carbon-react 112.0.0 → 112.0.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.
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ export interface BatchSelectionProps {
3
+ /** Content to be rendered after selected count */
4
+ children: React.ReactNode;
5
+ /** Color of the background, transparent if not defined */
6
+ colorTheme?: "dark" | "light" | "white" | "transparent";
7
+ /** If true disables all user interaction */
8
+ disabled?: boolean;
9
+ /** Hidden if true */
10
+ hidden?: boolean;
11
+ /** Number of selected elements */
12
+ selectedCount: number;
13
+ }
14
+ export declare const BatchSelection: ({ disabled, children, colorTheme, selectedCount, hidden, }: BatchSelectionProps) => JSX.Element;
15
+ export default BatchSelection;
@@ -6,7 +6,7 @@ import { StyledBatchSelection, StyledSelectionCount } from "./batch-selection.st
6
6
  const BatchSelection = ({
7
7
  disabled,
8
8
  children,
9
- colorTheme,
9
+ colorTheme = "transparent",
10
10
  selectedCount,
11
11
  hidden
12
12
  }) => {
@@ -22,22 +22,11 @@ const BatchSelection = ({
22
22
  };
23
23
 
24
24
  BatchSelection.propTypes = {
25
- /** Content to be rendered after selected count */
26
- children: PropTypes.node.isRequired,
27
-
28
- /** Number of selected elements */
29
- selectedCount: PropTypes.number.isRequired,
30
-
31
- /** Color of the background, transparent if not defined */
32
- colorTheme: PropTypes.oneOf(["dark", "light", "white", "transparent"]),
33
-
34
- /** If true disables all user interaction */
35
- disabled: PropTypes.bool,
36
-
37
- /** Hidden if true */
38
- hidden: PropTypes.bool
39
- };
40
- BatchSelection.defaultProps = {
41
- colorTheme: "transparent"
25
+ "children": PropTypes.node,
26
+ "colorTheme": PropTypes.oneOf(["dark", "light", "transparent", "white"]),
27
+ "disabled": PropTypes.bool,
28
+ "hidden": PropTypes.bool,
29
+ "selectedCount": PropTypes.number.isRequired
42
30
  };
31
+ export { BatchSelection };
43
32
  export default BatchSelection;
@@ -0,0 +1,4 @@
1
+ import { BatchSelectionProps } from ".";
2
+ declare const StyledBatchSelection: import("styled-components").StyledComponent<"div", any, Pick<BatchSelectionProps, "disabled" | "hidden" | "colorTheme">, never>;
3
+ declare const StyledSelectionCount: import("styled-components").StyledComponent<"span", any, {}, never>;
4
+ export { StyledBatchSelection, StyledSelectionCount };
@@ -1 +1,2 @@
1
- export { default } from "./batch-selection";
1
+ export { default } from "./batch-selection.component";
2
+ export type { BatchSelectionProps } from "./batch-selection.component";
@@ -104,12 +104,8 @@ const Tabs = ({
104
104
  previousSelectedTabId.current = selectedTabId;
105
105
  }
106
106
  }, [blurPreviousSelectedTab, previousSelectedTabId, selectedTabId, selectedTabIdState]);
107
- /** Determines if the tab titles are in a vertical format. */
108
-
109
- const isVertical = currentPosition => currentPosition === "left";
110
107
  /** Handles the changing of tabs with the mouse */
111
108
 
112
-
113
109
  const handleTabClick = ev => {
114
110
  if (Event.isEventType(ev, "keydown")) {
115
111
  return;
@@ -147,7 +143,7 @@ const Tabs = ({
147
143
 
148
144
  const handleKeyDown = index => {
149
145
  return event => {
150
- const isTabVertical = isVertical(position);
146
+ const isTabVertical = isInSidebar || position === "left";
151
147
  const isUp = isTabVertical && Event.isUpKey(event);
152
148
  const isDown = isTabVertical && Event.isDownKey(event);
153
149
  const isLeft = !isTabVertical && Event.isLeftKey(event);
@@ -1,2 +1,5 @@
1
- declare const StyledPrefix: import("styled-components").StyledComponent<"span", any, {}, never>;
1
+ import { TextboxProps } from "../textbox.component";
2
+ declare const StyledPrefix: import("styled-components").StyledComponent<"span", any, {
3
+ size: NonNullable<TextboxProps["size"]>;
4
+ }, never>;
2
5
  export default StyledPrefix;
@@ -1,7 +1,14 @@
1
1
  import styled from "styled-components";
2
+ import InputSizes from "../../../__internal__/input/input-sizes.style";
2
3
  const StyledPrefix = styled.span`
3
4
  align-self: center;
4
5
  font-weight: 900;
5
- margin-right: 8px;
6
+ margin-left: ${({
7
+ size
8
+ }) => InputSizes[size].horizontalPadding}; // margin must match the original component padding
9
+
10
+ && + input {
11
+ padding-left: var(--spacing100);
12
+ }
6
13
  `;
7
14
  export default StyledPrefix;
@@ -114,7 +114,8 @@ const Textbox = ({
114
114
  positionedChildren: positionedChildren,
115
115
  hasIcon: hasIconInside
116
116
  }, leftChildren, prefix && /*#__PURE__*/React.createElement(StyledPrefix, {
117
- "data-element": "textbox-prefix"
117
+ "data-element": "textbox-prefix",
118
+ size: size
118
119
  }, prefix), /*#__PURE__*/React.createElement(Input, _extends({}, required && {
119
120
  required
120
121
  }, {
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ export interface BatchSelectionProps {
3
+ /** Content to be rendered after selected count */
4
+ children: React.ReactNode;
5
+ /** Color of the background, transparent if not defined */
6
+ colorTheme?: "dark" | "light" | "white" | "transparent";
7
+ /** If true disables all user interaction */
8
+ disabled?: boolean;
9
+ /** Hidden if true */
10
+ hidden?: boolean;
11
+ /** Number of selected elements */
12
+ selectedCount: number;
13
+ }
14
+ export declare const BatchSelection: ({ disabled, children, colorTheme, selectedCount, hidden, }: BatchSelectionProps) => JSX.Element;
15
+ export default BatchSelection;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.BatchSelection = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -18,7 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  const BatchSelection = ({
19
19
  disabled,
20
20
  children,
21
- colorTheme,
21
+ colorTheme = "transparent",
22
22
  selectedCount,
23
23
  hidden
24
24
  }) => {
@@ -33,24 +33,13 @@ const BatchSelection = ({
33
33
  }, l.batchSelection.selected(selectedCount)), children);
34
34
  };
35
35
 
36
+ exports.BatchSelection = BatchSelection;
36
37
  BatchSelection.propTypes = {
37
- /** Content to be rendered after selected count */
38
- children: _propTypes.default.node.isRequired,
39
-
40
- /** Number of selected elements */
41
- selectedCount: _propTypes.default.number.isRequired,
42
-
43
- /** Color of the background, transparent if not defined */
44
- colorTheme: _propTypes.default.oneOf(["dark", "light", "white", "transparent"]),
45
-
46
- /** If true disables all user interaction */
47
- disabled: _propTypes.default.bool,
48
-
49
- /** Hidden if true */
50
- hidden: _propTypes.default.bool
51
- };
52
- BatchSelection.defaultProps = {
53
- colorTheme: "transparent"
38
+ "children": _propTypes.default.node,
39
+ "colorTheme": _propTypes.default.oneOf(["dark", "light", "transparent", "white"]),
40
+ "disabled": _propTypes.default.bool,
41
+ "hidden": _propTypes.default.bool,
42
+ "selectedCount": _propTypes.default.number.isRequired
54
43
  };
55
44
  var _default = BatchSelection;
56
45
  exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import { BatchSelectionProps } from ".";
2
+ declare const StyledBatchSelection: import("styled-components").StyledComponent<"div", any, Pick<BatchSelectionProps, "disabled" | "hidden" | "colorTheme">, never>;
3
+ declare const StyledSelectionCount: import("styled-components").StyledComponent<"span", any, {}, never>;
4
+ export { StyledBatchSelection, StyledSelectionCount };
@@ -1 +1,2 @@
1
- export { default } from "./batch-selection";
1
+ export { default } from "./batch-selection.component";
2
+ export type { BatchSelectionProps } from "./batch-selection.component";
@@ -134,12 +134,8 @@ const Tabs = ({
134
134
  previousSelectedTabId.current = selectedTabId;
135
135
  }
136
136
  }, [blurPreviousSelectedTab, previousSelectedTabId, selectedTabId, selectedTabIdState]);
137
- /** Determines if the tab titles are in a vertical format. */
138
-
139
- const isVertical = currentPosition => currentPosition === "left";
140
137
  /** Handles the changing of tabs with the mouse */
141
138
 
142
-
143
139
  const handleTabClick = ev => {
144
140
  if (_events.default.isEventType(ev, "keydown")) {
145
141
  return;
@@ -177,7 +173,7 @@ const Tabs = ({
177
173
 
178
174
  const handleKeyDown = index => {
179
175
  return event => {
180
- const isTabVertical = isVertical(position);
176
+ const isTabVertical = isInSidebar || position === "left";
181
177
 
182
178
  const isUp = isTabVertical && _events.default.isUpKey(event);
183
179
 
@@ -1,2 +1,5 @@
1
- declare const StyledPrefix: import("styled-components").StyledComponent<"span", any, {}, never>;
1
+ import { TextboxProps } from "../textbox.component";
2
+ declare const StyledPrefix: import("styled-components").StyledComponent<"span", any, {
3
+ size: NonNullable<TextboxProps["size"]>;
4
+ }, never>;
2
5
  export default StyledPrefix;
@@ -7,12 +7,20 @@ exports.default = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
 
10
+ var _inputSizes = _interopRequireDefault(require("../../../__internal__/input/input-sizes.style"));
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  const StyledPrefix = _styledComponents.default.span`
13
15
  align-self: center;
14
16
  font-weight: 900;
15
- margin-right: 8px;
17
+ margin-left: ${({
18
+ size
19
+ }) => _inputSizes.default[size].horizontalPadding}; // margin must match the original component padding
20
+
21
+ && + input {
22
+ padding-left: var(--spacing100);
23
+ }
16
24
  `;
17
25
  var _default = StyledPrefix;
18
26
  exports.default = _default;
@@ -144,7 +144,8 @@ const Textbox = ({
144
144
  positionedChildren: positionedChildren,
145
145
  hasIcon: hasIconInside
146
146
  }, leftChildren, prefix && /*#__PURE__*/_react.default.createElement(_prefix.default, {
147
- "data-element": "textbox-prefix"
147
+ "data-element": "textbox-prefix",
148
+ size: size
148
149
  }, prefix), /*#__PURE__*/_react.default.createElement(_input.Input, _extends({}, required && {
149
150
  required
150
151
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "112.0.0",
3
+ "version": "112.0.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -1,18 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface BatchSelectionProps {
4
- /** Content to be rendered after selected count */
5
- children: React.ReactNode;
6
- /** Color of the background, transparent if not defined */
7
- colorTheme?: "dark" | "light" | "white" | "transparent";
8
- /** If true disables all user interaction */
9
- disabled?: boolean;
10
- /** Hidden if true */
11
- hidden?: boolean;
12
- /** Number of selected elements */
13
- selectedCount: number;
14
- }
15
-
16
- declare function BatchSelection(props: BatchSelectionProps): JSX.Element;
17
-
18
- export default BatchSelection;
@@ -1,18 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface BatchSelectionProps {
4
- /** Content to be rendered after selected count */
5
- children: React.ReactNode;
6
- /** Color of the background, transparent if not defined */
7
- colorTheme?: "dark" | "light" | "white" | "transparent";
8
- /** If true disables all user interaction */
9
- disabled?: boolean;
10
- /** Hidden if true */
11
- hidden?: boolean;
12
- /** Number of selected elements */
13
- selectedCount: number;
14
- }
15
-
16
- declare function BatchSelection(props: BatchSelectionProps): JSX.Element;
17
-
18
- export default BatchSelection;