carbon-react 106.0.2 → 106.0.3
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/esm/__internal__/input/index.d.ts +5 -5
- package/esm/__internal__/input/input-presentation.component.d.ts +21 -27
- package/esm/__internal__/input/input-presentation.component.js +7 -20
- package/esm/__internal__/input/input-presentation.style.d.ts +5 -8
- package/esm/__internal__/input/input-presentation.style.js +37 -53
- package/esm/__internal__/input/input-sizes.style.d.ts +8 -18
- package/esm/__internal__/input/input-sizes.style.js +3 -2
- package/esm/__internal__/input/input.component.d.ts +39 -2
- package/esm/__internal__/input/input.component.js +84 -66
- package/esm/__internal__/input/input.style.d.ts +2 -1
- package/esm/__internal__/input/input.style.js +0 -4
- package/esm/__internal__/input-behaviour/index.d.ts +2 -1
- package/esm/__internal__/input-behaviour/input-behaviour.component.d.ts +7 -10
- package/esm/__internal__/input-behaviour/input-behaviour.component.js +2 -7
- package/esm/__internal__/input-behaviour/input-group-behaviour.component.d.ts +8 -12
- package/esm/__internal__/input-behaviour/input-group-behaviour.component.js +1 -7
- package/esm/__internal__/input-behaviour/useInputBehaviour.d.ts +14 -10
- package/esm/__internal__/label/label.d.ts +1 -1
- package/esm/components/badge/badge.component.d.ts +10 -13
- package/esm/components/badge/badge.component.js +60 -24
- package/esm/components/badge/badge.style.d.ts +7 -5
- package/esm/components/badge/index.d.ts +2 -1
- package/esm/components/carbon-provider/carbon-provider.component.d.ts +8 -14
- package/esm/components/carbon-provider/carbon-provider.component.js +110 -14
- package/esm/components/carbon-provider/index.d.ts +2 -1
- package/esm/components/date-range/date-range.style.js +2 -2
- package/esm/components/decimal/decimal.component.js +2 -1
- package/esm/components/heading/heading.style.d.ts +1 -2
- package/esm/components/inline-inputs/index.d.ts +2 -1
- package/esm/components/inline-inputs/index.js +1 -1
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +25 -22
- package/esm/components/inline-inputs/inline-inputs.component.js +96 -60
- package/esm/components/inline-inputs/inline-inputs.config.d.ts +1 -1
- package/esm/components/inline-inputs/inline-inputs.style.d.ts +5 -3
- package/esm/components/inline-inputs/inline-inputs.style.js +2 -2
- package/esm/components/link/index.d.ts +1 -2
- package/esm/components/link/link.component.d.ts +37 -2
- package/esm/components/link/link.component.js +1243 -124
- package/esm/components/link/link.config.d.ts +2 -2
- package/esm/components/link/link.style.d.ts +7 -2
- package/esm/components/link/link.style.js +0 -5
- package/esm/components/pager/pager.style.d.ts +1 -2
- package/esm/components/pod/pod.style.d.ts +1 -2
- package/esm/components/simple-color-picker/simple-color-input/simple-color-input.style.d.ts +1 -1
- package/esm/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +1 -2
- package/esm/components/tile-select/tile-select.style.d.ts +1 -1
- package/lib/__internal__/input/index.d.ts +5 -5
- package/lib/__internal__/input/input-presentation.component.d.ts +21 -27
- package/lib/__internal__/input/input-presentation.component.js +7 -23
- package/lib/__internal__/input/input-presentation.style.d.ts +5 -8
- package/lib/__internal__/input/input-presentation.style.js +37 -54
- package/lib/__internal__/input/input-sizes.style.d.ts +8 -18
- package/lib/__internal__/input/input-sizes.style.js +2 -1
- package/lib/__internal__/input/input.component.d.ts +39 -2
- package/lib/__internal__/input/input.component.js +85 -69
- package/lib/__internal__/input/input.style.d.ts +2 -1
- package/lib/__internal__/input/input.style.js +0 -7
- package/lib/__internal__/input-behaviour/index.d.ts +2 -1
- package/lib/__internal__/input-behaviour/input-behaviour.component.d.ts +7 -10
- package/lib/__internal__/input-behaviour/input-behaviour.component.js +3 -10
- package/lib/__internal__/input-behaviour/input-group-behaviour.component.d.ts +8 -12
- package/lib/__internal__/input-behaviour/input-group-behaviour.component.js +2 -10
- package/lib/__internal__/input-behaviour/useInputBehaviour.d.ts +14 -10
- package/lib/__internal__/label/label.d.ts +1 -1
- package/lib/components/badge/badge.component.d.ts +10 -13
- package/lib/components/badge/badge.component.js +51 -29
- package/lib/components/badge/badge.style.d.ts +7 -5
- package/lib/components/badge/index.d.ts +2 -1
- package/lib/components/carbon-provider/carbon-provider.component.d.ts +8 -14
- package/lib/components/carbon-provider/carbon-provider.component.js +115 -20
- package/lib/components/carbon-provider/index.d.ts +2 -1
- package/lib/components/date-range/date-range.style.js +4 -4
- package/lib/components/decimal/decimal.component.js +2 -1
- package/lib/components/heading/heading.style.d.ts +1 -2
- package/lib/components/inline-inputs/index.d.ts +2 -1
- package/lib/components/inline-inputs/index.js +10 -2
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +25 -22
- package/lib/components/inline-inputs/inline-inputs.component.js +143 -68
- package/lib/components/inline-inputs/inline-inputs.config.d.ts +1 -1
- package/lib/components/inline-inputs/inline-inputs.style.d.ts +5 -3
- package/lib/components/inline-inputs/inline-inputs.style.js +2 -2
- package/lib/components/link/index.d.ts +1 -2
- package/lib/components/link/link.component.d.ts +37 -2
- package/lib/components/link/link.component.js +764 -146
- package/lib/components/link/link.config.d.ts +2 -2
- package/lib/components/link/link.style.d.ts +7 -2
- package/lib/components/link/link.style.js +0 -6
- package/lib/components/pager/pager.style.d.ts +1 -2
- package/lib/components/pod/pod.style.d.ts +1 -2
- package/lib/components/simple-color-picker/simple-color-input/simple-color-input.style.d.ts +1 -1
- package/lib/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +1 -2
- package/lib/components/tile-select/tile-select.style.d.ts +1 -1
- package/package.json +1 -1
- package/esm/__internal__/input/extract-props/extract-props.d.ts +0 -1
- package/esm/__internal__/input/extract-props/extract-props.js +0 -11
- package/esm/__internal__/input/extract-props/index.d.ts +0 -1
- package/esm/__internal__/input/extract-props/index.js +0 -1
- package/esm/__internal__/input/input-presentation.d.ts +0 -24
- package/esm/__internal__/input/input.d.ts +0 -54
- package/esm/components/badge/badge.d.ts +0 -14
- package/esm/components/carbon-provider/carbon-provider.d.ts +0 -12
- package/esm/components/inline-inputs/inline-inputs.d.ts +0 -30
- package/esm/components/link/link.d.ts +0 -47
- package/lib/__internal__/input/extract-props/extract-props.d.ts +0 -1
- package/lib/__internal__/input/extract-props/extract-props.js +0 -18
- package/lib/__internal__/input/extract-props/index.d.ts +0 -1
- package/lib/__internal__/input/extract-props/index.js +0 -15
- package/lib/__internal__/input/extract-props/package.json +0 -6
- package/lib/__internal__/input/input-presentation.d.ts +0 -24
- package/lib/__internal__/input/input.d.ts +0 -54
- package/lib/components/badge/badge.d.ts +0 -14
- package/lib/components/carbon-provider/carbon-provider.d.ts +0 -12
- package/lib/components/inline-inputs/inline-inputs.d.ts +0 -30
- package/lib/components/link/link.d.ts +0 -47
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
10
|
-
const counter: PropTypes.Requireable<string | number>;
|
|
11
|
-
const onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface BadgeProps {
|
|
3
|
+
/** The badge will be added to this element */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** The number rendered in the badge component */
|
|
6
|
+
counter?: string | number;
|
|
7
|
+
/** Callback fired when badge is clicked */
|
|
8
|
+
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
13
9
|
}
|
|
14
|
-
|
|
10
|
+
export declare const Badge: ({ children, counter, onClick }: BadgeProps) => JSX.Element;
|
|
11
|
+
export default Badge;
|
|
@@ -1,32 +1,68 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) => {
|
|
10
|
-
return /*#__PURE__*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
import {
|
|
4
|
+
StyledBadgeWrapper,
|
|
5
|
+
StyledButton,
|
|
6
|
+
StyledCrossIcon,
|
|
7
|
+
StyledCounter,
|
|
8
|
+
} from "./badge.style";
|
|
9
|
+
const Badge = ({ children, counter = 0, onClick }) => {
|
|
10
|
+
return /*#__PURE__*/ React.createElement(
|
|
11
|
+
StyledBadgeWrapper,
|
|
12
|
+
null,
|
|
13
|
+
counter > 0 &&
|
|
14
|
+
/*#__PURE__*/ React.createElement(
|
|
15
|
+
StyledButton,
|
|
16
|
+
{
|
|
17
|
+
"data-component": "badge",
|
|
18
|
+
buttonType: "secondary",
|
|
19
|
+
onClick: onClick,
|
|
20
|
+
},
|
|
21
|
+
/*#__PURE__*/ React.createElement(StyledCrossIcon, {
|
|
22
|
+
"data-element": "badge-cross-icon",
|
|
23
|
+
type: "cross",
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ React.createElement(
|
|
26
|
+
StyledCounter,
|
|
27
|
+
{
|
|
28
|
+
"data-element": "badge-counter",
|
|
29
|
+
},
|
|
30
|
+
counter > 99 ? 99 : counter
|
|
31
|
+
)
|
|
32
|
+
),
|
|
33
|
+
children
|
|
34
|
+
);
|
|
20
35
|
};
|
|
21
36
|
|
|
22
37
|
Badge.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The badge will be added to this element
|
|
40
|
+
*/
|
|
41
|
+
children: PropTypes.node,
|
|
42
|
+
/**
|
|
43
|
+
* The number rendered in the badge component
|
|
44
|
+
*/
|
|
27
45
|
counter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
46
|
+
/**
|
|
47
|
+
* Callback fired when badge is clicked
|
|
48
|
+
*/
|
|
49
|
+
onClick: PropTypes.func,
|
|
50
|
+
};
|
|
28
51
|
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
Badge.propTypes = {
|
|
53
|
+
/**
|
|
54
|
+
* The badge will be added to this element
|
|
55
|
+
*/
|
|
56
|
+
children: PropTypes.node,
|
|
57
|
+
/**
|
|
58
|
+
* The number rendered in the badge component
|
|
59
|
+
*/
|
|
60
|
+
counter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
61
|
+
/**
|
|
62
|
+
* Callback fired when badge is clicked
|
|
63
|
+
*/
|
|
64
|
+
onClick: PropTypes.func,
|
|
31
65
|
};
|
|
32
|
-
|
|
66
|
+
|
|
67
|
+
export { Badge };
|
|
68
|
+
export default Badge;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Icon from "../icon";
|
|
3
|
+
declare const StyledBadgeWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
declare const StyledCounter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
declare const StyledButton: import("styled-components").StyledComponent<{
|
|
3
6
|
({ size, subtext, as, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: import("../button").ButtonProps): JSX.Element;
|
|
4
7
|
displayName: string;
|
|
5
8
|
}, any, {}, never>;
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
import Icon from "../icon";
|
|
9
|
+
declare const StyledCrossIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
|
|
10
|
+
export { StyledBadgeWrapper, StyledButton, StyledCrossIcon, StyledCounter };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./badge";
|
|
1
|
+
export { default } from "./badge.component";
|
|
2
|
+
export type { BadgeProps } from "./badge.component";
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
export const NewValidationContext: React.Context<{}>;
|
|
2
|
-
export default CarbonProvider;
|
|
3
1
|
import React from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
theme?:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare namespace CarbonProvider {
|
|
10
|
-
namespace propTypes {
|
|
11
|
-
const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
12
|
-
const theme: PropTypes.Requireable<object>;
|
|
13
|
-
const validationRedesignOptIn: PropTypes.Requireable<boolean>;
|
|
14
|
-
}
|
|
2
|
+
import { ThemeObject } from "../../style/themes/base";
|
|
3
|
+
export interface CarbonProviderProps {
|
|
4
|
+
theme?: ThemeObject;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
validationRedesignOptIn?: boolean;
|
|
15
7
|
}
|
|
16
|
-
|
|
8
|
+
export declare const NewValidationContext: React.Context<Pick<CarbonProviderProps, "validationRedesignOptIn">>;
|
|
9
|
+
export declare const CarbonProvider: ({ children, theme, validationRedesignOptIn, }: CarbonProviderProps) => JSX.Element;
|
|
10
|
+
export default CarbonProvider;
|
|
@@ -3,23 +3,119 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import mintTheme from "../../style/themes/mint";
|
|
5
5
|
import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider";
|
|
6
|
-
export const NewValidationContext = /*#__PURE__*/createContext({});
|
|
7
|
-
|
|
6
|
+
export const NewValidationContext = /*#__PURE__*/ createContext({});
|
|
8
7
|
const CarbonProvider = ({
|
|
9
8
|
children,
|
|
10
9
|
theme = mintTheme,
|
|
11
|
-
validationRedesignOptIn = false
|
|
12
|
-
}) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
validationRedesignOptIn = false,
|
|
11
|
+
}) =>
|
|
12
|
+
/*#__PURE__*/ React.createElement(
|
|
13
|
+
ThemeProvider,
|
|
14
|
+
{
|
|
15
|
+
theme: theme,
|
|
16
|
+
},
|
|
17
|
+
/*#__PURE__*/ React.createElement(
|
|
18
|
+
CarbonScopedTokensProvider,
|
|
19
|
+
null,
|
|
20
|
+
/*#__PURE__*/ React.createElement(
|
|
21
|
+
NewValidationContext.Provider,
|
|
22
|
+
{
|
|
23
|
+
value: {
|
|
24
|
+
validationRedesignOptIn,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
);
|
|
19
31
|
|
|
20
32
|
CarbonProvider.propTypes = {
|
|
21
|
-
children: PropTypes.node
|
|
22
|
-
theme: PropTypes.
|
|
23
|
-
|
|
33
|
+
children: PropTypes.node,
|
|
34
|
+
theme: PropTypes.shape({
|
|
35
|
+
colors: PropTypes.shape({
|
|
36
|
+
destructive: PropTypes.shape({
|
|
37
|
+
hover: PropTypes.string.isRequired,
|
|
38
|
+
}).isRequired,
|
|
39
|
+
error: PropTypes.string.isRequired,
|
|
40
|
+
focus: PropTypes.string.isRequired,
|
|
41
|
+
info: PropTypes.string.isRequired,
|
|
42
|
+
loadingBarBackground: PropTypes.string.isRequired,
|
|
43
|
+
placeholder: PropTypes.string.isRequired,
|
|
44
|
+
primary: PropTypes.string.isRequired,
|
|
45
|
+
secondary: PropTypes.string.isRequired,
|
|
46
|
+
tertiary: PropTypes.string.isRequired,
|
|
47
|
+
warning: PropTypes.string.isRequired,
|
|
48
|
+
warningText: PropTypes.string.isRequired,
|
|
49
|
+
white: PropTypes.oneOf(["#FFFFFF"]).isRequired,
|
|
50
|
+
}).isRequired,
|
|
51
|
+
disabled: PropTypes.shape({
|
|
52
|
+
background: PropTypes.string.isRequired,
|
|
53
|
+
}).isRequired,
|
|
54
|
+
name: PropTypes.string.isRequired,
|
|
55
|
+
palette: PropTypes.shape({
|
|
56
|
+
blackOpacity: PropTypes.func.isRequired,
|
|
57
|
+
whiteOpacity: PropTypes.func.isRequired,
|
|
58
|
+
}).isRequired,
|
|
59
|
+
space: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
60
|
+
spacing: PropTypes.number.isRequired,
|
|
61
|
+
zIndex: PropTypes.shape({
|
|
62
|
+
aboveAll: PropTypes.number.isRequired,
|
|
63
|
+
fullScreenModal: PropTypes.number.isRequired,
|
|
64
|
+
header: PropTypes.number.isRequired,
|
|
65
|
+
modal: PropTypes.number.isRequired,
|
|
66
|
+
nav: PropTypes.number.isRequired,
|
|
67
|
+
notification: PropTypes.number.isRequired,
|
|
68
|
+
overlay: PropTypes.number.isRequired,
|
|
69
|
+
popover: PropTypes.number.isRequired,
|
|
70
|
+
smallOverlay: PropTypes.number.isRequired,
|
|
71
|
+
}).isRequired,
|
|
72
|
+
}),
|
|
73
|
+
validationRedesignOptIn: PropTypes.bool,
|
|
24
74
|
};
|
|
25
|
-
|
|
75
|
+
|
|
76
|
+
CarbonProvider.propTypes = {
|
|
77
|
+
children: PropTypes.node,
|
|
78
|
+
theme: PropTypes.shape({
|
|
79
|
+
colors: PropTypes.shape({
|
|
80
|
+
destructive: PropTypes.shape({
|
|
81
|
+
hover: PropTypes.string.isRequired,
|
|
82
|
+
}).isRequired,
|
|
83
|
+
error: PropTypes.string.isRequired,
|
|
84
|
+
focus: PropTypes.string.isRequired,
|
|
85
|
+
info: PropTypes.string.isRequired,
|
|
86
|
+
loadingBarBackground: PropTypes.string.isRequired,
|
|
87
|
+
placeholder: PropTypes.string.isRequired,
|
|
88
|
+
primary: PropTypes.string.isRequired,
|
|
89
|
+
secondary: PropTypes.string.isRequired,
|
|
90
|
+
tertiary: PropTypes.string.isRequired,
|
|
91
|
+
warning: PropTypes.string.isRequired,
|
|
92
|
+
warningText: PropTypes.string.isRequired,
|
|
93
|
+
white: PropTypes.oneOf(["#FFFFFF"]).isRequired,
|
|
94
|
+
}).isRequired,
|
|
95
|
+
disabled: PropTypes.shape({
|
|
96
|
+
background: PropTypes.string.isRequired,
|
|
97
|
+
}).isRequired,
|
|
98
|
+
name: PropTypes.string.isRequired,
|
|
99
|
+
palette: PropTypes.shape({
|
|
100
|
+
blackOpacity: PropTypes.func.isRequired,
|
|
101
|
+
whiteOpacity: PropTypes.func.isRequired,
|
|
102
|
+
}).isRequired,
|
|
103
|
+
space: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
104
|
+
spacing: PropTypes.number.isRequired,
|
|
105
|
+
zIndex: PropTypes.shape({
|
|
106
|
+
aboveAll: PropTypes.number.isRequired,
|
|
107
|
+
fullScreenModal: PropTypes.number.isRequired,
|
|
108
|
+
header: PropTypes.number.isRequired,
|
|
109
|
+
modal: PropTypes.number.isRequired,
|
|
110
|
+
nav: PropTypes.number.isRequired,
|
|
111
|
+
notification: PropTypes.number.isRequired,
|
|
112
|
+
overlay: PropTypes.number.isRequired,
|
|
113
|
+
popover: PropTypes.number.isRequired,
|
|
114
|
+
smallOverlay: PropTypes.number.isRequired,
|
|
115
|
+
}).isRequired,
|
|
116
|
+
}),
|
|
117
|
+
validationRedesignOptIn: PropTypes.bool,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export { CarbonProvider };
|
|
121
|
+
export default CarbonProvider;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./carbon-provider";
|
|
1
|
+
export { default } from "./carbon-provider.component";
|
|
2
|
+
export type { CarbonProviderProps } from "./carbon-provider.component";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
3
|
import StyledDateInput from "../date/date.style";
|
|
4
|
-
import { StyledLabelContainer } from "../../__internal__/label/label.style
|
|
5
|
-
import { StyledInputPresentationContainer } from "../../__internal__/input/input-presentation.style
|
|
4
|
+
import { StyledLabelContainer } from "../../__internal__/label/label.style";
|
|
5
|
+
import { StyledInputPresentationContainer } from "../../__internal__/input/input-presentation.style";
|
|
6
6
|
import baseTheme from "../../style/themes/base";
|
|
7
7
|
const StyledDateRange = styled.div`
|
|
8
8
|
${margin}
|
|
@@ -190,7 +190,8 @@ const Decimal = ({
|
|
|
190
190
|
onChange: handleOnChange,
|
|
191
191
|
onBlur: handleOnBlur,
|
|
192
192
|
value: stateValue,
|
|
193
|
-
"data-component": "decimal"
|
|
193
|
+
"data-component": "decimal",
|
|
194
|
+
id: id
|
|
194
195
|
}, rest)), /*#__PURE__*/React.createElement("input", {
|
|
195
196
|
name: name,
|
|
196
197
|
value: toStandardDecimal(stateValue),
|
|
@@ -7,9 +7,8 @@ export const StyledHeaderHelp: import("styled-components").StyledComponent<typeo
|
|
|
7
7
|
export const StyledHeadingTitle: import("styled-components").StyledComponent<typeof Typography, any, {}, never>;
|
|
8
8
|
export const StyledDivider: import("styled-components").StyledComponent<({ adaptiveMxBreakpoint, ml, mr, ...rest }: import("../hr/hr.component").HrProps) => JSX.Element, any, {}, never>;
|
|
9
9
|
export const StyledHeaderContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
-
export const StyledHeadingBackButton: import("styled-components").StyledComponent<
|
|
10
|
+
export const StyledHeadingBackButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../link/link.component").LinkProps & import("react").RefAttributes<HTMLLinkElement | HTMLButtonElement>>, any, {}, never>;
|
|
11
11
|
export const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
12
12
|
import Icon from "../icon";
|
|
13
13
|
import Help from "../help";
|
|
14
14
|
import Typography from "../typography";
|
|
15
|
-
import Link from "../link";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./inline-inputs";
|
|
1
|
+
export { default, InlineInputsContext } from "./inline-inputs.component";
|
|
2
|
+
export type { InlineInputsProps } from "./inline-inputs.component";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./inline-inputs.component";
|
|
1
|
+
export { default, InlineInputsContext } from "./inline-inputs.component";
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
export const InlineInputsContext: React.Context<{}>;
|
|
2
|
-
export default InlineInputs;
|
|
3
1
|
import React from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
interface InlineInputsContextProps {
|
|
3
|
+
ariaLabelledBy?: string;
|
|
4
|
+
}
|
|
5
|
+
declare type GutterOptions = "none" | "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
|
|
6
|
+
export interface InlineInputsProps {
|
|
7
|
+
/** Children elements */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** [Legacy prop] A custom class name for the component. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Gutter prop gets passed down to Row component if false gutter value is "none" */
|
|
12
|
+
gutter?: GutterOptions;
|
|
13
|
+
/** The id of the corresponding input control for the label */
|
|
14
|
+
htmlFor?: string;
|
|
15
|
+
/** Width of the inline inputs container in percentage */
|
|
16
|
+
inputWidth?: number;
|
|
17
|
+
/** Defines the label text for the heading. */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Width of a label in percentage */
|
|
20
|
+
labelWidth?: number;
|
|
23
21
|
}
|
|
24
|
-
|
|
22
|
+
export declare const InlineInputsContext: React.Context<InlineInputsContextProps>;
|
|
23
|
+
declare const InlineInputs: {
|
|
24
|
+
({ label, htmlFor, children, className, gutter, inputWidth, labelWidth, }: InlineInputsProps): JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export default InlineInputs;
|
|
@@ -1,82 +1,118 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import Label from "../../__internal__/label";
|
|
4
|
-
import StyledInlineInputs, {
|
|
4
|
+
import StyledInlineInputs, {
|
|
5
|
+
StyledContentContainer,
|
|
6
|
+
StyledInlineInput,
|
|
7
|
+
} from "./inline-inputs.style";
|
|
5
8
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
6
|
-
export const InlineInputsContext = /*#__PURE__*/React.createContext({});
|
|
9
|
+
export const InlineInputsContext = /*#__PURE__*/ React.createContext({});
|
|
7
10
|
|
|
8
11
|
const columnWrapper = (children, gutter, labelId) => {
|
|
9
|
-
return React.Children.map(children, input => {
|
|
10
|
-
return /*#__PURE__*/React.createElement(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
return React.Children.map(children, (input) => {
|
|
13
|
+
return /*#__PURE__*/ React.createElement(
|
|
14
|
+
InlineInputsContext.Provider,
|
|
15
|
+
{
|
|
16
|
+
value: {
|
|
17
|
+
ariaLabelledBy: labelId,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
/*#__PURE__*/ React.createElement(
|
|
21
|
+
StyledInlineInput,
|
|
22
|
+
{
|
|
23
|
+
gutter: gutter,
|
|
24
|
+
"data-element": "inline-input",
|
|
25
|
+
},
|
|
26
|
+
input
|
|
27
|
+
)
|
|
28
|
+
);
|
|
18
29
|
});
|
|
19
30
|
};
|
|
20
31
|
|
|
21
|
-
const InlineInputs =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = props;
|
|
32
|
+
const InlineInputs = ({
|
|
33
|
+
label,
|
|
34
|
+
htmlFor,
|
|
35
|
+
children = null,
|
|
36
|
+
className = "",
|
|
37
|
+
gutter = "none",
|
|
38
|
+
inputWidth,
|
|
39
|
+
labelWidth,
|
|
40
|
+
}) => {
|
|
31
41
|
const labelId = useRef(createGuid());
|
|
32
42
|
|
|
33
43
|
function renderLabel() {
|
|
34
44
|
if (!label) return null;
|
|
35
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
return /*#__PURE__*/ React.createElement(
|
|
46
|
+
Label,
|
|
47
|
+
{
|
|
48
|
+
labelId: labelId.current,
|
|
49
|
+
inline: true,
|
|
50
|
+
htmlFor: htmlFor,
|
|
51
|
+
},
|
|
52
|
+
label
|
|
53
|
+
);
|
|
40
54
|
}
|
|
41
55
|
|
|
42
|
-
return /*#__PURE__*/React.createElement(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
return /*#__PURE__*/ React.createElement(
|
|
57
|
+
StyledInlineInputs,
|
|
58
|
+
{
|
|
59
|
+
gutter: gutter,
|
|
60
|
+
"data-component": "inline-inputs",
|
|
61
|
+
className: className,
|
|
62
|
+
labelWidth: labelWidth,
|
|
63
|
+
},
|
|
64
|
+
renderLabel(),
|
|
65
|
+
/*#__PURE__*/ React.createElement(
|
|
66
|
+
StyledContentContainer,
|
|
67
|
+
{
|
|
68
|
+
gutter: gutter,
|
|
69
|
+
"data-element": "inline-inputs-container",
|
|
70
|
+
inputWidth: inputWidth,
|
|
71
|
+
},
|
|
72
|
+
columnWrapper(children, gutter, label ? labelId.current : undefined)
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
};
|
|
54
76
|
|
|
55
77
|
InlineInputs.propTypes = {
|
|
56
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Children elements
|
|
80
|
+
*/
|
|
57
81
|
children: PropTypes.node,
|
|
58
|
-
|
|
59
|
-
|
|
82
|
+
/**
|
|
83
|
+
* [Legacy prop] A custom class name for the component.
|
|
84
|
+
*/
|
|
60
85
|
className: PropTypes.string,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Gutter prop gets passed down to Row component if false gutter value is "none"
|
|
88
|
+
*/
|
|
89
|
+
gutter: PropTypes.oneOf([
|
|
90
|
+
"extra-large",
|
|
91
|
+
"extra-small",
|
|
92
|
+
"large",
|
|
93
|
+
"medium-large",
|
|
94
|
+
"medium-small",
|
|
95
|
+
"medium",
|
|
96
|
+
"none",
|
|
97
|
+
"small",
|
|
98
|
+
]),
|
|
99
|
+
/**
|
|
100
|
+
* The id of the corresponding input control for the label
|
|
101
|
+
*/
|
|
66
102
|
htmlFor: PropTypes.string,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/** Width of the inline inputs container in percentage */
|
|
103
|
+
/**
|
|
104
|
+
* Width of the inline inputs container in percentage
|
|
105
|
+
*/
|
|
72
106
|
inputWidth: PropTypes.number,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Defines the label text for the heading.
|
|
109
|
+
*/
|
|
110
|
+
label: PropTypes.string,
|
|
111
|
+
/**
|
|
112
|
+
* Width of a label in percentage
|
|
113
|
+
*/
|
|
114
|
+
labelWidth: PropTypes.number,
|
|
81
115
|
};
|
|
82
|
-
|
|
116
|
+
|
|
117
|
+
InlineInputs.displayName = "InlineInputs";
|
|
118
|
+
export default InlineInputs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const INLINE_INPUTS_SIZES: string[];
|
|
1
|
+
export declare const INLINE_INPUTS_SIZES: string[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { InlineInputsProps } from "./inline-inputs.component";
|
|
2
|
+
declare const StyledInlineInput: import("styled-components").StyledComponent<"div", any, Pick<InlineInputsProps, "gutter">, never>;
|
|
3
|
+
declare const StyledContentContainer: import("styled-components").StyledComponent<"div", any, Pick<InlineInputsProps, "inputWidth" | "gutter">, never>;
|
|
4
|
+
declare const StyledInlineInputs: import("styled-components").StyledComponent<"div", any, Pick<InlineInputsProps, "labelWidth" | "gutter">, never>;
|
|
5
|
+
export { StyledContentContainer, StyledInlineInput };
|
|
1
6
|
export default StyledInlineInputs;
|
|
2
|
-
export const StyledContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledInlineInput: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
declare const StyledInlineInputs: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -17,7 +17,7 @@ const StyledInlineInput = styled.div`
|
|
|
17
17
|
|
|
18
18
|
${({
|
|
19
19
|
gutter
|
|
20
|
-
}) => css`
|
|
20
|
+
}) => gutter && css`
|
|
21
21
|
margin-bottom: 0;
|
|
22
22
|
padding-left: ${spacings[gutter]}px;
|
|
23
23
|
`}
|
|
@@ -30,7 +30,7 @@ const StyledContentContainer = styled.div`
|
|
|
30
30
|
|
|
31
31
|
${({
|
|
32
32
|
gutter
|
|
33
|
-
}) => css`
|
|
33
|
+
}) => gutter && css`
|
|
34
34
|
margin-bottom: 0;
|
|
35
35
|
margin-left: -${spacings[gutter]}px;
|
|
36
36
|
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { default } from "./link";
|
|
2
|
-
export * from "./link";
|
|
1
|
+
export { default } from "./link.component";
|