asheeui 0.6.6 → 0.6.7

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.
@@ -22,18 +22,6 @@ export interface TooltipProps extends BaseTooltipProps {
22
22
  * @default false
23
23
  */
24
24
  isDisabled?: boolean;
25
- /**
26
- * Extra classes applied to every tooltip instance.
27
- *
28
- * @default ""
29
- */
30
- className?: string;
31
- /**
32
- * Whether to render the tooltip in a Floating UI portal.
33
- * When true, the tooltip is rendered at the document body level,
34
- * escaping any parent DOM hierarchy. Defaults to true.
35
- */
36
- portal?: boolean;
37
25
  }
38
26
  /**
39
27
  * A floating tooltip that appears on hover or focus of a child element.
@@ -47,12 +35,6 @@ export interface TooltipProps extends BaseTooltipProps {
47
35
  * automatically handles viewport edge detection and flipping. It is fully
48
36
  * accessible with keyboard focus support.
49
37
  *
50
- * By default, the tooltip uses FloatingPortal to render at the document body
51
- * level. This ensures the tooltip escapes CSS containment, overflow clipping,
52
- * and stacking context issues. The portal can be disabled via the `portal` prop
53
- * or `components.tooltip.portal` in the config if the tooltip needs to stay
54
- * within a specific parent container.
55
- *
56
38
  * @param props - Tooltip configuration options.
57
39
  * @param props.content - The content to display inside the tooltip.
58
40
  * @param props.children - The child element that triggers the tooltip.
@@ -65,7 +47,6 @@ export interface TooltipProps extends BaseTooltipProps {
65
47
  * @param props.offset - Offset from the trigger. Defaults to 8.
66
48
  * @param props.radius - Corner rounding. Defaults to "md".
67
49
  * @param props.showArrow - Whether to show a pointer arrow. Defaults to false.
68
- * @param props.portal - Whether to render the tooltip in a portal. Defaults to true.
69
50
  * @param props.className - Extra classes for the tooltip.
70
51
  *
71
52
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAcf,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,kBAAkB,CAAC;AAO1B,KAAK,gBAAgB,GAAG,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,OAAO,yGAsNnB,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAcf,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,kBAAkB,CAAC;AAO1B,KAAK,gBAAgB,GAAG,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,OAAO,yGAyMnB,CAAC"}
@@ -1,167 +1,159 @@
1
1
  "use client";
2
2
  import { jsx as a, Fragment as S, jsxs as h } from "react/jsx-runtime";
3
- import { offset as Z, flip as $, shift as ee, arrow as oe, useFloating as se, autoUpdate as te, useHover as re, useFocus as ae, useDismiss as le, useRole as ne, useInteractions as de, FloatingArrow as ie, FloatingPortal as pe } from "@floating-ui/react";
4
- import { forwardRef as me, useRef as ce, useState as ue, isValidElement as fe, cloneElement as ve } from "react";
5
- import { useAsheeConfig as we } from "../../libs/context.js";
6
- import { resolveCascade as s, resolveRadiusKey as ye, resolveClassKey as i } from "../../utils/resolve-token.js";
7
- import { FALLBACK_TOOLTIP_CONFIG as o } from "./tooltip-config.js";
8
- import { TOOLTIP_PADDING_X_CLASS as Ae, TOOLTIP_PADDING_Y_CLASS as Oe, TOOLTIP_FONT_CLASS as Se } from "./tooltip-styles.js";
9
- import { RADIUS_CLASS as he } from "../../shared/radius.js";
10
- import { cn as Pe } from "../../utils/cn.js";
11
- import { resolveVariantClass as Re } from "../../shared/variant.js";
12
- const Te = me(
3
+ import { offset as J, flip as Q, shift as W, arrow as Z, useFloating as $, autoUpdate as ee, useHover as se, useFocus as oe, useDismiss as re, useRole as te, useInteractions as ae, FloatingPortal as le, FloatingArrow as ne } from "@floating-ui/react";
4
+ import { forwardRef as de, useRef as ie, useState as me, isValidElement as pe, cloneElement as ce } from "react";
5
+ import { useAsheeConfig as ue } from "../../libs/context.js";
6
+ import { resolveCascade as o, resolveRadiusKey as fe, resolveClassKey as i } from "../../utils/resolve-token.js";
7
+ import { FALLBACK_TOOLTIP_CONFIG as s } from "./tooltip-config.js";
8
+ import { TOOLTIP_PADDING_X_CLASS as ve, TOOLTIP_PADDING_Y_CLASS as we, TOOLTIP_FONT_CLASS as ye } from "./tooltip-styles.js";
9
+ import { RADIUS_CLASS as Ae } from "../../shared/radius.js";
10
+ import { cn as Oe } from "../../utils/cn.js";
11
+ import { resolveVariantClass as Se } from "../../shared/variant.js";
12
+ const he = de(
13
13
  ({
14
14
  content: u,
15
- children: t,
16
- variant: P,
17
- color: R,
18
- size: T,
19
- placement: _,
20
- delay: F,
21
- offset: I,
22
- radius: L,
23
- showArrow: N,
15
+ children: r,
16
+ variant: R,
17
+ color: T,
18
+ size: _,
19
+ placement: F,
20
+ delay: I,
21
+ offset: L,
22
+ radius: N,
23
+ showArrow: P,
24
24
  isDisabled: l = !1,
25
- className: z,
26
- portal: K
25
+ className: z
27
26
  }, n) => {
28
27
  var O;
29
- const d = we(), e = (O = d.components) == null ? void 0 : O.tooltip, f = ce(null), [x, D] = ue(!1), p = s(
30
- T,
28
+ const d = ue(), e = (O = d.components) == null ? void 0 : O.tooltip, f = ie(null), [v, K] = me(!1), m = o(
29
+ _,
31
30
  e == null ? void 0 : e.size,
32
31
  void 0,
33
- o.size
34
- ), V = s(
35
- _,
32
+ s.size
33
+ ), x = o(
34
+ F,
36
35
  e == null ? void 0 : e.placement,
37
36
  void 0,
38
- o.placement
39
- ), b = s(
40
- P,
37
+ s.placement
38
+ ), D = o(
39
+ R,
41
40
  e == null ? void 0 : e.variant,
42
41
  d.defaultVariant,
43
- o.variant
44
- ), g = s(
45
- R,
42
+ s.variant
43
+ ), V = o(
44
+ T,
46
45
  e == null ? void 0 : e.color,
47
46
  d.defaultColor,
48
- o.color
49
- ), E = s(F, e == null ? void 0 : e.delay, void 0, o.delay), G = s(
50
- I,
47
+ s.color
48
+ ), b = o(I, e == null ? void 0 : e.delay, void 0, s.delay), g = o(
49
+ L,
51
50
  e == null ? void 0 : e.offset,
52
51
  void 0,
53
- o.offset
54
- ), v = s(
55
- N,
52
+ s.offset
53
+ ), w = o(
54
+ P,
56
55
  e == null ? void 0 : e.showArrow,
57
56
  void 0,
58
- o.showArrow
59
- ), j = ye(
60
- L,
57
+ s.showArrow
58
+ ), E = fe(
59
+ N,
61
60
  e == null ? void 0 : e.radius,
62
61
  d.defaultRadius,
63
- o.radius
64
- ), U = s(
65
- K,
66
- e == null ? void 0 : e.portal,
67
- void 0,
68
- o.portal
62
+ s.radius
63
+ ), G = i(
64
+ m,
65
+ ve,
66
+ s.size
67
+ ), j = i(
68
+ m,
69
+ we,
70
+ s.size
71
+ ), U = i(
72
+ m,
73
+ ye,
74
+ s.size
69
75
  ), X = i(
70
- p,
76
+ E,
71
77
  Ae,
72
- o.size
73
- ), Y = i(
74
- p,
75
- Oe,
76
- o.size
77
- ), k = i(
78
- p,
79
- Se,
80
- o.size
81
- ), B = i(
82
- j,
83
- he,
84
- o.radius
85
- ), w = [
86
- Z(G),
87
- $({ padding: 8 }),
88
- ee({ padding: 8 })
78
+ s.radius
79
+ ), y = [
80
+ J(g),
81
+ Q({ padding: 8 }),
82
+ W({ padding: 8 })
89
83
  ];
90
- v && w.push(oe({ element: f }));
91
- const { refs: m, floatingStyles: C, context: r } = se({
92
- open: x && !l,
93
- onOpenChange: D,
94
- placement: V,
95
- whileElementsMounted: te,
96
- middleware: w
97
- }), H = re(r, {
98
- delay: E,
84
+ w && y.push(Z({ element: f }));
85
+ const { refs: p, floatingStyles: Y, context: t } = $({
86
+ open: v && !l,
87
+ onOpenChange: K,
88
+ placement: x,
89
+ whileElementsMounted: ee,
90
+ middleware: y
91
+ }), k = se(t, {
92
+ delay: b,
99
93
  enabled: !l
100
- }), M = ae(r, { enabled: !l }), q = le(r), J = ne(r, { role: "tooltip" }), { getReferenceProps: y, getFloatingProps: Q } = de([
94
+ }), B = oe(t, { enabled: !l }), H = re(t), M = te(t, { role: "tooltip" }), { getReferenceProps: A, getFloatingProps: q } = ae([
95
+ k,
96
+ B,
101
97
  H,
102
- M,
103
- q,
104
- J
105
- ]), W = fe(t) ? ve(
106
- t,
107
- y({
108
- ref: m.setReference,
109
- ...t.props
98
+ M
99
+ ]), C = pe(r) ? ce(
100
+ r,
101
+ A({
102
+ ref: p.setReference,
103
+ ...r.props
110
104
  })
111
105
  ) : /* @__PURE__ */ a(
112
106
  "span",
113
107
  {
114
- ref: m.setReference,
115
- ...y(),
108
+ ref: p.setReference,
109
+ ...A(),
116
110
  className: "inline-flex",
117
- children: t
118
- }
119
- );
120
- if (!u || l)
121
- return /* @__PURE__ */ a(S, { children: t });
122
- const A = /* @__PURE__ */ a(
123
- "div",
124
- {
125
- ref: (c) => {
126
- m.setFloating(c), typeof n == "function" ? n(c) : n && (n.current = c);
127
- },
128
- style: C,
129
- className: "z-50 pointer-events-none",
130
- ...Q(),
131
- children: /* @__PURE__ */ h(
132
- "div",
133
- {
134
- className: Pe(
135
- "font-medium border whitespace-nowrap select-none bg-background shadow-md transition-all duration-150 ease-out animate-in fade-in-0 zoom-in-95",
136
- X,
137
- Y,
138
- k,
139
- B,
140
- Re(b, g),
141
- z
142
- ),
143
- children: [
144
- u,
145
- v && /* @__PURE__ */ a(
146
- ie,
147
- {
148
- ref: f,
149
- context: r,
150
- className: "fill-current text-border"
151
- }
152
- )
153
- ]
154
- }
155
- )
111
+ children: r
156
112
  }
157
113
  );
