@teambit/react.ui.component-highlighter 0.0.493 → 0.0.497

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.
Files changed (86) hide show
  1. package/{multi-highlighter/multi-highlighter.composition.tsx → children-highlighter/children-highlighter.composition.tsx} +23 -19
  2. package/{multi-highlighter/multi-highlighter.spec.tsx → children-highlighter/children-highlighter.spec.tsx} +3 -3
  3. package/children-highlighter/children-highlighter.tsx +9 -0
  4. package/children-highlighter/index.ts +5 -0
  5. package/{multi-highlighter/use-multi-highlighter.tsx → children-highlighter/use-children-highlighter.tsx} +3 -3
  6. package/component-highlighter.docs.md +4 -3
  7. package/dist/children-highlighter/children-highlighter.composition.d.ts +5 -0
  8. package/dist/{multi-highlighter/multi-highlighter.composition.js → children-highlighter/children-highlighter.composition.js} +22 -20
  9. package/dist/children-highlighter/children-highlighter.composition.js.map +1 -0
  10. package/dist/children-highlighter/children-highlighter.d.ts +3 -0
  11. package/dist/{multi-highlighter/multi-highlighter.js → children-highlighter/children-highlighter.js} +6 -6
  12. package/dist/children-highlighter/children-highlighter.js.map +1 -0
  13. package/dist/{multi-highlighter/multi-highlighter.spec.d.ts → children-highlighter/children-highlighter.spec.d.ts} +0 -0
  14. package/dist/{multi-highlighter/multi-highlighter.spec.js → children-highlighter/children-highlighter.spec.js} +4 -4
  15. package/dist/children-highlighter/children-highlighter.spec.js.map +1 -0
  16. package/dist/children-highlighter/index.d.ts +4 -0
  17. package/dist/children-highlighter/index.js +8 -0
  18. package/dist/children-highlighter/index.js.map +1 -0
  19. package/dist/{multi-highlighter/use-multi-highlighter.d.ts → children-highlighter/use-children-highlighter.d.ts} +2 -3
  20. package/dist/{multi-highlighter/use-multi-highlighter.js → children-highlighter/use-children-highlighter.js} +4 -4
  21. package/dist/children-highlighter/use-children-highlighter.js.map +1 -0
  22. package/dist/component-highlighter.docs.md +4 -3
  23. package/dist/element-highlighter/element-highlighter.compositions.d.ts +1 -3
  24. package/dist/element-highlighter/element-highlighter.compositions.js +6 -6
  25. package/dist/element-highlighter/element-highlighter.compositions.js.map +1 -1
  26. package/dist/element-highlighter/element-highlighter.d.ts +2 -4
  27. package/dist/element-highlighter/element-highlighter.js +2 -2
  28. package/dist/element-highlighter/element-highlighter.js.map +1 -1
  29. package/dist/element-highlighter/element-highlighter.module.scss +2 -5
  30. package/dist/element-highlighter/index.d.ts +1 -1
  31. package/dist/hover-highlighter/hover-highlighter.compositions.js +1 -1
  32. package/dist/hover-highlighter/hover-highlighter.compositions.js.map +1 -1
  33. package/dist/hover-highlighter/hover-highlighter.d.ts +1 -1
  34. package/dist/hover-highlighter/hover-highlighter.js +2 -2
  35. package/dist/hover-highlighter/hover-highlighter.js.map +1 -1
  36. package/dist/{hybrid-highligher → hybrid-highlighter}/hybrid-highlighter.d.ts +2 -3
  37. package/dist/{hybrid-highligher → hybrid-highlighter}/hybrid-highlighter.js +4 -4
  38. package/dist/hybrid-highlighter/hybrid-highlighter.js.map +1 -0
  39. package/dist/{hybrid-highligher → hybrid-highlighter}/index.d.ts +0 -0
  40. package/dist/{hybrid-highligher → hybrid-highlighter}/index.js +0 -0
  41. package/dist/hybrid-highlighter/index.js.map +1 -0
  42. package/dist/index.d.ts +4 -4
  43. package/dist/index.js +5 -5
  44. package/dist/index.js.map +1 -1
  45. package/dist/label/component-strip.d.ts +0 -2
  46. package/dist/label/component-strip.js +2 -2
  47. package/dist/label/component-strip.js.map +1 -1
  48. package/dist/label/component-strip.module.scss +6 -21
  49. package/dist/label/index.d.ts +1 -1
  50. package/dist/label/label.d.ts +1 -4
  51. package/dist/label/label.js +3 -3
  52. package/dist/label/label.js.map +1 -1
  53. package/dist/label/other-components.d.ts +1 -3
  54. package/dist/label/other-components.js +2 -2
  55. package/dist/label/other-components.js.map +1 -1
  56. package/element-highlighter/element-highlighter.compositions.tsx +7 -10
  57. package/element-highlighter/element-highlighter.module.scss +2 -5
  58. package/element-highlighter/element-highlighter.tsx +2 -6
  59. package/element-highlighter/index.ts +1 -7
  60. package/hover-highlighter/hover-highlighter.compositions.tsx +1 -1
  61. package/hover-highlighter/hover-highlighter.tsx +1 -1
  62. package/{hybrid-highligher → hybrid-highlighter}/hybrid-highlighter.tsx +3 -12
  63. package/{hybrid-highligher → hybrid-highlighter}/index.ts +0 -0
  64. package/index.ts +4 -4
  65. package/label/component-strip.module.scss +6 -21
  66. package/label/component-strip.tsx +2 -5
  67. package/label/index.ts +1 -1
  68. package/label/label.tsx +4 -6
  69. package/label/other-components.tsx +2 -4
  70. package/package-tar/teambit-react.ui.component-highlighter-0.0.497.tgz +0 -0
  71. package/package.json +12 -12
  72. package/tsconfig.json +2 -1
  73. package/dist/hybrid-highligher/hybrid-highlighter.js.map +0 -1
  74. package/dist/hybrid-highligher/index.js.map +0 -1
  75. package/dist/multi-highlighter/index.d.ts +0 -2
  76. package/dist/multi-highlighter/index.js +0 -6
  77. package/dist/multi-highlighter/index.js.map +0 -1
  78. package/dist/multi-highlighter/multi-highlighter.composition.d.ts +0 -5
  79. package/dist/multi-highlighter/multi-highlighter.composition.js.map +0 -1
  80. package/dist/multi-highlighter/multi-highlighter.d.ts +0 -3
  81. package/dist/multi-highlighter/multi-highlighter.js.map +0 -1
  82. package/dist/multi-highlighter/multi-highlighter.spec.js.map +0 -1
  83. package/dist/multi-highlighter/use-multi-highlighter.js.map +0 -1
  84. package/multi-highlighter/index.ts +0 -2
  85. package/multi-highlighter/multi-highlighter.tsx +0 -9
  86. package/package-tar/teambit-react.ui.component-highlighter-0.0.493.tgz +0 -0
