@loomhq/lens 10.87.1 → 10.89.0

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.
@@ -167,6 +167,7 @@ export { default as SvgStar } from "./star.js";
167
167
  export { default as SvgStarOutline } from "./star-outline.js";
168
168
  export { default as SvgStop } from "./stop.js";
169
169
  export { default as SvgTagFaces } from "./tag-faces.js";
170
+ export { default as SvgTask } from "./task.js";
170
171
  export { default as SvgTimer } from "./timer.js";
171
172
  export { default as SvgTouchApp } from "./touch-app.js";
172
173
  export { default as SvgTrash } from "./trash.js";
@@ -167,6 +167,7 @@ export { default as SvgStar } from './star.js';
167
167
  export { default as SvgStarOutline } from './star-outline.js';
168
168
  export { default as SvgStop } from './stop.js';
169
169
  export { default as SvgTagFaces } from './tag-faces.js';
170
+ export { default as SvgTask } from './task.js';
170
171
  export { default as SvgTimer } from './timer.js';
171
172
  export { default as SvgTouchApp } from './touch-app.js';
172
173
  export { default as SvgTrash } from './trash.js';
@@ -0,0 +1,2 @@
1
+ export default SvgTask;
2
+ declare function SvgTask(): JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ const SvgTask = () => (React.createElement("svg", { viewBox: "0 0 21 23", fill: "none" },
3
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10.5 20C15.7467 20 20 15.7467 20 10.5C20 5.25329 15.7467 1 10.5 1C5.25329 1 1 5.25329 1 10.5V20.6209C1 21.7814 2.44382 22.3155 3.19907 21.4344L5.59598 18.638C7.02754 19.5025 8.70568 20 10.5 20Z", fill: "var(--lns-color-grey8)" }),
4
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M21 10.5C21 16.299 16.299 21 10.5 21C8.82262 21 7.23509 20.606 5.82696 19.9051L3.95833 22.0852C2.59888 23.6712 0 22.7098 0 20.6209V10.5C0 4.70101 4.70101 0 10.5 0C16.299 0 21 4.70101 21 10.5ZM5.59598 18.638L3.19907 21.4344C2.44382 22.3155 1 21.7814 1 20.6209V10.5C1 5.25329 5.25329 1 10.5 1C15.7467 1 20 5.25329 20 10.5C20 15.7467 15.7467 20 10.5 20C8.70568 20 7.02754 19.5025 5.59598 18.638Z", fill: "white", fillOpacity: "0.65" }),
5
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.6186 7.09759C15.8471 7.32614 15.8471 7.69669 15.6186 7.92524L9.18096 14.3629C8.95241 14.5914 8.58186 14.5914 8.35331 14.3629L5.42712 11.4367C5.19857 11.2081 5.19857 10.8376 5.42712 10.609C5.65567 10.3805 6.02622 10.3805 6.25477 10.609L8.76714 13.1214L14.7909 7.09759C15.0195 6.86904 15.39 6.86904 15.6186 7.09759Z", fill: "var(--lns-color-grey8)" }),
6
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.76846 14.5343C8.76758 14.5343 8.7667 14.5343 8.76581 14.5343C8.61648 14.5339 8.46725 14.4768 8.35331 14.3629L5.42712 11.4367C5.19857 11.2081 5.19857 10.8376 5.42712 10.609C5.65567 10.3805 6.02622 10.3805 6.25477 10.609L8.76714 13.1214L14.7909 7.09759C15.0195 6.86904 15.39 6.86904 15.6186 7.09759C15.8471 7.32614 15.8471 7.69669 15.6186 7.92524L9.18096 14.3629M9.18096 14.3629C9.06703 14.4768 8.9178 14.5339 8.76846 14.5343Z", fill: "white" })));
7
+ export default SvgTask;
@@ -1,16 +1,18 @@
1
1
  import React from 'react';
2
2
  declare const ToastWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ToastWrapperProps, object>;
3
- declare const Toast: ({ children, isOpen, onCloseClick, zIndex, duration, }: ToastProps & React.ComponentProps<typeof ToastWrapper>) => JSX.Element;
3
+ declare const Toast: ({ children, isOpen, onCloseClick, zIndex, duration, platform, }: ToastProps & React.ComponentProps<typeof ToastWrapper>) => JSX.Element;
4
4
  declare type ToastProps = {
5
5
  children?: React.ReactNode;
6
6
  isOpen?: boolean;
7
7
  onCloseClick?: () => void;
8
8
  zIndex?: number;
9
9
  duration?: 'short' | 'long';
10
+ platform: 'web-app' | 'chrome-extension';
10
11
  };
11
12
  declare type ToastWrapperProps = {
12
13
  zIndex?: number;
13
14
  isOpen?: boolean;
14
15
  toastDuration?: number;
16
+ platform: 'web-app' | 'chrome-extension';
15
17
  };
16
18
  export default Toast;
@@ -4,11 +4,13 @@ import IconButton from '../icon-button/icon-button';
4
4
  import { SvgClose } from '../icon/available-icons';
5
5
  import { keyframes } from '@emotion/core';
6
6
  import styled from '@emotion/styled';
7
+ const WEBAPP = 'web-app';
8
+ const CHROME_EXTENSION = 'chrome-extension';
7
9
  const toastDurations = { short: 3000, long: 8000 };
8
- const enter = toastDuration => keyframes `
10
+ const enter = (toastDuration, platform) => keyframes `
9
11
  0% {
10
12
  opacity: 0;
11
- transform: translate(-50%, ${u(8)});
13
+ transform: translate(-50%, ${u(platform === CHROME_EXTENSION ? -8 : 8)});
12
14
  }
13
15
  // (300 / toastDuration) * 100 evaluates to 10% for short. Longer durations will have the same speed of animation
14
16
  ${(300 / toastDuration) * 100}% {
@@ -23,12 +25,33 @@ const enter = toastDuration => keyframes `
23
25
  opacity: 0;
24
26
  }
25
27
  `;
28
+ const getTop = platform => {
29
+ switch (platform) {
30
+ case WEBAPP:
31
+ return 'unset';
32
+ case CHROME_EXTENSION:
33
+ return u(4);
34
+ default:
35
+ return 'unset';
36
+ }
37
+ };
38
+ const getBottom = platform => {
39
+ switch (platform) {
40
+ case WEBAPP:
41
+ return u(4);
42
+ case CHROME_EXTENSION:
43
+ return 'unset';
44
+ default:
45
+ return u(4);
46
+ }
47
+ };
26
48
  const ToastWrapper = styled.div `
27
- animation: ${props => enter(props.toastDuration)}
49
+ animation: ${props => enter(props.toastDuration, props.platform)}
28
50
  ${props => props.toastDuration}ms forwards;
29
51
  background-color: ${getColorValue('background')};
30
52
  border-radius: 1.75rem; // Height of single line toast (56px) divided by 2 so one line toasts appear fully rounded
31
- bottom: ${u(4)};
53
+ top: ${props => getTop(props.platform)};
54
+ bottom: ${props => getBottom(props.platform)};
32
55
  ${getShadow('large')};
33
56
  color: ${getColorValue('body')};
34
57
  display: grid;
@@ -47,7 +70,7 @@ const ToastWrapper = styled.div `
47
70
  const ChildrenSection = styled.div `
48
71
  align-self: center;
49
72
  `;
50
- const Toast = ({ children, isOpen, onCloseClick, zIndex = 1100, duration = 'short', }) => {
73
+ const Toast = ({ children, isOpen, onCloseClick, zIndex = 1100, duration = 'short', platform = 'web-app', }) => {
51
74
  const toastDuration = toastDurations[duration];
52
75
  useEffect(() => {
53
76
  const timer = setTimeout(() => {
@@ -57,7 +80,7 @@ const Toast = ({ children, isOpen, onCloseClick, zIndex = 1100, duration = 'shor
57
80
  }, toastDuration);
58
81
  return () => clearTimeout(timer);
59
82
  }, [isOpen]);
60
- return (React.createElement(React.Fragment, null, isOpen && (React.createElement(ToastWrapper, { "data-lens-theme": "dark", onClick: e => e.stopPropagation(), zIndex: zIndex, isOpen: isOpen, toastDuration: toastDuration },
83
+ return (React.createElement(React.Fragment, null, isOpen && (React.createElement(ToastWrapper, { "data-lens-theme": "dark", onClick: e => e.stopPropagation(), zIndex: zIndex, isOpen: isOpen, toastDuration: toastDuration, platform: platform },
61
84
  React.createElement(ChildrenSection, { "aria-live": "polite" }, children),
62
85
  onCloseClick && (React.createElement(IconButton, { altText: "Close", icon: React.createElement(SvgClose, null), onClick: onCloseClick }))))));
63
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.87.1",
3
+ "version": "10.89.0",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",