carbon-react 142.13.5 → 143.0.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.
Files changed (47) hide show
  1. package/esm/__internal__/validations/validation-icon.component.js +2 -1
  2. package/esm/components/accordion/accordion-group/accordion-group.component.d.ts +2 -1
  3. package/esm/components/accordion/accordion-group/accordion-group.component.js +4 -1
  4. package/esm/components/advanced-color-picker/advanced-color-picker.component.js +3 -1
  5. package/esm/components/pages/page/page.component.js +1 -0
  6. package/esm/components/preview/preview.component.js +6 -2
  7. package/esm/components/select/__internal__/select-list/select-list.component.d.ts +4 -2
  8. package/esm/components/select/__internal__/select-list/select-list.component.js +8 -4
  9. package/esm/components/select/__internal__/utils/with-filter.hoc.js +3 -1
  10. package/esm/components/select/filterable-select/filterable-select.component.d.ts +4 -2
  11. package/esm/components/select/filterable-select/filterable-select.component.js +17 -3
  12. package/esm/components/select/multi-select/multi-select.component.d.ts +4 -2
  13. package/esm/components/select/multi-select/multi-select.component.js +17 -3
  14. package/esm/components/select/option/option.component.d.ts +5 -5
  15. package/esm/components/select/option/option.component.js +8 -8
  16. package/esm/components/select/option/option.style.d.ts +1 -0
  17. package/esm/components/select/option/option.style.js +9 -7
  18. package/esm/components/select/option-group-header/option-group-header.component.d.ts +1 -1
  19. package/esm/components/select/option-group-header/option-group-header.component.js +2 -2
  20. package/esm/components/select/option-row/option-row.component.d.ts +1 -1
  21. package/esm/components/select/option-row/option-row.component.js +3 -3
  22. package/esm/components/select/simple-select/simple-select.component.d.ts +4 -2
  23. package/esm/components/select/simple-select/simple-select.component.js +36 -43
  24. package/lib/__internal__/validations/validation-icon.component.js +2 -1
  25. package/lib/components/accordion/accordion-group/accordion-group.component.d.ts +2 -1
  26. package/lib/components/accordion/accordion-group/accordion-group.component.js +4 -1
  27. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +3 -1
  28. package/lib/components/pages/page/page.component.js +1 -0
  29. package/lib/components/preview/preview.component.js +6 -2
  30. package/lib/components/select/__internal__/select-list/select-list.component.d.ts +4 -2
  31. package/lib/components/select/__internal__/select-list/select-list.component.js +8 -4
  32. package/lib/components/select/__internal__/utils/with-filter.hoc.js +3 -1
  33. package/lib/components/select/filterable-select/filterable-select.component.d.ts +4 -2
  34. package/lib/components/select/filterable-select/filterable-select.component.js +17 -3
  35. package/lib/components/select/multi-select/multi-select.component.d.ts +4 -2
  36. package/lib/components/select/multi-select/multi-select.component.js +17 -3
  37. package/lib/components/select/option/option.component.d.ts +5 -5
  38. package/lib/components/select/option/option.component.js +8 -8
  39. package/lib/components/select/option/option.style.d.ts +1 -0
  40. package/lib/components/select/option/option.style.js +9 -7
  41. package/lib/components/select/option-group-header/option-group-header.component.d.ts +1 -1
  42. package/lib/components/select/option-group-header/option-group-header.component.js +2 -2
  43. package/lib/components/select/option-row/option-row.component.d.ts +1 -1
  44. package/lib/components/select/option-row/option-row.component.js +3 -3
  45. package/lib/components/select/simple-select/simple-select.component.d.ts +4 -2
  46. package/lib/components/select/simple-select/simple-select.component.js +36 -43
  47. package/package.json +2 -2
