@teambit/react.ui.component-highlighter 0.0.447 → 0.0.451
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/bubble/bubble.module.scss +1 -1
- package/component-highlighter/hover-highlighter/hover-highlighter.compositions.tsx +21 -0
- package/{dist/component-highlighter/component-highlighter.module.scss → component-highlighter/hover-highlighter/hover-highlighter.module.scss} +0 -9
- package/component-highlighter/hover-highlighter/hover-highlighter.tsx +100 -0
- package/component-highlighter/hover-highlighter/index.ts +1 -0
- package/component-highlighter/index.ts +2 -2
- package/component-highlighter.docs.md +110 -0
- package/dist/bubble/bubble.module.scss +1 -1
- package/dist/component-highlighter/hover-highlighter/hover-highlighter.compositions.d.ts +1 -0
- package/dist/component-highlighter/hover-highlighter/hover-highlighter.compositions.js +37 -0
- package/dist/component-highlighter/hover-highlighter/hover-highlighter.compositions.js.map +1 -0
- package/dist/component-highlighter/hover-highlighter/hover-highlighter.d.ts +13 -0
- package/dist/component-highlighter/{component-highlighter.js → hover-highlighter/hover-highlighter.js} +22 -18
- package/dist/component-highlighter/hover-highlighter/hover-highlighter.js.map +1 -0
- package/{component-highlighter/component-highlighter.module.scss → dist/component-highlighter/hover-highlighter/hover-highlighter.module.scss} +0 -9
- package/dist/component-highlighter/hover-highlighter/index.d.ts +1 -0
- package/dist/component-highlighter/hover-highlighter/index.js +6 -0
- package/dist/component-highlighter/hover-highlighter/index.js.map +1 -0
- package/dist/component-highlighter/index.d.ts +2 -2
- package/dist/component-highlighter/index.js +3 -3
- package/dist/component-highlighter/index.js.map +1 -1
- package/dist/component-highlighter.docs.md +110 -0
- package/dist/element-highlighter/element-highlighter.compositions.d.ts +6 -0
- package/dist/element-highlighter/element-highlighter.compositions.js +56 -0
- package/dist/element-highlighter/element-highlighter.compositions.js.map +1 -0
- package/dist/element-highlighter/element-highlighter.d.ts +27 -0
- package/dist/element-highlighter/element-highlighter.js +32 -0
- package/dist/element-highlighter/element-highlighter.js.map +1 -0
- package/dist/element-highlighter/element-highlighter.module.scss +8 -0
- package/dist/element-highlighter/index.d.ts +2 -0
- package/dist/element-highlighter/index.js +6 -0
- package/dist/element-highlighter/index.js.map +1 -0
- package/dist/ignore-highlighter.d.ts +10 -0
- package/dist/ignore-highlighter.js +18 -0
- package/dist/ignore-highlighter.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/label/component-label/component-label.js +3 -3
- package/dist/label/component-label/component-label.js.map +1 -1
- package/dist/label/default-label/default-label.js +1 -2
- package/dist/label/default-label/default-label.js.map +1 -1
- package/dist/label/default-label/default-label.module.scss +4 -0
- package/dist/label/index.d.ts +1 -1
- package/dist/label/label.d.ts +1 -0
- package/dist/label/label.js +3 -8
- package/dist/label/label.js.map +1 -1
- package/element-highlighter/element-highlighter.compositions.tsx +46 -0
- package/element-highlighter/element-highlighter.module.scss +8 -0
- package/element-highlighter/element-highlighter.tsx +60 -0
- package/element-highlighter/index.ts +2 -0
- package/ignore-highlighter.tsx +14 -0
- package/index.ts +7 -2
- package/label/component-label/component-label.tsx +2 -3
- package/label/default-label/default-label.module.scss +4 -0
- package/label/default-label/default-label.tsx +1 -2
- package/label/index.ts +1 -1
- package/label/label.tsx +13 -9
- package/package-tar/teambit-react.ui.component-highlighter-0.0.451.tgz +0 -0
- package/package.json +12 -12
- package/component-highlighter/component-highlighter.docs.md +0 -23
- package/component-highlighter/component-highlighter.tsx +0 -109
- package/dist/component-highlighter/component-highlighter.d.ts +0 -5
- package/dist/component-highlighter/component-highlighter.docs.md +0 -23
- package/dist/component-highlighter/component-highlighter.js.map +0 -1
- package/dist/label/label.module.scss +0 -3
- package/label/label.module.scss +0 -3
- package/package-tar/teambit-react.ui.component-highlighter-0.0.447.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-highlighter.compositions.js","sourceRoot":"","sources":["../../element-highlighter/element-highlighter.compositions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8D;AAC9D,+DAA4E;AAE5E,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAE9C,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAA0D,EAAE,EAAE;IACjH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAA0B,SAAS,CAAC,CAAC;IACvF,MAAM,SAAS,GAAG,IAAA,iBAAS,GAAkB,CAAC;IAE9C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;QAC9B,gBAAgB,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC;IACzC,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAExB,MAAM,MAAM,GAAgC,aAAa,IAAI;QAC3D,OAAO,EAAE,aAAa;QACtB,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,+CAA+C;QACrD,SAAS,EAAE,gCAAgC;KAC5C,CAAC;IAEF,OAAO,CACL,uCAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE;QACnE,uCAAK,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,uBAEpC;QACL,MAAM,IAAI,8BAAC,wCAAkB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,QAAQ,GAAG,CAC9E,CACP,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,kBAAkB,sBAwB7B;AAEK,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,OAAO,CACL,8BAAC,0BAAkB,IACjB,KAAK,EAAE;YACL,yBAAyB,EAAE,SAAS;YACpC,+BAA+B,EAAE,SAAS;YAC1C,gCAAgC,EAAE,SAAS;SAC5C,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB;AAEK,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,OAAO,8BAAC,0BAAkB,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAI,CAAC;AAC7D,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Placement } from '../label';
|
|
3
|
+
export interface ElementHighlighterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** target element to highlight */
|
|
5
|
+
target: HighlightTarget;
|
|
6
|
+
/** default location of the label */
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
/** customize styles */
|
|
9
|
+
classes?: HighlightClasses;
|
|
10
|
+
}
|
|
11
|
+
export { Placement };
|
|
12
|
+
export declare type HighlightTarget = {
|
|
13
|
+
id?: string;
|
|
14
|
+
element: HTMLElement;
|
|
15
|
+
/** e.g. 'https://bit.dev/teambit/base-ui/elements/dots-loader', */
|
|
16
|
+
link?: string;
|
|
17
|
+
/** e.g. 'https://bit.dev/teambit/base-ui' */
|
|
18
|
+
scopeLink?: string;
|
|
19
|
+
/** use full production url, or local workspace url */
|
|
20
|
+
local?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare type HighlightClasses = {
|
|
23
|
+
container?: string;
|
|
24
|
+
frame?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function ElementHighlighter({ target, placement, className, classes, ...props }: ElementHighlighterProps): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ElementHighlighter = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const frame_1 = require("../frame");
|
|
21
|
+
const label_1 = require("../label");
|
|
22
|
+
const ignore_highlighter_1 = require("../ignore-highlighter");
|
|
23
|
+
const element_highlighter_module_scss_1 = __importDefault(require("./element-highlighter.module.scss"));
|
|
24
|
+
function ElementHighlighter(_a) {
|
|
25
|
+
var { target, placement = 'top', className, classes } = _a, props = __rest(_a, ["target", "placement", "className", "classes"]);
|
|
26
|
+
return (react_1.default.createElement("div", Object.assign({}, props, ignore_highlighter_1.excludeHighlighterAtt, { className: (0, classnames_1.default)(classes === null || classes === void 0 ? void 0 : classes.container, element_highlighter_module_scss_1.default.container, className) }),
|
|
27
|
+
react_1.default.createElement(frame_1.Frame, { targetRef: target.element, className: classes === null || classes === void 0 ? void 0 : classes.frame }),
|
|
28
|
+
target.id && (react_1.default.createElement(label_1.LabelContainer, { className: element_highlighter_module_scss_1.default.label, targetRef: target.element, placement: placement },
|
|
29
|
+
react_1.default.createElement(label_1.Label, { componentId: target.id, link: target.link, scopeLink: target.scopeLink, local: target.local, className: classes === null || classes === void 0 ? void 0 : classes.label })))));
|
|
30
|
+
}
|
|
31
|
+
exports.ElementHighlighter = ElementHighlighter;
|
|
32
|
+
//# sourceMappingURL=element-highlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-highlighter.js","sourceRoot":"","sources":["../../element-highlighter/element-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AACpC,oCAAiC;AACjC,oCAA4D;AAC5D,8DAA8D;AAC9D,wGAAuD;AA8BvD,SAAgB,kBAAkB,CAAC,EAMT;QANS,EACjC,MAAM,EACN,SAAS,GAAG,KAAK,EACjB,SAAS,EACT,OAAO,OAEiB,EADrB,KAAK,cALyB,+CAMlC,CADS;IAER,OAAO,CACL,uDAAS,KAAK,EAAM,0CAAqB,IAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE,yCAAM,CAAC,SAAS,EAAE,SAAS,CAAC;QAC/G,8BAAC,aAAK,IAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,GAAI;QAE9D,MAAM,CAAC,EAAE,IAAI,CACZ,8BAAC,sBAAc,IAAC,SAAS,EAAE,yCAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS;YACtF,8BAAC,aAAK,IACJ,WAAW,EAAE,MAAM,CAAC,EAAE,EACtB,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,SAAS,EAAE,MAAM,CAAC,SAAS,EAC3B,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,GACzB,CACa,CAClB,CACG,CACP,CAAC;AACJ,CAAC;AAxBD,gDAwBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElementHighlighter = void 0;
|
|
4
|
+
var element_highlighter_1 = require("./element-highlighter");
|
|
5
|
+
Object.defineProperty(exports, "ElementHighlighter", { enumerable: true, get: function () { return element_highlighter_1.ElementHighlighter; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../element-highlighter/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const excludeHighlighterAttrName = "data-ignore-component-highlight";
|
|
3
|
+
/** select elements matching the exclusion pattern */
|
|
4
|
+
export declare const excludeHighlighterSelector: string;
|
|
5
|
+
/** elements with these attributes will be ignored by the automatic highlighter */
|
|
6
|
+
export declare const excludeHighlighterAtt: {
|
|
7
|
+
"data-ignore-component-highlight": boolean;
|
|
8
|
+
};
|
|
9
|
+
/** elements under this element will be ignored by the automatic highlighter */
|
|
10
|
+
export declare function ExcludeHighlighter(props: React.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExcludeHighlighter = exports.excludeHighlighterAtt = exports.excludeHighlighterSelector = exports.excludeHighlighterAttrName = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
exports.excludeHighlighterAttrName = 'data-ignore-component-highlight';
|
|
9
|
+
/** select elements matching the exclusion pattern */
|
|
10
|
+
exports.excludeHighlighterSelector = `[${exports.excludeHighlighterAttrName}]`;
|
|
11
|
+
/** elements with these attributes will be ignored by the automatic highlighter */
|
|
12
|
+
exports.excludeHighlighterAtt = { [exports.excludeHighlighterAttrName]: true };
|
|
13
|
+
/** elements under this element will be ignored by the automatic highlighter */
|
|
14
|
+
function ExcludeHighlighter(props) {
|
|
15
|
+
return react_1.default.createElement("div", Object.assign({}, props, exports.excludeHighlighterAtt));
|
|
16
|
+
}
|
|
17
|
+
exports.ExcludeHighlighter = ExcludeHighlighter;
|
|
18
|
+
//# sourceMappingURL=ignore-highlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore-highlighter.js","sourceRoot":"","sources":["../ignore-highlighter.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAEb,QAAA,0BAA0B,GAAG,iCAAiC,CAAC;AAE5E,qDAAqD;AACxC,QAAA,0BAA0B,GAAG,IAAI,kCAA0B,GAAG,CAAC;AAE5E,kFAAkF;AACrE,QAAA,qBAAqB,GAAG,EAAE,CAAC,kCAA0B,CAAC,EAAE,IAAI,EAAE,CAAC;AAE5E,+EAA+E;AAC/E,SAAgB,kBAAkB,CAAC,KAA2C;IAC5E,OAAO,uDAAS,KAAK,EAAM,6BAAqB,EAAI,CAAC;AACvD,CAAC;AAFD,gDAEC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { ComponentHighlighter } from './component-highlighter';
|
|
2
|
-
export type { ComponentHighlightProps } from './component-highlighter';
|
|
1
|
+
export { HoverHighlighter as ComponentHighlighter } from './component-highlighter';
|
|
2
|
+
export type { HoverHighlighterProps as ComponentHighlightProps } from './component-highlighter';
|
|
3
|
+
export { ElementHighlighter } from './element-highlighter';
|
|
4
|
+
export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses } from './element-highlighter';
|
|
5
|
+
export { ExcludeHighlighter, excludeHighlighterAtt } from './ignore-highlighter';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ComponentHighlighter = void 0;
|
|
3
|
+
exports.excludeHighlighterAtt = exports.ExcludeHighlighter = exports.ElementHighlighter = exports.ComponentHighlighter = void 0;
|
|
4
4
|
var component_highlighter_1 = require("./component-highlighter");
|
|
5
|
-
Object.defineProperty(exports, "ComponentHighlighter", { enumerable: true, get: function () { return component_highlighter_1.
|
|
5
|
+
Object.defineProperty(exports, "ComponentHighlighter", { enumerable: true, get: function () { return component_highlighter_1.HoverHighlighter; } });
|
|
6
|
+
var element_highlighter_1 = require("./element-highlighter");
|
|
7
|
+
Object.defineProperty(exports, "ElementHighlighter", { enumerable: true, get: function () { return element_highlighter_1.ElementHighlighter; } });
|
|
8
|
+
var ignore_highlighter_1 = require("./ignore-highlighter");
|
|
9
|
+
Object.defineProperty(exports, "ExcludeHighlighter", { enumerable: true, get: function () { return ignore_highlighter_1.ExcludeHighlighter; } });
|
|
10
|
+
Object.defineProperty(exports, "excludeHighlighterAtt", { enumerable: true, get: function () { return ignore_highlighter_1.excludeHighlighterAtt; } });
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,iEAAmF;AAA1E,6HAAA,gBAAgB,OAAwB;AAGjD,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAG3B,2DAAiF;AAAxE,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA"}
|
|
@@ -24,9 +24,9 @@ const component_bubble_1 = require("./component-bubble");
|
|
|
24
24
|
const scope_bubble_1 = require("./scope-bubble");
|
|
25
25
|
function ComponentLabel(_a) {
|
|
26
26
|
var { componentId, className, link, scopeLink, local } = _a, rest = __rest(_a, ["componentId", "className", "link", "scopeLink", "local"]);
|
|
27
|
-
return (react_1.default.createElement(base_ui_surfaces_card_1.Card, Object.assign({}, rest, { className: (0, classnames_1.default)(className, duo_component_bubble_module_scss_1.default.duoComponentBubble)
|
|
28
|
-
react_1.default.createElement(scope_bubble_1.ScopeBubble, { href: scopeLink, componentId: componentId, className: bubble_1.bubble
|
|
29
|
-
react_1.default.createElement(component_bubble_1.ComponentBubble, { href: link, componentId: componentId, className: bubble_1.bubble, local: local
|
|
27
|
+
return (react_1.default.createElement(base_ui_surfaces_card_1.Card, Object.assign({}, rest, { className: (0, classnames_1.default)(className, duo_component_bubble_module_scss_1.default.duoComponentBubble) }),
|
|
28
|
+
react_1.default.createElement(scope_bubble_1.ScopeBubble, { href: scopeLink, componentId: componentId, className: bubble_1.bubble }),
|
|
29
|
+
react_1.default.createElement(component_bubble_1.ComponentBubble, { href: link, componentId: componentId, className: bubble_1.bubble, local: local })));
|
|
30
30
|
}
|
|
31
31
|
exports.ComponentLabel = ComponentLabel;
|
|
32
32
|
//# sourceMappingURL=component-label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-label.js","sourceRoot":"","sources":["../../../label/component-label/component-label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AACpC,0EAAiE;AAGjE,yCAAsC;AACtC,0GAAwD;AAExD,yDAAqD;AACrD,iDAA6C;AAS7C,SAAgB,cAAc,CAAC,EAAgF;QAAhF,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,OAAgC,EAA3B,IAAI,cAAzD,0DAA2D,CAAF;IACtF,OAAO,CACL,8BAAC,4BAAI,oBAAK,IAAI,IAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,0CAAM,CAAC,kBAAkB,CAAC;QACzE,8BAAC,0BAAW,IAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,eAAM,
|
|
1
|
+
{"version":3,"file":"component-label.js","sourceRoot":"","sources":["../../../label/component-label/component-label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AACpC,0EAAiE;AAGjE,yCAAsC;AACtC,0GAAwD;AAExD,yDAAqD;AACrD,iDAA6C;AAS7C,SAAgB,cAAc,CAAC,EAAgF;QAAhF,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,OAAgC,EAA3B,IAAI,cAAzD,0DAA2D,CAAF;IACtF,OAAO,CACL,8BAAC,4BAAI,oBAAK,IAAI,IAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,0CAAM,CAAC,kBAAkB,CAAC;QACzE,8BAAC,0BAAW,IAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,eAAM,GAAI;QAC7E,8BAAC,kCAAe,IACd,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,eAAM,EACjB,KAAK,EAAE,KAAK,GACZ,CACG,CACR,CAAC;AACJ,CAAC;AAZD,wCAYC"}
|
|
@@ -18,14 +18,13 @@ exports.DefaultLabel = void 0;
|
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const classnames_1 = __importDefault(require("classnames"));
|
|
20
20
|
const base_ui_surfaces_card_1 = require("@teambit/base-ui.surfaces.card");
|
|
21
|
-
const base_ui_css_components_pill_1 = require("@teambit/base-ui.css-components.pill");
|
|
22
21
|
const base_ui_routing_native_link_1 = require("@teambit/base-ui.routing.native-link");
|
|
23
22
|
const bubble_1 = require("../../bubble");
|
|
24
23
|
const default_label_module_scss_1 = __importDefault(require("./default-label.module.scss"));
|
|
25
24
|
function DefaultLabel(_a) {
|
|
26
25
|
var { className, href, children } = _a, rest = __rest(_a, ["className", "href", "children"]);
|
|
27
26
|
return (react_1.default.createElement(base_ui_surfaces_card_1.Card, Object.assign({}, rest, { className: (0, classnames_1.default)(default_label_module_scss_1.default.container, className) }),
|
|
28
|
-
react_1.default.createElement(base_ui_routing_native_link_1.NativeLink, { external: true, href: href, className:
|
|
27
|
+
react_1.default.createElement(base_ui_routing_native_link_1.NativeLink, { external: true, href: href, className: bubble_1.bubble }, children)));
|
|
29
28
|
}
|
|
30
29
|
exports.DefaultLabel = DefaultLabel;
|
|
31
30
|
//# sourceMappingURL=default-label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-label.js","sourceRoot":"","sources":["../../../label/default-label/default-label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AAEpC,0EAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"default-label.js","sourceRoot":"","sources":["../../../label/default-label/default-label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AAEpC,0EAAiE;AACjE,sFAAkE;AAElE,yCAAsC;AACtC,4FAAiD;AAMjD,SAAgB,YAAY,CAAC,EAAyD;QAAzD,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,OAA8B,EAAzB,IAAI,cAApC,iCAAsC,CAAF;IAC/D,OAAO,CACL,8BAAC,4BAAI,oBAAK,IAAI,IAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,mCAAM,CAAC,SAAS,EAAE,SAAS,CAAC;QAChE,8BAAC,wCAAU,IAAC,QAAQ,QAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,eAAM,IAC/C,QAAQ,CACE,CACR,CACR,CAAC;AACJ,CAAC;AARD,oCAQC"}
|
package/dist/label/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { LabelContainer, Label } from './label';
|
|
2
|
-
export type { LabelContainerProps, LabelProps } from './label';
|
|
2
|
+
export type { LabelContainerProps, LabelProps, Placement } from './label';
|
package/dist/label/label.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface LabelContainerProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
8
8
|
placement?: Placement;
|
|
9
9
|
flip?: boolean;
|
|
10
10
|
}
|
|
11
|
+
export type { Placement };
|
|
11
12
|
export declare function LabelContainer({ targetRef, offset, placement, flip, className, ...rest }: LabelContainerProps): JSX.Element;
|
|
12
13
|
export interface LabelProps extends CardProps {
|
|
13
14
|
componentId: string;
|
package/dist/label/label.js
CHANGED
|
@@ -36,21 +36,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.Label = exports.LabelContainer = void 0;
|
|
37
37
|
const react_1 = __importStar(require("react"));
|
|
38
38
|
const react_popper_1 = require("react-popper");
|
|
39
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
40
39
|
const component_id_1 = require("@teambit/component-id");
|
|
41
40
|
const use_animation_frame_1 = __importDefault(require("use-animation-frame"));
|
|
42
41
|
require("@popperjs/core");
|
|
43
42
|
const default_label_1 = require("./default-label");
|
|
44
43
|
const component_label_1 = require("./component-label");
|
|
45
|
-
const label_module_scss_1 = __importDefault(require("./label.module.scss"));
|
|
46
44
|
// TODO - replace this with TippyJS, when it supports a `targetElement={targetRef.current}` prop
|
|
47
45
|
function LabelContainer(_a) {
|
|
48
46
|
var { targetRef, offset, placement, flip = true, className } = _a, rest = __rest(_a, ["targetRef", "offset", "placement", "flip", "className"]);
|
|
49
47
|
const [sourceRef, setSourceRef] = (0, react_1.useState)(null);
|
|
50
|
-
const modifiers = (0, react_1.useMemo)(() => [{ name: 'offset', options: { offset } }], [
|
|
51
|
-
flip,
|
|
52
|
-
offset,
|
|
53
|
-
]);
|
|
48
|
+
const modifiers = (0, react_1.useMemo)(() => [{ name: 'offset', options: { offset } }], [flip, offset]);
|
|
54
49
|
const { styles, attributes, update } = (0, react_popper_1.usePopper)(targetRef, sourceRef, {
|
|
55
50
|
modifiers,
|
|
56
51
|
placement,
|
|
@@ -58,14 +53,14 @@ function LabelContainer(_a) {
|
|
|
58
53
|
(0, use_animation_frame_1.default)(() => update === null || update === void 0 ? void 0 : update(), [update]);
|
|
59
54
|
if (!targetRef)
|
|
60
55
|
return null;
|
|
61
|
-
return (react_1.default.createElement("div", Object.assign({}, rest, { ref: setSourceRef, className:
|
|
56
|
+
return (react_1.default.createElement("div", Object.assign({}, rest, { ref: setSourceRef, className: className, style: styles.popper }, attributes.popper)));
|
|
62
57
|
}
|
|
63
58
|
exports.LabelContainer = LabelContainer;
|
|
64
59
|
function Label(_a) {
|
|
65
60
|
var { componentId, link, scopeLink, local } = _a, rest = __rest(_a, ["componentId", "link", "scopeLink", "local"]);
|
|
66
61
|
const parsedId = (0, react_1.useMemo)(() => component_id_1.ComponentID.tryFromString(componentId), [componentId]);
|
|
67
62
|
if (!parsedId)
|
|
68
|
-
return react_1.default.createElement(default_label_1.DefaultLabel, { href: link }, componentId);
|
|
63
|
+
return (react_1.default.createElement(default_label_1.DefaultLabel, Object.assign({}, rest, { href: link }), componentId));
|
|
69
64
|
return react_1.default.createElement(component_label_1.ComponentLabel, Object.assign({}, rest, { local: local, componentId: parsedId, link: link, scopeLink: scopeLink }));
|
|
70
65
|
}
|
|
71
66
|
exports.Label = Label;
|
package/dist/label/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../label/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,+CAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../label/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,+CAAyC;AACzC,wDAAoD;AAEpD,8EAAoD;AAEpD,0BAAwB;AAExB,mDAA+C;AAC/C,uDAAmD;AAWnD,gGAAgG;AAChG,SAAgB,cAAc,CAAC,EAAsF;QAAtF,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,OAAgC,EAA3B,IAAI,cAA/D,yDAAiE,CAAF;IAC5F,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAwB,IAAI,CAAC,CAAC;IAExE,MAAM,SAAS,GAAG,IAAA,eAAO,EACvB,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAC/C,CAAC,IAAI,EAAE,MAAM,CAAC,CACf,CAAC;IAEF,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,wBAAS,EAAC,SAAS,EAAE,SAAS,EAAE;QACrE,SAAS;QACT,SAAS;KACV,CAAC,CAAC;IAEH,IAAA,6BAAiB,EAAC,GAAG,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,EAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9C,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,OAAO,CACL,uDACM,IAAI,IACR,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,IAChB,UAAU,CAAC,MAAM,EACrB,CACH,CAAC;AACJ,CAAC;AA1BD,wCA0BC;AASD,SAAgB,KAAK,CAAC,EAA4D;QAA5D,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,OAAuB,EAAlB,IAAI,cAA9C,6CAAgD,CAAF;IAClE,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAEtF,IAAI,CAAC,QAAQ;QACX,OAAO,CACL,8BAAC,4BAAY,oBAAK,IAAI,IAAE,IAAI,EAAE,IAAI,KAC/B,WAAW,CACC,CAChB,CAAC;IAEJ,OAAO,8BAAC,gCAAc,oBAAK,IAAI,IAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC;AAC7G,CAAC;AAXD,sBAWC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useState, createRef, useEffect } from 'react';
|
|
2
|
+
import { ElementHighlighter, HighlightTarget } from './element-highlighter';
|
|
3
|
+
|
|
4
|
+
const mockTargetId = 'teambit.design/ui/icon-button';
|
|
5
|
+
|
|
6
|
+
export const HighlightedElement = ({ style, className }: { style?: Record<string, string>; className?: string }) => {
|
|
7
|
+
const [targetElement, setTargetElement] = useState<HTMLElement | undefined>(undefined);
|
|
8
|
+
const targetRef = createRef<HTMLDivElement>();
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const { current } = targetRef;
|
|
12
|
+
setTargetElement(current || undefined);
|
|
13
|
+
}, [targetRef.current]);
|
|
14
|
+
|
|
15
|
+
const target: HighlightTarget | undefined = targetElement && {
|
|
16
|
+
element: targetElement,
|
|
17
|
+
id: mockTargetId,
|
|
18
|
+
link: 'https://bit.dev/teambit/design/ui/icon-button',
|
|
19
|
+
scopeLink: 'https://bit.dev/teambit/design',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={className} style={{ padding: '16px 160px 50px 16px' }}>
|
|
24
|
+
<div ref={targetRef} style={{ width: 100 }}>
|
|
25
|
+
highlight target
|
|
26
|
+
</div>
|
|
27
|
+
{target && <ElementHighlighter target={target} style={style} placement="bottom" />}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Customized = () => {
|
|
33
|
+
return (
|
|
34
|
+
<HighlightedElement
|
|
35
|
+
style={{
|
|
36
|
+
'--bit-highlighter-color': '#94deb4',
|
|
37
|
+
'--bit-highlighter-color-hover': '#d0f1de',
|
|
38
|
+
'--bit-highlighter-color-active': '#37b26c',
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Sizes = () => {
|
|
45
|
+
return <HighlightedElement style={{ fontSize: '16px' }} />;
|
|
46
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { Frame } from '../frame';
|
|
4
|
+
import { Label, LabelContainer, Placement } from '../label';
|
|
5
|
+
import { excludeHighlighterAtt } from '../ignore-highlighter';
|
|
6
|
+
import styles from './element-highlighter.module.scss';
|
|
7
|
+
|
|
8
|
+
export interface ElementHighlighterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** target element to highlight */
|
|
10
|
+
target: HighlightTarget;
|
|
11
|
+
/** default location of the label */
|
|
12
|
+
placement?: Placement;
|
|
13
|
+
/** customize styles */
|
|
14
|
+
classes?: HighlightClasses;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Placement };
|
|
18
|
+
|
|
19
|
+
export type HighlightTarget = {
|
|
20
|
+
id?: string;
|
|
21
|
+
element: HTMLElement;
|
|
22
|
+
/** e.g. 'https://bit.dev/teambit/base-ui/elements/dots-loader', */
|
|
23
|
+
link?: string;
|
|
24
|
+
/** e.g. 'https://bit.dev/teambit/base-ui' */
|
|
25
|
+
scopeLink?: string;
|
|
26
|
+
/** use full production url, or local workspace url */
|
|
27
|
+
local?: boolean;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type HighlightClasses = {
|
|
31
|
+
container?: string;
|
|
32
|
+
frame?: string;
|
|
33
|
+
label?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export function ElementHighlighter({
|
|
37
|
+
target,
|
|
38
|
+
placement = 'top',
|
|
39
|
+
className,
|
|
40
|
+
classes,
|
|
41
|
+
...props
|
|
42
|
+
}: ElementHighlighterProps) {
|
|
43
|
+
return (
|
|
44
|
+
<div {...props} {...excludeHighlighterAtt} className={classnames(classes?.container, styles.container, className)}>
|
|
45
|
+
<Frame targetRef={target.element} className={classes?.frame} />
|
|
46
|
+
|
|
47
|
+
{target.id && (
|
|
48
|
+
<LabelContainer className={styles.label} targetRef={target.element} placement={placement}>
|
|
49
|
+
<Label
|
|
50
|
+
componentId={target.id}
|
|
51
|
+
link={target.link}
|
|
52
|
+
scopeLink={target.scopeLink}
|
|
53
|
+
local={target.local}
|
|
54
|
+
className={classes?.label}
|
|
55
|
+
/>
|
|
56
|
+
</LabelContainer>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export const excludeHighlighterAttrName = 'data-ignore-component-highlight';
|
|
4
|
+
|
|
5
|
+
/** select elements matching the exclusion pattern */
|
|
6
|
+
export const excludeHighlighterSelector = `[${excludeHighlighterAttrName}]`;
|
|
7
|
+
|
|
8
|
+
/** elements with these attributes will be ignored by the automatic highlighter */
|
|
9
|
+
export const excludeHighlighterAtt = { [excludeHighlighterAttrName]: true };
|
|
10
|
+
|
|
11
|
+
/** elements under this element will be ignored by the automatic highlighter */
|
|
12
|
+
export function ExcludeHighlighter(props: React.HTMLAttributes<HTMLDivElement>) {
|
|
13
|
+
return <div {...props} {...excludeHighlighterAtt} />;
|
|
14
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export { ComponentHighlighter } from './component-highlighter';
|
|
2
|
-
export type { ComponentHighlightProps } from './component-highlighter';
|
|
1
|
+
export { HoverHighlighter as ComponentHighlighter } from './component-highlighter';
|
|
2
|
+
export type { HoverHighlighterProps as ComponentHighlightProps } from './component-highlighter';
|
|
3
|
+
|
|
4
|
+
export { ElementHighlighter } from './element-highlighter';
|
|
5
|
+
export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses } from './element-highlighter';
|
|
6
|
+
|
|
7
|
+
export { ExcludeHighlighter, excludeHighlighterAtt } from './ignore-highlighter';
|
|
@@ -18,14 +18,13 @@ export interface ComponentLabelProps extends CardProps {
|
|
|
18
18
|
|
|
19
19
|
export function ComponentLabel({ componentId, className, link, scopeLink, local, ...rest }: ComponentLabelProps) {
|
|
20
20
|
return (
|
|
21
|
-
<Card {...rest} className={classNames(className, styles.duoComponentBubble)}
|
|
22
|
-
<ScopeBubble href={scopeLink} componentId={componentId} className={bubble}
|
|
21
|
+
<Card {...rest} className={classNames(className, styles.duoComponentBubble)}>
|
|
22
|
+
<ScopeBubble href={scopeLink} componentId={componentId} className={bubble} />
|
|
23
23
|
<ComponentBubble
|
|
24
24
|
href={link}
|
|
25
25
|
componentId={componentId}
|
|
26
26
|
className={bubble}
|
|
27
27
|
local={local}
|
|
28
|
-
data-ignore-component-highlight
|
|
29
28
|
/>
|
|
30
29
|
</Card>
|
|
31
30
|
);
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Card, CardProps } from '@teambit/base-ui.surfaces.card';
|
|
5
|
-
import { pillClass } from '@teambit/base-ui.css-components.pill';
|
|
6
5
|
import { NativeLink } from '@teambit/base-ui.routing.native-link';
|
|
7
6
|
|
|
8
7
|
import { bubble } from '../../bubble';
|
|
@@ -15,7 +14,7 @@ export interface DefaultLabelProps extends CardProps {
|
|
|
15
14
|
export function DefaultLabel({ className, href, children, ...rest }: DefaultLabelProps) {
|
|
16
15
|
return (
|
|
17
16
|
<Card {...rest} className={classnames(styles.container, className)}>
|
|
18
|
-
<NativeLink external href={href} className={
|
|
17
|
+
<NativeLink external href={href} className={bubble}>
|
|
19
18
|
{children}
|
|
20
19
|
</NativeLink>
|
|
21
20
|
</Card>
|
package/label/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { LabelContainer, Label } from './label';
|
|
2
|
-
export type { LabelContainerProps, LabelProps } from './label';
|
|
2
|
+
export type { LabelContainerProps, LabelProps, Placement } from './label';
|
package/label/label.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { usePopper } from 'react-popper';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
3
|
import { ComponentID } from '@teambit/component-id';
|
|
5
4
|
import type { CardProps } from '@teambit/base-ui.surfaces.card';
|
|
6
5
|
import useAnimationFrame from 'use-animation-frame';
|
|
@@ -10,8 +9,6 @@ import '@popperjs/core';
|
|
|
10
9
|
import { DefaultLabel } from './default-label';
|
|
11
10
|
import { ComponentLabel } from './component-label';
|
|
12
11
|
|
|
13
|
-
import classes from './label.module.scss';
|
|
14
|
-
|
|
15
12
|
export interface LabelContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
13
|
targetRef: HTMLElement | null;
|
|
17
14
|
offset?: [number, number];
|
|
@@ -19,14 +16,16 @@ export interface LabelContainerProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
19
16
|
flip?: boolean;
|
|
20
17
|
}
|
|
21
18
|
|
|
19
|
+
export type { Placement };
|
|
20
|
+
|
|
22
21
|
// TODO - replace this with TippyJS, when it supports a `targetElement={targetRef.current}` prop
|
|
23
22
|
export function LabelContainer({ targetRef, offset, placement, flip = true, className, ...rest }: LabelContainerProps) {
|
|
24
23
|
const [sourceRef, setSourceRef] = useState<HTMLDivElement | null>(null);
|
|
25
24
|
|
|
26
|
-
const modifiers = useMemo<Partial<Modifier<any, any>>[]>(
|
|
27
|
-
|
|
28
|
-
offset
|
|
29
|
-
|
|
25
|
+
const modifiers = useMemo<Partial<Modifier<any, any>>[]>(
|
|
26
|
+
() => [{ name: 'offset', options: { offset } }],
|
|
27
|
+
[flip, offset]
|
|
28
|
+
);
|
|
30
29
|
|
|
31
30
|
const { styles, attributes, update } = usePopper(targetRef, sourceRef, {
|
|
32
31
|
modifiers,
|
|
@@ -41,7 +40,7 @@ export function LabelContainer({ targetRef, offset, placement, flip = true, clas
|
|
|
41
40
|
<div
|
|
42
41
|
{...rest}
|
|
43
42
|
ref={setSourceRef}
|
|
44
|
-
className={
|
|
43
|
+
className={className}
|
|
45
44
|
style={styles.popper}
|
|
46
45
|
{...attributes.popper}
|
|
47
46
|
/>
|
|
@@ -58,7 +57,12 @@ export interface LabelProps extends CardProps {
|
|
|
58
57
|
export function Label({ componentId, link, scopeLink, local, ...rest }: LabelProps) {
|
|
59
58
|
const parsedId = useMemo(() => ComponentID.tryFromString(componentId), [componentId]);
|
|
60
59
|
|
|
61
|
-
if (!parsedId)
|
|
60
|
+
if (!parsedId)
|
|
61
|
+
return (
|
|
62
|
+
<DefaultLabel {...rest} href={link}>
|
|
63
|
+
{componentId}
|
|
64
|
+
</DefaultLabel>
|
|
65
|
+
);
|
|
62
66
|
|
|
63
67
|
return <ComponentLabel {...rest} local={local} componentId={parsedId} link={link} scopeLink={scopeLink} />;
|
|
64
68
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react.ui.component-highlighter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.451",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/react/ui/component-highlighter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.react",
|
|
8
8
|
"name": "ui/component-highlighter",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.451"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@popperjs/core": "2.6.0",
|
|
13
12
|
"classnames": "2.2.6",
|
|
13
|
+
"@popperjs/core": "2.6.0",
|
|
14
14
|
"react-popper": "2.2.4",
|
|
15
15
|
"use-animation-frame": "0.1.0",
|
|
16
16
|
"use-debounce": "6.0.1",
|
|
@@ -20,26 +20,26 @@
|
|
|
20
20
|
"@teambit/base-ui.utils.popper-js.resize-to-match-reference": "1.0.0",
|
|
21
21
|
"@teambit/base-ui.surfaces.card": "1.0.1",
|
|
22
22
|
"@teambit/base-ui.routing.native-link": "1.0.0",
|
|
23
|
-
"@teambit/
|
|
24
|
-
"@teambit/react.babel.bit-react-transformer": "0.0.444",
|
|
25
|
-
"@teambit/react.modules.dom-to-react": "0.0.439",
|
|
26
|
-
"@teambit/react.ui.hover-selector": "0.0.117",
|
|
23
|
+
"@teambit/react.babel.bit-react-transformer": "0.0.448",
|
|
27
24
|
"@teambit/component-id": "0.0.369",
|
|
28
|
-
"@teambit/
|
|
25
|
+
"@teambit/react.modules.dom-to-react": "0.0.442",
|
|
26
|
+
"@teambit/react.ui.hover-selector": "0.0.121",
|
|
27
|
+
"@teambit/component.modules.component-url": "0.0.75"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@types/classnames": "2.2.11",
|
|
32
30
|
"@types/react": "^17.0.8",
|
|
31
|
+
"@types/classnames": "2.2.11",
|
|
33
32
|
"@types/url-join": "4.0.0",
|
|
34
33
|
"@types/mocha": "5.2.7",
|
|
35
34
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
36
35
|
"@babel/runtime": "7.12.18",
|
|
37
36
|
"@types/jest": "^26.0.0",
|
|
38
37
|
"@types/react-dom": "^17.0.5",
|
|
39
|
-
"@types/node": "12.20.4"
|
|
38
|
+
"@types/node": "12.20.4",
|
|
39
|
+
"@teambit/design.ui.icon-button": "1.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@teambit/legacy": "1.0.
|
|
42
|
+
"@teambit/legacy": "1.0.158",
|
|
43
43
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
44
44
|
"react": "^16.8.0 || ^17.0.0"
|
|
45
45
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"react": "-"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@teambit/legacy": "1.0.
|
|
70
|
+
"@teambit/legacy": "1.0.158",
|
|
71
71
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
72
72
|
"react": "^16.8.0 || ^17.0.0"
|
|
73
73
|
}
|