carbon-react 106.0.1 → 106.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.
- 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/split-button/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +1 -2
- package/esm/components/textarea/textarea-test.stories.js +21 -1
- package/esm/components/tile-select/tile-select.style.d.ts +1 -1
- package/esm/style/fonts.css +22 -16
- 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/split-button/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +1 -2
- package/lib/components/textarea/textarea-test.stories.js +21 -1
- package/lib/components/tile-select/tile-select.style.d.ts +1 -1
- package/lib/style/fonts.css +22 -16
- package/package.json +1 -2
- 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,45 +1,140 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
4
|
+
value: true,
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.NewValidationContext = void 0;
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
exports.default = exports.CarbonProvider = exports.NewValidationContext = void 0;
|
|
9
8
|
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
12
|
var _styledComponents = require("styled-components");
|
|
13
13
|
|
|
14
14
|
var _mint = _interopRequireDefault(require("../../style/themes/mint"));
|
|
15
15
|
|
|
16
|
-
var _carbonScopedTokensProvider = _interopRequireDefault(
|
|
16
|
+
var _carbonScopedTokensProvider = _interopRequireDefault(
|
|
17
|
+
require("../../style/design-tokens/carbon-scoped-tokens-provider")
|
|
18
|
+
);
|
|
17
19
|
|
|
18
|
-
function _interopRequireDefault(obj) {
|
|
20
|
+
function _interopRequireDefault(obj) {
|
|
21
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
22
|
+
}
|
|
19
23
|
|
|
20
|
-
function _getRequireWildcardCache() {
|
|
24
|
+
function _getRequireWildcardCache() {
|
|
25
|
+
if (typeof WeakMap !== "function") return null;
|
|
26
|
+
var cache = new WeakMap();
|
|
27
|
+
_getRequireWildcardCache = function () {
|
|
28
|
+
return cache;
|
|
29
|
+
};
|
|
30
|
+
return cache;
|
|
31
|
+
}
|
|
21
32
|
|
|
22
|
-
function _interopRequireWildcard(obj) {
|
|
33
|
+
function _interopRequireWildcard(obj) {
|
|
34
|
+
if (obj && obj.__esModule) {
|
|
35
|
+
return obj;
|
|
36
|
+
}
|
|
37
|
+
if (obj === null || (typeof obj !== "object" && typeof obj !== "function")) {
|
|
38
|
+
return { default: obj };
|
|
39
|
+
}
|
|
40
|
+
var cache = _getRequireWildcardCache();
|
|
41
|
+
if (cache && cache.has(obj)) {
|
|
42
|
+
return cache.get(obj);
|
|
43
|
+
}
|
|
44
|
+
var newObj = {};
|
|
45
|
+
var hasPropertyDescriptor =
|
|
46
|
+
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
47
|
+
for (var key in obj) {
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
49
|
+
var desc = hasPropertyDescriptor
|
|
50
|
+
? Object.getOwnPropertyDescriptor(obj, key)
|
|
51
|
+
: null;
|
|
52
|
+
if (desc && (desc.get || desc.set)) {
|
|
53
|
+
Object.defineProperty(newObj, key, desc);
|
|
54
|
+
} else {
|
|
55
|
+
newObj[key] = obj[key];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
newObj.default = obj;
|
|
60
|
+
if (cache) {
|
|
61
|
+
cache.set(obj, newObj);
|
|
62
|
+
}
|
|
63
|
+
return newObj;
|
|
64
|
+
}
|
|
23
65
|
|
|
24
|
-
const NewValidationContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
66
|
+
const NewValidationContext = /*#__PURE__*/ (0, _react.createContext)({});
|
|
25
67
|
exports.NewValidationContext = NewValidationContext;
|
|
26
68
|
|
|
27
69
|
const CarbonProvider = ({
|
|
28
70
|
children,
|
|
29
71
|
theme = _mint.default,
|
|
30
|
-
validationRedesignOptIn = false
|
|
31
|
-
}) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
72
|
+
validationRedesignOptIn = false,
|
|
73
|
+
}) =>
|
|
74
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
75
|
+
_styledComponents.ThemeProvider,
|
|
76
|
+
{
|
|
77
|
+
theme: theme,
|
|
78
|
+
},
|
|
79
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
80
|
+
_carbonScopedTokensProvider.default,
|
|
81
|
+
null,
|
|
82
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
83
|
+
NewValidationContext.Provider,
|
|
84
|
+
{
|
|
85
|
+
value: {
|
|
86
|
+
validationRedesignOptIn,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
children
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
);
|
|
38
93
|
|
|
39
94
|
CarbonProvider.propTypes = {
|
|
40
|
-
children: _propTypes.default.node
|
|
41
|
-
theme: _propTypes.default.
|
|
42
|
-
|
|
95
|
+
children: _propTypes.default.node,
|
|
96
|
+
theme: _propTypes.default.shape({
|
|
97
|
+
colors: _propTypes.default.shape({
|
|
98
|
+
destructive: _propTypes.default.shape({
|
|
99
|
+
hover: _propTypes.default.string.isRequired,
|
|
100
|
+
}).isRequired,
|
|
101
|
+
error: _propTypes.default.string.isRequired,
|
|
102
|
+
focus: _propTypes.default.string.isRequired,
|
|
103
|
+
info: _propTypes.default.string.isRequired,
|
|
104
|
+
loadingBarBackground: _propTypes.default.string.isRequired,
|
|
105
|
+
placeholder: _propTypes.default.string.isRequired,
|
|
106
|
+
primary: _propTypes.default.string.isRequired,
|
|
107
|
+
secondary: _propTypes.default.string.isRequired,
|
|
108
|
+
tertiary: _propTypes.default.string.isRequired,
|
|
109
|
+
warning: _propTypes.default.string.isRequired,
|
|
110
|
+
warningText: _propTypes.default.string.isRequired,
|
|
111
|
+
white: _propTypes.default.oneOf(["#FFFFFF"]).isRequired,
|
|
112
|
+
}).isRequired,
|
|
113
|
+
disabled: _propTypes.default.shape({
|
|
114
|
+
background: _propTypes.default.string.isRequired,
|
|
115
|
+
}).isRequired,
|
|
116
|
+
name: _propTypes.default.string.isRequired,
|
|
117
|
+
palette: _propTypes.default.shape({
|
|
118
|
+
blackOpacity: _propTypes.default.func.isRequired,
|
|
119
|
+
whiteOpacity: _propTypes.default.func.isRequired,
|
|
120
|
+
}).isRequired,
|
|
121
|
+
space: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
122
|
+
spacing: _propTypes.default.number.isRequired,
|
|
123
|
+
zIndex: _propTypes.default.shape({
|
|
124
|
+
aboveAll: _propTypes.default.number.isRequired,
|
|
125
|
+
fullScreenModal: _propTypes.default.number.isRequired,
|
|
126
|
+
header: _propTypes.default.number.isRequired,
|
|
127
|
+
modal: _propTypes.default.number.isRequired,
|
|
128
|
+
nav: _propTypes.default.number.isRequired,
|
|
129
|
+
notification: _propTypes.default.number.isRequired,
|
|
130
|
+
overlay: _propTypes.default.number.isRequired,
|
|
131
|
+
popover: _propTypes.default.number.isRequired,
|
|
132
|
+
smallOverlay: _propTypes.default.number.isRequired,
|
|
133
|
+
}).isRequired,
|
|
134
|
+
}),
|
|
135
|
+
validationRedesignOptIn: _propTypes.default.bool,
|
|
43
136
|
};
|
|
137
|
+
|
|
138
|
+
exports.CarbonProvider = CarbonProvider;
|
|
44
139
|
var _default = CarbonProvider;
|
|
45
|
-
exports.default = _default;
|
|
140
|
+
exports.default = _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./carbon-provider";
|
|
1
|
+
export { default } from "./carbon-provider.component";
|
|
2
|
+
export type { CarbonProviderProps } from "./carbon-provider.component";
|
|
@@ -11,9 +11,9 @@ var _styledSystem = require("styled-system");
|
|
|
11
11
|
|
|
12
12
|
var _date = _interopRequireDefault(require("../date/date.style"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _label = require("../../__internal__/label/label.style");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _inputPresentation = require("../../__internal__/input/input-presentation.style");
|
|
17
17
|
|
|
18
18
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
19
19
|
|
|
@@ -34,11 +34,11 @@ const StyledDateRange = _styledComponents.default.div`
|
|
|
34
34
|
margin-right: var(--spacing300);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
${
|
|
37
|
+
${_label.StyledLabelContainer} {
|
|
38
38
|
width: auto;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
${
|
|
41
|
+
${_inputPresentation.StyledInputPresentationContainer} {
|
|
42
42
|
flex: auto;
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
@@ -211,7 +211,8 @@ const Decimal = ({
|
|
|
211
211
|
onChange: handleOnChange,
|
|
212
212
|
onBlur: handleOnBlur,
|
|
213
213
|
value: stateValue,
|
|
214
|
-
"data-component": "decimal"
|
|
214
|
+
"data-component": "decimal",
|
|
215
|
+
id: id
|
|
215
216
|
}, rest)), /*#__PURE__*/_react.default.createElement("input", {
|
|
216
217
|
name: name,
|
|
217
218
|
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";
|
|
@@ -9,7 +9,15 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
return _inlineInputs.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "InlineInputsContext", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _inlineInputs.InlineInputsContext;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _inlineInputs = _interopRequireWildcard(require("./inline-inputs.component"));
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
14
22
|
|
|
15
|
-
function
|
|
23
|
+
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; }
|
|
@@ -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,103 +1,178 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
4
|
+
value: true,
|
|
5
5
|
});
|
|
6
|
+
|
|
6
7
|
exports.default = exports.InlineInputsContext = void 0;
|
|
7
8
|
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
12
|
var _label = _interopRequireDefault(require("../../__internal__/label"));
|
|
13
13
|
|
|
14
14
|
var _inlineInputs = _interopRequireWildcard(require("./inline-inputs.style"));
|
|
15
15
|
|
|
16
|
-
var _guid = _interopRequireDefault(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
var _guid = _interopRequireDefault(
|
|
17
|
+
require("../../__internal__/utils/helpers/guid")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) {
|
|
21
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache() {
|
|
25
|
+
if (typeof WeakMap !== "function") return null;
|
|
26
|
+
var cache = new WeakMap();
|
|
27
|
+
_getRequireWildcardCache = function () {
|
|
28
|
+
return cache;
|
|
29
|
+
};
|
|
30
|
+
return cache;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _interopRequireWildcard(obj) {
|
|
34
|
+
if (obj && obj.__esModule) {
|
|
35
|
+
return obj;
|
|
36
|
+
}
|
|
37
|
+
if (obj === null || (typeof obj !== "object" && typeof obj !== "function")) {
|
|
38
|
+
return { default: obj };
|
|
39
|
+
}
|
|
40
|
+
var cache = _getRequireWildcardCache();
|
|
41
|
+
if (cache && cache.has(obj)) {
|
|
42
|
+
return cache.get(obj);
|
|
43
|
+
}
|
|
44
|
+
var newObj = {};
|
|
45
|
+
var hasPropertyDescriptor =
|
|
46
|
+
Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
47
|
+
for (var key in obj) {
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
49
|
+
var desc = hasPropertyDescriptor
|
|
50
|
+
? Object.getOwnPropertyDescriptor(obj, key)
|
|
51
|
+
: null;
|
|
52
|
+
if (desc && (desc.get || desc.set)) {
|
|
53
|
+
Object.defineProperty(newObj, key, desc);
|
|
54
|
+
} else {
|
|
55
|
+
newObj[key] = obj[key];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
newObj.default = obj;
|
|
60
|
+
if (cache) {
|
|
61
|
+
cache.set(obj, newObj);
|
|
62
|
+
}
|
|
63
|
+
return newObj;
|
|
64
|
+
}
|
|
23
65
|
|
|
24
|
-
const InlineInputsContext = /*#__PURE__*/_react.default.createContext({});
|
|
66
|
+
const InlineInputsContext = /*#__PURE__*/ _react.default.createContext({});
|
|
25
67
|
|
|
26
68
|
exports.InlineInputsContext = InlineInputsContext;
|
|
27
69
|
|
|
28
70
|
const columnWrapper = (children, gutter, labelId) => {
|
|
29
|
-
return _react.default.Children.map(children, input => {
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
71
|
+
return _react.default.Children.map(children, (input) => {
|
|
72
|
+
return /*#__PURE__*/ _react.default.createElement(
|
|
73
|
+
InlineInputsContext.Provider,
|
|
74
|
+
{
|
|
75
|
+
value: {
|
|
76
|
+
ariaLabelledBy: labelId,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
80
|
+
_inlineInputs.StyledInlineInput,
|
|
81
|
+
{
|
|
82
|
+
gutter: gutter,
|
|
83
|
+
"data-element": "inline-input",
|
|
84
|
+
},
|
|
85
|
+
input
|
|
86
|
+
)
|
|
87
|
+
);
|
|
38
88
|
});
|
|
39
89
|
};
|
|
40
90
|
|
|
41
|
-
const InlineInputs =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = props;
|
|
91
|
+
const InlineInputs = ({
|
|
92
|
+
label,
|
|
93
|
+
htmlFor,
|
|
94
|
+
children = null,
|
|
95
|
+
className = "",
|
|
96
|
+
gutter = "none",
|
|
97
|
+
inputWidth,
|
|
98
|
+
labelWidth,
|
|
99
|
+
}) => {
|
|
51
100
|
const labelId = (0, _react.useRef)((0, _guid.default)());
|
|
52
101
|
|
|
53
102
|
function renderLabel() {
|
|
54
103
|
if (!label) return null;
|
|
55
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
104
|
+
return /*#__PURE__*/ _react.default.createElement(
|
|
105
|
+
_label.default,
|
|
106
|
+
{
|
|
107
|
+
labelId: labelId.current,
|
|
108
|
+
inline: true,
|
|
109
|
+
htmlFor: htmlFor,
|
|
110
|
+
},
|
|
111
|
+
label
|
|
112
|
+
);
|
|
60
113
|
}
|
|
61
114
|
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
115
|
+
return /*#__PURE__*/ _react.default.createElement(
|
|
116
|
+
_inlineInputs.default,
|
|
117
|
+
{
|
|
118
|
+
gutter: gutter,
|
|
119
|
+
"data-component": "inline-inputs",
|
|
120
|
+
className: className,
|
|
121
|
+
labelWidth: labelWidth,
|
|
122
|
+
},
|
|
123
|
+
renderLabel(),
|
|
124
|
+
/*#__PURE__*/ _react.default.createElement(
|
|
125
|
+
_inlineInputs.StyledContentContainer,
|
|
126
|
+
{
|
|
127
|
+
gutter: gutter,
|
|
128
|
+
"data-element": "inline-inputs-container",
|
|
129
|
+
inputWidth: inputWidth,
|
|
130
|
+
},
|
|
131
|
+
columnWrapper(children, gutter, label ? labelId.current : undefined)
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
};
|
|
74
135
|
|
|
75
136
|
InlineInputs.propTypes = {
|
|
76
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Children elements
|
|
139
|
+
*/
|
|
77
140
|
children: _propTypes.default.node,
|
|
78
|
-
|
|
79
|
-
|
|
141
|
+
/**
|
|
142
|
+
* [Legacy prop] A custom class name for the component.
|
|
143
|
+
*/
|
|
80
144
|
className: _propTypes.default.string,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Gutter prop gets passed down to Row component if false gutter value is "none"
|
|
147
|
+
*/
|
|
148
|
+
gutter: _propTypes.default.oneOf([
|
|
149
|
+
"extra-large",
|
|
150
|
+
"extra-small",
|
|
151
|
+
"large",
|
|
152
|
+
"medium-large",
|
|
153
|
+
"medium-small",
|
|
154
|
+
"medium",
|
|
155
|
+
"none",
|
|
156
|
+
"small",
|
|
157
|
+
]),
|
|
158
|
+
/**
|
|
159
|
+
* The id of the corresponding input control for the label
|
|
160
|
+
*/
|
|
86
161
|
htmlFor: _propTypes.default.string,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/** Width of the inline inputs container in percentage */
|
|
162
|
+
/**
|
|
163
|
+
* Width of the inline inputs container in percentage
|
|
164
|
+
*/
|
|
92
165
|
inputWidth: _propTypes.default.number,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Defines the label text for the heading.
|
|
168
|
+
*/
|
|
169
|
+
label: _propTypes.default.string,
|
|
170
|
+
/**
|
|
171
|
+
* Width of a label in percentage
|
|
172
|
+
*/
|
|
173
|
+
labelWidth: _propTypes.default.number,
|
|
101
174
|
};
|
|
175
|
+
|
|
176
|
+
InlineInputs.displayName = "InlineInputs";
|
|
102
177
|
var _default = InlineInputs;
|
|
103
|
-
exports.default = _default;
|
|
178
|
+
exports.default = _default;
|
|
@@ -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>;
|
|
@@ -34,7 +34,7 @@ const StyledInlineInput = _styledComponents.default.div`
|
|
|
34
34
|
|
|
35
35
|
${({
|
|
36
36
|
gutter
|
|
37
|
-
}) => (0, _styledComponents.css)`
|
|
37
|
+
}) => gutter && (0, _styledComponents.css)`
|
|
38
38
|
margin-bottom: 0;
|
|
39
39
|
padding-left: ${spacings[gutter]}px;
|
|
40
40
|
`}
|
|
@@ -48,7 +48,7 @@ const StyledContentContainer = _styledComponents.default.div`
|
|
|
48
48
|
|
|
49
49
|
${({
|
|
50
50
|
gutter
|
|
51
|
-
}) => (0, _styledComponents.css)`
|
|
51
|
+
}) => gutter && (0, _styledComponents.css)`
|
|
52
52
|
margin-bottom: 0;
|
|
53
53
|
margin-left: -${spacings[gutter]}px;
|
|
54
54
|
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { default } from "./link";
|
|
2
|
-
export * from "./link";
|
|
1
|
+
export { default } from "./link.component";
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
export default Link;
|
|
2
|
-
declare const Link: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
1
|
import React from "react";
|
|
2
|
+
import { IconType } from "components/icon/icon";
|
|
3
|
+
export interface LinkProps extends React.AriaAttributes {
|
|
4
|
+
/** The disabled state of the link. */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** An href for an anchor tag. */
|
|
7
|
+
href?: string;
|
|
8
|
+
/** An icon to display next to the link. */
|
|
9
|
+
icon?: IconType;
|
|
10
|
+
/** Which side of the link to the render the link. */
|
|
11
|
+
iconAlign?: "left" | "right";
|
|
12
|
+
/** Function called when the mouse is clicked. */
|
|
13
|
+
onClick?: (ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
14
|
+
/** Function called when a key is pressed. */
|
|
15
|
+
onKeyDown?: (ev: React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
16
|
+
/** Function called when a mouse down event triggers. */
|
|
17
|
+
onMouseDown?: (ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
18
|
+
/** Whether to include the link in the tab order of the page */
|
|
19
|
+
tabbable?: boolean;
|
|
20
|
+
/** A message to display as a tooltip to the link. */
|
|
21
|
+
tooltipMessage?: string;
|
|
22
|
+
/** Positions the tooltip with the link. */
|
|
23
|
+
tooltipPosition?: "bottom" | "left" | "right" | "top";
|
|
24
|
+
/** Child content to render in the link. */
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
/** Classes to apply to the component. */
|
|
27
|
+
className?: string;
|
|
28
|
+
/** Target property in which link should open ie: _blank, _self, _parent, _top */
|
|
29
|
+
target?: string;
|
|
30
|
+
/** Aria label for accessibility purposes */
|
|
31
|
+
ariaLabel?: string;
|
|
32
|
+
/** Allows to create skip link */
|
|
33
|
+
isSkipLink?: boolean;
|
|
34
|
+
/** allows to set rel property in <a> tag */
|
|
35
|
+
rel?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLLinkElement | HTMLButtonElement>>;
|
|
38
|
+
export default Link;
|