carbon-react 118.1.0 → 118.1.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 (167) hide show
  1. package/esm/__internal__/filter-object-properties/filter-object-properties.d.ts +1 -1
  2. package/esm/components/pager/pager.component.js +5 -5
  3. package/esm/components/pill/pill.component.d.ts +3 -1
  4. package/esm/components/pill/pill.component.js +1 -0
  5. package/esm/components/select/__internal__/select-list-context.d.ts +7 -0
  6. package/esm/components/select/__internal__/select-text/index.d.ts +2 -0
  7. package/esm/components/select/__internal__/select-text/index.js +1 -0
  8. package/esm/components/select/__internal__/select-text/select-text.component.d.ts +33 -0
  9. package/esm/components/select/__internal__/select-text/select-text.component.js +16 -36
  10. package/esm/components/select/__internal__/select-text/select-text.style.d.ts +6 -1
  11. package/esm/components/select/filterable-select/filterable-select.component.d.ts +65 -0
  12. package/esm/components/select/filterable-select/filterable-select.component.js +568 -102
  13. package/esm/components/select/filterable-select/index.d.ts +2 -1
  14. package/esm/components/select/filterable-select/index.js +1 -0
  15. package/esm/components/select/index.d.ts +6 -0
  16. package/esm/components/select/index.js +6 -6
  17. package/esm/components/select/list-action-button/index.d.ts +2 -0
  18. package/esm/components/select/list-action-button/index.js +1 -0
  19. package/esm/components/select/list-action-button/list-action-button.component.d.ts +7 -0
  20. package/esm/components/select/list-action-button/list-action-button.component.js +9 -6
  21. package/esm/components/select/list-action-button/list-action-button.style.d.ts +2 -0
  22. package/esm/components/select/multi-select/index.d.ts +2 -1
  23. package/esm/components/select/multi-select/index.js +1 -0
  24. package/esm/components/select/multi-select/multi-select.component.d.ts +62 -0
  25. package/esm/components/select/multi-select/multi-select.component.js +575 -104
  26. package/esm/components/select/multi-select/multi-select.style.d.ts +4 -0
  27. package/esm/components/select/multi-select/multi-select.style.js +1 -0
  28. package/esm/components/select/option/index.d.ts +2 -25
  29. package/esm/components/select/option/index.js +1 -0
  30. package/esm/components/select/option/option.component.d.ts +34 -0
  31. package/esm/components/select/option/option.component.js +399 -62
  32. package/esm/components/select/option/option.style.d.ts +6 -0
  33. package/esm/components/select/option/option.style.js +0 -5
  34. package/esm/components/select/option-group-header/index.d.ts +2 -10
  35. package/esm/components/select/option-group-header/index.js +1 -0
  36. package/esm/components/select/option-group-header/option-group-header.component.d.ts +16 -0
  37. package/esm/components/select/option-group-header/option-group-header.component.js +4 -15
  38. package/esm/components/select/option-group-header/option-group-header.style.d.ts +2 -0
  39. package/esm/components/select/option-row/index.d.ts +2 -16
  40. package/esm/components/select/option-row/index.js +1 -0
  41. package/esm/components/select/option-row/option-row.component.d.ts +42 -0
  42. package/esm/components/select/option-row/option-row.component.js +10 -40
  43. package/esm/components/select/option-row/option-row.style.d.ts +6 -0
  44. package/esm/components/select/select-list/index.d.ts +2 -0
  45. package/esm/components/select/select-list/index.js +1 -0
  46. package/esm/components/select/select-list/select-list-container.style.d.ts +6 -0
  47. package/esm/components/select/select-list/select-list.component.d.ts +64 -0
  48. package/esm/components/select/select-list/select-list.component.js +69 -100
  49. package/esm/components/select/select-list/select-list.style.d.ts +12 -0
  50. package/esm/components/select/select-list/select-list.style.js +2 -2
  51. package/esm/components/select/select-textbox/index.d.ts +2 -1
  52. package/esm/components/select/select-textbox/index.js +1 -0
  53. package/esm/components/select/select-textbox/select-textbox.component.d.ts +81 -0
  54. package/esm/components/select/select-textbox/select-textbox.component.js +567 -142
  55. package/esm/components/select/select.style.d.ts +8 -0
  56. package/esm/components/select/simple-select/index.d.ts +2 -1
  57. package/esm/components/select/simple-select/index.js +1 -0
  58. package/esm/components/select/simple-select/simple-select.component.d.ts +58 -0
  59. package/esm/components/select/simple-select/simple-select.component.js +578 -111
  60. package/esm/components/select/utils/get-next-child-by-text.d.ts +5 -0
  61. package/esm/components/select/utils/get-next-child-by-text.js +20 -17
  62. package/esm/components/select/utils/get-next-index-by-key.d.ts +2 -0
  63. package/esm/components/select/utils/highlight-part-of-text.d.ts +2 -0
  64. package/esm/components/select/utils/highlight-part-of-text.js +10 -3
  65. package/esm/components/select/utils/is-expected-option.d.ts +2 -0
  66. package/esm/components/select/utils/is-expected-option.js +1 -1
  67. package/esm/components/select/utils/is-expected-value.d.ts +1 -0
  68. package/esm/components/select/utils/is-expected-value.js +1 -1
  69. package/esm/components/select/utils/is-navigation-key.d.ts +1 -0
  70. package/esm/components/select/utils/matching-text.style.d.ts +2 -0
  71. package/esm/components/select/utils/with-filter.hoc.d.ts +14 -0
  72. package/esm/components/select/utils/with-filter.hoc.js +59 -41
  73. package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +1 -0
  74. package/lib/__internal__/filter-object-properties/filter-object-properties.d.ts +1 -1
  75. package/lib/components/pager/pager.component.js +5 -5
  76. package/lib/components/pill/pill.component.d.ts +3 -1
  77. package/lib/components/pill/pill.component.js +1 -0
  78. package/lib/components/select/__internal__/select-list-context.d.ts +7 -0
  79. package/lib/components/select/__internal__/select-text/index.d.ts +2 -0
  80. package/lib/components/select/__internal__/select-text/index.js +15 -0
  81. package/lib/components/select/__internal__/select-text/package.json +6 -0
  82. package/lib/components/select/__internal__/select-text/select-text.component.d.ts +33 -0
  83. package/lib/components/select/__internal__/select-text/select-text.component.js +16 -36
  84. package/lib/components/select/__internal__/select-text/select-text.style.d.ts +6 -1
  85. package/lib/components/select/filterable-select/filterable-select.component.d.ts +65 -0
  86. package/lib/components/select/filterable-select/filterable-select.component.js +569 -103
  87. package/lib/components/select/filterable-select/index.d.ts +2 -1
  88. package/lib/components/select/filterable-select/index.js +15 -0
  89. package/lib/components/select/filterable-select/package.json +6 -0
  90. package/lib/components/select/index.d.ts +6 -0
  91. package/lib/components/select/index.js +6 -6
  92. package/lib/components/select/list-action-button/index.d.ts +2 -0
  93. package/lib/components/select/list-action-button/index.js +15 -0
  94. package/lib/components/select/list-action-button/list-action-button.component.d.ts +7 -0
  95. package/lib/components/select/list-action-button/list-action-button.component.js +9 -6
  96. package/lib/components/select/list-action-button/list-action-button.style.d.ts +2 -0
  97. package/lib/components/select/list-action-button/package.json +6 -0
  98. package/lib/components/select/multi-select/index.d.ts +2 -1
  99. package/lib/components/select/multi-select/index.js +15 -0
  100. package/lib/components/select/multi-select/multi-select.component.d.ts +62 -0
  101. package/lib/components/select/multi-select/multi-select.component.js +576 -105
  102. package/lib/components/select/multi-select/multi-select.style.d.ts +4 -0
  103. package/lib/components/select/multi-select/multi-select.style.js +1 -0
  104. package/lib/components/select/multi-select/package.json +6 -0
  105. package/lib/components/select/option/index.d.ts +2 -25
  106. package/lib/components/select/option/index.js +15 -0
  107. package/lib/components/select/option/option.component.d.ts +34 -0
  108. package/lib/components/select/option/option.component.js +399 -62
  109. package/lib/components/select/option/option.style.d.ts +6 -0
  110. package/lib/components/select/option/option.style.js +0 -8
  111. package/lib/components/select/option/package.json +6 -0
  112. package/lib/components/select/option-group-header/index.d.ts +2 -10
  113. package/lib/components/select/option-group-header/index.js +15 -0
  114. package/lib/components/select/option-group-header/option-group-header.component.d.ts +16 -0
  115. package/lib/components/select/option-group-header/option-group-header.component.js +4 -15
  116. package/lib/components/select/option-group-header/option-group-header.style.d.ts +2 -0
  117. package/lib/components/select/option-group-header/package.json +6 -0
  118. package/lib/components/select/option-row/index.d.ts +2 -16
  119. package/lib/components/select/option-row/index.js +15 -0
  120. package/lib/components/select/option-row/option-row.component.d.ts +42 -0
  121. package/lib/components/select/option-row/option-row.component.js +10 -40
  122. package/lib/components/select/option-row/option-row.style.d.ts +6 -0
  123. package/lib/components/select/option-row/package.json +6 -0
  124. package/lib/components/select/select-list/index.d.ts +2 -0
  125. package/lib/components/select/select-list/index.js +15 -0
  126. package/lib/components/select/select-list/package.json +6 -0
  127. package/lib/components/select/select-list/select-list-container.style.d.ts +6 -0
  128. package/lib/components/select/select-list/select-list.component.d.ts +64 -0
  129. package/lib/components/select/select-list/select-list.component.js +69 -100
  130. package/lib/components/select/select-list/select-list.style.d.ts +12 -0
  131. package/lib/components/select/select-list/select-list.style.js +2 -2
  132. package/lib/components/select/select-textbox/index.d.ts +2 -1
  133. package/lib/components/select/select-textbox/index.js +15 -0
  134. package/lib/components/select/select-textbox/package.json +6 -0
  135. package/lib/components/select/select-textbox/select-textbox.component.d.ts +81 -0
  136. package/lib/components/select/select-textbox/select-textbox.component.js +567 -142
  137. package/lib/components/select/select.style.d.ts +8 -0
  138. package/lib/components/select/simple-select/index.d.ts +2 -1
  139. package/lib/components/select/simple-select/index.js +15 -0
  140. package/lib/components/select/simple-select/package.json +6 -0
  141. package/lib/components/select/simple-select/simple-select.component.d.ts +58 -0
  142. package/lib/components/select/simple-select/simple-select.component.js +579 -113
  143. package/lib/components/select/utils/get-next-child-by-text.d.ts +5 -0
  144. package/lib/components/select/utils/get-next-child-by-text.js +20 -17
  145. package/lib/components/select/utils/get-next-index-by-key.d.ts +2 -0
  146. package/lib/components/select/utils/highlight-part-of-text.d.ts +2 -0
  147. package/lib/components/select/utils/highlight-part-of-text.js +10 -3
  148. package/lib/components/select/utils/is-expected-option.d.ts +2 -0
  149. package/lib/components/select/utils/is-expected-option.js +1 -1
  150. package/lib/components/select/utils/is-expected-value.d.ts +1 -0
  151. package/lib/components/select/utils/is-expected-value.js +1 -1
  152. package/lib/components/select/utils/is-navigation-key.d.ts +1 -0
  153. package/lib/components/select/utils/matching-text.style.d.ts +2 -0
  154. package/lib/components/select/utils/with-filter.hoc.d.ts +14 -0
  155. package/lib/components/select/utils/with-filter.hoc.js +59 -42
  156. package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +1 -0
  157. package/package.json +1 -1
  158. package/esm/components/select/__internal__/select-text/select-text.d.ts +0 -36
  159. package/esm/components/select/filterable-select/filterable-select.d.ts +0 -71
  160. package/esm/components/select/multi-select/multi-select.d.ts +0 -68
  161. package/esm/components/select/select-textbox/select-textbox.d.ts +0 -72
  162. package/esm/components/select/simple-select/simple-select.d.ts +0 -64
  163. package/lib/components/select/__internal__/select-text/select-text.d.ts +0 -36
  164. package/lib/components/select/filterable-select/filterable-select.d.ts +0 -71
  165. package/lib/components/select/multi-select/multi-select.d.ts +0 -68
  166. package/lib/components/select/select-textbox/select-textbox.d.ts +0 -72
  167. package/lib/components/select/simple-select/simple-select.d.ts +0 -64
