carbon-react 118.2.0 → 118.3.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 (126) hide show
  1. package/esm/components/button-minor/button-minor.component.d.ts +5 -1
  2. package/esm/components/button-minor/button-minor.component.js +4 -1
  3. package/esm/components/button-minor/button-minor.style.d.ts +2 -1
  4. package/esm/components/button-minor/button-minor.style.js +17 -0
  5. package/esm/components/button-minor/index.d.ts +1 -1
  6. package/esm/components/i18n-provider/i18n-provider.component.js +4 -0
  7. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +18 -0
  8. package/esm/components/menu/menu-item/menu-item.component.js +1 -1
  9. package/esm/components/menu/menu-item/menu-item.style.js +13 -11
  10. package/esm/components/password/index.d.ts +2 -0
  11. package/esm/components/password/index.js +1 -0
  12. package/esm/components/password/password.component.d.ts +9 -0
  13. package/esm/components/password/password.component.js +580 -0
  14. package/esm/components/password/password.style.d.ts +5 -0
  15. package/esm/components/password/password.style.js +8 -0
  16. package/esm/components/text-editor/__internal__/decorators/index.d.ts +2 -2
  17. package/esm/components/text-editor/__internal__/decorators/link-decorator.d.ts +7 -6
  18. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.component.d.ts +15 -0
  19. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.component.js +5 -15
  20. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.style.d.ts +5 -0
  21. package/esm/components/text-editor/__internal__/editor-counter/index.d.ts +2 -2
  22. package/esm/components/text-editor/__internal__/editor-link/editor-link.component.d.ts +9 -0
  23. package/esm/components/text-editor/__internal__/editor-link/editor-link.component.js +3 -4
  24. package/esm/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +3 -0
  25. package/esm/components/text-editor/__internal__/editor-link/index.d.ts +2 -2
  26. package/esm/components/text-editor/__internal__/label-wrapper/index.d.ts +2 -2
  27. package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.component.d.ts +12 -0
  28. package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.component.js +4 -3
  29. package/esm/components/text-editor/__internal__/toolbar/index.d.ts +2 -2
  30. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/index.d.ts +2 -2
  31. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.d.ts +25 -0
  32. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +12 -23
  33. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.d.ts +6 -0
  34. package/esm/components/text-editor/__internal__/toolbar/toolbar.component.d.ts +16 -0
  35. package/esm/components/text-editor/__internal__/toolbar/toolbar.component.js +40 -36
  36. package/esm/components/text-editor/__internal__/toolbar/toolbar.style.d.ts +4 -0
  37. package/esm/components/text-editor/__internal__/utils/index.d.ts +1 -1
  38. package/esm/components/text-editor/__internal__/utils/utils.d.ts +27 -26
  39. package/esm/components/text-editor/__internal__/utils/utils.js +9 -10
  40. package/esm/components/text-editor/index.d.ts +2 -2
  41. package/esm/components/text-editor/text-editor.component.d.ts +36 -7
  42. package/esm/components/text-editor/text-editor.component.js +230 -87
  43. package/esm/components/text-editor/text-editor.style.d.ts +11 -3
  44. package/esm/components/text-editor/text-editor.style.js +1 -2
  45. package/esm/components/text-editor/types.d.ts +6 -0
  46. package/esm/components/text-editor/types.js +4 -0
  47. package/esm/components/textbox/textbox.component.js +1 -1
  48. package/esm/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.js +1 -1
  49. package/esm/locales/en-gb.js +4 -0
  50. package/esm/locales/locale.d.ts +4 -0
  51. package/esm/locales/pl-pl.js +4 -0
  52. package/lib/components/button-minor/button-minor.component.d.ts +5 -1
  53. package/lib/components/button-minor/button-minor.component.js +4 -1
  54. package/lib/components/button-minor/button-minor.style.d.ts +2 -1
  55. package/lib/components/button-minor/button-minor.style.js +17 -0
  56. package/lib/components/button-minor/index.d.ts +1 -1
  57. package/lib/components/i18n-provider/i18n-provider.component.js +4 -0
  58. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +18 -0
  59. package/lib/components/menu/menu-item/menu-item.component.js +1 -1
  60. package/lib/components/menu/menu-item/menu-item.style.js +13 -11
  61. package/lib/components/password/index.d.ts +2 -0
  62. package/lib/components/password/index.js +15 -0
  63. package/lib/components/password/package.json +6 -0
  64. package/lib/components/password/password.component.d.ts +9 -0
  65. package/lib/components/password/password.component.js +600 -0
  66. package/lib/components/password/password.style.d.ts +5 -0
  67. package/lib/components/password/password.style.js +21 -0
  68. package/lib/components/text-editor/__internal__/decorators/index.d.ts +2 -2
  69. package/lib/components/text-editor/__internal__/decorators/link-decorator.d.ts +7 -6
  70. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.component.d.ts +15 -0
  71. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.component.js +5 -15
  72. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.style.d.ts +5 -0
  73. package/lib/components/text-editor/__internal__/editor-counter/index.d.ts +2 -2
  74. package/lib/components/text-editor/__internal__/editor-link/editor-link.component.d.ts +9 -0
  75. package/lib/components/text-editor/__internal__/editor-link/editor-link.component.js +3 -4
  76. package/lib/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +3 -0
  77. package/lib/components/text-editor/__internal__/editor-link/index.d.ts +2 -2
  78. package/lib/components/text-editor/__internal__/label-wrapper/index.d.ts +2 -2
  79. package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.component.d.ts +12 -0
  80. package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.component.js +2 -8
  81. package/lib/components/text-editor/__internal__/toolbar/index.d.ts +2 -2
  82. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/index.d.ts +2 -2
  83. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.d.ts +25 -0
  84. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +13 -24
  85. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.d.ts +6 -0
  86. package/lib/components/text-editor/__internal__/toolbar/toolbar.component.d.ts +16 -0
  87. package/lib/components/text-editor/__internal__/toolbar/toolbar.component.js +50 -46
  88. package/lib/components/text-editor/__internal__/toolbar/toolbar.style.d.ts +4 -0
  89. package/lib/components/text-editor/__internal__/utils/index.d.ts +1 -1
  90. package/lib/components/text-editor/__internal__/utils/utils.d.ts +27 -26
  91. package/lib/components/text-editor/__internal__/utils/utils.js +10 -11
  92. package/lib/components/text-editor/index.d.ts +2 -2
  93. package/lib/components/text-editor/text-editor.component.d.ts +36 -7
  94. package/lib/components/text-editor/text-editor.component.js +231 -88
  95. package/lib/components/text-editor/text-editor.style.d.ts +11 -3
  96. package/lib/components/text-editor/text-editor.style.js +1 -2
  97. package/lib/components/text-editor/types.d.ts +6 -0
  98. package/lib/components/text-editor/types.js +14 -0
  99. package/lib/components/textbox/textbox.component.js +1 -1
  100. package/lib/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.js +1 -1
  101. package/lib/hooks/__internal__/useUniqueId/package.json +6 -0
  102. package/lib/locales/en-gb.js +4 -0
  103. package/lib/locales/locale.d.ts +4 -0
  104. package/lib/locales/pl-pl.js +4 -0
  105. package/package.json +4 -4
  106. package/esm/__internal__/DeprecationWarning.js +0 -20
  107. package/esm/__internal__/utils/storybook/partial-action.d.ts +0 -3
  108. package/esm/__internal__/utils/storybook/partial-action.js +0 -13
  109. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.d.ts +0 -11
  110. package/esm/components/text-editor/__internal__/editor-link/editor-link.d.ts +0 -11
  111. package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.d.ts +0 -10
  112. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.d.ts +0 -20
  113. package/esm/components/text-editor/__internal__/toolbar/toolbar.d.ts +0 -13
  114. package/esm/components/text-editor/text-editor.d.ts +0 -40
  115. package/lib/__internal__/DeprecationWarning.js +0 -31
  116. package/lib/__internal__/utils/helpers/useUniqueId/package.json +0 -6
  117. package/lib/__internal__/utils/storybook/partial-action.d.ts +0 -3
  118. package/lib/__internal__/utils/storybook/partial-action.js +0 -21
  119. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.d.ts +0 -11
  120. package/lib/components/text-editor/__internal__/editor-link/editor-link.d.ts +0 -11
  121. package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.d.ts +0 -10
  122. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.d.ts +0 -20
  123. package/lib/components/text-editor/__internal__/toolbar/toolbar.d.ts +0 -13
  124. package/lib/components/text-editor/text-editor.d.ts +0 -40
  125. /package/esm/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.d.ts +0 -0
  126. /package/lib/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.d.ts +0 -0
