@loomhq/lens 10.43.6 → 10.43.9

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/README.md CHANGED
@@ -62,7 +62,7 @@ navigate to: http://localhost:3000
62
62
 
63
63
  ### Use conventional commits
64
64
 
65
- Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to kick off publishing a new version of Lens when PR is merged. To upgrade Lens to the latest published version in the [main Loom repo](http://github.com/loomhq/loom), `cd src/client` and `pnpm up @loomhq/lens`.
65
+ Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to kick off publishing a new version of Lens when PR is merged. To upgrade Lens to the latest published version in the [main Loom repo](http://github.com/loomhq/loom), `cd projects/webapp-client` and `pnpm up @loomhq/lens`.
66
66
 
67
67
  ### Add an icon to the icon set
68
68
 
@@ -137,15 +137,26 @@ const CustomHeader = ({ selectedOptionValue, selectedItem, trigger, getToggleBut
137
137
  };
138
138
  return trigger(triggerContent, buttonProps());
139
139
  };
140
+ const getSelectedOption = (value, options) => options.find(o => o.value === value);
141
+ const didSelectedOptionValueChange = (selectedOptionValue, prevSelectedItem) => {
142
+ return Boolean(prevSelectedItem && selectedOptionValue !== prevSelectedItem.value);
143
+ };
140
144
  const Select = (_a) => {
141
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"]);
142
146
  const environment = getDownshiftEnvironment(container);
143
147
  const [downshiftIsOpen, setDownshiftIsOpen] = useState(false);
148
+ const [prevSelectedItem, setPrevSelectedItem] = useState(getSelectedOption(selectedOptionValue, options));
149
+ const [selectedItem, setSelectedItem] = useState(prevSelectedItem);
150
+ const onDownshiftChange = item => {
151
+ setSelectedItem(item);
152
+ onChange && onChange(item ? item : '');
153
+ };
144
154
  const downshiftProps = {
145
155
  itemToString: item => (item ? item.value : ''),
146
- onChange: onChange && (item => onChange(item ? item : '')),
156
+ onChange: onDownshiftChange,
147
157
  onOuterClick,
148
158
  environment,
159
+ selectedItem,
149
160
  };
150
161
  if (environment) {
151
162
  downshiftProps.environment = environment;
@@ -158,6 +169,13 @@ const Select = (_a) => {
158
169
  auto: true,
159
170
  snap: true,
160
171
  });
172
+ useEffect(() => {
173
+ if (didSelectedOptionValueChange(selectedOptionValue, prevSelectedItem)) {
174
+ const selectedItem = getSelectedOption(selectedOptionValue, options);
175
+ setPrevSelectedItem(selectedItem);
176
+ setSelectedItem(selectedItem);
177
+ }
178
+ }, [selectedOptionValue, options, prevSelectedItem]);
161
179
  useEffect(() => {
162
180
  onOpenChange && onOpenChange(downshiftIsOpen);
163
181
  }, [downshiftIsOpen, onOpenChange]);
@@ -30,6 +30,7 @@ const sizesStyles = {
30
30
  },
31
31
  };
32
32
  const InputField = styled.input `
33
+ -webkit-appearance: none;
33
34
  font-family: inherit;
34
35
  width: 100%;
35
36
  height: ${props => sizesStyles[props.inputSize].height};
@@ -51,12 +52,6 @@ const InputField = styled.input `
51
52
 
52
53
  ${props => getTextSize(sizesStyles[props.inputSize].textSize)};
53
54
 
54
- &::-webkit-search-decoration,
55
- &::-webkit-search-results-button,
56
- &::-webkit-search-results-decoration {
57
- -webkit-appearance: none;
58
- }
59
-
60
55
  &:hover {
61
56
  box-shadow: inset 0 0 0 var(--lns-formFieldBorderWidthFocus)
62
57
  var(--lns-color-blurple);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "10.43.6",
3
+ "version": "10.43.9",
4
4
  "scripts": {
5
5
  "dev": "next",
6
6
  "build:next": "next build",