@@ -16,10 +16,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.HoverHighlighter = void 0;
18
18
  const react_1 = __importDefault(require("react"));
19
- const hybrid_highligher_1 = require("../hybrid-highligher");
19
+ const hybrid_highlighter_1 = require("../hybrid-highlighter");
20
20
  function HoverHighlighter(_a) {
21
21
  var props = __rest(_a, []);
22
- return react_1.default.createElement(hybrid_highligher_1.HybridHighlighter, Object.assign({}, props, { mode: 'hover' }));
22
+ return react_1.default.createElement(hybrid_highlighter_1.HybridHighlighter, Object.assign({}, props, { mode: 'hover' }));
23
23
  }
24
24
  exports.HoverHighlighter = HoverHighlighter;
25
25
  //# sourceMappingURL=hover-highlighter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hover-highlighter.js","sourceRoot":"","sources":["../../hover-highlighter/hover-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAiF;AAIjF,SAAgB,gBAAgB,CAAC,EAAmC;QAA9B,KAAK,cAAV,EAAY,CAAF;IACzC,OAAO,8BAAC,qCAAiB,oBAAK,KAAK,IAAE,IAAI,EAAE,OAAO,IAAI,CAAC;AACzD,CAAC;AAFD,4CAEC"}
1
+ {"version":3,"file":"hover-highlighter.js","sourceRoot":"","sources":["../../hover-highlighter/hover-highlighter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,8DAAkF;AAIlF,SAAgB,gBAAgB,CAAC,EAAmC;QAA9B,KAAK,cAAV,EAAY,CAAF;IACzC,OAAO,8BAAC,sCAAiB,oBAAK,KAAK,IAAE,IAAI,EAAE,OAAO,IAAI,CAAC;AACzD,CAAC;AAFD,4CAEC"}
@@ -1,5 +1,5 @@
1
1
  import React, { CSSProperties } from 'react';
2
- import { Placement, HighlightClasses, HighlighterSize } from '../element-highlighter';
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, size, children, ...rest }: HybridHighlighterProps): JSX.Element;
36
+ export declare function HybridHighlighter({ disabled, mode, debounceSelection, watchMotion, placement, rule, componentRule, classes, highlightStyle, className, style, bgColor, bgColorHover, bgColorActive, children, ...rest }: HybridHighlighterProps): JSX.Element;
@@ -39,10 +39,10 @@ const classnames_1 = __importDefault(require("classnames"));
39
39
  const uuid_1 = require("uuid");
