carbon-react 106.6.6 → 106.6.9

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 (76) hide show
  1. package/esm/__internal__/utils/argTypes/specialCharacters.d.ts +36 -0
  2. package/esm/__internal__/utils/argTypes/specialCharacters.js +36 -0
  3. package/esm/components/accordion/accordion-group/accordion-group.component.d.ts +9 -23
  4. package/esm/components/accordion/accordion-group/accordion-group.component.js +222 -25
  5. package/esm/components/accordion/accordion.component.d.ts +44 -2
  6. package/esm/components/accordion/accordion.component.js +648 -68
  7. package/esm/components/accordion/accordion.style.d.ts +45 -9
  8. package/esm/components/accordion/index.d.ts +4 -2
  9. package/esm/components/decimal/decimal.component.js +12 -10
  10. package/esm/components/menu/menu-item/menu-item.style.js +6 -3
  11. package/esm/components/multi-action-button/index.d.ts +2 -1
  12. package/esm/components/multi-action-button/multi-action-button.component.d.ts +9 -52
  13. package/esm/components/multi-action-button/multi-action-button.component.js +471 -67
  14. package/esm/components/multi-action-button/multi-action-button.config.d.ts +3 -3
  15. package/esm/components/multi-action-button/multi-action-button.style.d.ts +10 -2
  16. package/esm/components/multi-action-button/multi-action-button.style.js +4 -7
  17. package/esm/components/portal/portal.js +0 -5
  18. package/esm/components/portrait/portrait-initials.component.js +1 -2
  19. package/esm/components/tile-select/__internal__/accordion/accordion.style.d.ts +2 -2
  20. package/esm/components/tooltip/tooltip.component.d.ts +3 -0
  21. package/esm/style/utils/filter-out-styled-system-spacing-props.d.ts +1 -1
  22. package/esm/style/utils/filter-out-styled-system-spacing-props.js +1 -1
  23. package/lib/__internal__/utils/argTypes/specialCharacters.d.ts +36 -0
  24. package/lib/__internal__/utils/argTypes/specialCharacters.js +46 -0
  25. package/lib/components/accordion/accordion-group/accordion-group.component.d.ts +9 -23
  26. package/lib/components/accordion/accordion-group/accordion-group.component.js +225 -29
  27. package/lib/components/accordion/accordion.component.d.ts +44 -2
  28. package/lib/components/accordion/accordion.component.js +649 -70
  29. package/lib/components/accordion/accordion.style.d.ts +45 -9
  30. package/lib/components/accordion/index.d.ts +4 -2
  31. package/lib/components/decimal/decimal.component.js +12 -10
  32. package/lib/components/menu/menu-item/menu-item.style.js +6 -3
  33. package/lib/components/multi-action-button/index.d.ts +2 -1
  34. package/lib/components/multi-action-button/multi-action-button.component.d.ts +9 -52
  35. package/lib/components/multi-action-button/multi-action-button.component.js +471 -70
  36. package/lib/components/multi-action-button/multi-action-button.config.d.ts +3 -3
  37. package/lib/components/multi-action-button/multi-action-button.style.d.ts +10 -2
  38. package/lib/components/multi-action-button/multi-action-button.style.js +4 -7
  39. package/lib/components/portal/portal.js +0 -6
  40. package/lib/components/portrait/portrait-initials.component.js +1 -5
  41. package/lib/components/tile-select/__internal__/accordion/accordion.style.d.ts +2 -2
  42. package/lib/components/tooltip/tooltip.component.d.ts +3 -0
  43. package/lib/style/utils/filter-out-styled-system-spacing-props.d.ts +1 -1
  44. package/lib/style/utils/filter-out-styled-system-spacing-props.js +1 -1
  45. package/package.json +2 -1
  46. package/esm/__internal__/utils/helpers/browser/index.d.ts +0 -15
  47. package/esm/__internal__/utils/helpers/browser/index.js +0 -33
  48. package/esm/components/accordion/accordion-group/accordion-group.d.ts +0 -17
  49. package/esm/components/accordion/accordion.d.ts +0 -54
  50. package/esm/components/action-popover/action-popover-test.stories.js +0 -76
  51. package/esm/components/button-bar/button-bar-test.stories.js +0 -122
  52. package/esm/components/draggable/draggable-test.stories.js +0 -48
  53. package/esm/components/duelling-picklist/duelling-picklist-test.stories.js +0 -539
  54. package/esm/components/menu/menu-test.stories.js +0 -109
  55. package/esm/components/multi-action-button/multi-action-button.d.ts +0 -10
  56. package/esm/components/profile/profile-test.stories.js +0 -55
  57. package/esm/components/progress-tracker/progress-tracker-test.stories.js +0 -63
  58. package/esm/components/select/simple-select/simple-select-test.stories.js +0 -193
  59. package/esm/components/show-edit-pod/show-edit-pod-test.stories.js +0 -143
  60. package/esm/components/textarea/textarea-test.stories.js +0 -154
  61. package/lib/__internal__/utils/helpers/browser/index.d.ts +0 -15
  62. package/lib/__internal__/utils/helpers/browser/index.js +0 -40
  63. package/lib/__internal__/utils/helpers/browser/package.json +0 -6
  64. package/lib/components/accordion/accordion-group/accordion-group.d.ts +0 -17
  65. package/lib/components/accordion/accordion.d.ts +0 -54
  66. package/lib/components/action-popover/action-popover-test.stories.js +0 -95
  67. package/lib/components/button-bar/button-bar-test.stories.js +0 -145
  68. package/lib/components/draggable/draggable-test.stories.js +0 -66
  69. package/lib/components/duelling-picklist/duelling-picklist-test.stories.js +0 -573
  70. package/lib/components/menu/menu-test.stories.js +0 -132
  71. package/lib/components/multi-action-button/multi-action-button.d.ts +0 -10
  72. package/lib/components/profile/profile-test.stories.js +0 -75
  73. package/lib/components/progress-tracker/progress-tracker-test.stories.js +0 -79
  74. package/lib/components/select/simple-select/simple-select-test.stories.js +0 -206
  75. package/lib/components/show-edit-pod/show-edit-pod-test.stories.js +0 -165
  76. package/lib/components/textarea/textarea-test.stories.js +0 -173
