carbon-react 119.7.2 → 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.
@@ -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();
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "119.7.2",
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",