@@ -69,7 +69,8 @@ export const ValidationIcon = ({
69
69
  setTriggeredByIcon(false);
70
70
  if (onBlur) onBlur(e);
71
71
  },
72
- isPartOfInput: isPartOfInput
72
+ isPartOfInput: isPartOfInput,
73
+ "data-role": "validation-icon-wrapper"
73
74
  }, filterStyledSystemMarginProps(rest)), /*#__PURE__*/React.createElement(Icon, {
74
75
  "aria-describedby": validationTooltipId.current,
75
76
  key: `${validationType}-icon`,
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
+ import { TagProps } from "../../../__internal__/utils/helpers/tags";
3
4
  declare type AccordionGroupChild = React.ReactElement | boolean | null | undefined | AccordionGroupChildArray;
4
5
  interface AccordionGroupChildArray extends Array<AccordionGroupChild> {
5
6
  }
6
- export interface AccordionGroupProps extends MarginProps {
7
+ export interface AccordionGroupProps extends MarginProps, Omit<TagProps, "data-component"> {
7
8
  /** An Accordion or list of Accordion components to be rendered inside the AccordionGroup */
8
9
  children?: AccordionGroupChild;
9
10
  }
@@ -1,3 +1,4 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
1
2
  import React, { useMemo, useCallback } from "react";
2
3
  import PropTypes from "prop-types";
3
4
  import invariant from "invariant";
@@ -50,7 +51,9 @@ export const AccordionGroup = ({
50
51
  focusAccordion(ev, refs.length - 1);
51
52
  }
52
53
  }, [focusAccordion, refs]);
53
- return /*#__PURE__*/React.createElement(StyledAccordionGroup, rest, filteredChildren.map((child, index) =>
54
+ return /*#__PURE__*/React.createElement(StyledAccordionGroup, _extends({}, rest, {
55
+ "data-component": "accordion-group"
56
+ }), filteredChildren.map((child, index) =>
54
57
  /*#__PURE__*/
55
58
  // casted to ReactElement as there is no overload for an FunctionComponentElement in cloneElement
56
59
  React.cloneElement(child, {
@@ -120,7 +120,9 @@ export const AdvancedColorPicker = ({
120
120
  }
121
121
  return /*#__PURE__*/React.createElement(StyledAdvancedColorPickerWrapper, _extends({
122
122
  m: "15px auto auto 15px"
123
- }, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledAdvancedColorPickerCell, {
123
+ }, filterStyledSystemMarginProps(props), {
124
+ "data-role": "advanced-color-picker-wrapper"
125
+ }), /*#__PURE__*/React.createElement(StyledAdvancedColorPickerCell, {
124
126
  "data-element": "color-picker-cell",
125
127
  "aria-label": l.advancedColorPicker.ariaLabel(),
126
128
  "aria-describedby": descriptionId.current,
@@ -35,6 +35,7 @@ const Page = ({
35
35
  hasContent: true
36
36
  }, title), /*#__PURE__*/React.createElement(StyledPageContent, _extends({
37
37
  "data-element": "carbon-page-content",
38
+ "data-role": "page-content",
38
39
  p: "34px 40px"
39
40
  }, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(Box, {
40
41
  boxSizing: "border-box",
@@ -34,8 +34,12 @@ export const Preview = ({
34
34
  disableAnimation: disableAnimation || reduceMotion
35
35
  }, props)));
36
36
  }
37
- return /*#__PURE__*/React.createElement(StyledPreview, marginProps, placeholders);
37
+ return /*#__PURE__*/React.createElement(StyledPreview, _extends({
38
+ "data-role": "preview-wrapper"
39
+ }, marginProps), placeholders);
38
40
  }
39
- return /*#__PURE__*/React.createElement(StyledPreview, marginProps, children);
41
+ return /*#__PURE__*/React.createElement(StyledPreview, _extends({
42
+ "data-role": "preview-wrapper"
43
+ }, marginProps), children);
40
44
  };
41
45
  export default Preview;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Side } from "@floating-ui/dom";
2
+ export declare type ListPlacement = "top" | "bottom" | "top-start" | "bottom-start" | "top-end" | "bottom-end";
3
3
  export interface SelectListProps {
4
4
  /** The ID for the parent <div> */
5
5
  id?: string;
@@ -38,7 +38,7 @@ export interface SelectListProps {
38
38
  /** When true component will work in multi column mode, children should consist of OptionRow components in this mode */
39
39
  multiColumn?: boolean;
40
40
  /** Placement of the select list relative to the input element */
41
- listPlacement?: Side;
41
+ listPlacement?: ListPlacement;
42
42
  /** Use the opposite list placement if the set placement does not fit */
43
43
  flipEnabled?: boolean;
44
44
  /** @private @ignore
@@ -56,6 +56,8 @@ export interface SelectListProps {
56
56
  virtualScrollOverscan?: number;
57
57
  /** @private @ignore A callback for when a mouseDown event occurs on the component */
58
58
  onMouseDown?: () => void;
59
+ /** Override the default width of the list element. Number passed is converted into pixel value */
60
+ listWidth?: number;
59
61
  }
60
62
  declare const SelectList: React.ForwardRefExoticComponent<SelectListProps & React.RefAttributes<HTMLDivElement>>;
61
63
  export default SelectList;
@@ -44,6 +44,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
44
44
  multiselectValues,
45
45
  enableVirtualScroll,
46
46
  virtualScrollOverscan = 5,
47
+ listWidth,
47
48
  ...listProps
48
49
  }, listContainerRef) => {
49
50
  const [currentOptionsListIndex, setCurrentOptionsListIndex] = useState(-1);
@@ -153,7 +154,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
153
154
  const childElementRefs = useRef(Array.from({
154
155
  length: React.Children.count(children)
155
156
  }));
156
- const optionChildrenList = useMemo(() => childrenList.filter(child => /*#__PURE__*/React.isValidElement(child) && (child.type === Option || child.type === OptionRow)), [childrenList]);
157
+ const optionChildrenList = useMemo(() => childrenList.filter(child => {
158
+ return /*#__PURE__*/React.isValidElement(child) && (child.type === Option || child.type === OptionRow);
159
+ }), [childrenList]);
157
160
  const {
158
161
  measureElement
159
162
  } = virtualizer;
@@ -372,12 +375,12 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
372
375
  elements
373
376
  }) {
374
377
  Object.assign(elements.floating.style, {
375
- width: `${rects.reference.width}px`
378
+ width: `${listWidth ?? rects.reference.width}px`
376
379
  });
377
380
  }
378
381
  }), ...(flipEnabled ? [flip({
379
382
  fallbackStrategy: "initialPlacement"
380
- })] : [])], [flipEnabled]);
383
+ })] : [])], [listWidth, flipEnabled]);
381
384
  const loader = isLoading ? /*#__PURE__*/React.createElement(StyledSelectLoaderContainer, {
382
385
  key: "loader"
383
386
  }, /*#__PURE__*/React.createElement(Loader, null)) : undefined;
