@kiva/kv-components 8.9.0 → 8.9.1

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,17 +1,17 @@
1
- import l from "./KvTabPanel2.js";
2
- import { openBlock as a, createBlock as o, Transition as c, withCtx as r, withDirectives as n, createElementBlock as s, renderSlot as d, vShow as v } from "vue";
3
- import b from "../_virtual/_plugin-vue_export-helper.js";
4
- const w = ["id", "aria-hidden", "aria-labelledby"];
5
- function f(i, p, t, e, _, m) {
6
- return a(), o(c, {
1
+ import o from "./KvTabPanel2.js";
2
+ import { openBlock as a, createBlock as l, Transition as r, withCtx as c, withDirectives as n, createElementBlock as s, renderSlot as d, vShow as v } from "vue";
3
+ import f from "../_virtual/_plugin-vue_export-helper.js";
4
+ const b = ["id", "aria-hidden", "aria-labelledby"];
5
+ function w(i, p, t, e, m, _) {
6
+ return a(), l(r, {
7
7
  "enter-active-class": "tw-transition-opacity tw-duration-700",
8
8
  "leave-active-class": "",
9
- "enter-class": "tw-opacity-0 tw-absolute tw-top-0",
9
+ "enter-from-class": "tw-opacity-0 tw-absolute tw-top-0",
10
10
  "enter-to-class": "tw-opacity-full",
11
- "leave-class": "",
11
+ "leave-from-class": "",
12
12
  "leave-to-class": "tw-opacity-0 tw-absolute tw-top-0"
13
13
  }, {
14
- default: r(() => [
14
+ default: c(() => [
15
15
  n((a(), s("div", {
16
16
  id: `kv-tab-panel-${t.id}`,
17
17
  key: `kv-tab-panel-${t.id}`,
@@ -21,14 +21,14 @@ function f(i, p, t, e, _, m) {
21
21
  tabindex: "0"
22
22
  }, [
23
23
  d(i.$slots, "default")
24
- ], 8, w)), [
24
+ ], 8, b)), [
25
25
  [v, e.isActive]
26
26
  ])
27
27
  ]),
28
28
  _: 3
29
29
  });
30
30
  }
31
- const y = /* @__PURE__ */ b(l, [["render", f]]);
31
+ const y = /* @__PURE__ */ f(o, [["render", w]]);
32
32
  export {
33
33
  y as default
34
34
  };
@@ -1,32 +1,32 @@
1
- import d from "./KvTabs2.js";
2
- import { openBlock as c, createElementBlock as s, normalizeClass as l, createElementVNode as a, renderSlot as i, normalizeStyle as w } from "vue";
3
- import m from "../_virtual/_plugin-vue_export-helper.js";
1
+ import w from "./KvTabs2.js";
2
+ import { openBlock as d, createElementBlock as s, normalizeClass as l, createElementVNode as o, renderSlot as i, normalizeStyle as m } from "vue";
3
+ import c from "../_virtual/_plugin-vue_export-helper.js";
4
4
  const f = { class: "tw-relative" };
5
- function b(o, r, e, t, v, x) {
6
- return c(), s("div", {
5
+ function v(a, r, e, t, b, g) {
6
+ return d(), s("div", {
7
7
  class: l(e.vertical ? "md:tw-flex" : "")
8
8
  }, [
9
- a("div", {
9
+ o("div", {
10
10
  role: "tablist",
11
11
  class: l(["tw-flex tw-overflow-auto tw-relative tw-gap-x-2.5 md:tw-gap-x-5 lg:tw-gap-x-6 tw-mb-3 lg:tw-mb-4", { "md:tw-flex-col md:tw-mr-3": e.vertical }]),
12
12
  onKeydown: r[0] || (r[0] = (n) => t.handleKeyDown(n))
13
13
  }, [
14
- i(o.$slots, "tabNav"),
15
- a("div", {
14
+ i(a.$slots, "tabNav"),
15
+ o("div", {
16
16
  class: l(["tw-absolute tw-bottom-0 tw-h-0.5 tw-left-0 tw-bg-primary-inverse tw-rounded-full tw-origin-left tw-transition-all tw-duration-300", { "tw-hidden md:tw-block tw-top-0 md:tw-bg-action": e.vertical }]),
17
- style: w(`
18
- width: ${t.selectedTabEl && !e.vertical ? t.selectedTabEl.clientWidth : 3}px;
19
- height: ${t.selectedTabEl && e.vertical ? `${t.selectedTabEl.clientHeight}px` : "0.25rem"};
20
- transform: ${t.selectedTabEl && !e.vertical ? `translateX(${t.selectedTabEl.offsetLeft}px)` : t.selectedTabEl ? `translateY(${t.selectedTabEl.offsetTop}px)` : null};
17
+ style: m(`
18
+ width: ${t.indicatorStyle.width}px;
19
+ height: ${t.indicatorStyle.height};
20
+ transform: ${t.indicatorStyle.transform};
21
21
  `)
22
22
  }, null, 6)
23
23
  ], 34),
24
- a("div", f, [
25
- i(o.$slots, "tabPanels")
24
+ o("div", f, [
25
+ i(a.$slots, "tabPanels")
26
26
  ])
27
27
  ], 2);
28
28
  }
29
- const h = /* @__PURE__ */ m(d, [["render", b]]);
29
+ const p = /* @__PURE__ */ c(w, [["render", v]]);
30
30
  export {
31
- h as default
31
+ p as default
32
32
  };
@@ -1,3 +1,14 @@
1
+ import { ComponentPublicInstance } from 'vue';
2
+ interface TabNavItem extends ComponentPublicInstance {
3
+ forPanel?: string;
4
+ isActive?: boolean;
5
+ selected?: boolean;
6
+ }
7
+ interface TabContext {
8
+ selectedIndex: number;
9
+ setTab: ((index: number) => void) | null;
10
+ navItems: TabNavItem[];
11
+ }
1
12
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
13
  vertical: {
3
14
  type: BooleanConstructor;
@@ -5,12 +16,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
5
16
  };
6
17
  }>, {
7
18
  handleKeyDown: (event: any) => void;
8
- selectedTabEl: import('vue').ComputedRef<any>;
9
- tabContext: {
10
- selectedIndex: number;
11
- setTab: any;
12
- navItems: any[];
19
+ indicatorStyle: {
20
+ width: number;
21
+ height: string;
22
+ transform: string;
13
23
  };
24
+ tabContext: TabContext;
14
25
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
15
26
  vertical: {
16
27
  type: BooleanConstructor;
@@ -1,60 +1,70 @@
1
- import { reactive as b, ref as I, computed as m, provide as x, onMounted as T, onBeforeUnmount as h, getCurrentInstance as y } from "vue";
2
- const D = {
1
+ import { reactive as h, ref as x, computed as I, provide as T, watch as g, nextTick as y, onMounted as k, onBeforeUnmount as $ } from "vue";
2
+ const E = {
3
3
  props: {
4
4
  vertical: {
5
5
  type: Boolean,
6
6
  default: !1
7
7
  }
8
8
  },
9
- setup(k, { emit: u }) {
10
- const t = b({
9
+ setup(p, { emit: b }) {
10
+ const t = h({
11
11
  selectedIndex: 0,
12
12
  setTab: null,
13
13
  navItems: []
14
- }), l = I(null), f = m(() => {
15
- var c;
14
+ }), i = x(null), r = I(() => {
15
+ var l;
16
16
  const { navItems: e, selectedIndex: o } = t;
17
- return ((c = e[o]) == null ? void 0 : c.$el) ?? null;
18
- }), i = () => {
19
- const e = y();
20
- e && e.proxy.$forceUpdate();
21
- }, n = (e) => {
22
- t.selectedIndex = e, f.value.scrollIntoView({ behavior: "smooth", block: "nearest" }), u("tab-changed", e);
17
+ return ((l = e[o]) == null ? void 0 : l.$el) ?? null;
18
+ }), n = h({
19
+ width: 3,
20
+ height: "0.25rem",
21
+ transform: ""
22
+ }), c = () => {
23
+ const e = r.value;
24
+ e && (p.vertical ? (n.width = 3, n.height = `${e.clientHeight}px`, n.transform = `translateY(${e.offsetTop}px)`) : (n.width = e.clientWidth, n.height = "0.25rem", n.transform = `translateX(${e.offsetLeft}px)`));
25
+ }, s = (e) => {
26
+ t.selectedIndex = e, r.value.scrollIntoView({ behavior: "smooth", block: "nearest" }), b("tab-changed", e);
23
27
  };
24
- t.setTab = n, x("$KvTabContext", t);
25
- const p = (e) => {
26
- const { navItems: o, selectedIndex: c } = t, a = () => {
27
- var d;
28
- const s = o.find((v) => v.isActive);
29
- s && ((d = s.$el) == null || d.focus());
30
- }, r = o.length;
28
+ t.setTab = s, T("$KvTabContext", t);
29
+ const m = (e) => {
30
+ const { navItems: o, selectedIndex: l } = t, d = () => {
31
+ var v;
32
+ const a = o.find((w) => w.isActive);
33
+ a && ((v = a.$el) == null || v.focus());
34
+ }, f = o.length;
31
35
  if (e.key === "ArrowRight") {
32
36
  e.preventDefault();
33
- const s = (c + 1) % r;
34
- n(s), a();
37
+ const a = (l + 1) % f;
38
+ s(a), d();
35
39
  }
36
40
  if (e.key === "ArrowLeft") {
37
41
  e.preventDefault();
38
- const s = (c - 1 + r) % r;
39
- n(s), a();
42
+ const a = (l - 1 + f) % f;
43
+ s(a), d();
40
44
  }
41
- e.key === "Home" && (e.preventDefault(), n(0), a()), e.key === "End" && (e.preventDefault(), n(r - 1), a());
45
+ e.key === "Home" && (e.preventDefault(), s(0), d()), e.key === "End" && (e.preventDefault(), s(f - 1), d());
46
+ }, u = () => {
47
+ var e;
48
+ (e = i.value) == null || e.disconnect(), r.value && (i.value = new ResizeObserver(() => {
49
+ c();
50
+ }), i.value.observe(r.value));
42
51
  };
43
- return T(() => {
52
+ return g(r, () => {
53
+ u(), y(c);
54
+ }), k(() => {
44
55
  t.navItems.forEach((e, o) => {
45
- e.selected && n(o);
46
- }), l.value = new ResizeObserver(() => {
47
- i();
48
- }), l.value.observe(f.value);
49
- }), h(() => {
50
- l.value.disconnect();
56
+ e.selected && s(o);
57
+ }), c(), u(), window.addEventListener("resize", c);
58
+ }), $(() => {
59
+ var e;
60
+ (e = i.value) == null || e.disconnect(), window.removeEventListener("resize", c);
51
61
  }), {
52
- handleKeyDown: p,
53
- selectedTabEl: f,
62
+ handleKeyDown: m,
63
+ indicatorStyle: n,
54
64
  tabContext: t
55
65
  };
56
66
  }
57
67
  };
58
68
  export {
59
- D as default
69
+ E as default
60
70
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "8.9.0",
3
+ "version": "8.9.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -125,5 +125,5 @@
125
125
  "embla-carousel-fade",
126
126
  "popper.js"
127
127
  ],
128
- "gitHead": "8e1a9900d6e8e1c8307875aad711ffa5080e1dd9"
128
+ "gitHead": "ff3cad55e305990584c6d393f118b979987720ba"
129
129
  }