@loomhq/lens 10.70.0 → 10.71.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.
@@ -126,7 +126,7 @@ const ButtonWrapper = styled.button `
126
126
  }
127
127
 
128
128
  &:focus-visible {
129
- outline: none;
129
+ outline: 1px solid transparent;
130
130
  ${getFocusRing()};
131
131
  }
132
132
 
@@ -58,7 +58,7 @@ const InputContainer = styled.div `
58
58
  }
59
59
 
60
60
  &:focus {
61
- outline: none;
61
+ outline: 1px solid transparent;
62
62
  box-shadow: var(--lns-formFieldBorderShadowFocus);
63
63
  }
64
64
  }
@@ -10,7 +10,7 @@ declare type OptionsObject = {
10
10
  };
11
11
  declare type DropdownProps = {
12
12
  trigger?: React.ReactNode;
13
- menuPosition?: 'left' | 'right';
13
+ menuPosition?: 'left' | 'right' | 'topRight' | 'topLeft';
14
14
  options?: OptionsObject[];
15
15
  isOpen?: boolean;
16
16
  menuZIndex?: number;
@@ -9,19 +9,13 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import Menu, { MenuItem } from '../menu/menu';
12
+ import Menu, { MenuItem, menuPositions } from '../menu/menu';
13
13
  import React, { useEffect, useState } from 'react';
14
14
  import Downshift from 'downshift';
15
15
  import ResizeObserver from 'resize-observer-polyfill';
16
16
  import { getDownshiftEnvironment } from '../../utilities/downshift';
17
17
  import styled from '@emotion/styled';
18
18
  import { useLayer } from 'react-laag';
19
- const menuPositions = {
20
- left: 'bottom-start',
21
- right: 'bottom-end',
22
- ['topLeft']: 'top-start',
23
- ['topRight']: 'top-end',
24
- };
25
19
  const TriggerSection = styled.div `
26
20
  display: inline-block;
27
21
  vertical-align: middle;
@@ -32,7 +32,7 @@ export const IconButtonBox = styled.button `
32
32
  width: ${props => sizeStyles[props.size].size};
33
33
  height: ${props => sizeStyles[props.size].size};
34
34
  position: relative;
35
- outline: none;
35
+ outline: 1px solid transparent;
36
36
  transition: 0.6s background-color;
37
37
  display: inline-flex;
38
38
  justify-content: center;
@@ -43,24 +43,21 @@ const LinkWrapper = styled.a `
43
43
  ${props => !props.disabled && `color: ${variants[props.variant].color}`};
44
44
  ${props => (props.disabled ? statusStyles.disabled : statusStyles.enabled)};
45
45
  ${props => props.as === 'button' && buttonStyles.isButton};
46
- &:focus {
47
- outline: 0px solid transparent;
46
+ border-radius: 0.28em;
47
+ box-shadow: 0 0 0 1px transparent;
48
+ text-decoration: underline;
49
+ text-underline-offset: 0.35em;
50
+ transition: 0.3s box-shadow;
51
+ &:focus,
52
+ &:focus-visible {
53
+ outline: 1px solid transparent;
48
54
  }
49
55
  &:focus-visible {
50
- outline: none;
51
56
  ${getFocusRing()};
52
57
  }
53
58
  &::-moz-focus-inner {
54
59
  border: 0;
55
60
  }
56
- @supports not (text-underline-offset: 0.35em) {
57
- box-shadow: 0 1px 0 currentColor;
58
- padding: 0 0 1px 0;
59
- }
60
- @supports (text-underline-offset: 0.35em) {
61
- text-underline-offset: 0.35em;
62
- text-decoration: underline;
63
- }
64
61
  `;
65
62
  const Link = (_a) => {
66
63
  var { children, href, variant = 'primary', htmlTag = 'a', isDisabled } = _a, props = __rest(_a, ["children", "href", "variant", "htmlTag", "isDisabled"]);
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
+ declare type MenuPositionsProps = {
3
+ [key: string]: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
4
+ };
5
+ export declare const menuPositions: MenuPositionsProps;
2
6
  declare const MenuWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, MenuProps, object>;
3
7
  declare const MenuItemWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, MenuItemProps, object>;
4
8
  export declare const MenuItem: ({ isDisabled, isHighlighted, isSelected, icon, hasDivider, children, ...props }: MenuItemProps & React.ComponentProps<typeof MenuItemWrapper>) => JSX.Element;
@@ -15,6 +15,12 @@ import React from 'react';
15
15
  import { SvgCheck } from '../icon/available-icons';
16
16
  import Text from '../text/text';
17
17
  import styled from '@emotion/styled';
18
+ export const menuPositions = {
19
+ left: 'bottom-start',
20
+ right: 'bottom-end',
21
+ ['topLeft']: 'top-start',
22
+ ['topRight']: 'top-end',
23
+ };
18
24
  const MenuWrapper = styled.ul `
19
25
  background-color: ${getColorValue('overlay')};
20
26
  list-style: none;
@@ -1,6 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  declare const SelectWrapper: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement>>, object>;
3
- declare const Select: ({ container, onChange, menuZIndex, menuMaxWidth, menuMaxHeight, selectedOptionValue, onOuterClick, options, placeholder, isDisabled, onOpenChange, trigger, ...props }: SelectProps & React.ComponentProps<typeof SelectWrapper>) => JSX.Element;
3
+ declare const Select: ({ container, onChange, menuZIndex, menuMaxWidth, menuMaxHeight, menuMinWidth, selectedOptionValue, onOuterClick, options, placeholder, menuPosition, isDisabled, onOpenChange, trigger, ...props }: SelectProps & React.ComponentProps<typeof SelectWrapper>) => JSX.Element;
4
4
  declare type OptionsObject = {
5
5
  value: string;
6
6
  title: React.ReactNode;
@@ -17,6 +17,8 @@ declare type SelectProps = {
17
17
  menuZIndex?: number;
18
18
  menuMaxWidth?: string | number;
19
19
  menuMaxHeight?: string | number;
20
+ menuMinWidth?: string | number;
21
+ menuPosition?: 'left' | 'right' | 'topRight' | 'topLeft';
20
22
  options?: OptionsObject[];
21
23
  container?: HTMLElement;
22
24
  onOuterClick?: () => void;
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import Menu, { MenuItem } from '../menu/menu';
12
+ import Menu, { MenuItem, menuPositions } from '../menu/menu';
13
13
  import React, { useEffect, useState } from 'react';
14
14
  import { getColorValue, getSize, u } from '../../utilities';
15
15
  import Downshift from 'downshift';
@@ -50,7 +50,7 @@ const SelectHeaderWrapper = styled.button `
50
50
  }
51
51
 
52
52
  &:focus {
53
- outline: none;
53
+ outline: 1px solid transparent;
54
54
  box-shadow: var(--lns-formFieldBorderShadowFocus);
55
55
  }
56
56
 
@@ -142,7 +142,7 @@ const didSelectedOptionValueChange = (selectedOptionValue, prevSelectedItem) =>
142
142
  return Boolean(prevSelectedItem && selectedOptionValue !== prevSelectedItem.value);
143
143
  };
