carbon-react 102.21.0 → 103.1.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.
@@ -1,23 +1,27 @@
1
1
  export default Loader;
2
- declare function Loader({ isInsideButton, isActive, size, ...rest }: {
2
+ declare function Loader({ "aria-label": ariaLabel, isInsideButton, isActive, size, ...rest }: {
3
3
  [x: string]: any;
4
+ "aria-label": any;
4
5
  isInsideButton: any;
5
6
  isActive: any;
6
7
  size: any;
7
8
  }): JSX.Element;
8
9
  declare namespace Loader {
9
- namespace defaultProps {
10
- const size: string;
11
- const isInsideButton: boolean;
12
- const isActive: boolean;
13
- }
14
- namespace propTypes {
15
- const size_1: PropTypes.Requireable<string>;
16
- export { size_1 as size };
17
- const isInsideButton_1: PropTypes.Requireable<boolean>;
18
- export { isInsideButton_1 as isInsideButton };
19
- const isActive_1: PropTypes.Requireable<boolean>;
20
- export { isActive_1 as isActive };
21
- }
10
+ const defaultProps: {
11
+ size: string;
12
+ isInsideButton: boolean;
13
+ isActive: boolean;
14
+ "aria-label": string;
15
+ };
16
+ const propTypes: {
17
+ /** Specify an aria-label for the Loader component */
18
+ "aria-label": PropTypes.Requireable<string>;
19
+ /** Size of the loader. */
20
+ size: PropTypes.Requireable<string>;
21
+ /** Applies white color. */
22
+ isInsideButton: PropTypes.Requireable<boolean>;
23
+ /** Applies slate color. Available only when isInsideButton is true. */
24
+ isActive: PropTypes.Requireable<boolean>;
25
+ };
22
26
  }
23
27
  import PropTypes from "prop-types";
@@ -26,12 +26,16 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
26
26
  const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
27
27
 
28
28
  const Loader = ({
29
+ "aria-label": ariaLabel,
29
30
  isInsideButton,
30
31
  isActive,
31
32
  size,
32
33
  ...rest
33
34
  }) => {
34
- return /*#__PURE__*/_react.default.createElement(_loader.default, _extends({}, rest, (0, _tags.default)("loader", rest)), /*#__PURE__*/_react.default.createElement(_loaderSquare.default, {
35
+ return /*#__PURE__*/_react.default.createElement(_loader.default, _extends({
36
+ "aria-label": ariaLabel,
37
+ role: "progressbar"
38
+ }, (0, _tags.default)("loader", rest), rest), /*#__PURE__*/_react.default.createElement(_loaderSquare.default, {
35
39
  isInsideButton: isInsideButton,
36
40
  isActive: isActive,
37
41
  size: size
@@ -49,10 +53,14 @@ const Loader = ({
49
53
  Loader.defaultProps = {
50
54
  size: "medium",
51
55
  isInsideButton: false,
52
- isActive: true
56
+ isActive: true,
57
+ "aria-label": "loader"
53
58
  };
54
59
  Loader.propTypes = { ...marginPropTypes,
55
60
 
61
+ /** Specify an aria-label for the Loader component */
62
+ "aria-label": _propTypes.default.string,
63
+
56
64
  /** Size of the loader. */
57
65
  size: _propTypes.default.oneOf(["small", "medium", "large"]),
58
66
 
@@ -1,6 +1,8 @@
1
1
  import { MarginProps } from "styled-system";
2
2
 
3
3
  export interface LoaderProps extends MarginProps {
4
+ /** Specify an aria-label for the Loader component */
5
+ "aria-label"?: string;
4
6
  /** Size of the loader. */
5
7
  size?: "small" | "medium" | "large";
6
8
  /** Applies white color. */
@@ -48,12 +48,6 @@ var _default = {
48
48
  type: "select"
49
49
  }
50
50
  },
51
- variant: {
52
- options: _progressTracker.PROGRESS_TRACKER_VARIANTS,
53
- control: {
54
- type: "select"
55
- }
56
- },
57
51
  orientation: {
58
52
  options: ["horizontal", "vertical"],
59
53
  control: {
@@ -1,27 +1,56 @@
1
1
  export default ProgressTracker;
2
- declare function ProgressTracker({ size, progress, showDefaultLabels, currentProgressLabel, maxProgressLabel, variant, orientation, direction, labelsPosition, ...rest }: {
2
+ declare function ProgressTracker({ "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-valuenow": ariaValueNow, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuetext": ariaValueText, size, progress, showDefaultLabels, currentProgressLabel, maxProgressLabel, orientation, direction, labelsPosition, ...rest }: {
3
3
  [x: string]: any;
4
+ "aria-label"?: string | undefined;
5
+ "aria-describedby": any;
6
+ "aria-valuenow": any;
7
+ "aria-valuemin": any;
8
+ "aria-valuemax": any;
9
+ "aria-valuetext": any;
4
10
  size?: string | undefined;
5
11
  progress?: number | undefined;
6
12
  showDefaultLabels?: boolean | undefined;
7
13
  currentProgressLabel: any;
8
14
  maxProgressLabel: any;
9
- variant?: string | undefined;
10
15
  orientation?: string | undefined;
11
16
  direction?: string | undefined;
12
17
  labelsPosition: any;
13
18
  }): JSX.Element;
14
19
  declare namespace ProgressTracker {
15
- namespace propTypes {
16
- const size: PropTypes.Requireable<string>;
17
- const progress: PropTypes.Requireable<number>;
18
- const showDefaultLabels: PropTypes.Requireable<boolean>;
19
- const currentProgressLabel: PropTypes.Requireable<string>;
20
- const maxProgressLabel: PropTypes.Requireable<string>;
21
- const variant: PropTypes.Requireable<string>;
22
- const orientation: PropTypes.Requireable<string>;
23
- const direction: PropTypes.Requireable<string>;
24
- const labelsPosition: PropTypes.Requireable<string>;
25
- }
20
+ const propTypes: {
21
+ /** Specifies an aria label to the component */
22
+ "aria-label": PropTypes.Requireable<string>;
23
+ /** Specifies the aria describedby for the component */
24
+ "aria-describedby": PropTypes.Requireable<string>;
25
+ /** The value of progress to be read out to the user. */
26
+ "aria-valuenow": PropTypes.Requireable<number>;
27
+ /** The minimum value of the progress tracker */
28
+ "aria-valuemin": PropTypes.Requireable<number>;
29
+ /** The maximum value of the progress tracker */
30
+ "aria-valuemax": PropTypes.Requireable<number>;
31
+ /** Prop to define the human readable text alternative of aria-valuenow
32
+ * if aria-valuenow is not a number
33
+ */
34
+ "aria-valuetext": PropTypes.Requireable<string>;
35
+ /** Size of the progress bar. */
36
+ size: PropTypes.Requireable<string>;
37
+ /** Current progress (percentage). */
38
+ progress: PropTypes.Requireable<number>;
39
+ /** Flag to control whether the default value labels (as percentages) should be rendered. */
40
+ showDefaultLabels: PropTypes.Requireable<boolean>;
41
+ /** Value to display as current progress. */
42
+ currentProgressLabel: PropTypes.Requireable<string>;
43
+ /** Value to display as the maximum progress limit. */
44
+ maxProgressLabel: PropTypes.Requireable<string>;
45
+ /** The orientation of the component. */
46
+ orientation: PropTypes.Requireable<string>;
47
+ /** The direction the bar should move as progress increases, only applies in vertical orientation. */
48
+ direction: PropTypes.Requireable<string>;
49
+ /**
50
+ * The position the value label are rendered in.
51
+ * Top/bottom apply to horizontal and left/right to vertical orientation.
52
+ */
53
+ labelsPosition: PropTypes.Requireable<string>;
54
+ };
26
55
  }
27
56
  import PropTypes from "prop-types";
@@ -24,12 +24,17 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
24
24
  const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
25
25
 
26
26
  const ProgressTracker = ({
27
+ "aria-label": ariaLabel = "progress tracker",
28
+ "aria-describedby": ariaDescribedBy,
29
+ "aria-valuenow": ariaValueNow,
30
+ "aria-valuemin": ariaValueMin,
31
+ "aria-valuemax": ariaValueMax,
32
+ "aria-valuetext": ariaValueText,
27
33
  size = "medium",
28
34
  progress = 0,
29
35
  showDefaultLabels = false,
30
36
  currentProgressLabel,
31
37
  maxProgressLabel,
32
- variant = "default",
33
38
  orientation = "horizontal",
34
39
  direction = "up",
35
40
  labelsPosition,
@@ -64,20 +69,47 @@ const ProgressTracker = ({
64
69
  return /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressTracker, _extends({
65
70
  size: size,
66
71
  isVertical: isVertical
67
- }, rest, (0, _tags.default)("progress-bar", rest)), prefixLabels && renderValueLabels(), /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressBar, {
72
+ }, rest, (0, _tags.default)("progress-bar", rest), {
73
+ role: "progressbar",
74
+ "aria-label": ariaLabel,
75
+ "aria-describedby": ariaDescribedBy,
76
+ "aria-valuenow": ariaValueNow,
77
+ "aria-valuemin": ariaValueMin,
78
+ "aria-valuemax": ariaValueMax,
79
+ "aria-valuetext": ariaValueText
80
+ }), prefixLabels && renderValueLabels(), /*#__PURE__*/_react.default.createElement(_progressTracker.StyledProgressBar, {
68
81
  direction: isVertical ? direction : undefined,
69
82
  isVertical: isVertical,
70
83
  size: size
71
84
  }, /*#__PURE__*/_react.default.createElement(_progressTracker.InnerBar, {
72
85
  isVertical: isVertical,
73
86
  size: size,
74
- progress: progress,
75
- variant: variant
87
+ progress: progress
76
88
  })), !prefixLabels && renderValueLabels());
77
89
  };
78
90
 
79
91
  ProgressTracker.propTypes = { ...marginPropTypes,
80
92
 
93
+ /** Specifies an aria label to the component */
94
+ "aria-label": _propTypes.default.string,
95
+
96
+ /** Specifies the aria describedby for the component */
97
+ "aria-describedby": _propTypes.default.string,
98
+
99
+ /** The value of progress to be read out to the user. */
100
+ "aria-valuenow": _propTypes.default.number,
101
+
102
+ /** The minimum value of the progress tracker */
103
+ "aria-valuemin": _propTypes.default.number,
104
+
105
+ /** The maximum value of the progress tracker */
106
+ "aria-valuemax": _propTypes.default.number,
107
+
108
+ /** Prop to define the human readable text alternative of aria-valuenow
109
+ * if aria-valuenow is not a number
110
+ */
111
+ "aria-valuetext": _propTypes.default.string,
112
+
81
113
  /** Size of the progress bar. */
82
114
  size: _propTypes.default.oneOf(["small", "medium", "large"]),
83
115
 
@@ -93,12 +125,6 @@ ProgressTracker.propTypes = { ...marginPropTypes,
93
125
  /** Value to display as the maximum progress limit. */
94
126
  maxProgressLabel: _propTypes.default.string,
95
127
 
96
- /**
97
- * Sets the colour of the bar that shows the current progress.
98
- * The "traffic" variant changes the colour of status bar depending on current progress.
99
- */
100
- variant: _propTypes.default.oneOf(["default", "traffic"]),
101
-
102
128
  /** The orientation of the component. */
103
129
  orientation: _propTypes.default.oneOf(["horizontal", "vertical"]),
104
130
 
@@ -1,3 +1,2 @@
1
1
  export const OUTER_TRACKER_LENGTH: "256px";
2
2
  export const PROGRESS_TRACKER_SIZES: string[];
3
- export const PROGRESS_TRACKER_VARIANTS: string[];
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PROGRESS_TRACKER_VARIANTS = exports.PROGRESS_TRACKER_SIZES = exports.OUTER_TRACKER_LENGTH = void 0;
6
+ exports.PROGRESS_TRACKER_SIZES = exports.OUTER_TRACKER_LENGTH = void 0;
7
7
  const OUTER_TRACKER_LENGTH = "256px";
8
8
  exports.OUTER_TRACKER_LENGTH = OUTER_TRACKER_LENGTH;
9
9
  const PROGRESS_TRACKER_SIZES = ["small", "medium", "large"];
10
- exports.PROGRESS_TRACKER_SIZES = PROGRESS_TRACKER_SIZES;
11
- const PROGRESS_TRACKER_VARIANTS = ["default", "traffic"];
12
- exports.PROGRESS_TRACKER_VARIANTS = PROGRESS_TRACKER_VARIANTS;
10
+ exports.PROGRESS_TRACKER_SIZES = PROGRESS_TRACKER_SIZES;
@@ -1,6 +1,19 @@
1
1
  import { MarginProps } from "styled-system";
2
2
 
3
3
  export interface ProgressBarProps extends MarginProps {
4
+ /** Specifies an aria-label to the component */
5
+ "aria-label"?: string;
6
+ /** Specifies the aria-describedby for the component */
7
+ "aria-describedby"?: string;
8
+ /** The value of progress to be read out to the user. */
9
+ "aria-valuenow"?: number;
10
+ /** The minimum value of the progress tracker */
11
+ "aria-valuemin"?: number;
12
+ /** The maximum value of the progress tracker */
13
+ "aria-valueMax"?: number;
14
+ /** Prop to define the human readable text alternative of aria-valuenow
15
+ * if aria-valuenow is not a number */
16
+ "aria-valuetext"?: string;
4
17
  /** Size of the progressBar. */
5
18
  size?: "small" | "medium" | "large";
6
19
  /** Current progress (percentage). */
@@ -11,11 +24,6 @@ export interface ProgressBarProps extends MarginProps {
11
24
  currentProgressLabel?: string;
12
25
  /** Value to display as the maximum progress limit. */
13
26
  maxProgressLabel?: string;
14
- /**
15
- * Sets the colour of the bar that shows the current progress.
16
- * The "traffic" variant changes the colour of status bar depending on current progress.
17
- * */
18
- variant?: "default" | "traffic";
19
27
  /** The orientation of the component. */
20
28
  orientation?: "horizontal" | "vertical";
21
29
  /** The direction the bar should move as progress increases, only applies in vertical orientation. */
@@ -43,12 +43,11 @@ const StyledProgressBar = _styledComponents.default.span`
43
43
  ${({
44
44
  direction,
45
45
  isVertical,
46
- size,
47
- theme
46
+ size
48
47
  }) => (0, _styledComponents.css)`
49
48
  display: flex;
50
49
  position: relative;
51
- background-color: ${theme.progressTracker.background};
50
+ background-color: var(--colorsSemanticNeutral200);
52
51
 
53
52
  ${!isVertical && (0, _styledComponents.css)`
54
53
  overflow-x: hidden;
@@ -68,16 +67,12 @@ const StyledProgressBar = _styledComponents.default.span`
68
67
  `;
69
68
  exports.StyledProgressBar = StyledProgressBar;
70
69
  const StyledValue = _styledComponents.default.span`
70
+ color: var(--colorsUtilityYin090);
71
71
  ${({
72
- isMaxValue,
73
- theme
72
+ isMaxValue
74
73
  }) => (0, _styledComponents.css)`
75
- ${isMaxValue && `
76
- color: ${theme.text.placeholder};
77
- `}
78
- ${!isMaxValue && `
79
- font-weight: bold;
80
- `}
74
+ ${isMaxValue && `color: var(--colorsUtilityYin055);`}
75
+ ${!isMaxValue && `font-weight: bold;`}
81
76
  `}
82
77
  `;
83
78
  exports.StyledValue = StyledValue;
@@ -121,13 +116,11 @@ const InnerBar = _styledComponents.default.span`
121
116
  ${({
122
117
  isVertical,
123
118
  progress,
124
- size,
125
- theme,
126
- variant
119
+ size
127
120
  }) => (0, _styledComponents.css)`
128
121
  position: absolute;
129
122
  left: 0;
130
- background-color: ${getInnerBarColour(variant, progress, theme)};
123
+ background-color: ${getInnerBarColour(progress)};
131
124
 
132
125
  ${!isVertical && (0, _styledComponents.css)`
133
126
  width: calc(${_progressTracker.OUTER_TRACKER_LENGTH} * ${progress / 100});
@@ -146,44 +139,49 @@ exports.InnerBar = InnerBar;
146
139
  function getHeight(size) {
147
140
  switch (size) {
148
141
  case "small":
149
- return "4px";
142
+ return "var(--sizing050)";
150
143
 
151
144
  case "large":
152
- return "16px";
145
+ return "var(--sizing200)";
153
146
 
154
147
  default:
155
- return "8px";
148
+ return "var(--sizing100)";
156
149
  }
157
150
  }
158
151
 
159
- function getInnerBarColour(variant, progress, theme) {
160
- if (progress >= 100) return theme.colors.success;
161
- if (variant === "default") return theme.progressTracker.innerBackground;
162
- if (progress < 20) return theme.colors.error;
163
- return theme.progressTracker.trafficNeutral;
152
+ function getInnerBarColour(progress) {
153
+ if (progress >= 100) return "var(--colorsSemanticPositive500)";
154
+ return "var(--colorsSemanticNeutral500)";
164
155
  }
165
156
 
166
157
  StyledProgressTracker.defaultProps = {
167
158
  theme: _base.default
168
159
  };
169
160
  StyledProgressBar.defaultProps = {
170
- theme: _base.default,
161
+ size: "medium"
162
+ };
163
+ InnerBar.defaultProps = {
164
+ progress: 0,
171
165
  size: "medium"
172
166
  };
173
167
  InnerBar.propTypes = {
174
168
  size: _propTypes.default.oneOf(_progressTracker.PROGRESS_TRACKER_SIZES),
175
169
  progress: _propTypes.default.number,
176
- variant: _propTypes.default.oneOf(_progressTracker.PROGRESS_TRACKER_VARIANTS)
170
+ isVertical: _propTypes.default.bool
177
171
  };
178
- InnerBar.defaultProps = {
179
- progress: 0,
180
- theme: _base.default,
181
- size: "medium",
182
- variant: "default"
172
+ StyledProgressTracker.propTypes = {
173
+ theme: _propTypes.default.object,
174
+ isVertical: _propTypes.default.bool
183
175
  };
184
- StyledValue.defaultProps = {
185
- theme: _base.default
176
+ StyledValuesLabel.propTypes = {
177
+ isVertical: _propTypes.default.bool,
178
+ position: _propTypes.default.oneOf(["top", "bottom", "left", "right"])
179
+ };
180
+ StyledValue.propTypes = {
181
+ isMaxValue: _propTypes.default.bool
186
182
  };
187
183
  StyledProgressBar.propTypes = {
184
+ direction: _propTypes.default.oneOf(["up", "down"]),
185
+ isVertical: _propTypes.default.bool,
188
186
  size: _propTypes.default.oneOf(_progressTracker.PROGRESS_TRACKER_SIZES)
189
187
  };
@@ -22,28 +22,28 @@ const StyledSplitButtonChildrenContainer = _styledComponents.default.div`
22
22
  theme,
23
23
  align
24
24
  }) => (0, _styledComponents.css)`
25
- background-color: ${theme.colors.secondary};
25
+ background-color: var(--colorsActionMajorYang100);
26
26
  min-width: ${({
27
27
  minWidth
28
28
  }) => minWidth}px;
29
29
  white-space: nowrap;
30
30
  z-index: ${theme.zIndex.popover};
31
+ box-shadow: var(--boxShadow100);
31
32
 
32
33
  ${_button.default} {
33
- background-color: ${theme.colors.secondary};
34
- border: 1px solid ${theme.colors.secondary};
35
- color: ${theme.colors.white};
34
+ background-color: var(--colorsActionMajorYang100);
35
+ border: 1px solid var(--colorsActionMajorTransparent);
36
+ color: var(--colorsActionMajor500);
36
37
  display: block;
37
38
  margin-left: 0;
38
- margin-top: 3px;
39
- margin-bottom: 3px;
40
39
  min-width: 100%;
41
40
  text-align: ${align};
42
41
  z-index: ${theme.zIndex.overlay};
43
42
 
44
43
  &:focus,
45
44
  &:hover {
46
- background-color: ${theme.colors.tertiary};
45
+ color: var(--colorsActionMajorYang100);
46
+ background-color: var(--colorsActionMajor600);
47
47
  }
48
48
 
49
49
  & + & {
@@ -27,23 +27,32 @@ const StyledSplitButtonToggle = (0, _styledComponents.default)(_button.default)`
27
27
  buttonType,
28
28
  disabled,
29
29
  displayed,
30
- size,
31
- theme
30
+ size
32
31
  }) => (0, _styledComponents.css)`
33
32
  ${!disabled && displayed ? (0, _styledComponents.css)`
34
- background-color: ${theme.colors.secondary};
35
- border-color: ${theme.colors.secondary};
33
+ background-color: var(--colorsActionMajor500);
34
+ border-color: var(--colorsActionMajor500);
36
35
 
37
36
  &,
38
37
  ${_icon.default} {
39
- color: ${theme.colors.white};
38
+ color: var(--colorsActionMajorYang100);
40
39
  }
41
40
 
42
41
  &:focus {
43
- border-left-color: ${theme.colors.secondary};
42
+ border-left-color: var(--colorsSemanticFocus500);
44
43
  }
45
44
  ` : ""}
46
- ${!disabled && buttonType === "primary" && `border-left-color: ${theme.colors.secondary};`}
45
+ ${!disabled && buttonType === "primary" && `position: relative;
46
+ &::before {
47
+ content: '';
48
+ width: 2px;
49
+ height: 100%;
50
+ background: var(--colorsActionMajorYang100);
51
+ position: absolute;
52
+ left: -2px;
53
+ z-index: 2;
54
+ }
55
+ `}
47
56
  ${buttonType === "secondary" && "border-left-width: 0;"}
48
57
  padding: 0 ${horizontalPaddingSizes[size]}px;
49
58
 
@@ -25,9 +25,7 @@ const StyledSplitButton = _styledComponents.default.div`
25
25
  margin: 0;
26
26
 
27
27
  &:focus {
28
- border: 3px solid ${({
29
- theme
30
- }) => theme.colors.focus};
28
+ border: 3px solid var(--colorsSemanticFocus500);
31
29
  outline: none;
32
30
  margin: -1px;
33
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "102.21.0",
3
+ "version": "103.1.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {