@leaflink/stash 48.7.0 → 48.7.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,6 +1,6 @@
1
1
  import { defineComponent as b, ref as g, watch as m, onMounted as x, openBlock as p, createElementBlock as c, createVNode as _, withCtx as f, Fragment as I, renderList as V, createBlock as k, unref as T, createTextVNode as N, toDisplayString as B } from "vue";
2
2
  import C from "@leaflink/snitch";
3
- import d from "lodash-es/kebabCase";
3
+ import s from "lodash-es/kebabCase";
4
4
  import { useRoute as U, useRouter as y } from "vue-router";
5
5
  import { _ as P } from "./Tab.vue_vue_type_script_setup_true_lang-69d1b046.js";
6
6
  import D from "./Tabs.js";
@@ -37,25 +37,25 @@ const E = {
37
37
  setup(v, { emit: i }) {
38
38
  const r = v;
39
39
  r.activeIndex && C.info("The `activeIndex` prop is deprecated. Use `v-model` instead.");
40
- const o = U(), u = y(), s = g("");
41
- function l(t) {
42
- t !== s.value && (s.value = t, i("update:modelValue", t));
40
+ const o = U(), u = y(), d = g("");
41
+ function n(t) {
42
+ t !== d.value && (d.value = t, i("update:modelValue", t));
43
43
  }
44
44
  return m(() => r.modelValue, (t, e) => {
45
45
  if (e === t)
46
46
  return;
47
- const a = r.items.findIndex((n) => d(n.label) === t);
48
- i("change", a);
47
+ const a = r.items.findIndex((l) => s(l.label) === t);
48
+ i("change", a), n(t);
49
49
  }), x(() => {
50
50
  if (!r.items.length)
51
51
  return;
52
52
  if (r.activeIndex !== void 0) {
53
53
  const e = r.items[r.activeIndex];
54
- l(d(e.label));
54
+ n(s(e.label));
55
55
  return;
56
56
  }
57
- if (r.modelValue) {
58
- l(r.modelValue);
57
+ if (r.modelValue !== d.value) {
58
+ n(r.modelValue);
59
59
  return;
60
60
  }
61
61
  if (!u)
@@ -68,24 +68,24 @@ const E = {
68
68
  return !0;
69
69
  if (!o.path.includes(a))
70
70
  return;
71
- const n = (o.path.length - o.path.lastIndexOf("/")) * -1, h = o.path.slice(0, n);
71
+ const l = (o.path.length - o.path.lastIndexOf("/")) * -1, h = o.path.slice(0, l);
72
72
  return a === h;
73
73
  });
74
- t && l((t == null ? void 0 : t.value) || d(t.label));
74
+ t && n((t == null ? void 0 : t.value) || s(t.label));
75
75
  }), (t, e) => (p(), c("nav", E, [
76
76
  _(D, {
77
- "active-tab": s.value,
78
- "onUpdate:activeTab": l
77
+ "active-tab": d.value,
78
+ "onUpdate:activeTab": n
79
79
  }, {
80
80
  default: f(() => [
81
- (p(!0), c(I, null, V(r.items, (a, n) => (p(), k(P, {
81
+ (p(!0), c(I, null, V(r.items, (a, l) => (p(), k(P, {
82
82
  key: a.label,
83
- value: (a == null ? void 0 : a.value) || T(d)(a.label),
83
+ value: (a == null ? void 0 : a.value) || T(s)(a.label),
84
84
  to: a.to,
85
85
  href: a.href,
86
86
  badge: a.badge,
87
87
  disabled: a.disabled,
88
- "data-id": n
88
+ "data-id": l
89
89
  }, {
90
90
  default: f(() => [
91
91
  N(B(a.label), 1)
@@ -1 +1 @@
1
- {"version":3,"file":"PageNavigation.js","sources":["../src/components/PageNavigation/PageNavigation.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import kebabCase from 'lodash-es/kebabCase';\n import { onMounted, ref, watch } from 'vue';\n import { RouteLocationRaw, useRoute, useRouter } from 'vue-router';\n\n import Tab, { type TabProps } from '../Tab/Tab.vue';\n import Tabs from '../Tabs/Tabs.vue';\n\n defineOptions({\n name: 'll-page-navigation',\n });\n\n export interface NavItem extends Omit<TabProps, 'value'> {\n /**\n * The tab's label\n */\n label: string;\n\n /**\n * The tab's label\n */\n value?: string;\n }\n\n export interface PageNavigationProps {\n /**\n * Index of active tab (zero-based)\n * @deprecated Use v-model instead.\n */\n activeIndex?: number | string;\n\n /**\n * The currently active tab value\n */\n modelValue?: string;\n\n /**\n * Array of tabs. A `tab` is an object containing a `label` and either an `href` | `to`\n */\n items: NavItem[];\n }\n\n const props = withDefaults(defineProps<PageNavigationProps>(), {\n activeIndex: undefined,\n modelValue: '',\n });\n\n const emit =\n defineEmits<{\n /**\n * Emits the current active nav value\n */\n (e: 'update:modelValue', activeTab: string): void;\n\n /**\n * Emits the current active nav index\n * @deprecated - Use v-model instead.\n */\n (e: 'change', activeNavIndex: number): void;\n }>();\n\n if (props.activeIndex) {\n logger.info('The `activeIndex` prop is deprecated. Use `v-model` instead.');\n }\n\n const route = useRoute();\n const router = useRouter();\n\n // this ref is needed to keep track of the active tab even if v-model is not passed\n const activeTab = ref('');\n\n function onUpdateActiveTab(newActiveTab: string) {\n if (newActiveTab === activeTab.value) return;\n\n activeTab.value = newActiveTab;\n emit('update:modelValue', newActiveTab);\n }\n\n // TODO: Remove this once activeIndex is removed\n watch(() => props.modelValue, (newValue, oldValue) => {\n if (oldValue === newValue) return;\n\n const activeNavItemIndex = props.items.findIndex((item) => kebabCase(item.label) === newValue);\n\n emit('change', activeNavItemIndex);\n });\n\n onMounted(() => {\n if (!props.items.length) return;\n\n // TODO: Remove this once activeIndex is removed\n if (props.activeIndex !== undefined) {\n const activeTabItem = props.items[props.activeIndex];\n\n onUpdateActiveTab(kebabCase(activeTabItem.label));\n\n return;\n }\n\n if (props.modelValue) {\n onUpdateActiveTab(props.modelValue);\n return;\n }\n\n if (!router) return;\n\n const itemMatchingRoute = props.items.find(item => {\n if (item?.disabled || (!item?.to && !item?.href)) return;\n\n const { path } = router.resolve(item?.to as RouteLocationRaw || item?.href as string);\n\n if (path === route.path) {\n return true;\n }\n\n if (!route.path.includes(path)) return;\n\n const sliceIndex = (route.path.length - route.path.lastIndexOf('/')) * -1;\n const parentPath = route.path.slice(0, sliceIndex);\n\n return path === parentPath;\n });\n\n if (!itemMatchingRoute) return;\n\n onUpdateActiveTab(itemMatchingRoute?.value || kebabCase(itemMatchingRoute.label));\n });\n</script>\n\n<template>\n <nav class=\"stash-page-navigation container\" data-test=\"stash-page-navigation\">\n <Tabs :active-tab=\"activeTab\" @update:active-tab=\"onUpdateActiveTab\">\n <Tab\n v-for=\"(item, index) in props.items\"\n :key=\"item.label\"\n :value=\"item?.value || kebabCase(item.label)\"\n :to=\"item.to\"\n :href=\"item.href\"\n :badge=\"item.badge\"\n :disabled=\"item.disabled\"\n :data-id=\"index\"\n >\n {{ item.label }}\n </Tab>\n </Tabs>\n </nav>\n</template>\n"],"names":["props","logger","route","useRoute","router","useRouter","activeTab","ref","onUpdateActiveTab","newActiveTab","emit","watch","newValue","oldValue","activeNavItemIndex","item","kebabCase","onMounted","activeTabItem","itemMatchingRoute","path","sliceIndex","parentPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DE,IAAIA,EAAM,eACRC,EAAO,KAAK,8DAA8D;AAG5E,UAAMC,IAAQC,KACRC,IAASC,KAGTC,IAAYC,EAAI,EAAE;AAExB,aAASC,EAAkBC,GAAsB;AAC/C,MAAIA,MAAiBH,EAAU,UAE/BA,EAAU,QAAQG,GAClBC,EAAK,qBAAqBD,CAAY;AAAA,IACxC;AAGA,WAAAE,EAAM,MAAMX,EAAM,YAAY,CAACY,GAAUC,MAAa;AACpD,UAAIA,MAAaD;AAAU;AAErB,YAAAE,IAAqBd,EAAM,MAAM,UAAU,CAACe,MAASC,EAAUD,EAAK,KAAK,MAAMH,CAAQ;AAE7F,MAAAF,EAAK,UAAUI,CAAkB;AAAA,IAAA,CAClC,GAEDG,EAAU,MAAM;AACV,UAAA,CAACjB,EAAM,MAAM;AAAQ;AAGrB,UAAAA,EAAM,gBAAgB,QAAW;AACnC,cAAMkB,IAAgBlB,EAAM,MAAMA,EAAM,WAAW;AAEjC,QAAAQ,EAAAQ,EAAUE,EAAc,KAAK,CAAC;AAEhD;AAAA,MACF;AAEA,UAAIlB,EAAM,YAAY;AACpB,QAAAQ,EAAkBR,EAAM,UAAU;AAClC;AAAA,MACF;AAEA,UAAI,CAACI;AAAQ;AAEb,YAAMe,IAAoBnB,EAAM,MAAM,KAAK,CAAQe,MAAA;AACjD,YAAIA,KAAA,QAAAA,EAAM,YAAa,EAACA,KAAA,QAAAA,EAAM,OAAM,EAACA,KAAA,QAAAA,EAAM;AAAO;AAE5C,cAAA,EAAE,MAAAK,EAAS,IAAAhB,EAAO,SAAQW,KAAA,gBAAAA,EAAM,QAA0BA,KAAA,gBAAAA,EAAM,KAAc;AAEhF,YAAAK,MAASlB,EAAM;AACV,iBAAA;AAGT,YAAI,CAACA,EAAM,KAAK,SAASkB,CAAI;AAAG;AAE1B,cAAAC,KAAcnB,EAAM,KAAK,SAASA,EAAM,KAAK,YAAY,GAAG,KAAK,IACjEoB,IAAapB,EAAM,KAAK,MAAM,GAAGmB,CAAU;AAEjD,eAAOD,MAASE;AAAA,MAAA,CACjB;AAED,MAAKH,KAELX,GAAkBW,KAAA,gBAAAA,EAAmB,UAASH,EAAUG,EAAkB,KAAK,CAAC;AAAA,IAAA,CACjF;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PageNavigation.js","sources":["../src/components/PageNavigation/PageNavigation.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import kebabCase from 'lodash-es/kebabCase';\n import { onMounted, ref, watch } from 'vue';\n import { RouteLocationRaw, useRoute, useRouter } from 'vue-router';\n\n import Tab, { type TabProps } from '../Tab/Tab.vue';\n import Tabs from '../Tabs/Tabs.vue';\n\n defineOptions({\n name: 'll-page-navigation',\n });\n\n export interface NavItem extends Omit<TabProps, 'value'> {\n /**\n * The tab's label\n */\n label: string;\n\n /**\n * The tab's label\n */\n value?: string;\n }\n\n export interface PageNavigationProps {\n /**\n * Index of active tab (zero-based)\n * @deprecated Use v-model instead.\n */\n activeIndex?: number | string;\n\n /**\n * The currently active tab value\n */\n modelValue?: string;\n\n /**\n * Array of tabs. A `tab` is an object containing a `label` and either an `href` | `to`\n */\n items: NavItem[];\n }\n\n const props = withDefaults(defineProps<PageNavigationProps>(), {\n activeIndex: undefined,\n modelValue: '',\n });\n\n const emit =\n defineEmits<{\n /**\n * Emits the current active nav value\n */\n (e: 'update:modelValue', activeTab: string): void;\n\n /**\n * Emits the current active nav index\n * @deprecated - Use v-model instead.\n */\n (e: 'change', activeNavIndex: number): void;\n }>();\n\n if (props.activeIndex) {\n logger.info('The `activeIndex` prop is deprecated. Use `v-model` instead.');\n }\n\n const route = useRoute();\n const router = useRouter();\n\n // this ref is needed to keep track of the active tab even if v-model is not passed\n const activeTab = ref('');\n\n function onUpdateActiveTab(newActiveTab: string) {\n if (newActiveTab === activeTab.value) return;\n\n activeTab.value = newActiveTab;\n emit('update:modelValue', newActiveTab);\n }\n\n watch(() => props.modelValue, (newValue, oldValue) => {\n if (oldValue === newValue) return;\n\n // TODO: Remove this once activeIndex is removed\n const activeNavItemIndex = props.items.findIndex((item) => kebabCase(item.label) === newValue);\n emit('change', activeNavItemIndex);\n\n // Forcing updating activeTab when the component is in a keep alive state\n onUpdateActiveTab(newValue);\n });\n\n onMounted(() => {\n if (!props.items.length) return;\n\n // TODO: Remove this once activeIndex is removed\n if (props.activeIndex !== undefined) {\n const activeTabItem = props.items[props.activeIndex];\n\n onUpdateActiveTab(kebabCase(activeTabItem.label));\n\n return;\n }\n\n if (props.modelValue !== activeTab.value) {\n onUpdateActiveTab(props.modelValue);\n return;\n }\n\n if (!router) return;\n\n const itemMatchingRoute = props.items.find(item => {\n if (item?.disabled || (!item?.to && !item?.href)) return;\n\n const { path } = router.resolve(item?.to as RouteLocationRaw || item?.href as string);\n\n if (path === route.path) {\n return true;\n }\n\n if (!route.path.includes(path)) return;\n\n const sliceIndex = (route.path.length - route.path.lastIndexOf('/')) * -1;\n const parentPath = route.path.slice(0, sliceIndex);\n\n return path === parentPath;\n });\n\n if (!itemMatchingRoute) return;\n\n onUpdateActiveTab(itemMatchingRoute?.value || kebabCase(itemMatchingRoute.label));\n });\n</script>\n\n<template>\n <nav class=\"stash-page-navigation container\" data-test=\"stash-page-navigation\">\n <Tabs :active-tab=\"activeTab\" @update:active-tab=\"onUpdateActiveTab\">\n <Tab\n v-for=\"(item, index) in props.items\"\n :key=\"item.label\"\n :value=\"item?.value || kebabCase(item.label)\"\n :to=\"item.to\"\n :href=\"item.href\"\n :badge=\"item.badge\"\n :disabled=\"item.disabled\"\n :data-id=\"index\"\n >\n {{ item.label }}\n </Tab>\n </Tabs>\n </nav>\n</template>\n"],"names":["props","logger","route","useRoute","router","useRouter","activeTab","ref","onUpdateActiveTab","newActiveTab","emit","watch","newValue","oldValue","activeNavItemIndex","item","kebabCase","onMounted","activeTabItem","itemMatchingRoute","path","sliceIndex","parentPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DE,IAAIA,EAAM,eACRC,EAAO,KAAK,8DAA8D;AAG5E,UAAMC,IAAQC,KACRC,IAASC,KAGTC,IAAYC,EAAI,EAAE;AAExB,aAASC,EAAkBC,GAAsB;AAC/C,MAAIA,MAAiBH,EAAU,UAE/BA,EAAU,QAAQG,GAClBC,EAAK,qBAAqBD,CAAY;AAAA,IACxC;AAEA,WAAAE,EAAM,MAAMX,EAAM,YAAY,CAACY,GAAUC,MAAa;AACpD,UAAIA,MAAaD;AAAU;AAGrB,YAAAE,IAAqBd,EAAM,MAAM,UAAU,CAACe,MAASC,EAAUD,EAAK,KAAK,MAAMH,CAAQ;AAC7F,MAAAF,EAAK,UAAUI,CAAkB,GAGjCN,EAAkBI,CAAQ;AAAA,IAAA,CAC3B,GAEDK,EAAU,MAAM;AACV,UAAA,CAACjB,EAAM,MAAM;AAAQ;AAGrB,UAAAA,EAAM,gBAAgB,QAAW;AACnC,cAAMkB,IAAgBlB,EAAM,MAAMA,EAAM,WAAW;AAEjC,QAAAQ,EAAAQ,EAAUE,EAAc,KAAK,CAAC;AAEhD;AAAA,MACF;AAEI,UAAAlB,EAAM,eAAeM,EAAU,OAAO;AACxC,QAAAE,EAAkBR,EAAM,UAAU;AAClC;AAAA,MACF;AAEA,UAAI,CAACI;AAAQ;AAEb,YAAMe,IAAoBnB,EAAM,MAAM,KAAK,CAAQe,MAAA;AACjD,YAAIA,KAAA,QAAAA,EAAM,YAAa,EAACA,KAAA,QAAAA,EAAM,OAAM,EAACA,KAAA,QAAAA,EAAM;AAAO;AAE5C,cAAA,EAAE,MAAAK,EAAS,IAAAhB,EAAO,SAAQW,KAAA,gBAAAA,EAAM,QAA0BA,KAAA,gBAAAA,EAAM,KAAc;AAEhF,YAAAK,MAASlB,EAAM;AACV,iBAAA;AAGT,YAAI,CAACA,EAAM,KAAK,SAASkB,CAAI;AAAG;AAE1B,cAAAC,KAAcnB,EAAM,KAAK,SAASA,EAAM,KAAK,YAAY,GAAG,KAAK,IACjEoB,IAAapB,EAAM,KAAK,MAAM,GAAGmB,CAAU;AAEjD,eAAOD,MAASE;AAAA,MAAA,CACjB;AAED,MAAKH,KAELX,GAAkBW,KAAA,gBAAAA,EAAmB,UAASH,EAAUG,EAAkB,KAAK,CAAC;AAAA,IAAA,CACjF;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflink/stash",
3
- "version": "48.7.0",
3
+ "version": "48.7.1",
4
4
  "description": "LeafLink's design system.",
5
5
  "homepage": "https://stash.leaflink.com",
6
6
  "main": "./dist/index.ts",