144
144
  const Select = (_a) => {
145
- var { container, onChange, menuZIndex = 1100, menuMaxWidth, menuMaxHeight = 34, selectedOptionValue, onOuterClick, options, placeholder, isDisabled, onOpenChange, trigger } = _a, props = __rest(_a, ["container", "onChange", "menuZIndex", "menuMaxWidth", "menuMaxHeight", "selectedOptionValue", "onOuterClick", "options", "placeholder", "isDisabled", "onOpenChange", "trigger"]);
145
+ var { container, onChange, menuZIndex = 1100, menuMaxWidth, menuMaxHeight = 34, menuMinWidth, selectedOptionValue, onOuterClick, options, placeholder, menuPosition = 'left', isDisabled, onOpenChange, trigger } = _a, props = __rest(_a, ["container", "onChange", "menuZIndex", "menuMaxWidth", "menuMaxHeight", "menuMinWidth", "selectedOptionValue", "onOuterClick", "options", "placeholder", "menuPosition", "isDisabled", "onOpenChange", "trigger"]);
146
146
  const environment = getDownshiftEnvironment(container);
147
147
  const [downshiftIsOpen, setDownshiftIsOpen] = useState(false);
148
148
  const [prevSelectedItem, setPrevSelectedItem] = useState(getSelectedOption(selectedOptionValue, options));
@@ -165,7 +165,7 @@ const Select = (_a) => {
165
165
  isOpen: downshiftIsOpen,
166
166
  container,
167
167
  ResizeObserver,
168
- placement: 'bottom-center',
168
+ placement: menuPositions[menuPosition],
169
169
  auto: true,
170
170
  snap: true,
171
171
  });
