carbon-react 119.7.1 → 119.8.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.
Files changed (29) hide show
  1. package/esm/__internal__/checkable-input/checkable-input.component.d.ts +2 -0
  2. package/esm/__internal__/checkable-input/checkable-input.component.js +3 -0
  3. package/esm/__internal__/form-field/form-field.component.d.ts +3 -1
  4. package/esm/__internal__/form-field/form-field.component.js +2 -1
  5. package/esm/components/checkbox/checkbox.component.js +1 -0
  6. package/esm/components/radio-button/radio-button.component.js +1 -0
  7. package/esm/components/select/option/option.component.d.ts +7 -1
  8. package/esm/components/select/option/option.component.js +3 -0
  9. package/esm/components/select/option-group-header/option-group-header.component.d.ts +7 -1
  10. package/esm/components/select/option-group-header/option-group-header.component.js +4 -0
  11. package/esm/components/select/option-row/option-row.component.d.ts +6 -6
  12. package/esm/components/select/option-row/option-row.component.js +4 -1
  13. package/esm/components/select/select-list/select-list.component.js +1 -1
  14. package/esm/components/switch/switch.component.js +2 -0
  15. package/lib/__internal__/checkable-input/checkable-input.component.d.ts +2 -0
  16. package/lib/__internal__/checkable-input/checkable-input.component.js +3 -0
  17. package/lib/__internal__/form-field/form-field.component.d.ts +3 -1
  18. package/lib/__internal__/form-field/form-field.component.js +2 -1
  19. package/lib/components/checkbox/checkbox.component.js +1 -0
  20. package/lib/components/radio-button/radio-button.component.js +1 -0
  21. package/lib/components/select/option/option.component.d.ts +7 -1
  22. package/lib/components/select/option/option.component.js +3 -0
  23. package/lib/components/select/option-group-header/option-group-header.component.d.ts +7 -1
  24. package/lib/components/select/option-group-header/option-group-header.component.js +4 -0
  25. package/lib/components/select/option-row/option-row.component.d.ts +6 -6
  26. package/lib/components/select/option-row/option-row.component.js +4 -1
  27. package/lib/components/select/select-list/select-list.component.js +1 -1
  28. package/lib/components/switch/switch.component.js +2 -0
  29. package/package.json +1 -1
@@ -4,6 +4,8 @@ import { ValidationProps } from "../validations";
4
4
  export interface CommonCheckableInputProps extends ValidationProps, CommonHiddenCheckableInputProps {
5
5
  /** If true, the component will be disabled */
6
6
  disabled?: boolean;
7
+ /** @private @ignore */
8
+ loading?: boolean;
7
9
  /** Help content to be displayed under an input */
8
10
  fieldHelp?: React.ReactNode;
9
11
  /**
@@ -14,6 +14,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
14
14
  checked,
15
15
  children,
16
16
  disabled,
17
+ loading,
17
18
  error,
18
19
  fieldHelp,
19
20
  fieldHelpInline,
@@ -57,6 +58,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
57
58
  const isRadio = type === "radio";
58
59
  const formFieldProps = {
59
60
  disabled,
61
+ loading,
60
62
  error,
61
63
  fieldHelp,
62
64
  fieldHelpInline,
@@ -217,6 +219,7 @@ CheckableInput.propTypes = {
217
219
  "labelWidth": PropTypes.number,
218
220
  "lang": PropTypes.string,
219
221
  "list": PropTypes.string,
222
+ "loading": PropTypes.bool,
220
223
  "max": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
221
224
  "maxLength": PropTypes.number,
222
225
  "min": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -7,6 +7,8 @@ import { IconType } from "../../components/icon";
7
7
  interface CommonFormFieldProps extends MarginProps, ValidationProps {
8
8
  /** If true, the component will be disabled */
9
9
  disabled?: boolean;
10
+ /** @private @ignore */
11
+ loading?: boolean;
10
12
  /** Help content to be displayed under an input */
11
13
  fieldHelp?: React.ReactNode;
12
14
  /** The unique id of the Help component tooltip, used for accessibility */
@@ -59,7 +61,7 @@ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
59
61
  useValidationIcon?: boolean;
60
62
  }
61
63
  declare const FormField: {
62
- ({ children, "data-component": dataComponent, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, labelAs, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, validationRedesignOptIn, ...rest }: FormFieldProps): React.JSX.Element;
64
+ ({ children, "data-component": dataComponent, disabled, loading, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, labelAs, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, validationRedesignOptIn, ...rest }: FormFieldProps): React.JSX.Element;
63
65
  displayName: string;
64
66
  };
