@teambit/react.ui.component-highlighter 0.0.494 → 0.0.498
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/children-highlighter/children-highlighter.composition.tsx +9 -5
- package/component-highlighter.docs.md +1 -0
- package/dist/children-highlighter/children-highlighter.composition.js +7 -5
- package/dist/children-highlighter/children-highlighter.composition.js.map +1 -1
- package/dist/component-highlighter.docs.md +1 -0
- package/dist/element-highlighter/element-highlighter.compositions.d.ts +1 -3
- package/dist/element-highlighter/element-highlighter.compositions.js +6 -6
- package/dist/element-highlighter/element-highlighter.compositions.js.map +1 -1
- package/dist/element-highlighter/element-highlighter.d.ts +2 -4
- package/dist/element-highlighter/element-highlighter.js +2 -2
- package/dist/element-highlighter/element-highlighter.js.map +1 -1
- package/dist/element-highlighter/element-highlighter.module.scss +2 -5
- package/dist/element-highlighter/index.d.ts +1 -1
- package/dist/hover-highlighter/hover-highlighter.compositions.js +1 -1
- package/dist/hover-highlighter/hover-highlighter.compositions.js.map +1 -1
- package/dist/hybrid-highlighter/hybrid-highlighter.d.ts +2 -3
- package/dist/hybrid-highlighter/hybrid-highlighter.js +2 -2
- package/dist/hybrid-highlighter/hybrid-highlighter.js.map +1 -1
- package/dist/label/component-strip.d.ts +0 -2
- package/dist/label/component-strip.js +2 -2
- package/dist/label/component-strip.js.map +1 -1
- package/dist/label/component-strip.module.scss +6 -21
- package/dist/label/index.d.ts +1 -1
- package/dist/label/label.d.ts +1 -4
- package/dist/label/label.js +3 -3
- package/dist/label/label.js.map +1 -1
- package/dist/label/other-components.d.ts +1 -3
- package/dist/label/other-components.js +2 -2
- package/dist/label/other-components.js.map +1 -1
- package/element-highlighter/element-highlighter.compositions.tsx +7 -10
- package/element-highlighter/element-highlighter.module.scss +2 -5
- package/element-highlighter/element-highlighter.tsx +2 -6
- package/element-highlighter/index.ts +1 -7
- package/hover-highlighter/hover-highlighter.compositions.tsx +1 -1
- package/hybrid-highlighter/hybrid-highlighter.tsx +1 -10
- package/label/component-strip.module.scss +6 -21
- package/label/component-strip.tsx +2 -5
- package/label/index.ts +1 -1
- package/label/label.tsx +4 -6
- package/label/other-components.tsx +2 -4
- package/package-tar/teambit-react.ui.component-highlighter-0.0.498.tgz +0 -0
- package/package.json +10 -10
- package/tsconfig.json +2 -1
- package/package-tar/teambit-react.ui.component-highlighter-0.0.494.tgz +0 -0
|
@@ -7,7 +7,8 @@ import { ChildrenHighlighter } from './children-highlighter';
|
|
|
7
7
|
|
|
8
8
|
export const ChildrenHighlighterPreview = () => {
|
|
9
9
|
return (
|
|
10
|
-
|
|
10
|
+
// highlighter runs in compositions, therefor should not have our font
|
|
11
|
+
<ChildrenHighlighter style={{ padding: 40, minWidth: 200, fontFamily: 'sans-serif' }}>
|
|
11
12
|
<MockedComponentWithMeta>hover here</MockedComponentWithMeta>
|
|
12
13
|
<br />
|
|
13
14
|
<br />
|
|
@@ -20,7 +21,7 @@ export const ChildrenHighlighterPreview = () => {
|
|
|
20
21
|
export const ChildrenHighlighterWithCustomColors = () => {
|
|
21
22
|
return (
|
|
22
23
|
<ChildrenHighlighter
|
|
23
|
-
style={{ padding: 40, minWidth: 200, color: 'yellow' }}
|
|
24
|
+
style={{ padding: 40, minWidth: 200, color: 'yellow', fontFamily: 'sans-serif' }}
|
|
24
25
|
bgColor="cornflowerblue"
|
|
25
26
|
bgColorHover="blue"
|
|
26
27
|
bgColorActive="DarkSlateBlue"
|
|
@@ -37,7 +38,7 @@ export const ChildrenHighlighterWithCustomColors = () => {
|
|
|
37
38
|
export const ChildrenHighlighterInsideIgnore = () => {
|
|
38
39
|
return (
|
|
39
40
|
<ExcludeHighlighter>
|
|
40
|
-
<ChildrenHighlighter>
|
|
41
|
+
<ChildrenHighlighter style={{ fontFamily: 'sans-serif' }}>
|
|
41
42
|
Multi Highlighter should still work when inside <code>{'<ExcludeHighlighter>'}</code>
|
|
42
43
|
<br />
|
|
43
44
|
It should only skip exclusion zones inside of it.
|
|
@@ -56,7 +57,7 @@ export const ChildrenHighlighterInsideIgnore = () => {
|
|
|
56
57
|
|
|
57
58
|
export const ChildrenHighlighterWithRule = () => {
|
|
58
59
|
return (
|
|
59
|
-
<ChildrenHighlighter rule="#someSubTree *" style={{ minWidth: 300 }}>
|
|
60
|
+
<ChildrenHighlighter rule="#someSubTree *" style={{ minWidth: 300, fontFamily: 'sans-serif' }}>
|
|
60
61
|
<div>
|
|
61
62
|
element filter: <code>"#someSubTree *"</code>
|
|
62
63
|
</div>
|
|
@@ -74,7 +75,10 @@ export const ChildrenHighlighterWithRule = () => {
|
|
|
74
75
|
|
|
75
76
|
export const ChildrenHighlighterWithComponentRule = () => {
|
|
76
77
|
return (
|
|
77
|
-
<ChildrenHighlighter
|
|
78
|
+
<ChildrenHighlighter
|
|
79
|
+
componentRule="teambit.design/ui/icon-button"
|
|
80
|
+
style={{ minWidth: 300, fontFamily: 'sans-serif' }}
|
|
81
|
+
>
|
|
78
82
|
<div>
|
|
79
83
|
component filter: <code>"teambit.design/ui/icon-button"</code>
|
|
80
84
|
</div>
|
|
@@ -170,6 +170,7 @@ Use these CSS variables to edit the highlighter color
|
|
|
170
170
|
--bit-highlighter-color: #eebcc9;
|
|
171
171
|
--bit-highlighter-color-hover: #f6dae2;
|
|
172
172
|
--bit-highlighter-color-active: #e79db1;
|
|
173
|
+
--bit-highlighter-shadow: 0px 11px 29px 0px rgba(0, 0, 0, 0.23));
|
|
173
174
|
```
|
|
174
175
|
|
|
175
176
|
While it is preferred to use the css variables, you can also set them using react props:
|
|
@@ -11,7 +11,9 @@ const design_ui_icon_button_1 = require("@teambit/design.ui.icon-button");
|
|
|
11
11
|
const ignore_highlighter_1 = require("../ignore-highlighter");
|
|
12
12
|
const children_highlighter_1 = require("./children-highlighter");
|
|
13
13
|
const ChildrenHighlighterPreview = () => {
|
|
14
|
-
return (
|
|
14
|
+
return (
|
|
15
|
+
// highlighter runs in compositions, therefor should not have our font
|
|
16
|
+
react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { style: { padding: 40, minWidth: 200, fontFamily: 'sans-serif' } },
|
|
15
17
|
react_1.default.createElement(react_ui_highlighter_component_metadata_bit_component_meta_1.MockedComponentWithMeta, null, "hover here"),
|
|
16
18
|
react_1.default.createElement("br", null),
|
|
17
19
|
react_1.default.createElement("br", null),
|
|
@@ -20,7 +22,7 @@ const ChildrenHighlighterPreview = () => {
|
|
|
20
22
|
};
|
|
21
23
|
exports.ChildrenHighlighterPreview = ChildrenHighlighterPreview;
|
|
22
24
|
const ChildrenHighlighterWithCustomColors = () => {
|
|
23
|
-
return (react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { style: { padding: 40, minWidth: 200, color: 'yellow' }, bgColor: "cornflowerblue", bgColorHover: "blue", bgColorActive: "DarkSlateBlue" },
|
|
25
|
+
return (react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { style: { padding: 40, minWidth: 200, color: 'yellow', fontFamily: 'sans-serif' }, bgColor: "cornflowerblue", bgColorHover: "blue", bgColorActive: "DarkSlateBlue" },
|
|
24
26
|
react_1.default.createElement(react_ui_highlighter_component_metadata_bit_component_meta_1.MockedComponentWithMeta, null, "hover here"),
|
|
25
27
|
react_1.default.createElement("br", null),
|
|
26
28
|
react_1.default.createElement("br", null),
|
|
@@ -30,7 +32,7 @@ const ChildrenHighlighterWithCustomColors = () => {
|
|
|
30
32
|
exports.ChildrenHighlighterWithCustomColors = ChildrenHighlighterWithCustomColors;
|
|
31
33
|
const ChildrenHighlighterInsideIgnore = () => {
|
|
32
34
|
return (react_1.default.createElement(ignore_highlighter_1.ExcludeHighlighter, null,
|
|
33
|
-
react_1.default.createElement(children_highlighter_1.ChildrenHighlighter,
|
|
35
|
+
react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { style: { fontFamily: 'sans-serif' } },
|
|
34
36
|
"Multi Highlighter should still work when inside ",
|
|
35
37
|
react_1.default.createElement("code", null, '<ExcludeHighlighter>'),
|
|
36
38
|
react_1.default.createElement("br", null),
|
|
@@ -46,7 +48,7 @@ const ChildrenHighlighterInsideIgnore = () => {
|
|
|
46
48
|
};
|
|
47
49
|
exports.ChildrenHighlighterInsideIgnore = ChildrenHighlighterInsideIgnore;
|
|
48
50
|
const ChildrenHighlighterWithRule = () => {
|
|
49
|
-
return (react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { rule: "#someSubTree *", style: { minWidth: 300 } },
|
|
51
|
+
return (react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { rule: "#someSubTree *", style: { minWidth: 300, fontFamily: 'sans-serif' } },
|
|
50
52
|
react_1.default.createElement("div", null,
|
|
51
53
|
"element filter: ",
|
|
52
54
|
react_1.default.createElement("code", null, "\"#someSubTree *\"")),
|
|
@@ -60,7 +62,7 @@ const ChildrenHighlighterWithRule = () => {
|
|
|
60
62
|
};
|
|
61
63
|
exports.ChildrenHighlighterWithRule = ChildrenHighlighterWithRule;
|
|
62
64
|
const ChildrenHighlighterWithComponentRule = () => {
|
|
63
|
-
return (react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { componentRule: "teambit.design/ui/icon-button", style: { minWidth: 300 } },
|
|
65
|
+
return (react_1.default.createElement(children_highlighter_1.ChildrenHighlighter, { componentRule: "teambit.design/ui/icon-button", style: { minWidth: 300, fontFamily: 'sans-serif' } },
|
|
64
66
|
react_1.default.createElement("div", null,
|
|
65
67
|
"component filter: ",
|
|
66
68
|
react_1.default.createElement("code", null, "\"teambit.design/ui/icon-button\"")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children-highlighter.composition.js","sourceRoot":"","sources":["../../children-highlighter/children-highlighter.composition.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,sFAAsF;AACtF,oJAA8G;AAC9G,0EAA4D;AAC5D,8DAA2D;AAC3D,iEAA6D;AAEtD,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"children-highlighter.composition.js","sourceRoot":"","sources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BAAoC,CACxC,CACH,CACtB,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,+BAA+B,mCAkB1C;AAEK,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,OAAO,CACL,8BAAC,0CAAmB,IAAC,IAAI,EAAC,gBAAgB,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE;QAC3F;;YACkB,iEAA6B,CACzC;QACN,yCAAM;QACN,8BAAC,oFAAuB,yBAAyC;QACjE,yCAAM;QACN,yCAAM;QACN,yCAAM;QACN,uCAAK,EAAE,EAAC,aAAa;YACnB,8BAAC,oFAAuB,mCAAmD,CACvE,CACc,CACvB,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,2BAA2B,+BAgBtC;AAEK,MAAM,oCAAoC,GAAG,GAAG,EAAE;IACvD,OAAO,CACL,8BAAC,0CAAmB,IAClB,aAAa,EAAC,+BAA+B,EAC7C,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE;QAElD;;YACoB,gFAA4C,CAC1D;QACN,yCAAM;QACN,8BAAC,oFAAuB,yBAAyC;QACjE,yCAAM;QACN,yCAAM;QACN,yCAAM;QACN,8BAAC,kCAAU,mCAAsC,CAC7B,CACvB,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,oCAAoC,wCAiB/C;AAEF,oEAAoE;AACpE,aAAa;AACb,4BAA4B;AAC5B,uDAAuD;AACvD,6BAA6B;AAC7B,OAAO;AACP,KAAK"}
|
|
@@ -170,6 +170,7 @@ Use these CSS variables to edit the highlighter color
|
|
|
170
170
|
--bit-highlighter-color: #eebcc9;
|
|
171
171
|
--bit-highlighter-color-hover: #f6dae2;
|
|
172
172
|
--bit-highlighter-color-active: #e79db1;
|
|
173
|
+
--bit-highlighter-shadow: 0px 11px 29px 0px rgba(0, 0, 0, 0.23));
|
|
173
174
|
```
|
|
174
175
|
|
|
175
176
|
While it is preferred to use the css variables, you can also set them using react props:
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import { HighlighterSize } from './element-highlighter';
|
|
3
2
|
declare type HighlightedElementProps = {
|
|
4
3
|
style?: CSSProperties;
|
|
5
4
|
targetStyle?: CSSProperties;
|
|
6
5
|
className?: string;
|
|
7
6
|
watchMotion?: boolean;
|
|
8
|
-
size?: HighlighterSize;
|
|
9
7
|
};
|
|
10
|
-
export declare const HighlightedElement: ({ style, targetStyle, watchMotion, className
|
|
8
|
+
export declare const HighlightedElement: ({ style, targetStyle, watchMotion, className }: HighlightedElementProps) => JSX.Element;
|
|
11
9
|
export declare const Customized: () => JSX.Element;
|
|
12
10
|
export declare const Sizes: () => JSX.Element;
|
|
13
11
|
export declare const MovingElement: () => JSX.Element;
|
|
@@ -32,14 +32,14 @@ const mockTarget = {
|
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
};
|
|
35
|
-
const HighlightedElement = ({ style, targetStyle, watchMotion, className
|
|
35
|
+
const HighlightedElement = ({ style, targetStyle, watchMotion, className }) => {
|
|
36
36
|
const [targetElement, setTargetElement] = (0, react_1.useState)(undefined);
|
|
37
37
|
const targetRef = (0, react_1.createRef)();
|
|
38
38
|
(0, react_1.useEffect)(() => setTargetElement(targetRef.current || undefined), [targetRef.current]);
|
|
39
39
|
const target = targetElement && Object.assign(Object.assign({}, mockTarget), { element: targetElement });
|
|
40
|
-
return (react_1.default.createElement("div", { className: className, style: { padding: '16px 16px 40px 16px', width: 300 } },
|
|
40
|
+
return (react_1.default.createElement("div", { className: className, style: { padding: '16px 16px 40px 16px', width: 300, fontFamily: 'sans-serif' } },
|
|
41
41
|
react_1.default.createElement("div", { ref: targetRef, style: Object.assign({ width: 100 }, targetStyle) }, "highlight target"),
|
|
42
|
-
target &&
|
|
42
|
+
target && react_1.default.createElement(element_highlighter_1.ElementHighlighter, { target: target, style: style, watchMotion: watchMotion, placement: "bottom" })));
|
|
43
43
|
};
|
|
44
44
|
exports.HighlightedElement = HighlightedElement;
|
|
45
45
|
const Customized = () => {
|
|
@@ -52,9 +52,9 @@ const Customized = () => {
|
|
|
52
52
|
exports.Customized = Customized;
|
|
53
53
|
const Sizes = () => {
|
|
54
54
|
return (react_1.default.createElement("div", null,
|
|
55
|
-
react_1.default.createElement(exports.HighlightedElement, {
|
|
56
|
-
react_1.default.createElement(exports.HighlightedElement, {
|
|
57
|
-
react_1.default.createElement(exports.HighlightedElement, {
|
|
55
|
+
react_1.default.createElement(exports.HighlightedElement, { style: { fontSize: 10 } }),
|
|
56
|
+
react_1.default.createElement(exports.HighlightedElement, { style: { fontSize: 14 } }),
|
|
57
|
+
react_1.default.createElement(exports.HighlightedElement, { style: { fontSize: 18 } })));
|
|
58
58
|
};
|
|
59
59
|
exports.Sizes = Sizes;
|
|
60
60
|
const MovingElement = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-highlighter.compositions.js","sourceRoot":"","sources":["../../element-highlighter/element-highlighter.compositions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,oJAAyG;AACzG,+CAA6E;AAC7E,+
|
|
1
|
+
{"version":3,"file":"element-highlighter.compositions.js","sourceRoot":"","sources":["../../element-highlighter/element-highlighter.compositions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,oJAAyG;AACzG,+CAA6E;AAC7E,+DAA4E;AAE5E,MAAM,UAAU,GAA6B;IAC3C,UAAU,EAAE;QACV;YACE,CAAC,+EAAkB,CAAC,EAAE;gBACpB,EAAE,EAAE,qCAAqC;aAC1C;SACF;KACF;CACF,CAAC;AASK,MAAM,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAA2B,EAAE,EAAE;IAC5G,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAA0B,SAAS,CAAC,CAAC;IACvF,MAAM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J,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB;AAEK,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAExC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1E,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,8BAAC,0BAAkB,IAAC,WAAW,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,GAAI,CAAC;AACrE,CAAC,CAAC;AATW,QAAA,aAAa,iBASxB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
-
import { Placement
|
|
4
|
-
export declare type HighlighterSize = LabelSize;
|
|
3
|
+
import { Placement } from '../label';
|
|
5
4
|
export interface ElementHighlighterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
5
|
/** target element to highlight */
|
|
7
6
|
target: HighlightTarget;
|
|
@@ -11,7 +10,6 @@ export interface ElementHighlighterProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
11
10
|
classes?: HighlightClasses;
|
|
12
11
|
/** continually update highlighter to match moving elements */
|
|
13
12
|
watchMotion?: boolean;
|
|
14
|
-
size?: HighlighterSize;
|
|
15
13
|
}
|
|
16
14
|
export { Placement };
|
|
17
15
|
export declare type HighlightTarget = {
|
|
@@ -25,4 +23,4 @@ export declare type HighlightClasses = {
|
|
|
25
23
|
frame?: string;
|
|
26
24
|
label?: string;
|
|
27
25
|
};
|
|
28
|
-
export declare function ElementHighlighter({ target, placement, watchMotion, className, classes,
|
|
26
|
+
export declare function ElementHighlighter({ target, placement, watchMotion, className, classes, ...props }: ElementHighlighterProps): JSX.Element;
|
|
@@ -22,11 +22,11 @@ const label_1 = require("../label");
|
|
|
22
22
|
const ignore_highlighter_1 = require("../ignore-highlighter");
|
|
23
23
|
const element_highlighter_module_scss_1 = __importDefault(require("./element-highlighter.module.scss"));
|
|
24
24
|
function ElementHighlighter(_a) {
|
|
25
|
-
var { target, placement = 'top', watchMotion = true, className, classes
|
|
25
|
+
var { target, placement = 'top', watchMotion = true, className, classes } = _a, props = __rest(_a, ["target", "placement", "watchMotion", "className", "classes"]);
|
|
26
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
27
|
react_1.default.createElement(frame_1.Frame, { targetRef: target.element, className: (0, classnames_1.default)(element_highlighter_module_scss_1.default.frame, classes === null || classes === void 0 ? void 0 : classes.frame), watchMotion: watchMotion }),
|
|
28
28
|
target.components && (react_1.default.createElement(label_1.LabelContainer, { className: element_highlighter_module_scss_1.default.label, targetRef: target.element, placement: placement, watchMotion: watchMotion },
|
|
29
|
-
react_1.default.createElement(label_1.Label, { components: target.components, className: classes === null || classes === void 0 ? void 0 : classes.label
|
|
29
|
+
react_1.default.createElement(label_1.Label, { components: target.components, className: classes === null || classes === void 0 ? void 0 : classes.label })))));
|
|
30
30
|
}
|
|
31
31
|
exports.ElementHighlighter = ElementHighlighter;
|
|
32
32
|
//# sourceMappingURL=element-highlighter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-highlighter.js","sourceRoot":"","sources":["../../element-highlighter/element-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AAEpC,oCAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"element-highlighter.js","sourceRoot":"","sources":["../../element-highlighter/element-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AAEpC,oCAAiC;AACjC,oCAA4D;AAC5D,8DAA8D;AAC9D,wGAAuD;AA4BvD,SAAgB,kBAAkB,CAAC,EAOT;QAPS,EACjC,MAAM,EACN,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,IAAI,EAClB,SAAS,EACT,OAAO,OAEiB,EADrB,KAAK,cANyB,8DAOlC,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,IACJ,SAAS,EAAE,MAAM,CAAC,OAAO,EACzB,SAAS,EAAE,IAAA,oBAAU,EAAC,yCAAM,CAAC,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,EACnD,WAAW,EAAE,WAAW,GACxB;QAED,MAAM,CAAC,UAAU,IAAI,CACpB,8BAAC,sBAAc,IACb,SAAS,EAAE,yCAAM,CAAC,KAAK,EACvB,SAAS,EAAE,MAAM,CAAC,OAAO,EACzB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW;YAExB,8BAAC,aAAK,IAAC,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,GAAI,CACpD,CAClB,CACG,CACP,CAAC;AACJ,CAAC;AA5BD,gDA4BC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
@import '~@teambit/ui-foundation.ui.constants.z-indexes/z-indexes.module.scss';
|
|
2
2
|
|
|
3
|
-
.container {
|
|
4
|
-
font-size: 12px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.label {
|
|
8
|
-
|
|
4
|
+
// space between the label and the target
|
|
5
|
+
// keep this space so users can move their cursor in this space.
|
|
9
6
|
padding: 8px;
|
|
10
7
|
}
|
|
11
8
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ElementHighlighter } from './element-highlighter';
|
|
2
|
-
export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses
|
|
2
|
+
export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses } from './element-highlighter';
|
|
@@ -25,7 +25,7 @@ const design_ui_icon_button_1 = require("@teambit/design.ui.icon-button");
|
|
|
25
25
|
const hover_highlighter_1 = require("./hover-highlighter");
|
|
26
26
|
const ShowWhenHovering = () => {
|
|
27
27
|
const [disabled, setDisabled] = (0, react_1.useState)(false);
|
|
28
|
-
return (react_1.default.createElement("div", { style: { padding: '16px 50px 32px 16px', minWidth: 300 } },
|
|
28
|
+
return (react_1.default.createElement("div", { style: { padding: '16px 50px 32px 16px', minWidth: 300, fontFamily: 'sans-serif' } },
|
|
29
29
|
react_1.default.createElement(hover_highlighter_1.HoverHighlighter, { style: { padding: 16 }, disabled: disabled },
|
|
30
30
|
react_1.default.createElement("div", null,
|
|
31
31
|
react_1.default.createElement("br", null),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-highlighter.compositions.js","sourceRoot":"","sources":["../../hover-highlighter/hover-highlighter.compositions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,0EAA4D;AAC5D,2DAAuD;AAEhD,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAEzD,OAAO,CACL,uCAAK,KAAK,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"hover-highlighter.compositions.js","sourceRoot":"","sources":["../../hover-highlighter/hover-highlighter.compositions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AACxC,0EAA4D;AAC5D,2DAAuD;AAEhD,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAEzD,OAAO,CACL,uCAAK,KAAK,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE;QACrF,8BAAC,oCAAgB,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ;YAC1D;gBACE,yCAAM;gBACN;oBACE,8BAAC,kCAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,iBAAyB,CACtE;gBACN;oBACG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;;oBAAkB,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CACpE,CACF,CACW,CACf,CACP,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,gBAAgB,oBAkB3B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { Placement, HighlightClasses
|
|
2
|
+
import { Placement, HighlightClasses } from '../element-highlighter';
|
|
3
3
|
import type { MatchRule, ComponentMatchRule } from '../rule-matcher';
|
|
4
4
|
export interface HybridHighlighterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/** stop all highlighting and drop listeners */
|
|
@@ -31,7 +31,6 @@ export interface HybridHighlighterProps extends React.HTMLAttributes<HTMLDivElem
|
|
|
31
31
|
bgColor?: string;
|
|
32
32
|
bgColorHover?: string;
|
|
33
33
|
bgColorActive?: string;
|
|
34
|
-
size?: HighlighterSize;
|
|
35
34
|
}
|
|
36
35
|
/** automatically highlight components on hover */
|
|
37
|
-
export declare function HybridHighlighter({ disabled, mode, debounceSelection, watchMotion, placement, rule, componentRule, classes, highlightStyle, className, style, bgColor, bgColorHover, bgColorActive,
|
|
36
|
+
export declare function HybridHighlighter({ disabled, mode, debounceSelection, watchMotion, placement, rule, componentRule, classes, highlightStyle, className, style, bgColor, bgColorHover, bgColorActive, children, ...rest }: HybridHighlighterProps): JSX.Element;
|
|
@@ -42,7 +42,7 @@ const element_highlighter_1 = require("../element-highlighter");
|
|
|
42
42
|
const children_highlighter_1 = require("../children-highlighter");
|
|
43
43
|
/** automatically highlight components on hover */
|
|
44
44
|
function HybridHighlighter(_a) {
|
|
45
|
-
var { disabled, mode = 'hover', debounceSelection = 80, watchMotion = true, placement, rule, componentRule, classes, highlightStyle, className, style, bgColor, bgColorHover, bgColorActive,
|
|
45
|
+
var { disabled, mode = 'hover', debounceSelection = 80, watchMotion = true, placement, rule, componentRule, classes, highlightStyle, className, style, bgColor, bgColorHover, bgColorActive, children } = _a, rest = __rest(_a, ["disabled", "mode", "debounceSelection", "watchMotion", "placement", "rule", "componentRule", "classes", "highlightStyle", "className", "style", "bgColor", "bgColorHover", "bgColorActive", "children"]);
|
|
46
46
|
const ref = (0, react_1.createRef)();
|
|
47
47
|
const [targets, setTarget] = (0, react_1.useState)({});
|
|
48
48
|
const scopeClass = (0, react_1.useRef)(`hl-scope-${(0, uuid_1.v4)()}`).current;
|
|
@@ -70,7 +70,7 @@ function HybridHighlighter(_a) {
|
|
|
70
70
|
const _styles = (0, react_1.useMemo)(() => (Object.assign({ '--bit-highlighter-color': bgColor, '--bit-highlighter-color-hover': bgColorHover, '--bit-highlighter-color-active': bgColorActive }, style)), [bgColor, bgColorHover, bgColorActive, style]);
|
|
71
71
|
return (react_1.default.createElement("div", Object.assign({ ref: ref }, rest, handlers, { style: _styles, className: (0, classnames_1.default)(className, scopeClass), "data-nullify-component-highlight": true }),
|
|
72
72
|
children,
|
|
73
|
-
Object.entries(targets).map(([key, target]) => (react_1.default.createElement(element_highlighter_1.ElementHighlighter, { key: key, target: target, classes: classes, style: highlightStyle, placement: placement, watchMotion: watchMotion
|
|
73
|
+
Object.entries(targets).map(([key, target]) => (react_1.default.createElement(element_highlighter_1.ElementHighlighter, { key: key, target: target, classes: classes, style: highlightStyle, placement: placement, watchMotion: watchMotion })))));
|
|
74
74
|
}
|
|
75
75
|
exports.HybridHighlighter = HybridHighlighter;
|
|
76
76
|
//# sourceMappingURL=hybrid-highlighter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hybrid-highlighter.js","sourceRoot":"","sources":["../../hybrid-highlighter/hybrid-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8F;AAC9F,4DAAoC;AACpC,+BAA0B;AAE1B,4DAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"hybrid-highlighter.js","sourceRoot":"","sources":["../../hybrid-highlighter/hybrid-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8F;AAC9F,4DAAoC;AACpC,+BAA0B;AAE1B,4DAA2D;AAC3D,gEAA0G;AAC1G,kEAAiE;AAqCjE,kDAAkD;AAClD,SAAgB,iBAAiB,CAAC,EAkBT;QAlBS,EAChC,QAAQ,EACR,IAAI,GAAG,OAAO,EACd,iBAAiB,GAAG,EAAE,EACtB,WAAW,GAAG,IAAI,EAClB,SAAS,EACT,IAAI,EACJ,aAAa,EAEb,OAAO,EACP,cAAc,EACd,SAAS,EACT,KAAK,EACL,OAAO,EACP,YAAY,EACZ,aAAa,EACb,QAAQ,OAEe,EADpB,IAAI,cAjByB,yMAkBjC,CADQ;IAEP,MAAM,GAAG,GAAG,IAAA,iBAAS,GAAkB,CAAC;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DACE,GAAG,EAAE,GAAG,IACJ,IAAI,EACJ,QAAQ,IACZ,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,UAAU,CAAC;QAG3C,QAAQ;QAKR,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAC9C,8BAAC,wCAAkB,IACjB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,GACxB,CACH,CAAC,CACE,CACP,CAAC;AACJ,CAAC;AAtFD,8CAsFC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
-
export declare type ComponentStripSize = 's' | 'm' | 'l';
|
|
4
3
|
interface ComponentStripProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
4
|
component: ComponentMetaHolder;
|
|
6
|
-
size?: ComponentStripSize;
|
|
7
5
|
}
|
|
8
6
|
export declare const ComponentStrip: React.ForwardRefExoticComponent<ComponentStripProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
7
|
export {};
|
|
@@ -30,11 +30,11 @@ const component_modules_component_url_1 = require("@teambit/component.modules.co
|
|
|
30
30
|
const react_ui_highlighter_component_metadata_bit_component_meta_1 = require("@teambit/react.ui.highlighter.component-metadata.bit-component-meta");
|
|
31
31
|
const component_strip_module_scss_1 = __importDefault(require("./component-strip.module.scss"));
|
|
32
32
|
const links_1 = require("./links");
|
|
33
|
-
exports.ComponentStrip = (0, react_1.forwardRef)(function ComponentStrip({ component,
|
|
33
|
+
exports.ComponentStrip = (0, react_1.forwardRef)(function ComponentStrip({ component, children }, ref) {
|
|
34
34
|
const { id, homepage, exported } = component[react_ui_highlighter_component_metadata_bit_component_meta_1.componentMetaField];
|
|
35
35
|
const parsedId = (0, react_1.useMemo)(() => component_id_1.ComponentID.tryFromString(id), [id]);
|
|
36
36
|
const componentLink = homepage || (0, links_1.calcComponentLink)(parsedId, exported);
|
|
37
|
-
return (react_1.default.createElement("div", { className: component_strip_module_scss_1.default.componentStrip, ref: ref
|
|
37
|
+
return (react_1.default.createElement("div", { className: component_strip_module_scss_1.default.componentStrip, ref: ref },
|
|
38
38
|
!parsedId && react_1.default.createElement(LabelBlock, { link: homepage }, id),
|
|
39
39
|
parsedId && react_1.default.createElement(LabelBlock, { link: component_modules_component_url_1.ScopeUrl.toUrl(parsedId.scope) }, parsedId.scope),
|
|
40
40
|
parsedId && (react_1.default.createElement(LabelBlock, { link: componentLink },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-strip.js","sourceRoot":"","sources":["../../label/component-strip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4E;AAC5E,sFAAkE;AAClE,wDAAoD;AACpD,8FAAoE;AACpE,oJAG6E;AAC7E,gGAAmD;AACnD,mCAA4C;
|
|
1
|
+
{"version":3,"file":"component-strip.js","sourceRoot":"","sources":["../../label/component-strip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4E;AAC5E,sFAAkE;AAClE,wDAAoD;AACpD,8FAAoE;AACpE,oJAG6E;AAC7E,gGAAmD;AACnD,mCAA4C;AAK/B,QAAA,cAAc,GAAG,IAAA,kBAAU,EAAC,SAAS,cAAc,CAC9D,EAAE,SAAS,EAAE,QAAQ,EAAuB,EAC5C,GAAiC;IAEjC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,+EAAkB,CAAC,CAAC;IAEjE,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,aAA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height: 16px;
|
|
9
8
|
border-radius: $borderRadius;
|
|
10
|
-
box-shadow:
|
|
11
|
-
|
|
12
|
-
&[data-size='s'] {
|
|
13
|
-
font-size: 12px;
|
|
14
|
-
line-height: 16px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&[data-size='m'] {
|
|
18
|
-
font-size: 14px;
|
|
19
|
-
line-height: 16px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&[data-size='l'] {
|
|
23
|
-
font-size: 16px;
|
|
24
|
-
line-height: 24px;
|
|
25
|
-
}
|
|
9
|
+
box-shadow: var(--bit-highlighter-shadow);
|
|
26
10
|
|
|
27
11
|
> * {
|
|
28
|
-
padding:
|
|
12
|
+
padding: 0 0.5em;
|
|
13
|
+
line-height: 1.5; //use line height to get rounder values than 0.25em padding
|
|
29
14
|
|
|
30
15
|
transition: filter 300ms, background-color 300ms;
|
|
31
16
|
transform: translateZ(0); //fix blurriness in Safari
|
package/dist/label/index.d.ts
CHANGED
package/dist/label/label.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
-
import { ComponentStripSize } from './component-strip';
|
|
4
|
-
export declare type LabelSize = ComponentStripSize;
|
|
5
3
|
export interface LabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
4
|
components: ComponentMetaHolder[];
|
|
7
|
-
size?: LabelSize;
|
|
8
5
|
}
|
|
9
|
-
export declare function Label({ components,
|
|
6
|
+
export declare function Label({ components, ...props }: LabelProps): JSX.Element;
|
package/dist/label/label.js
CHANGED
|
@@ -40,7 +40,7 @@ const label_module_scss_1 = __importDefault(require("./label.module.scss"));
|
|
|
40
40
|
const component_strip_1 = require("./component-strip");
|
|
41
41
|
const other_components_1 = require("./other-components");
|
|
42
42
|
function Label(_a) {
|
|
43
|
-
var { components
|
|
43
|
+
var { components } = _a, props = __rest(_a, ["components"]);
|
|
44
44
|
const [showMore, setShowMore] = (0, react_1.useState)(false);
|
|
45
45
|
const last = components.slice(-1).pop();
|
|
46
46
|
if (!last)
|
|
@@ -50,8 +50,8 @@ function Label(_a) {
|
|
|
50
50
|
(0, react_1.useEffect)(() => {
|
|
51
51
|
setShowMore(false);
|
|
52
52
|
}, [components]);
|
|
53
|
-
return (react_1.default.createElement(other_components_1.OtherComponentsPopper, { components: components, visible: showMore, placement: "bottom-start"
|
|
54
|
-
react_1.default.createElement(component_strip_1.ComponentStrip, Object.assign({}, props, { component: last
|
|
53
|
+
return (react_1.default.createElement(other_components_1.OtherComponentsPopper, { components: components, visible: showMore, placement: "bottom-start" },
|
|
54
|
+
react_1.default.createElement(component_strip_1.ComponentStrip, Object.assign({}, props, { component: last }), hasMore && (react_1.default.createElement("span", { className: (0, classnames_1.default)(label_module_scss_1.default.othersTooltip, showMore && label_module_scss_1.default.active), onClick: () => setShowMore((x) => !x) })))));
|
|
55
55
|
}
|
|
56
56
|
exports.Label = Label;
|
|
57
57
|
//# sourceMappingURL=label.js.map
|
package/dist/label/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../label/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,4DAAoC;AAGpC,4EAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../label/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,4DAAoC;AAGpC,4EAAyC;AACzC,uDAAmD;AACnD,yDAA2D;AAM3D,SAAgB,KAAK,CAAC,EAAoC;QAApC,EAAE,UAAU,OAAwB,EAAnB,KAAK,cAAtB,cAAwB,CAAF;IAC1C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACxC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAEtC,+BAA+B;IAC/B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,8BAAC,wCAAqB,IAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAC,cAAc;QACxF,8BAAC,gCAAc,oBAAK,KAAK,IAAE,SAAS,EAAE,IAAI,KACvC,OAAO,IAAI,CACV,wCACE,SAAS,EAAE,IAAA,oBAAU,EAAC,2BAAM,CAAC,aAAa,EAAE,QAAQ,IAAI,2BAAM,CAAC,MAAM,CAAC,EACtE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GACrC,CACH,CACc,CACK,CACzB,CAAC;AACJ,CAAC;AAxBD,sBAwBC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { TippyProps } from '@tippyjs/react/headless';
|
|
2
2
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
-
import { ComponentStripSize } from './component-strip';
|
|
4
3
|
export declare type OtherComponentsProps = {
|
|
5
4
|
components: ComponentMetaHolder[];
|
|
6
|
-
size?: ComponentStripSize;
|
|
7
5
|
start?: number;
|
|
8
6
|
end?: number;
|
|
9
7
|
} & TippyProps;
|
|
10
|
-
export declare function OtherComponentsPopper({ components, children, start, end,
|
|
8
|
+
export declare function OtherComponentsPopper({ components, children, start, end, placement, interactive, ...tippyProps }: OtherComponentsProps): JSX.Element;
|
|
@@ -21,11 +21,11 @@ const component_strip_1 = require("./component-strip");
|
|
|
21
21
|
const label_module_scss_1 = __importDefault(require("./label.module.scss"));
|
|
22
22
|
// a popper ("tooltip") that shows the additional React Components related to this dom element
|
|
23
23
|
function OtherComponentsPopper(_a) {
|
|
24
|
-
var { components, children, start, end = -1,
|
|
24
|
+
var { components, children, start, end = -1, placement = 'bottom', interactive = true } = _a, tippyProps = __rest(_a, ["components", "children", "start", "end", "placement", "interactive"]);
|
|
25
25
|
const content = (react_1.default.createElement(react_1.default.Fragment, null, components
|
|
26
26
|
.slice(start, end)
|
|
27
27
|
.reverse()
|
|
28
|
-
.map((comp, idx) => (react_1.default.createElement(component_strip_1.ComponentStrip, { key: idx, component: comp
|
|
28
|
+
.map((comp, idx) => (react_1.default.createElement(component_strip_1.ComponentStrip, { key: idx, component: comp })))));
|
|
29
29
|
return (react_1.default.createElement(headless_1.default, Object.assign({ placement: placement, interactive: interactive }, tippyProps, {
|
|
30
30
|
// second parameter "content" is always undefined, use content inline
|
|
31
31
|
// https://github.com/atomiks/tippyjs-react/issues/341
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"other-components.js","sourceRoot":"","sources":["../../label/other-components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uEAA4D;AAG5D,
|
|
1
|
+
{"version":3,"file":"other-components.js","sourceRoot":"","sources":["../../label/other-components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uEAA4D;AAG5D,uDAAmD;AACnD,4EAAyC;AAQzC,8FAA8F;AAC9F,SAAgB,qBAAqB,CAAC,EAQf;QARe,EACpC,UAAU,EACV,QAAQ,EACR,KAAK,EACL,GAAG,GAAG,CAAC,CAAC,EACR,SAAS,GAAG,QAAQ,EACpB,WAAW,GAAG,IAAI,OAEG,EADlB,UAAU,cAPuB,sEAQrC,CADc;IAEb,MAAM,OAAO,GAAG,CACd,8DACG,UAAU;SACR,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC;SACjB,OAAO,EAAE;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAClB,8BAAC,gCAAc,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,GAAI,CAC9C,CAAC,CACH,CACJ,CAAC;IAEF,OAAO,CACL,8BAAC,kBAAK,kBACJ,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,IACpB,UAAU;QACd,qEAAqE;QACrE,sDAAsD;QACtD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CACjB,uDAAS,KAAK,IAAE,SAAS,EAAE,2BAAM,CAAC,eAAe,KAC9C,OAAO,CACJ,CACP,KAEA,QAAQ,CACH,CACT,CAAC;AACJ,CAAC;AApCD,sDAoCC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { componentMetaField } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
2
2
|
import React, { useState, createRef, useEffect, CSSProperties } from 'react';
|
|
3
|
-
import { ElementHighlighter,
|
|
3
|
+
import { ElementHighlighter, HighlightTarget } from './element-highlighter';
|
|
4
4
|
|
|
5
5
|
const mockTarget: Partial<HighlightTarget> = {
|
|
6
6
|
components: [
|
|
@@ -17,10 +17,9 @@ type HighlightedElementProps = {
|
|
|
17
17
|
targetStyle?: CSSProperties;
|
|
18
18
|
className?: string;
|
|
19
19
|
watchMotion?: boolean;
|
|
20
|
-
size?: HighlighterSize;
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
export const HighlightedElement = ({ style, targetStyle, watchMotion, className
|
|
22
|
+
export const HighlightedElement = ({ style, targetStyle, watchMotion, className }: HighlightedElementProps) => {
|
|
24
23
|
const [targetElement, setTargetElement] = useState<HTMLElement | undefined>(undefined);
|
|
25
24
|
const targetRef = createRef<HTMLDivElement>();
|
|
26
25
|
|
|
@@ -28,13 +27,11 @@ export const HighlightedElement = ({ style, targetStyle, watchMotion, className,
|
|
|
28
27
|
const target = targetElement && { ...mockTarget, element: targetElement };
|
|
29
28
|
|
|
30
29
|
return (
|
|
31
|
-
<div className={className} style={{ padding: '16px 16px 40px 16px', width: 300 }}>
|
|
30
|
+
<div className={className} style={{ padding: '16px 16px 40px 16px', width: 300, fontFamily: 'sans-serif' }}>
|
|
32
31
|
<div ref={targetRef} style={{ width: 100, ...targetStyle }}>
|
|
33
32
|
highlight target
|
|
34
33
|
</div>
|
|
35
|
-
{target &&
|
|
36
|
-
<ElementHighlighter target={target} style={style} watchMotion={watchMotion} placement="bottom" size={size} />
|
|
37
|
-
)}
|
|
34
|
+
{target && <ElementHighlighter target={target} style={style} watchMotion={watchMotion} placement="bottom" />}
|
|
38
35
|
</div>
|
|
39
36
|
);
|
|
40
37
|
};
|
|
@@ -56,9 +53,9 @@ export const Customized = () => {
|
|
|
56
53
|
export const Sizes = () => {
|
|
57
54
|
return (
|
|
58
55
|
<div>
|
|
59
|
-
<HighlightedElement
|
|
60
|
-
<HighlightedElement
|
|
61
|
-
<HighlightedElement
|
|
56
|
+
<HighlightedElement style={{ fontSize: 10 }} />
|
|
57
|
+
<HighlightedElement style={{ fontSize: 14 }} />
|
|
58
|
+
<HighlightedElement style={{ fontSize: 18 }} />
|
|
62
59
|
</div>
|
|
63
60
|
);
|
|
64
61
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
@import '~@teambit/ui-foundation.ui.constants.z-indexes/z-indexes.module.scss';
|
|
2
2
|
|
|
3
|
-
.container {
|
|
4
|
-
font-size: 12px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.label {
|
|
8
|
-
|
|
4
|
+
// space between the label and the target
|
|
5
|
+
// keep this space so users can move their cursor in this space.
|
|
9
6
|
padding: 8px;
|
|
10
7
|
}
|
|
11
8
|
|
|
@@ -2,12 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
4
4
|
import { Frame } from '../frame';
|
|
5
|
-
import { Label, LabelContainer, Placement
|
|
5
|
+
import { Label, LabelContainer, Placement } from '../label';
|
|
6
6
|
import { excludeHighlighterAtt } from '../ignore-highlighter';
|
|
7
7
|
import styles from './element-highlighter.module.scss';
|
|
8
8
|
|
|
9
|
-
export type HighlighterSize = LabelSize;
|
|
10
|
-
|
|
11
9
|
export interface ElementHighlighterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
10
|
/** target element to highlight */
|
|
13
11
|
target: HighlightTarget;
|
|
@@ -17,7 +15,6 @@ export interface ElementHighlighterProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
17
15
|
classes?: HighlightClasses;
|
|
18
16
|
/** continually update highlighter to match moving elements */
|
|
19
17
|
watchMotion?: boolean;
|
|
20
|
-
size?: HighlighterSize;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
export { Placement };
|
|
@@ -41,7 +38,6 @@ export function ElementHighlighter({
|
|
|
41
38
|
watchMotion = true,
|
|
42
39
|
className,
|
|
43
40
|
classes,
|
|
44
|
-
size,
|
|
45
41
|
...props
|
|
46
42
|
}: ElementHighlighterProps) {
|
|
47
43
|
return (
|
|
@@ -59,7 +55,7 @@ export function ElementHighlighter({
|
|
|
59
55
|
placement={placement}
|
|
60
56
|
watchMotion={watchMotion}
|
|
61
57
|
>
|
|
62
|
-
<Label components={target.components} className={classes?.label}
|
|
58
|
+
<Label components={target.components} className={classes?.label} />
|
|
63
59
|
</LabelContainer>
|
|
64
60
|
)}
|
|
65
61
|
</div>
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
export { ElementHighlighter } from './element-highlighter';
|
|
2
|
-
export type {
|
|
3
|
-
ElementHighlighterProps,
|
|
4
|
-
HighlightTarget,
|
|
5
|
-
Placement,
|
|
6
|
-
HighlightClasses,
|
|
7
|
-
HighlighterSize,
|
|
8
|
-
} from './element-highlighter';
|
|
2
|
+
export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses } from './element-highlighter';
|
|
@@ -6,7 +6,7 @@ export const ShowWhenHovering = () => {
|
|
|
6
6
|
const [disabled, setDisabled] = useState<boolean>(false);
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
|
-
<div style={{ padding: '16px 50px 32px 16px', minWidth: 300 }}>
|
|
9
|
+
<div style={{ padding: '16px 50px 32px 16px', minWidth: 300, fontFamily: 'sans-serif' }}>
|
|
10
10
|
<HoverHighlighter style={{ padding: 16 }} disabled={disabled}>
|
|
11
11
|
<div>
|
|
12
12
|
<br />
|
|
@@ -3,13 +3,7 @@ import classnames from 'classnames';
|
|
|
3
3
|
import { v4 } from 'uuid';
|
|
4
4
|
|
|
5
5
|
import { useHoverHighlighter } from '../hover-highlighter';
|
|
6
|
-
import {
|
|
7
|
-
ElementHighlighter,
|
|
8
|
-
HighlightTarget,
|
|
9
|
-
Placement,
|
|
10
|
-
HighlightClasses,
|
|
11
|
-
HighlighterSize,
|
|
12
|
-
} from '../element-highlighter';
|
|
6
|
+
import { ElementHighlighter, HighlightTarget, Placement, HighlightClasses } from '../element-highlighter';
|
|
13
7
|
import { useChildrenHighlighter } from '../children-highlighter';
|
|
14
8
|
import type { MatchRule, ComponentMatchRule } from '../rule-matcher';
|
|
15
9
|
|
|
@@ -45,7 +39,6 @@ export interface HybridHighlighterProps extends React.HTMLAttributes<HTMLDivElem
|
|
|
45
39
|
bgColor?: string;
|
|
46
40
|
bgColorHover?: string;
|
|
47
41
|
bgColorActive?: string;
|
|
48
|
-
size?: HighlighterSize;
|
|
49
42
|
}
|
|
50
43
|
|
|
51
44
|
/** automatically highlight components on hover */
|
|
@@ -65,7 +58,6 @@ export function HybridHighlighter({
|
|
|
65
58
|
bgColor,
|
|
66
59
|
bgColorHover,
|
|
67
60
|
bgColorActive,
|
|
68
|
-
size,
|
|
69
61
|
children,
|
|
70
62
|
...rest
|
|
71
63
|
}: HybridHighlighterProps) {
|
|
@@ -132,7 +124,6 @@ export function HybridHighlighter({
|
|
|
132
124
|
style={highlightStyle}
|
|
133
125
|
placement={placement}
|
|
134
126
|
watchMotion={watchMotion}
|
|
135
|
-
size={size}
|
|
136
127
|
/>
|
|
137
128
|
))}
|
|
138
129
|
</div>
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
$borderRadius:
|
|
2
|
-
$gap:
|
|
1
|
+
$borderRadius: 0.5em;
|
|
2
|
+
$gap: 0.125em;
|
|
3
3
|
|
|
4
4
|
.componentStrip {
|
|
5
5
|
display: flex;
|
|
6
|
+
width: fit-content; // for correct shadow size
|
|
6
7
|
|
|
7
|
-
font-size: 14px;
|
|
8
|
-
line-height: 16px;
|
|
9
8
|
border-radius: $borderRadius;
|
|
10
|
-
box-shadow:
|
|
11
|
-
|
|
12
|
-
&[data-size='s'] {
|
|
13
|
-
font-size: 12px;
|
|
14
|
-
line-height: 16px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&[data-size='m'] {
|
|
18
|
-
font-size: 14px;
|
|
19
|
-
line-height: 16px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&[data-size='l'] {
|
|
23
|
-
font-size: 16px;
|
|
24
|
-
line-height: 24px;
|
|
25
|
-
}
|
|
9
|
+
box-shadow: var(--bit-highlighter-shadow);
|
|
26
10
|
|
|
27
11
|
> * {
|
|
28
|
-
padding:
|
|
12
|
+
padding: 0 0.5em;
|
|
13
|
+
line-height: 1.5; //use line height to get rounder values than 0.25em padding
|
|
29
14
|
|
|
30
15
|
transition: filter 300ms, background-color 300ms;
|
|
31
16
|
transform: translateZ(0); //fix blurriness in Safari
|
|
@@ -9,14 +9,11 @@ import {
|
|
|
9
9
|
import styles from './component-strip.module.scss';
|
|
10
10
|
import { calcComponentLink } from './links';
|
|
11
11
|
|
|
12
|
-
export type ComponentStripSize = 's' | 'm' | 'l';
|
|
13
|
-
|
|
14
12
|
interface ComponentStripProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
13
|
component: ComponentMetaHolder;
|
|
16
|
-
size?: ComponentStripSize;
|
|
17
14
|
}
|
|
18
15
|
export const ComponentStrip = forwardRef(function ComponentStrip(
|
|
19
|
-
{ component,
|
|
16
|
+
{ component, children }: ComponentStripProps,
|
|
20
17
|
ref: ForwardedRef<HTMLDivElement>
|
|
21
18
|
) {
|
|
22
19
|
const { id, homepage, exported } = component[componentMetaField];
|
|
@@ -25,7 +22,7 @@ export const ComponentStrip = forwardRef(function ComponentStrip(
|
|
|
25
22
|
const componentLink = homepage || calcComponentLink(parsedId, exported);
|
|
26
23
|
|
|
27
24
|
return (
|
|
28
|
-
<div className={styles.componentStrip} ref={ref}
|
|
25
|
+
<div className={styles.componentStrip} ref={ref}>
|
|
29
26
|
{!parsedId && <LabelBlock link={homepage}>{id}</LabelBlock>}
|
|
30
27
|
{parsedId && <LabelBlock link={ScopeUrl.toUrl(parsedId.scope)}>{parsedId.scope}</LabelBlock>}
|
|
31
28
|
{parsedId && (
|
package/label/index.ts
CHANGED
package/label/label.tsx
CHANGED
|
@@ -3,16 +3,14 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
4
4
|
|
|
5
5
|
import styles from './label.module.scss';
|
|
6
|
-
import { ComponentStrip
|
|
6
|
+
import { ComponentStrip } from './component-strip';
|
|
7
7
|
import { OtherComponentsPopper } from './other-components';
|
|
8
8
|
|
|
9
|
-
export type LabelSize = ComponentStripSize;
|
|
10
9
|
export interface LabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
10
|
components: ComponentMetaHolder[];
|
|
12
|
-
size?: LabelSize;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
export function Label({ components,
|
|
13
|
+
export function Label({ components, ...props }: LabelProps) {
|
|
16
14
|
const [showMore, setShowMore] = useState(false);
|
|
17
15
|
const last = components.slice(-1).pop();
|
|
18
16
|
if (!last) return null;
|
|
@@ -25,8 +23,8 @@ export function Label({ components, size, ...props }: LabelProps) {
|
|
|
25
23
|
}, [components]);
|
|
26
24
|
|
|
27
25
|
return (
|
|
28
|
-
<OtherComponentsPopper components={components} visible={showMore} placement="bottom-start"
|
|
29
|
-
<ComponentStrip {...props} component={last}
|
|
26
|
+
<OtherComponentsPopper components={components} visible={showMore} placement="bottom-start">
|
|
27
|
+
<ComponentStrip {...props} component={last}>
|
|
30
28
|
{hasMore && (
|
|
31
29
|
<span
|
|
32
30
|
className={classNames(styles.othersTooltip, showMore && styles.active)}
|
|
@@ -2,12 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import Tippy, { TippyProps } from '@tippyjs/react/headless';
|
|
3
3
|
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
4
4
|
|
|
5
|
-
import { ComponentStrip
|
|
5
|
+
import { ComponentStrip } from './component-strip';
|
|
6
6
|
import styles from './label.module.scss';
|
|
7
7
|
|
|
8
8
|
export type OtherComponentsProps = {
|
|
9
9
|
components: ComponentMetaHolder[];
|
|
10
|
-
size?: ComponentStripSize;
|
|
11
10
|
start?: number;
|
|
12
11
|
end?: number;
|
|
13
12
|
} & TippyProps;
|
|
@@ -18,7 +17,6 @@ export function OtherComponentsPopper({
|
|
|
18
17
|
children,
|
|
19
18
|
start,
|
|
20
19
|
end = -1,
|
|
21
|
-
size,
|
|
22
20
|
placement = 'bottom',
|
|
23
21
|
interactive = true,
|
|
24
22
|
...tippyProps
|
|
@@ -29,7 +27,7 @@ export function OtherComponentsPopper({
|
|
|
29
27
|
.slice(start, end)
|
|
30
28
|
.reverse()
|
|
31
29
|
.map((comp, idx) => (
|
|
32
|
-
<ComponentStrip key={idx} component={comp}
|
|
30
|
+
<ComponentStrip key={idx} component={comp} />
|
|
33
31
|
))}
|
|
34
32
|
</>
|
|
35
33
|
);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react.ui.component-highlighter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.498",
|
|
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.498"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"get-xpath": "3.0.1",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"@teambit/base-ui.utils.popper-js.ignore-popper-size": "1.0.0",
|
|
22
22
|
"@teambit/base-ui.utils.popper-js.resize-to-match-reference": "1.0.0",
|
|
23
23
|
"@teambit/base-ui.routing.native-link": "1.0.0",
|
|
24
|
-
"@teambit/component-id": "0.0.
|
|
25
|
-
"@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.
|
|
26
|
-
"@teambit/react.modules.dom-to-react": "0.0.
|
|
27
|
-
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.
|
|
28
|
-
"@teambit/react.ui.hover-selector": "0.0.
|
|
29
|
-
"@teambit/component.modules.component-url": "0.0.
|
|
24
|
+
"@teambit/component-id": "0.0.392",
|
|
25
|
+
"@teambit/react.ui.highlighter.component-metadata.bit-component-meta": "0.0.14",
|
|
26
|
+
"@teambit/react.modules.dom-to-react": "0.0.480",
|
|
27
|
+
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.480",
|
|
28
|
+
"@teambit/react.ui.hover-selector": "0.0.158",
|
|
29
|
+
"@teambit/component.modules.component-url": "0.0.113"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "^17.0.8",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@teambit/design.ui.icon-button": "1.0.10"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@teambit/legacy": "1.0.
|
|
46
|
+
"@teambit/legacy": "1.0.188",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
48
48
|
"react": "^16.8.0 || ^17.0.0"
|
|
49
49
|
},
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react": "-"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@teambit/legacy": "1.0.
|
|
74
|
+
"@teambit/legacy": "1.0.188",
|
|
75
75
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
76
76
|
"react": "^16.8.0 || ^17.0.0"
|
|
77
77
|
}
|
package/tsconfig.json
CHANGED
|
Binary file
|