@@ -458,7 +461,8 @@ if (process.env.NODE_ENV !== "production") {
458
461
  "labelId": PropTypes.string,
459
462
  "listActionButton": PropTypes.node,
460
463
  "listMaxHeight": PropTypes.number,
461
- "listPlacement": PropTypes.oneOf(["bottom", "left", "right", "top"]),
464
+ "listPlacement": PropTypes.oneOf(["bottom-end", "bottom-start", "bottom", "top-end", "top-start", "top"]),
465
+ "listWidth": PropTypes.number,
462
466
  "multiColumn": PropTypes.bool,
463
467
  "multiselectValues": PropTypes.arrayOf(PropTypes.string),
464
468
  "onListAction": PropTypes.func,
@@ -106,7 +106,9 @@ const withFilter = WrappedComponent => {
106
106
  colSpan: colSpan
107
107
  }, noResultsMessage || noResultsText));
108
108
  }
109
- return /*#__PURE__*/React.createElement(StyledOption, null, noResultsMessage || noResultsText);
109
+ return /*#__PURE__*/React.createElement(StyledOption, {
110
+ isInteractive: true
111
+ }, noResultsMessage || noResultsText);
110
112
  }
111
113
  return addHighlightedContent(filteredElements, filterText);
112
114
  }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { Side } from "@floating-ui/dom";
