@leaflink/stash 50.6.0 → 50.7.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.
package/dist/Tooltip.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as g, ref as n, computed as r, openBlock as d, createElementBlock as S, createElementVNode as i, renderSlot as l, createBlock as T, Teleport as E, normalizeStyle as f, unref as $, createTextVNode as k, toDisplayString as O } from "vue";
2
- import { u as A, a as B, f as F, o as D, b as I } from "./floating-ui.vue-pzUuloyX.js";
1
+ import { defineComponent as g, ref as n, computed as r, openBlock as d, createElementBlock as S, createElementVNode as i, renderSlot as l, createBlock as T, Teleport as E, normalizeStyle as f, unref as $, createTextVNode as k, toDisplayString as B } from "vue";
2
+ import { u as D, a as O, f as A, o as F, b as I } from "./floating-ui.vue-pzUuloyX.js";
3
3
  import { a as P } from "./index-ConQ3o31.js";
4
4
  const z = {
5
5
  ref: "wrapper",
@@ -9,6 +9,7 @@ const z = {
9
9
  props: {
10
10
  disableTeleport: { type: Boolean, default: !1 },
11
11
  side: { default: "top" },
12
+ isDisabled: { type: Boolean, default: !1 },
12
13
  isOpen: { type: Boolean, default: !1 },
13
14
  teleportTo: { default: "#stash-menus-mount-node" },
14
15
  text: { default: "" }
@@ -19,31 +20,31 @@ const z = {
19
20
  right: "left",
20
21
  bottom: "top",
21
22
  left: "right"
22
- }, e = u, a = n(null), p = n(null), c = n(null), { isOutside: h } = P(a), _ = r(() => !h.value || e.isOpen), y = r(() => e.side), { floatingStyles: x, middlewareData: o, placement: v } = A(a, c, {
23
- whileElementsMounted: B,
24
- placement: y,
25
- middleware: [F(), D(N), I({ element: p })]
26
- }), b = r(() => {
23
+ }, t = u, a = n(null), p = n(null), c = n(null), { isOutside: h } = P(a), y = r(() => !t.isDisabled && (!h.value || t.isOpen)), _ = r(() => t.side), { floatingStyles: x, middlewareData: o, placement: b } = D(a, c, {
24
+ whileElementsMounted: O,
25
+ placement: _,
26
+ middleware: [A(), F(N), I({ element: p })]
27
+ }), v = r(() => {
27
28
  var s, w;
28
- const t = m[v.value];
29
+ const e = m[b.value];
29
30
  return {
30
31
  left: ((s = o.value.arrow) == null ? void 0 : s.x) != null ? `${o.value.arrow.x}px` : "",
31
32
  top: ((w = o.value.arrow) == null ? void 0 : w.y) != null ? `${o.value.arrow.y}px` : "",
32
- [t]: `-${M}px`
33
+ [e]: `-${M}px`
33
34
  };
34
35
  });
35
- return (t, s) => (d(), S("div", z, [
36
+ return (e, s) => (d(), S("div", z, [
36
37
  i("span", {
37
38
  ref_key: "anchor",
38
39
  ref: a,
39
40
  "data-test": "stash-tooltip|anchor",
40
41
  class: "stash-tooltip__anchor"
41
42
  }, [
42
- l(t.$slots, "default")
43
+ l(e.$slots, "default")
43
44
  ], 512),
44
45
  (d(), T(E, {
45
- to: e.teleportTo,
46
- disabled: e.disableTeleport
46
+ to: t.teleportTo,
47
+ disabled: t.disableTeleport
47
48
  }, [
48
49
  i("div", {
49
50
  ref_key: "tooltip",
@@ -53,19 +54,19 @@ const z = {
53
54
  role: "tooltip",
54
55
  style: f({
55
56
  ...$(x),
56
- opacity: _.value ? 0.95 : 0
57
+ opacity: y.value ? 0.95 : 0
57
58
  })
58
59
  }, [
59
- l(t.$slots, "icon"),
60
- l(t.$slots, "content", {}, () => [
61
- k(O(e.text), 1)
60
+ l(e.$slots, "icon"),
61
+ l(e.$slots, "content", {}, () => [
62
+ k(B(t.text), 1)
62
63
  ]),
63
- l(t.$slots, "secondaryIcon"),
64
+ l(e.$slots, "secondaryIcon"),
64
65
  i("div", {
65
66
  ref_key: "floatingArrow",
66
67
  ref: p,
67
68
  class: "stash-tooltip__arrow tw-absolute tw-z-behind tw-h-[12px] tw-w-[12px] tw-rotate-45 tw-bg-ice-900",
68
- style: f(b.value)
69
+ style: f(v.value)
69
70
  }, null, 4)
70
71
  ], 4)
71
72
  ], 8, ["to", "disabled"]))
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../src/components/Tooltip/Tooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { arrow, autoUpdate, flip, offset, type Side, useFloating } from '@floating-ui/vue';\n import { useMouseInElement } from '@vueuse/core';\n import { computed, ref } from 'vue';\n\n export type TooltipSide = Side;\n\n const ARROW_OFFSET_PX = 6;\n const OFFSET_DISTANCE_PX = 12;\n\n const SIDE_MAP: Record<TooltipSide, TooltipSide> = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n };\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n export interface TooltipSlots {\n /**\n * The content to display in the tooltip. This may be text node, an element, or a component.\n */\n content: any;\n /**\n * The default slot is the element or component to which the tooltip will be anchored.\n */\n default: any;\n /**\n * A slot for the primary icon. This icon will be displayed before the text or content.\n */\n icon: any;\n /**\n * A slot for the secondary icon. This icon will be displayed after the text or content.\n */\n secondaryIcon: any;\n }\n /* eslint-enable @typescript-eslint/no-explicit-any */\n\n defineSlots<TooltipSlots>();\n\n export interface TooltipProps {\n /**\n * Disables teleporting the popover menu to an external element\n * @default false\n */\n disableTeleport?: boolean;\n /**\n * Sets the placement of the menu\n * @default 'top'\n */\n side?: TooltipSide;\n /**\n * Sets if the menu is open. If not set from the parent context, the menu will be controlled internally.\n * @default false\n */\n isOpen?: boolean;\n /**\n * The query selector where the tooltip should be teleported\n * @default '#stash-menus-mount-node'\n */\n teleportTo?: string | HTMLElement;\n /**\n * String content to display within the tooltip\n * @default ''\n */\n text?: string;\n }\n\n const props = withDefaults(defineProps<TooltipProps>(), {\n disableTeleport: false,\n isOpen: false,\n side: 'top',\n teleportTo: '#stash-menus-mount-node',\n text: '',\n });\n\n const anchor = ref<HTMLElement | null>(null);\n const floatingArrow = ref<HTMLElement | null>(null);\n const tooltip = ref<HTMLElement | null>(null);\n\n const { isOutside } = useMouseInElement(anchor);\n\n const open = computed(() => !isOutside.value || props.isOpen);\n const placementSetting = computed(() => props.side);\n\n const { floatingStyles, middlewareData, placement } = useFloating(anchor, tooltip, {\n whileElementsMounted: autoUpdate,\n placement: placementSetting,\n middleware: [flip(), offset(OFFSET_DISTANCE_PX), arrow({ element: floatingArrow })],\n });\n\n const arrowStyles = computed(() => {\n const arrowPosition = SIDE_MAP[placement.value];\n\n return {\n left: middlewareData.value.arrow?.x != null ? `${middlewareData.value.arrow.x}px` : '',\n top: middlewareData.value.arrow?.y != null ? `${middlewareData.value.arrow.y}px` : '',\n [arrowPosition]: `-${ARROW_OFFSET_PX}px`,\n };\n });\n</script>\n\n<template>\n <div ref=\"wrapper\" class=\"stash-tooltip__wrapper tw-relative tw-inline-flex tw-h-fit tw-w-fit\">\n <span ref=\"anchor\" data-test=\"stash-tooltip|anchor\" class=\"stash-tooltip__anchor\">\n <slot></slot>\n </span>\n <Teleport :to=\"props.teleportTo\" :disabled=\"props.disableTeleport\">\n <div\n ref=\"tooltip\"\n data-test=\"stash-tooltip\"\n class=\"stash-tooltip tw-pointer-events-none tw-z-screen tw-flex tw-w-[148px] tw-flex-col tw-items-center tw-whitespace-normal tw-rounded tw-bg-ice-900 tw-p-3 tw-text-center tw-text-xs tw-text-white tw-opacity-0 tw-shadow tw-transition-opacity\"\n role=\"tooltip\"\n :style=\"{\n ...floatingStyles,\n opacity: open ? 0.95 : 0,\n }\"\n >\n <slot name=\"icon\"></slot>\n <slot name=\"content\">{{ props.text }}</slot>\n <slot name=\"secondaryIcon\"></slot>\n <div\n ref=\"floatingArrow\"\n class=\"stash-tooltip__arrow tw-absolute tw-z-behind tw-h-[12px] tw-w-[12px] tw-rotate-45 tw-bg-ice-900\"\n :style=\"arrowStyles\"\n ></div>\n </div>\n </Teleport>\n </div>\n</template>\n"],"names":["ARROW_OFFSET_PX","OFFSET_DISTANCE_PX","SIDE_MAP","props","__props","anchor","ref","floatingArrow","tooltip","isOutside","useMouseInElement","open","computed","placementSetting","floatingStyles","middlewareData","placement","useFloating","autoUpdate","flip","offset","arrow","arrowStyles","arrowPosition","_a","_b"],"mappings":";;;;;;GAOQA,IAAkB,GAClBC,IAAqB;;;;;;;;;;AAE3B,UAAMC,IAA6C;AAAA,MACjD,KAAK;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,IACR,GAqDMC,IAAQC,GAQRC,IAASC,EAAwB,IAAI,GACrCC,IAAgBD,EAAwB,IAAI,GAC5CE,IAAUF,EAAwB,IAAI,GAEtC,EAAE,WAAAG,EAAA,IAAcC,EAAkBL,CAAM,GAExCM,IAAOC,EAAS,MAAM,CAACH,EAAU,SAASN,EAAM,MAAM,GACtDU,IAAmBD,EAAS,MAAMT,EAAM,IAAI,GAE5C,EAAE,gBAAAW,GAAgB,gBAAAC,GAAgB,WAAAC,EAAc,IAAAC,EAAYZ,GAAQG,GAAS;AAAA,MACjF,sBAAsBU;AAAA,MACtB,WAAWL;AAAA,MACX,YAAY,CAACM,EAAK,GAAGC,EAAOnB,CAAkB,GAAGoB,EAAM,EAAE,SAASd,GAAe,CAAC;AAAA,IAAA,CACnF,GAEKe,IAAcV,EAAS,MAAM;;AAC3B,YAAAW,IAAgBrB,EAASc,EAAU,KAAK;AAEvC,aAAA;AAAA,QACL,QAAMQ,IAAAT,EAAe,MAAM,UAArB,gBAAAS,EAA4B,MAAK,OAAO,GAAGT,EAAe,MAAM,MAAM,CAAC,OAAO;AAAA,QACpF,OAAKU,IAAAV,EAAe,MAAM,UAArB,gBAAAU,EAA4B,MAAK,OAAO,GAAGV,EAAe,MAAM,MAAM,CAAC,OAAO;AAAA,QACnF,CAACQ,CAAa,GAAG,IAAIvB,CAAe;AAAA,MACtC;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../src/components/Tooltip/Tooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { arrow, autoUpdate, flip, offset, type Side, useFloating } from '@floating-ui/vue';\n import { useMouseInElement } from '@vueuse/core';\n import { computed, ref } from 'vue';\n\n export type TooltipSide = Side;\n\n const ARROW_OFFSET_PX = 6;\n const OFFSET_DISTANCE_PX = 12;\n\n const SIDE_MAP: Record<TooltipSide, TooltipSide> = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n };\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n export interface TooltipSlots {\n /**\n * The content to display in the tooltip. This may be text node, an element, or a component.\n */\n content: any;\n /**\n * The default slot is the element or component to which the tooltip will be anchored.\n */\n default: any;\n /**\n * A slot for the primary icon. This icon will be displayed before the text or content.\n */\n icon: any;\n /**\n * A slot for the secondary icon. This icon will be displayed after the text or content.\n */\n secondaryIcon: any;\n }\n /* eslint-enable @typescript-eslint/no-explicit-any */\n\n defineSlots<TooltipSlots>();\n\n export interface TooltipProps {\n /**\n * Disables teleporting the popover menu to an external element\n * @default false\n */\n disableTeleport?: boolean;\n /**\n * Sets the placement of the menu\n * @default 'top'\n */\n side?: TooltipSide;\n /**\n * Disables the tooltip\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Sets if the menu is open. If not set from the parent context, the menu will be controlled internally.\n * @default false\n */\n isOpen?: boolean;\n /**\n * The query selector where the tooltip should be teleported\n * @default '#stash-menus-mount-node'\n */\n teleportTo?: string | HTMLElement;\n /**\n * String content to display within the tooltip\n * @default ''\n */\n text?: string;\n }\n\n const props = withDefaults(defineProps<TooltipProps>(), {\n disableTeleport: false,\n isDisabled: false,\n isOpen: false,\n side: 'top',\n teleportTo: '#stash-menus-mount-node',\n text: '',\n });\n\n const anchor = ref<HTMLElement | null>(null);\n const floatingArrow = ref<HTMLElement | null>(null);\n const tooltip = ref<HTMLElement | null>(null);\n\n const { isOutside } = useMouseInElement(anchor);\n\n const open = computed(() => !props.isDisabled && (!isOutside.value || props.isOpen));\n const placementSetting = computed(() => props.side);\n\n const { floatingStyles, middlewareData, placement } = useFloating(anchor, tooltip, {\n whileElementsMounted: autoUpdate,\n placement: placementSetting,\n middleware: [flip(), offset(OFFSET_DISTANCE_PX), arrow({ element: floatingArrow })],\n });\n\n const arrowStyles = computed(() => {\n const arrowPosition = SIDE_MAP[placement.value];\n\n return {\n left: middlewareData.value.arrow?.x != null ? `${middlewareData.value.arrow.x}px` : '',\n top: middlewareData.value.arrow?.y != null ? `${middlewareData.value.arrow.y}px` : '',\n [arrowPosition]: `-${ARROW_OFFSET_PX}px`,\n };\n });\n</script>\n\n<template>\n <div ref=\"wrapper\" class=\"stash-tooltip__wrapper tw-relative tw-inline-flex tw-h-fit tw-w-fit\">\n <span ref=\"anchor\" data-test=\"stash-tooltip|anchor\" class=\"stash-tooltip__anchor\">\n <slot></slot>\n </span>\n <Teleport :to=\"props.teleportTo\" :disabled=\"props.disableTeleport\">\n <div\n ref=\"tooltip\"\n data-test=\"stash-tooltip\"\n class=\"stash-tooltip tw-pointer-events-none tw-z-screen tw-flex tw-w-[148px] tw-flex-col tw-items-center tw-whitespace-normal tw-rounded tw-bg-ice-900 tw-p-3 tw-text-center tw-text-xs tw-text-white tw-opacity-0 tw-shadow tw-transition-opacity\"\n role=\"tooltip\"\n :style=\"{\n ...floatingStyles,\n opacity: open ? 0.95 : 0,\n }\"\n >\n <slot name=\"icon\"></slot>\n <slot name=\"content\">{{ props.text }}</slot>\n <slot name=\"secondaryIcon\"></slot>\n <div\n ref=\"floatingArrow\"\n class=\"stash-tooltip__arrow tw-absolute tw-z-behind tw-h-[12px] tw-w-[12px] tw-rotate-45 tw-bg-ice-900\"\n :style=\"arrowStyles\"\n ></div>\n </div>\n </Teleport>\n </div>\n</template>\n"],"names":["ARROW_OFFSET_PX","OFFSET_DISTANCE_PX","SIDE_MAP","props","__props","anchor","ref","floatingArrow","tooltip","isOutside","useMouseInElement","open","computed","placementSetting","floatingStyles","middlewareData","placement","useFloating","autoUpdate","flip","offset","arrow","arrowStyles","arrowPosition","_a","_b"],"mappings":";;;;;;GAOQA,IAAkB,GAClBC,IAAqB;;;;;;;;;;;AAE3B,UAAMC,IAA6C;AAAA,MACjD,KAAK;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,IACR,GA0DMC,IAAQC,GASRC,IAASC,EAAwB,IAAI,GACrCC,IAAgBD,EAAwB,IAAI,GAC5CE,IAAUF,EAAwB,IAAI,GAEtC,EAAE,WAAAG,EAAA,IAAcC,EAAkBL,CAAM,GAExCM,IAAOC,EAAS,MAAM,CAACT,EAAM,eAAe,CAACM,EAAU,SAASN,EAAM,OAAO,GAC7EU,IAAmBD,EAAS,MAAMT,EAAM,IAAI,GAE5C,EAAE,gBAAAW,GAAgB,gBAAAC,GAAgB,WAAAC,EAAc,IAAAC,EAAYZ,GAAQG,GAAS;AAAA,MACjF,sBAAsBU;AAAA,MACtB,WAAWL;AAAA,MACX,YAAY,CAACM,EAAK,GAAGC,EAAOnB,CAAkB,GAAGoB,EAAM,EAAE,SAASd,GAAe,CAAC;AAAA,IAAA,CACnF,GAEKe,IAAcV,EAAS,MAAM;;AAC3B,YAAAW,IAAgBrB,EAASc,EAAU,KAAK;AAEvC,aAAA;AAAA,QACL,QAAMQ,IAAAT,EAAe,MAAM,UAArB,gBAAAS,EAA4B,MAAK,OAAO,GAAGT,EAAe,MAAM,MAAM,CAAC,OAAO;AAAA,QACpF,OAAKU,IAAAV,EAAe,MAAM,UAArB,gBAAAU,EAA4B,MAAK,OAAO,GAAGV,EAAe,MAAM,MAAM,CAAC,OAAO;AAAA,QACnF,CAACQ,CAAa,GAAG,IAAIvB,CAAe;AAAA,MACtC;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -35,18 +35,21 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
35
35
 
36
36
  declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TooltipProps>, {
37
37
  disableTeleport: boolean;
38
+ isDisabled: boolean;
38
39
  isOpen: boolean;
39
40
  side: string;
40
41
  teleportTo: string;
41
42
  text: string;
42
43
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TooltipProps>, {
43
44
  disableTeleport: boolean;
45
+ isDisabled: boolean;
44
46
  isOpen: boolean;
45
47
  side: string;
46
48
  teleportTo: string;
47
49
  text: string;
48
50
  }>>> & Readonly<{}>, {
49
51
  text: string;
52
+ isDisabled: boolean;
50
53
  teleportTo: string | HTMLElement;
51
54
  isOpen: boolean;
52
55
  side: Side;
@@ -65,6 +68,11 @@ export declare interface TooltipProps {
65
68
  * @default 'top'
66
69
  */
67
70
  side?: TooltipSide;
71
+ /**
72
+ * Disables the tooltip
73
+ * @default false
74
+ */
75
+ isDisabled?: boolean;
68
76
  /**
69
77
  * Sets if the menu is open. If not set from the parent context, the menu will be controlled internally.
70
78
  * @default false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflink/stash",
3
- "version": "50.6.0",
3
+ "version": "50.7.0",
4
4
  "description": "LeafLink's design system.",
5
5
  "homepage": "https://stash.leaflink.com",
6
6
  "main": "./dist/index.ts",