carbon-react 111.12.0 → 111.12.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.
Files changed (31) hide show
  1. package/esm/components/accordion/accordion.style.js +1 -1
  2. package/esm/components/switch/__internal__/switch-slider-panel.style.d.ts +7 -0
  3. package/esm/components/switch/__internal__/switch-slider-panel.style.js +0 -5
  4. package/esm/components/switch/__internal__/switch-slider.component.d.ts +11 -0
  5. package/esm/components/switch/__internal__/switch-slider.component.js +8 -8
  6. package/esm/components/switch/__internal__/switch-slider.style.d.ts +6 -0
  7. package/esm/components/switch/__internal__/switch-slider.style.js +0 -9
  8. package/esm/components/switch/index.d.ts +2 -1
  9. package/esm/components/switch/switch.component.d.ts +31 -0
  10. package/esm/components/switch/switch.component.js +522 -124
  11. package/esm/components/switch/switch.style.d.ts +4 -0
  12. package/esm/components/switch/switch.style.js +0 -8
  13. package/esm/components/toast/toast.component.js +9 -4
  14. package/esm/components/toast/toast.style.js +5 -2
  15. package/lib/components/accordion/accordion.style.js +1 -1
  16. package/lib/components/switch/__internal__/switch-slider-panel.style.d.ts +7 -0
  17. package/lib/components/switch/__internal__/switch-slider-panel.style.js +0 -6
  18. package/lib/components/switch/__internal__/switch-slider.component.d.ts +11 -0
  19. package/lib/components/switch/__internal__/switch-slider.component.js +8 -8
  20. package/lib/components/switch/__internal__/switch-slider.style.d.ts +6 -0
  21. package/lib/components/switch/__internal__/switch-slider.style.js +0 -10
  22. package/lib/components/switch/index.d.ts +2 -1
  23. package/lib/components/switch/switch.component.d.ts +31 -0
  24. package/lib/components/switch/switch.component.js +523 -127
  25. package/lib/components/switch/switch.style.d.ts +4 -0
  26. package/lib/components/switch/switch.style.js +0 -9
  27. package/lib/components/toast/toast.component.js +8 -3
  28. package/lib/components/toast/toast.style.js +5 -2
  29. package/package.json +1 -1
  30. package/esm/components/switch/switch.d.ts +0 -37
  31. package/lib/components/switch/switch.d.ts +0 -37
@@ -136,7 +136,7 @@ const StyledAccordionTitleContainer = styled.div`
136
136
 
137
137
  ${!hasButtonProps && css`
138
138
  ${StyledAccordionHeadingsContainer} {
139
- margin-left: ${iconAlign === "right" ? "64px" : "32px"};
139
+ margin-left: ${iconAlign === "right" ? "var(--spacing300)" : "var(--spacing100)"};
140
140
  }
141
141
  `}
142
142
 
@@ -0,0 +1,7 @@
1
+ import { SwitchProps } from "../switch.component";
2
+ export interface SwitchSliderPanelProps {
3
+ isLoading?: boolean;
4
+ size?: SwitchProps["size"];
5
+ }
6
+ declare const SwitchSliderPanel: import("styled-components").StyledComponent<"div", any, SwitchSliderPanelProps, never>;
7
+ export default SwitchSliderPanel;
@@ -1,5 +1,4 @@
1
1
  import styled, { css } from "styled-components";
2
- import PropTypes from "prop-types";
3
2
  import StyledLoader from "../../loader/loader.style";
4
3
  import StyledLoaderSquare from "../../loader/loader-square.style";
5
4
  const SwitchSliderPanel = styled.div`
@@ -59,8 +58,4 @@ const SwitchSliderPanel = styled.div`
59
58
  `}
60
59
  `}
61
60
  `;
62
- SwitchSliderPanel.propTypes = {
63
- isLoading: PropTypes.bool,
64
- size: PropTypes.string
65
- };
66
61
  export default SwitchSliderPanel;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { ValidationProps } from "../../../__internal__/validations";
