@behivetech/atoms.tooltip 0.2.4 → 1.0.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/README.md +2 -2
- package/dist/index.cjs +2 -110
- package/dist/index.js +1 -132
- package/docs.json +1 -1
- package/package.json +10 -8
- package/tooltip.tsx +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Names a control on hover and on keyboard focus, built on
|
|
4
4
|
[`@radix-ui/react-tooltip`](https://www.radix-ui.com/primitives/docs/components/tooltip).
|
|
5
5
|
|
|
6
|
-
Docs: https://
|
|
6
|
+
Docs: https://platform.behivetech.com/behivetech/atoms/tooltip
|
|
7
7
|
|
|
8
8
|
Intended for icon-only controls, where the tooltip is the only thing naming the
|
|
9
9
|
control. It replaces the `title` attribute, which delays about a second, is
|
|
@@ -14,7 +14,7 @@ placement.
|
|
|
14
14
|
|
|
15
15
|
```jsx
|
|
16
16
|
import { Tooltip } from "@behivetech/atoms.tooltip";
|
|
17
|
-
import { BoxIcon } from "@behivetech/
|
|
17
|
+
import { BoxIcon } from "@behivetech/icons.box";
|
|
18
18
|
|
|
19
19
|
<Tooltip label="Rectangle" side="right">
|
|
20
20
|
<button type="button">
|
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,67 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
34
|
-
var require_classnames = __commonJS({
|
|
35
|
-
"../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
(function() {
|
|
38
|
-
"use strict";
|
|
39
|
-
var hasOwn = {}.hasOwnProperty;
|
|
40
|
-
function classNames() {
|
|
41
|
-
var classes = "";
|
|
42
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
43
|
-
var arg = arguments[i];
|
|
44
|
-
if (arg) {
|
|
45
|
-
classes = appendClass(classes, parseValue(arg));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return classes;
|
|
49
|
-
}
|
|
50
|
-
function parseValue(arg) {
|
|
51
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
52
|
-
return arg;
|
|
53
|
-
}
|
|
54
|
-
if (typeof arg !== "object") {
|
|
55
|
-
return "";
|
|
56
|
-
}
|
|
57
|
-
if (Array.isArray(arg)) {
|
|
58
|
-
return classNames.apply(null, arg);
|
|
59
|
-
}
|
|
60
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
61
|
-
return arg.toString();
|
|
62
|
-
}
|
|
63
|
-
var classes = "";
|
|
64
|
-
for (var key in arg) {
|
|
65
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
66
|
-
classes = appendClass(classes, key);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return classes;
|
|
70
|
-
}
|
|
71
|
-
function appendClass(value, newClass) {
|
|
72
|
-
if (!newClass) {
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
if (value) {
|
|
76
|
-
return value + " " + newClass;
|
|
77
|
-
}
|
|
78
|
-
return value + newClass;
|
|
79
|
-
}
|
|
80
|
-
if (typeof module2 !== "undefined" && module2.exports) {
|
|
81
|
-
classNames.default = classNames;
|
|
82
|
-
module2.exports = classNames;
|
|
83
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
84
|
-
define("classnames", [], function() {
|
|
85
|
-
return classNames;
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
window.classNames = classNames;
|
|
89
|
-
}
|
|
90
|
-
})();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
30
|
// index.ts
|
|
95
31
|
var index_exports = {};
|
|
96
32
|
__export(index_exports, {
|
|
@@ -101,42 +37,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
101
37
|
// tooltip.tsx
|
|
102
38
|
var import_react = require("react");
|
|
103
39
|
var RadixTooltip = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
104
|
-
|
|
105
|
-
// ../../../../packages/registry/class-names/dist/index.js
|
|
106
|
-
var import_classnames = __toESM(require_classnames(), 1);
|
|
107
|
-
var getClassName = ({
|
|
108
|
-
className,
|
|
109
|
-
modifiers = {},
|
|
110
|
-
rootClass,
|
|
111
|
-
styles = {}
|
|
112
|
-
}) => {
|
|
113
|
-
function getModifiers() {
|
|
114
|
-
const updatedModifiers = {};
|
|
115
|
-
const modifierKeys = Object.keys(modifiers);
|
|
116
|
-
if (modifierKeys.length) {
|
|
117
|
-
modifierKeys.forEach((modKey) => {
|
|
118
|
-
const classKey = `${rootClass}--${modKey}`;
|
|
119
|
-
const newClassName = styles[classKey] || classKey;
|
|
120
|
-
updatedModifiers[newClassName] = modifiers[modKey] ?? false;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return updatedModifiers;
|
|
124
|
-
}
|
|
125
|
-
function getChildClass(childClassName) {
|
|
126
|
-
const classKey = `${rootClass}__${childClassName}`;
|
|
127
|
-
return styles[classKey] || classKey;
|
|
128
|
-
}
|
|
129
|
-
function getRootStyles() {
|
|
130
|
-
return (0, import_classnames.default)(
|
|
131
|
-
className,
|
|
132
|
-
{
|
|
133
|
-
...getModifiers()
|
|
134
|
-
},
|
|
135
|
-
styles[rootClass] || rootClass
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
return [getRootStyles(), getChildClass];
|
|
139
|
-
};
|
|
40
|
+
var import_get_class_name = require("@behivetech/get-class-name");
|
|
140
41
|
|
|
141
42
|
// tooltip.module.scss
|
|
142
43
|
var tooltip_module_default = {
|
|
@@ -160,7 +61,7 @@ var Tooltip = ({
|
|
|
160
61
|
children,
|
|
161
62
|
className
|
|
162
63
|
}) => {
|
|
163
|
-
const [, getChildClass] = getClassName({
|
|
64
|
+
const [, getChildClass] = (0, import_get_class_name.getClassName)({
|
|
164
65
|
className,
|
|
165
66
|
rootClass: "BHT__Tooltip",
|
|
166
67
|
styles: tooltip_module_default
|
|
@@ -187,12 +88,3 @@ var Tooltip = ({
|
|
|
187
88
|
0 && (module.exports = {
|
|
188
89
|
Tooltip
|
|
189
90
|
});
|
|
190
|
-
/*! Bundled license information:
|
|
191
|
-
|
|
192
|
-
classnames/index.js:
|
|
193
|
-
(*!
|
|
194
|
-
Copyright (c) 2018 Jed Watson.
|
|
195
|
-
Licensed under the MIT License (MIT), see
|
|
196
|
-
http://jedwatson.github.io/classnames
|
|
197
|
-
*)
|
|
198
|
-
*/
|
package/dist/index.js
CHANGED
|
@@ -1,129 +1,7 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
28
|
-
var require_classnames = __commonJS({
|
|
29
|
-
"../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
(function() {
|
|
32
|
-
"use strict";
|
|
33
|
-
var hasOwn = {}.hasOwnProperty;
|
|
34
|
-
function classNames() {
|
|
35
|
-
var classes = "";
|
|
36
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
37
|
-
var arg = arguments[i];
|
|
38
|
-
if (arg) {
|
|
39
|
-
classes = appendClass(classes, parseValue(arg));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return classes;
|
|
43
|
-
}
|
|
44
|
-
function parseValue(arg) {
|
|
45
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
46
|
-
return arg;
|
|
47
|
-
}
|
|
48
|
-
if (typeof arg !== "object") {
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
if (Array.isArray(arg)) {
|
|
52
|
-
return classNames.apply(null, arg);
|
|
53
|
-
}
|
|
54
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
55
|
-
return arg.toString();
|
|
56
|
-
}
|
|
57
|
-
var classes = "";
|
|
58
|
-
for (var key in arg) {
|
|
59
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
60
|
-
classes = appendClass(classes, key);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return classes;
|
|
64
|
-
}
|
|
65
|
-
function appendClass(value, newClass) {
|
|
66
|
-
if (!newClass) {
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
if (value) {
|
|
70
|
-
return value + " " + newClass;
|
|
71
|
-
}
|
|
72
|
-
return value + newClass;
|
|
73
|
-
}
|
|
74
|
-
if (typeof module !== "undefined" && module.exports) {
|
|
75
|
-
classNames.default = classNames;
|
|
76
|
-
module.exports = classNames;
|
|
77
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
78
|
-
define("classnames", [], function() {
|
|
79
|
-
return classNames;
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
window.classNames = classNames;
|
|
83
|
-
}
|
|
84
|
-
})();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
1
|
// tooltip.tsx
|
|
89
2
|
import { isValidElement } from "react";
|
|
90
3
|
import * as RadixTooltip from "@radix-ui/react-tooltip";
|
|
91
|
-
|
|
92
|
-
// ../../../../packages/registry/class-names/dist/index.js
|
|
93
|
-
var import_classnames = __toESM(require_classnames(), 1);
|
|
94
|
-
var getClassName = ({
|
|
95
|
-
className,
|
|
96
|
-
modifiers = {},
|
|
97
|
-
rootClass,
|
|
98
|
-
styles = {}
|
|
99
|
-
}) => {
|
|
100
|
-
function getModifiers() {
|
|
101
|
-
const updatedModifiers = {};
|
|
102
|
-
const modifierKeys = Object.keys(modifiers);
|
|
103
|
-
if (modifierKeys.length) {
|
|
104
|
-
modifierKeys.forEach((modKey) => {
|
|
105
|
-
const classKey = `${rootClass}--${modKey}`;
|
|
106
|
-
const newClassName = styles[classKey] || classKey;
|
|
107
|
-
updatedModifiers[newClassName] = modifiers[modKey] ?? false;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return updatedModifiers;
|
|
111
|
-
}
|
|
112
|
-
function getChildClass(childClassName) {
|
|
113
|
-
const classKey = `${rootClass}__${childClassName}`;
|
|
114
|
-
return styles[classKey] || classKey;
|
|
115
|
-
}
|
|
116
|
-
function getRootStyles() {
|
|
117
|
-
return (0, import_classnames.default)(
|
|
118
|
-
className,
|
|
119
|
-
{
|
|
120
|
-
...getModifiers()
|
|
121
|
-
},
|
|
122
|
-
styles[rootClass] || rootClass
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return [getRootStyles(), getChildClass];
|
|
126
|
-
};
|
|
4
|
+
import { getClassName } from "@behivetech/get-class-name";
|
|
127
5
|
|
|
128
6
|
// tooltip.module.scss
|
|
129
7
|
var tooltip_module_default = {
|
|
@@ -173,12 +51,3 @@ var Tooltip = ({
|
|
|
173
51
|
export {
|
|
174
52
|
Tooltip
|
|
175
53
|
};
|
|
176
|
-
/*! Bundled license information:
|
|
177
|
-
|
|
178
|
-
classnames/index.js:
|
|
179
|
-
(*!
|
|
180
|
-
Copyright (c) 2018 Jed Watson.
|
|
181
|
-
Licensed under the MIT License (MIT), see
|
|
182
|
-
http://jedwatson.github.io/classnames
|
|
183
|
-
*)
|
|
184
|
-
*/
|
package/docs.json
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behivetech/atoms.tooltip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Names a control on hover and on keyboard focus, built on [`@radix-ui/react-tooltip`](https://www.radix-ui.com/primitives/docs/components/tooltip).",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"private": false,
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"types": "./dist/index.d.ts",
|
|
@@ -27,32 +30,31 @@
|
|
|
27
30
|
"tags": []
|
|
28
31
|
},
|
|
29
32
|
"dependencies": {
|
|
30
|
-
"@
|
|
33
|
+
"@behivetech/get-class-name": "1.0.0",
|
|
34
|
+
"@radix-ui/react-tooltip": "^1.4.1"
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|
|
33
37
|
"react": "^19.2.7",
|
|
34
38
|
"react-dom": "^19.2.7"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
41
|
+
"@bht-component-registry/env": "0.2.0",
|
|
37
42
|
"@types/react": "19.2.17",
|
|
38
43
|
"@types/react-dom": "19.2.3",
|
|
39
44
|
"eslint": "^9.39.5",
|
|
40
45
|
"tsup": "^8.5.1",
|
|
41
46
|
"typescript": "^6.0.3",
|
|
42
|
-
"vitest": "^4.1.10"
|
|
43
|
-
"@bht-component-registry/class-names": "0.0.6",
|
|
44
|
-
"@bht-component-registry/env": "0.1.0"
|
|
47
|
+
"vitest": "^4.1.10"
|
|
45
48
|
},
|
|
46
49
|
"repository": {
|
|
47
50
|
"type": "git",
|
|
48
51
|
"url": "https://github.com/behivetech/bht-galaxy.git",
|
|
49
52
|
"directory": "registry/behivetech/atoms/tooltip"
|
|
50
53
|
},
|
|
51
|
-
"homepage": "https://
|
|
54
|
+
"homepage": "https://platform.behivetech.com/behivetech/atoms/tooltip",
|
|
52
55
|
"publishConfig": {
|
|
53
56
|
"registry": "https://registry.npmjs.org",
|
|
54
|
-
"access": "public"
|
|
55
|
-
"provenance": true
|
|
57
|
+
"access": "public"
|
|
56
58
|
},
|
|
57
59
|
"scripts": {
|
|
58
60
|
"build": "tsup && bht-registry-docgen",
|
package/tooltip.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isValidElement, type ReactElement } from "react";
|
|
2
2
|
import * as RadixTooltip from "@radix-ui/react-tooltip";
|
|
3
|
-
import { getClassName } from "@
|
|
3
|
+
import { getClassName } from "@behivetech/get-class-name";
|
|
4
4
|
import styles from "./tooltip.module.scss";
|
|
5
5
|
|
|
6
6
|
/**
|