@@ -1,7 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from "../button";
3
+ export interface ButtonMinorProps extends ButtonProps {
4
+ /** @private @ignore */
5
+ isInPassword?: boolean;
6
+ }
3
7
  export declare const ButtonMinor: {
4
- ({ buttonType, size, ...rest }: ButtonProps): JSX.Element;
8
+ ({ buttonType, size, isInPassword, ...rest }: ButtonMinorProps): JSX.Element;
5
9
  displayName: string;
6
10
  };
7
11
  export default ButtonMinor;
@@ -7,10 +7,12 @@ import StyledButtonMinor from "./button-minor.style";
7
7
  const ButtonMinor = ({
8
8
  buttonType = "secondary",
9
9
  size = "medium",
10
+ isInPassword,
10
11
  ...rest
11
12
  }) => /*#__PURE__*/React.createElement(StyledButtonMinor, _extends({
12
13
  size: size,
13
- buttonType: buttonType
14
+ buttonType: buttonType,
15
+ isInPassword: isInPassword
14
16
  }, rest));
15
17
 
16
18
  ButtonMinor.propTypes = {
@@ -29,6 +31,7 @@ ButtonMinor.propTypes = {
29
31
  "iconTooltipPosition": PropTypes.oneOf(["bottom", "left", "right", "top"]),
30
32
  "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"]),
