@appmax_npm/ds-prime 1.0.0-alpha.143 → 1.0.0-alpha.144

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.
package/amtabs/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as _, mergeModels as p, ref as o, useModel as v, onMounted as b, openBlock as r, createElementBlock as u, Fragment as y, renderList as k, createBlock as V, withCtx as m, createVNode as T, createTextVNode as g, toDisplayString as x, createElementVNode as A, normalizeStyle as h } from "vue";
2
- import { _ as B } from "../AmText.vue_vue_type_script_setup_true_lang-yjw50cPR.js";
3
- import C from "../ambutton/index.js";
4
- import { _ as E } from "../_plugin-vue_export-helper-CHgC5LLL.js";
5
- const M = { name: "AmTabs" }, $ = /* @__PURE__ */ _({
6
- ...M,
1
+ import { defineComponent as b, mergeModels as p, ref as s, useModel as y, onMounted as g, openBlock as n, createElementBlock as f, Fragment as k, renderList as T, createBlock as V, withCtx as d, createVNode as h, createTextVNode as A, toDisplayString as x, createElementVNode as B, normalizeStyle as C } from "vue";
2
+ import { _ as E } from "../AmText.vue_vue_type_script_setup_true_lang-yjw50cPR.js";
3
+ import M from "../ambutton/index.js";
4
+ import { _ as S } from "../_plugin-vue_export-helper-CHgC5LLL.js";
5
+ const $ = { name: "AmTabs" }, w = /* @__PURE__ */ b({
6
+ ...$,
7
7
  props: /* @__PURE__ */ p({
8
8
  tabs: { default: () => [] },
9
9
  modelValue: {}
@@ -12,43 +12,47 @@ const M = { name: "AmTabs" }, $ = /* @__PURE__ */ _({
12
12
  modelModifiers: {}
13
13
  }),
14
14
  emits: ["update:modelValue"],
15
- setup(i) {
16
- const n = o(0), s = o(0), t = v(i, "modelValue"), a = o(null), f = async (e) => {
17
- t.value !== e && (t.value = e, c());
18
- }, c = () => {
19
- if (!a.value) return;
20
- const e = a.value.querySelectorAll(".am-tab")[t.value];
21
- e && (n.value = e.clientWidth, s.value = e.offsetLeft);
15
+ setup(u) {
16
+ const a = u, c = s(0), m = s(0), t = y(u, "modelValue"), l = s(null), v = async (e) => {
17
+ e < 0 || e >= a.tabs.length || t.value !== e && (t.value = e, i());
18
+ }, i = () => {
19
+ l.value && setTimeout(() => {
20
+ var r;
21
+ const e = (r = l.value) == null ? void 0 : r.querySelectorAll(".am-tab")[t.value];
22
+ e && (c.value = e.clientWidth, m.value = e.offsetLeft);
23
+ }, 0);
22
24
  };
23
- return b(c), (e, w) => (r(), u("div", {
25
+ return g(() => {
26
+ (t.value < 0 || t.value >= a.tabs.length) && (t.value = 0), i();
27
+ }), (e, r) => (n(), f("div", {
24
28
  ref_key: "parentElement",
25
- ref: a,
29
+ ref: l,
26
30
  class: "w-full flex items-center border-b border-gray-200 relative"
27
31
  }, [
28
- (r(!0), u(y, null, k(e.tabs, (d, l) => (r(), V(C, {
29
- "data-active": t.value === l,
30
- key: l,
32
+ (n(!0), f(k, null, T(a.tabs, (_, o) => (n(), V(M, {
33
+ "data-active": String(t.value.value === o),
34
+ key: o,
31
35
  class: "am-tab",
32
- onClick: (L) => f(l),
36
+ onClick: (L) => v(o),
33
37
  text: ""
34
38
  }, {
35
- default: m(() => [
36
- T(B, { class: "am-tab__label" }, {
37
- default: m(() => [
38
- g(x(d), 1)
39
+ default: d(() => [
40
+ h(E, { class: "am-tab__label" }, {
41
+ default: d(() => [
42
+ A(x(_), 1)
39
43
  ]),
40
44
  _: 2
41
45
  }, 1024)
42
46
  ]),
43
47
  _: 2
44
48
  }, 1032, ["data-active", "onClick"]))), 128)),
45
- A("span", {
46
- style: h({ scale: `${n.value} 1`, translate: `${s.value}px` }),
49
+ B("span", {
50
+ style: C({ transform: `translateX(${m.value}px) scaleX(${c.value})` }),
47
51
  class: "am-tab__line bg-primary-500 absolute left-0"
48
52
  }, null, 4)
49
53
  ], 512));
50
54
  }
51
- }), z = /* @__PURE__ */ E($, [["__scopeId", "data-v-81f00e50"]]);
55
+ }), z = /* @__PURE__ */ S(w, [["__scopeId", "data-v-1431ab61"]]);
52
56
  export {
53
57
  z as default
54
58
  };