@appquality/unguess-design-system 3.1.102 → 3.1.103

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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # v3.1.103 (Fri Jun 28 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - release 20240628 [#399](https://github.com/AppQuality/unguess-design-system/pull/399) ([@iDome89](https://github.com/iDome89) [@marcbon](https://github.com/marcbon))
6
+ - fix words in obs [#398](https://github.com/AppQuality/unguess-design-system/pull/398) ([@iDome89](https://github.com/iDome89))
7
+ - Add highlited observations fix [#397](https://github.com/AppQuality/unguess-design-system/pull/397) ([@iDome89](https://github.com/iDome89))
8
+
9
+ #### Authors: 2
10
+
11
+ - [@iDome89](https://github.com/iDome89)
12
+ - Marco Bonomo ([@marcbon](https://github.com/marcbon))
13
+
14
+ ---
15
+
1
16
  # v3.1.102 (Fri Jun 21 2024)
2
17
 
3
18
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -4072,6 +4072,7 @@ const Rect = styled.styled.div `
4072
4072
  }
4073
4073
 
4074
4074
  ${({ isActive }) => isActive && activeBookMark}
4075
+ ${({ isFocused }) => isFocused && activeBookMark}
4075
4076
  `;
4076
4077
  const StyledTooltip$1 = styled.styled(Tooltip) `
4077
4078
  margin-bottom: ${({ theme }) => theme.space.sm};
@@ -4103,7 +4104,7 @@ const Bookmark = (props) => {
4103
4104
  }
4104
4105
  if (start > videoEnd || start < videoStart)
4105
4106
  return null;
4106
- return (jsxRuntime.jsx(StyledTooltip$1, Object.assign({ content: tooltipContent, type: "light", size: "large", isTransparent: true }, { children: jsxRuntime.jsxs(Rect, Object.assign({ isActive: activeBookmark && activeBookmark.id === props.id, hue: hue, style: {
4107
+ return (jsxRuntime.jsx(StyledTooltip$1, Object.assign({ content: tooltipContent, type: "light", size: "large", isTransparent: true }, { children: jsxRuntime.jsxs(Rect, Object.assign({ isActive: activeBookmark && activeBookmark.id === props.id, hue: hue, isFocused: props.isFocused, style: {
4107
4108
  left: `${((start - videoStart) / duration) * 100}%`,
4108
4109
  width: `${((end - start) / duration) * 100}%`,
4109
4110
  }, onClick: props.onClick }, { children: [jsxRuntime.jsx(Grabber, { observation: props }), jsxRuntime.jsx(Grabber, { isEnd: true, observation: props })] })) })));
@@ -5678,6 +5679,9 @@ const CreateObservationButton = styled.styled(Button) `
5678
5679
  z-index: ${({ theme }) => theme.levels.front};
5679
5680
  `;
5680
5681
 
5682
+ const getFocusedObs = (observations) => {
5683
+ return observations.find((obs) => obs.isFocused);
5684
+ };
5681
5685
  const StyledWord = styled__default["default"].div `
5682
5686
  display: inline-block;
5683
5687
  font-size: ${({ theme, size }) => theme.fontSizes[size !== null && size !== void 0 ? size : "md"]};
@@ -5688,13 +5692,16 @@ const StyledWord = styled__default["default"].div `
5688
5692
 
5689
5693
  ${({ observations, theme }) => {
5690
5694
  var _a;
5691
- return observations && observations.length > 0 &&
5695
+ return observations &&
5696
+ observations.length > 0 &&
5692
5697
  `
5693
5698
  color: ${(_a = observations[observations.length - 1].color) !== null && _a !== void 0 ? _a : theme.palette.grey[600]};
5694
5699
  box-sizing: border-box;
5695
- font-weight: ${theme.fontWeights.semibold};
5700
+ font-weight: ${getFocusedObs(observations)
5701
+ ? theme.fontWeights.extrabold
5702
+ : theme.fontWeights.semibold};
5703
+ font-style: ${getFocusedObs(observations) ? "italic" : "normal"};
5696
5704
  z-index: 1;
5697
-
5698
5705
  &:focus {
5699
5706
  outline: none;
5700
5707
  }
@@ -5768,9 +5775,7 @@ const Highlight = (props) => {
5768
5775
  const range = activeSelection.getRangeAt(0);
5769
5776
  const rects = range.getClientRects();
5770
5777
  const lastRect = rects[rects.length - 1];
5771
- const containerRect = ref && ref.current
5772
- ? ref.current.getBoundingClientRect()
5773
- : null;
5778
+ const containerRect = ref && ref.current ? ref.current.getBoundingClientRect() : null;
5774
5779
  if (!lastRect || !containerRect)
5775
5780
  return;
5776
5781
  const relativeY = lastRect.bottom - containerRect.top + ref.current.scrollTop;
@@ -5819,12 +5824,14 @@ const Word = (props) => {
5819
5824
  // Are there any observations containing this word?
5820
5825
  const foundObservations = React.useMemo(() => {
5821
5826
  var _a, _b;
5822
- return (_b = (_a = props.observations) === null || _a === void 0 ? void 0 : _a.filter((obs) => props.start >= obs.start && props.end <= obs.end)) !== null && _b !== void 0 ? _b : [];
5827
+ return (_b = (_a = props.observations) === null || _a === void 0 ? void 0 : _a.filter((obs) => Number(props.start.toFixed(8)) >= Number(obs.start.toFixed(8)) &&
5828
+ Number(props.end.toFixed(8)) <= Number(obs.end.toFixed(8)))) !== null && _b !== void 0 ? _b : [];
5823
5829
  }, [props.observations, props.start, props.end]);
5824
- const ObsWord = React.useMemo(() => (jsxRuntime.jsxs(StyledWord, Object.assign({}, props, { "data-start": props.start, "data-end": props.end, className: foundObservations.length > 0 ? "highlighted" : "" }, (foundObservations && { observations: foundObservations }), { children: [foundObservations.length > 0 && foundObservations.map((obs) => {
5825
- var _a;
5826
- return (jsxRuntime.jsx(Layer, { color: (_a = obs.hue) !== null && _a !== void 0 ? _a : theme.palette.grey[600] }, obs.id));
5827
- }), isActive ? (jsxRuntime.jsx(ActiveWord, Object.assign({ "data-start": props.start, "data-end": props.end }, { children: jsxRuntime.jsx(Searchable, { text: props.text }) }))) : (jsxRuntime.jsx(Searchable, { text: props.text })), " "] }))), [props, foundObservations, isActive]);
5830
+ const ObsWord = React.useMemo(() => (jsxRuntime.jsxs(StyledWord, Object.assign({}, props, { "data-start": props.start, "data-end": props.end, className: foundObservations.length > 0 ? "highlighted" : "" }, (foundObservations && { observations: foundObservations }), { children: [foundObservations.length > 0 &&
5831
+ foundObservations.map((obs) => {
5832
+ var _a;
5833
+ return (jsxRuntime.jsx(Layer, { color: (_a = obs.hue) !== null && _a !== void 0 ? _a : theme.palette.grey[600] }, obs.id));
5834
+ }), isActive ? (jsxRuntime.jsx(ActiveWord, Object.assign({ "data-start": props.start, "data-end": props.end }, { children: jsxRuntime.jsx(Searchable, { text: props.text }) }))) : (jsxRuntime.jsx(Searchable, { text: props.text })), " "] }))), [props, foundObservations, isActive]);
5828
5835
  if (props.tooltipContent !== undefined && foundObservations.length > 0) {
5829
5836
  return (jsxRuntime.jsx(Tooltip, Object.assign({ content: props.tooltipContent(foundObservations), isTransparent: true }, { children: ObsWord })));
5830
5837
  }
@@ -22,6 +22,7 @@ export interface IBookmark {
22
22
  hue?: string;
23
23
  label?: string;
24
24
  tooltipContent?: ReactNode;
25
+ isFocused?: boolean;
25
26
  onClick?: () => void;
26
27
  tags?: VideoTag[];
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "3.1.102",
3
+ "version": "3.1.103",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",