65
67
  export default FormField;
@@ -14,6 +14,7 @@ const FormField = _ref => {
14
14
  children,
15
15
  "data-component": dataComponent,
16
16
  disabled,
17
+ loading,
17
18
  fieldHelp: fieldHelpContent,
18
19
  fieldHelpInline,
19
20
  error,
@@ -46,7 +47,7 @@ const FormField = _ref => {
46
47
  warning: !!warning,
47
48
  info: !!info
48
49
  };
49
- if (!disabled) return undefined;
50
+ if (!(disabled && !loading)) return undefined;
50
51
  return Object.keys(validationProps).find(propName => validationProps[propName]);
51
52
  }, [error, warning, info, disabled]);
52
53
  !(invalidValidationProp === undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Prop \`${invalidValidationProp}\` cannot be used in conjunction with \`disabled\`. ` + "Use `readOnly` if you require users to see validations with a non-interactive field") : invariant(false) : void 0;
@@ -235,6 +235,7 @@ Checkbox.propTypes = {
235
235
  "labelWidth": PropTypes.number,
236
236
  "lang": PropTypes.string,
237
237
  "list": PropTypes.string,
238
+ "loading": PropTypes.bool,
238
239
  "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
239
240
  "__@toStringTag": PropTypes.string.isRequired,
240
241
  "description": PropTypes.string,
@@ -240,6 +240,7 @@ RadioButton.propTypes = {
240
240
  "labelWidth": PropTypes.number,
241
241
  "lang": PropTypes.string,
242
242
  "list": PropTypes.string,
243
+ "loading": PropTypes.bool,
243
244
  "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
244
245
  "__@toStringTag": PropTypes.string.isRequired,
245
246
  "description": PropTypes.string,
@@ -1,5 +1,11 @@
1
1
  import React from "react";
2
- export interface OptionProps extends Omit<React.InputHTMLAttributes<HTMLLIElement>, "value" | "onSelect" | "onClick"> {
2
+ import { TagProps } from "__internal__/utils/helpers/tags";
3
+ export interface OptionProps extends Omit<React.InputHTMLAttributes<HTMLLIElement>, "value" | "onSelect" | "onClick">, TagProps {
4
+ /**
5
+ * Unique identifier for the component.
6
+ * Will use a randomly generated GUID if none is provided.
7
+ */
8
+ id?: string;
3
9
  /** The option's visible text, displayed within <Textbox> of <Select>, and used for filtering */
4
10
  text: string;
5
11
  /** Optional: alternative rendered content, displayed within <SelectList> of <Select> (eg: an icon, an image, etc) */
@@ -116,6 +116,9 @@ Option.propTypes = {
116
116
  "dangerouslySetInnerHTML": PropTypes.shape({
117
117
  "__html": PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired
118
118
  }),
119
+ "data-component": PropTypes.string,
120
+ "data-element": PropTypes.string,
121
+ "data-role": PropTypes.string,
119
122
  "datatype": PropTypes.string,
120
123
  "defaultChecked": PropTypes.bool,
121
124
  "defaultValue": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.number, PropTypes.string]),
@@ -1,7 +1,13 @@
1
1
  import React from "react";
2
2
  import { CSSProperties } from "styled-components";
3
+ import { TagProps } from "__internal__/utils/helpers/tags";
3
4
  import { IconProps } from "../../icon";
4
- export interface OptionGroupHeaderProps {
5
+ export interface OptionGroupHeaderProps extends TagProps {
6
+ /**
7
+ * Unique identifier for the component.
8
+ * Will use a randomly generated GUID if none is provided.
9
+ */
10
+ id?: string;
5
11
  /** Heading text */
6
12
  label: string;
7
13
  /** Any valid Carbon icon name */
@@ -19,7 +19,11 @@ const OptionGroupHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
19
19
  }), /*#__PURE__*/React.createElement("h4", null, label));
20
20
  });
21
21
  OptionGroupHeader.propTypes = {
22
+ "data-component": PropTypes.string,
23
+ "data-element": PropTypes.string,
24
+ "data-role": PropTypes.string,
22
25
  "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", "bin", "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", "coins", "collaborate", "computer_clock", "connect_off", "connect", "construction", "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", "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", "in_progress", "in_transit", "individual", "info", "intranet", "italic", "job_seeked", "key", "laptop", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "like", "link_cloud", "link_on", "link", "list_view", "location", "locked", "logout", "lookup", "maintenance", "marker", "message", "messages", "microphone", "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", "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"]),
26
+ "id": PropTypes.string,
23
27
  "label": PropTypes.string.isRequired,