40
40
  const hover_highlighter_1 = require("../hover-highlighter");
41
41
  const element_highlighter_1 = require("../element-highlighter");
42
- const use_multi_highlighter_1 = require("../multi-highlighter/use-multi-highlighter");
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, size, children } = _a, rest = __rest(_a, ["disabled", "mode", "debounceSelection", "watchMotion", "placement", "rule", "componentRule", "classes", "highlightStyle", "className", "style", "bgColor", "bgColorHover", "bgColorActive", "size", "children"]);
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;
@@ -59,7 +59,7 @@ function HybridHighlighter(_a) {
59
59
  rule,
60
60
  componentRule,
61
61
  });
62
- (0, use_multi_highlighter_1.useMultiHighlighter)({
62
+ (0, children_highlighter_1.useChildrenHighlighter)({
63
63
  onChange: setTarget,
64
64
  scopeRef: ref,
65
65
  scopeClass,
@@ -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, size: size })))));
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
@@ -0,0 +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,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,I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,CAAC;IAEF,OAAO,CACL,qDACE,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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../hybrid-highlighter/index.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { HybridHighlighter as ComponentHighlighter } from './hybrid-highligher';
2
- export type { HybridHighlighterProps as ComponentHighlightProps } from './hybrid-highligher';
1
+ export { HybridHighlighter as ComponentHighlighter } from './hybrid-highlighter';
2
+ export type { HybridHighlighterProps as ComponentHighlightProps } from './hybrid-highlighter';
3
3
  export { HoverHighlighter } from './hover-highlighter';
4
4
  export type { HoverHighlighterProps } from './hover-highlighter';
5
- export { MultiHighlighter } from './multi-highlighter';
6
- export type { MultiHighlighterProps } from './multi-highlighter';
5
+ export { ChildrenHighlighter } from './children-highlighter';
6
+ export type { ChildrenHighlighterProps } from './children-highlighter';
7
7
  export { ElementHighlighter } from './element-highlighter';
8
8
  export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses } from './element-highlighter';
9
9
  export { ExcludeHighlighter, excludeHighlighterAtt, excludeHighlighterSelector, excludeHighlighterAttrName, } from './ignore-highlighter';
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.excludeHighlighterAttrName = exports.excludeHighlighterSelector = exports.excludeHighlighterAtt = exports.ExcludeHighlighter = exports.ElementHighlighter = exports.MultiHighlighter = exports.HoverHighlighter = exports.ComponentHighlighter = void 0;
4
- var hybrid_highligher_1 = require("./hybrid-highligher");
5
- Object.defineProperty(exports, "ComponentHighlighter", { enumerable: true, get: function () { return hybrid_highligher_1.HybridHighlighter; } });
3
+ exports.excludeHighlighterAttrName = exports.excludeHighlighterSelector = 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
6
  var hover_highlighter_1 = require("./hover-highlighter");
