carbon-react 117.4.1 → 117.6.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 (138) hide show
  1. package/esm/__internal__/input/input.component.d.ts +3 -3
  2. package/esm/components/advanced-color-picker/advanced-color-picker.component.js +8 -0
  3. package/esm/components/button-toggle/button-toggle.component.js +7 -0
  4. package/esm/components/checkbox/checkbox.component.js +6 -0
  5. package/esm/components/decimal/decimal.component.js +7 -0
  6. package/esm/components/grouped-character/grouped-character.component.js +6 -0
  7. package/esm/components/menu/__internal__/locators.d.ts +6 -6
  8. package/esm/components/menu/__internal__/spec-helper/index.d.ts +3 -0
  9. package/esm/components/menu/__internal__/submenu/index.d.ts +2 -0
  10. package/esm/components/menu/__internal__/submenu/index.js +1 -0
  11. package/esm/components/menu/__internal__/submenu/submenu.component.d.ts +42 -0
  12. package/esm/components/menu/__internal__/submenu/submenu.component.js +162 -85
  13. package/esm/components/menu/__internal__/submenu/submenu.context.d.ts +10 -0
  14. package/esm/components/menu/__internal__/submenu/submenu.style.d.ts +16 -0
  15. package/esm/components/menu/__internal__/submenu/submenu.style.js +4 -4
  16. package/esm/components/menu/index.d.ts +12 -6
  17. package/esm/components/menu/index.js +5 -5
  18. package/esm/components/menu/menu-divider/index.d.ts +2 -2
  19. package/esm/components/menu/menu-divider/index.js +1 -0
  20. package/esm/components/menu/menu-divider/menu-divider.component.d.ts +7 -0
  21. package/esm/components/menu/menu-divider/menu-divider.component.js +14 -7
  22. package/esm/components/menu/menu-divider/menu-divider.style.d.ts +6 -0
  23. package/esm/components/menu/menu-full-screen/index.d.ts +2 -2
  24. package/esm/components/menu/menu-full-screen/menu-full-screen.component.d.ts +14 -0
  25. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +20 -30
  26. package/esm/components/menu/menu-full-screen/menu-full-screen.style.d.ts +8 -0
  27. package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +29 -27
  28. package/esm/components/menu/menu-item/index.d.ts +2 -2
  29. package/esm/components/menu/menu-item/menu-item.component.d.ts +67 -0
  30. package/esm/components/menu/menu-item/menu-item.component.js +2084 -121
  31. package/esm/components/menu/menu-item/menu-item.style.d.ts +21 -0
  32. package/esm/components/menu/menu-item/menu-item.style.js +188 -146
  33. package/esm/components/menu/menu-segment-title/index.d.ts +2 -2
  34. package/esm/components/menu/menu-segment-title/index.js +1 -0
  35. package/esm/components/menu/menu-segment-title/menu-segment-title.component.d.ts +10 -0
  36. package/esm/components/menu/menu-segment-title/menu-segment-title.component.js +13 -9
  37. package/esm/components/menu/menu-segment-title/menu-segment-title.style.d.ts +8 -0
  38. package/esm/components/menu/menu.component.d.ts +11 -9
  39. package/esm/components/menu/menu.component.js +1887 -18
  40. package/esm/components/menu/menu.config.d.ts +58 -94
  41. package/esm/components/menu/menu.context.d.ts +12 -6
  42. package/esm/components/menu/menu.style.d.ts +12 -2
  43. package/esm/components/menu/menu.style.js +11 -11
  44. package/esm/components/menu/scrollable-block/index.d.ts +2 -1
  45. package/esm/components/menu/scrollable-block/scrollable-block.component.d.ts +19 -0
  46. package/esm/components/menu/scrollable-block/scrollable-block.component.js +13 -20
  47. package/esm/components/menu/scrollable-block/scrollable-block.style.d.ts +8 -0
  48. package/esm/components/number/number.component.js +6 -0
  49. package/esm/components/numeral-date/numeral-date.component.js +8 -0
  50. package/esm/components/radio-button/radio-button-group.component.js +8 -0
  51. package/esm/components/radio-button/radio-button.style.js +1 -1
  52. package/esm/components/search/search.component.js +6 -0
  53. package/esm/components/select/filterable-select/filterable-select.component.js +9 -1
  54. package/esm/components/select/multi-select/multi-select.component.js +9 -1
  55. package/esm/components/select/simple-select/simple-select.component.js +9 -1
  56. package/esm/components/simple-color-picker/simple-color-picker.component.js +8 -0
  57. package/esm/components/switch/switch.component.js +6 -0
  58. package/esm/components/textarea/textarea.component.js +6 -0
  59. package/esm/components/textbox/textbox.component.js +6 -0
  60. package/esm/components/vertical-menu/vertical-menu-item.component.d.ts +3 -1
  61. package/esm/components/vertical-menu/vertical-menu-item.component.js +3 -1
  62. package/lib/__internal__/input/input.component.d.ts +3 -3
  63. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +11 -0
  64. package/lib/components/button-toggle/button-toggle.component.js +10 -0
  65. package/lib/components/checkbox/checkbox.component.js +7 -0
  66. package/lib/components/decimal/decimal.component.js +8 -0
  67. package/lib/components/grouped-character/grouped-character.component.js +7 -0
  68. package/lib/components/menu/__internal__/locators.d.ts +6 -6
  69. package/lib/components/menu/__internal__/spec-helper/index.d.ts +3 -0
  70. package/lib/components/menu/__internal__/submenu/index.d.ts +2 -0
  71. package/lib/components/menu/__internal__/submenu/index.js +15 -0
  72. package/lib/components/menu/__internal__/submenu/package.json +6 -0
  73. package/lib/components/menu/__internal__/submenu/submenu.component.d.ts +42 -0
  74. package/lib/components/menu/__internal__/submenu/submenu.component.js +162 -86
  75. package/lib/components/menu/__internal__/submenu/submenu.context.d.ts +10 -0
  76. package/lib/components/menu/__internal__/submenu/submenu.style.d.ts +16 -0
  77. package/lib/components/menu/__internal__/submenu/submenu.style.js +4 -4
  78. package/lib/components/menu/index.d.ts +12 -6
  79. package/lib/components/menu/index.js +5 -5
  80. package/lib/components/menu/menu-divider/index.d.ts +2 -2
  81. package/lib/components/menu/menu-divider/index.js +15 -0
  82. package/lib/components/menu/menu-divider/menu-divider.component.d.ts +7 -0
  83. package/lib/components/menu/menu-divider/menu-divider.component.js +15 -7
  84. package/lib/components/menu/menu-divider/menu-divider.style.d.ts +6 -0
  85. package/lib/components/menu/menu-divider/package.json +6 -0
  86. package/lib/components/menu/menu-full-screen/index.d.ts +2 -2
  87. package/lib/components/menu/menu-full-screen/menu-full-screen.component.d.ts +14 -0
  88. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +22 -31
  89. package/lib/components/menu/menu-full-screen/menu-full-screen.style.d.ts +8 -0
  90. package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +30 -28
  91. package/lib/components/menu/menu-item/index.d.ts +2 -2
  92. package/lib/components/menu/menu-item/menu-item.component.d.ts +67 -0
  93. package/lib/components/menu/menu-item/menu-item.component.js +2085 -122
  94. package/lib/components/menu/menu-item/menu-item.style.d.ts +21 -0
  95. package/lib/components/menu/menu-item/menu-item.style.js +191 -146
  96. package/lib/components/menu/menu-segment-title/index.d.ts +2 -2
  97. package/lib/components/menu/menu-segment-title/index.js +15 -0
  98. package/lib/components/menu/menu-segment-title/menu-segment-title.component.d.ts +10 -0
  99. package/lib/components/menu/menu-segment-title/menu-segment-title.component.js +14 -9
  100. package/lib/components/menu/menu-segment-title/menu-segment-title.style.d.ts +8 -0
  101. package/lib/components/menu/menu-segment-title/package.json +6 -0
  102. package/lib/components/menu/menu.component.d.ts +11 -9
  103. package/lib/components/menu/menu.component.js +1889 -20
  104. package/lib/components/menu/menu.config.d.ts +58 -94
  105. package/lib/components/menu/menu.context.d.ts +12 -6
  106. package/lib/components/menu/menu.style.d.ts +12 -2
  107. package/lib/components/menu/menu.style.js +12 -12
  108. package/lib/components/menu/scrollable-block/index.d.ts +2 -1
  109. package/lib/components/menu/scrollable-block/scrollable-block.component.d.ts +19 -0
  110. package/lib/components/menu/scrollable-block/scrollable-block.component.js +15 -21
  111. package/lib/components/menu/scrollable-block/scrollable-block.style.d.ts +8 -0
  112. package/lib/components/number/number.component.js +7 -0
  113. package/lib/components/numeral-date/numeral-date.component.js +10 -0
  114. package/lib/components/radio-button/radio-button-group.component.js +11 -0
  115. package/lib/components/radio-button/radio-button.style.js +1 -1
  116. package/lib/components/search/search.component.js +7 -0
  117. package/lib/components/select/filterable-select/filterable-select.component.js +10 -1
  118. package/lib/components/select/multi-select/multi-select.component.js +10 -1
  119. package/lib/components/select/simple-select/simple-select.component.js +10 -1
  120. package/lib/components/simple-color-picker/simple-color-picker.component.js +11 -0
  121. package/lib/components/switch/switch.component.js +7 -0
  122. package/lib/components/textarea/textarea.component.js +7 -0
  123. package/lib/components/textbox/textbox.component.js +7 -0
  124. package/lib/components/vertical-menu/vertical-menu-item.component.d.ts +3 -1
  125. package/lib/components/vertical-menu/vertical-menu-item.component.js +3 -1
  126. package/package.json +2 -2
  127. package/esm/components/menu/menu-divider/menu-divider.d.ts +0 -11
  128. package/esm/components/menu/menu-full-screen/menu-full-screen.d.ts +0 -16
  129. package/esm/components/menu/menu-item/menu-item.d.ts +0 -60
  130. package/esm/components/menu/menu-segment-title/menu-segment-title.d.ts +0 -12
  131. package/esm/components/menu/menu.d.ts +0 -28
  132. package/esm/components/menu/scrollable-block/scrollable-block.d.ts +0 -20
  133. package/lib/components/menu/menu-divider/menu-divider.d.ts +0 -11
  134. package/lib/components/menu/menu-full-screen/menu-full-screen.d.ts +0 -16
  135. package/lib/components/menu/menu-item/menu-item.d.ts +0 -60
  136. package/lib/components/menu/menu-segment-title/menu-segment-title.d.ts +0 -12
  137. package/lib/components/menu/menu.d.ts +0 -28
  138. package/lib/components/menu/scrollable-block/scrollable-block.d.ts +0 -20
