@loomhq/lens 10.33.0 → 10.34.1

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.
@@ -1,16 +1,20 @@
1
1
  import React from 'react';
2
2
  declare const LinkWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, LinkWrapperProps, object>;
3
- declare const Link: ({ children, href, variant, ...props }: LinkProps & React.ComponentProps<typeof LinkWrapper>) => JSX.Element;
3
+ declare const Link: ({ children, href, variant, htmlTag, isDisabled, ...props }: LinkProps & React.ComponentProps<typeof LinkWrapper>) => JSX.Element;
4
4
  export declare const availableVariants: string[];
5
5
  declare type LinkProps = {
6
6
  children?: React.ReactNode;
7
7
  href?: string;
8
8
  variant?: 'neutral' | 'primary';
9
+ htmlTag?: 'button' | 'a';
10
+ isDisabled?: boolean;
9
11
  onClick?: React.ReactEventHandler;
10
12
  };
11
13
  declare type LinkWrapperProps = {
12
14
  children?: React.ReactNode;
13
15
  href?: string;
16
+ disabled?: boolean;
14
17
  variant?: 'neutral' | 'primary';
18
+ as?: string;
15
19
  };
16
20
  export default Link;
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
+ import { css } from '@emotion/core';
14
15
  import { getColorValue } from '../../utilities';