7
7
  Object.defineProperty(exports, "HoverHighlighter", { enumerable: true, get: function () { return hover_highlighter_1.HoverHighlighter; } });
8
- var multi_highlighter_1 = require("./multi-highlighter");
9
- Object.defineProperty(exports, "MultiHighlighter", { enumerable: true, get: function () { return multi_highlighter_1.MultiHighlighter; } });
8
+ var children_highlighter_1 = require("./children-highlighter");
9
+ Object.defineProperty(exports, "ChildrenHighlighter", { enumerable: true, get: function () { return children_highlighter_1.ChildrenHighlighter; } });
10
10
  var element_highlighter_1 = require("./element-highlighter");
11
11
  Object.defineProperty(exports, "ElementHighlighter", { enumerable: true, get: function () { return element_highlighter_1.ElementHighlighter; } });
12
12
  var ignore_highlighter_1 = require("./ignore-highlighter");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yDAAgF;AAAvE,yHAAA,iBAAiB,OAAwB;AAGlD,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAGzB,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAGzB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAG3B,2DAK8B;AAJ5B,wHAAA,kBAAkB,OAAA;AAClB,2HAAA,qBAAqB,OAAA;AACrB,gIAAA,0BAA0B,OAAA;AAC1B,gIAAA,0BAA0B,OAAA"}
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,2DAK8B;AAJ5B,wHAAA,kBAAkB,OAAA;AAClB,2HAAA,qBAAqB,OAAA;AACrB,gIAAA,0BAA0B,OAAA;AAC1B,gIAAA,0BAA0B,OAAA"}
@@ -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, size = 'm', children }, ref) {
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, "data-size": size },
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;AAQ/B,QAAA,cAAc,GAAG,IAAA,kBAAU,EAAC,SAAS,cAAc,CAC9D,EAAE,SAAS,EAAE,IAAI,GAAG,GAAG,EAAE,QAAQ,EAAuB,EACxD,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,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,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AAA,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;YAC5B,QAAQ,CAAC,QAAQ;YACjB,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,KAAK,QAAQ,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,CACjE,CACd;QACA,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAA0C;IAC5E,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,IAC/B,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC"}
@@ -1,31 +1,16 @@
1
- $borderRadius: 8px;
2
- $gap: 2px;
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: 0px 11px 29px 0px rgba(0, 0, 0, 0.23);
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: 4px 8px;
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
@@ -1,4 +1,4 @@
1
1
  export { Label } from './label';
2
- export type { LabelProps, LabelSize } from './label';
2
+ export type { LabelProps } from './label';
3
3
  export { LabelContainer } from './label-container';
4
4
  export type { LabelContainerProps, Placement } from './label-container';
@@ -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, size, ...props }: LabelProps): JSX.Element;
6
+ export declare function Label({ components, ...props }: LabelProps): JSX.Element;
@@ -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, size } = _a, props = __rest(_a, ["components", "size"]);
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", size: size },
54
- react_1.default.createElement(component_strip_1.ComponentStrip, Object.assign({}, props, { component: last, size: size }), 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) })))));
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
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sourceRoot":"","sources":["../../label/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,4DAAoC;AAGpC,4EAAyC;AACzC,uDAAuE;AACvE,yDAA2D;AAQ3D,SAAgB,KAAK,CAAC,EAA0C;QAA1C,EAAE,UAAU,EAAE,IAAI,OAAwB,EAAnB,KAAK,cAA5B,sBAA8B,CAAF;IAChD,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,CAA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,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, size, placement, interactive, ...tippyProps }: OtherComponentsProps): JSX.Element;
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, size, placement = 'bottom', interactive = true } = _a, tippyProps = __rest(_a, ["components", "children", "start", "end", "size", "placement", "interactive"]);
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, size: size })))));
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,uDAAuE;AACvE,4EAAyC;AASzC,8FAA8F;AAC9F,SAAgB,qBAAqB,CAAC,EASf;QATe,EACpC,UAAU,EACV,QAAQ,EACR,KAAK,EACL,GAAG,GAAG,CAAC,CAAC,EACR,IAAI,EACJ,SAAS,GAAG,QAAQ,EACpB,WAAW,GAAG,IAAI,OAEG,EADlB,UAAU,cARuB,8EASrC,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,EAAE,IAAI,EAAE,IAAI,GAAI,CAC1D,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;AArCD,sDAqCC"}
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, HighlighterSize, HighlightTarget } from './element-highlighter';
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, size }: HighlightedElementProps) => {
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 size="s" />
60
- <HighlightedElement size="m" />
61
- <HighlightedElement size="l" />
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
- font-family: sans-serif;
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, LabelSize } from '../label';
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} size={size} />
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 />
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { HybridHighlighter, HybridHighlighterProps } from '../hybrid-highligher';
2
+ import { HybridHighlighter, HybridHighlighterProps } from '../hybrid-highlighter';
3
3
 
