carbon-react 143.0.0 → 143.0.2
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.
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +10 -2
- package/esm/components/select/__internal__/select-list/select-list.component.js +3 -1
- package/esm/components/select/__internal__/utils/with-filter.hoc.js +3 -1
- package/esm/components/select/option/option.component.d.ts +5 -5
- package/esm/components/select/option/option.component.js +8 -8
- package/esm/components/select/option/option.style.d.ts +1 -0
- package/esm/components/select/option/option.style.js +9 -7
- package/esm/components/select/option-group-header/option-group-header.component.d.ts +1 -1
- package/esm/components/select/option-group-header/option-group-header.component.js +2 -2
- package/esm/components/select/option-row/option-row.component.d.ts +1 -1
- package/esm/components/select/option-row/option-row.component.js +3 -3
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +10 -2
- package/lib/components/select/__internal__/select-list/select-list.component.js +3 -1
- package/lib/components/select/__internal__/utils/with-filter.hoc.js +3 -1
- package/lib/components/select/option/option.component.d.ts +5 -5
- package/lib/components/select/option/option.component.js +8 -8
- package/lib/components/select/option/option.style.d.ts +1 -0
- package/lib/components/select/option/option.style.js +9 -7
- package/lib/components/select/option-group-header/option-group-header.component.d.ts +1 -1
- package/lib/components/select/option-group-header/option-group-header.component.js +2 -2
- package/lib/components/select/option-row/option-row.component.d.ts +1 -1
- package/lib/components/select/option-row/option-row.component.js +3 -3
- package/package.json +2 -2
package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts
CHANGED
|
@@ -3,13 +3,21 @@ import { Alignment } from "../__internal__/action-popover.context";
|
|
|
3
3
|
export interface ActionPopoverMenuBaseProps {
|
|
4
4
|
/** Children for the menu */
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
* @private
|
|
9
|
+
* @internal
|
|
10
|
+
* Index to control which item is focused */
|
|
7
11
|
focusIndex?: number;
|
|
8
12
|
/** Flag to indicate whether a menu should open */
|
|
9
13
|
isOpen?: boolean;
|
|
10
14
|
/** A unique ID for the menu */
|
|
11
15
|
menuID?: string;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
* @private
|
|
19
|
+
* @internal
|
|
20
|
+
* Callback to set the index of the focused item */
|
|
13
21
|
setFocusIndex?: (args: number) => void;
|
|
14
22
|
/** Callback to set the isOpen flag */
|
|
15
23
|
setOpen?: (args: boolean) => void;
|
|
@@ -154,7 +154,9 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
154
154
|
const childElementRefs = useRef(Array.from({
|
|
155
155
|
length: React.Children.count(children)
|
|
156
156
|
}));
|
|
157
|
-
const optionChildrenList = useMemo(() => childrenList.filter(child =>
|
|
157
|
+
const optionChildrenList = useMemo(() => childrenList.filter(child => {
|
|
158
|
+
return /*#__PURE__*/React.isValidElement(child) && (child.type === Option || child.type === OptionRow);
|
|
159
|
+
}), [childrenList]);
|
|
158
160
|
const {
|
|
159
161
|
measureElement
|
|
160
162
|
} = virtualizer;
|
|
@@ -106,7 +106,9 @@ const withFilter = WrappedComponent => {
|
|
|
106
106
|
colSpan: colSpan
|
|
107
107
|
}, noResultsMessage || noResultsText));
|
|
108
108
|
}
|
|
109
|
-
return /*#__PURE__*/React.createElement(StyledOption,
|
|
109
|
+
return /*#__PURE__*/React.createElement(StyledOption, {
|
|
110
|
+
isInteractive: true
|
|
111
|
+
}, noResultsMessage || noResultsText);
|
|
110
112
|
}
|
|
111
113
|
return addHighlightedContent(filteredElements, filterText);
|
|
112
114
|
}
|
|
@@ -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
|
|
11
|
-
/**
|
|
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
|
|
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
|
|
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])
|
|
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
|
-
}) =>
|
|
17
|
-
|
|
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
|
|
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,
|
package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts
CHANGED
|
@@ -3,13 +3,21 @@ import { Alignment } from "../__internal__/action-popover.context";
|
|
|
3
3
|
export interface ActionPopoverMenuBaseProps {
|
|
4
4
|
/** Children for the menu */
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
* @private
|
|
9
|
+
* @internal
|
|
10
|
+
* Index to control which item is focused */
|
|
7
11
|
focusIndex?: number;
|
|
8
12
|
/** Flag to indicate whether a menu should open */
|
|
9
13
|
isOpen?: boolean;
|
|
10
14
|
/** A unique ID for the menu */
|
|
11
15
|
menuID?: string;
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
* @private
|
|
19
|
+
* @internal
|
|
20
|
+
* Callback to set the index of the focused item */
|
|
13
21
|
setFocusIndex?: (args: number) => void;
|
|
14
22
|
/** Callback to set the isOpen flag */
|
|
15
23
|
setOpen?: (args: boolean) => void;
|
|
@@ -163,7 +163,9 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
163
163
|
const childElementRefs = (0, _react.useRef)(Array.from({
|
|
164
164
|
length: _react.default.Children.count(children)
|
|
165
165
|
}));
|
|
166
|
-
const optionChildrenList = (0, _react.useMemo)(() => childrenList.filter(child =>
|
|
166
|
+
const optionChildrenList = (0, _react.useMemo)(() => childrenList.filter(child => {
|
|
167
|
+
return /*#__PURE__*/_react.default.isValidElement(child) && (child.type === _option.default || child.type === _optionRow.default);
|
|
168
|
+
}), [childrenList]);
|
|
167
169
|
const {
|
|
168
170
|
measureElement
|
|
169
171
|
} = virtualizer;
|
|
@@ -115,7 +115,9 @@ const withFilter = WrappedComponent => {
|
|
|
115
115
|
colSpan: colSpan
|
|
116
116
|
}, noResultsMessage || noResultsText));
|
|
117
117
|
}
|
|
118
|
-
return /*#__PURE__*/_react.default.createElement(_option.default,
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement(_option.default, {
|
|
119
|
+
isInteractive: true
|
|
120
|
+
}, noResultsMessage || noResultsText);
|
|
119
121
|
}
|
|
120
122
|
return addHighlightedContent(filteredElements, filterText);
|
|
121
123
|
}
|
|
@@ -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
|
|
11
|
-
/**
|
|
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
|
|
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 */
|
|
@@ -29,11 +29,11 @@ const Option = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
29
29
|
const selectListContext = (0, _react.useContext)(_selectList.default);
|
|
30
30
|
let isSelected = selectListContext.currentOptionsListIndex === index;
|
|
31
31
|
const internalIdRef = (0, _react.useRef)(id || (0, _guid.default)());
|
|
32
|
-
if (selectListContext.multiselectValues) {
|
|
32
|
+
if (selectListContext.multiselectValues && value) {
|
|
33
33
|
isSelected = selectListContext.multiselectValues.includes(value);
|
|
34
34
|
}
|
|
35
35
|
function handleClick() {
|
|
36
|
-
if (disabled) {
|
|
36
|
+
if (disabled || !value) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (!onClick) {
|
|
@@ -52,15 +52,16 @@ const Option = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
52
52
|
ref: ref,
|
|
53
53
|
"aria-selected": isSelected,
|
|
54
54
|
"aria-disabled": disabled,
|
|
55
|
-
"data-component": "option",
|
|
56
55
|
isDisabled: disabled,
|
|
57
56
|
onClick: handleClick,
|
|
58
57
|
isHighlighted: selectListContext.currentOptionsListIndex === index,
|
|
59
58
|
role: "option",
|
|
60
59
|
hidden: hidden,
|
|
61
|
-
style: style
|
|
60
|
+
style: style,
|
|
61
|
+
isInteractive: !!value
|
|
62
62
|
}, rest, {
|
|
63
|
-
fill: undefined
|
|
63
|
+
fill: undefined,
|
|
64
|
+
"data-component": "option"
|
|
64
65
|
}), children || text);
|
|
65
66
|
});
|
|
66
67
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -134,7 +135,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
134
135
|
"dangerouslySetInnerHTML": _propTypes.default.shape({
|
|
135
136
|
"__html": _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]).isRequired
|
|
136
137
|
}),
|
|
137
|
-
"data-component": _propTypes.default.string,
|
|
138
138
|
"data-element": _propTypes.default.string,
|
|
139
139
|
"data-role": _propTypes.default.string,
|
|
140
140
|
"datatype": _propTypes.default.string,
|
|
@@ -404,7 +404,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
404
404
|
"suppressContentEditableWarning": _propTypes.default.bool,
|
|
405
405
|
"suppressHydrationWarning": _propTypes.default.bool,
|
|
406
406
|
"tabIndex": _propTypes.default.number,
|
|
407
|
-
"text": _propTypes.default.string
|
|
407
|
+
"text": _propTypes.default.string,
|
|
408
408
|
"title": _propTypes.default.string,
|
|
409
409
|
"translate": _propTypes.default.oneOf(["no", "yes"]),
|
|
410
410
|
"type": _propTypes.default.oneOfType([_propTypes.default.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.default.shape({
|
|
@@ -460,7 +460,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
460
460
|
})]),
|
|
461
461
|
"typeof": _propTypes.default.string,
|
|
462
462
|
"unselectable": _propTypes.default.oneOf(["off", "on"]),
|
|
463
|
-
"value": _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string])
|
|
463
|
+
"value": _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
464
464
|
"vocab": _propTypes.default.string,
|
|
465
465
|
"width": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
466
466
|
};
|
|
@@ -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;
|
|
@@ -8,7 +8,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const StyledOption = _styledComponents.default.li`
|
|
11
|
-
cursor: pointer;
|
|
12
11
|
box-sizing: border-box;
|
|
13
12
|
line-height: 16px;
|
|
14
13
|
padding: 12px 16px;
|
|
@@ -20,19 +19,22 @@ const StyledOption = _styledComponents.default.li`
|
|
|
20
19
|
width: 100%;
|
|
21
20
|
|
|
22
21
|
${({
|
|
22
|
+
isInteractive,
|
|
23
23
|
isHighlighted
|
|
24
|
-
}) =>
|
|
25
|
-
|
|
24
|
+
}) => isInteractive && (0, _styledComponents.css)`
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
:hover {
|
|
27
|
+
background-color: var(--colorsUtilityMajor100);
|
|
28
|
+
}
|
|
29
|
+
${isHighlighted && (0, _styledComponents.css)`
|
|
30
|
+
background-color: var(--colorsUtilityMajor200);
|
|
31
|
+
`}
|
|
26
32
|
`}
|
|
27
33
|
|
|
28
34
|
${({
|
|
29
35
|
hidden
|
|
30
36
|
}) => hidden && "display: none;"}
|
|
31
37
|
|
|
32
|
-
:hover {
|
|
33
|
-
background-color: var(--colorsUtilityMajor100);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
38
|
${({
|
|
37
39
|
isDisabled
|
|
38
40
|
}) => isDisabled && (0, _styledComponents.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.
|
|
@@ -30,7 +30,8 @@ const OptionGroupHeader = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
30
30
|
style: style,
|
|
31
31
|
id: internalIdRef.current
|
|
32
32
|
}, rest, {
|
|
33
|
-
ref: ref
|
|
33
|
+
ref: ref,
|
|
34
|
+
"data-component": "option-group-header"
|
|
34
35
|
}), children || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
35
36
|
type: icon
|
|
36
37
|
}), /*#__PURE__*/_react.default.createElement("h4", null, label)));
|
|
@@ -38,7 +39,6 @@ const OptionGroupHeader = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
38
39
|
if (process.env.NODE_ENV !== "production") {
|
|
39
40
|
OptionGroupHeader.propTypes = {
|
|
40
41
|
"children": _propTypes.default.node,
|
|
41
|
-
"data-component": _propTypes.default.string,
|
|
42
42
|
"data-element": _propTypes.default.string,
|
|
43
43
|
"data-role": _propTypes.default.string,
|
|
44
44
|
"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", "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 */
|
|
@@ -46,19 +46,19 @@ const OptionRow = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
46
46
|
ref: ref,
|
|
47
47
|
"aria-selected": isSelected,
|
|
48
48
|
"aria-disabled": disabled,
|
|
49
|
-
"data-component": "option-row",
|
|
50
49
|
isDisabled: disabled,
|
|
51
50
|
onClick: handleClick,
|
|
52
51
|
isHighlighted: selectListContext.currentOptionsListIndex === index,
|
|
53
52
|
role: "option",
|
|
54
53
|
hidden: hidden,
|
|
55
54
|
style: style
|
|
56
|
-
}, rest
|
|
55
|
+
}, rest, {
|
|
56
|
+
"data-component": "option-row"
|
|
57
|
+
}), children);
|
|
57
58
|
});
|
|
58
59
|
if (process.env.NODE_ENV !== "production") {
|
|
59
60
|
OptionRow.propTypes = {
|
|
60
61
|
"children": _propTypes.default.node,
|
|
61
|
-
"data-component": _propTypes.default.string,
|
|
62
62
|
"data-element": _propTypes.default.string,
|
|
63
63
|
"data-role": _propTypes.default.string,
|
|
64
64
|
"disabled": _propTypes.default.bool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "143.0.
|
|
3
|
+
"version": "143.0.2",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
"@floating-ui/react-dom": "~1.3.0",
|
|
185
185
|
"@octokit/rest": "^18.12.0",
|
|
186
186
|
"@styled-system/prop-types": "^5.1.5",
|
|
187
|
-
"@tanstack/react-virtual": "^3.
|
|
187
|
+
"@tanstack/react-virtual": "^3.10.8",
|
|
188
188
|
"@types/styled-system": "^5.1.22",
|
|
189
189
|
"chalk": "^4.1.2",
|
|
190
190
|
"ci-info": "^3.8.0",
|