carbon-react 117.4.1 → 117.5.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.
- package/esm/components/vertical-menu/vertical-menu-item.component.d.ts +3 -1
- package/esm/components/vertical-menu/vertical-menu-item.component.js +3 -1
- package/lib/components/vertical-menu/vertical-menu-item.component.d.ts +3 -1
- package/lib/components/vertical-menu/vertical-menu-item.component.js +3 -1
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ import { IconType } from "../icon";
|
|
|
5
5
|
export interface VerticalMenuItemProps<T = React.ElementType> extends PaddingProps, TagProps {
|
|
6
6
|
/** Children of the menu item - another level of VerticalMenuItems */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
/** Default open state of the component */
|
|
9
|
+
defaultOpen?: boolean;
|
|
8
10
|
/** Title of the menu item */
|
|
9
11
|
title: string;
|
|
10
12
|
/** Adornment of the menu item meant to be rendered on the right side */
|
|
@@ -21,5 +23,5 @@ export interface VerticalMenuItemProps<T = React.ElementType> extends PaddingPro
|
|
|
21
23
|
component?: T;
|
|
22
24
|
}
|
|
23
25
|
declare type InferredComponentProps<T extends React.ElementType> = Omit<React.ComponentProps<T>, keyof VerticalMenuItemProps<T>>;
|
|
24
|
-
export declare const VerticalMenuItem: <T>({ title, iconType, adornment, children, component, active, height, href, ...rest }: T extends React.ElementType<any> ? InferredComponentProps<T> & VerticalMenuItemProps<T> : VerticalMenuItemProps<React.ElementType<any>>) => JSX.Element;
|
|
26
|
+
export declare const VerticalMenuItem: <T>({ defaultOpen, title, iconType, adornment, children, component, active, height, href, ...rest }: T extends React.ElementType<any> ? InferredComponentProps<T> & VerticalMenuItemProps<T> : VerticalMenuItemProps<React.ElementType<any>>) => JSX.Element;
|
|
25
27
|
export default VerticalMenuItem;
|
|
@@ -11,6 +11,7 @@ const MenuItemContext = /*#__PURE__*/React.createContext({
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
const VerticalMenuItem = ({
|
|
14
|
+
defaultOpen = false,
|
|
14
15
|
title,
|
|
15
16
|
iconType,
|
|
16
17
|
adornment,
|
|
@@ -21,7 +22,7 @@ const VerticalMenuItem = ({
|
|
|
21
22
|
href,
|
|
22
23
|
...rest
|
|
23
24
|
}) => {
|
|
24
|
-
const [isOpen, setIsOpen] = useState(
|
|
25
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
25
26
|
|
|
26
27
|
const handleOnClick = () => {
|
|
27
28
|
setIsOpen(state => !state);
|
|
@@ -104,6 +105,7 @@ VerticalMenuItem.propTypes = {
|
|
|
104
105
|
"data-component": PropTypes.string,
|
|
105
106
|
"data-element": PropTypes.string,
|
|
106
107
|
"data-role": PropTypes.string,
|
|
108
|
+
"defaultOpen": PropTypes.bool,
|
|
107
109
|
"height": PropTypes.string,
|
|
108
110
|
"href": PropTypes.string,
|
|
109
111
|
"iconType": PropTypes.oneOf(["add", "admin", "alert_on", "alert", "analysis", "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", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "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", "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", "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", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "laptop", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "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", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|
|
@@ -5,6 +5,8 @@ import { IconType } from "../icon";
|
|
|
5
5
|
export interface VerticalMenuItemProps<T = React.ElementType> extends PaddingProps, TagProps {
|
|
6
6
|
/** Children of the menu item - another level of VerticalMenuItems */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
/** Default open state of the component */
|
|
9
|
+
defaultOpen?: boolean;
|
|
8
10
|
/** Title of the menu item */
|
|
9
11
|
title: string;
|
|
10
12
|
/** Adornment of the menu item meant to be rendered on the right side */
|
|
@@ -21,5 +23,5 @@ export interface VerticalMenuItemProps<T = React.ElementType> extends PaddingPro
|
|
|
21
23
|
component?: T;
|
|
22
24
|
}
|
|
23
25
|
declare type InferredComponentProps<T extends React.ElementType> = Omit<React.ComponentProps<T>, keyof VerticalMenuItemProps<T>>;
|
|
24
|
-
export declare const VerticalMenuItem: <T>({ title, iconType, adornment, children, component, active, height, href, ...rest }: T extends React.ElementType<any> ? InferredComponentProps<T> & VerticalMenuItemProps<T> : VerticalMenuItemProps<React.ElementType<any>>) => JSX.Element;
|
|
26
|
+
export declare const VerticalMenuItem: <T>({ defaultOpen, title, iconType, adornment, children, component, active, height, href, ...rest }: T extends React.ElementType<any> ? InferredComponentProps<T> & VerticalMenuItemProps<T> : VerticalMenuItemProps<React.ElementType<any>>) => JSX.Element;
|
|
25
27
|
export default VerticalMenuItem;
|
|
@@ -30,6 +30,7 @@ const MenuItemContext = /*#__PURE__*/_react.default.createContext({
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
const VerticalMenuItem = ({
|
|
33
|
+
defaultOpen = false,
|
|
33
34
|
title,
|
|
34
35
|
iconType,
|
|
35
36
|
adornment,
|
|
@@ -40,7 +41,7 @@ const VerticalMenuItem = ({
|
|
|
40
41
|
href,
|
|
41
42
|
...rest
|
|
42
43
|
}) => {
|
|
43
|
-
const [isOpen, setIsOpen] = (0, _react.useState)(
|
|
44
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(defaultOpen);
|
|
44
45
|
|
|
45
46
|
const handleOnClick = () => {
|
|
46
47
|
setIsOpen(state => !state);
|
|
@@ -124,6 +125,7 @@ VerticalMenuItem.propTypes = {
|
|
|
124
125
|
"data-component": _propTypes.default.string,
|
|
125
126
|
"data-element": _propTypes.default.string,
|
|
126
127
|
"data-role": _propTypes.default.string,
|
|
128
|
+
"defaultOpen": _propTypes.default.bool,
|
|
127
129
|
"height": _propTypes.default.string,
|
|
128
130
|
"href": _propTypes.default.string,
|
|
129
131
|
"iconType": _propTypes.default.oneOf(["add", "admin", "alert_on", "alert", "analysis", "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", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "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", "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", "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", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "laptop", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "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", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|