31
33
  "id": PropTypes.string,
34
+ "isInPassword": PropTypes.bool,
32
35
  "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
33
36
  "__@toStringTag": PropTypes.string.isRequired,
34
37
  "description": PropTypes.string,
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
- declare const StyledButtonMinor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, {}, never>;
2
+ import { ButtonMinorProps } from "./button-minor.component";
3
+ declare const StyledButtonMinor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, ButtonMinorProps, never>;
3
4
  export default StyledButtonMinor;
@@ -61,6 +61,23 @@ const StyledButtonMinor = styled(Button)`
61
61
  }
62
62
  `}
63
63
  `}
64
+
65
+ ${({
66
+ isInPassword,
67
+ disabled
68
+ }) => isInPassword && !disabled && css`
69
+ ${StyledIcon} {
70
+ color: var(--colorsUtilityMajor300);
71
+ }
72
+
73
+ &:hover {
74
+ ${StyledIcon} {
75
+ color: var(--colorsUtilityMajor300);
76
+ }
77
+ color: var(--colorsActionMinor500);
78
+ background: transparent;
79
+ }
80
+ `}
64
81
 
65
82
  ${({
66
83
  size
@@ -1,2 +1,2 @@
1
1
  export { default } from "./button-minor.component";
2
- export type { ButtonProps as ButtonMinorProps } from "../button";
2
+ export type { ButtonMinorProps } from "./button-minor.component";
@@ -89,6 +89,10 @@ I18nProvider.propTypes = {
89
89
  "records": PropTypes.func.isRequired,
90
90
  "show": PropTypes.func.isRequired
91
91
  }),
92
+ "password": PropTypes.shape({
93
+ "ariaLiveHiddenMessage": PropTypes.func.isRequired,
94
+ "ariaLiveShownMessage": PropTypes.func.isRequired
95
+ }),
92
96
  "pod": PropTypes.shape({
93
97
  "undo": PropTypes.func.isRequired
94
98
  }),
@@ -33,6 +33,24 @@ const MenuFullscreen = ({
33
33
  if (Events.isEscKey(ev)) {
34
34
  onClose(ev);
35
35
  }
36
+
37
+ if (Events.isTabKey(ev) && !Events.isShiftKey(ev)) {
38
+ var _menuWrapperRef$curre;
39
+
40
+ const search = (_menuWrapperRef$curre = menuWrapperRef.current) === null || _menuWrapperRef$curre === void 0 ? void 0 : _menuWrapperRef$curre.querySelector('[data-component="search"');
41
+ const searchInput = search === null || search === void 0 ? void 0 : search.querySelector("input");
42
+ const searchButton = search === null || search === void 0 ? void 0 : search.querySelector("button"); // if there is no value in the search input the button disappears when the input blurs
43
+ // this means we need to programatically set focus to the next menu item
44
+
45
+ if (searchButton && searchInput && !searchInput.value && searchInput === document.activeElement) {
46
+ var _menuWrapperRef$curre2, _elements;
47
+
48
+ ev.preventDefault();
49
+ const elements = Array.from((_menuWrapperRef$curre2 = menuWrapperRef.current) === null || _menuWrapperRef$curre2 === void 0 ? void 0 : _menuWrapperRef$curre2.querySelectorAll("a, input, button"));
50
+ const index = elements.indexOf(searchInput);
51
+ (_elements = elements[index + 2]) === null || _elements === void 0 ? void 0 : _elements.focus();
52
+ }
53
+ }
36
54
  };
37
55
 
38
56
  return /*#__PURE__*/React.createElement("li", {
@@ -111,7 +111,7 @@ const MenuItem = ({
111
111
  (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
112
112
  }
113
113
 
114
- const shouldFocusIcon = ((_inputIcon$current2 = inputIcon.current) === null || _inputIcon$current2 === void 0 ? void 0 : _inputIcon$current2.getAttribute("tabindex")) === "0" && document.activeElement === inputRef.current && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value); // let natural tab order move focus if input icon is tabbable
114
+ const shouldFocusIcon = ((_inputIcon$current2 = inputIcon.current) === null || _inputIcon$current2 === void 0 ? void 0 : _inputIcon$current2.getAttribute("tabindex")) === "0" && document.activeElement === inputRef.current && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value); // let natural tab order move focus if input icon is tabbable or input with button exists
115
115
 
116
116
  if (Events.isTabKey(event) && (!Events.isShiftKey(event) && shouldFocusIcon || Events.isShiftKey(event) && document.activeElement === inputIcon.current)) {
117
117
  return;
@@ -300,18 +300,20 @@ const StyledMenuItemWrapper = styled.a.attrs({
300
300
  position: relative;
301
301
  }
302
302
 
303
- a:focus,
304
- a:hover,
305
- button:focus,
306
- button:hover {
307
- background-color: var(--colorsComponentsMenuAutumnStandard600);
308
- color: var(--colorsComponentsMenuYang100);
303
+ && {
304
+ a:focus,
305
+ a:hover,
306
+ button:focus,
307
+ button:hover {
308
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
309
+ color: var(--colorsComponentsMenuYang100);
309
310
 
310
- ${!hasInput && `
311
- [data-component="icon"] {
312
- color: var(--colorsComponentsMenuYang100);
313
- }
314
- `}
311
+ ${!hasInput && `
312
+ [data-component="icon"] {
313
+ color: var(--colorsComponentsMenuYang100);
314
+ }
315
+ `}
316
+ }
315
317
  }
316
318
  }
317
319
  `}
@@ -0,0 +1,2 @@
1
+ export { default } from "./password.component";
2
+ export type { PasswordProps } from "./password.component";
@@ -0,0 +1 @@
1
+ export { default } from "./password.component";
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { TextboxProps } from "../textbox";
3
+ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ export interface PasswordProps extends TextboxProps, TagProps {
5
+ /** When `true` input `type` is `password` and text is obscured. */
6
+ forceObscurity?: boolean;
7
+ }
8
+ export declare const Password: ({ id, disabled, forceObscurity, ...rest }: PasswordProps) => JSX.Element;
9
+ export default Password;