@shtabapp/ui-kit 1.26.0 → 1.28.0

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +96 -18
  3. package/dist/SAvatar-CRq0LG8U.cjs +1 -0
  4. package/dist/SAvatar-kB6E-fX6.js +187 -0
  5. package/dist/{SAvatarGroup-CpXYyENT.js → SAvatarGroup-Buja-Gw9.js} +1 -1
  6. package/dist/{SAvatarGroup-UZFNjjwz.cjs → SAvatarGroup-Cc4sBQjA.cjs} +1 -1
  7. package/dist/{SButton-fFytCz5D.cjs → SButton-CHxE2l-X.cjs} +1 -1
  8. package/dist/{SButton-DI04KG06.js → SButton-D5yFE3W2.js} +1 -1
  9. package/dist/{SCard-BF6CapA9.cjs → SCard-BR2R5VQd.cjs} +1 -1
  10. package/dist/{SCard-qqo16_wT.js → SCard-CrU67ok0.js} +1 -1
  11. package/dist/{SInput-A659aRIu.cjs → SInput-Bno-hQ-b.cjs} +1 -1
  12. package/dist/{SInput-oIwQ2B1r.js → SInput-W2257ZAC.js} +1 -1
  13. package/dist/{SList-s90xxyCL.js → SList-9BpZD3aT.js} +1 -1
  14. package/dist/{SList-ptf_BOAm.cjs → SList-D-J6fBrQ.cjs} +1 -1
  15. package/dist/{SListItem-DnQa1Q4k.cjs → SListItem-4OTUkahk.cjs} +1 -1
  16. package/dist/{SListItem-pDfLBCNA.js → SListItem-BAWj5_pk.js} +1 -1
  17. package/dist/{SSegmentControl-CWCXiHF6.js → SSegmentControl-CmJEjfSR.js} +1 -1
  18. package/dist/{SSegmentControl-DIoA__FA.cjs → SSegmentControl-Dz-d3Y9v.cjs} +1 -1
  19. package/dist/{SSelect-IawcrqEa.cjs → SSelect-DADK22v2.cjs} +1 -1
  20. package/dist/{SSelect-DIizkGJa.js → SSelect-DFkWwUc1.js} +4 -4
  21. package/dist/{STab-DzehRmKv.cjs → STab-C8RXx0lW.cjs} +1 -1
  22. package/dist/{STab-BPJQgGWd.js → STab-DXGKWtFI.js} +1 -1
  23. package/dist/{STabs-B0GD_1Zy.js → STabs-Cfv9NIJe.js} +2 -2
  24. package/dist/{STabs-C_u7te-N.cjs → STabs-DLFs7km7.cjs} +1 -1
  25. package/dist/{STag-D_E2Wrbz.cjs → STag-DlVk53Cn.cjs} +1 -1
  26. package/dist/{STag-FAeaFL--.js → STag-ZPesEPB4.js} +2 -2
  27. package/dist/{STagGroup-Z5ZHpRMT.js → STagGroup-C3-hAyGi.js} +1 -1
  28. package/dist/{STagGroup-CR6yvDmU.cjs → STagGroup-C4qL3p57.cjs} +1 -1
  29. package/dist/components/SAvatar/SAvatar.types.d.ts +39 -0
  30. package/dist/components/SAvatar/SAvatar.types.d.ts.map +1 -1
  31. package/dist/components/SAvatar/SAvatar.vue.d.ts.map +1 -1
  32. package/dist/components/SAvatar/SAvatarBadge.vue.d.ts +5 -0
  33. package/dist/components/SAvatar/SAvatarBadge.vue.d.ts.map +1 -0
  34. package/dist/components/SAvatar/constants/SAvatar.constants.d.ts +6 -0
  35. package/dist/components/SAvatar/constants/SAvatar.constants.d.ts.map +1 -0
  36. package/dist/components/SAvatar/index.d.ts +1 -1
  37. package/dist/components/SAvatar/index.d.ts.map +1 -1
  38. package/dist/components/SList/utils/resolveListItemFields.d.ts +1 -1
  39. package/dist/components/SList/utils/resolveListItemFields.d.ts.map +1 -1
  40. package/dist/components/SSelect/SSelect.vue.d.ts +2 -2
  41. package/dist/composables/useLink.d.ts +1 -1
  42. package/dist/composables/useLink.d.ts.map +1 -1
  43. package/dist/entries/avatar-group.cjs +1 -1
  44. package/dist/entries/avatar-group.js +1 -1
  45. package/dist/entries/avatar.cjs +1 -1
  46. package/dist/entries/avatar.d.ts +1 -1
  47. package/dist/entries/avatar.d.ts.map +1 -1
  48. package/dist/entries/avatar.js +2 -2
  49. package/dist/entries/button.cjs +1 -1
  50. package/dist/entries/button.js +1 -1
  51. package/dist/entries/card.cjs +1 -1
  52. package/dist/entries/card.js +1 -1
  53. package/dist/entries/composables.cjs +1 -1
  54. package/dist/entries/composables.js +1 -1
  55. package/dist/entries/input.cjs +1 -1
  56. package/dist/entries/input.js +1 -1
  57. package/dist/entries/list-item.cjs +1 -1
  58. package/dist/entries/list-item.js +1 -1
  59. package/dist/entries/list.cjs +1 -1
  60. package/dist/entries/list.js +1 -1
  61. package/dist/entries/segment-control.cjs +1 -1
  62. package/dist/entries/segment-control.js +1 -1
  63. package/dist/entries/select.cjs +1 -1
  64. package/dist/entries/select.js +1 -1
  65. package/dist/entries/tab.cjs +1 -1
  66. package/dist/entries/tab.js +1 -1
  67. package/dist/entries/tabs.cjs +1 -1
  68. package/dist/entries/tabs.js +2 -2
  69. package/dist/entries/tag-group.cjs +1 -1
  70. package/dist/entries/tag-group.js +2 -2
  71. package/dist/entries/tag.cjs +1 -1
  72. package/dist/entries/tag.js +1 -1
  73. package/dist/index.cjs +1 -1
  74. package/dist/index.d.ts +1 -1
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +34 -34
  77. package/dist/uikit-components.css +1 -1
  78. package/dist/useLink-1LLWpdDZ.cjs +1 -0
  79. package/dist/useLink-Com5VhOk.js +55 -0
  80. package/package.json +12 -5
  81. package/dist/SAvatar-C9YzCOKj.cjs +0 -1
  82. package/dist/SAvatar-CGxQaW36.js +0 -87
  83. package/dist/useLink-CvN7IK0Z.cjs +0 -1
  84. package/dist/useLink-Zo9A_RCf.js +0 -53