3
2
  import { ButtonProps } from "../../button";
4
3
  import { FormInputPropTypes } from "../__internal__/select-textbox";
4
+ import { ListPlacement } from "../__internal__/select-list/select-list.component";
5
5
  import { CustomSelectChangeEvent } from "../simple-select";
6
6
  export interface FilterableSelectProps extends Omit<FormInputPropTypes, "defaultValue" | "value"> {
7
7
  /** Prop to specify the aria-label attribute of the component input */
@@ -49,7 +49,7 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
49
49
  /** Maximum list height - defaults to 180 */
50
50
  listMaxHeight?: number;
51
51
  /** Placement of the select list in relation to the input element */
52
- listPlacement?: Side;
52
+ listPlacement?: ListPlacement;
53
53
  /** Use the opposite list placement if the set placement does not fit */
54
54
  flipEnabled?: boolean;
55
55
  /** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
@@ -68,6 +68,8 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
68
68
  required?: boolean;
69
69
  /** Specify a callback triggered on change */
70
70
  onChange?: (ev: CustomSelectChangeEvent | React.ChangeEvent<HTMLInputElement>) => void;
71
+ /** Override the default width of the list element. Number passed is converted into pixel value */
72
+ listWidth?: number;
71
73
  }
72
74
  export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<HTMLInputElement>>;
73
75
  export default FilterableSelect;
@@ -54,6 +54,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
54
54
  disableDefaultFiltering = false,
55
55
  isOptional,
56
56
  required,
57
+ listWidth,
57
58
  ...textboxProps
58
59
  }, ref) => {
59
60
  const [activeDescendantId, setActiveDescendantId] = useState();
@@ -396,6 +397,17 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
396
397
  ...filterOutStyledSystemSpacingProps(textboxProps)
397
398
  };
398
399
  }
400
+ let placement;
401
+ switch (listPlacement) {
402
+ case "top":
403
+ placement = "top-end";
404
+ break;
405
+ case "bottom":
406
+ placement = "bottom-end";
407
+ break;
408
+ default:
409
+ placement = listPlacement;
410
+ }
399
411
  const selectListProps = {
400
412
  ref: listboxRef,
401
413
  id: selectListId.current,
@@ -414,11 +426,12 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
414
426
  onListScrollBottom,
415
427
  tableHeader,
416
428
  multiColumn,
417
- listPlacement,
429
+ listPlacement: listWidth !== undefined ? placement : listPlacement,
418
430
  flipEnabled,
419
431
  isOpen,
420
432
  enableVirtualScroll,
421
- virtualScrollOverscan
433
+ virtualScrollOverscan,
434
+ listWidth
422
435
  };
423
436
  const selectList = disableDefaultFiltering ? /*#__PURE__*/React.createElement(SelectList, selectListProps, children) : /*#__PURE__*/React.createElement(FilterableSelectList, selectListProps, children);
424
437
  const marginProps = useFormSpacing(textboxProps);