@@ -1 +1 @@
1
- export default function filterObjectProperties(originalObject: any, keyList: any): {};
1
+ export default function filterObjectProperties<T extends object>(originalObject: T, keyList: string[]): Partial<T>;
@@ -101,12 +101,12 @@ const Pager = ({
101
101
  onPrevious(e);
102
102
  }
103
103
  }, [page, onPrevious]);
104
- const handleOnPagination = useCallback(e => {
105
- setValue(e.target.value);
106
- setCurrentPageSize(+e.target.value);
107
- onPagination(1, +e.target.value, "page-select");
104
+ const handleOnPagination = useCallback(selectedValue => {
105
+ setValue(selectedValue);
106
+ setCurrentPageSize(+selectedValue);
107
+ onPagination(1, +selectedValue, "page-select");
108
108
  }, [onPagination]);
109
- const handleKeyDown = useCallback(e => Events.isEnterKey(e) && handleOnPagination(e), [handleOnPagination]);
109
+ const handleKeyDown = useCallback(e => Events.isEnterKey(e) && handleOnPagination(e.target.value), [handleOnPagination]);
110
110
 
111
111
  const sizeSelector = () => {
112
112
  return /*#__PURE__*/React.createElement(StyledSelectContainer, null, /*#__PURE__*/React.createElement(Select, {
@@ -14,11 +14,13 @@ export interface PillProps extends StyledPillProps {
14
14
  /** Callback function for when the pill is clicked. */
15
15
  onClick?: (ev: React.MouseEvent<HTMLSpanElement>) => void;
16
16
  /** Callback function for when the remove icon is clicked. */
17
- onDelete?: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
17
+ onDelete?: (ev?: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
18
18
  /** Sets the type of pill in use. */
19
19
  pillRole?: "tag" | "status";
20
20
  /** Sets custom aria-label attribute on the remove button */
21
21
  ariaLabelOfRemoveButton?: string;
22
+ /** @private @ignore title attribute passed down to underlying element */
23
+ title?: string;
22
24
  }
23
25
  export declare const Pill: ({ wrapText, borderColor, colorVariant, children, fill, maxWidth, onClick, onDelete, pillRole, size, ariaLabelOfRemoveButton, ...rest }: PillProps) => JSX.Element;
24
26
  export default Pill;
@@ -247,6 +247,7 @@ Pill.propTypes = {
247
247
  "smallOverlay": PropTypes.number.isRequired
248
248
  })
249
249
  }),
250
+ "title": PropTypes.string,
250
251
  "wrapText": PropTypes.bool
251
252
  };
252
253
  export { Pill };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ declare type SelectListContextProps = {
3
+ currentOptionsListIndex?: number;
4
+ multiselectValues?: (string | Record<string, unknown>)[];
5
+ };
6
+ declare const SelectListContext: React.Context<SelectListContextProps>;
7
+ export default SelectListContext;
@@ -0,0 +1,2 @@
1
+ export { default } from "./select-text.component";
2
+ export type { SelectTextProps } from "./select-text.component";
@@ -0,0 +1 @@
1
+ export { default } from "./select-text.component";
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ export interface SelectTextProps {
3
+ /** If true the Component will be disabled */
4
+ disabled?: boolean;
5
+ /** Value to be displayed */
6
+ formattedValue?: string;
7
+ /** Label id passed from Select component */
8
+ labelId?: string;
9
+ /** If true, the list is displayed */
10
+ isOpen?: boolean;
11
+ /** Callback function for when the Select Textbox loses it's focus. */
12
+ onBlur?: (ev: React.FocusEvent<HTMLElement>) => void;
13
+ /** Callback function for when the component is clicked. */
14
+ onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
15
+ /** Callback function for when the Select Textbox is focused. */
16
+ onFocus?: (ev: React.FocusEvent<HTMLElement>) => void;
17
+ /** Callback function for when the key is pressed when focused on Select Text. */
18
+ onKeyDown?: (ev: React.KeyboardEvent<HTMLElement>) => void;
19
+ /** Callback function for when the left mouse key is pressed when focused on Select Text. */
20
+ onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
21
+ /** Placeholder string to be displayed when formattedValue is empty */
22
+ placeholder?: string;
23
+ /** If true the Component will be read-only */
24
+ readOnly?: boolean;
25
+ /** If true the component has no border and a transparent background */
26
+ transparent?: boolean;
27
+ /** Id of the Select Text element */
28
+ textId?: string;
29
+ /** Component size */
30
+ size?: "small" | "medium" | "large";
31
+ }
32
+ declare const SelectText: ({ disabled, formattedValue, onClick, onKeyDown, onMouseDown, placeholder, readOnly, textId, transparent, size, }: SelectTextProps) => JSX.Element;
33
+ export default SelectText;
@@ -15,57 +15,37 @@ const SelectText = ({
15
15
  size = "medium"
16
16
  }) => {
17
17
  const hasPlaceholder = !disabled && !readOnly && !formattedValue;
18
-
19
- function handleClick(event) {
20
- onClick(event);
21
- }
22
-
23
18
  return /*#__PURE__*/React.createElement(StyledSelectText, {
24
19
  "aria-hidden": true,
25
20
  "data-element": "select-text",
26
21
  disabled: disabled,
27
22
  hasPlaceholder: hasPlaceholder,
28
23
  id: textId,
29
- onClick: handleClick,
24
+ onClick: onClick,
30
25
  onKeyDown: onKeyDown,
31
26
  onMouseDown: onMouseDown,
32
27
  readOnly: readOnly,
33
28
  role: "button",
34
- tabIndex: "-1",
29
+ tabIndex: -1,
35
30
  transparent: transparent,
36
31
  size: size
37
32
  }, hasPlaceholder ? placeholder : formattedValue);
38
33
  };
39
34
 
40
35
  SelectText.propTypes = {
41
- /** If true the Component will be disabled */
42
- disabled: PropTypes.bool,
43
-
44
- /** Value to be displayed */
45
- formattedValue: PropTypes.string,
46
-
47
- /** Callback function for when the component is clicked. */
48
- onClick: PropTypes.func,
49
-
50
- /** Callback function for when the key is pressed when focused on Select Text. */
51
- onKeyDown: PropTypes.func,
52
-
53
- /** Callback function for when the left mouse key is pressed when focused on Select Text. */
54
- onMouseDown: PropTypes.func,
55
-
56
- /** Placeholder string to be displayed when formattedValue is empty */
57
- placeholder: PropTypes.string,
58
-
59
- /** If true the Component will be read-only */
60
- readOnly: PropTypes.bool,
61
-
62
- /** If true the component has no border and a transparent background */
63
- transparent: PropTypes.bool,
64
-
65
- /** Id of the Select Text element */
66
- textId: PropTypes.string,
67
-
68
- /** Component size */
69
- size: PropTypes.string
36
+ "disabled": PropTypes.bool,
37
+ "formattedValue": PropTypes.string,
38
+ "isOpen": PropTypes.bool,
39
+ "labelId": PropTypes.string,
40
+ "onBlur": PropTypes.func,
41
+ "onClick": PropTypes.func,
42
+ "onFocus": PropTypes.func,
43
+ "onKeyDown": PropTypes.func,
44
+ "onMouseDown": PropTypes.func,
45
+ "placeholder": PropTypes.string,
46
+ "readOnly": PropTypes.bool,
47
+ "size": PropTypes.oneOf(["large", "medium", "small"]),
48
+ "textId": PropTypes.string,
49
+ "transparent": PropTypes.bool
70
50
  };
71
51
  export default SelectText;
@@ -1,2 +1,7 @@
1
+ import { SelectTextProps } from ".";
2
+ interface StyledSelectTextProps extends Pick<SelectTextProps, "disabled" | "readOnly" | "transparent"> {
3
+ hasPlaceholder: boolean;
4
+ size: NonNullable<SelectTextProps["size"]>;
5
+ }
6
+ declare const StyledSelectText: import("styled-components").StyledComponent<"span", any, StyledSelectTextProps, never>;
1
7
  export default StyledSelectText;
2
- declare const StyledSelectText: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,65 @@
1
+ import React from "react";
2
+ import { Side } from "@floating-ui/dom";
3
+ import { ButtonProps } from "../../button";
4
+ import { FormInputPropTypes } from "../select-textbox";
5
+ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "defaultValue" | "value"> {
6
+ /** Prop to specify the aria-label attribute of the component input */
7
+ "aria-label"?: string;
8
+ /** Prop to specify the aria-labeledby property of the component input */
9
+ "aria-labelledby"?: string;
10
+ /** Identifier used for testing purposes, applied to the root element of the component. */
11
+ "data-component"?: string;
12
+ /** Identifier used for testing purposes, applied to the root element of the component. */
13
+ "data-element"?: string;
14
+ /** Identifier used for testing purposes, applied to the root element of the component. */
15
+ "data-role"?: string;
16
+ /** Child components (such as Option or OptionRow) for the SelectList */
17
+ children: React.ReactNode;
18
+ /** The default selected value(s), when the component is operating in uncontrolled mode */
19
+ defaultValue?: string | Record<string, unknown>;
20
+ /** Boolean to toggle where SelectList is rendered in relation to the Select Input */
21
+ disablePortal?: boolean;
22
+ /** If true the loader animation is displayed in the option list */
23
+ isLoading?: boolean;
24
+ /** True for default text button or a Button Component to be rendered */
25
+ listActionButton?: boolean | React.ReactElement<ButtonProps>;
26
+ /** When true component will work in multi column mode.
27
+ * Children should consist of OptionRow components in this mode
28
+ */
29
+ multiColumn?: boolean;
30
+ /** A custom message to be displayed when any option does not match the filter text */
31
+ noResultsMessage?: string;
32
+ /** A custom callback for when the input text changes */
33
+ onFilterChange?: (filterText: string) => void;
34
+ /** A custom callback for when the dropdown menu opens */
35
+ onOpen?: () => void;
36
+ /** A callback for when the Action Button is triggered */
37
+ onListAction?: () => void;
38
+ /** A callback that is triggered when a user scrolls to the bottom of the list */
39
+ onListScrollBottom?: () => void;
40
+ /** If true the Component opens on focus */
41
+ openOnFocus?: boolean;
42
+ /** SelectList table header, should consist of multiple th elements.
43
+ * Works only in multiColumn mode
44
+ */
45
+ tableHeader?: React.ReactNode;
46
+ /** The selected value(s), when the component is operating in controlled mode */
47
+ value?: string | Record<string, unknown>;
48
+ /** Overrides the default tooltip position */
49
+ tooltipPosition?: "top" | "bottom" | "left" | "right";
50
+ /** Maximum list height - defaults to 180 */
51
+ listMaxHeight?: number;
52
+ /** Placement of the select list in relation to the input element */
53
+ listPlacement?: Side;
54
+ /** Use the opposite list placement if the set placement does not fit */
55
+ flipEnabled?: boolean;
56
+ /** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
57
+ * DOM at all times, which may cause performance problems on very large lists */
58
+ enableVirtualScroll?: boolean;
59
+ /** The number of options to render into the DOM at once, either side of the currently-visible ones.
60
+ * Higher values make for smoother scrolling but may impact performance.
61
+ * Only used if the `enableVirtualScroll` prop is set. */
62
+ virtualScrollOverscan?: number;
63
+ }
64
+ export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<unknown>>;
65
+ export default FilterableSelect;