@@ -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)(false);
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"]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "117.4.1",
3
+ "version": "117.6.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -174,7 +174,7 @@
174
174
  "chalk": "^4.1.1",
175
175
  "ci-info": "^3.3.2",
176
176
  "classnames": "~2.2.6",
177
- "crypto-js": "~3.3.0",
177
+ "crypto-js": "^4.1.1",
178
178
  "date-fns": "^2.26.0",
179
179
  "dotenv": "^10.0.0",
180
180
  "immutable": "~3.8.2",
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface MenuDividerProps {
4
- size?: "default" | "large";
5
- }
6
-
7
- declare function MenuDivider(
8
- props: MenuDividerProps & React.RefAttributes<HTMLDivElement>
9
- ): JSX.Element;
10
-
11
- export default MenuDivider;
@@ -1,16 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface MenuFullscreenProps {
4
- /** The child elements to render */
5
- children?: React.ReactNode;
6
- /** Sets whether the component is open or closed */
7
- isOpen?: boolean;
8
- /** The start position for the component to open from */
9
- startPosition?: "left" | "right";
10
- /** A callback to be called when the close icon is clicked or enter is pressed when focused */
11
- onClose: React.MouseEventHandler<HTMLButtonElement>;
12
- }
13
-
14
- declare function MenuFullscreen(props: MenuFullscreenProps): JSX.Element;
15
-
16
- export default MenuFullscreen;
@@ -1,60 +0,0 @@
1
- import * as React from "react";
2
- import { FlexboxProps, LayoutProps } from "styled-system";
3
- import { IconType } from "../../icon";
4
-
5
- export interface MenuItemBaseProps extends LayoutProps, FlexboxProps {
6
- /** Custom className */
7
- className?: string;
8
- /** onClick handler */
9
- onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
10
- /** Defines which direction the submenu will hang eg. left/right */
11
- submenuDirection?: string;
12
- /** Is the menu item the currently selected item. */
13
- selected?: boolean;
14
- /** A title for the menu item that has a submenu. */
15
- submenu?: React.ReactNode | boolean;
16
- /** The href to use for the menu item. */
17
- href?: string;
18
- /** onKeyDown handler */
19
- onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void;
20
- /** The target to use for the menu item. */
21
- target?: string;
22
- /** The rel attribute to be used for the underlying <a> tag */
23
- rel?: string;
24
- /** set the colour variant for a menuType */
25
- variant?: "default" | "alternate";
26
- /** Flag to display the dropdown arrow when an item has a submenu */
27
- showDropdownArrow?: boolean;
28
- /** If no text is provided an ariaLabel should be given to facilitate accessibility. */
29
- ariaLabel?: string;
30
- /** Callback triggered when submenu opens. Only valid with submenu prop */
31
- onSubmenuOpen?: () => void;
32
- /** Callback triggered when submenu closes. Only valid with submenu prop */
33
- onSubmenuClose?: () => void;
34
- /**
35
- @ignore @private
36
- private prop, used inside ScrollableBlock to ensure the MenuItem's color variant overrides the CSS
37
- for other MenuItems inside the block
38
- */
39
- overrideColor?: boolean;
40
- /** @private @ignore */
41
- "data-component"?: string;
42
- }
43
-
44
- export interface MenuWithChildren extends MenuItemBaseProps {
45
- children: React.ReactNode;
46
- /** Either prop `icon` must be defined or this node must have children. */
47
- icon?: IconType;
48
- }
49
-
50
- export interface MenuWithIcon extends MenuItemBaseProps {
51
- /** Either prop `icon` must be defined or this node must have children. */
52
- icon: IconType;
53
- children?: React.ReactNode;
54
- }
55
-
56
- export type MenuItemProps = MenuWithChildren | MenuWithIcon;
57
-
58
- declare function MenuItem(props: MenuItemProps): JSX.Element;
59
-
60
- export default MenuItem;
@@ -1,12 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface MenuTitleProps {
4
- children: string;
5
- variant?: "default" | "alternate";
6
- }
7
-
8
- declare function MenuTitle(
9
- props: MenuTitleProps & React.RefAttributes<HTMLDivElement>
10
- ): JSX.Element;
11
-
12
- export default MenuTitle;
@@ -1,28 +0,0 @@
1
- import * as React from "react";
2
- import { LayoutProps, FlexboxProps } from "styled-system";
3
-
4
- type menuType = "light" | "dark" | "white" | "black";
5
- interface MenuContextProps {
6
- menuType: menuType;
7
- isFirstElement: boolean;
8
- handleKeyDown: (
9
- ev: React.KeyboardEvent<HTMLAnchorElement | HTMLButtonElement>,
10
- submenuOpen?: boolean
11
- ) => void;
12
- isFocused: boolean;
13
- openSubmenu: boolean;
14
- inMenu: boolean;
15
- }
16
-
17
- export interface MenuProps extends LayoutProps, FlexboxProps {
18
- /** Children elements */
19
- children: React.ReactNode;
20
- /** Defines the color scheme of the component */
21
- menuType?: menuType;
22
- }
23
-
24
- declare const MenuContext: React.Context<MenuContextProps>;
25
- declare function Menu(props: MenuProps): JSX.Element;
26
-
27
- export { MenuContext };
28
- export default Menu;
@@ -1,20 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface ScrollableBlockProps {
4
- /** Children elements */
5
- children: React.ReactNode;
6
- /** A custom height to be applied to the component. */
7
- height?: string | number;
8
- /** set the colour variant for a menuType */
9
- variant?: "default" | "alternate";
10
- /** the element, if any, displayed at the top of the block to be its semantic "parent",
11
- * but not part of the scrollable section
12
- */
13
- parent?: React.ReactElement;
14
- /** the colour variant for the parent element, if different from the variant of the block */
15
- parentVariant?: "default" | "alternate";
16
- }
17
-
18
- declare function ScrollableBlock(props: ScrollableBlockProps): JSX.Element;
19
-
20
- export default ScrollableBlock;
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface MenuDividerProps {
4
- size?: "default" | "large";
5
- }
6
-
7
- declare function MenuDivider(
8
- props: MenuDividerProps & React.RefAttributes<HTMLDivElement>
9
- ): JSX.Element;
10
-
11
- export default MenuDivider;
@@ -1,16 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface MenuFullscreenProps {
4
- /** The child elements to render */
5
- children?: React.ReactNode;
6
- /** Sets whether the component is open or closed */
7
- isOpen?: boolean;
8
- /** The start position for the component to open from */
9
- startPosition?: "left" | "right";
10
- /** A callback to be called when the close icon is clicked or enter is pressed when focused */
11
- onClose: React.MouseEventHandler<HTMLButtonElement>;
12
- }
13
-
14
- declare function MenuFullscreen(props: MenuFullscreenProps): JSX.Element;
15
-
16
- export default MenuFullscreen;
@@ -1,60 +0,0 @@
1
- import * as React from "react";
2
- import { FlexboxProps, LayoutProps } from "styled-system";
3
- import { IconType } from "../../icon";
4
-
5
- export interface MenuItemBaseProps extends LayoutProps, FlexboxProps {
6
- /** Custom className */
7
- className?: string;
8
- /** onClick handler */
9
- onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
10
- /** Defines which direction the submenu will hang eg. left/right */
11
- submenuDirection?: string;
12
- /** Is the menu item the currently selected item. */
13
- selected?: boolean;
14
- /** A title for the menu item that has a submenu. */
15
- submenu?: React.ReactNode | boolean;
16
- /** The href to use for the menu item. */
17
- href?: string;
18
- /** onKeyDown handler */
19
- onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void;
20
- /** The target to use for the menu item. */
21
- target?: string;
22
- /** The rel attribute to be used for the underlying <a> tag */
23
- rel?: string;
24
- /** set the colour variant for a menuType */
25
- variant?: "default" | "alternate";
26
- /** Flag to display the dropdown arrow when an item has a submenu */
27
- showDropdownArrow?: boolean;
28
- /** If no text is provided an ariaLabel should be given to facilitate accessibility. */
29
- ariaLabel?: string;
30
- /** Callback triggered when submenu opens. Only valid with submenu prop */
31
- onSubmenuOpen?: () => void;
32
- /** Callback triggered when submenu closes. Only valid with submenu prop */
33
- onSubmenuClose?: () => void;
34
- /**
35
- @ignore @private
36
- private prop, used inside ScrollableBlock to ensure the MenuItem's color variant overrides the CSS
37
- for other MenuItems inside the block
38
- */
39
- overrideColor?: boolean;
40
- /** @private @ignore */
41
- "data-component"?: string;
42
- }
43
-
44
- export interface MenuWithChildren extends MenuItemBaseProps {
45
- children: React.ReactNode;
46
- /** Either prop `icon` must be defined or this node must have children. */
47
- icon?: IconType;
48
- }
49
-
50
- export interface MenuWithIcon extends MenuItemBaseProps {
51
- /** Either prop `icon` must be defined or this node must have children. */
52
- icon: IconType;
53
- children?: React.ReactNode;
54
- }
55
-
56
- export type MenuItemProps = MenuWithChildren | MenuWithIcon;
57
-
58
- declare function MenuItem(props: MenuItemProps): JSX.Element;
59
-
60
- export default MenuItem;
@@ -1,12 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface MenuTitleProps {
4
- children: string;
5
- variant?: "default" | "alternate";
6
- }
7
-
8
- declare function MenuTitle(
9
- props: MenuTitleProps & React.RefAttributes<HTMLDivElement>
10
- ): JSX.Element;
11
-
12
- export default MenuTitle;
@@ -1,28 +0,0 @@
1
- import * as React from "react";
2
- import { LayoutProps, FlexboxProps } from "styled-system";
3
-
4
- type menuType = "light" | "dark" | "white" | "black";
5
- interface MenuContextProps {
6
- menuType: menuType;
7
- isFirstElement: boolean;
8
- handleKeyDown: (
9
- ev: React.KeyboardEvent<HTMLAnchorElement | HTMLButtonElement>,
10
- submenuOpen?: boolean
11
- ) => void;
12
- isFocused: boolean;
13
- openSubmenu: boolean;
14
- inMenu: boolean;
15
- }
16
-
17
- export interface MenuProps extends LayoutProps, FlexboxProps {
18
- /** Children elements */
19
- children: React.ReactNode;
20
- /** Defines the color scheme of the component */
21
- menuType?: menuType;
22
- }
23
-
24
- declare const MenuContext: React.Context<MenuContextProps>;
25
- declare function Menu(props: MenuProps): JSX.Element;
26
-
27
- export { MenuContext };
28
- export default Menu;
@@ -1,20 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface ScrollableBlockProps {
4
- /** Children elements */
5
- children: React.ReactNode;
6
- /** A custom height to be applied to the component. */
7
- height?: string | number;
8
- /** set the colour variant for a menuType */
9
- variant?: "default" | "alternate";
10
- /** the element, if any, displayed at the top of the block to be its semantic "parent",
11
- * but not part of the scrollable section
12
- */
13
- parent?: React.ReactElement;
14
- /** the colour variant for the parent element, if different from the variant of the block */
15
- parentVariant?: "default" | "alternate";
16
- }
17
-
18
- declare function ScrollableBlock(props: ScrollableBlockProps): JSX.Element;
19
-
20
- export default ScrollableBlock;