4
4
  export type HoverHighlighterProps = Omit<HybridHighlighterProps, 'mode'>;
5
5
 
@@ -3,14 +3,8 @@ 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';
13
- import { useMultiHighlighter } from '../multi-highlighter/use-multi-highlighter';
6
+ import { ElementHighlighter, HighlightTarget, Placement, HighlightClasses } from '../element-highlighter';
7
+ import { useChildrenHighlighter } from '../children-highlighter';
14
8
  import type { MatchRule, ComponentMatchRule } from '../rule-matcher';
15
9
 
16
10
  export interface HybridHighlighterProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -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) {
@@ -91,7 +83,7 @@ export function HybridHighlighter({
91
83
  }
92
84
  );
93
85
 
94
- useMultiHighlighter({
86
+ useChildrenHighlighter({
95
87
  onChange: setTarget,
96
88
  scopeRef: ref,
97
89
  scopeClass,
@@ -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>
package/index.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { HybridHighlighter as ComponentHighlighter } from './hybrid-highligher';
2
- export type { HybridHighlighterProps as ComponentHighlightProps } from './hybrid-highligher';
1
+ export { HybridHighlighter as ComponentHighlighter } from './hybrid-highlighter';
2
+ export type { HybridHighlighterProps as ComponentHighlightProps } from './hybrid-highlighter';
3
3
 
4
4
  export { HoverHighlighter } from './hover-highlighter';
5
5
  export type { HoverHighlighterProps } from './hover-highlighter';
6
6
 
7
- export { MultiHighlighter } from './multi-highlighter';
8
- export type { MultiHighlighterProps } from './multi-highlighter';
7
+ export { ChildrenHighlighter } from './children-highlighter';
8
+ export type { ChildrenHighlighterProps } from './children-highlighter';
9
9
 
10
10
  export { ElementHighlighter } from './element-highlighter';
11
11
  export type { ElementHighlighterProps, HighlightTarget, Placement, HighlightClasses } from './element-highlighter';
@@ -1,31 +1,16 @@
1
- $borderRadius: 8px;
2
- $gap: 2px;
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: 0px 11px 29px 0px rgba(0, 0, 0, 0.23);
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: 4px 8px;
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, size = 'm', children }: ComponentStripProps,
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} data-size={size}>
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
@@ -1,5 +1,5 @@
1
1
  export { Label } from './label';
2
- export type { LabelProps, LabelSize } from './label';
2
+ export type { LabelProps } from './label';
3
3
 
4
4
  export { LabelContainer } from './label-container';
5
5
  export type { LabelContainerProps, Placement } from './label-container';
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, ComponentStripSize } from './component-strip';
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, size, ...props }: LabelProps) {
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" size={size}>
29
- <ComponentStrip {...props} component={last} size={size}>
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, ComponentStripSize } from './component-strip';
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} size={size} />
30
+ <ComponentStrip key={idx} component={comp} />
33
31
  ))}
34
32
  </>
35
33
  );