24
28
  "style": PropTypes.object
25
29
  };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { CSSProperties } from "styled-components";
3
- export interface OptionRowProps {
3
+ import { TagProps } from "__internal__/utils/helpers/tags";
4
+ export interface OptionRowProps extends TagProps {
4
5
  /** The option's visible text, displayed within <Textbox> of <Select> */
5
6
  text: string;
6
7
  /** Row content, should consist of multiple td elements */
@@ -8,17 +9,16 @@ export interface OptionRowProps {
8
9
  /** The option's invisible internal value */
9
10
  value: string | Record<string, unknown>;
10
11
  /**
11
- * @private
12
- * @ignore
13
- * Component id (prop added by the SelectList component)
12
+ * Unique identifier for the component.
13
+ * Will use a randomly generated GUID if none is provided.
14
14
  */
15
- id: string;
15
+ id?: string;
16
16
  /**
17
17
  * @private
18
18
  * @ignore
19
19
  * Callback to return value when the element is selected (prop added by the SelectList component) */
20
20
  onSelect?: (ev: {
21
- id: string;
21
+ id?: string;
22
22
  text: string;
23
23
  value: string | Record<string, unknown>;
24
24
  }) => void;
@@ -41,8 +41,11 @@ const OptionRow = /*#__PURE__*/React.forwardRef((_ref, ref) => {
41
41
  });
42
42
  OptionRow.propTypes = {
43
43
  "children": PropTypes.node,
44
+ "data-component": PropTypes.string,
45
+ "data-element": PropTypes.string,
46
+ "data-role": PropTypes.string,
44
47
  "hidden": PropTypes.bool,
45
- "id": PropTypes.string.isRequired,
48
+ "id": PropTypes.string,
46
49
  "index": PropTypes.number,
47
50
  "onSelect": PropTypes.func,
48
51
  "style": PropTypes.object,
@@ -102,7 +102,7 @@ const SelectList = /*#__PURE__*/React.forwardRef((_ref, listContainerRef) => {
102
102
  // childIds should be stable except when children are added or removed - can't use useMemo
103
103
  // as that isn't absolutely guaranteed to never rerun when dependencies haven't changed.
104
104
  const setChildIds = () => {
105
- childIdsRef.current = React.Children.map(children, () => guid()) || /* istanbul ignore next */null;
105
+ childIdsRef.current = React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) && child?.props.id || guid()) || /* istanbul ignore next */null;
106
106
  };
107
107
  if (childIdsRef.current?.length !== React.Children.count(children)) {
108
108
  setChildIds();
@@ -99,6 +99,7 @@ const Switch = /*#__PURE__*/React.forwardRef((_ref, ref) => {
99
99
  warning,
100
100
  info,
101
101
  disabled: disabled || loading,
102
+ loading,
102
103
  checked: isControlled ? checked : checkedInternal,
103
104
  label,
104
105
  labelHelp,
@@ -143,6 +144,7 @@ const Switch = /*#__PURE__*/React.forwardRef((_ref, ref) => {
143
144
  error,
144
145
  warning,
145
146
  disabled: disabled || loading,
147
+ loading,
146
148
  checked: isControlled ? checked : checkedInternal,
147
149
  onBlur,
148
150
  onFocus,
@@ -4,6 +4,8 @@ import { ValidationProps } from "../validations";
4
4
  export interface CommonCheckableInputProps extends ValidationProps, CommonHiddenCheckableInputProps {
5
5
  /** If true, the component will be disabled */
6
6
  disabled?: boolean;
7
+ /** @private @ignore */
8
+ loading?: boolean;
7
9
  /** Help content to be displayed under an input */
8
10
  fieldHelp?: React.ReactNode;
9
11
  /**
@@ -23,6 +23,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
23
23
  checked,
24
24
  children,
25
25
  disabled,
26
+ loading,
26
27
  error,
27
28
  fieldHelp,
28
29
  fieldHelpInline,
@@ -66,6 +67,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
66
67
  const isRadio = type === "radio";
67
68
  const formFieldProps = {
68
69
  disabled,
70
+ loading,
69
71
  error,
70
72
  fieldHelp,
71
73
  fieldHelpInline,
@@ -226,6 +228,7 @@ CheckableInput.propTypes = {
226
228
  "labelWidth": _propTypes.default.number,
227
229
  "lang": _propTypes.default.string,
228
230
  "list": _propTypes.default.string,
231
+ "loading": _propTypes.default.bool,
229
232
  "max": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
230
233
  "maxLength": _propTypes.default.number,
231
234
  "min": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
@@ -7,6 +7,8 @@ import { IconType } from "../../components/icon";
7
7
  interface CommonFormFieldProps extends MarginProps, ValidationProps {
8
8
  /** If true, the component will be disabled */
9
9
  disabled?: boolean;
10
+ /** @private @ignore */
11
+ loading?: boolean;
10
12
  /** Help content to be displayed under an input */
11
13
  fieldHelp?: React.ReactNode;
12
14
  /** The unique id of the Help component tooltip, used for accessibility */
@@ -59,7 +61,7 @@ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
59
61
  useValidationIcon?: boolean;
60
62
  }
61
63
  declare const FormField: {
62
- ({ children, "data-component": dataComponent, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, labelAs, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, validationRedesignOptIn, ...rest }: FormFieldProps): React.JSX.Element;
64
+ ({ children, "data-component": dataComponent, disabled, loading, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, labelAs, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, validationRedesignOptIn, ...rest }: FormFieldProps): React.JSX.Element;
63
65
  displayName: string;
64
66
  };
65
67
  export default FormField;
@@ -23,6 +23,7 @@ const FormField = _ref => {
23
23
  children,
24
24
  "data-component": dataComponent,
25
25
  disabled,
26
+ loading,
26
27
  fieldHelp: fieldHelpContent,
27
28
  fieldHelpInline,
28
29
  error,
@@ -55,7 +56,7 @@ const FormField = _ref => {
55
56
  warning: !!warning,
56
57
  info: !!info
57
58
  };
58
- if (!disabled) return undefined;
59
+ if (!(disabled && !loading)) return undefined;
59
60
  return Object.keys(validationProps).find(propName => validationProps[propName]);
60
61
  }, [error, warning, info, disabled]);
61
62
  !(invalidValidationProp === undefined) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, `Prop \`${invalidValidationProp}\` cannot be used in conjunction with \`disabled\`. ` + "Use `readOnly` if you require users to see validations with a non-interactive field") : (0, _invariant.default)(false) : void 0;
@@ -245,6 +245,7 @@ Checkbox.propTypes = {
245
245
  "labelWidth": _propTypes.default.number,
246
246
  "lang": _propTypes.default.string,
247
247
  "list": _propTypes.default.string,
248
+ "loading": _propTypes.default.bool,
248
249
  "m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
249
250
  "__@toStringTag": _propTypes.default.string.isRequired,
250
251
  "description": _propTypes.default.string,
@@ -250,6 +250,7 @@ RadioButton.propTypes = {
250
250
  "labelWidth": _propTypes.default.number,
251
251
  "lang": _propTypes.default.string,
252
252
  "list": _propTypes.default.string,
253
+ "loading": _propTypes.default.bool,
253
254
  "m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
254
255
  "__@toStringTag": _propTypes.default.string.isRequired,
255
256
  "description": _propTypes.default.string,
@@ -1,5 +1,11 @@
1
1
  import React from "react";
2
- export interface OptionProps extends Omit<React.InputHTMLAttributes<HTMLLIElement>, "value" | "onSelect" | "onClick"> {
2
+ import { TagProps } from "__internal__/utils/helpers/tags";
3
+ export interface OptionProps extends Omit<React.InputHTMLAttributes<HTMLLIElement>, "value" | "onSelect" | "onClick">, TagProps {
4
+ /**
5
+ * Unique identifier for the component.
6
+ * Will use a randomly generated GUID if none is provided.
7
+ */
8
+ id?: string;
3
9
  /** The option's visible text, displayed within <Textbox> of <Select>, and used for filtering */
4
10
  text: string;
5
11
  /** Optional: alternative rendered content, displayed within <SelectList> of <Select> (eg: an icon, an image, etc) */
@@ -125,6 +125,9 @@ Option.propTypes = {
125
125
  "dangerouslySetInnerHTML": _propTypes.default.shape({
126
126
  "__html": _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]).isRequired
127
127
  }),
128
+ "data-component": _propTypes.default.string,
129
+ "data-element": _propTypes.default.string,
130
+ "data-role": _propTypes.default.string,
128
131
  "datatype": _propTypes.default.string,
129
132
  "defaultChecked": _propTypes.default.bool,
130
133
  "defaultValue": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.number, _propTypes.default.string]),
@@ -1,7 +1,13 @@
1
1
  import React from "react";
2
2
  import { CSSProperties } from "styled-components";
3
+ import { TagProps } from "__internal__/utils/helpers/tags";
3
4
  import { IconProps } from "../../icon";
4
- export interface OptionGroupHeaderProps {
5
+ export interface OptionGroupHeaderProps extends TagProps {
6
+ /**
7
+ * Unique identifier for the component.
8
+ * Will use a randomly generated GUID if none is provided.
9
+ */
10
+ id?: string;
5
11
  /** Heading text */
6
12
  label: string;
7
13
  /** Any valid Carbon icon name */
@@ -26,7 +26,11 @@ const OptionGroupHeader = /*#__PURE__*/_react.default.forwardRef((_ref, ref) =>
26
26
  }), /*#__PURE__*/_react.default.createElement("h4", null, label));
27
27
  });
28
28
  OptionGroupHeader.propTypes = {
29
+ "data-component": _propTypes.default.string,
30
+ "data-element": _propTypes.default.string,
31
+ "data-role": _propTypes.default.string,
29
32
  "icon": _propTypes.default.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", "bin", "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", "coins", "collaborate", "computer_clock", "connect_off", "connect", "construction", "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", "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", "in_progress", "in_transit", "individual", "info", "intranet", "italic", "job_seeked", "key", "laptop", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "like", "link_cloud", "link_on", "link", "list_view", "location", "locked", "logout", "lookup", "maintenance", "marker", "message", "messages", "microphone", "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", "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"]),
33
+ "id": _propTypes.default.string,
30
34
  "label": _propTypes.default.string.isRequired,
31
35
  "style": _propTypes.default.object
32
36
  };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { CSSProperties } from "styled-components";
3
- export interface OptionRowProps {
3
+ import { TagProps } from "__internal__/utils/helpers/tags";
4
+ export interface OptionRowProps extends TagProps {
4
5
  /** The option's visible text, displayed within <Textbox> of <Select> */
5
6
  text: string;
6
7
  /** Row content, should consist of multiple td elements */
@@ -8,17 +9,16 @@ export interface OptionRowProps {
8
9
  /** The option's invisible internal value */
9
10
  value: string | Record<string, unknown>;
10
11
  /**
11
- * @private
12
- * @ignore
13
- * Component id (prop added by the SelectList component)
12
+ * Unique identifier for the component.
13
+ * Will use a randomly generated GUID if none is provided.
14
14
  */
15
- id: string;
15
+ id?: string;
16
16
  /**
17
17
  * @private
18
18
  * @ignore
19
19
  * Callback to return value when the element is selected (prop added by the SelectList component) */
20
20
  onSelect?: (ev: {
21
- id: string;
21
+ id?: string;
22
22
  text: string;
23
23
  value: string | Record<string, unknown>;
24
24
  }) => void;
@@ -50,8 +50,11 @@ const OptionRow = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
50
50
  });
51
51
  OptionRow.propTypes = {
52
52
  "children": _propTypes.default.node,
53
+ "data-component": _propTypes.default.string,
54
+ "data-element": _propTypes.default.string,
55
+ "data-role": _propTypes.default.string,
53
56
  "hidden": _propTypes.default.bool,
54
- "id": _propTypes.default.string.isRequired,
57
+ "id": _propTypes.default.string,
55
58
  "index": _propTypes.default.number,
56
59
  "onSelect": _propTypes.default.func,
57
60
  "style": _propTypes.default.object,
@@ -111,7 +111,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef((_ref, listContainerRe
111
111
  // childIds should be stable except when children are added or removed - can't use useMemo
112
112
  // as that isn't absolutely guaranteed to never rerun when dependencies haven't changed.
113
113
  const setChildIds = () => {
114
- childIdsRef.current = _react.default.Children.map(children, () => (0, _guid.default)()) || /* istanbul ignore next */null;
114
+ childIdsRef.current = _react.default.Children.map(children, child => /*#__PURE__*/_react.default.isValidElement(child) && child?.props.id || (0, _guid.default)()) || /* istanbul ignore next */null;
115
115
  };
116
116
  if (childIdsRef.current?.length !== _react.default.Children.count(children)) {
117
117
  setChildIds();
@@ -108,6 +108,7 @@ const Switch = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
108
108
  warning,
109
109
  info,
110
110
  disabled: disabled || loading,
111
+ loading,
111
112
  checked: isControlled ? checked : checkedInternal,
112
113
  label,
113
114
  labelHelp,
@@ -152,6 +153,7 @@ const Switch = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
152
153
  error,
153
154
  warning,
154
155
  disabled: disabled || loading,
156
+ loading,
155
157
  checked: isControlled ? checked : checkedInternal,
156
158
  onBlur,
157
159
  onFocus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "119.7.1",
3
+ "version": "119.8.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",