carbon-react 106.6.1 → 106.6.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.
@@ -1,2 +1,13 @@
1
+ import React from "react";
2
+ import { SpaceProps, LayoutProps, FlexboxProps, ColorProps } from "styled-system";
3
+ export declare type OverflowWrap = "break-word" | "anywhere";
4
+ export declare type ScrollVariant = "light" | "dark";
5
+ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, ColorProps {
6
+ as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
7
+ /** String to set Box content break strategy. Note "anywhere" is not supported in Safari */
8
+ overflowWrap?: OverflowWrap;
9
+ /** scroll styling attribute */
10
+ scrollVariant?: ScrollVariant;
11
+ }
12
+ declare const Box: import("styled-components").StyledComponent<"div", any, BoxProps, never>;
1
13
  export default Box;
2
- declare const Box: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,15 +1,23 @@
1
- import propTypes from "@styled-system/prop-types";
2
- import PropTypes from "prop-types";
3
1
  import styled, { css } from "styled-components";
4
2
  import { space, layout, flexbox } from "styled-system";
5
3
  import BaseTheme from "../../style/themes/base";
6
- import color from "../../style/utils/color";
4
+ import styledColor from "../../style/utils/color";
7
5
  import boxConfig from "./box.config";
8
6
  const Box = styled.div`
9
7
  ${space}
10
8
  ${layout}
11
9
  ${flexbox}
12
- ${color}
10
+ ${({
11
+ color,
12
+ bg,
13
+ backgroundColor,
14
+ ...rest
15
+ }) => styledColor({
16
+ color,
17
+ bg,
18
+ backgroundColor,
19
+ ...rest
20
+ })}
13
21
 
14
22
  ${({
15
23
  overflowWrap
@@ -34,25 +42,6 @@ const Box = styled.div`
34
42
  }
35
43
  `}
36
44
  `;
37
- Box.propTypes = {
38
- /** Styled system box props */
39
- ...propTypes.space,
40
-
41
- /** Styled system flex props */
42
- ...propTypes.flexbox,
43
-
44
- /** Styled system layout props */
45
- ...propTypes.layout,
46
-
47
- /** Styled system color props */
48
- ...propTypes.color,
49
-
50
- /** String to set Box content break strategy. Note "anywhere" is not supported in Safari and IE11 */
51
- overflowWrap: PropTypes.oneOf(["break-word", "anywhere"]),
52
-
53
- /** scroll styling attribute */
54
- scrollVariant: PropTypes.oneOf(["light", "dark"])
55
- };
56
45
  Box.defaultProps = {
57
46
  theme: BaseTheme
58
47
  };
@@ -1,13 +1,11 @@
1
- declare namespace _default {
2
- namespace light {
3
- const thumb: string;
4
- const track: string;
5
- }
6
- namespace dark {
7
- const thumb_1: string;
8
- export { thumb_1 as thumb };
9
- const track_1: string;
10
- export { track_1 as track };
11
- }
12
- }
1
+ declare const _default: {
2
+ light: {
3
+ thumb: string;
4
+ track: string;
5
+ };
6
+ dark: {
7
+ thumb: string;
8
+ track: string;
9
+ };
10
+ };
13
11
  export default _default;
@@ -1 +1,2 @@
1
- export { default } from "./box";
1
+ export { default } from "./box.component";
2
+ export type { BoxProps } from "./box.component";
@@ -1,3 +1,2 @@
1
- declare var _default: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
1
+ declare var _default: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
2
2
  export default _default;
3
- import Box from "../box";
@@ -2,9 +2,8 @@ export const StyledSidebarHeader: import("styled-components").StyledComponent<"d
2
2
  export const StyledDrawerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export const StyledDrawerContent: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export const StyledDrawerChildren: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export const StyledDrawerSidebar: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
5
+ export const StyledDrawerSidebar: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
6
6
  export const StyledSidebarTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export const StyledButton: import("styled-components").StyledComponent<"button", any, {
8
8
  type: "button";
9
9
  }, "type">;