15
16
  const variants = {
16
17
  neutral: {
@@ -20,16 +21,33 @@ const variants = {
20
21
  color: getColorValue('primary'),
21
22
  },
22
23
  };
24
+ const statusStyles = {
25
+ enabled: css `
26
+ cursor: pointer;
27
+ `,
28
+ disabled: css `
29
+ pointer-events: none;
30
+ color: ${getColorValue('disabledContent')};
31
+ `,
32
+ };
33
+ const buttonStyles = {
34
+ isButton: css `
35
+ background: none;
36
+ border: none;
37
+ font: inherit;
38
+ `
39
+ };
23
40
  const LinkWrapper = styled.a `
24
41
  text-decoration: none;
25
- color: ${props => variants[props.variant].color};
42
+ ${props => !props.disabled && `color: ${variants[props.variant].color}`};
26
43
  box-shadow: 0 1px 0 currentColor;
27
- padding-bottom: 1px;
28
- cursor: pointer;
44
+ padding: 0 0 1px 0;
45
+ ${props => props.disabled ? statusStyles.disabled : statusStyles.enabled};
46
+ ${props => props.as === 'button' && buttonStyles.isButton};
29
47
  `;
30
48
  const Link = (_a) => {
31
- var { children, href, variant = 'primary' } = _a, props = __rest(_a, ["children", "href", "variant"]);
32
- return (React.createElement(LinkWrapper, Object.assign({ href: href, variant: variant }, props), children));
49
+ var { children, href, variant = 'primary', htmlTag = 'a', isDisabled } = _a, props = __rest(_a, ["children", "href", "variant", "htmlTag", "isDisabled"]);
50
+ return (React.createElement(LinkWrapper, Object.assign({ href: href, variant: variant, as: htmlTag, disabled: isDisabled }, props), children));
33
51
  };
34
52
  export const availableVariants = Object.keys(variants);
35
53
  export default Link;
@@ -9,12 +9,12 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { getRadius, getShadow, getColorValue, u } from '../../utilities';
13
- import IconButton from '../icon-button/icon-button';
14
12
  import React, { useEffect } from 'react';
13
+ import { getColorValue, getRadius, getShadow, u } from '../../utilities';
14
+ import IconButton from '../icon-button/icon-button';
15
15
  import { SvgClose } from '../icon/available-icons';
16
- import styled from '@emotion/styled';
17
16
  import { keyframes } from '@emotion/core';
17
+ import styled from '@emotion/styled';
18
18
  const toastDuration = 3000;
19
19
  const enter = keyframes `
20
20
  from {
@@ -66,7 +66,7 @@ const Toast = (_a) => {
66
66
  }, toastDuration);
67
67
  return () => clearTimeout(timer);
68
68
  }, [isOpen, onCloseClick]);
69
- return (React.createElement(React.Fragment, null, isOpen && (React.createElement(ToastWrapper, Object.assign({ className: "theme-dark", onClick: e => e.stopPropagation(), zIndex: zIndex, isOpen: isOpen }, props),
69
+ return (React.createElement(React.Fragment, null, isOpen && (React.createElement(ToastWrapper, Object.assign({ "data-lens-theme": "dark", onClick: e => e.stopPropagation(), zIndex: zIndex, isOpen: isOpen }, props),
70
70
  React.createElement(ChildrenSection, { "aria-live": "polite" }, children),
71
71
  onCloseClick && (React.createElement(IconButton, { altText: "Close", icon: React.createElement(SvgClose, null), onClick: onCloseClick }))))));
72
72
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  declare const TooltipBoxWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TooltipBoxProps, object>;
3
3
  export declare const TooltipBox: ({ children, maxWidth, onMouseEnter, onMouseLeave, layerProps, zIndex, ...rest }: TooltipBoxProps & React.ComponentProps<typeof TooltipBoxWrapper>) => JSX.Element;
4
- declare function Tooltip({ children, content, placement, keepOpen, triggerOffset, maxWidth, isInline, container, zIndex, verticalAlign, ...rest }: TooltipProps): JSX.Element;
4
+ declare function Tooltip({ children, content, placement, keepOpen, triggerOffset, maxWidth, isInline, isDisabled, container, zIndex, verticalAlign, ...rest }: TooltipProps): JSX.Element;
5
5
  export declare const availablePlacements: string[];
6
6
  declare type TooltipBoxProps = {
7
7
  children?: React.ReactNode;
@@ -12,15 +12,16 @@ declare type TooltipBoxProps = {
12
12
  zIndex?: number;
13
13
  };
14
14
  declare type TooltipProps = {
15
- placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'leftTop' | 'leftCenter' | 'leftBottom' | 'rightTop' | 'rightCenter' | 'rightBottom';
15
+ children?: React.ReactNode;
16
+ container?: HTMLElement | (() => HTMLElement) | string;
16
17
  content?: React.ReactNode;
17
- triggerOffset?: number;
18
+ isDisabled?: boolean;
19
+ isInline?: boolean;
18
20
  keepOpen?: boolean;
19
21
  maxWidth?: number | string | [];
20
- isInline?: boolean;
21
- container?: HTMLElement | (() => HTMLElement) | string;
22
- zIndex?: number;
23
- children?: React.ReactNode;
22
+ placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'leftTop' | 'leftCenter' | 'leftBottom' | 'rightTop' | 'rightCenter' | 'rightBottom';
23
+ triggerOffset?: number;
24
24
  verticalAlign?: string;
25
+ zIndex?: number;
25
26
  };
26
27
  export default Tooltip;
@@ -53,7 +53,7 @@ const TooltipChildren = styled.span `
53
53
  ${props => props.verticalAlign && `vertical-align: ${props.verticalAlign}`};
54
54
  `;
55
55
  function Tooltip(_a) {
56
- var { children, content, placement = 'topCenter', keepOpen, triggerOffset = 4, maxWidth = 26, isInline = true, container, zIndex = 1100, verticalAlign = 'middle' } = _a, rest = __rest(_a, ["children", "content", "placement", "keepOpen", "triggerOffset", "maxWidth", "isInline", "container", "zIndex", "verticalAlign"]);
56
+ var { children, content, placement = 'topCenter', keepOpen, triggerOffset = 4, maxWidth = 26, isInline = true, isDisabled, container, zIndex = 1100, verticalAlign = 'middle' } = _a, rest = __rest(_a, ["children", "content", "placement", "keepOpen", "triggerOffset", "maxWidth", "isInline", "isDisabled", "container", "zIndex", "verticalAlign"]);
57
57
  const [show, hoverProps] = useHover({
58
58
  delayEnter: 100,
59
59
  delayLeave: 100,
@@ -71,6 +71,7 @@ function Tooltip(_a) {
71
71
  return (React.createElement(React.Fragment, null,
72
72
  React.createElement(TooltipChildren, Object.assign({}, triggerProps, hoverProps, { isInline: isInline, verticalAlign: verticalAlign }), children),
73
73
  isOpen &&
74
+ !isDisabled &&
74
75
  renderLayer(React.createElement("div", Object.assign({}, layerProps, { style: Object.assign(Object.assign({}, layerProps.style), { zIndex }) }),
75
76
  React.createElement(TooltipBox, Object.assign({ maxWidth: maxWidth, onMouseEnter: () => setIsOverTooltip(true), onMouseLeave: () => setIsOverTooltip(false) }, rest), content)))));
76
77
  }
@@ -100,12 +100,12 @@ export const getThemeStylesString = (customRootElement = ':root') => {
100
100
  return `
101
101
  ${rootElement},
102
102
  .theme-light,
103
- [data-lensTheme="light"] {
103
+ [data-lens-theme="light"] {
104
104
  ${assignLightThemeColors().join('')}
105
105
  }
106
106
 
107
107
  .theme-dark,
108
- [data-lensTheme="dark"] {
108
+ [data-lens-theme="dark"] {
109
109
  ${assignDarkThemeColors().join('')}
110
110
  }
111
111
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.33.0",
3
+ "version": "10.34.1",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",
@@ -38,8 +38,8 @@
38
38
  "react-dom": "^17.0.2"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/cli": "^7.8.4",
42
- "@babel/core": "7.8.4",
41
+ "@babel/cli": "^7.16.0",
42
+ "@babel/core": "^7.14.0",
43
43
  "@babel/plugin-proposal-class-properties": "^7.8.3",
44
44
  "@babel/preset-env": "^7.8.4",
45
45
  "@babel/preset-react": "^7.8.3",