@scalar/components 0.14.13 → 0.14.14

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 (58) hide show
  1. package/dist/components/ScalarButton/ScalarButton.stories.d.ts +12 -12
  2. package/dist/components/ScalarButton/ScalarButton.vue.d.ts +1 -1
  3. package/dist/components/ScalarButton/variants.d.ts +7 -2
  4. package/dist/components/ScalarButton/variants.d.ts.map +1 -1
  5. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts.map +1 -1
  6. package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.d.ts +6 -2
  7. package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.d.ts.map +1 -1
  8. package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.js +58 -52
  9. package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.d.ts.map +1 -1
  10. package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.js +0 -1
  11. package/dist/components/ScalarContextMenu/ScalarContextMenu.stories.d.ts +3 -3
  12. package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts +3 -3
  13. package/dist/components/ScalarIcon/ScalarIconLegacyAdapter.vue.d.ts +3 -4
  14. package/dist/components/ScalarIcon/ScalarIconLegacyAdapter.vue.d.ts.map +1 -1
  15. package/dist/components/ScalarIcon/utils/index.d.ts +2 -0
  16. package/dist/components/ScalarIcon/utils/index.d.ts.map +1 -1
  17. package/dist/components/ScalarIconButton/ScalarIconButton.stories.d.ts +8 -20
  18. package/dist/components/ScalarIconButton/ScalarIconButton.stories.d.ts.map +1 -1
  19. package/dist/components/ScalarIconButton/ScalarIconButton.vue.d.ts +17 -77
  20. package/dist/components/ScalarIconButton/ScalarIconButton.vue.d.ts.map +1 -1
  21. package/dist/components/ScalarIconButton/ScalarIconButton.vue.js +30 -31
  22. package/dist/components/ScalarIconButton/types.d.ts +50 -0
  23. package/dist/components/ScalarIconButton/types.d.ts.map +1 -0
  24. package/dist/components/ScalarIconButton/variants.d.ts +62 -0
  25. package/dist/components/ScalarIconButton/variants.d.ts.map +1 -0
  26. package/dist/components/ScalarIconButton/variants.js +32 -0
  27. package/dist/components/ScalarLoading/ScalarLoading.stories.d.ts +3 -3
  28. package/dist/components/ScalarMenu/ScalarMenuLink.vue.d.ts +2 -1
  29. package/dist/components/ScalarMenu/ScalarMenuLink.vue.d.ts.map +1 -1
  30. package/dist/components/ScalarMenu/ScalarMenuProduct.vue.d.ts +2 -1
  31. package/dist/components/ScalarMenu/ScalarMenuProduct.vue.d.ts.map +1 -1
  32. package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts +3 -3
  33. package/dist/components/ScalarSearchResults/ScalarSearchResultItem.vue.d.ts +2 -2
  34. package/dist/components/ScalarSearchResults/ScalarSearchResultItem.vue.d.ts.map +1 -1
  35. package/dist/components/ScalarSearchResults/ScalarSearchResults.stories.d.ts +3 -3
  36. package/dist/components/ScalarSidebar/ScalarSidebarGroupToggle.vue.d.ts +3 -2
  37. package/dist/components/ScalarSidebar/ScalarSidebarGroupToggle.vue.d.ts.map +1 -1
  38. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue.d.ts.map +1 -1
  39. package/dist/components/ScalarSidebar/types.d.ts +2 -1
  40. package/dist/components/ScalarSidebar/types.d.ts.map +1 -1
  41. package/dist/components/ScalarTooltip/ScalarTooltip.stories.d.ts +15 -15
  42. package/dist/components/ScalarTooltip/ScalarTooltip.vue.d.ts +21 -17
  43. package/dist/components/ScalarTooltip/ScalarTooltip.vue.d.ts.map +1 -1
  44. package/dist/components/ScalarTooltip/ScalarTooltip.vue.js +13 -11
  45. package/dist/components/ScalarTooltip/constants.d.ts +2 -0
  46. package/dist/components/ScalarTooltip/constants.d.ts.map +1 -1
  47. package/dist/components/ScalarTooltip/constants.js +5 -4
  48. package/dist/components/ScalarTooltip/index.d.ts +2 -0
  49. package/dist/components/ScalarTooltip/index.d.ts.map +1 -1
  50. package/dist/components/ScalarTooltip/types.d.ts +3 -2
  51. package/dist/components/ScalarTooltip/types.d.ts.map +1 -1
  52. package/dist/components/ScalarTooltip/useTooltip.js +17 -17
  53. package/dist/components/ScalarTooltip/useTooltip.test.d.ts.map +1 -0
  54. package/dist/index.js +23 -21
  55. package/dist/style.css +1 -1
  56. package/package.json +6 -6
  57. package/dist/components/ScalarTooltip/__tests__/useTooltip.test.d.ts.map +0 -1
  58. /package/dist/components/ScalarTooltip/{__tests__/useTooltip.test.d.ts → useTooltip.test.d.ts} +0 -0