@@ -0,0 +1 @@
1
+ let e=require("vue");var t=e=>e?typeof e==`string`?{mode:`href`,rootTag:`a`,linkBindings:{href:e}}:{mode:`route`,rootTag:`router-link`,linkBindings:{to:e}}:{mode:`none`},n=e=>t(e).mode!==`none`,r=(e,t)=>{if(e.mode===`none`)return{};if(e.mode===`route`){let n={...e.linkBindings};return t?.replace&&(n.replace=!0),n}return e.linkBindings},i=(e,t)=>{let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(String(n??``)!==String(i??``))return!1}return!0},a=(n,r)=>(0,e.computed)(()=>{let i=t((0,e.toValue)(n));return i.mode===`route`&&!r?{mode:`none`}:i}),o=t=>({linkPresentation:a(t,!1),isLink:(0,e.computed)(()=>n((0,e.toValue)(t))),isRouterLink:(0,e.computed)(()=>!1),isActive:(0,e.computed)(()=>!1),navigate:()=>Promise.reject(Error(`[@shtabapp/ui-kit] useLink.navigate() requires an active vue-router instance. Install and register vue-router in the app, or use an href link.`))}),s=e=>typeof e==`object`&&!!e&&`useLink`in e,c=(t,r,o,s,c)=>{let l=a(o,!0),u=(0,e.computed)(()=>n((0,e.toValue)(o))),d=(0,e.computed)(()=>l.value.mode===`route`),f=(0,e.computed)(()=>{let e=l.value;return e.mode===`route`?e.linkBindings.to:``}),p=r.useLink({to:(0,e.toRef)(()=>f.value),replace:(0,e.toRef)(()=>(0,e.toValue)(c)??!1)});return{linkPresentation:l,isLink:u,isRouterLink:d,isActive:(0,e.computed)(()=>d.value?(0,e.toValue)(s)??!1?p.isExactActive.value?i(p.route.value.query,t.currentRoute.value.query):!1:p.isActive.value:!1),navigate:e=>d.value?p.navigate(e):Promise.resolve()}},l=(t,n,r)=>{let i=(0,e.getCurrentInstance)()?.proxy?.$router,a=i?(0,e.resolveDynamicComponent)(`RouterLink`):void 0;return!i||!s(a)?o(t):c(i,a,t,n,r)};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -0,0 +1,55 @@
1
+ import { computed as e, getCurrentInstance as t, resolveDynamicComponent as n, toRef as r, toValue as i } from "vue";
2
+ //#region src/utils/vueRouterLinkPresentation.ts
3
+ var a = (e) => e ? typeof e == "string" ? {
4
+ mode: "href",
5
+ rootTag: "a",
6
+ linkBindings: { href: e }
7
+ } : {
8
+ mode: "route",
9
+ rootTag: "router-link",
10
+ linkBindings: { to: e }
11
+ } : { mode: "none" }, o = (e) => a(e).mode !== "none", s = (e, t) => {
12
+ if (e.mode === "none") return {};
13
+ if (e.mode === "route") {
14
+ let n = { ...e.linkBindings };
15
+ return t?.replace && (n.replace = !0), n;
16
+ }
17
+ return e.linkBindings;
18
+ }, c = (e, t) => {
19
+ let n = Object.keys(e), r = Object.keys(t);
20
+ if (n.length !== r.length) return !1;
21
+ for (let r of n) {
22
+ let n = e[r], i = t[r];
23
+ if (String(n ?? "") !== String(i ?? "")) return !1;
24
+ }
25
+ return !0;
26
+ }, l = (t, n) => e(() => {
27
+ let e = a(i(t));
28
+ return e.mode === "route" && !n ? { mode: "none" } : e;
29
+ }), u = (t) => ({
30
+ linkPresentation: l(t, !1),
31
+ isLink: e(() => o(i(t))),
32
+ isRouterLink: e(() => !1),
33
+ isActive: e(() => !1),
34
+ navigate: () => Promise.reject(/* @__PURE__ */ Error("[@shtabapp/ui-kit] useLink.navigate() requires an active vue-router instance. Install and register vue-router in the app, or use an href link."))
35
+ }), d = (e) => typeof e == "object" && !!e && "useLink" in e, f = (t, n, a, s, u) => {
36
+ let d = l(a, !0), f = e(() => o(i(a))), p = e(() => d.value.mode === "route"), m = e(() => {
37
+ let e = d.value;
38
+ return e.mode === "route" ? e.linkBindings.to : "";
39
+ }), h = n.useLink({
40
+ to: r(() => m.value),
41
+ replace: r(() => i(u) ?? !1)
42
+ });
43
+ return {
44
+ linkPresentation: d,
45
+ isLink: f,
46
+ isRouterLink: p,
47
+ isActive: e(() => p.value ? i(s) ?? !1 ? h.isExactActive.value ? c(h.route.value.query, t.currentRoute.value.query) : !1 : h.isActive.value : !1),
48
+ navigate: (e) => p.value ? h.navigate(e) : Promise.resolve()
49
+ };
50
+ }, p = (e, r, i) => {
51
+ let a = t()?.proxy?.$router, o = a ? n("RouterLink") : void 0;
52
+ return !a || !d(o) ? u(e) : f(a, o, e, r, i);
53
+ };
54
+ //#endregion
55
+ export { s as n, o as r, p as t };
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "@shtabapp/ui-kit",
3
- "version": "1.26.0",
4
- "description": "Compose-ready Vue 3 components for Shtab UI Kit",
3
+ "version": "1.28.0",
4
+ "description": "Vue 3 component library by Shtab 30+ typed components, design tokens, light/dark themes",
5
5
  "keywords": [
6
6
  "shtab",
7
7
  "vue",
8
- "components"
8
+ "vue3",
9
+ "components",
10
+ "component-library",
11
+ "ui-kit",
12
+ "design-system",
13
+ "design-tokens",
14
+ "typescript"
9
15
  ],
