carbon-react 126.4.2 → 126.5.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.
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
2
+ import { MarginProps, BackgroundProps, LayoutProps, PaddingProps } from "styled-system";
3
3
  export declare type PositionProps = "absolute" | "fixed" | "relative" | "static" | "sticky";
4
- export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps {
4
+ export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps, PaddingProps {
5
5
  /** HTML alt property to display when an img fails to load */
6
6
  alt?: string;
7
7
  /** Prop to specify if the image is decorative */
@@ -1,5 +1,5 @@
1
1
  import styled, { css } from "styled-components";
2
- import { margin, layout, background } from "styled-system";
2
+ import { margin, layout, background, padding } from "styled-system";
3
3
  import { baseTheme } from "../../style/themes";
4
4
  const StyledImage = styled.div.attrs(({
5
5
  src,
@@ -25,6 +25,7 @@ const StyledImage = styled.div.attrs(({
25
25
  }))`
26
26
  ${margin}
27
27
  ${layout}
28
+ ${padding}
28
29
 
29
30
  ${({
30
31
  position,
@@ -265,7 +265,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
265
265
  const {
266
266
  id: selectedOptionId,
267
267
  text,
268
- value: newValue,
268
+ value: newValue = "",
269
269
  selectionType,
270
270
  selectionConfirmed
271
271
  } = optionData;
@@ -279,7 +279,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
279
279
  setHighlightedValue(newValue);
280
280
  }
281
281
  setTextValue(text || /* istanbul ignore next */"");
282
- triggerChange(newValue, selectionConfirmed);
282
+ triggerChange(newValue, !!selectionConfirmed);
283
283
  setActiveDescendantId(selectedOptionId);
284
284
  if (selectionType !== "navigationKey") {
285
285
  openOnFocusFlagBlock.current = !!openOnFocus;
@@ -249,6 +249,16 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
249
249
  const currentOption = childrenList[currentOptionsListIndex];
250
250
  if (! /*#__PURE__*/React.isValidElement(currentOption)) {
251
251
  onSelectListClose();
252
+
253
+ // need to call onSelect here with empty text/value to clear the input when
254
+ // no matches found in FilterableSelect
255
+ onSelect({
256
+ id: undefined,
257
+ text: "",
258
+ value: "",
259
+ selectionType: "enterKey",
260
+ selectionConfirmed: false
261
+ });
252
262
  return;
253
263
  }
254
264
  if (currentOption.props.disabled) {
@@ -308,7 +318,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
308
318
  setCurrentOptionsListIndex(previousIndex => {
309
319
  const match = getNextChildByText(filterText, childrenList, previousIndex);
310
320
  if (!match) {
311
- return previousIndex;
321
+ return -1;
312
322
  }
313
323
  const indexOfMatch = getIndexOfMatch(match.props.value);
314
324
  virtualizer.scrollToIndex(indexOfMatch, SCROLL_OPTIONS);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
2
+ import { MarginProps, BackgroundProps, LayoutProps, PaddingProps } from "styled-system";
3
3
  export declare type PositionProps = "absolute" | "fixed" | "relative" | "static" | "sticky";
4
- export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps {
4
+ export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps, PaddingProps {
5
5
  /** HTML alt property to display when an img fails to load */
6
6
  alt?: string;
7
7
  /** Prop to specify if the image is decorative */
@@ -33,6 +33,7 @@ const StyledImage = exports.StyledImage = _styledComponents.default.div.attrs(({
33
33
  }))`
34
34
  ${_styledSystem.margin}
35
35
  ${_styledSystem.layout}
36
+ ${_styledSystem.padding}
36
37
 
37
38
  ${({
38
39
  position,
@@ -274,7 +274,7 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
274
274
  const {
275
275
  id: selectedOptionId,
276
276
  text,
277
- value: newValue,
277
+ value: newValue = "",
278
278
  selectionType,
279
279
  selectionConfirmed
280
280
  } = optionData;
@@ -288,7 +288,7 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
288
288
  setHighlightedValue(newValue);
289
289
  }
290
290
  setTextValue(text || /* istanbul ignore next */"");
291
- triggerChange(newValue, selectionConfirmed);
291
+ triggerChange(newValue, !!selectionConfirmed);
292
292
  setActiveDescendantId(selectedOptionId);
293
293
  if (selectionType !== "navigationKey") {
294
294
  openOnFocusFlagBlock.current = !!openOnFocus;
@@ -258,6 +258,16 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
258
258
  const currentOption = childrenList[currentOptionsListIndex];
259
259
  if (! /*#__PURE__*/_react.default.isValidElement(currentOption)) {
260
260
  onSelectListClose();
261
+
262
+ // need to call onSelect here with empty text/value to clear the input when
263
+ // no matches found in FilterableSelect
264
+ onSelect({
265
+ id: undefined,
266
+ text: "",
267
+ value: "",
268
+ selectionType: "enterKey",
269
+ selectionConfirmed: false
270
+ });
261
271
  return;
262
272
  }
263
273
  if (currentOption.props.disabled) {
@@ -317,7 +327,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
317
327
  setCurrentOptionsListIndex(previousIndex => {
318
328
  const match = (0, _getNextChildByText.default)(filterText, childrenList, previousIndex);
319
329
  if (!match) {
320
- return previousIndex;
330
+ return -1;
321
331
  }
322
332
  const indexOfMatch = getIndexOfMatch(match.props.value);
323
333
  virtualizer.scrollToIndex(indexOfMatch, SCROLL_OPTIONS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "126.4.2",
3
+ "version": "126.5.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",