@thecb/components 6.0.0-beta.27 → 6.0.0-beta.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "6.0.0-beta.27",
3
+ "version": "6.0.0-beta.28",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,4 +1,4 @@
1
- import React, { Fragment } from "react";
1
+ import React, { Fragment, forwardRef } from "react";
2
2
  import { BoxWrapper } from "./Box.styled";
3
3
  import { safeChildren, screenReaderOnlyStyle } from "../../../util/general";
4
4
 
@@ -10,80 +10,84 @@ import { safeChildren, screenReaderOnlyStyle } from "../../../util/general";
10
10
  completely off screen (only for users of screen readers)
11
11
  */
12
12
 
13
- const Box = ({
14
- padding = "16px",
15
- borderSize = "0px",
16
- borderColor = "transparent",
17
- borderRadius,
18
- boxShadow = "none",
19
- background,
20
- color,
21
- minHeight,
22
- width,
23
- minWidth,
24
- maxWidth,
25
- borderWidthOverride,
26
- border,
27
- textAlign,
28
- hoverStyles,
29
- activeStyles,
30
- disabledStyles,
31
- variant,
32
- as,
33
- onClick,
34
- onKeyDown,
35
- onMouseEnter,
36
- onMouseLeave,
37
- onFocus,
38
- onBlur,
39
- onTouchEnd,
40
- theme,
41
- hiddenStyles,
42
- extraStyles,
43
- srOnly = false,
44
- ref,
45
- dataQa,
46
- children,
47
- ...rest
48
- }) => (
49
- <BoxWrapper
50
- padding={padding}
51
- borderSize={borderSize}
52
- borderColor={borderColor}
53
- boxShadow={boxShadow}
54
- color={color}
55
- minHeight={minHeight}
56
- width={width}
57
- minWidth={minWidth}
58
- maxWidth={maxWidth}
59
- background={background}
60
- borderRadius={borderRadius}
61
- borderWidthOverride={borderWidthOverride}
62
- border={border}
63
- hoverStyles={hoverStyles}
64
- activeStyles={activeStyles}
65
- disabledStyles={disabledStyles}
66
- variant={variant}
67
- as={as}
68
- onClick={onClick}
69
- hiddenStyles={hiddenStyles}
70
- onKeyDown={onKeyDown}
71
- extraStyles={
72
- srOnly ? `${screenReaderOnlyStyle}${extraStyles}` : extraStyles
73
- }
74
- theme={theme}
75
- textAlign={textAlign}
76
- data-qa={dataQa}
77
- onMouseEnter={onMouseEnter}
78
- onMouseLeave={onMouseLeave}
79
- onFocus={onFocus}
80
- onBlur={onBlur}
81
- onTouchEnd={onTouchEnd}
82
- ref={ref}
83
- {...rest}
84
- >
85
- {children && safeChildren(children, <Fragment />)}
86
- </BoxWrapper>
13
+ const Box = forwardRef(
14
+ (
15
+ {
16
+ padding = "16px",
17
+ borderSize = "0px",
18
+ borderColor = "transparent",
19
+ borderRadius,
20
+ boxShadow = "none",
21
+ background,
22
+ color,
23
+ minHeight,
24
+ width,
25
+ minWidth,
26
+ maxWidth,
27
+ borderWidthOverride,
28
+ border,
29
+ textAlign,
30
+ hoverStyles,
31
+ activeStyles,
32
+ disabledStyles,
33
+ variant,
34
+ as,
35
+ onClick,
36
+ onKeyDown,
37
+ onMouseEnter,
38
+ onMouseLeave,
39
+ onFocus,
40
+ onBlur,
41
+ onTouchEnd,
42
+ theme,
43
+ hiddenStyles,
44
+ extraStyles,
45
+ srOnly = false,
46
+ dataQa,
47
+ children,
48
+ ...rest
49
+ },
50
+ ref
51
+ ) => (
52
+ <BoxWrapper
53
+ padding={padding}
54
+ borderSize={borderSize}
55
+ borderColor={borderColor}
56
+ boxShadow={boxShadow}
57
+ color={color}
58
+ minHeight={minHeight}
59
+ width={width}
60
+ minWidth={minWidth}
61
+ maxWidth={maxWidth}
62
+ background={background}
63
+ borderRadius={borderRadius}
64
+ borderWidthOverride={borderWidthOverride}
65
+ border={border}
66
+ hoverStyles={hoverStyles}
67
+ activeStyles={activeStyles}
68
+ disabledStyles={disabledStyles}
69
+ variant={variant}
70
+ as={as}
71
+ onClick={onClick}
72
+ hiddenStyles={hiddenStyles}
73
+ onKeyDown={onKeyDown}
74
+ extraStyles={
75
+ srOnly ? `${screenReaderOnlyStyle}${extraStyles}` : extraStyles
76
+ }
77
+ theme={theme}
78
+ textAlign={textAlign}
79
+ data-qa={dataQa}
80
+ onMouseEnter={onMouseEnter}
81
+ onMouseLeave={onMouseLeave}
82
+ onFocus={onFocus}
83
+ onBlur={onBlur}
84
+ onTouchEnd={onTouchEnd}
85
+ ref={ref}
86
+ {...rest}
87
+ >
88
+ {children && safeChildren(children, <Fragment />)}
89
+ </BoxWrapper>
90
+ )
87
91
  );
88
92
 
89
93
  export default Box;
@@ -29,16 +29,8 @@ export const BoxWrapper = styled(
29
29
  hiddenStyles,
30
30
  ariaControls,
31
31
  ariaLabel,
32
- ref,
33
32
  ...props
34
- }) => (
35
- <div
36
- aria-controls={ariaControls}
37
- aria-label={ariaLabel}
38
- ref={ref}
39
- {...props}
40
- />
41
- )
33
+ }) => <div aria-controls={ariaControls} aria-label={ariaLabel} {...props} />
42
34
  )`
43
35
  position: relative;
44
36
  box-sizing: border-box;