3
+ export interface SwitchSliderProps extends ValidationProps {
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ loading?: boolean;
7
+ size?: "small" | "large";
8
+ useValidationIcon?: boolean;
9
+ }
10
+ declare const SwitchSlider: ({ checked, disabled, loading, size, error, warning, info, useValidationIcon, }: SwitchSliderProps) => JSX.Element;
11
+ export default SwitchSlider;
@@ -49,13 +49,13 @@ const SwitchSlider = ({
49
49
  };
50
50
 
51
51
  SwitchSlider.propTypes = {
52
- checked: PropTypes.bool,
53
- disabled: PropTypes.bool,
54
- loading: PropTypes.bool,
55
- size: PropTypes.string,
56
- error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
57
- warning: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
58
- info: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
59
- useValidationIcon: PropTypes.bool
52
+ "checked": PropTypes.bool,
53
+ "disabled": PropTypes.bool,
54
+ "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
55
+ "info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
56
+ "loading": PropTypes.bool,
57
+ "size": PropTypes.oneOf(["large", "small"]),
58
+ "useValidationIcon": PropTypes.bool,
59
+ "warning": PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
60
60
  };
61
61
  export default SwitchSlider;
@@ -0,0 +1,6 @@
1
+ import { SwitchSliderProps } from "./switch-slider.component";
2
+ interface StyledSwitchSliderProps extends Pick<SwitchSliderProps, "checked" | "disabled" | "size" | "error" | "warning"> {
3
+ isLoading?: boolean;
4
+ }
5
+ declare const StyledSwitchSlider: import("styled-components").StyledComponent<"span", any, StyledSwitchSliderProps, never>;
6
+ export default StyledSwitchSlider;
@@ -1,5 +1,4 @@
1
1
  import styled, { css } from "styled-components";
2
- import PropTypes from "prop-types";
3
2
  import SwitchSliderPanel from "./switch-slider-panel.style";
4
3
  import StyledValidationIcon from "../../../__internal__/validations/validation-icon.style";
5
4
  const StyledSwitchSlider = styled.span`
@@ -107,12 +106,4 @@ const StyledSwitchSlider = styled.span`
107
106
  }
108
107
  `}
109
108
  `;
110
- StyledSwitchSlider.propTypes = {
111
- checked: PropTypes.bool,
112
- disabled: PropTypes.bool,
113
- size: PropTypes.string,
114
- isLoading: PropTypes.bool,
115
- error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
116
- warning: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
117
- };
118
109
  export default StyledSwitchSlider;
@@ -1 +1,2 @@
1
- export { default } from "./switch";
1
+ export { default } from "./switch.component";
2
+ export type { SwitchProps } from "./switch.component";
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import { MarginProps } from "styled-system";
3
+ import { CommonCheckableInputProps } from "../../__internal__/checkable-input";
4
+ export interface SwitchProps extends CommonCheckableInputProps, MarginProps {
5
+ /** Identifier used for testing purposes, applied to the root element of the component. */
6
+ "data-component"?: string;
7
+ /** Identifier used for testing purposes, applied to the root element of the component. */
8
+ "data-element"?: string;
9
+ /** Identifier used for testing purposes, applied to the root element of the component. */
10
+ "data-role"?: string;
11
+ /** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
12
+ adaptiveLabelBreakpoint?: number;
13
+ /** Set the default value of the Switch if component is meant to be used as uncontrolled */
14
+ defaultChecked?: boolean;
15
+ /** Text alignment of the label */
16
+ labelAlign?: "left" | "right";
17
+ /** When true label is inline */
18
+ labelInline?: boolean;
19
+ /** Triggers loading animation */
20
+ loading?: boolean;
21
+ /** When true, validation icon will be placed on label instead of being placed on the input */
22
+ validationOnLabel?: boolean;
23
+ /** The value of the switch, passed on form submit */
24
+ value?: string;
25
+ /** Overrides the default tooltip position */
26
+ tooltipPosition?: "top" | "bottom" | "left" | "right";
27
+ /** Aria label for rendered help component */
28
+ helpAriaLabel?: string;
29
+ }
30
+ export declare const Switch: ({ autoFocus, id, label, onChange, onBlur, onFocus, value, checked, defaultChecked, disabled, loading, reverse, validationOnLabel, labelInline, labelSpacing, labelHelp, fieldHelpInline, size, name, adaptiveLabelBreakpoint, tooltipPosition, error, warning, info, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, ...rest }: SwitchProps) => JSX.Element;
31
+ export default Switch;