@@ -191,8 +191,8 @@ const Select = (_a) => {
191
191
  React.createElement("div", Object.assign({}, triggerProps), trigger ? (React.createElement(CustomHeader, { getToggleButtonProps: getToggleButtonProps, selectedItem: selectedItem, selectedOptionValue: selectedOptionValue, selectPlaceholder: placeholder, isDisabled: isDisabled, options: options, trigger: trigger })) : (React.createElement(SelectHeader, { getToggleButtonProps: getToggleButtonProps, selectedItem: selectedItem, selectedOptionValue: selectedOptionValue, selectPlaceholder: placeholder, options: options, inputValue: inputValue, isDisabled: isDisabled }))),
192
192
  downshiftIsOpen &&
193
193
  isOpen &&
194
- renderLayer(React.createElement("div", Object.assign({}, layerProps, { style: Object.assign(Object.assign({}, layerProps.style), { zIndex: menuZIndex, width: triggerBounds === null || triggerBounds === void 0 ? void 0 : triggerBounds.width }) }),
195
- React.createElement(Menu, { downshiftMenuProps: getMenuProps, maxWidth: menuMaxWidth, maxHeight: menuMaxHeight }, options.map((item, index) => {
194
+ renderLayer(React.createElement("div", Object.assign({}, layerProps, { style: Object.assign(Object.assign({}, layerProps.style), { zIndex: menuZIndex, width: menuMinWidth ? 'auto' : triggerBounds === null || triggerBounds === void 0 ? void 0 : triggerBounds.width }) }),
195
+ React.createElement(Menu, { position: menuPosition, downshiftMenuProps: getMenuProps, maxWidth: menuMaxWidth, maxHeight: menuMaxHeight, minWidth: menuMinWidth }, options.map((item, index) => {
196
196
  return (React.createElement(MenuItem, Object.assign({ key: index, getItemProps: getItemProps, icon: item.icon, hidden: item.hidden }, getItemProps({
197
197
  key: `${item.value}-${index}`,
198
198
  index,
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { getColorValue, getFocusRing, getFontWeight, getSize, getSizeValue, u, } from '../../utilities';
12
+ import { getColorValue, getFocusRing, getFontWeight, getRadius, getSize, getSizeValue, u, } from '../../utilities';
13
13
  import Container from '../container/container';
14
14
  import Icon from '../icon/icon';
15
15
  import React from 'react';
@@ -21,6 +21,8 @@ const Wrapper = styled.div `
21
21
  `};
22
22
  `;
23
23
  const TabsNav = styled.nav `
24
+ --activeIndicatorHeight: 3px;
25
+
24
26
  display: flex;
25
27
  overflow: auto;
26
28
  -ms-overflow-style: none;
@@ -49,27 +51,33 @@ const TabWrapper = styled.button `
49
51
  appearance: none;
50
52
  font: inherit;
51
53
  background: transparent;
52
- cursor: pointer;
53
54
  border: none;
55
+ ${getRadius('medium')};
56
+ cursor: pointer;
54
57
  display: inline-flex;
55
58
  align-items: center;
56
59
  justify-content: center;
57
60
  vertical-align: middle;
58
- padding: 0 0 ${u(1)} 0;
61
+ padding: 0 0 calc(var(--lns-space-small) + var(--activeIndicatorHeight)) 0;
62
+ position: relative;
59
63
  color: inherit;
60
64
  text-decoration: none;
61
65
  flex-shrink: 0;
62
66
  ${getFontWeight('medium')};
63
67
  transition: 0.6s color;
64
- border-bottom: ${u(0.375)} solid transparent;
65
68
  white-space: nowrap;
66
69
  color: ${props => getColorValue(props.isActive ? 'body' : 'bodyDimmed')};
67
70
  ${props => props.isActive &&
68
71
  `border-color: ${getColorValue('primary')};
69
72
  `};
70
73
 
71
- &:focus {
72
- outline: none;
74
+ &:focus,
75
+ &:focus-visible {
76
+ outline: 1px solid transparent;
77
+ }
78
+
79
+ &:focus-visible {
80
+ ${getFocusRing(undefined, 'inset')};
73
81
  }
74
82
 
75
83
  &:hover {
@@ -77,8 +85,14 @@ const TabWrapper = styled.button `
77
85
  transition: 0.3s color;
78
86
  }
79
87
 
80
- &:focus-visible {
81
- ${getFocusRing(undefined, 'inset')};
88
+ &::after {
89
+ bottom: 0;
90
+ ${getRadius('medium')};
91
+ content: '';
92
+ height: var(--activeIndicatorHeight);
93
+ position: absolute;
94
+ width: 100%;
95
+ ${props => props.isActive && `background-color: ${getColorValue('primary')}`};
82
96
  }
83
97
  `;
84
98
  export const Tab = (_a) => {
@@ -48,8 +48,9 @@ const TextButtonWrapper = styled.button `
48
48
  ${props => props.offsetSide &&
49
49
  `margin-${props.offsetSide}: calc(-1 * ${sizeStyles[props.size].xSpace})`};
50
50
 
51
- &:focus {
52
- outline: none;
51
+ &:focus,
52
+ &:focus-visible {
53
+ outline: 1px solid transparent;
53
54
  }
54
55
 
55
56
  &:focus-visible {
@@ -62,7 +62,7 @@ const InputField = styled.input `
62
62
  }
63
63
 
64
64
  &:focus {
65
- outline: none;
65
+ outline: 1px solid transparent;
66
66
  box-shadow: var(--lns-formFieldBorderShadowFocus);
67
67
  }
68
68
 
@@ -42,7 +42,7 @@ const TextareaWrapper = styled.textarea `
42
42
  }
43
43
 
44
44
  &:focus {
45
- outline: none;
45
+ outline: 1px solid transparent;
46
46
  box-shadow: var(--lns-formFieldBorderShadowFocus);
47
47
  }
48
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.70.0",
3
+ "version": "10.71.1",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",