158
- return /* @__PURE__ */ h(S, { children: [
159
- W,
160
- U ? /* @__PURE__ */ a(pe, { children: A }) : A
114
+ return !u || l ? /* @__PURE__ */ a(S, { children: r }) : /* @__PURE__ */ h(S, { children: [
115
+ C,
116
+ /* @__PURE__ */ a(le, { children: v && /* @__PURE__ */ a(
117
+ "div",
118
+ {
119
+ ref: (c) => {
120
+ p.setFloating(c), typeof n == "function" ? n(c) : n && (n.current = c);
121
+ },
122
+ style: Y,
123
+ className: "z-50 pointer-events-none",
124
+ ...q(),
125
+ children: /* @__PURE__ */ h(
126
+ "div",
127
+ {
128
+ className: Oe(
129
+ "font-medium border whitespace-nowrap select-none bg-background shadow-md transition-all duration-150 ease-out animate-in fade-in-0 zoom-in-95",
130
+ G,
131
+ j,
132
+ U,
133
+ X,
134
+ Se(D, V),
135
+ e == null ? void 0 : e.className,
136
+ z
137
+ ),
138
+ children: [
139
+ u,
140
+ w && /* @__PURE__ */ a(
141
+ ne,
142
+ {
143
+ ref: f,
144
+ context: t,
145
+ className: "fill-current text-border"
146
+ }
147
+ )
148
+ ]
149
+ }
150
+ )
151
+ }
152
+ ) })
161
153
  ] });
162
154
  }
163
155
  );
164
- Te.displayName = "Tooltip";
156
+ he.displayName = "Tooltip";
165
157
  export {
166
- Te as Tooltip
158
+ he as Tooltip
167
159
  };
@@ -73,15 +73,11 @@ export interface TooltipConfig {
73
73
  */
74
74
  showArrow?: boolean;
75
75
  /**
76
- * Whether to render the tooltip in a Floating UI portal.
77
- * When true, the tooltip is rendered at the document body level,
78
- * escaping any parent DOM hierarchy. This prevents CSS containment,
79
- * overflow clipping, and stacking context issues. Defaults to true
80
- * because tooltips should always appear above other content.
76
+ * Extra classes applied to every tooltip instance.
81
77
  *
82
- * @default true
78
+ * @default ""
83
79
  */
84
- portal?: boolean;
80
+ className?: string;
85
81
  }
86
82
  /**
87
83
  * Default config values registered for the Tooltip component.
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-config.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAOlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,aAAa,CAUlD,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,OAAO,EAAE,aAAa,CAAC;KACxB;CACF"}
1
+ {"version":3,"file":"tooltip-config.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,aAAa,GACb,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC;AAElC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAMlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,aAAa,CAUlD,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,OAAO,EAAE,aAAa,CAAC;KACxB;CACF"}
@@ -5,9 +5,8 @@ const e = {
5
5
  placement: "top",
6
6
  delay: 200,
7
7
  offset: 8,
8
- showArrow: !1,
9
- portal: !0
10
- }, r = {
8
+ showArrow: !1
9
+ }, s = {
11
10
  size: "md",
12
11
  placement: "top",
13
12
  variant: "solid",
@@ -16,10 +15,10 @@ const e = {
16
15
  offset: 8,
17
16
  radius: "md",
18
17
  showArrow: !1,
19
- portal: !0
18
+ className: ""
20
19
  };
21
20
  o("tooltip", e);
22
21
  export {
23
- r as FALLBACK_TOOLTIP_CONFIG,
22
+ s as FALLBACK_TOOLTIP_CONFIG,
24
23
  e as defaultTooltipConfig
25
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asheeui",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",