mediacube-ui-v2 0.0.328 → 0.0.329

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.328",
3
+ "libraryVersion": "0.0.329",
4
4
  "packageName": "mediacube-ui-v2",
5
5
  "pathHash": "9b6f3b8016b22ac7",
6
6
  "componentCount": 76,
@@ -1,6 +1,6 @@
1
- import { defineComponent as y, inject as S, useAttrs as g, ref as u, computed as t, onMounted as A, withDirectives as x, openBlock as T, createElementBlock as P, renderSlot as k, createCommentVNode as B, vShow as D } from "vue";
2
- import { useTheme as w } from "../../../composables/useTheme2.js";
3
- const M = ["id", "aria-hidden", "href", "to"], j = /* @__PURE__ */ y({
1
+ import { defineComponent as S, inject as u, useAttrs as A, ref as d, computed as t, onMounted as T, onBeforeUnmount as x, withDirectives as B, openBlock as M, createElementBlock as P, renderSlot as k, createCommentVNode as D, vShow as w } from "vue";
2
+ import { useTheme as N } from "../../../composables/useTheme2.js";
3
+ const U = ["id", "aria-hidden", "href", "to"], I = /* @__PURE__ */ S({
4
4
  __name: "McTab",
5
5
  props: {
6
6
  /**
@@ -101,18 +101,19 @@ const M = ["id", "aria-hidden", "href", "to"], j = /* @__PURE__ */ y({
101
101
  }
102
102
  },
103
103
  setup(n) {
104
- const i = S("selfRegisterTabMethod", () => {
105
- }), r = g(), e = n, l = w("tab"), o = u(!1), s = u(!0), p = t(() => e.appendCountColor || l.component.count), d = t(() => e.id ? e.id : e.name.toLowerCase().replace(/ /g, "-")), c = t(() => e.isDisabled ? "#" : `#${d.value}`), f = t(() => !!e.appendCount || e.appendCount === 0), C = t(() => `--mc-tab-append-count-color: ${l.colors[p.value]}`), m = t(() => [e.prefix, e.name, e.suffix].filter(Boolean).join("")), h = t(() => e.visible ? m.value : "");
106
- A(() => {
107
- if (i) {
108
- const a = {
104
+ const r = u("selfRegisterTabMethod", () => {
105
+ }), c = u("selfUnregisterTabMethod", () => {
106
+ }), l = A(), e = n, p = N("tab"), o = d(!1), f = d(!0), s = t(() => e.appendCountColor || p.component.count), a = t(() => e.id ? e.id : e.name.toLowerCase().replace(/ /g, "-")), m = t(() => e.isDisabled ? "#" : `#${a.value}`), C = t(() => !!e.appendCount || e.appendCount === 0), b = t(() => `--mc-tab-append-count-color: ${p.colors[s.value]}`), h = t(() => [e.prefix, e.name, e.suffix].filter(Boolean).join("")), v = t(() => e.visible ? h.value : "");
107
+ T(() => {
108
+ if (r) {
109
+ const i = {
109
110
  isActive: o.value,
110
- isVisible: s.value,
111
- computedId: d.value,
112
- hash: c.value,
113
- hasAppendCount: f.value,
114
- appendCountStyles: C.value,
115
- header: h.value,
111
+ isVisible: f.value,
112
+ computedId: a.value,
113
+ hash: m.value,
114
+ hasAppendCount: C.value,
115
+ appendCountStyles: b.value,
116
+ header: v.value,
116
117
  id: e.id,
117
118
  name: e.name,
118
119
  to: e.to,
@@ -123,24 +124,26 @@ const M = ["id", "aria-hidden", "href", "to"], j = /* @__PURE__ */ y({
123
124
  iconPrepend: e.iconPrepend,
124
125
  visible: e.visible,
125
126
  isDisabled: e.isDisabled,
126
- appendCountColor: p.value,
127
+ appendCountColor: s.value,
127
128
  appendCount: e.appendCount,
128
129
  suffix: e.suffix,
129
130
  prefix: e.prefix,
130
- showTab: v,
131
- hideTab: b,
132
- onClick: r.onClick,
133
- ...r
131
+ showTab: y,
132
+ hideTab: g,
133
+ onClick: l.onClick,
134
+ ...l
134
135
  };
135
- i(a);
136
+ r(i);
136
137
  }
138
+ }), x(() => {
139
+ c(a.value);
137
140
  });
138
- const v = () => {
141
+ const y = () => {
139
142
  o.value = !0;
140
- }, b = () => {
143
+ }, g = () => {
141
144
  o.value = !1;
142
145
  };
143
- return (a, N) => x((T(), P("section", {
146
+ return (i, V) => B((M(), P("section", {
144
147
  id: n.id,
145
148
  "aria-hidden": !o.value,
146
149
  class: "tabs-component-panel",
@@ -148,12 +151,12 @@ const M = ["id", "aria-hidden", "href", "to"], j = /* @__PURE__ */ y({
148
151
  href: n.href,
149
152
  to: n.to
150
153
  }, [
151
- n.visible ? k(a.$slots, "default", { key: 0 }) : B("", !0)
152
- ], 8, M)), [
153
- [D, o.value]
154
+ n.visible ? k(i.$slots, "default", { key: 0 }) : D("", !0)
155
+ ], 8, U)), [
156
+ [w, o.value]
154
157
  ]);
155
158
  }
156
159
  });
157
160
  export {
158
- j as default
161
+ I as default
159
162
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as P, defineAsyncComponent as d, inject as j, ref as F, computed as c, onMounted as K, onUpdated as O, watch as R, nextTick as $, provide as L, openBlock as a, createElementBlock as u, normalizeStyle as U, normalizeClass as _, createElementVNode as i, createVNode as W, unref as l, withCtx as q, Fragment as G, renderList as H, withDirectives as J, createBlock as m, createCommentVNode as f, toDisplayString as Q, vShow as X, renderSlot as Y } from "vue";
1
+ import { defineComponent as U, defineAsyncComponent as u, inject as j, ref as F, computed as c, onMounted as K, onUpdated as O, watch as R, nextTick as $, provide as y, openBlock as a, createElementBlock as p, normalizeStyle as L, normalizeClass as g, createElementVNode as i, createVNode as W, unref as l, withCtx as q, Fragment as G, renderList as H, withDirectives as J, createBlock as m, createCommentVNode as f, toDisplayString as Q, vShow as X, renderSlot as Y } from "vue";
2
2
  import { TabVariations as Z } from "../../../enums/Tab2.js";
3
3
  import { useTheme as ee } from "../../../composables/useTheme2.js";
4
- import { ChipSize as oe } from "../../../enums/Chip2.js";
5
- import { useDebounceFn as te } from "@vueuse/core";
6
- const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected", "href", "onClick"], ce = { class: "tabs-component-tab__tab-name" }, ae = { class: "tabs-component-panels" }, ue = /* @__PURE__ */ P({
4
+ import { ChipSize as te } from "../../../enums/Chip2.js";
5
+ import { useDebounceFn as oe } from "@vueuse/core";
6
+ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected", "href", "onClick"], ce = { class: "tabs-component-tab__tab-name" }, ae = { class: "tabs-component-panels" }, pe = /* @__PURE__ */ U({
7
7
  __name: "McTabs",
8
8
  props: {
9
9
  modelValue: {
@@ -61,16 +61,16 @@ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected",
61
61
  }
62
62
  },
63
63
  emits: ["update:modelValue", "tab-changed", "clicked"],
64
- setup(k, { emit: g }) {
65
- const T = d(() => import("../../elements/McChip/McChip.vue.js")), h = d(() => import("../../elements/McSvgIcon/McSvgIcon.vue.js")), V = d(() => import("../McWrapScroll/McWrapScroll.vue.js")), v = g, C = j("dsOptions", {}), n = k, r = ee("tabs"), s = F([]), S = c(() => n.color || r.component.color), A = c(() => n.accentColor || r.component.accentColor), D = c(() => ({
64
+ setup(k, { emit: T }) {
65
+ const V = u(() => import("../../elements/McChip/McChip.vue.js")), h = u(() => import("../../elements/McSvgIcon/McSvgIcon.vue.js")), S = u(() => import("../McWrapScroll/McWrapScroll.vue.js")), v = T, C = j("dsOptions", {}), n = k, r = ee("tabs"), s = F([]), A = c(() => n.color || r.component.color), D = c(() => n.accentColor || r.component.accentColor), I = c(() => ({
66
66
  "mc-tabs": !0,
67
67
  [`mc-tabs--tab-variation-${n.tabVariation}`]: !!n.tabVariation,
68
68
  "mc-tabs--uppercase": !!n.uppercase,
69
69
  "mc-tabs--sticky": !!n.sticky
70
- })), w = c(() => ({
71
- "--mc-tabs-color": r.colors[S.value],
72
- "--mc-tabs-accent-color": r.colors[A.value]
73
- })), z = c({
70
+ })), M = c(() => ({
71
+ "--mc-tabs-color": r.colors[A.value],
72
+ "--mc-tabs-accent-color": r.colors[D.value]
73
+ })), w = c({
74
74
  // @ts-ignore
75
75
  get() {
76
76
  return n.modelValue;
@@ -78,23 +78,25 @@ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected",
78
78
  set(e) {
79
79
  v("update:modelValue", e);
80
80
  }
81
- }), b = c(() => s.value.filter((e) => e.visible && !e.isDisabled)), M = (e) => {
81
+ }), b = c(() => s.value.filter((e) => e.visible && !e.isDisabled)), z = (e) => {
82
82
  s.value.forEach((t) => {
83
83
  t.isActive = t.computedId === e, t.isActive ? t.showTab() : t.hideTab();
84
84
  });
85
85
  }, B = (e) => {
86
- s.value.push(e);
87
- }, y = () => {
86
+ s.value.some((t) => t.computedId === e.computedId) || s.value.push(e);
87
+ }, x = (e) => {
88
+ s.value = s.value.filter((t) => t.computedId !== e);
89
+ }, _ = () => {
88
90
  let [e] = b.value;
89
91
  const t = s.value.find((o) => o.computedId === n.modelValue);
90
- t && !t.isDisabled && (e = t), e && p(e);
91
- }, I = (e, t) => {
92
+ t && !t.isDisabled && (e = t), e && d(e);
93
+ }, E = (e, t) => {
92
94
  v("tab-changed", { tab: e, event: t });
93
- }, x = te(() => {
95
+ }, N = oe(() => {
94
96
  if (n.loading || !s.value?.find((o) => o.isActive)?.isDisabled) return;
95
97
  const [t] = b.value;
96
- p(t);
97
- }, 100), p = (e, t) => {
98
+ d(t);
99
+ }, 100), d = (e, t) => {
98
100
  if (!((e.to || e.href) && (t?.metaKey || t?.ctrlKey)) && (t?.preventDefault(), !e.isDisabled)) {
99
101
  if (e.onClick && typeof e.onClick == "function") return e.onClick(e, t);
100
102
  if (e.href) {
@@ -105,31 +107,31 @@ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected",
105
107
  C.meta.router_push(e.to);
106
108
  return;
107
109
  }
108
- I(e, t), M(e.computedId), z.value = e.computedId;
110
+ E(e, t), z(e.computedId), w.value = e.computedId;
109
111
  }
110
112
  };
111
- return K(y), O(x), R(
113
+ return K(_), O(N), R(
112
114
  () => n.loading,
113
115
  (e, t) => {
114
116
  !e && t && $(() => {
115
- y();
117
+ _();
116
118
  });
117
119
  }
118
- ), L("selfRegisterTabMethod", B), (e, t) => (a(), u("div", {
119
- class: _(D.value),
120
- style: U(w.value)
120
+ ), y("selfRegisterTabMethod", B), y("selfUnregisterTabMethod", x), (e, t) => (a(), p("div", {
121
+ class: g(I.value),
122
+ style: L(M.value)
121
123
  }, [
122
124
  i("div", ne, [
123
- W(l(V), {
125
+ W(l(S), {
124
126
  "tag-name": "ul",
125
127
  role: "tablist",
126
128
  scrollable: "",
127
129
  class: "tabs-component-tabs"
128
130
  }, {
129
131
  default: q(() => [
130
- (a(!0), u(G, null, H(s.value, (o, E) => J((a(), u("li", {
131
- key: E,
132
- class: _([{ "is-active": o.isActive, "is-disabled": o.isDisabled, "is-hidden": !o.visible }, "tabs-component-tab"]),
132
+ (a(!0), p(G, null, H(s.value, (o) => J((a(), p("li", {
133
+ key: o.computedId,
134
+ class: g([{ "is-active": o.isActive, "is-disabled": o.isDisabled, "is-hidden": !o.visible }, "tabs-component-tab"]),
133
135
  role: "presentation"
134
136
  }, [
135
137
  i("a", {
@@ -138,7 +140,7 @@ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected",
138
140
  href: o.href || o.to || o.hash || "javascript:void(0)",
139
141
  class: "tabs-component-tab-a",
140
142
  role: "tab",
141
- onClick: (N) => p(o, N)
143
+ onClick: (P) => d(o, P)
142
144
  }, [
143
145
  i("span", ce, [
144
146
  o.iconPrepend ? (a(), m(l(h), {
@@ -154,11 +156,11 @@ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected",
154
156
  color: o.iconAppendColor,
155
157
  size: "200"
156
158
  }, null, 8, ["name", "color"])) : f("", !0),
157
- o.hasAppendCount ? (a(), m(l(T), {
159
+ o.hasAppendCount ? (a(), m(l(V), {
158
160
  key: 2,
159
161
  title: o.appendCount,
160
162
  "text-color": o.appendCountColor,
161
- size: l(oe).S,
163
+ size: l(te).S,
162
164
  class: "tabs-component-tab__tab-name_append-count"
163
165
  }, null, 8, ["title", "text-color", "size"])) : f("", !0)
164
166
  ])
@@ -177,5 +179,5 @@ const ne = { class: "tabs-component" }, se = ["aria-controls", "aria-selected",
177
179
  }
178
180
  });
179
181
  export {
180
- ue as default
182
+ pe as default
181
183
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui-v2",
3
- "version": "0.0.328",
3
+ "version": "0.0.329",
4
4
  "license": "MIT",
5
5
  "description": "Design system for Mediacube services",
6
6
  "sideEffects": [