@nar-bus/ui-kit 1.9.0 → 1.10.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.
@@ -0,0 +1,51 @@
1
+ /**
2
+ * FIX-498 — Pure tooltip positioning with viewport flip + clamp.
3
+ *
4
+ * The Tooltip component used to split positioning between JS (top/left set on the
5
+ * portaled node) and CSS translate classes (`-translate-x-1/2 -translate-y-full`).
6
+ * With no JS-side number to test, a near-viewport-edge tooltip overflowed and was
7
+ * clipped (e.g. header status bar under the 42px --header-height).
8
+ *
9
+ * This helper places the tooltip FULLY in JS — including the half-size centering
10
+ * the CSS translate used to perform — so overflow is testable. `side` becomes a
11
+ * PREFERENCE: if the primary axis overflows and the opposite side has room, it
12
+ * flips; the cross-axis is clamped into the viewport (`max` applied last so an
13
+ * oversized tooltip sticks to the margin edge instead of going negative).
14
+ *
15
+ * Extracted as a pure function because jsdom computes no layout, so the component
16
+ * itself can't be positioned in vitest — the math is asserted here instead.
17
+ */
18
+ export type TooltipSide = "top" | "right" | "bottom" | "left";
19
+ export interface Rect {
20
+ top: number;
21
+ left: number;
22
+ right: number;
23
+ bottom: number;
24
+ width: number;
25
+ height: number;
26
+ }
27
+ export interface Size {
28
+ width: number;
29
+ height: number;
30
+ }
31
+ export interface Viewport {
32
+ width: number;
33
+ height: number;
34
+ }
35
+ export interface TooltipPlacement {
36
+ top: number;
37
+ left: number;
38
+ side: TooltipSide;
39
+ }
40
+ /**
41
+ * Compute the final on-screen position for a tooltip.
42
+ *
43
+ * @param trigger Bounding rect of the trigger element.
44
+ * @param tooltip Measured natural size of the tooltip.
45
+ * @param side Preferred side (may flip to its opposite on overflow).
46
+ * @param viewport Viewport dimensions.
47
+ * @param gap Trigger↔tooltip offset (the legacy ±8).
48
+ * @param margin Minimum padding from the viewport edge.
49
+ */
50
+ export declare function computeTooltipPosition(trigger: Rect, tooltip: Size, side: TooltipSide, viewport: Viewport, gap?: number, margin?: number): TooltipPlacement;
51
+ //# sourceMappingURL=tooltipPosition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltipPosition.d.ts","sourceRoot":"","sources":["../../src/utils/tooltipPosition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB;AA0DD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,EACb,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,QAAQ,EAClB,GAAG,SAAI,EACP,MAAM,SAAI,GACT,gBAAgB,CAyBlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nar-bus/ui-kit",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -14,6 +14,10 @@
14
14
  "types": "./dist/i18n/resources.d.ts",
15
15
  "import": "./dist/i18n/resources.js"
16
16
  },
17
+ "./map": {
18
+ "types": "./dist/map.d.ts",
19
+ "import": "./dist/map.js"
20
+ },
17
21
  "./theme.css": "./dist/theme.css"
18
22
  },
19
23
  "files": [
@@ -47,9 +51,16 @@
47
51
  "sonner": "^2.0.0",
48
52
  "@tanstack/react-table": "^8.0.0",
49
53
  "@tanstack/react-virtual": "^3.0.0",
50
- "tailwindcss": "^4.0.0"
54
+ "tailwindcss": "^4.0.0",
55
+ "maplibre-gl": "^5.24.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "maplibre-gl": {
59
+ "optional": true
60
+ }
51
61
  },
52
62
  "devDependencies": {
63
+ "maplibre-gl": "^5.24.0",
53
64
  "@nar-bus/ui-shared": "*",
54
65
  "@storybook/addon-a11y": "^8.4.0",
55
66
  "@storybook/addon-essentials": "^8.6.18",