@@ -576,7 +589,8 @@ if (process.env.NODE_ENV !== "production") {
576
589
  "list": PropTypes.string,
577
590
  "listActionButton": PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
578
591
  "listMaxHeight": PropTypes.number,
579
- "listPlacement": PropTypes.oneOf(["bottom", "left", "right", "top"]),
592
+ "listPlacement": PropTypes.oneOf(["bottom-end", "bottom-start", "bottom", "top-end", "top-start", "top"]),
593
+ "listWidth": PropTypes.number,
580
594
  "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
581
595
  "__@toStringTag": PropTypes.string.isRequired,
582
596
  "description": PropTypes.string,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { Side } from "@floating-ui/dom";
3
2
  import { FormInputPropTypes } from "../__internal__/select-textbox";
3
+ import { ListPlacement } from "../__internal__/select-list/select-list.component";
4
4
  import { CustomSelectChangeEvent } from "../simple-select";
5
5
  export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue" | "value"> {
6
6
  /** Prop to specify the aria-label attribute of the component input */
@@ -44,7 +44,7 @@ export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue
44
44
  /** Maximum list height - defaults to 180 */
45
45
  listMaxHeight?: number;
46
46
  /** Placement of the select list in relation to the input element */
47
- listPlacement?: Side;
47
+ listPlacement?: ListPlacement;
48
48
  /** Use the opposite list placement if the set placement does not fit */
49
49
  flipEnabled?: boolean;
50
50
  /** Wraps the pill text when it would overflow the input width */
@@ -60,6 +60,8 @@ export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue
60
60
  isOptional?: boolean;
61
61
  /** Specify a callback triggered on change */
62
62
  onChange?: (ev: CustomSelectChangeEvent | React.ChangeEvent<HTMLInputElement>) => void;
63
+ /** Override the default width of the list element. Number passed is converted into pixel value */
64
+ listWidth?: number;
63
65
  }
64
66
  export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLInputElement>>;
65
67
  export default MultiSelect;
@@ -55,6 +55,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
55
55
  virtualScrollOverscan,
56
56
  isOptional,
57
57
  required,
58
+ listWidth,
58
59
  ...textboxProps
59
60
  }, ref) => {
60
61
  const [activeDescendantId, setActiveDescendantId] = useState();
@@ -421,6 +422,17 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
421
422
  ...filterOutStyledSystemSpacingProps(textboxProps)
422
423
  };
423
424
  }
425
+ let placement;
426
+ switch (listPlacement) {
427
+ case "top":
428
+ placement = "top-end";
429
+ break;
430
+ case "bottom":
431
+ placement = "bottom-end";
432
+ break;
433
+ default:
434
+ placement = listPlacement;
435
+ }
424
436
  const selectList = /*#__PURE__*/React.createElement(FilterableSelectList, {
425
437
  ref: listboxRef,
426
438
  id: selectListId.current,
@@ -435,13 +447,14 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
435
447
  isLoading: isLoading,
436
448
  tableHeader: tableHeader,
437
449
  multiColumn: multiColumn,
438
- listPlacement: listPlacement,
450
+ listPlacement: listWidth !== undefined ? placement : listPlacement,
439
451
  listMaxHeight: listMaxHeight,
440
452
  flipEnabled: flipEnabled,
441
453
  multiselectValues: actualValue,
442
454
  isOpen: isOpen,
443
455
  enableVirtualScroll: enableVirtualScroll,
444
- virtualScrollOverscan: virtualScrollOverscan
456
+ virtualScrollOverscan: virtualScrollOverscan,
457
+ listWidth: listWidth
445
458
  }, children);
446
459
  const marginProps = useFormSpacing(textboxProps);
