@teambit/react.ui.component-highlighter 0.0.0-3456ec42c20f5ecbc6cb251096040bd1c79ecc95
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 +103 -0
- package/children-highlighter/children-highlighter.spec.tsx +22 -0
- package/children-highlighter/children-highlighter.tsx +9 -0
- package/children-highlighter/index.ts +5 -0
- package/children-highlighter/use-children-highlighter.tsx +79 -0
- package/component-highlighter.docs.md +191 -0
- package/dist/children-highlighter/children-highlighter.composition.d.ts +6 -0
- package/dist/children-highlighter/children-highlighter.composition.js +93 -0
- package/dist/children-highlighter/children-highlighter.composition.js.map +1 -0
- package/dist/children-highlighter/children-highlighter.d.ts +4 -0
- package/dist/children-highlighter/children-highlighter.js +24 -0
- package/dist/children-highlighter/children-highlighter.js.map +1 -0
- package/dist/children-highlighter/children-highlighter.spec.d.ts +1 -0
- package/dist/children-highlighter/children-highlighter.spec.js +22 -0
- package/dist/children-highlighter/children-highlighter.spec.js.map +1 -0
- package/dist/children-highlighter/index.d.ts +4 -0
- package/dist/children-highlighter/index.js +8 -0
- package/dist/children-highlighter/index.js.map +1 -0
- package/dist/children-highlighter/use-children-highlighter.d.ts +18 -0
- package/dist/children-highlighter/use-children-highlighter.js +51 -0
- package/dist/children-highlighter/use-children-highlighter.js.map +1 -0
- package/dist/component-highlighter.docs.md +191 -0
- package/dist/element-highlighter/element-highlighter.compositions.d.ts +14 -0
- package/dist/element-highlighter/element-highlighter.compositions.js +103 -0
- package/dist/element-highlighter/element-highlighter.compositions.js.map +1 -0
- package/dist/element-highlighter/element-highlighter.d.ts +22 -0
- package/dist/element-highlighter/element-highlighter.js +31 -0
- package/dist/element-highlighter/element-highlighter.js.map +1 -0
- package/dist/element-highlighter/element-highlighter.module.scss +10 -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/frame/frame.d.ts +14 -0
- package/dist/frame/frame.js +128 -0
- package/dist/frame/frame.js.map +1 -0
- package/dist/frame/frame.module.scss +23 -0
- package/dist/frame/index.d.ts +2 -0
- package/dist/frame/index.js +6 -0
- package/dist/frame/index.js.map +1 -0
- package/dist/hover-highlighter/bubble-to-component.d.ts +24 -0
- package/dist/hover-highlighter/bubble-to-component.js +55 -0
- package/dist/hover-highlighter/bubble-to-component.js.map +1 -0
- package/dist/hover-highlighter/bubble-to-component.spec.d.ts +1 -0
- package/dist/hover-highlighter/bubble-to-component.spec.js +38 -0
- package/dist/hover-highlighter/bubble-to-component.spec.js.map +1 -0
- package/dist/hover-highlighter/hover-highlighter.compositions.d.ts +4 -0
- package/dist/hover-highlighter/hover-highlighter.compositions.js +73 -0
- package/dist/hover-highlighter/hover-highlighter.compositions.js.map +1 -0
- package/dist/hover-highlighter/hover-highlighter.d.ts +4 -0
- package/dist/hover-highlighter/hover-highlighter.js +24 -0
- package/dist/hover-highlighter/hover-highlighter.js.map +1 -0
- package/dist/hover-highlighter/hover-highlighter.spec.d.ts +1 -0
- package/dist/hover-highlighter/hover-highlighter.spec.js +95 -0
- package/dist/hover-highlighter/hover-highlighter.spec.js.map +1 -0
- package/dist/hover-highlighter/index.d.ts +4 -0
- package/dist/hover-highlighter/index.js +8 -0
- package/dist/hover-highlighter/index.js.map +1 -0
- package/dist/hover-highlighter/use-hover-highlighter.d.ts +25 -0
- package/dist/hover-highlighter/use-hover-highlighter.js +47 -0
- package/dist/hover-highlighter/use-hover-highlighter.js.map +1 -0
- package/dist/hybrid-highlighter/hybrid-highlighter.d.ts +36 -0
- package/dist/hybrid-highlighter/hybrid-highlighter.js +83 -0
- package/dist/hybrid-highlighter/hybrid-highlighter.js.map +1 -0
- package/dist/hybrid-highlighter/index.d.ts +2 -0
- package/dist/hybrid-highlighter/index.js +6 -0
- package/dist/hybrid-highlighter/index.js.map +1 -0
- package/dist/ignore-highlighter.d.ts +19 -0
- package/dist/ignore-highlighter.js +25 -0
- package/dist/ignore-highlighter.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/label/component-strip.compositions.d.ts +2 -0
- package/dist/label/component-strip.compositions.js +17 -0
- package/dist/label/component-strip.compositions.js.map +1 -0
- package/dist/label/component-strip.d.ts +7 -0
- package/dist/label/component-strip.js +61 -0
- package/dist/label/component-strip.js.map +1 -0
- package/dist/label/component-strip.module.scss +68 -0
- package/dist/label/index.d.ts +4 -0
- package/dist/label/index.js +8 -0
- package/dist/label/index.js.map +1 -0
- package/dist/label/label-container.d.ts +13 -0
- package/dist/label/label-container.js +77 -0
- package/dist/label/label-container.js.map +1 -0
- package/dist/label/label.d.ts +6 -0
- package/dist/label/label.js +60 -0
- package/dist/label/label.js.map +1 -0
- package/dist/label/label.module.scss +32 -0
- package/dist/label/links.d.ts +2 -0
- package/dist/label/links.js +16 -0
- package/dist/label/links.js.map +1 -0
- package/dist/label/other-components.d.ts +9 -0
- package/dist/label/other-components.js +34 -0
- package/dist/label/other-components.js.map +1 -0
- package/dist/mock-component.d.ts +14 -0
- package/dist/mock-component.js +43 -0
- package/dist/mock-component.js.map +1 -0
- package/dist/preview-1766004072990.js +10 -0
- package/dist/rule-matcher.d.ts +8 -0
- package/dist/rule-matcher.js +32 -0
- package/dist/rule-matcher.js.map +1 -0
- package/element-highlighter/element-highlighter.compositions.tsx +130 -0
- package/element-highlighter/element-highlighter.module.scss +10 -0
- package/element-highlighter/element-highlighter.tsx +51 -0
- package/element-highlighter/index.ts +2 -0
- package/frame/frame.module.scss +23 -0
- package/frame/frame.tsx +142 -0
- package/frame/index.ts +2 -0
- package/hover-highlighter/bubble-to-component.spec.tsx +57 -0
- package/hover-highlighter/bubble-to-component.tsx +82 -0
- package/hover-highlighter/hover-highlighter.compositions.tsx +65 -0
- package/hover-highlighter/hover-highlighter.spec.tsx +115 -0
- package/hover-highlighter/hover-highlighter.tsx +8 -0
- package/hover-highlighter/index.ts +5 -0
- package/hover-highlighter/use-hover-highlighter.tsx +85 -0
- package/hybrid-highlighter/hybrid-highlighter.tsx +142 -0
- package/hybrid-highlighter/index.ts +2 -0
- package/ignore-highlighter.tsx +22 -0
- package/index.ts +21 -0
- package/label/component-strip.compositions.tsx +13 -0
- package/label/component-strip.module.scss +68 -0
- package/label/component-strip.tsx +57 -0
- package/label/index.ts +5 -0
- package/label/label-container.tsx +74 -0
- package/label/label.module.scss +32 -0
- package/label/label.tsx +37 -0
- package/label/links.tsx +9 -0
- package/label/other-components.tsx +51 -0
- package/mock-component.tsx +23 -0
- package/package.json +60 -0
- package/rule-matcher.tsx +42 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** name of ignore attribute */
|
|
3
|
+
export declare const excludeHighlighterAttrName = "data-ignore-component-highlight";
|
|
4
|
+
/** selector for elements with the ignore attribute */
|
|
5
|
+
export declare const excludeHighlighterSelector = "[data-ignore-component-highlight]";
|
|
6
|
+
/** highlighter will exclude elements with this attribute */
|
|
7
|
+
export declare const excludeHighlighterAtt: {
|
|
8
|
+
"data-ignore-component-highlight": boolean;
|
|
9
|
+
};
|
|
10
|
+
/** children of this element will be excluded by the automatic highlighter */
|
|
11
|
+
export declare function ExcludeHighlighter(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
12
|
+
/** name of skip attribute */
|
|
13
|
+
export declare const skipHighlighterAttrName = "data-skip-component-highlight";
|
|
14
|
+
/** highlighter will skip (ignore) elements with these attributes */
|
|
15
|
+
export declare const skipHighlighterAttr: {
|
|
16
|
+
"data-skip-component-highlight": boolean;
|
|
17
|
+
};
|
|
18
|
+
/** selector for elements with the skip attribute */
|
|
19
|
+
export declare const skipHighlighterSelector = "[data-skip-component-highlight]";
|
|
@@ -0,0 +1,25 @@
|
|
|
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.skipHighlighterSelector = exports.skipHighlighterAttr = exports.skipHighlighterAttrName = exports.excludeHighlighterAtt = exports.excludeHighlighterSelector = exports.excludeHighlighterAttrName = void 0;
|
|
7
|
+
exports.ExcludeHighlighter = ExcludeHighlighter;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
/** name of ignore attribute */
|
|
10
|
+
exports.excludeHighlighterAttrName = 'data-ignore-component-highlight';
|
|
11
|
+
/** selector for elements with the ignore attribute */
|
|
12
|
+
exports.excludeHighlighterSelector = `[${exports.excludeHighlighterAttrName}]`;
|
|
13
|
+
/** highlighter will exclude elements with this attribute */
|
|
14
|
+
exports.excludeHighlighterAtt = { [exports.excludeHighlighterAttrName]: true };
|
|
15
|
+
/** children of this element will be excluded by the automatic highlighter */
|
|
16
|
+
function ExcludeHighlighter(props) {
|
|
17
|
+
return react_1.default.createElement("div", Object.assign({}, props, exports.excludeHighlighterAtt));
|
|
18
|
+
}
|
|
19
|
+
/** name of skip attribute */
|
|
20
|
+
exports.skipHighlighterAttrName = 'data-skip-component-highlight';
|
|
21
|
+
/** highlighter will skip (ignore) elements with these attributes */
|
|
22
|
+
exports.skipHighlighterAttr = { [exports.skipHighlighterAttrName]: true };
|
|
23
|
+
/** selector for elements with the skip attribute */
|
|
24
|
+
exports.skipHighlighterSelector = `[${exports.skipHighlighterAttrName}]`;
|
|
25
|
+
//# sourceMappingURL=ignore-highlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore-highlighter.js","sourceRoot":"","sources":["../ignore-highlighter.tsx"],"names":[],"mappings":";;;;;;AAYA,gDAEC;AAdD,kDAA0B;AAE1B,+BAA+B;AAClB,QAAA,0BAA0B,GAAG,iCAAiC,CAAC;AAE5E,sDAAsD;AACzC,QAAA,0BAA0B,GAAG,IAAI,kCAA0B,GAAG,CAAC;AAE5E,4DAA4D;AAC/C,QAAA,qBAAqB,GAAG,EAAE,CAAC,kCAA0B,CAAC,EAAE,IAAI,EAAE,CAAC;AAE5E,6EAA6E;AAC7E,SAAgB,kBAAkB,CAAC,KAA2C;IAC5E,OAAO,uDAAS,KAAK,EAAM,6BAAqB,EAAI,CAAC;AACvD,CAAC;AAED,6BAA6B;AAChB,QAAA,uBAAuB,GAAG,+BAA+B,CAAC;AACvE,oEAAoE;AACvD,QAAA,mBAAmB,GAAG,EAAE,CAAC,+BAAuB,CAAC,EAAE,IAAI,EAAE,CAAC;AACvE,oDAAoD;AACvC,QAAA,uBAAuB,GAAG,IAAI,+BAAuB,GAAG,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { HybridHighlighter as ComponentHighlighter } from './hybrid-highlighter';
|
|
2
|
+
export type { HybridHighlighterProps as ComponentHighlightProps } from './hybrid-highlighter';
|
|
3
|
+
export { HoverHighlighter } from './hover-highlighter';
|
|
4
|
+
export type { HoverHighlighterProps } from './hover-highlighter';
|
|
5
|
+
export { ChildrenHighlighter } from './children-highlighter';
|
|
6
|
+
export type { ChildrenHighlighterProps } from './children-highlighter';
|
|
7
|
+
export { ElementHighlighter } from './element-highlighter';
|
|
8
|
+
export type { ElementHighlighterProps, Placement, HighlightClasses } from './element-highlighter';
|
|
9
|
+
export { ExcludeHighlighter, excludeHighlighterAtt, excludeHighlighterAttrName, skipHighlighterAttr, skipHighlighterAttrName, } from './ignore-highlighter';
|
|
10
|
+
export type { MatchRule } from './rule-matcher';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skipHighlighterAttrName = exports.skipHighlighterAttr = exports.excludeHighlighterAttrName = exports.excludeHighlighterAtt = exports.ExcludeHighlighter = exports.ElementHighlighter = exports.ChildrenHighlighter = exports.HoverHighlighter = exports.ComponentHighlighter = void 0;
|
|
4
|
+
var hybrid_highlighter_1 = require("./hybrid-highlighter");
|
|
5
|
+
Object.defineProperty(exports, "ComponentHighlighter", { enumerable: true, get: function () { return hybrid_highlighter_1.HybridHighlighter; } });
|
|
6
|
+
var hover_highlighter_1 = require("./hover-highlighter");
|
|
7
|
+
Object.defineProperty(exports, "HoverHighlighter", { enumerable: true, get: function () { return hover_highlighter_1.HoverHighlighter; } });
|
|
8
|
+
var children_highlighter_1 = require("./children-highlighter");
|
|
9
|
+
Object.defineProperty(exports, "ChildrenHighlighter", { enumerable: true, get: function () { return children_highlighter_1.ChildrenHighlighter; } });
|
|
10
|
+
var element_highlighter_1 = require("./element-highlighter");
|
|
11
|
+
Object.defineProperty(exports, "ElementHighlighter", { enumerable: true, get: function () { return element_highlighter_1.ElementHighlighter; } });
|
|
12
|
+
var ignore_highlighter_1 = require("./ignore-highlighter");
|
|
13
|
+
Object.defineProperty(exports, "ExcludeHighlighter", { enumerable: true, get: function () { return ignore_highlighter_1.ExcludeHighlighter; } });
|
|
14
|
+
Object.defineProperty(exports, "excludeHighlighterAtt", { enumerable: true, get: function () { return ignore_highlighter_1.excludeHighlighterAtt; } });
|
|
15
|
+
Object.defineProperty(exports, "excludeHighlighterAttrName", { enumerable: true, get: function () { return ignore_highlighter_1.excludeHighlighterAttrName; } });
|
|
16
|
+
Object.defineProperty(exports, "skipHighlighterAttr", { enumerable: true, get: function () { return ignore_highlighter_1.skipHighlighterAttr; } });
|
|
17
|
+
Object.defineProperty(exports, "skipHighlighterAttrName", { enumerable: true, get: function () { return ignore_highlighter_1.skipHighlighterAttrName; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,2DAAiF;AAAxE,0HAAA,iBAAiB,OAAwB;AAGlD,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAGzB,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAG5B,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAG3B,2DAM8B;AAL5B,wHAAA,kBAAkB,OAAA;AAClB,2HAAA,qBAAqB,OAAA;AACrB,gIAAA,0BAA0B,OAAA;AAC1B,yHAAA,mBAAmB,OAAA;AACnB,6HAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.ComponentStripPreview = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const component_strip_1 = require("./component-strip");
|
|
9
|
+
const mock_component_1 = require("../mock-component");
|
|
10
|
+
const ComponentStripPreview = () => {
|
|
11
|
+
return (react_1.default.createElement("div", { style: { fontFamily: 'sans-serif', padding: 8 } },
|
|
12
|
+
react_1.default.createElement(component_strip_1.ComponentStrip, { component: mock_component_1.MockSnap }),
|
|
13
|
+
react_1.default.createElement("br", null),
|
|
14
|
+
react_1.default.createElement(component_strip_1.ComponentStrip, { component: mock_component_1.MockButton })));
|
|
15
|
+
};
|
|
16
|
+
exports.ComponentStripPreview = ComponentStripPreview;
|
|
17
|
+
//# sourceMappingURL=component-strip.compositions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-strip.compositions.js","sourceRoot":"","sources":["../../label/component-strip.compositions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uDAAmD;AACnD,sDAAyD;AAElD,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,OAAO,CACL,uCAAK,KAAK,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE;QAClD,8BAAC,gCAAc,IAAC,SAAS,EAAE,yBAAQ,GAAI;QACvC,yCAAM;QACN,8BAAC,gCAAc,IAAC,SAAS,EAAE,2BAAU,GAAI,CACrC,CACP,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
+
interface ComponentStripProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
component: ComponentMetaHolder | string;
|
|
5
|
+
}
|
|
6
|
+
export declare const ComponentStrip: React.ForwardRefExoticComponent<ComponentStripProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ComponentStrip = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const base_ui_routing_native_link_1 = require("@teambit/base-ui.routing.native-link");
|
|
32
|
+
const component_id_1 = require("@teambit/component-id");
|
|
33
|
+
const component_modules_component_url_1 = require("@teambit/component.modules.component-url");
|
|
34
|
+
const react_ui_highlighter_component_metadata_bit_component_meta_1 = require("@teambit/react.ui.highlighter.component-metadata.bit-component-meta");
|
|
35
|
+
const component_strip_module_scss_1 = __importDefault(require("./component-strip.module.scss"));
|
|
36
|
+
const links_1 = require("./links");
|
|
37
|
+
exports.ComponentStrip = (0, react_1.forwardRef)(function ComponentStrip({ component, children }, ref) {
|
|
38
|
+
const { id, homepage, exported } = extractMetadata(component);
|
|
39
|
+
const parsedId = (0, react_1.useMemo)(() => component_id_1.ComponentID.tryFromString(id), [id]);
|
|
40
|
+
const componentLink = homepage || (0, links_1.calcComponentLink)(parsedId, exported);
|
|
41
|
+
return (react_1.default.createElement("div", { className: component_strip_module_scss_1.default.componentStrip, ref: ref },
|
|
42
|
+
!parsedId && react_1.default.createElement(LabelBlock, { link: homepage }, id),
|
|
43
|
+
parsedId && react_1.default.createElement(LabelBlock, { link: component_modules_component_url_1.ScopeUrl.toUrl(parsedId.scope) }, parsedId.scope),
|
|
44
|
+
parsedId && (react_1.default.createElement(LabelBlock, { link: componentLink, className: component_strip_module_scss_1.default.nameBlock },
|
|
45
|
+
react_1.default.createElement("span", null, parsedId.fullName),
|
|
46
|
+
parsedId.version && parsedId.version !== 'latest' && (react_1.default.createElement("span", { className: component_strip_module_scss_1.default.version },
|
|
47
|
+
"@",
|
|
48
|
+
parsedId.version)))),
|
|
49
|
+
children));
|
|
50
|
+
});
|
|
51
|
+
function LabelBlock({ link, children, className }) {
|
|
52
|
+
const Comp = link ? base_ui_routing_native_link_1.NativeLink : 'span';
|
|
53
|
+
return (react_1.default.createElement(Comp, { href: link, external: !!link, className: className }, children));
|
|
54
|
+
}
|
|
55
|
+
function extractMetadata(metadata) {
|
|
56
|
+
if (typeof metadata === 'string') {
|
|
57
|
+
return { id: metadata, exported: true };
|
|
58
|
+
}
|
|
59
|
+
return metadata[react_ui_highlighter_component_metadata_bit_component_meta_1.componentMetaField];
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=component-strip.js.map
|
|
@@ -0,0 +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,oJAI6E;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,eAAe,CAAC,SAAS,CAAC,CAAC;IAE9D,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,QAAQ,IAAI,IAAA,yBAAiB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAExE,OAAO,CACL,uCAAK,SAAS,EAAE,qCAAM,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG;QAC5C,CAAC,QAAQ,IAAI,8BAAC,UAAU,IAAC,IAAI,EAAE,QAAQ,IAAG,EAAE,CAAc;QAC1D,QAAQ,IAAI,8BAAC,UAAU,IAAC,IAAI,EAAE,0CAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAG,QAAQ,CAAC,KAAK,CAAc;QAC3F,QAAQ,IAAI,CACX,8BAAC,UAAU,IAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,qCAAM,CAAC,SAAS;YAC1D,4CAAO,QAAQ,CAAC,QAAQ,CAAQ;YAC/B,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,KAAK,QAAQ,IAAI,CACpD,wCAAM,SAAS,EAAE,qCAAM,CAAC,OAAO;;gBAAI,QAAQ,CAAC,OAAO,CAAQ,CAC5D,CACU,CACd;QACA,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAA8D;IAC3G,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,wCAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,CACL,8BAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,IACrD,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAsC;IAC7D,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,QAAQ,CAAC,+EAAkB,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
$borderRadius: 0.5em;
|
|
2
|
+
$gap: 0.125em;
|
|
3
|
+
|
|
4
|
+
.componentStrip {
|
|
5
|
+
display: flex;
|
|
6
|
+
width: fit-content; // for correct shadow size
|
|
7
|
+
|
|
8
|
+
border-radius: $borderRadius;
|
|
9
|
+
box-shadow: var(--bit-highlighter-shadow);
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
|
|
12
|
+
> * {
|
|
13
|
+
padding: 0 0.5em;
|
|
14
|
+
line-height: 1.5; //use line height to get rounder values than 0.25em padding
|
|
15
|
+
|
|
16
|
+
transition: filter 300ms, background-color 300ms;
|
|
17
|
+
transform: translateZ(0); //fix blurriness in Safari
|
|
18
|
+
|
|
19
|
+
background: var(--bit-highlighter-color, #eebcc9);
|
|
20
|
+
|
|
21
|
+
margin-right: $gap;
|
|
22
|
+
|
|
23
|
+
&:link,
|
|
24
|
+
&:visited {
|
|
25
|
+
text-decoration: inherit; // reset browser defaults
|
|
26
|
+
color: inherit; // reset browser defaults
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
background: var(--bit-highlighter-color-hover, #f6dae2);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:active {
|
|
33
|
+
background: var(--bit-highlighter-color-active, #e79db1);
|
|
34
|
+
color: inherit;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&:first-child {
|
|
39
|
+
border-top-left-radius: $borderRadius;
|
|
40
|
+
border-bottom-left-radius: $borderRadius;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:last-child {
|
|
44
|
+
border-top-right-radius: $borderRadius;
|
|
45
|
+
border-bottom-right-radius: $borderRadius;
|
|
46
|
+
|
|
47
|
+
margin-right: unset;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.nameBlock {
|
|
53
|
+
display: flex;
|
|
54
|
+
|
|
55
|
+
.version {
|
|
56
|
+
// leave room for 9 digits + 3 "."
|
|
57
|
+
max-width: 13ch;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
|
|
62
|
+
transition: max-width 480ms;
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
max-width: 61ch;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelContainer = exports.Label = void 0;
|
|
4
|
+
var label_1 = require("./label");
|
|
5
|
+
Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return label_1.Label; } });
|
|
6
|
+
var label_container_1 = require("./label-container");
|
|
7
|
+
Object.defineProperty(exports, "LabelContainer", { enumerable: true, get: function () { return label_container_1.LabelContainer; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../label/index.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AAGd,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
|
+
import type { Placement } from '@floating-ui/react-dom';
|
|
3
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useEffect;
|
|
4
|
+
export interface LabelContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
targetRef: RefObject<HTMLElement | null>;
|
|
6
|
+
offset?: [number, number];
|
|
7
|
+
placement?: Placement;
|
|
8
|
+
flip?: boolean;
|
|
9
|
+
/** continually update label position to match moving elements */
|
|
10
|
+
watchMotion?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type { Placement };
|
|
13
|
+
export declare function LabelContainer({ targetRef, offset, placement, flip, watchMotion, className, style, ...rest }: LabelContainerProps): React.JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.useIsomorphicLayoutEffect = void 0;
|
|
41
|
+
exports.LabelContainer = LabelContainer;
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
44
|
+
const lodash_compact_1 = __importDefault(require("lodash.compact"));
|
|
45
|
+
const react_dom_1 = require("@floating-ui/react-dom");
|
|
46
|
+
const label_module_scss_1 = __importDefault(require("./label.module.scss"));
|
|
47
|
+
const HAS_RESIZE_OBSERVER = typeof window !== 'undefined' && !!window.ResizeObserver;
|
|
48
|
+
exports.useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
|
|
49
|
+
function LabelContainer(_a) {
|
|
50
|
+
var _b;
|
|
51
|
+
var { targetRef, offset, placement, flip = true, watchMotion, className, style } = _a, rest = __rest(_a, ["targetRef", "offset", "placement", "flip", "watchMotion", "className", "style"]);
|
|
52
|
+
const { x, y, strategy, floating, reference, refs, update, middlewareData } = (0, react_dom_1.useFloating)({
|
|
53
|
+
placement,
|
|
54
|
+
middleware: (0, lodash_compact_1.default)([
|
|
55
|
+
offset && (0, react_dom_1.offset)({ mainAxis: offset[0], crossAxis: offset[1] }),
|
|
56
|
+
flip && (0, react_dom_1.flip)(),
|
|
57
|
+
// enabling 'shift' for 'crossAxis' will make floating-ui push the label _inside_, when it has nowhere to go
|
|
58
|
+
(0, react_dom_1.shift)({ rootBoundary: 'document', mainAxis: true, crossAxis: true }),
|
|
59
|
+
(0, react_dom_1.hide)({ strategy: 'referenceHidden' }),
|
|
60
|
+
]),
|
|
61
|
+
});
|
|
62
|
+
(0, exports.useIsomorphicLayoutEffect)(() => {
|
|
63
|
+
reference(targetRef.current);
|
|
64
|
+
}, [targetRef.current, reference]);
|
|
65
|
+
// automatically update on scroll, resize, etc.
|
|
66
|
+
// `watchMotion` will trigger continuous updates using animation frame
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
68
|
+
if (!refs.reference.current || !refs.floating.current || !HAS_RESIZE_OBSERVER)
|
|
69
|
+
return () => { };
|
|
70
|
+
return (0, react_dom_1.autoUpdate)(refs.reference.current, refs.floating.current, update, { animationFrame: !!watchMotion });
|
|
71
|
+
}, [refs.reference.current, refs.floating.current, update, watchMotion]);
|
|
72
|
+
const isReady = !((_b = middlewareData.hide) === null || _b === void 0 ? void 0 : _b.referenceHidden);
|
|
73
|
+
return (react_1.default.createElement("div", Object.assign({}, rest, { ref: floating, className: (0, classnames_1.default)(className, !isReady && label_module_scss_1.default.hidden),
|
|
74
|
+
// starting at pos [0,0] will ensure the label doesn't increase the document size.
|
|
75
|
+
style: Object.assign(Object.assign({}, style), { position: strategy, top: y !== null && y !== void 0 ? y : 0, left: x !== null && x !== void 0 ? x : 0 }) })));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=label-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-container.js","sourceRoot":"","sources":["../../label/label-container.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,wCA4CC;AAzED,+CAAqE;AACrE,4DAAoC;AACpC,oEAAqC;AACrC,sDAOgC;AAEhC,4EAAyC;AAEzC,MAAM,mBAAmB,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;AACxE,QAAA,yBAAyB,GACpC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,uBAAe,CAAC,CAAC,CAAC,iBAAS,CAAA;AAa7D,SAAgB,cAAc,CAAC,EAST;;QATS,EAC7B,SAAS,EACT,MAAM,EACN,SAAS,EACT,IAAI,GAAG,IAAI,EACX,WAAW,EACX,SAAS,EACT,KAAK,OAEe,EADjB,IAAI,cARsB,iFAS9B,CADQ;IAEP,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,uBAAW,EAAC;QACxF,SAAS;QACT,UAAU,EAAE,IAAA,wBAAO,EAAC;YAClB,MAAM,IAAI,IAAA,kBAAgB,EAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,IAAI,IAAI,IAAA,gBAAc,GAAE;YACxB,4GAA4G;YAC5G,IAAA,iBAAK,EAAC,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YACpE,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;SACtC,CAAC;KACH,CAAC,CAAC;IAEH,IAAA,iCAAyB,EAAC,GAAG,EAAE;QAC7B,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnC,+CAA+C;IAC/C,sEAAsE;IACtE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,mBAAmB;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAE/F,OAAO,IAAA,sBAAU,EAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9G,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,CAAC,CAAA,MAAA,cAAc,CAAC,IAAI,0CAAE,eAAe,CAAA,CAAC;IAEtD,OAAO,CACL,uDACM,IAAI,IACR,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,CAAC,OAAO,IAAI,2BAAM,CAAC,MAAM,CAAC;QAC3D,kFAAkF;QAClF,KAAK,kCAAO,KAAK,KAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,aAAD,CAAC,cAAD,CAAC,GAAI,CAAC,EAAE,IAAI,EAAE,CAAC,aAAD,CAAC,cAAD,CAAC,GAAI,CAAC,OAChE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
+
export interface LabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
components: (ComponentMetaHolder | string)[];
|
|
5
|
+
}
|
|
6
|
+
export declare function Label({ components, ...props }: LabelProps): React.JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.Label = Label;
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
43
|
+
const label_module_scss_1 = __importDefault(require("./label.module.scss"));
|
|
44
|
+
const component_strip_1 = require("./component-strip");
|
|
45
|
+
const other_components_1 = require("./other-components");
|
|
46
|
+
function Label(_a) {
|
|
47
|
+
var { components } = _a, props = __rest(_a, ["components"]);
|
|
48
|
+
const [showMore, setShowMore] = (0, react_1.useState)(false);
|
|
49
|
+
const last = components.slice(-1).pop();
|
|
50
|
+
if (!last)
|
|
51
|
+
return null;
|
|
52
|
+
const hasMore = components.length > 1;
|
|
53
|
+
// reset when switching targets
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
setShowMore(false);
|
|
56
|
+
}, [components]);
|
|
57
|
+
return (react_1.default.createElement(other_components_1.OtherComponentsPopper, { components: components, visible: showMore, placement: "bottom-start" },
|
|
58
|
+
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) })))));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../label/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,sBAwBC;AApCD,+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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.othersContainer {
|
|
2
|
+
> * {
|
|
3
|
+
margin-bottom: 8px;
|
|
4
|
+
|
|
5
|
+
&:last-child {
|
|
6
|
+
margin-bottom: unset;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.othersTooltip {
|
|
12
|
+
user-select: none;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
|
|
15
|
+
&::before {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
transition: transform 300ms;
|
|
18
|
+
content: '▾';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.active::before {
|
|
22
|
+
transform: rotate(-180deg);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.hidden {
|
|
27
|
+
// label size is needed for position calculations,
|
|
28
|
+
// so it can't be removed by `display: none`
|
|
29
|
+
visibility: hidden;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
user-select: none;
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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.calcComponentLink = calcComponentLink;
|
|
7
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
8
|
+
const component_modules_component_url_1 = require("@teambit/component.modules.component-url");
|
|
9
|
+
function calcComponentLink(id, exported) {
|
|
10
|
+
if (!id)
|
|
11
|
+
return undefined;
|
|
12
|
+
if (exported)
|
|
13
|
+
return component_modules_component_url_1.ComponentUrl.toUrl(id);
|
|
14
|
+
return (0, url_join_1.default)('/', id.fullName);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../label/links.tsx"],"names":[],"mappings":";;;;;AAIA,8CAIC;AARD,wDAA+B;AAE/B,8FAAwE;AAExE,SAAgB,iBAAiB,CAAC,EAA2B,EAAE,QAA6B;IAC1F,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1B,IAAI,QAAQ;QAAE,OAAO,8CAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5C,OAAO,IAAA,kBAAO,EAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TippyProps } from '@tippyjs/react/headless';
|
|
3
|
+
import { ComponentMetaHolder } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
4
|
+
export type OtherComponentsProps = {
|
|
5
|
+
components: (ComponentMetaHolder | string)[];
|
|
6
|
+
start?: number;
|
|
7
|
+
end?: number;
|
|
8
|
+
} & TippyProps;
|
|
9
|
+
export declare function OtherComponentsPopper({ components, children, start, end, placement, interactive, ...tippyProps }: OtherComponentsProps): React.JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
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.OtherComponentsPopper = OtherComponentsPopper;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const headless_1 = __importDefault(require("@tippyjs/react/headless"));
|
|
20
|
+
const component_strip_1 = require("./component-strip");
|
|
21
|
+
const label_module_scss_1 = __importDefault(require("./label.module.scss"));
|
|
22
|
+
// a popper ("tooltip") that shows the additional React Components related to this dom element
|
|
23
|
+
function OtherComponentsPopper(_a) {
|
|
24
|
+
var { components, children, start, end = -1, placement = 'bottom', interactive = true } = _a, tippyProps = __rest(_a, ["components", "children", "start", "end", "placement", "interactive"]);
|
|
25
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null, components
|
|
26
|
+
.slice(start, end)
|
|
27
|
+
.reverse()
|
|
28
|
+
.map((comp, idx) => (react_1.default.createElement(component_strip_1.ComponentStrip, { key: idx, component: comp })))));
|
|
29
|
+
return (react_1.default.createElement(headless_1.default, Object.assign({ placement: placement, interactive: interactive }, tippyProps, {
|
|
30
|
+
// second parameter "content" is always undefined, use content inline
|
|
31
|
+
// https://github.com/atomiks/tippyjs-react/issues/341
|
|
32
|
+
render: (attrs) => (react_1.default.createElement("div", Object.assign({}, attrs, { className: label_module_scss_1.default.othersContainer }), content)) }), children));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=other-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"other-components.js","sourceRoot":"","sources":["../../label/other-components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcA,sDAoCC;AAlDD,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
|
+
import { ComponentMeta } from '@teambit/react.ui.highlighter.component-metadata.bit-component-meta';
|
|
3
|
+
export declare function MockTarget({ children, ...rest }: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
4
|
+
export declare namespace MockTarget {
|
|
5
|
+
var __bit_component: ComponentMeta;
|
|
6
|
+
}
|
|
7
|
+
export declare function MockButton({ children, ...rest }: ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
8
|
+
export declare namespace MockButton {
|
|
9
|
+
var __bit_component: ComponentMeta;
|
|
10
|
+
}
|
|
11
|
+
export declare function MockSnap({ children, ...rest }: ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
12
|
+
export declare namespace MockSnap {
|
|
13
|
+
var __bit_component: ComponentMeta;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.MockTarget = MockTarget;
|
|
18
|
+
exports.MockButton = MockButton;
|
|
19
|
+
exports.MockSnap = MockSnap;
|
|
20
|
+
const react_1 = __importDefault(require("react"));
|
|
21
|
+
const react_ui_highlighter_component_metadata_bit_component_meta_1 = require("@teambit/react.ui.highlighter.component-metadata.bit-component-meta");
|
|
22
|
+
function MockTarget(_a) {
|
|
23
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
24
|
+
return react_1.default.createElement("div", Object.assign({}, rest), children);
|
|
25
|
+
}
|
|
26
|
+
MockTarget[react_ui_highlighter_component_metadata_bit_component_meta_1.componentMetaField] = {
|
|
27
|
+
id: 'teambit.design/ui/mock-target@1.6.2',
|
|
28
|
+
};
|
|
29
|
+
function MockButton(_a) {
|
|
30
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
31
|
+
return react_1.default.createElement("button", Object.assign({}, rest), children);
|
|
32
|
+
}
|
|
33
|
+
MockButton[react_ui_highlighter_component_metadata_bit_component_meta_1.componentMetaField] = {
|
|
34
|
+
id: 'teambit.design/ui/icon-button@1.6.2',
|
|
35
|
+
};
|
|
36
|
+
function MockSnap(_a) {
|
|
37
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
38
|
+
return react_1.default.createElement("button", Object.assign({}, rest), children);
|
|
39
|
+
}
|
|
40
|
+
MockSnap[react_ui_highlighter_component_metadata_bit_component_meta_1.componentMetaField] = {
|
|
41
|
+
id: 'teambit.design/ui/icon-button@a21594d5cc63fd24d2b4763fa7d817b131f0edbb',
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=mock-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-component.js","sourceRoot":"","sources":["../mock-component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,gCAEC;AAKD,gCAEC;AAKD,4BAEC;AAnBD,kDAAoE;AACpE,oJAAwH;AAExH,SAAgB,UAAU,CAAC,EAAqD;QAArD,EAAE,QAAQ,OAA2C,EAAtC,IAAI,cAAnB,YAAqB,CAAF;IAC5C,OAAO,uDAAS,IAAI,GAAG,QAAQ,CAAO,CAAC;AACzC,CAAC;AACD,UAAU,CAAC,+EAAkB,CAAC,GAAG;IAC/B,EAAE,EAAE,qCAAqC;CACzB,CAAC;AAEnB,SAAgB,UAAU,CAAC,EAA8D;QAA9D,EAAE,QAAQ,OAAoD,EAA/C,IAAI,cAAnB,YAAqB,CAAF;IAC5C,OAAO,0DAAY,IAAI,GAAG,QAAQ,CAAU,CAAC;AAC/C,CAAC;AACD,UAAU,CAAC,+EAAkB,CAAC,GAAG;IAC/B,EAAE,EAAE,qCAAqC;CACzB,CAAC;AAEnB,SAAgB,QAAQ,CAAC,EAA8D;QAA9D,EAAE,QAAQ,OAAoD,EAA/C,IAAI,cAAnB,YAAqB,CAAF;IAC1C,OAAO,0DAAY,IAAI,GAAG,QAAQ,CAAU,CAAC;AAC/C,CAAC;AACD,QAAQ,CAAC,+EAAkB,CAAC,GAAG;IAC7B,EAAE,EAAE,wEAAwE;CAC5D,CAAC"}
|