16
+ "homepage": "https://ui.shtab.app",
10
17
  "license": "MIT",
11
18
  "type": "module",
12
19
  "publishConfig": {
@@ -211,8 +218,8 @@
211
218
  },
212
219
  "dependencies": {
213
220
  "chart.js": "^4.5.0",
214
- "@shtabapp/ui-kit-tokens": "^1.13.0",
215
- "@shtabapp/ui-kit-primitives": "^1.11.0"
221
+ "@shtabapp/ui-kit-primitives": "^1.14.0",
222
+ "@shtabapp/ui-kit-tokens": "^1.14.0"
216
223
  },
217
224
  "devDependencies": {
218
225
  "@storybook/vue3-vite": "^10.4.1",
@@ -1 +0,0 @@
1
- let e=require("vue");var t=function(e){return e.SIZE_80=`80`,e.SIZE_40=`40`,e.SIZE_32=`32`,e.SIZE_24=`24`,e.SIZE_20=`20`,e.SIZE_16=`16`,e}({}),n=function(e){return e.CIRCLE=`circle`,e.SQUARE=`square`,e}({}),r=function(e){return e.TEAL=`teal`,e.CYAN=`cyan`,e.INDIGO=`indigo`,e.VIOLET=`violet`,e.PINK=`pink`,e.SURFACE=`surface`,e}({}),i=e=>e.startsWith(`#`),a=e=>i(e)?`s-ui-avatar--color-custom`:`s-ui-avatar--color-${e}`,o=e=>({"--s-ui-avatar-background":e}),s=[`aria-disabled`],c={class:`s-ui-avatar__content`},l=[`src`,`alt`],u=[`role`,`aria-label`],d={key:0,class:`s-ui-avatar__name`},f=(0,e.defineComponent)({inheritAttrs:!1,__name:`SAvatar`,props:{alt:{},color:{default:()=>r.TEAL},disabled:{type:Boolean,default:!1},initialLength:{default:1},name:{},shape:{default:()=>n.CIRCLE},showName:{type:Boolean,default:!0},size:{default:()=>t.SIZE_40},src:{}},setup(n){let r=(0,e.useAttrs)(),f=(0,e.ref)(!1),p=e=>typeof e==`number`||typeof e==`string`,m=(0,e.computed)(()=>{if(p(r.tabindex))return r.tabindex;if(p(r.tabIndex))return r.tabIndex}),h=(0,e.computed)(()=>p(r.tabindex)||p(r.tabIndex)),g=(0,e.computed)(()=>n.disabled?-1:h.value?m.value:0),_=(0,e.computed)(()=>({...r,tabindex:g.value})),v=(0,e.computed)(()=>[`s-ui-avatar--size-${n.size}`,`s-ui-avatar--shape-${n.shape}`,a(n.color),{"s-ui-avatar--disabled":n.disabled,"s-ui-avatar--photo":n.src&&!f.value}]),y=(0,e.computed)(()=>{if(i(n.color))return o(n.color)}),b=e=>{let t=e.split(/\s+/).filter(Boolean);if(t.length===1){let e=t[0];if(e)return e}return t.map(e=>e.slice(0,1)).join(``)},x=(0,e.computed)(()=>n.name?b(n.name):``),S=(0,e.computed)(()=>n.alt?n.alt:n.name?n.name:x.value),C=(0,e.computed)(()=>x.value.slice(0,Math.max(n.initialLength,0))),w={[t.SIZE_80]:`s-ui-typography-label-16-medium`,[t.SIZE_40]:`s-ui-typography-label-14-medium`,[t.SIZE_32]:`s-ui-typography-label-12-medium`,[t.SIZE_24]:`s-ui-typography-label-12-medium`,[t.SIZE_20]:`s-ui-typography-label-12-medium`,[t.SIZE_16]:`s-ui-typography-label-10-medium`},T=(0,e.computed)(()=>w[n.size]),E=()=>{f.value=!0};return(0,e.watch)(()=>n.src,()=>{f.value=!1}),(t,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,(0,e.mergeProps)(_.value,{class:[`s-ui-avatar`,v.value],style:y.value,"aria-disabled":n.disabled||void 0}),[(0,e.createElementVNode)(`span`,c,[n.src&&!f.value?((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:0,class:`s-ui-avatar__image`,src:n.src,alt:S.value,onError:E},null,40,l)):((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:1,class:(0,e.normalizeClass)([`s-ui-avatar__initials`,T.value]),role:n.alt?`img`:void 0,"aria-label":n.alt},(0,e.toDisplayString)(C.value),11,u))]),n.showName&&n.name?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,d,(0,e.toDisplayString)(n.name),1)):(0,e.createCommentVNode)(``,!0)],16,s))}});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
@@ -1,87 +0,0 @@
1
- import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, defineComponent as i, mergeProps as a, normalizeClass as o, openBlock as s, ref as c, toDisplayString as l, useAttrs as u, watch as d } from "vue";
2
- //#region src/components/SAvatar/SAvatar.types.ts
3
- var f = /* @__PURE__ */ function(e) {
4
- return e.SIZE_80 = "80", e.SIZE_40 = "40", e.SIZE_32 = "32", e.SIZE_24 = "24", e.SIZE_20 = "20", e.SIZE_16 = "16", e;
5
- }({}), p = /* @__PURE__ */ function(e) {
6
- return e.CIRCLE = "circle", e.SQUARE = "square", e;
7
- }({}), m = /* @__PURE__ */ function(e) {
8
- return e.TEAL = "teal", e.CYAN = "cyan", e.INDIGO = "indigo", e.VIOLET = "violet", e.PINK = "pink", e.SURFACE = "surface", e;
9
- }({}), h = (e) => e.startsWith("#"), g = (e) => h(e) ? "s-ui-avatar--color-custom" : `s-ui-avatar--color-${e}`, _ = (e) => ({ "--s-ui-avatar-background": e }), v = ["aria-disabled"], y = { class: "s-ui-avatar__content" }, b = ["src", "alt"], x = ["role", "aria-label"], S = {
10
- key: 0,
11
- class: "s-ui-avatar__name"
12
- }, C = /* @__PURE__ */ i({
13
- inheritAttrs: !1,
14
- __name: "SAvatar",
15
- props: {
16
- alt: {},
17
- color: { default: () => m.TEAL },
18
- disabled: {
19
- type: Boolean,
20
- default: !1
21
- },
22
- initialLength: { default: 1 },
23
- name: {},
24
- shape: { default: () => p.CIRCLE },
25
- showName: {
26
- type: Boolean,
27
- default: !0
28
- },
29
- size: { default: () => f.SIZE_40 },
30
- src: {}
31
- },
32
- setup(i) {
33
- let p = u(), m = c(!1), C = (e) => typeof e == "number" || typeof e == "string", w = e(() => {
34
- if (C(p.tabindex)) return p.tabindex;
35
- if (C(p.tabIndex)) return p.tabIndex;
36
- }), T = e(() => C(p.tabindex) || C(p.tabIndex)), E = e(() => i.disabled ? -1 : T.value ? w.value : 0), D = e(() => ({
37
- ...p,
38
- tabindex: E.value
39
- })), O = e(() => [
40
- `s-ui-avatar--size-${i.size}`,
41
- `s-ui-avatar--shape-${i.shape}`,
42
- g(i.color),
43
- {
44
- "s-ui-avatar--disabled": i.disabled,
45
- "s-ui-avatar--photo": i.src && !m.value
46
- }
47
- ]), k = e(() => {
48
- if (h(i.color)) return _(i.color);
49
- }), A = (e) => {
50
- let t = e.split(/\s+/).filter(Boolean);
51
- if (t.length === 1) {
52
- let e = t[0];
53
- if (e) return e;
54
- }
55
- return t.map((e) => e.slice(0, 1)).join("");
56
- }, j = e(() => i.name ? A(i.name) : ""), M = e(() => i.alt ? i.alt : i.name ? i.name : j.value), N = e(() => j.value.slice(0, Math.max(i.initialLength, 0))), P = {
57
- [f.SIZE_80]: "s-ui-typography-label-16-medium",
58
- [f.SIZE_40]: "s-ui-typography-label-14-medium",
59
- [f.SIZE_32]: "s-ui-typography-label-12-medium",
60
- [f.SIZE_24]: "s-ui-typography-label-12-medium",
61
- [f.SIZE_20]: "s-ui-typography-label-12-medium",
62
- [f.SIZE_16]: "s-ui-typography-label-10-medium"
63
- }, F = e(() => P[i.size]), I = () => {
64
- m.value = !0;
65
- };
66
- return d(() => i.src, () => {
67
- m.value = !1;
68
- }), (e, c) => (s(), n("span", a(D.value, {
69
- class: ["s-ui-avatar", O.value],
70
- style: k.value,
71
- "aria-disabled": i.disabled || void 0
72
- }), [r("span", y, [i.src && !m.value ? (s(), n("img", {
73
- key: 0,
74
- class: "s-ui-avatar__image",
75
- src: i.src,
76
- alt: M.value,
77
- onError: I
78
- }, null, 40, b)) : (s(), n("span", {
79
- key: 1,
80
- class: o(["s-ui-avatar__initials", F.value]),
81
- role: i.alt ? "img" : void 0,
82
- "aria-label": i.alt
83
- }, l(N.value), 11, x))]), i.showName && i.name ? (s(), n("span", S, l(i.name), 1)) : t("", !0)], 16, v));
84
- }
85
- });
86
- //#endregion
87
- export { f as i, m as n, p as r, C as t };
@@ -1 +0,0 @@
1
- let e=require("vue"),t=require("vue-router");var n=e=>e?typeof e==`string`?{mode:`href`,rootTag:`a`,linkBindings:{href:e}}:{mode:`route`,rootTag:`router-link`,linkBindings:{to:e}}:{mode:`none`},r=e=>n(e).mode!==`none`,i=(e,t)=>{if(e.mode===`none`)return{};if(e.mode===`route`){let n={...e.linkBindings};return t?.replace&&(n.replace=!0),n}return e.linkBindings},a=(e,t)=>{let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(String(n??``)!==String(i??``))return!1}return!0},o=(t,r)=>(0,e.computed)(()=>{let i=n((0,e.toValue)(t));return i.mode===`route`&&!r?{mode:`none`}:i}),s=t=>({linkPresentation:o(t,!1),isLink:(0,e.computed)(()=>r((0,e.toValue)(t))),isRouterLink:(0,e.computed)(()=>!1),isActive:(0,e.computed)(()=>!1),navigate:()=>Promise.reject(Error(`[@shtabapp/ui-kit] useLink.navigate() requires an active vue-router instance. Install and register vue-router in the app, or use an href link.`))}),c=(n,i,s)=>{let c=(0,e.inject)(t.routeLocationKey,null),l=o(n,!0),u=(0,e.computed)(()=>r((0,e.toValue)(n))),d=(0,e.computed)(()=>l.value.mode===`route`),f=(0,e.computed)(()=>{let e=l.value;return e.mode===`route`?e.linkBindings.to:``}),p=t.RouterLink.useLink({to:(0,e.toRef)(()=>f.value),replace:(0,e.toRef)(()=>(0,e.toValue)(s)??!1)});return{linkPresentation:l,isLink:u,isRouterLink:d,isActive:(0,e.computed)(()=>d.value?(0,e.toValue)(i)??!1?p.isExactActive.value?c?a(p.route.value.query,c.query):p.isExactActive.value:!1:p.isActive.value:!1),navigate:e=>d.value?p.navigate(e):Promise.resolve()}},l=(n,r,i)=>(0,e.inject)(t.routerKey,null)?c(n,r,i):s(n);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -1,53 +0,0 @@
1
- import { computed as e, inject as t, toRef as n, toValue as r } from "vue";
2
- import { RouterLink as i, routeLocationKey as a, routerKey as o } from "vue-router";
3
- //#region src/utils/vueRouterLinkPresentation.ts
4
- var s = (e) => e ? typeof e == "string" ? {
5
- mode: "href",
6
- rootTag: "a",
7
- linkBindings: { href: e }
8
- } : {
9
- mode: "route",
10
- rootTag: "router-link",
11
- linkBindings: { to: e }
12
- } : { mode: "none" }, c = (e) => s(e).mode !== "none", l = (e, t) => {
13
- if (e.mode === "none") return {};
14
- if (e.mode === "route") {
15
- let n = { ...e.linkBindings };
16
- return t?.replace && (n.replace = !0), n;
17
- }
18
- return e.linkBindings;
19
- }, u = (e, t) => {
20
- let n = Object.keys(e), r = Object.keys(t);
21
- if (n.length !== r.length) return !1;
22
- for (let r of n) {
23
- let n = e[r], i = t[r];
24
- if (String(n ?? "") !== String(i ?? "")) return !1;
25
- }
26
- return !0;
27
- }, d = (t, n) => e(() => {
28
- let e = s(r(t));
29
- return e.mode === "route" && !n ? { mode: "none" } : e;
30
- }), f = (t) => ({
31
- linkPresentation: d(t, !1),
32
- isLink: e(() => c(r(t))),
33
- isRouterLink: e(() => !1),
34
- isActive: e(() => !1),
35
- navigate: () => Promise.reject(/* @__PURE__ */ Error("[@shtabapp/ui-kit] useLink.navigate() requires an active vue-router instance. Install and register vue-router in the app, or use an href link."))
36
- }), p = (o, s, l) => {
37
- let f = t(a, null), p = d(o, !0), m = e(() => c(r(o))), h = e(() => p.value.mode === "route"), g = e(() => {
38
- let e = p.value;
39
- return e.mode === "route" ? e.linkBindings.to : "";
40
- }), _ = i.useLink({
41
- to: n(() => g.value),
42
- replace: n(() => r(l) ?? !1)
43
- });
44
- return {
45
- linkPresentation: p,
46
- isLink: m,
47
- isRouterLink: h,
48
- isActive: e(() => h.value ? r(s) ?? !1 ? _.isExactActive.value ? f ? u(_.route.value.query, f.query) : _.isExactActive.value : !1 : _.isActive.value : !1),
49
- navigate: (e) => h.value ? _.navigate(e) : Promise.resolve()
50
- };
51
- }, m = (e, n, r) => t(o, null) ? p(e, n, r) : f(e);
52
- //#endregion
53
- export { l as n, c as r, m as t };