447
460
  return /*#__PURE__*/React.createElement(StyledSelectMultiSelect, _extends({
@@ -601,7 +614,8 @@ if (process.env.NODE_ENV !== "production") {
601
614
  "leftChildren": PropTypes.node,
602
615
  "list": PropTypes.string,
603
616
  "listMaxHeight": PropTypes.number,
604
- "listPlacement": PropTypes.oneOf(["bottom", "left", "right", "top"]),
617
+ "listPlacement": PropTypes.oneOf(["bottom-end", "bottom-start", "bottom", "top-end", "top-start", "top"]),
618
+ "listWidth": PropTypes.number,
605
619
  "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
606
620
  "__@toStringTag": PropTypes.string.isRequired,
607
621
  "description": PropTypes.string,
@@ -1,17 +1,17 @@
1
1
  import React from "react";
2
2
  import { TagProps } from "../../../__internal__/utils/helpers/tags";
3
- export interface OptionProps extends Omit<React.InputHTMLAttributes<HTMLLIElement>, "value" | "onSelect" | "onClick">, TagProps {
3
+ export interface OptionProps extends Omit<React.InputHTMLAttributes<HTMLLIElement>, "value" | "onSelect" | "onClick">, Omit<TagProps, "data-component"> {
4
4
  /**
5
5
  * Unique identifier for the component.
6
6
  * Will use a randomly generated GUID if none is provided.
7
7
  */
8
8
  id?: string;
9
9
  /** The option's visible text, displayed within `<Textbox>` of `<Select>`, and used for filtering */
10
- text: string;
11
- /** Optional: alternative rendered content, displayed within `<SelectList>` of `<Select>` (eg: an icon, an image, etc) */
10
+ text?: string;
11
+ /** Alternative rendered content, displayed within `<SelectList>` of `<Select>` (eg: an icon, an image, etc) */
12
12
  children?: React.ReactNode;
13
- /** The option's invisible internal value */
14
- value: string | Record<string, unknown>;
13
+ /** The option's invisible internal value, if this is not passed the option will not be treated as interactive or selectable */
14
+ value?: string | Record<string, unknown>;
15
15
  /** MultiSelect only - custom Pill border color - provide any color from palette or any valid css color value. */
16
16
  borderColor?: string;
17
17
  /** MultiSelect only - fill Pill background with color */
@@ -20,11 +20,11 @@ const Option = /*#__PURE__*/React.forwardRef(({
20
20
  const selectListContext = useContext(SelectListContext);
21
21
  let isSelected = selectListContext.currentOptionsListIndex === index;
22
22
  const internalIdRef = useRef(id || guid());
23
- if (selectListContext.multiselectValues) {
23
+ if (selectListContext.multiselectValues && value) {
24
24
  isSelected = selectListContext.multiselectValues.includes(value);
25
25
  }
26
26
  function handleClick() {
27
- if (disabled) {
27
+ if (disabled || !value) {
28
28
  return;
29
29
  }
30
30
  if (!onClick) {
@@ -43,15 +43,16 @@ const Option = /*#__PURE__*/React.forwardRef(({
43
43
  ref: ref,
44
44
  "aria-selected": isSelected,
45
45
  "aria-disabled": disabled,
46
- "data-component": "option",
47
46
  isDisabled: disabled,
48
47
  onClick: handleClick,
49
48
  isHighlighted: selectListContext.currentOptionsListIndex === index,
50
49
  role: "option",
51
50
  hidden: hidden,
52
- style: style
51
+ style: style,
52
+ isInteractive: !!value
53
53
  }, rest, {
54
- fill: undefined
54
+ fill: undefined,
55
+ "data-component": "option"
55
56
  }), children || text);
56
57
  });
57
58
  if (process.env.NODE_ENV !== "production") {
@@ -125,7 +126,6 @@ if (process.env.NODE_ENV !== "production") {
125
126
  "dangerouslySetInnerHTML": PropTypes.shape({
126
127
  "__html": PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired
127
128
  }),
128
- "data-component": PropTypes.string,
129
129
  "data-element": PropTypes.string,
130
130
  "data-role": PropTypes.string,
131
131
  "datatype": PropTypes.string,
@@ -395,7 +395,7 @@ if (process.env.NODE_ENV !== "production") {
395
395
  "suppressContentEditableWarning": PropTypes.bool,
396
396
  "suppressHydrationWarning": PropTypes.bool,
397
397
  "tabIndex": PropTypes.number,
398
- "text": PropTypes.string.isRequired,
398
+ "text": PropTypes.string,
399
399
  "title": PropTypes.string,
400
400
  "translate": PropTypes.oneOf(["no", "yes"]),
401
401
  "type": PropTypes.oneOfType([PropTypes.oneOf(["button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week"]), PropTypes.shape({
@@ -451,7 +451,7 @@ if (process.env.NODE_ENV !== "production") {
451
451
  })]),
452
452
  "typeof": PropTypes.string,
453
453
  "unselectable": PropTypes.oneOf(["off", "on"]),
454
- "value": PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired,
454
+ "value": PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
455
455
  "vocab": PropTypes.string,
456
456
  "width": PropTypes.oneOfType([PropTypes.number, PropTypes.string])
457
457
  };
@@ -2,6 +2,7 @@ import { OptionProps } from ".";
2
2
  interface StyledOptionProps extends Pick<OptionProps, "id"> {
3
3
  isHighlighted?: boolean;
4
4
  isDisabled?: boolean;
5
+ isInteractive: boolean;
5
6
  }
6
7
  declare const StyledOption: import("styled-components").StyledComponent<"li", any, StyledOptionProps, never>;
7
8
  export default StyledOption;
@@ -1,6 +1,5 @@
1
1
  import styled, { css } from "styled-components";
2
2
  const StyledOption = styled.li`
3
- cursor: pointer;
4
3
  box-sizing: border-box;
5
4
  line-height: 16px;
6
5
  padding: 12px 16px;
@@ -12,19 +11,22 @@ const StyledOption = styled.li`
12
11
  width: 100%;
13
12
 
14
13
  ${({
14
+ isInteractive,
15
15
  isHighlighted
16
- }) => isHighlighted && css`
17
- background-color: var(--colorsUtilityMajor200);
16
+ }) => isInteractive && css`
17
+ cursor: pointer;
18
+ :hover {
19
+ background-color: var(--colorsUtilityMajor100);
20
+ }
21
+ ${isHighlighted && css`
22
+ background-color: var(--colorsUtilityMajor200);
23
+ `}
18
24
  `}
19
25
 
20
26
  ${({
21
27
  hidden
22
28
  }) => hidden && "display: none;"}
23
29
 
24
- :hover {
25
- background-color: var(--colorsUtilityMajor100);
26
- }
27
-
28
30
  ${({
29
31
  isDisabled
30
32
  }) => isDisabled && css`
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { CSSProperties } from "styled-components";
3
3
  import { TagProps } from "__internal__/utils/helpers/tags";
4
4
  import { IconProps } from "../../icon";
5
- export interface OptionGroupHeaderProps extends TagProps {
5
+ export interface OptionGroupHeaderProps extends Omit<TagProps, "data-component"> {
6
6
  /**
7
7
  * Unique identifier for the component.
8
8
  * Will use a randomly generated GUID if none is provided.
@@ -21,7 +21,8 @@ const OptionGroupHeader = /*#__PURE__*/React.forwardRef(({
21
21
  style: style,
22
22
  id: internalIdRef.current
23
23
  }, rest, {
24
- ref: ref
24
+ ref: ref,
25
+ "data-component": "option-group-header"
25
26
  }), children || /*#__PURE__*/React.createElement(React.Fragment, null, icon && /*#__PURE__*/React.createElement(Icon, {
26
27
  type: icon
27
28
  }), /*#__PURE__*/React.createElement("h4", null, label)));
@@ -29,7 +30,6 @@ const OptionGroupHeader = /*#__PURE__*/React.forwardRef(({
29
30
  if (process.env.NODE_ENV !== "production") {
30
31
  OptionGroupHeader.propTypes = {
31
32
  "children": PropTypes.node,
32
- "data-component": PropTypes.string,
33
33
  "data-element": PropTypes.string,
34
34
  "data-role": PropTypes.string,
35
35
  "icon": PropTypes.oneOf(["accessibility_web", "add", "admin", "alert_on", "alert", "analysis", "app_facebook", "app_instagram", "app_tiktok", "app_twitter", "app_youtube", "apps", "arrow_bottom_right_circle", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_top_left_circle", "arrow_up", "arrow", "arrows_left_right", "attach", "bank_with_card", "bank", "basket_with_squares", "basket", "bed", "bill_paid", "bill_unpaid", "bin", "biometric", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "box_arrow_right", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_pay_date", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "card_wallet", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "cash", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "check_all", "check_none", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "cloud_co2", "coins", "collaborate", "computer_clock", "connect_off", "connect", "construction", "contact_card", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "dashboard", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "drill", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "export", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "form_refresh", "gift", "go", "graduation_hat", "graph", "grid", "hand_cash_coins", "hand_cash_note", "heart_pulse", "help", "hide", "home", "image", "import", "in_progress", "in_transit", "individual", "info", "intranet", "italic", "job_seeked", "key", "laptop", "leaf", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "like_no", "like", "link_cloud", "link_on", "link", "list_view", "location", "locked", "logout", "lookup", "maintenance", "marker", "message", "messages", "microphone", "minimise", "minus_large", "minus", "mobile", "money_bag", "new", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "percentage_boxed", "person_info", "person_tick", "person", "petrol_pump", "phone", "piggy_bank", "pin", "plane", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "protect", "question_hollow", "question_mark", "question", "recruiting", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "send", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "success", "support_online", "sync", "tag", "talk", "target_man", "target", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "volunteering", "warning", "website", "welfare"]),
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { CSSProperties } from "styled-components";
3
3
  import { TagProps } from "__internal__/utils/helpers/tags";
4
- export interface OptionRowProps extends TagProps {
4
+ export interface OptionRowProps extends Omit<TagProps, "data-component"> {
5
5
  /** The option's visible text, displayed within <Textbox> of <Select> */
6
6
  text: string;
7
7
  /** Row content, should consist of multiple td elements */
@@ -37,19 +37,19 @@ const OptionRow = /*#__PURE__*/React.forwardRef(({
37
37
  ref: ref,
38
38
  "aria-selected": isSelected,
39
39
  "aria-disabled": disabled,
40
- "data-component": "option-row",
41
40
  isDisabled: disabled,
42
41
  onClick: handleClick,
43
42
  isHighlighted: selectListContext.currentOptionsListIndex === index,
44
43
  role: "option",
45
44
  hidden: hidden,
46
45
  style: style
47
- }, rest), children);
46
+ }, rest, {
47
+ "data-component": "option-row"
48
+ }), children);
48
49
  });
49
50
  if (process.env.NODE_ENV !== "production") {
50
51
  OptionRow.propTypes = {
51
52
  "children": PropTypes.node,
52
- "data-component": PropTypes.string,
53
53
  "data-element": PropTypes.string,
54
54
  "data-role": PropTypes.string,
55
55
  "disabled": PropTypes.bool,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { Side } from "@floating-ui/dom";
3
2
  import { FormInputPropTypes } from "../__internal__/select-textbox";
3
+ import { ListPlacement } from "../__internal__/select-list/select-list.component";
4
4
  export interface OptionData {
5
5
  text?: string;
6
6
  value?: string | Record<string, unknown>;
@@ -51,7 +51,7 @@ export interface SimpleSelectProps extends Omit<FormInputPropTypes, "defaultValu
51
51
  /** Maximum list height - defaults to 180 */
52
52
  listMaxHeight?: number;
53
53
  /** Placement of the select list in relation to the input element */
54
- listPlacement?: Side;
54
+ listPlacement?: ListPlacement;
55
55
  /** Use the opposite list placement if the set placement does not fit */
56
56
  flipEnabled?: boolean;
57
57
  /** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
@@ -67,6 +67,8 @@ export interface SimpleSelectProps extends Omit<FormInputPropTypes, "defaultValu
67
67
  isRequired?: boolean;
68
68
  /** Specify a callback triggered on change */
69
69
  onChange?: (ev: CustomSelectChangeEvent | React.ChangeEvent<HTMLInputElement>) => void;
70
+ /** Override the default width of the list element. Number passed is converted into pixel value */
71
+ listWidth?: number;
70
72
  }
71
73
  export declare const SimpleSelect: React.ForwardRefExoticComponent<SimpleSelectProps & React.RefAttributes<HTMLInputElement>>;
72
74
  export default SimpleSelect;