@@ -4,7 +4,7 @@ declare const meta: {
4
4
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
5
5
  content?: string;
6
6
  delay?: number;
7
- placement?: import("@floating-ui/utils").Placement;
7
+ placement?: import("./types").ScalarTooltipPlacement;
8
8
  offset?: number;
9
9
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, HTMLDivElement, import("vue").ComponentProvideOptions, {
10
10
  P: {};
@@ -16,7 +16,7 @@ declare const meta: {
16
16
  }, Readonly<{
17
17
  content?: string;
18
18
  delay?: number;
19
- placement?: import("@floating-ui/utils").Placement;
19
+ placement?: import("./types").ScalarTooltipPlacement;
20
20
  offset?: number;
21
21
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
22
22
  __isFragment?: never;
@@ -25,7 +25,7 @@ declare const meta: {
25
25
  } & import("vue").ComponentOptionsBase<Readonly<{
26
26
  content?: string;
27
27
  delay?: number;
28
- placement?: import("@floating-ui/utils").Placement;
28
+ placement?: import("./types").ScalarTooltipPlacement;
29
29
  offset?: number;
30
30
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
31
31
  $slots: {
@@ -68,7 +68,7 @@ declare const meta: {
68
68
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
69
69
  content?: string;
70
70
  delay?: number;
71
- placement?: import("@floating-ui/utils").Placement;
71
+ placement?: import("./types").ScalarTooltipPlacement;
72
72
  offset?: number;
73
73
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, HTMLDivElement, import("vue").ComponentProvideOptions, {
74
74
  P: {};
@@ -80,7 +80,7 @@ declare const meta: {
80
80
  }, Readonly<{
81
81
  content?: string;
82
82
  delay?: number;
83
- placement?: import("@floating-ui/utils").Placement;
83
+ placement?: import("./types").ScalarTooltipPlacement;
84
84
  offset?: number;
85
85
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
86
86
  __isFragment?: never;
@@ -89,7 +89,7 @@ declare const meta: {
89
89
  } & import("vue").ComponentOptionsBase<Readonly<{
90
90
  content?: string;
91
91
  delay?: number;
92
- placement?: import("@floating-ui/utils").Placement;
92
+ placement?: import("./types").ScalarTooltipPlacement;
93
93
  offset?: number;
94
94
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
95
95
  $slots: {
@@ -101,7 +101,7 @@ declare const meta: {
101
101
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
102
102
  content?: string;
103
103
  delay?: number;
104
- placement?: import("@floating-ui/utils").Placement;
104
+ placement?: import("./types").ScalarTooltipPlacement;
105
105
  offset?: number;
106
106
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, HTMLDivElement, import("vue").ComponentProvideOptions, {
107
107
  P: {};
@@ -113,7 +113,7 @@ declare const meta: {
113
113
  }, Readonly<{
114
114
  content?: string;
115
115
  delay?: number;
116
- placement?: import("@floating-ui/utils").Placement;
116
+ placement?: import("./types").ScalarTooltipPlacement;
117
117
  offset?: number;
118
118
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
119
119
  __isFragment?: never;
@@ -122,7 +122,7 @@ declare const meta: {
122
122
  } & import("vue").ComponentOptionsBase<Readonly<{
123
123
  content?: string;
124
124
  delay?: number;
125
- placement?: import("@floating-ui/utils").Placement;
125
+ placement?: import("./types").ScalarTooltipPlacement;
126
126
  offset?: number;
127
127
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
128
128
  $slots: {
@@ -139,7 +139,7 @@ declare const meta: {
139
139
  type?: "button" | "submit" | "reset";
140
140
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
141
141
  size: "sm" | "md";
142
- variant: string;
142
+ variant: "solid" | "outlined" | "ghost" | "danger";
143
143
  fullWidth: boolean;
144
144
  type: "button" | "submit" | "reset";
145
145
  }, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
@@ -158,7 +158,7 @@ declare const meta: {
158
158
  type?: "button" | "submit" | "reset";
159
159
  }> & Readonly<{}>, {}, {}, {}, {}, {
160
160
  size: "sm" | "md";
161
- variant: string;
161
+ variant: "solid" | "outlined" | "ghost" | "danger";
162
162
  fullWidth: boolean;
163
163
  type: "button" | "submit" | "reset";
164
164
  }>;
@@ -174,7 +174,7 @@ declare const meta: {
174
174
  type?: "button" | "submit" | "reset";
175
175
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
176
176
  size: "sm" | "md";
177
- variant: string;
177
+ variant: "solid" | "outlined" | "ghost" | "danger";
178
178
  fullWidth: boolean;
179
179
  type: "button" | "submit" | "reset";
180
180
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
@@ -190,7 +190,7 @@ declare const meta: {
190
190
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
191
191
  content?: string;
192
192
  delay?: number;
193
- placement?: import("@floating-ui/utils").Placement;
193
+ placement?: import("./types").ScalarTooltipPlacement;
194
194
  offset?: number;
195
195
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, HTMLDivElement, import("vue").ComponentProvideOptions, {
196
196
  P: {};
@@ -202,7 +202,7 @@ declare const meta: {
202
202
  }, Readonly<{
203
203
  content?: string;
204
204
  delay?: number;
205
- placement?: import("@floating-ui/utils").Placement;
205
+ placement?: import("./types").ScalarTooltipPlacement;
206
206
  offset?: number;
207
207
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
208
208
  __isFragment?: never;
@@ -211,7 +211,7 @@ declare const meta: {
211
211
  } & import("vue").ComponentOptionsBase<Readonly<{
212
212
  content?: string;
213
213
  delay?: number;
214
- placement?: import("@floating-ui/utils").Placement;
214
+ placement?: import("./types").ScalarTooltipPlacement;
215
215
  offset?: number;
216
216
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
217
217
  $slots: {
@@ -1,23 +1,27 @@
1
- import type { Placement } from '@floating-ui/vue';
2
- type __VLS_Props = {
1
+ import type { ScalarTooltipPlacement } from './types';
2
+ /**
3
+ * Scalar tooltip component
4
+ *
5
+ * Adds a tooltip to an interactive element
6
+ *
7
+ * @example
8
+ * <ScalarTooltip content="This is a tooltip">
9
+ * <ScalarButton>Hover Me</ScalarButton>
10
+ * </ScalarTooltip>
11
+ */
12
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
3
13
  content?: string;
4
14
  delay?: number;
5
- placement?: Placement;
15
+ placement?: ScalarTooltipPlacement;
6
16
  offset?: number;
7
- };
8
- declare function __VLS_template(): {
9
- attrs: Partial<{}>;
10
- slots: {
11
- default?(_: {}): any;
12
- };
13
- refs: {
14
- wrapperRef: HTMLDivElement;
15
- };
16
- rootEl: HTMLDivElement;
17
- };
18
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
19
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
20
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
17
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
18
+ content?: string;
19
+ delay?: number;
20
+ placement?: ScalarTooltipPlacement;
21
+ offset?: number;
22
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>, {
23
+ default?(_: {}): any;
24
+ }>;
21
25
  export default _default;
22
26
  type __VLS_WithTemplateSlots<T, S> = T & {
23
27
  new (): {
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTooltip.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/ScalarTooltip.vue"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAOjD,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC;AA0BF,iBAAS,cAAc;WAwCT,OAAO,IAA6B;;yBATrB,GAAG;;;;;;EAc/B;AASD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,6SAOnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarTooltip.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/ScalarTooltip.vue"],"names":[],"mappings":"AAyEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAKrD;;;;;;;;;GASG;;cAIS,MAAM;YACR,MAAM;gBACF,sBAAsB;aACzB,MAAM;;cAHL,MAAM;YACR,MAAM;gBACF,sBAAsB;aACzB,MAAM;;qBA0DY,GAAG;;AAhEhC,wBAkGC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,29 +1,31 @@
1
1
  import { defineComponent as n, ref as f, computed as t, createElementBlock as r, openBlock as c, normalizeClass as d, renderSlot as s } from "vue";
2
- import { useTooltip as u } from "./useTooltip.js";
3
- const i = /* @__PURE__ */ n({
2
+ import { DEFAULT_OFFSET as u, DEFAULT_DELAY as m } from "./constants.js";
3
+ import { useTooltip as p } from "./useTooltip.js";
4
+ const i = {}, v = /* @__PURE__ */ n({
5
+ ...i,
4
6
  __name: "ScalarTooltip",
5
7
  props: {
6
8
  content: { default: "" },
7
- delay: { default: 300 },
9
+ delay: { default: () => m },
8
10
  placement: { default: "top" },
9
- offset: { default: 4 }
11
+ offset: { default: () => u }
10
12
  },
11
13
  setup(l) {
12
- const a = f(null);
13
- return u({
14
+ const o = f(null);
15
+ return p({
14
16
  content: t(() => l.content),
15
17
  delay: t(() => l.delay),
16
18
  placement: t(() => l.placement),
17
19
  offset: t(() => l.offset),
18
20
  targetRef: t(
19
21
  () => {
20
- var e, o;
21
- return ((o = (e = a.value) == null ? void 0 : e.children) == null ? void 0 : o[0]) || a.value || void 0;
22
+ var e, a;
23
+ return ((a = (e = o.value) == null ? void 0 : e.children) == null ? void 0 : a[0]) || o.value || void 0;
22
24
  }
23
25
  )
24
- }), (e, o) => (c(), r("div", {
26
+ }), (e, a) => (c(), r("div", {
25
27
  ref_key: "wrapperRef",
26
- ref: a,
28
+ ref: o,
27
29
  class: d({ contents: !!e.$slots.default })
28
30
  }, [
29
31
  s(e.$slots, "default")
@@ -31,5 +33,5 @@ const i = /* @__PURE__ */ n({
31
33
  }
32
34
  });
33
35
  export {
34
- i as default
36
+ v as default
35
37
  };
@@ -4,4 +4,6 @@ export declare const ELEMENT_ID: "scalar-tooltip";
4
4
  export declare const ELEMENT_CLASS: "scalar-tooltip";
5
5
  /** The default delay for the tooltip */
6
6
  export declare const DEFAULT_DELAY: 300;
7
+ /** The default offset for the tooltip */
8
+ export declare const DEFAULT_OFFSET: 4;
7
9
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/constants.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,eAAO,MAAM,UAAU,kBAA4B,CAAA;AAEnD,4CAA4C;AAC5C,eAAO,MAAM,aAAa,kBAA4B,CAAA;AAEtD,wCAAwC;AACxC,eAAO,MAAM,aAAa,KAAe,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/constants.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,eAAO,MAAM,UAAU,kBAA4B,CAAA;AAEnD,4CAA4C;AAC5C,eAAO,MAAM,aAAa,kBAA4B,CAAA;AAEtD,wCAAwC;AACxC,eAAO,MAAM,aAAa,KAAe,CAAA;AAEzC,yCAAyC;AACzC,eAAO,MAAM,cAAc,GAAa,CAAA"}
@@ -1,6 +1,7 @@
1
- const o = "scalar-tooltip", t = "scalar-tooltip", E = 300;
1
+ const E = "scalar-tooltip", o = "scalar-tooltip", t = 300, c = 4;
2
2
  export {
3
- E as DEFAULT_DELAY,
4
- t as ELEMENT_CLASS,
5
- o as ELEMENT_ID
3
+ t as DEFAULT_DELAY,
4
+ c as DEFAULT_OFFSET,
5
+ o as ELEMENT_CLASS,
6
+ E as ELEMENT_ID
6
7
  };
@@ -1,2 +1,4 @@
1
1
  export { default as ScalarTooltip } from './ScalarTooltip.vue.js';
2
+ export type { ScalarTooltipPlacement, TooltipConfiguration } from './types';
3
+ export { useTooltip } from './useTooltip.js';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAE9D,YAAY,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA"}
@@ -1,13 +1,14 @@
1
- import type { Placement } from '@floating-ui/vue';
1
+ import type { Placement as FloatingPlacement } from '@floating-ui/vue';
2
2
  import type { MaybeRef } from 'vue';
3
3
  /** Timer Utility Type */
4
4
  export type Timer = ReturnType<typeof setTimeout>;
5
5
  /** Might be an element or undefined */
6
6
  export type MaybeElement = Element | undefined | null;
7
+ export type ScalarTooltipPlacement = FloatingPlacement | undefined;
7
8
  /** The configuration for the active tooltip */
8
9
  export type TooltipConfiguration = {
9
10
  content: MaybeRef<string>;
10
- placement?: MaybeRef<Placement>;
11
+ placement?: MaybeRef<ScalarTooltipPlacement>;
11
12
  delay?: MaybeRef<number>;
12
13
  offset?: MaybeRef<number>;
13
14
  targetRef: MaybeRef<MaybeElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEnC,yBAAyB;AACzB,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AAEjD,uCAAuC;AACvC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAA;AAErD,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzB,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC/B,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxB,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzB,SAAS,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;CAClC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEnC,yBAAyB;AACzB,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AAEjD,uCAAuC;AACvC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAA;AAErD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,SAAS,CAAA;AAElE,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzB,SAAS,CAAC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAA;IAC5C,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxB,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzB,SAAS,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAA;CAClC,CAAA"}
@@ -1,7 +1,7 @@
1
- import { useFloating as y, autoUpdate as E, flip as L, shift as g } from "@floating-ui/vue";
2
- import { watch as m, unref as r, ref as p, computed as c } from "vue";
3
- import { ELEMENT_ID as d, ELEMENT_CLASS as T, DEFAULT_DELAY as b } from "./constants.js";
4
- const v = p(), t = p(), s = p(), { floatingStyles: o } = y(
1
+ import { useFloating as p, autoUpdate as y, flip as L, shift as T } from "@floating-ui/vue";
2
+ import { watch as m, unref as r, ref as E, computed as c } from "vue";
3
+ import { ELEMENT_ID as d, ELEMENT_CLASS as g, DEFAULT_DELAY as b, DEFAULT_OFFSET as h } from "./constants.js";
4
+ const v = E(), t = E(), s = E(), { floatingStyles: o } = p(
5
5
  c(() => {
6
6
  var e;
7
7
  return r((e = s.value) == null ? void 0 : e.targetRef);
@@ -12,8 +12,8 @@ const v = p(), t = p(), s = p(), { floatingStyles: o } = y(
12
12
  var e;
13
13
  return r((e = s.value) == null ? void 0 : e.placement);
14
14
  }),
15
- whileElementsMounted: E,
16
- middleware: c(() => [L(), g()])
15
+ whileElementsMounted: y,
16
+ middleware: c(() => [L(), T()])
17
17
  }
18
18
  );
19
19
  m(o, () => {
@@ -25,41 +25,41 @@ m(
25
25
  if (t.value)
26
26
  if (e) {
27
27
  t.value.textContent = r(e == null ? void 0 : e.content) ?? null;
28
- const n = r(e == null ? void 0 : e.offset);
28
+ const n = r(e == null ? void 0 : e.offset) ?? h;
29
29
  t.value.style.setProperty("--scalar-tooltip-offset", `${n}px`), t.value.style.setProperty("display", "block");
30
30
  } else
31
31
  t.value.textContent = null, t.value.style.removeProperty("--scalar-tooltip-offset"), t.value.style.setProperty("display", "none");
32
32
  },
33
33
  { deep: !0 }
34
34
  );
35
- function h() {
35
+ function A() {
36
36
  if (t.value)
37
37
  return;
38
38
  const e = document.getElementById(d);
39
- e ? t.value = e : (t.value = document.createElement("div"), t.value.role = "tooltip", t.value.id = d, t.value.classList.add(T), t.value.classList.add("scalar-app"), t.value.style.setProperty("display", "none"), t.value.addEventListener("mouseleave", u), document.body.appendChild(t.value));
39
+ e ? t.value = e : (t.value = document.createElement("div"), t.value.role = "tooltip", t.value.id = d, t.value.classList.add(g), t.value.classList.add("scalar-app"), t.value.style.setProperty("display", "none"), t.value.addEventListener("mouseleave", u), document.body.appendChild(t.value));
40
40
  }
41
41
  function u(e) {
42
- C(e) && (f(), s.value = void 0);
42
+ P(e) && (f(), s.value = void 0);
43
43
  }
44
- function A(e) {
44
+ function C(e) {
45
45
  e.key === "Escape" && (e.stopPropagation(), u(e));
46
46
  }
47
47
  function f() {
48
48
  v.value && (clearTimeout(v.value), v.value = void 0);
49
49
  }
50
- function C(e) {
50
+ function P(e) {
51
51
  var i;
52
52
  const n = r((i = s.value) == null ? void 0 : i.targetRef);
53
53
  return e instanceof MouseEvent && e.relatedTarget instanceof Element && n ? e.relatedTarget.id !== d && e.relatedTarget !== n : !0;
54
54
  }
55
- function _(e) {
56
- h();
55
+ function F(e) {
56
+ A();
57
57
  function n(a) {
58
58
  const l = r(e.delay) ?? b;
59
59
  f(), l > 0 ? v.value = setTimeout(() => i(), l) : i();
60
60
  }
61
61
  function i(a) {
62
- f(), document.addEventListener("keydown", A, { once: !0, capture: !0 }), s.value = e;
62
+ f(), document.addEventListener("keydown", C, { once: !0, capture: !0 }), s.value = e;
63
63
  }
64
64
  m(
65
65
  () => r(e.targetRef),
@@ -70,6 +70,6 @@ function _(e) {
70
70
  );
71
71
  }
72
72
  export {
73
- h as initializeTooltipElement,
74
- _ as useTooltip
73
+ A as initializeTooltipElement,
74
+ F as useTooltip
75
75
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTooltip.test.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTooltip/useTooltip.test.ts"],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /* empty css */
2
- import { compose as d, cva as p, cx as u, tw as m, useBindCx as c } from "@scalar/use-hooks/useBindCx";
3
- import { default as S } from "./components/ScalarButton/ScalarButton.vue.js";
2
+ import { compose as d, cva as p, cx as u, tw as m, useBindCx as s } from "@scalar/use-hooks/useBindCx";
3
+ import { default as x } from "./components/ScalarButton/ScalarButton.vue.js";
4
4
  import { default as i } from "./components/ScalarCodeBlock/ScalarCodeBlock.vue.js";
5
5
  /* empty css */
6
- import { default as M } from "./components/ScalarColorModeToggle/ScalarColorModeToggle.vue.js";
6
+ import { default as T } from "./components/ScalarColorModeToggle/ScalarColorModeToggle.vue.js";
7
7
  import { default as b } from "./components/ScalarColorModeToggle/ScalarColorModeToggleButton.vue.js";
8
8
  import { default as F } from "./components/ScalarCombobox/ScalarCombobox.vue.js";
9
9
  import { default as B } from "./components/ScalarCombobox/ScalarComboboxMultiselect.vue.js";
@@ -27,10 +27,10 @@ import { default as ea } from "./components/ScalarHeader/ScalarHeader.vue.js";
27
27
  import { default as la } from "./components/ScalarHeader/ScalarHeaderButton.vue.js";
28
28
  import { default as da } from "./components/ScalarIcon/ScalarIconLegacyAdapter.vue.js";
29
29
  import { default as ua } from "./components/ScalarIconButton/ScalarIconButton.vue.js";
30
- import { default as ca } from "./components/ScalarListbox/ScalarListbox.vue.js";
31
- import { default as Sa } from "./components/ScalarListbox/ScalarListboxItem.vue.js";
30
+ import { default as sa } from "./components/ScalarListbox/ScalarListbox.vue.js";
31
+ import { default as xa } from "./components/ScalarListbox/ScalarListboxItem.vue.js";
32
32
  import { default as ia } from "./components/ScalarListbox/ScalarListboxCheckbox.vue.js";
33
- import { default as Ma } from "./components/ScalarMarkdown/ScalarMarkdown.vue.js";
33
+ import { default as Ta } from "./components/ScalarMarkdown/ScalarMarkdown.vue.js";
34
34
  /* empty css */
35
35
  import { default as ba } from "./components/ScalarMenu/ScalarMenu.vue.js";
36
36
  import { default as Fa } from "./components/ScalarMenu/ScalarMenuButton.vue.js";
@@ -56,10 +56,10 @@ import { default as er } from "./components/ScalarSidebar/ScalarSidebarItems.vue
56
56
  import { default as lr } from "./components/ScalarSidebar/ScalarSidebarSearchButton.vue.js";
57
57
  import { default as dr } from "./components/ScalarSidebar/ScalarSidebarSearchInput.vue.js";
58
58
  import { default as ur } from "./components/ScalarTeleport/ScalarTeleport.vue.js";
59
- import { default as cr } from "./components/ScalarTeleport/ScalarTeleportRoot.vue.js";
60
- import { default as Sr } from "./components/ScalarTextArea/ScalarTextArea.vue.js";
59
+ import { default as sr } from "./components/ScalarTeleport/ScalarTeleportRoot.vue.js";
60
+ import { default as xr } from "./components/ScalarTextArea/ScalarTextArea.vue.js";
61
61
  import { default as ir } from "./components/ScalarTextInput/ScalarTextInput.vue.js";
62
- import { default as Mr } from "./components/ScalarToggle/ScalarToggle.vue.js";
62
+ import { default as Tr } from "./components/ScalarToggle/ScalarToggle.vue.js";
63
63
  import { default as br } from "./components/ScalarTooltip/ScalarTooltip.vue.js";
64
64
  /* empty css */
65
65
  import { default as Fr } from "./components/ScalarVirtualText/ScalarVirtualText.vue.js";
@@ -75,11 +75,12 @@ import { useLoadingState as Or } from "./components/ScalarLoading/ScalarLoading.
75
75
  import { default as Yr } from "./components/ScalarModal/ScalarModal.vue.js";
76
76
  import { useModal as jr } from "./components/ScalarModal/ScalarModal.vue2.js";
77
77
  import { TELEPORT_SYMBOL as zr, useProvideTeleport as Jr, useTeleport as Kr } from "./components/ScalarTeleport/useTeleport.js";
78
- import { addScalarClassesToHeadless as Qr } from "./helpers/add-scalar-classes.js";
78
+ import { useTooltip as Qr } from "./components/ScalarTooltip/useTooltip.js";
79
+ import { addScalarClassesToHeadless as Xr } from "./helpers/add-scalar-classes.js";
79
80
  export {
80
- S as ScalarButton,
81
+ x as ScalarButton,
81
82
  i as ScalarCodeBlock,
82
- M as ScalarColorModeToggle,
83
+ T as ScalarColorModeToggle,
83
84
  b as ScalarColorModeToggleButton,
84
85
  Cr as ScalarColorModeToggleIcon,
85
86
  F as ScalarCombobox,
@@ -109,11 +110,11 @@ export {
109
110
  yr as ScalarIcon,
110
111
  ua as ScalarIconButton,
111
112
  da as ScalarIconLegacyAdapter,
112
- ca as ScalarListbox,
113
+ sa as ScalarListbox,
113
114
  ia as ScalarListboxCheckbox,
114
- Sa as ScalarListboxItem,
115
+ xa as ScalarListboxItem,
115
116
  Ar as ScalarLoading,
116
- Ma as ScalarMarkdown,
117
+ Ta as ScalarMarkdown,
117
118
  ba as ScalarMenu,
118
119
  Fa as ScalarMenuButton,
119
120
  Ca as ScalarMenuLink,
@@ -138,22 +139,23 @@ export {
138
139
  lr as ScalarSidebarSearchButton,
139
140
  dr as ScalarSidebarSearchInput,
140
141
  ur as ScalarTeleport,
141
- cr as ScalarTeleportRoot,
142
- Sr as ScalarTextArea,
142
+ sr as ScalarTeleportRoot,
143
+ xr as ScalarTextArea,
143
144
  ir as ScalarTextInput,
144
- Mr as ScalarToggle,
145
+ Tr as ScalarToggle,
145
146
  br as ScalarTooltip,
146
147
  Fr as ScalarVirtualText,
147
148
  zr as TELEPORT_SYMBOL,
148
- Qr as addScalarClassesToHeadless,
149
+ Xr as addScalarClassesToHeadless,
149
150
  d as compose,
150
151
  p as cva,
151
152
  u as cx,
152
153
  Br as styles,
153
154
  m as tw,
154
- c as useBindCx,
155
+ s as useBindCx,
155
156
  Or as useLoadingState,
156
157
  jr as useModal,
157
158
  Jr as useProvideTeleport,
158
- Kr as useTeleport
159
+ Kr as useTeleport,
160
+ Qr as useTooltip
159
161
  };