@@ -1,10 +1,46 @@
1
- export const StyledAccordionGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export const StyledAccordionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export const StyledAccordionHeadingsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export const StyledAccordionSubTitle: import("styled-components").StyledComponent<"span", any, {}, never>;
5
- export const StyledAccordionTitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- export const StyledAccordionTitle: import("styled-components").StyledComponent<"h3", any, {}, never>;
7
- export const StyledAccordionIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
8
- export const StyledAccordionContent: import("styled-components").StyledComponent<"div", any, {}, never>;
9
- export const StyledAccordionContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
10
1
  import Icon from "../icon";
2
+ declare const StyledAccordionGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export interface StyledAccordionContainerProps {
4
+ /** Toggles left and right borders */
5
+ borders?: "default" | "full" | "none";
6
+ /** Renders the accordion heading in the style of a tertiary button */
7
+ buttonHeading?: boolean;
8
+ /** Sets background as white or transparent */
9
+ scheme?: "white" | "transparent";
10
+ /** Sets accordion width */
11
+ width?: string;
12
+ }
13
+ declare const StyledAccordionContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionContainerProps, never>;
14
+ interface StyledAccordionTitleProps {
15
+ size?: "large" | "small";
16
+ }
17
+ declare const StyledAccordionTitle: import("styled-components").StyledComponent<"h3", any, StyledAccordionTitleProps, never>;
18
+ declare const StyledAccordionSubTitle: import("styled-components").StyledComponent<"span", any, {}, never>;
19
+ interface StyledAccordionIconProps {
20
+ isExpanded?: boolean;
21
+ iconAlign?: "left" | "right";
22
+ }
23
+ declare const StyledAccordionIcon: import("styled-components").StyledComponent<typeof Icon, any, StyledAccordionIconProps, never>;
24
+ interface StyledAccordionHeadingsContainerProps {
25
+ buttonHeading?: boolean;
26
+ hasValidationIcon?: boolean;
27
+ }
28
+ declare const StyledAccordionHeadingsContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionHeadingsContainerProps, never>;
29
+ interface StyledAccordionTitleContainerProps {
30
+ buttonHeading?: boolean;
31
+ buttonWidth?: number;
32
+ hasButtonProps?: boolean;
33
+ iconAlign?: "left" | "right";
34
+ size?: "large" | "small";
35
+ }
36
+ declare const StyledAccordionTitleContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionTitleContainerProps, never>;
37
+ export interface StyledAccordionContentContainerProps {
38
+ isExpanded?: boolean;
39
+ maxHeight?: string | number;
40
+ }
41
+ declare const StyledAccordionContentContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionContentContainerProps, never>;
42
+ export interface StyledAccordionContentProps {
43
+ disableContentPadding?: boolean;
44
+ }
45
+ declare const StyledAccordionContent: import("styled-components").StyledComponent<"div", any, StyledAccordionContentProps, never>;
46
+ export { StyledAccordionGroup, StyledAccordionContainer, StyledAccordionHeadingsContainer, StyledAccordionSubTitle, StyledAccordionTitleContainer, StyledAccordionTitle, StyledAccordionIcon, StyledAccordionContent, StyledAccordionContentContainer, };
@@ -1,2 +1,4 @@
1
- export { default as Accordion } from "./accordion";
2
- export { default as AccordionGroup } from "./accordion-group/accordion-group";
1
+ export { default as Accordion } from "./accordion.component";
2
+ export type { AccordionProps } from "./accordion.component";
3
+ export { default as AccordionGroup } from "./accordion-group/accordion-group.component";
4
+ export type { AccordionGroupProps } from "./accordion-group/accordion-group.component";
@@ -50,8 +50,7 @@ const Decimal = ({
50
50
  }) => {
51
51
  const l = (0, _react.useContext)(_i18nContext.default);
52
52
  const emptyValue = allowEmptyValue ? "" : "0.00";
53
-
54
- const getSafeValueProp = initialValue => {
53
+ const getSafeValueProp = (0, _react.useCallback)(initialValue => {
55
54
  // We're intentionally preventing the use of number values to help prevent any unintentional rounding issues
56
55
  (0, _invariant.default)(typeof initialValue === "string", "Decimal `value` prop must be a string");
57
56
 
@@ -60,8 +59,7 @@ const Decimal = ({
60
59
  }
61
60
 
62
61
  return initialValue;
63
- };
64
-
62
+ }, [allowEmptyValue]);
65
63
  const getSeparator = (0, _react.useCallback)(separatorType => {
66
64
  const numberWithGroupAndDecimalSeparator = 10000.1;
67
65
  return Intl.NumberFormat(locale || l.locale()).formatToParts(numberWithGroupAndDecimalSeparator).find(part => part.type === separatorType).value;
@@ -190,18 +188,22 @@ const Decimal = ({
190
188
  (0, _invariant.default)(prevControlledRef.current !== isControlled, message);
191
189
  prevControlledRef.current = isControlled;
192
190
  }, [isControlled]);
191
+ const prevValue = (0, _usePrevious.default)(value);
193
192
  (0, _react.useEffect)(() => {
194
- const unformattedValue = toStandardDecimal(stateValue);
193
+ const standardDecimalValue = toStandardDecimal(stateValue);
195
194
 
196
195
  if (isControlled) {
197
196
  const valueProp = getSafeValueProp(value);
198
197
 
199
- if (unformattedValue !== valueProp) {
200
- setStateValue(formatValue(value));
198
+ if (standardDecimalValue !== valueProp) {
199
+ if (valueProp === "" && prevValue === "") {
200
+ setStateValue(formatValue(emptyValue));
201
+ } else {
202
+ setStateValue(formatValue(valueProp));
203
+ }
201
204
  }
202
- } // eslint-disable-next-line react-hooks/exhaustive-deps
203
-
204
- }, [value]);
205
+ }
206
+ }, [emptyValue, formatValue, getSafeValueProp, isControlled, prevValue, stateValue, toStandardDecimal, value]);
205
207
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_textbox.default, _extends({
206
208
  onKeyPress: onKeyPress,
207
209
  align: align,
@@ -141,7 +141,7 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
141
141
  ${isOpen && (0, _styledComponents.css)`
142
142
  a,
143
143
  button {
144
- background-color: ${_menu.default[menuType].submenuOpenedBackground};
144
+ background-color: ${_menu.default[menuType].submenuItemBackground};
145
145
  color: ${_menu.default[menuType].color};
146
146
  }
147
147
  `}
@@ -165,11 +165,14 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
165
165
 
166
166
  a:hover,
167
167
  button:hover {
168
+ background-color: ${_menu.default[menuType].submenuOpenedBackground};
169
+ color: var(--colorsComponentsMenuYang100);
170
+
168
171
  ${!(href || clickToOpen) && (0, _styledComponents.css)`
169
172
  cursor: default;
173
+ background-color: ${_menu.default[menuType].submenuItemBackground};
174
+ color: ${_menu.default[menuType].color};
170
175
  `}
171
- background-color: ${_menu.default[menuType].submenuOpenedBackground};
172
- color: ${_menu.default[menuType].color};
173
176
 
174
177
  [data-component="icon"] {
175
178
  color: ${_menu.default[menuType].color};
@@ -1 +1,2 @@
1
- export { default } from "./multi-action-button";
1
+ export { default } from "./multi-action-button.component";
2
+ export type { MultiActionButtonProps } from "./multi-action-button.component";
@@ -1,53 +1,10 @@
1
- export default MultiActionButton;
2
- declare function MultiActionButton({ align, disabled, as, buttonType, size, children, text, subtext, "data-element": dataElement, "data-role": dataRole, ...rest }: {
3
- [x: string]: any;
4
- align?: string | undefined;
5
- disabled: any;
6
- as: any;
7
- buttonType: any;
8
- size: any;
9
- children: any;
10
- text: any;
11
- subtext: any;
12
- "data-element": any;
13
- "data-role": any;
14
- }): JSX.Element;
15
- declare namespace MultiActionButton {
16
- const propTypes: {
17
- /** Button type: "primary" | "secondary" | "tertiary" */
18
- buttonType: PropTypes.Requireable<string>;
19
- /** The additional button to display. */
20
- children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
21
- /** Second text child, renders under main text, only when size is "large". */
22
- subtext: PropTypes.Requireable<string>;
23
- /** Customizes the appearance, can be set to 'primary', 'secondary' or 'transparent'. */
24
- as: PropTypes.Requireable<string>;
25
- /** The text to be displayed in the SplitButton. */
26
- text: PropTypes.Validator<string>;
27
- /** Gives the button a disabled state. */
28
- disabled: PropTypes.Requireable<boolean>;
29
- /** The size of the MultiActionButton. */
30
- size: PropTypes.Requireable<string>;
31
- /** A custom value for the data-element attribute. */
32
- "data-element": PropTypes.Requireable<string>;
33
- /** A custom value for the data-element attribute. */
34
- "data-role": PropTypes.Requireable<string>;
35
- /** Aligns the button's options */
36
- align: PropTypes.Requireable<string>;
37
- marginBottom?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
38
- margin?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
39
- m?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
40
- marginLeft?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
41
- ml?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
42
- marginRight?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
43
- mr?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
44
- marginTop?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
45
- mt?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
46
- mb?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
47
- marginX?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
48
- mx?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
49
- marginY?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
50
- my?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
51
- };
1
+ /// <reference types="react" />
2
+ import { SplitButtonProps } from "../split-button";
3
+ export interface MultiActionButtonProps extends Omit<SplitButtonProps, "buttonType"> {
4
+ /** Button type: "primary" | "secondary" | "tertiary" */
5
+ buttonType?: "primary" | "secondary" | "tertiary";
6
+ /** Second text child, renders under main text, only when size is "large" */
7
+ subtext?: string;
52
8
  }
53
- import PropTypes from "prop-types";
9
+ export declare const MultiActionButton: ({ align, disabled, as, buttonType, size, children, text, subtext, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
10
+ export default MultiActionButton;