@nordcom/nordstar-tooltip 0.0.75

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/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2026 Filiph Sandström <filfat@hotmail.se>
4
+ Copyright (c) 2023-2024 Nordcom AB <opensource@nordcom.io>
5
+ Copyright (c) 2020 Junior Garcia (Next UI)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # [@nordcom/nordstar-tooltip](https://nordcominc.github.io/nordstar/docs/components/tooltip/?utm_source=nordstar&utm_campaign=oss)
2
+
3
+ A thin rule that divides content visually or semantically.
4
+
5
+ ## Installation
6
+
7
+ > [!TIP]
8
+ > This is an internal package and should probably not be installed by itself, but rather come as a dependency of `@nordcom/nordstar`.
9
+
10
+ ```sh
11
+ npm install @nordcom/nordstar-tooltip
12
+ ```
@@ -0,0 +1,4 @@
1
+ import { default as Tooltip } from './tooltip';
2
+ export type { TooltipContentProps, TooltipProps } from './tooltip';
3
+ export { Tooltip };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import Tooltip from "./tooltip.js";
2
+ export { Tooltip };
@@ -0,0 +1,34 @@
1
+ import { ComponentPropsWithoutRef, ForwardRefExoticComponent, RefAttributes, FC } from 'react';
2
+ import * as Primitive from '@radix-ui/react-tooltip';
3
+ export type TooltipContentProps = ComponentPropsWithoutRef<typeof Primitive.Content>;
4
+ export type TooltipProps = ComponentPropsWithoutRef<typeof Primitive.Root>;
5
+ /**
6
+ * `<Tooltip/>`, a floating label that explains an element on hover or keyboard focus.
7
+ *
8
+ * Wraps `@radix-ui/react-tooltip` as a compound component: mount `<Tooltip.Provider>` once near the
9
+ * root of the app (or section) to share open/close timing, then compose `<Tooltip>` with
10
+ * `<Tooltip.Trigger>` and `<Tooltip.Content>`. Radix handles focus, dismissal, collision-aware
11
+ * positioning, and the `aria-describedby` wiring; the content is re-fitted to the Nordstar token
12
+ * contract. Tooltips are supplementary — never put essential or interactive content inside one.
13
+ *
14
+ * @param {object} props - Every `@radix-ui/react-tooltip` Root prop (`open`, `defaultOpen`, `delayDuration`, …).
15
+ * @returns {React.ReactNode} The tooltip root that scopes a single trigger/content pair.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <Tooltip.Provider>
20
+ * <Tooltip>
21
+ * <Tooltip.Trigger>Hover me</Tooltip.Trigger>
22
+ * <Tooltip.Content>Helpful hint</Tooltip.Content>
23
+ * </Tooltip>
24
+ * </Tooltip.Provider>
25
+ * ```
26
+ */
27
+ declare const Tooltip: ((props: TooltipProps) => import("react").JSX.Element) & {
28
+ Content: ForwardRefExoticComponent<Omit<Primitive.TooltipContentProps & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
29
+ displayName: string;
30
+ Provider: FC<Primitive.TooltipProviderProps>;
31
+ Trigger: ForwardRefExoticComponent<Primitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>>;
32
+ };
33
+ export default Tooltip;
34
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/tooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,KAAK,wBAAwB,EAAiC,MAAM,OAAO,CAAC;AAErF,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;AA6BrF,MAAM,MAAM,YAAY,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,OAAO,WACD,YAAY;;;;;CASvB,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import { cn } from "@nordcom/nordstar-system";
3
+ import * as Primitive from "@radix-ui/react-tooltip";
4
+ import { forwardRef } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/tooltip.tsx
7
+ /**
8
+ * `<Tooltip.Content/>`, the portal-rendered bubble shown next to the trigger.
9
+ *
10
+ * @param {object} props - Every `@radix-ui/react-tooltip` Content prop.
11
+ * @param {number} [props.sideOffset=6] - Pixel gap between the trigger and the bubble.
12
+ * @returns {React.ReactNode} The portalled tooltip content with a matching arrow.
13
+ */
14
+ var TooltipContent = forwardRef(({ className, sideOffset = 6, children, ...props }, ref) => /* @__PURE__ */ jsx(Primitive.Portal, { children: /* @__PURE__ */ jsxs(Primitive.Content, {
15
+ className: cn("z-50 max-w-xs select-none text-balance rounded-sm border-2 border-foreground border-solid bg-foreground px-2 py-1 font-body font-semibold text-background text-xs leading-tight shadow-lg", className),
16
+ ref,
17
+ sideOffset,
18
+ ...props,
19
+ children: [children, /* @__PURE__ */ jsx(Primitive.Arrow, { className: "fill-foreground" })]
20
+ }) }));
21
+ TooltipContent.displayName = "Nordstar.Tooltip.Content";
22
+ /**
23
+ * `<Tooltip/>`, a floating label that explains an element on hover or keyboard focus.
24
+ *
25
+ * Wraps `@radix-ui/react-tooltip` as a compound component: mount `<Tooltip.Provider>` once near the
26
+ * root of the app (or section) to share open/close timing, then compose `<Tooltip>` with
27
+ * `<Tooltip.Trigger>` and `<Tooltip.Content>`. Radix handles focus, dismissal, collision-aware
28
+ * positioning, and the `aria-describedby` wiring; the content is re-fitted to the Nordstar token
29
+ * contract. Tooltips are supplementary — never put essential or interactive content inside one.
30
+ *
31
+ * @param {object} props - Every `@radix-ui/react-tooltip` Root prop (`open`, `defaultOpen`, `delayDuration`, …).
32
+ * @returns {React.ReactNode} The tooltip root that scopes a single trigger/content pair.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <Tooltip.Provider>
37
+ * <Tooltip>
38
+ * <Tooltip.Trigger>Hover me</Tooltip.Trigger>
39
+ * <Tooltip.Content>Helpful hint</Tooltip.Content>
40
+ * </Tooltip>
41
+ * </Tooltip.Provider>
42
+ * ```
43
+ */
44
+ var Tooltip = Object.assign((props) => {
45
+ return /* @__PURE__ */ jsx(Primitive.Root, { ...props });
46
+ }, {
47
+ Content: TooltipContent,
48
+ displayName: "Nordstar.Tooltip",
49
+ Provider: Primitive.Provider,
50
+ Trigger: Primitive.Trigger
51
+ });
52
+ //#endregion
53
+ export { Tooltip as default };
54
+
55
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJ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UIsQ0FBQSxDQUMvQjtHQUNMLENBQUEsQ0FFMUI7QUFDQSxlQUFlLGNBQWM7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBMEI3QixJQUFNLFVBQVUsT0FBTyxRQUNsQixVQUF3QjtDQUNyQixPQUFPLG9CQUFDLFVBQVUsTUFBWCxFQUFnQixHQUFJLE1BQVEsQ0FBQTtBQUN2QyxHQUNBO0NBQ0ksU0FBUztDQUNULGFBQWE7Q0FDYixVQUFVLFVBQVU7Q0FDcEIsU0FBUyxVQUFVO0FBQ3ZCLENBQ0oifQ==
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "@nordcom/nordstar-tooltip",
4
+ "type": "module",
5
+ "version": "0.0.75",
6
+ "description": "A floating label that explains an element on hover or focus.",
7
+ "files": [
8
+ "dist",
9
+ "CHANGELOG.md",
10
+ "README.md"
11
+ ],
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "sideEffects": false,
26
+ "keywords": [
27
+ "nordstar",
28
+ "nordcom",
29
+ "component",
30
+ "react",
31
+ "tooltip",
32
+ "popover",
33
+ "nordstar-tooltip"
34
+ ],
35
+ "author": {
36
+ "name": "Filiph Sandström",
37
+ "email": "filfat@hotmail.se",
38
+ "url": "https://github.com/filiphsps/"
39
+ },
40
+ "contributors": [
41
+ {
42
+ "name": "Filiph Sandström",
43
+ "email": "filfat@hotmail.se",
44
+ "url": "https://github.com/filiphsps/"
45
+ }
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/NordcomInc/nordstar.git",
50
+ "directory": "packages/components/tooltip"
51
+ },
52
+ "license": "MIT",
53
+ "bugs": {
54
+ "url": "https://github.com/NordcomInc/nordstar/issues"
55
+ },
56
+ "homepage": "https://nordcominc.github.io/nordstar/docs/components/tooltip/",
57
+ "dependencies": {
58
+ "@radix-ui/react-tooltip": "1.2.9",
59
+ "@nordcom/nordstar-system": "0.0.75"
60
+ },
61
+ "peerDependencies": {
62
+ "react": ">=19",
63
+ "react-dom": ">=19"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "25.9.3",
67
+ "@types/react": "19.2.17",
68
+ "@types/react-dom": "19.2.3",
69
+ "react": "19.2.7",
70
+ "react-dom": "19.2.7",
71
+ "typescript": "6.0.3",
72
+ "vite": "8.0.16",
73
+ "vite-plugin-dts": "5.0.2"
74
+ },
75
+ "scripts": {
76
+ "build": "tsc && vite build",
77
+ "dev": "vite build --watch",
78
+ "clean": "rm -rf dist coverage .turbo .next *.tsbuildinfo *.log",
79
+ "typecheck": "tsc --noEmit"
80
+ }
81
+ }