10
- import Box from "../box";
@@ -1,5 +1,4 @@
1
- export const StyledPicklist: import("styled-components").StyledComponent<typeof Box, any, {
2
- as: "ul";
1
+ export const StyledPicklist: import("styled-components").StyledComponent<"div", any, import("../../box").BoxProps & {
2
+ as: string;
3
3
  }, "as">;
4
4
  export const StyledEmptyContainer: import("styled-components").StyledComponent<"li", any, {}, never>;
5
- import Box from "../../box";
@@ -1,5 +1,4 @@
1
- export const StyledFlatTableWrapper: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
1
+ export const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
2
2
  export const StyledFlatTable: import("styled-components").StyledComponent<"table", any, {}, never>;
3
3
  export const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export const StyledTableContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- import Box from "../box";
@@ -27,6 +27,7 @@ const Form = ({
27
27
  } = useContext(SidebarContext);
28
28
  const formRef = useRef();
29
29
  const formFooterRef = useRef();
30
+ const renderFooter = !!(saveButton || leftSideButtons || rightSideButtons || errorCount || warningCount);
30
31
  return /*#__PURE__*/React.createElement(StyledForm, _extends({
31
32
  ref: formRef,
32
33
  stickyFooter: stickyFooter,
@@ -40,7 +41,7 @@ const Form = ({
40
41
  "data-element": "form-content",
41
42
  stickyFooter: stickyFooter,
42
43
  className: stickyFooter ? "sticky" : ""
43
- }, children), /*#__PURE__*/React.createElement(StyledFormFooter, {
44
+ }, children), renderFooter && /*#__PURE__*/React.createElement(StyledFormFooter, {
44
45
  "data-element": "form-footer",
45
46
  className: stickyFooter ? "sticky" : "",
46
47
  ref: formFooterRef,
@@ -1,2 +1,13 @@
1
+ import React from "react";
2
+ import { SpaceProps, LayoutProps, FlexboxProps, ColorProps } from "styled-system";
3
+ export declare type OverflowWrap = "break-word" | "anywhere";
4
+ export declare type ScrollVariant = "light" | "dark";
5
+ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, ColorProps {
6
+ as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
7
+ /** String to set Box content break strategy. Note "anywhere" is not supported in Safari */
8
+ overflowWrap?: OverflowWrap;
9
+ /** scroll styling attribute */
10
+ scrollVariant?: ScrollVariant;
11
+ }
12
+ declare const Box: import("styled-components").StyledComponent<"div", any, BoxProps, never>;
1
13
  export default Box;
2
- declare const Box: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -5,10 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _propTypes = _interopRequireDefault(require("@styled-system/prop-types"));
9
-
10
- var _propTypes2 = _interopRequireDefault(require("prop-types"));
11
-
12
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
13
9
 
14
10
  var _styledSystem = require("styled-system");
@@ -19,17 +15,27 @@ var _color = _interopRequireDefault(require("../../style/utils/color"));
19
15
 
20
16
  var _box = _interopRequireDefault(require("./box.config"));
21
17
 
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
22
20
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
23
21
 
24
22
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
23
 
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
24
  const Box = _styledComponents.default.div`
29
25
  ${_styledSystem.space}
30
26
  ${_styledSystem.layout}
31
27
  ${_styledSystem.flexbox}
32
- ${_color.default}
28
+ ${({
29
+ color,
30
+ bg,
31
+ backgroundColor,
32
+ ...rest
33
+ }) => (0, _color.default)({
34
+ color,
35
+ bg,
36
+ backgroundColor,
37
+ ...rest
38
+ })}
33
39
 
34
40
  ${({
35
41
  overflowWrap
@@ -54,25 +60,6 @@ const Box = _styledComponents.default.div`
54
60
  }
55
61
  `}
56
62
  `;
57
- Box.propTypes = {
58
- /** Styled system box props */
59
- ..._propTypes.default.space,
60
-
61
- /** Styled system flex props */
62
- ..._propTypes.default.flexbox,
63
-
64
- /** Styled system layout props */
65
- ..._propTypes.default.layout,
66
-
67
- /** Styled system color props */
68
- ..._propTypes.default.color,
69
-
70
- /** String to set Box content break strategy. Note "anywhere" is not supported in Safari and IE11 */
71
- overflowWrap: _propTypes2.default.oneOf(["break-word", "anywhere"]),
72
-
73
- /** scroll styling attribute */
74
- scrollVariant: _propTypes2.default.oneOf(["light", "dark"])
75
- };
76
63
  Box.defaultProps = {
77
64
  theme: _base.default
78
65
  };
@@ -1,13 +1,11 @@
1
- declare namespace _default {
2
- namespace light {
3
- const thumb: string;
4
- const track: string;
5
- }
6
- namespace dark {
7
- const thumb_1: string;
8
- export { thumb_1 as thumb };
9
- const track_1: string;
10
- export { track_1 as track };
11
- }
12
- }
1
+ declare const _default: {
2
+ light: {
3
+ thumb: string;
4
+ track: string;
5
+ };
6
+ dark: {
7
+ thumb: string;
8
+ track: string;
9
+ };
10
+ };
13
11
  export default _default;
@@ -1 +1,2 @@
1
- export { default } from "./box";
1
+ export { default } from "./box.component";
2
+ export type { BoxProps } from "./box.component";
@@ -1,3 +1,2 @@
1
- declare var _default: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
1
+ declare var _default: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
2
2
  export default _default;
3
- import Box from "../box";
@@ -2,9 +2,8 @@ export const StyledSidebarHeader: import("styled-components").StyledComponent<"d
2
2
  export const StyledDrawerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export const StyledDrawerContent: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export const StyledDrawerChildren: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export const StyledDrawerSidebar: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
5
+ export const StyledDrawerSidebar: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
6
6
  export const StyledSidebarTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export const StyledButton: import("styled-components").StyledComponent<"button", any, {
8
8
  type: "button";
9
9
  }, "type">;
10
- import Box from "../box";
@@ -1,5 +1,4 @@
1
- export const StyledPicklist: import("styled-components").StyledComponent<typeof Box, any, {
2
- as: "ul";
1
+ export const StyledPicklist: import("styled-components").StyledComponent<"div", any, import("../../box").BoxProps & {
2
+ as: string;
3
3
  }, "as">;
4
4
  export const StyledEmptyContainer: import("styled-components").StyledComponent<"li", any, {}, never>;
5
- import Box from "../../box";
@@ -1,5 +1,4 @@
1
- export const StyledFlatTableWrapper: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
1
+ export const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
2
2
  export const StyledFlatTable: import("styled-components").StyledComponent<"table", any, {}, never>;
3
3
  export const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export const StyledTableContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- import Box from "../box";
@@ -45,6 +45,7 @@ const Form = ({
45
45
  } = (0, _react.useContext)(_sidebar.SidebarContext);
46
46
  const formRef = (0, _react.useRef)();
47
47
  const formFooterRef = (0, _react.useRef)();
48
+ const renderFooter = !!(saveButton || leftSideButtons || rightSideButtons || errorCount || warningCount);
48
49
  return /*#__PURE__*/_react.default.createElement(_form.StyledForm, _extends({
49
50
  ref: formRef,
50
51
  stickyFooter: stickyFooter,
@@ -58,7 +59,7 @@ const Form = ({
58
59
  "data-element": "form-content",
59
60
  stickyFooter: stickyFooter,
60
61
  className: stickyFooter ? "sticky" : ""
61
- }, children), /*#__PURE__*/_react.default.createElement(_form.StyledFormFooter, {
62
+ }, children), renderFooter && /*#__PURE__*/_react.default.createElement(_form.StyledFormFooter, {
62
63
  "data-element": "form-footer",
63
64
  className: stickyFooter ? "sticky" : "",
64
65
  ref: formFooterRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "106.6.1",
3
+ "version": "106.6.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -1,31 +0,0 @@
1
- import * as React from "react";
2
- import { StyledComponentProps } from "styled-components";
3
- import {
4
- ColorProps,
5
- FlexboxProps,
6
- LayoutProps,
7
- SpaceProps,
8
- } from "styled-system";
9
-
10
- export interface BoxProps
11
- extends SpaceProps,
12
- ColorProps,
13
- LayoutProps,
14
- FlexboxProps {
15
- as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
16
- overflowWrap?: "break-word" | "anywhere";
17
- scrollVariant?: "light" | "dark";
18
- }
19
-
20
- /**
21
- * HTML color prop have to be removed from the StyledComponentProps
22
- * as it's type conflicts with StyledSystem color prop
23
- */
24
- type PropsWithoutColor = Omit<
25
- StyledComponentProps<"div", Record<string, unknown>, BoxProps, "">,
26
- "color"
27
- >;
28
-
29
- declare function Box(attrs: PropsWithoutColor & ColorProps): JSX.Element;
30
-
31
- export default Box;
@@ -1,31 +0,0 @@
1
- import * as React from "react";
2
- import { StyledComponentProps } from "styled-components";
3
- import {
4
- ColorProps,
5
- FlexboxProps,
6
- LayoutProps,
7
- SpaceProps,
8
- } from "styled-system";
9
-
10
- export interface BoxProps
11
- extends SpaceProps,
12
- ColorProps,
13
- LayoutProps,
14
- FlexboxProps {
15
- as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
16
- overflowWrap?: "break-word" | "anywhere";
17
- scrollVariant?: "light" | "dark";
18
- }
19
-
20
- /**
21
- * HTML color prop have to be removed from the StyledComponentProps
22
- * as it's type conflicts with StyledSystem color prop
23
- */
24
- type PropsWithoutColor = Omit<
25
- StyledComponentProps<"div", Record<string, unknown>, BoxProps, "">,
26
- "color"
27
- >;
28
-
29
- declare function Box(attrs: PropsWithoutColor & ColorProps): JSX.Element;
30
-
31
- export default Box;