mediacube-ui-v2 0.0.333 → 0.0.334

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
1
  {
2
2
  "catalogSchemaVersion": 2,
3
- "libraryVersion": "0.0.333",
3
+ "libraryVersion": "0.0.334",
4
4
  "packageName": "mediacube-ui-v2",
5
5
  "pathHash": "9b6f3b8016b22ac7",
6
6
  "componentCount": 76,
@@ -1,30 +1,30 @@
1
- import { defineComponent as Fe, useAttrs as Pe, ref as q, reactive as Ee, computed as l, watch as ze, openBlock as u, createElementBlock as p, withModifiers as C, normalizeStyle as oe, normalizeClass as le, createElementVNode as x, renderSlot as V, createBlock as g, unref as m, withCtx as k, createTextVNode as j, toDisplayString as F, createCommentVNode as d, mergeProps as M, Fragment as Le, createVNode as U } from "vue";
2
- import { IMask as Z, IMaskComponent as De } from "vue-imask";
3
- import { Spaces as Oe } from "../../../types/styles/Spaces.js";
4
- import { Directions as ne } from "../../../enums/ui/Directions2.js";
5
- import { useFieldErrors as Ie } from "../../../composables/useFieldErrors2.js";
6
- import { Autocomplete as He, InputTypes as i } from "../../../enums/Input2.js";
7
- import { useTextareaAutosize as Ke } from "@vueuse/core";
8
- import { ButtonSize as se, ButtonType as Re } from "../../../enums/ui/Button2.js";
9
- import { HorizontalAlignment as qe } from "../../../enums/ui/Alignment2.js";
1
+ import { defineComponent as ze, useAttrs as De, ref as q, reactive as Oe, computed as n, watch as Ie, openBlock as u, createElementBlock as p, withModifiers as V, normalizeStyle as ne, normalizeClass as se, createElementVNode as x, renderSlot as $, createBlock as g, unref as m, withCtx as k, createTextVNode as Z, toDisplayString as F, createCommentVNode as d, mergeProps as M, Fragment as He, createVNode as j } from "vue";
2
+ import { IMask as U, IMaskComponent as Ke } from "vue-imask";
3
+ import { Spaces as Re } from "../../../types/styles/Spaces.js";
4
+ import { Directions as ie } from "../../../enums/ui/Directions2.js";
5
+ import { useFieldErrors as qe } from "../../../composables/useFieldErrors2.js";
6
+ import { Autocomplete as Ze, InputTypes as s } from "../../../enums/Input2.js";
7
+ import { useTextareaAutosize as je } from "@vueuse/core";
8
+ import { ButtonSize as ue, ButtonType as Ue } from "../../../enums/ui/Button2.js";
9
+ import { HorizontalAlignment as We } from "../../../enums/ui/Alignment2.js";
10
10
  import { TitleVariations as W } from "../../../enums/Title2.js";
11
- import { Weights as je } from "../../../enums/ui/Weights2.js";
12
- import { useTheme as Ue } from "../../../composables/useTheme2.js";
11
+ import { Weights as Ye } from "../../../enums/ui/Weights2.js";
12
+ import { useTheme as Ge } from "../../../composables/useTheme2.js";
13
13
  import P from "../McTitle/McTitle.vue2.js";
14
14
  import '../../../assets/components/elements/McTooltip/index.css';import '../../../assets/components/elements/McSvgIcon/index.css';import '../../../assets/components/elements/McButton/index.css';import '../../../assets/components/elements/McTitle/index.css';/* empty css */
15
- import ie from "../McButton/McButton.vue2.js";
15
+ import ce from "../McButton/McButton.vue2.js";
16
16
  /* empty css */
17
- import ue from "../McSvgIcon/McSvgIcon.vue2.js";
17
+ import me from "../McSvgIcon/McSvgIcon.vue2.js";
18
18
  /* empty css */
19
- import Ze from "../McTooltip/McTooltip.vue2.js";
19
+ import Je from "../McTooltip/McTooltip.vue2.js";
20
20
  /* empty css */
21
- const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__main" }, Qe = { class: "mc-field-text__input-wrapper" }, Xe = ["value", "maxlength"], et = ["value"], tt = ["value", "type", "readonly", "maxlength"], at = {
21
+ const Qe = ["dir"], Xe = ["for"], et = ["for"], tt = { class: "mc-field-text__main" }, at = { class: "mc-field-text__input-wrapper" }, rt = ["value", "maxlength"], ot = ["value"], lt = ["value", "type", "readonly", "maxlength"], nt = {
22
22
  key: 0,
23
23
  class: "mc-field-text__right"
24
- }, rt = {
24
+ }, st = {
25
25
  key: 0,
26
26
  class: "mc-field-text__footer"
27
- }, ot = { key: 1 }, Nt = /* @__PURE__ */ Fe({
27
+ }, it = { key: 1 }, Mt = /* @__PURE__ */ ze({
28
28
  __name: "McFieldText",
29
29
  props: {
30
30
  /**
@@ -49,7 +49,7 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
49
49
  */
50
50
  type: {
51
51
  type: String,
52
- default: i.Text
52
+ default: s.Text
53
53
  },
54
54
  /**
55
55
  * Заголовок поля:
@@ -160,7 +160,7 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
160
160
  */
161
161
  autocomplete: {
162
162
  type: String,
163
- default: He.On
163
+ default: Ze.On
164
164
  },
165
165
  /**
166
166
  * только чтение текста
@@ -246,7 +246,7 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
246
246
  },
247
247
  dir: {
248
248
  type: String,
249
- default: ne.Ltr
249
+ default: ie.Ltr
250
250
  },
251
251
  width: {
252
252
  type: String,
@@ -272,341 +272,368 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
272
272
  }
273
273
  },
274
274
  emits: ["update:modelValue", "keydown", "copy"],
275
- setup(f, { emit: ce }) {
276
- const { textarea: lt } = Ke(), E = ce, z = Pe(), t = f, Y = Ue("fieldText"), A = q(t.type), h = Ee({
275
+ setup(f, { emit: de }) {
276
+ const { textarea: ut } = je(), E = de, L = De(), a = f, Y = Ge("fieldText"), A = q(a.type), h = Oe({
277
277
  name: "copy",
278
278
  color: "black"
279
- }), y = Ie(t.errors), me = q(!1), _ = q(null), L = l(() => t.dir === ne.Rtl), de = l(() => ({
279
+ }), v = qe(a.errors), pe = q(!1), _ = q(null), z = n(() => a.dir === ie.Rtl), fe = n(() => ({
280
280
  "mc-field-text": !0,
281
- "mc-field-text--error": !!y.errorText.value,
281
+ "mc-field-text--error": !!v.errorText.value,
282
282
  "mc-field-text--textarea": b.value,
283
283
  "mc-field-text--textarea-autosize": w.value,
284
- "mc-field-text--disabled": t.disabled,
285
- "mc-field-text--copy": t.copy,
286
- "mc-field-text--rtl": L.value
287
- })), pe = l(() => ({
284
+ "mc-field-text--disabled": a.disabled,
285
+ "mc-field-text--copy": a.copy,
286
+ "mc-field-text--rtl": z.value
287
+ })), ye = n(() => ({
288
288
  "--mc-field-text-color": Y.colors[Y.component.color],
289
- "--mc-field-text-width": t.width
290
- })), fe = l(() => `${t.title}${t.required ? " *" : ""}`), D = l(() => A.value === i.Date), ye = l(() => !!t.mask || !!t.maskOptions || D.value), b = l(() => t.type === i.Textarea), w = l(() => t.type === i.TextareaAutosize), ve = l(() => {
291
- const e = Math.max(t.minHeight, 40), a = Math.max(t.maxHeight, e);
289
+ "--mc-field-text-width": a.width
290
+ })), ve = n(() => `${a.title}${a.required ? " *" : ""}`), D = n(() => A.value === s.Date), ge = n(() => !!a.mask || !!a.maskOptions || D.value), b = n(() => a.type === s.Textarea), w = n(() => a.type === s.TextareaAutosize), he = n(() => {
291
+ const e = Math.max(a.minHeight, 40), t = Math.max(a.maxHeight, e);
292
292
  return {
293
293
  "--textarea-autosize-min-height": `${e}px`,
294
- "--textarea-autosize-max-height": t.maxHeight ? `${a}px` : "auto"
294
+ "--textarea-autosize-max-height": a.maxHeight ? `${t}px` : "auto"
295
295
  };
296
- }), G = l(() => t.type === i.Password), ge = l(() => t.type === i.AmountFormat), O = l(() => !!t.maxLength && (b.value || w.value)), I = l(() => A.value === i.Password), he = l(() => I.value ? "visibility_off" : "visibility"), J = l(() => t.modelValue ? String(t.modelValue).length : 0), xe = l(() => `${J.value}/${t.maxLength}`), ke = l(() => t.maxLength < +J.value ? "red" : "dark-gray"), _e = l(() => ({
296
+ }), G = n(() => a.type === s.Password), xe = n(() => a.type === s.AmountFormat), O = n(() => !!a.maxLength && (b.value || w.value)), I = n(() => A.value === s.Password), ke = n(() => I.value ? "visibility_off" : "visibility"), J = n(() => a.modelValue ? String(a.modelValue).length : 0), _e = n(() => `${J.value}/${a.maxLength}`), be = n(() => a.maxLength < +J.value ? "red" : "dark-gray"), we = n(() => ({
297
297
  mask: Date,
298
298
  autofix: !0,
299
299
  blocks: {
300
300
  d: {
301
- mask: Z.MaskedRange,
302
- placeholderChar: t.dateMaskPlaceholder.date || "d",
301
+ mask: U.MaskedRange,
302
+ placeholderChar: a.dateMaskPlaceholder.date || "d",
303
303
  from: 1,
304
304
  to: 31,
305
305
  maxLength: 2
306
306
  },
307
307
  m: {
308
- mask: Z.MaskedRange,
309
- placeholderChar: t.dateMaskPlaceholder.month || "m",
308
+ mask: U.MaskedRange,
309
+ placeholderChar: a.dateMaskPlaceholder.month || "m",
310
310
  from: 1,
311
311
  to: 12,
312
312
  maxLength: 2
313
313
  },
314
314
  Y: {
315
- mask: Z.MaskedRange,
316
- placeholderChar: t.dateMaskPlaceholder.year || "y",
315
+ mask: U.MaskedRange,
316
+ placeholderChar: a.dateMaskPlaceholder.year || "y",
317
317
  from: 1900,
318
318
  to: 2999,
319
319
  maxLength: 4
320
320
  }
321
321
  }
322
- })), be = l(() => ({
322
+ })), Se = n(() => ({
323
323
  ...T.value,
324
- mask: t.mask,
324
+ mask: a.mask,
325
325
  lazy: !1,
326
326
  overwrite: !1,
327
- unmask: t.clearOutput,
327
+ unmask: a.clearOutput,
328
328
  definitions: {
329
329
  "#": /./
330
330
  },
331
- readonly: t.readOnly,
332
- maxlength: t.maxLength,
331
+ readonly: a.readOnly,
332
+ maxlength: a.maxLength,
333
333
  type: "tel",
334
- ...z,
335
- ...t.maskOptions ?? {},
336
- ...D.value ? _e.value : {}
337
- })), v = l({
334
+ ...L,
335
+ ...a.maskOptions ?? {},
336
+ ...D.value ? we.value : {}
337
+ })), y = n({
338
338
  get() {
339
- return ge.value && !L.value ? re(String(t.modelValue)) : t.modelValue;
339
+ return xe.value && !z.value ? le(String(a.modelValue)) : a.modelValue;
340
340
  },
341
341
  set(e) {
342
- y.toggleErrorVisible(), E("update:modelValue", e);
342
+ v.toggleErrorVisible(), E("update:modelValue", e);
343
343
  }
344
344
  }), B = (e) => {
345
- v.value = Se(e);
346
- }, S = l(() => t.type === i.AmountFormat || t.type === i.Num), T = l(() => ({
347
- style: we.value,
348
- placeholder: t.placeholder,
349
- disabled: t.disabled,
350
- name: t.name,
351
- "field-id": t.name,
352
- autocomplete: t.autocomplete,
353
- tabindex: t.tabindex,
354
- ...z,
355
- class: ["mc-field-text__input", z.class || ""].join(" ")
356
- })), we = l(() => {
345
+ y.value = Ce(e);
346
+ }, S = n(() => a.type === s.AmountFormat || a.type === s.Num), T = n(() => ({
347
+ style: Te.value,
348
+ placeholder: a.placeholder,
349
+ disabled: a.disabled,
350
+ name: a.name,
351
+ "field-id": a.name,
352
+ autocomplete: a.autocomplete,
353
+ tabindex: a.tabindex,
354
+ ...L,
355
+ class: ["mc-field-text__input", L.class || ""].join(" ")
356
+ })), Te = n(() => {
357
357
  let e = {};
358
358
  if (b.value || w.value) {
359
- const a = O.value ? "400" : "150", r = Oe[a];
359
+ const t = O.value ? "400" : "150", r = Re[t];
360
360
  e = { paddingBottom: `${parseInt(r) - 1}px` };
361
361
  }
362
362
  return {
363
363
  ...!b.value && !w.value ? { boxSizing: "border-box" } : {},
364
364
  ...e
365
365
  };
366
- }), Q = (e) => {
367
- if (e && t.maxDecimals) {
368
- const [a, r] = e.split(".");
369
- if (r?.length > t.maxDecimals)
370
- return `${a}.${r.slice(0, t.maxDecimals)}`;
366
+ }), H = (e) => {
367
+ if (e && a.maxDecimals) {
368
+ const [t, r] = e.split(".");
369
+ if (r?.length > a.maxDecimals)
370
+ return `${t}.${r.slice(0, a.maxDecimals)}`;
371
371
  }
372
372
  return e;
373
- }, H = (e) => {
374
- if (!t.removeLeadingZero) return e;
375
- let a = e;
376
- const [r] = e || [];
377
- return e.length > 1 && +r == 0 && e.indexOf(".") === -1 && (a = e.slice(1)), a;
378
- }, Se = (e) => {
379
- if (!e) return t.modelValue;
380
- const a = e.target;
381
- let r = D.value && a && a.value ? a.value?.substring(0, 10) : a.value;
382
- const { start: o } = Ve(a);
383
- let n = K(r);
384
- switch (t.type) {
385
- case i.Num: {
386
- const s = r?.replace(/,/g, ".")?.replace(/ /g, "");
387
- let [c] = /-?\d*[\.]?\d*/.exec(String(s)) || [];
388
- c = Q(c), c = H(c), r = String(c), a.value = String(c);
373
+ }, Q = (e) => {
374
+ if (!a.removeLeadingZero) return e;
375
+ const t = e.startsWith("-"), r = t ? e.slice(1) : e, [o] = r || [];
376
+ return r.length > 1 && +o == 0 && r.indexOf(".") === -1 ? (t ? "-" : "") + r.slice(1) : e;
377
+ }, Ne = (e) => {
378
+ if (!e || e.length <= 1) return e;
379
+ const t = e.startsWith("-"), r = t ? e.slice(1) : e;
380
+ if (r.indexOf(".") !== -1) {
381
+ const [l, i] = r.split("."), c = l.replace(/^0+/, "") || "0";
382
+ return `${t ? "-" : ""}${c}.${i}`;
383
+ }
384
+ const o = r.replace(/^0+/, "") || "0";
385
+ return t ? `-${o}` : o;
386
+ }, X = (e) => {
387
+ const t = e.inputType;
388
+ return typeof t == "string" && t.startsWith("delete");
389
+ }, ee = (e, t, r, o) => {
390
+ const l = X(t) ? e : Q(e);
391
+ if (r.value !== l && (r.value = l, Number.isFinite(o))) {
392
+ const i = e.length - l.length, c = Math.max(0, o - Math.max(0, i));
393
+ N(r, c, c);
394
+ }
395
+ return l;
396
+ }, Ce = (e) => {
397
+ if (!e) return a.modelValue;
398
+ const t = e.target;
399
+ let r = D.value && t && t.value ? t.value?.substring(0, 10) : t.value;
400
+ const { start: o } = Ae(t);
401
+ let l = K(r);
402
+ switch (a.type) {
403
+ case s.Num: {
404
+ const i = r?.replace(/,/g, ".")?.replace(/ /g, "");
405
+ let [c] = /-?\d*[\.]?\d*/.exec(String(i)) || [];
406
+ c = H(c), r = ee(String(H(c ?? "") ?? ""), e, t, o);
389
407
  break;
390
408
  }
391
- case i.Int: {
392
- let [s] = /-?\d*/.exec(String(a.value)) || [];
393
- s = H(s), r = String(s), a.value = String(s);
409
+ case s.Int: {
410
+ let [i] = /-?\d*/.exec(String(t.value)) || [];
411
+ r = ee(String(i ?? ""), e, t, o);
394
412
  break;
395
413
  }
396
- case i.AmountFormat: {
397
- r = r?.replace(/,/g, ".")?.replace(/ /g, ""), r = Q(r), r = H(r), n = K(r);
398
- const s = parseFloat(n), c = n.replace(/ /gm, "");
399
- r = n ? String(s) === c ? s : c || s || n : null;
400
- const N = re(n);
401
- a.value = L.value ? N.replace(/ /gm, "") : N;
402
- const $e = a.value?.slice(0, o).replace(/[^ ]/gm, "")?.length || 0, R = o + $e;
403
- Number.isFinite(o) && Number.isFinite(R) && $(a, R, R);
414
+ case s.AmountFormat: {
415
+ r = r?.replace(/,/g, ".")?.replace(/ /g, ""), r = H(r), X(e) || (r = Q(r)), l = K(r);
416
+ const i = parseFloat(l), c = l.replace(/ /gm, "");
417
+ r = l ? String(i) === c ? i : c || i || l : null;
418
+ const C = le(l);
419
+ t.value = z.value ? C.replace(/ /gm, "") : C;
420
+ const Le = t.value?.slice(0, o).replace(/[^ ]/gm, "")?.length || 0, R = o + Le;
421
+ Number.isFinite(o) && Number.isFinite(R) && N(t, R, R);
404
422
  break;
405
423
  }
406
- case i.Uppercase: {
407
- r = r?.toUpperCase(), a.value = r, Number.isFinite(o) && $(a, o, o);
424
+ case s.Uppercase: {
425
+ r = r?.toUpperCase(), t.value = r, Number.isFinite(o) && N(t, o, o);
408
426
  break;
409
427
  }
410
- case i.Lowercase: {
411
- r = r?.toLowerCase(), a.value = r, Number.isFinite(o) && $(a, o, o);
428
+ case s.Lowercase: {
429
+ r = r?.toLowerCase(), t.value = r, Number.isFinite(o) && N(t, o, o);
412
430
  break;
413
431
  }
414
- case i.Password:
415
- r = r?.replace(/ /gm, ""), a.value = r, Number.isFinite(o) && $(a, o, o);
432
+ case s.Password:
433
+ r = r?.replace(/ /gm, ""), t.value = r, Number.isFinite(o) && N(t, o, o);
416
434
  break;
417
- case i.PhoneNumber:
418
- r.length === 0 && (r = "+"), r.charAt(0) !== "+" && (r = "+" + r), r = r.replace(/(?!^)\D/g, ""), a.value = r;
435
+ case s.PhoneNumber:
436
+ r.length === 0 && (r = "+"), r.charAt(0) !== "+" && (r = "+" + r), r = r.replace(/(?!^)\D/g, ""), t.value = r;
419
437
  break;
420
438
  }
421
439
  return r;
422
- }, Te = (e) => "key" in e, X = (e) => {
423
- const a = _.value;
424
- !e || !a || t.allowEmpty || !S.value || (e.preventDefault(), a.value = "0", v.value = "0", ae(a, 1, 1));
425
- }, ee = (e) => {
426
- const a = _.value;
427
- if (!e || !a || t.allowEmpty || !S.value) return;
428
- const r = e.type === "paste", o = Te(e), n = o && (e.metaKey || e.ctrlKey), s = o && (e.key === "Delete" || e.key === "Backspace");
429
- ((s || r) && a.value.length <= 1 || s && n) && X(e);
430
- }, Ne = (e) => {
440
+ }, Ve = (e) => "key" in e, te = (e) => {
441
+ const t = _.value;
442
+ !e || !t || a.allowEmpty || !S.value || (e.preventDefault(), t.value = "0", y.value = "0", oe(t, 1, 1));
443
+ }, ae = (e) => {
444
+ const t = _.value;
445
+ if (!e || !t || a.allowEmpty || !S.value) return;
446
+ const r = e.type === "paste", o = Ve(e), l = o && (e.metaKey || e.ctrlKey), i = o && (e.key === "Delete" || e.key === "Backspace");
447
+ ((i || r) && t.value.length <= 1 || i && l) && te(e);
448
+ }, $e = (e) => {
431
449
  if (!e || !_.value) return;
432
- const a = e.target;
433
- !t.allowEmpty && a.value.length < 1 && S.value && X(e);
434
- }, Ce = (e) => {
435
- !e || !_.value || !t.allowEmpty && S.value && ee(e);
436
- }, te = (e) => {
437
- switch (t.type) {
438
- case i.AmountFormat:
439
- case i.Num: {
440
- me.value = !!e.key?.match(/Backspace/);
441
- const a = e.code?.match(/Space/), r = [".", ","];
442
- t.allowNegative && r.push("-");
443
- const o = r.includes(e.key), n = e.metaKey || e.ctrlKey, s = e.key?.match(/Arrow|Backspace|\.,/);
444
- !t.allowEmpty && S.value && ee(e), (isNaN(+e.key) && !s && !o && !n || a) && e.preventDefault();
445
- const c = typeof t.modelValue == "string" && r.some((N) => String(t.modelValue)?.includes(N));
446
- o && c && e.preventDefault();
450
+ const t = e.target;
451
+ !a.allowEmpty && t.value.length < 1 && S.value && te(e);
452
+ }, Me = (e) => {
453
+ !e || !_.value || !a.allowEmpty && S.value && ae(e);
454
+ }, re = (e) => {
455
+ switch (a.type) {
456
+ case s.AmountFormat:
457
+ case s.Num: {
458
+ pe.value = !!e.key?.match(/Backspace/);
459
+ const t = e.code?.match(/Space/), r = [".", ","];
460
+ a.allowNegative && r.push("-");
461
+ const o = r.includes(e.key), l = e.metaKey || e.ctrlKey, i = e.key?.match(/Arrow|Backspace|\.,/);
462
+ !a.allowEmpty && S.value && ae(e), (isNaN(+e.key) && !i && !o && !l || t) && e.preventDefault();
463
+ const c = e.key === "-" ? /-/ : /[.,]/, C = typeof a.modelValue == "string" && c.test(a.modelValue);
464
+ o && C && e.preventDefault();
447
465
  break;
448
466
  }
449
467
  }
450
468
  E("keydown", e);
451
469
  }, K = (e) => {
452
470
  if (!e) return e;
453
- const [a] = /-?\d*[\.]?\d*/.exec(String(e)?.replace(/ /gm, "")?.trim()) || [];
454
- return a;
455
- }, ae = (e, a, r) => {
471
+ const [t] = /-?\d*[\.]?\d*/.exec(String(e)?.replace(/ /gm, "")?.trim()) || [];
472
+ return t;
473
+ }, oe = (e, t, r) => {
456
474
  if (!e.setSelectionRange) return;
457
- let o = Number(a), n = Number(r);
458
- if (!Number.isFinite(o) || !Number.isFinite(n)) return;
459
- const s = e.value.length;
460
- if (o = Math.max(0, Math.min(o, s)), n = Math.max(0, Math.min(n, s)), !(e.selectionStart === o && e.selectionEnd === n))
475
+ let o = Number(t), l = Number(r);
476
+ if (!Number.isFinite(o) || !Number.isFinite(l)) return;
477
+ const i = e.value.length;
478
+ if (o = Math.max(0, Math.min(o, i)), l = Math.max(0, Math.min(l, i)), !(e.selectionStart === o && e.selectionEnd === l))
461
479
  try {
462
- typeof document < "u" && document.activeElement !== e && e.focus(), e.setSelectionRange(o, n);
480
+ typeof document < "u" && document.activeElement !== e && e.focus(), e.setSelectionRange(o, l);
463
481
  } catch {
464
482
  }
465
- }, $ = (e, a, r) => {
466
- const o = () => ae(e, a, r);
483
+ }, N = (e, t, r) => {
484
+ const o = () => oe(e, t, r);
467
485
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(o) : o();
468
- }, Ve = (e) => typeof e.selectionStart == "number" && typeof e.selectionEnd == "number" ? { start: e.selectionStart, end: e.selectionEnd } : { start: 0, end: 0 }, re = (e) => {
469
- const a = K(e), r = !!String(a)?.match(/\./), [o, n] = String(a).replace(/[^\d\.-]/g, "").replace(/\B(?=(?:\d{3})+(?!\d))/g, " ").split("."), s = [o, n?.replace(/ /gm, "") || ""];
470
- return r ? s.join(".") : s.filter((c) => !!c).join(".");
471
- }, Me = () => {
486
+ }, Ae = (e) => typeof e.selectionStart == "number" && typeof e.selectionEnd == "number" ? { start: e.selectionStart, end: e.selectionEnd } : { start: 0, end: 0 }, le = (e) => {
487
+ const t = K(e), r = !!String(t)?.match(/\./), [o, l] = String(t).replace(/[^\d\.-]/g, "").replace(/\B(?=(?:\d{3})+(?!\d))/g, " ").split("."), i = [o, l?.replace(/ /gm, "") || ""];
488
+ return r ? i.join(".") : i.filter((c) => !!c).join(".");
489
+ }, Be = () => {
472
490
  try {
473
- navigator.clipboard.writeText(t.modelValue), h.name = "check", h.color = "green", setTimeout(() => {
491
+ navigator.clipboard.writeText(a.modelValue), h.name = "check", h.color = "green", setTimeout(() => {
474
492
  h.name = "copy", h.color = "black";
475
493
  }, 2e3);
476
494
  } catch (e) {
477
495
  console.error("error while copy with navigator", e);
478
496
  }
479
- E("copy", t.modelValue);
480
- }, Ae = () => {
481
- A.value = I.value ? i.Text : i.Password;
497
+ E("copy", a.modelValue);
498
+ }, Fe = () => {
499
+ A.value = I.value ? s.Text : s.Password;
482
500
  };
483
- ze(
484
- () => t.errors,
501
+ Ie(
502
+ () => a.errors,
485
503
  (e) => {
486
- y.setError(e);
504
+ v.setError(e);
487
505
  }
488
506
  );
489
- const Be = (e) => {
507
+ const Pe = (e) => {
490
508
  if (!e) return;
491
- const a = e.target;
492
- if (!a) return;
493
- if (!["input", "textarea"].includes(a.tagName?.toLowerCase())) {
494
- const o = a.closest(".mc-field-text");
509
+ const t = e.target;
510
+ if (!t) return;
511
+ if (!["input", "textarea"].includes(t.tagName?.toLowerCase())) {
512
+ const o = t.closest(".mc-field-text");
495
513
  if (!o) return;
496
- const n = o.querySelector(".mc-field-text__input");
497
- if (!n) return;
498
- n.focus();
514
+ const l = o.querySelector(".mc-field-text__input");
515
+ if (!l) return;
516
+ l.focus();
517
+ }
518
+ }, Ee = () => {
519
+ if (a.removeLeadingZero) {
520
+ const e = [s.Int, s.Num, s.AmountFormat].includes(a.type), t = String(a.modelValue ?? "");
521
+ if (e && t) {
522
+ const r = Ne(t);
523
+ r !== t && (y.value = r);
524
+ }
499
525
  }
500
526
  };
501
- return (e, a) => (u(), p("div", {
502
- dir: t.dir,
503
- class: le(de.value),
504
- style: oe(pe.value),
505
- onClick: C(Be, ["stop"])
527
+ return (e, t) => (u(), p("div", {
528
+ dir: a.dir,
529
+ class: se(fe.value),
530
+ style: ne(ye.value),
531
+ onClick: V(Pe, ["stop"])
506
532
  }, [
507
533
  x("label", {
508
534
  for: f.name,
509
535
  class: "mc-field-text__header"
510
536
  }, [
511
- V(e.$slots, "header", {}, () => [
537
+ $(e.$slots, "header", {}, () => [
512
538
  f.title ? (u(), g(P, {
513
539
  key: 0,
514
540
  "max-width": "100%",
515
- weight: m(je).Medium
541
+ weight: m(Ye).Medium
516
542
  }, {
517
543
  default: k(() => [
518
- j(F(fe.value), 1)
544
+ Z(F(ve.value), 1)
519
545
  ]),
520
546
  _: 1
521
547
  }, 8, ["weight"])) : d("", !0)
522
548
  ])
523
- ], 8, Ye),
549
+ ], 8, Xe),
524
550
  x("label", {
525
551
  for: f.name,
526
552
  class: "mc-field-text__inner"
527
553
  }, [
528
- x("div", Je, [
554
+ x("div", tt, [
529
555
  e.$slots.prepend ? (u(), p("div", {
530
556
  key: 0,
531
557
  class: "mc-field-text__prepend",
532
- onClick: a[0] || (a[0] = C(() => {
558
+ onClick: t[0] || (t[0] = V(() => {
533
559
  }, ["stop"]))
534
560
  }, [
535
- V(e.$slots, "prepend")
561
+ $(e.$slots, "prepend")
536
562
  ])) : d("", !0),
537
- x("div", Qe, [
563
+ x("div", at, [
538
564
  b.value ? (u(), p("textarea", M({
539
565
  key: 0,
540
- value: v.value
566
+ value: y.value
541
567
  }, T.value, {
542
568
  maxlength: f.maxLength,
543
569
  rows: "1",
544
570
  onInput: B
545
- }), null, 16, Xe)) : w.value ? (u(), p("div", {
571
+ }), null, 16, rt)) : w.value ? (u(), p("div", {
546
572
  key: 1,
547
573
  class: "mc-field-text--textarea-autosize_wrapper",
548
- style: oe(ve.value)
574
+ style: ne(he.value)
549
575
  }, [
550
- x("span", M({ class: "mc-field-text--textarea-autosize_backdrop-cover" }, T.value), F(v.value), 17),
551
- x("textarea", M({ value: v.value }, T.value, { onInput: B }), null, 16, et)
552
- ], 4)) : (u(), p(Le, { key: 2 }, [
553
- ye.value ? (u(), g(m(De), M({
576
+ x("span", M({ class: "mc-field-text--textarea-autosize_backdrop-cover" }, T.value), F(y.value), 17),
577
+ x("textarea", M({ value: y.value }, T.value, { onInput: B }), null, 16, ot)
578
+ ], 4)) : (u(), p(He, { key: 2 }, [
579
+ ge.value ? (u(), g(m(Ke), M({
554
580
  key: 0,
555
- value: v.value
556
- }, be.value, {
557
- onKeydown: te,
558
- "onUpdate:modelValue": a[1] || (a[1] = (r, o) => B(o))
581
+ value: y.value
582
+ }, Se.value, {
583
+ onKeydown: re,
584
+ "onUpdate:modelValue": t[1] || (t[1] = (r, o) => B(o))
559
585
  }), null, 16, ["value"])) : (u(), p("input", M({
560
586
  key: 1,
561
587
  ref_key: "input",
562
588
  ref: _,
563
- value: v.value
589
+ value: y.value
564
590
  }, T.value, {
565
591
  type: A.value,
566
- readonly: t.readOnly,
592
+ readonly: a.readOnly,
567
593
  maxlength: f.maxLength,
568
- onKeydown: te,
569
- onKeyup: Ne,
594
+ onKeydown: re,
595
+ onKeyup: $e,
570
596
  onInput: B,
571
- onPaste: Ce
572
- }), null, 16, tt))
597
+ onPaste: Me,
598
+ onBlur: Ee
599
+ }), null, 16, lt))
573
600
  ], 64))
574
601
  ]),
575
602
  e.$slots.append || f.copy || G.value ? (u(), p("div", {
576
603
  key: 1,
577
- class: le(["mc-field-text__append", { "mc-field-text__append--indent-bottom": O.value }]),
578
- onClick: a[2] || (a[2] = C(() => {
604
+ class: se(["mc-field-text__append", { "mc-field-text__append--indent-bottom": O.value }]),
605
+ onClick: t[2] || (t[2] = V(() => {
579
606
  }, ["stop"]))
580
607
  }, [
581
- V(e.$slots, "append"),
582
- f.copy ? (u(), g(ie, {
608
+ $(e.$slots, "append"),
609
+ f.copy ? (u(), g(ce, {
583
610
  key: 0,
584
611
  variation: "black-link",
585
- size: m(se).MCompact,
586
- onClick: C(Me, ["stop", "prevent"])
612
+ size: m(ue).MCompact,
613
+ onClick: V(Be, ["stop", "prevent"])
587
614
  }, {
588
615
  "icon-append": k(() => [
589
- U(ue, {
616
+ j(me, {
590
617
  name: h.name,
591
618
  color: h.color
592
619
  }, null, 8, ["name", "color"])
593
620
  ]),
594
621
  _: 1
595
622
  }, 8, ["size"])) : d("", !0),
596
- G.value ? (u(), g(Ze, {
623
+ G.value ? (u(), g(Je, {
597
624
  key: 1,
598
- content: I.value ? t.passwordTooltip : t.passwordHideTooltip || t.passwordTooltip
625
+ content: I.value ? a.passwordTooltip : a.passwordHideTooltip || a.passwordTooltip
599
626
  }, {
600
627
  default: k(() => [
601
- U(ie, {
628
+ j(ce, {
602
629
  variation: "black-link",
603
- size: m(se).MCompact,
630
+ size: m(ue).MCompact,
604
631
  tabindex: "-1",
605
- type: m(Re).Button,
606
- onClick: C(Ae, ["stop", "prevent"])
632
+ type: m(Ue).Button,
633
+ onClick: V(Fe, ["stop", "prevent"])
607
634
  }, {
608
635
  "icon-append": k(() => [
609
- U(ue, { name: he.value }, null, 8, ["name"])
636
+ j(me, { name: ke.value }, null, 8, ["name"])
610
637
  ]),
611
638
  _: 1
612
639
  }, 8, ["size", "type"])
@@ -618,31 +645,31 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
618
645
  key: 2,
619
646
  class: "mc-field-text__char-counter",
620
647
  variation: m(W).Overline,
621
- "text-align": m(qe).Right,
622
- color: ke.value
648
+ "text-align": m(We).Right,
649
+ color: be.value
623
650
  }, {
624
651
  default: k(() => [
625
- j(F(xe.value), 1)
652
+ Z(F(_e.value), 1)
626
653
  ]),
627
654
  _: 1
628
655
  }, 8, ["variation", "text-align", "color"])) : d("", !0)
629
656
  ]),
630
- e.$slots.right ? (u(), p("div", at, [
631
- V(e.$slots, "right")
657
+ e.$slots.right ? (u(), p("div", nt, [
658
+ $(e.$slots, "right")
632
659
  ])) : d("", !0)
633
- ], 8, Ge),
634
- m(y).errorText.value || t.helpText || e.$slots.footer ? (u(), p("div", rt, [
635
- m(y).errorText.value ? (u(), g(P, {
660
+ ], 8, et),
661
+ m(v).errorText.value || a.helpText || e.$slots.footer ? (u(), p("div", st, [
662
+ m(v).errorText.value ? (u(), g(P, {
636
663
  key: 0,
637
664
  "tag-name": "div",
638
665
  color: "red",
639
666
  variation: m(W).Overline,
640
667
  class: "mc-field-text__error-text",
641
- "html-data": m(y).errorText.value
668
+ "html-data": m(v).errorText.value
642
669
  }, null, 8, ["variation", "html-data"])) : d("", !0),
643
- m(y).errorText.value ? (u(), p("br", ot)) : d("", !0),
644
- V(e.$slots, "footer", {}, () => [
645
- t.helpText ? (u(), g(P, {
670
+ m(v).errorText.value ? (u(), p("br", it)) : d("", !0),
671
+ $(e.$slots, "footer", {}, () => [
672
+ a.helpText ? (u(), g(P, {
646
673
  key: 0,
647
674
  "tag-name": "div",
648
675
  variation: m(W).Overline,
@@ -650,15 +677,15 @@ const We = ["dir"], Ye = ["for"], Ge = ["for"], Je = { class: "mc-field-text__ma
650
677
  "max-width": "100%"
651
678
  }, {
652
679
  default: k(() => [
653
- j(F(t.helpText), 1)
680
+ Z(F(a.helpText), 1)
654
681
  ]),
655
682
  _: 1
656
683
  }, 8, ["variation"])) : d("", !0)
657
684
  ])
658
685
  ])) : d("", !0)
659
- ], 14, We));
686
+ ], 14, Qe));
660
687
  }
661
688
  });
662
689
  export {
663
- Nt as default
690
+ Mt as default
664
691
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui-v2",
3
- "version": "0.0.333",
3
+ "version": "0.0.334",
4
4
  "license": "MIT",
5
5
  "description": "Design system for Mediacube services",
6
6
  "sideEffects": [