@atlaskit/form 9.0.0 → 9.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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/field.js +4 -4
- package/dist/cjs/fieldset.js +2 -4
- package/dist/cjs/form-footer.js +1 -3
- package/dist/cjs/form-header.js +5 -7
- package/dist/cjs/form-section.js +4 -6
- package/dist/cjs/label.js +9 -7
- package/dist/cjs/messages.js +13 -14
- package/dist/cjs/required-asterisk.js +1 -3
- package/dist/es2019/field.js +4 -5
- package/dist/es2019/fieldset.js +3 -5
- package/dist/es2019/form-footer.js +2 -4
- package/dist/es2019/form-header.js +6 -8
- package/dist/es2019/form-section.js +5 -7
- package/dist/es2019/label.js +8 -6
- package/dist/es2019/messages.js +11 -12
- package/dist/es2019/required-asterisk.js +2 -3
- package/dist/esm/field.js +4 -5
- package/dist/esm/fieldset.js +3 -5
- package/dist/esm/form-footer.js +2 -4
- package/dist/esm/form-header.js +6 -8
- package/dist/esm/form-section.js +5 -7
- package/dist/esm/label.js +8 -6
- package/dist/esm/messages.js +14 -15
- package/dist/esm/required-asterisk.js +2 -3
- package/package.json +7 -6
- package/tmp/api-report-tmp.d.ts +0 -265
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/form
|
|
2
2
|
|
|
3
|
+
## 9.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#58458](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58458) [`536478cdcf0b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/536478cdcf0b) - Updated Form messages to have a small gap between the icon and message text.
|
|
8
|
+
|
|
9
|
+
## 9.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 9.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/dist/cjs/field.js
CHANGED
|
@@ -17,7 +17,7 @@ var _form = require("./form");
|
|
|
17
17
|
var _label = require("./label");
|
|
18
18
|
var _requiredAsterisk = _interopRequireDefault(require("./required-asterisk"));
|
|
19
19
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
21
|
var fieldWrapperStyles = (0, _react2.css)({
|
|
22
22
|
marginTop: "var(--ds-space-100, 8px)"
|
|
23
23
|
});
|
|
@@ -244,14 +244,14 @@ function Field(props) {
|
|
|
244
244
|
'aria-labelledby': "".concat(fieldId, "-label"),
|
|
245
245
|
id: fieldId
|
|
246
246
|
});
|
|
247
|
-
return
|
|
247
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
248
248
|
css: fieldWrapperStyles,
|
|
249
249
|
"data-testid": props.testId
|
|
250
|
-
}, props.label &&
|
|
250
|
+
}, props.label && /*#__PURE__*/React.createElement(_label.Label, {
|
|
251
251
|
htmlFor: fieldId,
|
|
252
252
|
id: "".concat(fieldId, "-label"),
|
|
253
253
|
testId: props.testId && "".concat(props.testId, "--label")
|
|
254
|
-
}, props.label, props.isRequired &&
|
|
254
|
+
}, props.label, props.isRequired && /*#__PURE__*/React.createElement(_requiredAsterisk.default, null), props.elementAfterLabel), /*#__PURE__*/React.createElement(_fieldIdContext.FieldId.Provider, {
|
|
255
255
|
value: fieldId
|
|
256
256
|
}, props.children({
|
|
257
257
|
fieldProps: extendedFieldProps,
|
package/dist/cjs/fieldset.js
CHANGED
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _label = require("./label");
|
|
9
|
-
/** @jsx jsx */
|
|
10
|
-
|
|
11
9
|
var fieldSetStyles = (0, _react.css)({
|
|
12
10
|
marginTop: "var(--ds-space-100, 8px)"
|
|
13
11
|
});
|
|
@@ -25,8 +23,8 @@ var fieldSetStyles = (0, _react.css)({
|
|
|
25
23
|
var Fieldset = function Fieldset(_ref) {
|
|
26
24
|
var children = _ref.children,
|
|
27
25
|
legend = _ref.legend;
|
|
28
|
-
return
|
|
26
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
29
27
|
css: fieldSetStyles
|
|
30
|
-
}, legend &&
|
|
28
|
+
}, legend && /*#__PURE__*/React.createElement(_label.Legend, null, legend), children);
|
|
31
29
|
};
|
|
32
30
|
var _default = exports.default = Fieldset;
|
package/dist/cjs/form-footer.js
CHANGED
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = FormFooter;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
-
/** @jsx jsx */
|
|
9
|
-
|
|
10
8
|
var formFooterWrapperStyles = (0, _react.css)({
|
|
11
9
|
display: 'flex',
|
|
12
10
|
marginTop: "var(--ds-space-300, 24px)",
|
|
@@ -29,7 +27,7 @@ function FormFooter(_ref) {
|
|
|
29
27
|
var _ref$align = _ref.align,
|
|
30
28
|
align = _ref$align === void 0 ? 'end' : _ref$align,
|
|
31
29
|
children = _ref.children;
|
|
32
|
-
return
|
|
30
|
+
return /*#__PURE__*/React.createElement("footer", {
|
|
33
31
|
css: [formFooterWrapperStyles, align === 'start' && justifyContentStyles]
|
|
34
32
|
}, children);
|
|
35
33
|
}
|
package/dist/cjs/form-header.js
CHANGED
|
@@ -7,8 +7,6 @@ exports.default = exports.FormHeaderTitle = exports.FormHeaderDescription = expo
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _constants = require("@atlaskit/theme/constants");
|
|
9
9
|
var _typography = require("@atlaskit/theme/typography");
|
|
10
|
-
/** @jsx jsx */
|
|
11
|
-
|
|
12
10
|
var fontFamily = (0, _constants.fontFamily)();
|
|
13
11
|
var formHeaderContentStyles = (0, _react.css)({
|
|
14
12
|
minWidth: '100%',
|
|
@@ -37,25 +35,25 @@ var lightH700Styles = (0, _react.css)((0, _typography.h700)({
|
|
|
37
35
|
}));
|
|
38
36
|
var FormHeaderContent = exports.FormHeaderContent = function FormHeaderContent(_ref) {
|
|
39
37
|
var children = _ref.children;
|
|
40
|
-
return
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
39
|
css: formHeaderContentStyles
|
|
42
40
|
}, children);
|
|
43
41
|
};
|
|
44
42
|
var FormHeaderDescription = exports.FormHeaderDescription = function FormHeaderDescription(_ref2) {
|
|
45
43
|
var children = _ref2.children;
|
|
46
|
-
return
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
45
|
css: formHeaderDescriptionStyles
|
|
48
46
|
}, children);
|
|
49
47
|
};
|
|
50
48
|
var FormHeaderTitle = exports.FormHeaderTitle = function FormHeaderTitle(_ref3) {
|
|
51
49
|
var children = _ref3.children;
|
|
52
|
-
return
|
|
50
|
+
return /*#__PURE__*/React.createElement("h2", {
|
|
53
51
|
css: [lightH700Styles, formHeaderTitleStyles]
|
|
54
52
|
}, children);
|
|
55
53
|
};
|
|
56
54
|
var FormHeaderWrapper = function FormHeaderWrapper(_ref4) {
|
|
57
55
|
var children = _ref4.children;
|
|
58
|
-
return
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
59
57
|
css: formHeaderWrapperStyles
|
|
60
58
|
}, children);
|
|
61
59
|
};
|
|
@@ -74,6 +72,6 @@ var FormHeader = function FormHeader(_ref5) {
|
|
|
74
72
|
var children = _ref5.children,
|
|
75
73
|
description = _ref5.description,
|
|
76
74
|
title = _ref5.title;
|
|
77
|
-
return
|
|
75
|
+
return /*#__PURE__*/React.createElement(FormHeaderWrapper, null, title && /*#__PURE__*/React.createElement(FormHeaderTitle, null, title), description && /*#__PURE__*/React.createElement(FormHeaderDescription, null, description), children && /*#__PURE__*/React.createElement(FormHeaderContent, null, children));
|
|
78
76
|
};
|
|
79
77
|
var _default = exports.default = FormHeader;
|
package/dist/cjs/form-section.js
CHANGED
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _typography = require("@atlaskit/theme/typography");
|
|
9
|
-
/** @jsx jsx */
|
|
10
|
-
|
|
11
9
|
var formSectionDescriptionStyles = (0, _react.css)({
|
|
12
10
|
marginBlockStart: "var(--ds-space-100, 8px)"
|
|
13
11
|
});
|
|
@@ -31,19 +29,19 @@ var lightH600Styles = (0, _react.css)((0, _typography.h600)({
|
|
|
31
29
|
}));
|
|
32
30
|
var FormSectionWrapper = function FormSectionWrapper(_ref) {
|
|
33
31
|
var children = _ref.children;
|
|
34
|
-
return
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
33
|
css: formSectionWrapperStyles
|
|
36
34
|
}, children);
|
|
37
35
|
};
|
|
38
36
|
var FormSectionTitle = function FormSectionTitle(_ref2) {
|
|
39
37
|
var children = _ref2.children;
|
|
40
|
-
return
|
|
38
|
+
return /*#__PURE__*/React.createElement("h3", {
|
|
41
39
|
css: [formSectionTitleStyles, lightH600Styles]
|
|
42
40
|
}, children);
|
|
43
41
|
};
|
|
44
42
|
var FormSectionDescription = function FormSectionDescription(_ref3) {
|
|
45
43
|
var children = _ref3.children;
|
|
46
|
-
return
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
45
|
css: formSectionDescriptionStyles
|
|
48
46
|
}, children);
|
|
49
47
|
};
|
|
@@ -62,6 +60,6 @@ var FormSection = function FormSection(_ref4) {
|
|
|
62
60
|
var children = _ref4.children,
|
|
63
61
|
description = _ref4.description,
|
|
64
62
|
title = _ref4.title;
|
|
65
|
-
return
|
|
63
|
+
return /*#__PURE__*/React.createElement(FormSectionWrapper, null, title && /*#__PURE__*/React.createElement(FormSectionTitle, null, title), description && /*#__PURE__*/React.createElement(FormSectionDescription, null, description), children);
|
|
66
64
|
};
|
|
67
65
|
var _default = exports.default = FormSection;
|
package/dist/cjs/label.js
CHANGED
|
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Legend = exports.Label = void 0;
|
|
7
|
-
var _react = require("
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@emotion/react");
|
|
8
9
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
10
|
var _constants = require("@atlaskit/theme/constants");
|
|
10
11
|
var _typography = require("@atlaskit/theme/typography");
|
|
11
|
-
/** @jsx jsx */
|
|
12
|
-
|
|
13
12
|
var fontFamily = (0, _constants.fontFamily)();
|
|
14
13
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
15
|
-
var fieldsetLabelStyles = (0,
|
|
14
|
+
var fieldsetLabelStyles = (0, _react2.css)([(0, _typography.h200)({
|
|
16
15
|
theme: {
|
|
17
16
|
mode: 'light'
|
|
18
17
|
}
|
|
@@ -37,12 +36,15 @@ var Label = exports.Label = function Label(_ref) {
|
|
|
37
36
|
htmlFor = _ref.htmlFor,
|
|
38
37
|
id = _ref.id,
|
|
39
38
|
testId = _ref.testId;
|
|
40
|
-
return (
|
|
39
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
hidden: true,
|
|
41
|
+
id: "label--".concat(id || htmlFor)
|
|
42
|
+
}, children), /*#__PURE__*/React.createElement("label", {
|
|
41
43
|
css: fieldsetLabelStyles,
|
|
42
44
|
id: id,
|
|
43
45
|
htmlFor: htmlFor,
|
|
44
46
|
"data-testid": testId
|
|
45
|
-
}, children);
|
|
47
|
+
}, children));
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
/**
|
|
@@ -52,7 +54,7 @@ var Label = exports.Label = function Label(_ref) {
|
|
|
52
54
|
*/
|
|
53
55
|
var Legend = exports.Legend = function Legend(_ref2) {
|
|
54
56
|
var children = _ref2.children;
|
|
55
|
-
return
|
|
57
|
+
return /*#__PURE__*/React.createElement("legend", {
|
|
56
58
|
css: fieldsetLabelStyles
|
|
57
59
|
}, children);
|
|
58
60
|
};
|
package/dist/cjs/messages.js
CHANGED
|
@@ -12,8 +12,6 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
12
12
|
var _constants = require("@atlaskit/theme/constants");
|
|
13
13
|
var _typography = require("@atlaskit/theme/typography");
|
|
14
14
|
var _fieldIdContext = require("./field-id-context");
|
|
15
|
-
/** @jsx jsx */
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* API for the internal `<Message />` component. This is not public API.
|
|
19
17
|
*/
|
|
@@ -33,6 +31,7 @@ var lightH200Styles = (0, _react.css)((0, _typography.h200)({
|
|
|
33
31
|
var messageStyles = (0, _react.css)({
|
|
34
32
|
display: 'flex',
|
|
35
33
|
justifyContent: 'baseline',
|
|
34
|
+
gap: "var(--ds-space-050, 4px)",
|
|
36
35
|
fontFamily: "".concat(fontFamily),
|
|
37
36
|
fontWeight: 'normal',
|
|
38
37
|
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
@@ -53,16 +52,16 @@ var iconWrapperStyles = (0, _react.css)({
|
|
|
53
52
|
});
|
|
54
53
|
var IconWrapper = function IconWrapper(_ref) {
|
|
55
54
|
var children = _ref.children;
|
|
56
|
-
return
|
|
55
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
57
56
|
css: iconWrapperStyles
|
|
58
57
|
}, children);
|
|
59
58
|
};
|
|
60
59
|
var messageIcons = {
|
|
61
|
-
error:
|
|
60
|
+
error: /*#__PURE__*/React.createElement(_error.default, {
|
|
62
61
|
size: "small",
|
|
63
62
|
label: "error"
|
|
64
63
|
}),
|
|
65
|
-
valid:
|
|
64
|
+
valid: /*#__PURE__*/React.createElement(_success.default, {
|
|
66
65
|
size: "small",
|
|
67
66
|
label: "success"
|
|
68
67
|
})
|
|
@@ -83,13 +82,13 @@ var Message = function Message(_ref2) {
|
|
|
83
82
|
* If the child is just a string, this is not required and we can use one
|
|
84
83
|
* less DOM element.
|
|
85
84
|
*/
|
|
86
|
-
var content = typeof children === 'string' ? children :
|
|
87
|
-
return
|
|
85
|
+
var content = typeof children === 'string' ? children : /*#__PURE__*/React.createElement("span", null, children);
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
87
|
css: [lightH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
89
88
|
"data-testid": testId,
|
|
90
89
|
id: fieldId,
|
|
91
90
|
"aria-live": "polite"
|
|
92
|
-
}, icon &&
|
|
91
|
+
}, icon && /*#__PURE__*/React.createElement(IconWrapper, null, icon), content);
|
|
93
92
|
};
|
|
94
93
|
|
|
95
94
|
/**
|
|
@@ -102,8 +101,8 @@ var Message = function Message(_ref2) {
|
|
|
102
101
|
var HelperMessage = exports.HelperMessage = function HelperMessage(_ref3) {
|
|
103
102
|
var children = _ref3.children,
|
|
104
103
|
testId = _ref3.testId;
|
|
105
|
-
return
|
|
106
|
-
return
|
|
104
|
+
return /*#__PURE__*/React.createElement(_fieldIdContext.FieldId.Consumer, null, function (fieldId) {
|
|
105
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
107
106
|
fieldId: fieldId ? "".concat(fieldId, "-helper") : undefined,
|
|
108
107
|
testId: testId
|
|
109
108
|
}, children);
|
|
@@ -120,8 +119,8 @@ var HelperMessage = exports.HelperMessage = function HelperMessage(_ref3) {
|
|
|
120
119
|
var ErrorMessage = exports.ErrorMessage = function ErrorMessage(_ref4) {
|
|
121
120
|
var children = _ref4.children,
|
|
122
121
|
testId = _ref4.testId;
|
|
123
|
-
return
|
|
124
|
-
return
|
|
122
|
+
return /*#__PURE__*/React.createElement(_fieldIdContext.FieldId.Consumer, null, function (fieldId) {
|
|
123
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
125
124
|
appearance: "error",
|
|
126
125
|
fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
|
|
127
126
|
testId: testId
|
|
@@ -139,8 +138,8 @@ var ErrorMessage = exports.ErrorMessage = function ErrorMessage(_ref4) {
|
|
|
139
138
|
var ValidMessage = exports.ValidMessage = function ValidMessage(_ref5) {
|
|
140
139
|
var children = _ref5.children,
|
|
141
140
|
testId = _ref5.testId;
|
|
142
|
-
return
|
|
143
|
-
return
|
|
141
|
+
return /*#__PURE__*/React.createElement(_fieldIdContext.FieldId.Consumer, null, function (fieldId) {
|
|
142
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
144
143
|
appearance: "valid",
|
|
145
144
|
fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
|
|
146
145
|
testId: testId
|
|
@@ -7,8 +7,6 @@ exports.default = RequiredAsterisk;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
var _constants = require("@atlaskit/theme/constants");
|
|
10
|
-
/** @jsx jsx */
|
|
11
|
-
|
|
12
10
|
var fontFamily = (0, _constants.fontFamily)();
|
|
13
11
|
var requiredIndicatorStyles = (0, _react.css)({
|
|
14
12
|
paddingLeft: "var(--ds-space-025, 2px)",
|
|
@@ -16,7 +14,7 @@ var requiredIndicatorStyles = (0, _react.css)({
|
|
|
16
14
|
fontFamily: fontFamily
|
|
17
15
|
});
|
|
18
16
|
function RequiredAsterisk() {
|
|
19
|
-
return
|
|
17
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
20
18
|
css: requiredIndicatorStyles,
|
|
21
19
|
"aria-hidden": "true",
|
|
22
20
|
title: "required"
|
package/dist/es2019/field.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { css
|
|
2
|
+
import { css } from '@emotion/react';
|
|
4
3
|
import { uid } from 'react-uid';
|
|
5
4
|
import invariant from 'tiny-invariant';
|
|
6
5
|
import { FieldId } from './field-id-context';
|
|
@@ -229,14 +228,14 @@ export default function Field(props) {
|
|
|
229
228
|
'aria-labelledby': `${fieldId}-label`,
|
|
230
229
|
id: fieldId
|
|
231
230
|
};
|
|
232
|
-
return
|
|
231
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
233
232
|
css: fieldWrapperStyles,
|
|
234
233
|
"data-testid": props.testId
|
|
235
|
-
}, props.label &&
|
|
234
|
+
}, props.label && /*#__PURE__*/React.createElement(Label, {
|
|
236
235
|
htmlFor: fieldId,
|
|
237
236
|
id: `${fieldId}-label`,
|
|
238
237
|
testId: props.testId && `${props.testId}--label`
|
|
239
|
-
}, props.label, props.isRequired &&
|
|
238
|
+
}, props.label, props.isRequired && /*#__PURE__*/React.createElement(RequiredAsterisk, null), props.elementAfterLabel), /*#__PURE__*/React.createElement(FieldId.Provider, {
|
|
240
239
|
value: fieldId
|
|
241
240
|
}, props.children({
|
|
242
241
|
fieldProps: extendedFieldProps,
|
package/dist/es2019/fieldset.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import { Legend } from './label';
|
|
5
3
|
const fieldSetStyles = css({
|
|
6
4
|
marginTop: "var(--ds-space-100, 8px)"
|
|
@@ -20,8 +18,8 @@ const Fieldset = ({
|
|
|
20
18
|
children,
|
|
21
19
|
legend
|
|
22
20
|
}) => {
|
|
23
|
-
return
|
|
21
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
24
22
|
css: fieldSetStyles
|
|
25
|
-
}, legend &&
|
|
23
|
+
}, legend && /*#__PURE__*/React.createElement(Legend, null, legend), children);
|
|
26
24
|
};
|
|
27
25
|
export default Fieldset;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
const formFooterWrapperStyles = css({
|
|
5
3
|
display: 'flex',
|
|
6
4
|
marginTop: "var(--ds-space-300, 24px)",
|
|
@@ -23,7 +21,7 @@ export default function FormFooter({
|
|
|
23
21
|
align = 'end',
|
|
24
22
|
children
|
|
25
23
|
}) {
|
|
26
|
-
return
|
|
24
|
+
return /*#__PURE__*/React.createElement("footer", {
|
|
27
25
|
css: [formFooterWrapperStyles, align === 'start' && justifyContentStyles]
|
|
28
26
|
}, children);
|
|
29
27
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
5
3
|
import { h700 } from '@atlaskit/theme/typography';
|
|
6
4
|
const fontFamily = getFontFamily();
|
|
@@ -32,28 +30,28 @@ const lightH700Styles = css(h700({
|
|
|
32
30
|
const FormHeaderContent = ({
|
|
33
31
|
children
|
|
34
32
|
}) => {
|
|
35
|
-
return
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
34
|
css: formHeaderContentStyles
|
|
37
35
|
}, children);
|
|
38
36
|
};
|
|
39
37
|
const FormHeaderDescription = ({
|
|
40
38
|
children
|
|
41
39
|
}) => {
|
|
42
|
-
return
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
41
|
css: formHeaderDescriptionStyles
|
|
44
42
|
}, children);
|
|
45
43
|
};
|
|
46
44
|
const FormHeaderTitle = ({
|
|
47
45
|
children
|
|
48
46
|
}) => {
|
|
49
|
-
return
|
|
47
|
+
return /*#__PURE__*/React.createElement("h2", {
|
|
50
48
|
css: [lightH700Styles, formHeaderTitleStyles]
|
|
51
49
|
}, children);
|
|
52
50
|
};
|
|
53
51
|
const FormHeaderWrapper = ({
|
|
54
52
|
children
|
|
55
53
|
}) => {
|
|
56
|
-
return
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
55
|
css: formHeaderWrapperStyles
|
|
58
56
|
}, children);
|
|
59
57
|
};
|
|
@@ -73,7 +71,7 @@ const FormHeader = ({
|
|
|
73
71
|
description,
|
|
74
72
|
title
|
|
75
73
|
}) => {
|
|
76
|
-
return
|
|
74
|
+
return /*#__PURE__*/React.createElement(FormHeaderWrapper, null, title && /*#__PURE__*/React.createElement(FormHeaderTitle, null, title), description && /*#__PURE__*/React.createElement(FormHeaderDescription, null, description), children && /*#__PURE__*/React.createElement(FormHeaderContent, null, children));
|
|
77
75
|
};
|
|
78
76
|
export default FormHeader;
|
|
79
77
|
export { FormHeaderContent, FormHeaderDescription, FormHeaderTitle };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import { h600 } from '@atlaskit/theme/typography';
|
|
5
3
|
const formSectionDescriptionStyles = css({
|
|
6
4
|
marginBlockStart: "var(--ds-space-100, 8px)"
|
|
@@ -26,21 +24,21 @@ const lightH600Styles = css(h600({
|
|
|
26
24
|
const FormSectionWrapper = ({
|
|
27
25
|
children
|
|
28
26
|
}) => {
|
|
29
|
-
return
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
28
|
css: formSectionWrapperStyles
|
|
31
29
|
}, children);
|
|
32
30
|
};
|
|
33
31
|
const FormSectionTitle = ({
|
|
34
32
|
children
|
|
35
33
|
}) => {
|
|
36
|
-
return
|
|
34
|
+
return /*#__PURE__*/React.createElement("h3", {
|
|
37
35
|
css: [formSectionTitleStyles, lightH600Styles]
|
|
38
36
|
}, children);
|
|
39
37
|
};
|
|
40
38
|
const FormSectionDescription = ({
|
|
41
39
|
children
|
|
42
40
|
}) => {
|
|
43
|
-
return
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
42
|
css: formSectionDescriptionStyles
|
|
45
43
|
}, children);
|
|
46
44
|
};
|
|
@@ -60,6 +58,6 @@ const FormSection = ({
|
|
|
60
58
|
description,
|
|
61
59
|
title
|
|
62
60
|
}) => {
|
|
63
|
-
return
|
|
61
|
+
return /*#__PURE__*/React.createElement(FormSectionWrapper, null, title && /*#__PURE__*/React.createElement(FormSectionTitle, null, title), description && /*#__PURE__*/React.createElement(FormSectionDescription, null, description), children);
|
|
64
62
|
};
|
|
65
63
|
export default FormSection;
|
package/dist/es2019/label.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
4
3
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
4
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
6
5
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -32,12 +31,15 @@ export const Label = ({
|
|
|
32
31
|
id,
|
|
33
32
|
testId
|
|
34
33
|
}) => {
|
|
35
|
-
return
|
|
34
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
hidden: true,
|
|
36
|
+
id: `label--${id || htmlFor}`
|
|
37
|
+
}, children), /*#__PURE__*/React.createElement("label", {
|
|
36
38
|
css: fieldsetLabelStyles,
|
|
37
39
|
id: id,
|
|
38
40
|
htmlFor: htmlFor,
|
|
39
41
|
"data-testid": testId
|
|
40
|
-
}, children);
|
|
42
|
+
}, children));
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -48,7 +50,7 @@ export const Label = ({
|
|
|
48
50
|
export const Legend = ({
|
|
49
51
|
children
|
|
50
52
|
}) => {
|
|
51
|
-
return
|
|
53
|
+
return /*#__PURE__*/React.createElement("legend", {
|
|
52
54
|
css: fieldsetLabelStyles
|
|
53
55
|
}, children);
|
|
54
56
|
};
|
package/dist/es2019/messages.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
5
3
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
4
|
import { N200 } from '@atlaskit/theme/colors';
|
|
@@ -27,6 +25,7 @@ const lightH200Styles = css(h200({
|
|
|
27
25
|
const messageStyles = css({
|
|
28
26
|
display: 'flex',
|
|
29
27
|
justifyContent: 'baseline',
|
|
28
|
+
gap: "var(--ds-space-050, 4px)",
|
|
30
29
|
fontFamily: `${fontFamily}`,
|
|
31
30
|
fontWeight: 'normal',
|
|
32
31
|
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
@@ -48,16 +47,16 @@ const iconWrapperStyles = css({
|
|
|
48
47
|
const IconWrapper = ({
|
|
49
48
|
children
|
|
50
49
|
}) => {
|
|
51
|
-
return
|
|
50
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
52
51
|
css: iconWrapperStyles
|
|
53
52
|
}, children);
|
|
54
53
|
};
|
|
55
54
|
const messageIcons = {
|
|
56
|
-
error:
|
|
55
|
+
error: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
57
56
|
size: "small",
|
|
58
57
|
label: "error"
|
|
59
58
|
}),
|
|
60
|
-
valid:
|
|
59
|
+
valid: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
61
60
|
size: "small",
|
|
62
61
|
label: "success"
|
|
63
62
|
})
|
|
@@ -78,13 +77,13 @@ const Message = ({
|
|
|
78
77
|
* If the child is just a string, this is not required and we can use one
|
|
79
78
|
* less DOM element.
|
|
80
79
|
*/
|
|
81
|
-
const content = typeof children === 'string' ? children :
|
|
82
|
-
return
|
|
80
|
+
const content = typeof children === 'string' ? children : /*#__PURE__*/React.createElement("span", null, children);
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
83
82
|
css: [lightH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
84
83
|
"data-testid": testId,
|
|
85
84
|
id: fieldId,
|
|
86
85
|
"aria-live": "polite"
|
|
87
|
-
}, icon &&
|
|
86
|
+
}, icon && /*#__PURE__*/React.createElement(IconWrapper, null, icon), content);
|
|
88
87
|
};
|
|
89
88
|
|
|
90
89
|
/**
|
|
@@ -97,7 +96,7 @@ const Message = ({
|
|
|
97
96
|
export const HelperMessage = ({
|
|
98
97
|
children,
|
|
99
98
|
testId
|
|
100
|
-
}) =>
|
|
99
|
+
}) => /*#__PURE__*/React.createElement(FieldId.Consumer, null, fieldId => /*#__PURE__*/React.createElement(Message, {
|
|
101
100
|
fieldId: fieldId ? `${fieldId}-helper` : undefined,
|
|
102
101
|
testId: testId
|
|
103
102
|
}, children));
|
|
@@ -112,7 +111,7 @@ export const HelperMessage = ({
|
|
|
112
111
|
export const ErrorMessage = ({
|
|
113
112
|
children,
|
|
114
113
|
testId
|
|
115
|
-
}) =>
|
|
114
|
+
}) => /*#__PURE__*/React.createElement(FieldId.Consumer, null, fieldId => /*#__PURE__*/React.createElement(Message, {
|
|
116
115
|
appearance: "error",
|
|
117
116
|
fieldId: fieldId ? `${fieldId}-error` : undefined,
|
|
118
117
|
testId: testId
|
|
@@ -128,7 +127,7 @@ export const ErrorMessage = ({
|
|
|
128
127
|
export const ValidMessage = ({
|
|
129
128
|
children,
|
|
130
129
|
testId
|
|
131
|
-
}) =>
|
|
130
|
+
}) => /*#__PURE__*/React.createElement(FieldId.Consumer, null, fieldId => /*#__PURE__*/React.createElement(Message, {
|
|
132
131
|
appearance: "valid",
|
|
133
132
|
fieldId: fieldId ? `${fieldId}-valid` : undefined,
|
|
134
133
|
testId: testId
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
3
2
|
import { R400 } from '@atlaskit/theme/colors';
|
|
4
3
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
5
4
|
const fontFamily = getFontFamily();
|
|
@@ -9,7 +8,7 @@ const requiredIndicatorStyles = css({
|
|
|
9
8
|
fontFamily
|
|
10
9
|
});
|
|
11
10
|
export default function RequiredAsterisk() {
|
|
12
|
-
return
|
|
11
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
13
12
|
css: requiredIndicatorStyles,
|
|
14
13
|
"aria-hidden": "true",
|
|
15
14
|
title: "required"
|
package/dist/esm/field.js
CHANGED
|
@@ -3,9 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
/** @jsx jsx */
|
|
7
6
|
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
-
import { css
|
|
7
|
+
import { css } from '@emotion/react';
|
|
9
8
|
import { uid } from 'react-uid';
|
|
10
9
|
import invariant from 'tiny-invariant';
|
|
11
10
|
import { FieldId } from './field-id-context';
|
|
@@ -238,14 +237,14 @@ export default function Field(props) {
|
|
|
238
237
|
'aria-labelledby': "".concat(fieldId, "-label"),
|
|
239
238
|
id: fieldId
|
|
240
239
|
});
|
|
241
|
-
return
|
|
240
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
242
241
|
css: fieldWrapperStyles,
|
|
243
242
|
"data-testid": props.testId
|
|
244
|
-
}, props.label &&
|
|
243
|
+
}, props.label && /*#__PURE__*/React.createElement(Label, {
|
|
245
244
|
htmlFor: fieldId,
|
|
246
245
|
id: "".concat(fieldId, "-label"),
|
|
247
246
|
testId: props.testId && "".concat(props.testId, "--label")
|
|
248
|
-
}, props.label, props.isRequired &&
|
|
247
|
+
}, props.label, props.isRequired && /*#__PURE__*/React.createElement(RequiredAsterisk, null), props.elementAfterLabel), /*#__PURE__*/React.createElement(FieldId.Provider, {
|
|
249
248
|
value: fieldId
|
|
250
249
|
}, props.children({
|
|
251
250
|
fieldProps: extendedFieldProps,
|
package/dist/esm/fieldset.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import { Legend } from './label';
|
|
5
3
|
var fieldSetStyles = css({
|
|
6
4
|
marginTop: "var(--ds-space-100, 8px)"
|
|
@@ -19,8 +17,8 @@ var fieldSetStyles = css({
|
|
|
19
17
|
var Fieldset = function Fieldset(_ref) {
|
|
20
18
|
var children = _ref.children,
|
|
21
19
|
legend = _ref.legend;
|
|
22
|
-
return
|
|
20
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
23
21
|
css: fieldSetStyles
|
|
24
|
-
}, legend &&
|
|
22
|
+
}, legend && /*#__PURE__*/React.createElement(Legend, null, legend), children);
|
|
25
23
|
};
|
|
26
24
|
export default Fieldset;
|
package/dist/esm/form-footer.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
var formFooterWrapperStyles = css({
|
|
5
3
|
display: 'flex',
|
|
6
4
|
marginTop: "var(--ds-space-300, 24px)",
|
|
@@ -23,7 +21,7 @@ export default function FormFooter(_ref) {
|
|
|
23
21
|
var _ref$align = _ref.align,
|
|
24
22
|
align = _ref$align === void 0 ? 'end' : _ref$align,
|
|
25
23
|
children = _ref.children;
|
|
26
|
-
return
|
|
24
|
+
return /*#__PURE__*/React.createElement("footer", {
|
|
27
25
|
css: [formFooterWrapperStyles, align === 'start' && justifyContentStyles]
|
|
28
26
|
}, children);
|
|
29
27
|
}
|
package/dist/esm/form-header.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
5
3
|
import { h700 } from '@atlaskit/theme/typography';
|
|
6
4
|
var fontFamily = getFontFamily();
|
|
@@ -31,25 +29,25 @@ var lightH700Styles = css(h700({
|
|
|
31
29
|
}));
|
|
32
30
|
var FormHeaderContent = function FormHeaderContent(_ref) {
|
|
33
31
|
var children = _ref.children;
|
|
34
|
-
return
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
33
|
css: formHeaderContentStyles
|
|
36
34
|
}, children);
|
|
37
35
|
};
|
|
38
36
|
var FormHeaderDescription = function FormHeaderDescription(_ref2) {
|
|
39
37
|
var children = _ref2.children;
|
|
40
|
-
return
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
39
|
css: formHeaderDescriptionStyles
|
|
42
40
|
}, children);
|
|
43
41
|
};
|
|
44
42
|
var FormHeaderTitle = function FormHeaderTitle(_ref3) {
|
|
45
43
|
var children = _ref3.children;
|
|
46
|
-
return
|
|
44
|
+
return /*#__PURE__*/React.createElement("h2", {
|
|
47
45
|
css: [lightH700Styles, formHeaderTitleStyles]
|
|
48
46
|
}, children);
|
|
49
47
|
};
|
|
50
48
|
var FormHeaderWrapper = function FormHeaderWrapper(_ref4) {
|
|
51
49
|
var children = _ref4.children;
|
|
52
|
-
return
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
51
|
css: formHeaderWrapperStyles
|
|
54
52
|
}, children);
|
|
55
53
|
};
|
|
@@ -68,7 +66,7 @@ var FormHeader = function FormHeader(_ref5) {
|
|
|
68
66
|
var children = _ref5.children,
|
|
69
67
|
description = _ref5.description,
|
|
70
68
|
title = _ref5.title;
|
|
71
|
-
return
|
|
69
|
+
return /*#__PURE__*/React.createElement(FormHeaderWrapper, null, title && /*#__PURE__*/React.createElement(FormHeaderTitle, null, title), description && /*#__PURE__*/React.createElement(FormHeaderDescription, null, description), children && /*#__PURE__*/React.createElement(FormHeaderContent, null, children));
|
|
72
70
|
};
|
|
73
71
|
export default FormHeader;
|
|
74
72
|
export { FormHeaderContent, FormHeaderDescription, FormHeaderTitle };
|
package/dist/esm/form-section.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import { h600 } from '@atlaskit/theme/typography';
|
|
5
3
|
var formSectionDescriptionStyles = css({
|
|
6
4
|
marginBlockStart: "var(--ds-space-100, 8px)"
|
|
@@ -25,19 +23,19 @@ var lightH600Styles = css(h600({
|
|
|
25
23
|
}));
|
|
26
24
|
var FormSectionWrapper = function FormSectionWrapper(_ref) {
|
|
27
25
|
var children = _ref.children;
|
|
28
|
-
return
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
27
|
css: formSectionWrapperStyles
|
|
30
28
|
}, children);
|
|
31
29
|
};
|
|
32
30
|
var FormSectionTitle = function FormSectionTitle(_ref2) {
|
|
33
31
|
var children = _ref2.children;
|
|
34
|
-
return
|
|
32
|
+
return /*#__PURE__*/React.createElement("h3", {
|
|
35
33
|
css: [formSectionTitleStyles, lightH600Styles]
|
|
36
34
|
}, children);
|
|
37
35
|
};
|
|
38
36
|
var FormSectionDescription = function FormSectionDescription(_ref3) {
|
|
39
37
|
var children = _ref3.children;
|
|
40
|
-
return
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
39
|
css: formSectionDescriptionStyles
|
|
42
40
|
}, children);
|
|
43
41
|
};
|
|
@@ -56,6 +54,6 @@ var FormSection = function FormSection(_ref4) {
|
|
|
56
54
|
var children = _ref4.children,
|
|
57
55
|
description = _ref4.description,
|
|
58
56
|
title = _ref4.title;
|
|
59
|
-
return
|
|
57
|
+
return /*#__PURE__*/React.createElement(FormSectionWrapper, null, title && /*#__PURE__*/React.createElement(FormSectionTitle, null, title), description && /*#__PURE__*/React.createElement(FormSectionDescription, null, description), children);
|
|
60
58
|
};
|
|
61
59
|
export default FormSection;
|
package/dist/esm/label.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { Fragment } from 'react';
|
|
2
|
+
import { css } from '@emotion/react';
|
|
4
3
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
4
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
6
5
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -31,12 +30,15 @@ export var Label = function Label(_ref) {
|
|
|
31
30
|
htmlFor = _ref.htmlFor,
|
|
32
31
|
id = _ref.id,
|
|
33
32
|
testId = _ref.testId;
|
|
34
|
-
return
|
|
33
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
hidden: true,
|
|
35
|
+
id: "label--".concat(id || htmlFor)
|
|
36
|
+
}, children), /*#__PURE__*/React.createElement("label", {
|
|
35
37
|
css: fieldsetLabelStyles,
|
|
36
38
|
id: id,
|
|
37
39
|
htmlFor: htmlFor,
|
|
38
40
|
"data-testid": testId
|
|
39
|
-
}, children);
|
|
41
|
+
}, children));
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -46,7 +48,7 @@ export var Label = function Label(_ref) {
|
|
|
46
48
|
*/
|
|
47
49
|
export var Legend = function Legend(_ref2) {
|
|
48
50
|
var children = _ref2.children;
|
|
49
|
-
return
|
|
51
|
+
return /*#__PURE__*/React.createElement("legend", {
|
|
50
52
|
css: fieldsetLabelStyles
|
|
51
53
|
}, children);
|
|
52
54
|
};
|
package/dist/esm/messages.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
4
2
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
5
3
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
6
4
|
import { N200 } from '@atlaskit/theme/colors';
|
|
@@ -27,6 +25,7 @@ var lightH200Styles = css(h200({
|
|
|
27
25
|
var messageStyles = css({
|
|
28
26
|
display: 'flex',
|
|
29
27
|
justifyContent: 'baseline',
|
|
28
|
+
gap: "var(--ds-space-050, 4px)",
|
|
30
29
|
fontFamily: "".concat(fontFamily),
|
|
31
30
|
fontWeight: 'normal',
|
|
32
31
|
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
@@ -47,16 +46,16 @@ var iconWrapperStyles = css({
|
|
|
47
46
|
});
|
|
48
47
|
var IconWrapper = function IconWrapper(_ref) {
|
|
49
48
|
var children = _ref.children;
|
|
50
|
-
return
|
|
49
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
51
50
|
css: iconWrapperStyles
|
|
52
51
|
}, children);
|
|
53
52
|
};
|
|
54
53
|
var messageIcons = {
|
|
55
|
-
error:
|
|
54
|
+
error: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
56
55
|
size: "small",
|
|
57
56
|
label: "error"
|
|
58
57
|
}),
|
|
59
|
-
valid:
|
|
58
|
+
valid: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
60
59
|
size: "small",
|
|
61
60
|
label: "success"
|
|
62
61
|
})
|
|
@@ -77,13 +76,13 @@ var Message = function Message(_ref2) {
|
|
|
77
76
|
* If the child is just a string, this is not required and we can use one
|
|
78
77
|
* less DOM element.
|
|
79
78
|
*/
|
|
80
|
-
var content = typeof children === 'string' ? children :
|
|
81
|
-
return
|
|
79
|
+
var content = typeof children === 'string' ? children : /*#__PURE__*/React.createElement("span", null, children);
|
|
80
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
81
|
css: [lightH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
83
82
|
"data-testid": testId,
|
|
84
83
|
id: fieldId,
|
|
85
84
|
"aria-live": "polite"
|
|
86
|
-
}, icon &&
|
|
85
|
+
}, icon && /*#__PURE__*/React.createElement(IconWrapper, null, icon), content);
|
|
87
86
|
};
|
|
88
87
|
|
|
89
88
|
/**
|
|
@@ -96,8 +95,8 @@ var Message = function Message(_ref2) {
|
|
|
96
95
|
export var HelperMessage = function HelperMessage(_ref3) {
|
|
97
96
|
var children = _ref3.children,
|
|
98
97
|
testId = _ref3.testId;
|
|
99
|
-
return
|
|
100
|
-
return
|
|
98
|
+
return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) {
|
|
99
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
101
100
|
fieldId: fieldId ? "".concat(fieldId, "-helper") : undefined,
|
|
102
101
|
testId: testId
|
|
103
102
|
}, children);
|
|
@@ -114,8 +113,8 @@ export var HelperMessage = function HelperMessage(_ref3) {
|
|
|
114
113
|
export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
115
114
|
var children = _ref4.children,
|
|
116
115
|
testId = _ref4.testId;
|
|
117
|
-
return
|
|
118
|
-
return
|
|
116
|
+
return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) {
|
|
117
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
119
118
|
appearance: "error",
|
|
120
119
|
fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
|
|
121
120
|
testId: testId
|
|
@@ -133,8 +132,8 @@ export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
|
133
132
|
export var ValidMessage = function ValidMessage(_ref5) {
|
|
134
133
|
var children = _ref5.children,
|
|
135
134
|
testId = _ref5.testId;
|
|
136
|
-
return
|
|
137
|
-
return
|
|
135
|
+
return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) {
|
|
136
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
138
137
|
appearance: "valid",
|
|
139
138
|
fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
|
|
140
139
|
testId: testId
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import { css } from '@emotion/react';
|
|
3
2
|
import { R400 } from '@atlaskit/theme/colors';
|
|
4
3
|
import { fontFamily as getFontFamily } from '@atlaskit/theme/constants';
|
|
5
4
|
var fontFamily = getFontFamily();
|
|
@@ -9,7 +8,7 @@ var requiredIndicatorStyles = css({
|
|
|
9
8
|
fontFamily: fontFamily
|
|
10
9
|
});
|
|
11
10
|
export default function RequiredAsterisk() {
|
|
12
|
-
return
|
|
11
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
13
12
|
css: requiredIndicatorStyles,
|
|
14
13
|
"aria-hidden": "true",
|
|
15
14
|
title: "required"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/form",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "A form allows users to input information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/icon": "^
|
|
30
|
+
"@atlaskit/icon": "^22.0.0",
|
|
31
31
|
"@atlaskit/theme": "^12.6.0",
|
|
32
|
-
"@atlaskit/tokens": "^1.
|
|
32
|
+
"@atlaskit/tokens": "^1.29.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@emotion/react": "^11.7.1",
|
|
35
35
|
"final-form": "^4.20.1",
|
|
@@ -43,14 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@af/accessibility-testing": "*",
|
|
46
|
+
"@af/integration-testing": "*",
|
|
46
47
|
"@af/visual-regression": "*",
|
|
47
|
-
"@atlaskit/button": "^16.
|
|
48
|
+
"@atlaskit/button": "^16.17.0",
|
|
48
49
|
"@atlaskit/checkbox": "^13.0.0",
|
|
49
50
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
50
51
|
"@atlaskit/range": "^7.1.0",
|
|
51
|
-
"@atlaskit/select": "^
|
|
52
|
+
"@atlaskit/select": "^17.0.0",
|
|
52
53
|
"@atlaskit/ssr": "*",
|
|
53
|
-
"@atlaskit/textfield": "^
|
|
54
|
+
"@atlaskit/textfield": "^6.0.0",
|
|
54
55
|
"@atlaskit/visual-regression": "*",
|
|
55
56
|
"@atlaskit/webdriver-runner": "*",
|
|
56
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
package/tmp/api-report-tmp.d.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/form"
|
|
2
|
-
|
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
|
|
7
|
-
import { FC } from 'react';
|
|
8
|
-
import { FormApi as FormApi_2 } from 'final-form';
|
|
9
|
-
import { FormEvent } from 'react';
|
|
10
|
-
import { FormState } from 'final-form';
|
|
11
|
-
import { jsx } from '@emotion/react';
|
|
12
|
-
import { default as React_2 } from 'react';
|
|
13
|
-
import { ReactNode } from 'react';
|
|
14
|
-
|
|
15
|
-
// @public (undocumented)
|
|
16
|
-
type Align = 'end' | 'start';
|
|
17
|
-
|
|
18
|
-
// @public
|
|
19
|
-
export const CheckboxField: FC<CheckboxProps>;
|
|
20
|
-
|
|
21
|
-
// @public (undocumented)
|
|
22
|
-
export interface CheckboxFieldProps extends FieldProps<string | undefined> {
|
|
23
|
-
// (undocumented)
|
|
24
|
-
isChecked: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// @public (undocumented)
|
|
28
|
-
interface CheckboxProps {
|
|
29
|
-
children: (args: {
|
|
30
|
-
fieldProps: CheckboxFieldProps;
|
|
31
|
-
error?: string;
|
|
32
|
-
valid: boolean;
|
|
33
|
-
meta: Meta;
|
|
34
|
-
}) => ReactNode;
|
|
35
|
-
defaultIsChecked?: boolean;
|
|
36
|
-
isDisabled?: boolean;
|
|
37
|
-
isRequired?: boolean;
|
|
38
|
-
label?: ReactNode;
|
|
39
|
-
name: string;
|
|
40
|
-
value?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// @public
|
|
44
|
-
export const ErrorMessage: ({ children, testId }: MessageProps) => jsx.JSX.Element;
|
|
45
|
-
|
|
46
|
-
// @public (undocumented)
|
|
47
|
-
export function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>): jsx.JSX.Element;
|
|
48
|
-
|
|
49
|
-
// @public (undocumented)
|
|
50
|
-
interface FieldComponentProps<FieldValue, Element extends SupportedElements> {
|
|
51
|
-
children: (args: {
|
|
52
|
-
fieldProps: FieldProps<FieldValue, Element>;
|
|
53
|
-
error?: string;
|
|
54
|
-
valid: boolean;
|
|
55
|
-
meta: Meta;
|
|
56
|
-
}) => ReactNode;
|
|
57
|
-
defaultValue?: ((currentDefaultValue?: FieldValue) => FieldValue) | FieldValue;
|
|
58
|
-
elementAfterLabel?: ReactNode;
|
|
59
|
-
id?: string;
|
|
60
|
-
isDisabled?: boolean;
|
|
61
|
-
isRequired?: boolean;
|
|
62
|
-
label?: ReactNode;
|
|
63
|
-
name: string;
|
|
64
|
-
testId?: string;
|
|
65
|
-
transform?: (event: FieldValue | FormEvent<Element>, current: FieldValue) => FieldValue;
|
|
66
|
-
validate?: (value: FieldValue | undefined, formState: Object, fieldState: Meta) => Promise<string | void> | string | void;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// @public (undocumented)
|
|
70
|
-
export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
|
|
71
|
-
// (undocumented)
|
|
72
|
-
'aria-invalid': 'false' | 'true';
|
|
73
|
-
// (undocumented)
|
|
74
|
-
'aria-labelledby': string;
|
|
75
|
-
// (undocumented)
|
|
76
|
-
id: string;
|
|
77
|
-
// (undocumented)
|
|
78
|
-
isDisabled: boolean;
|
|
79
|
-
// (undocumented)
|
|
80
|
-
isInvalid: boolean;
|
|
81
|
-
// (undocumented)
|
|
82
|
-
isRequired: boolean;
|
|
83
|
-
// (undocumented)
|
|
84
|
-
name: string;
|
|
85
|
-
// (undocumented)
|
|
86
|
-
onBlur: () => void;
|
|
87
|
-
// (undocumented)
|
|
88
|
-
onChange: (value: FieldValue | FormEvent<Element>) => void;
|
|
89
|
-
// (undocumented)
|
|
90
|
-
onFocus: () => void;
|
|
91
|
-
// (undocumented)
|
|
92
|
-
value: FieldValue;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// @public
|
|
96
|
-
export const Fieldset: ({ children, legend }: FieldsetProps) => jsx.JSX.Element;
|
|
97
|
-
|
|
98
|
-
// @public (undocumented)
|
|
99
|
-
interface FieldsetProps {
|
|
100
|
-
children: ReactNode;
|
|
101
|
-
legend?: ReactNode;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// @public (undocumented)
|
|
105
|
-
function Form<FormValues extends Record<string, any> = {}>(props: FormProps<FormValues>): JSX.Element;
|
|
106
|
-
export default Form;
|
|
107
|
-
|
|
108
|
-
// @public (undocumented)
|
|
109
|
-
export type FormApi<FormData> = FormApi_2<FormData>;
|
|
110
|
-
|
|
111
|
-
// @public (undocumented)
|
|
112
|
-
interface FormChildrenProps {
|
|
113
|
-
// (undocumented)
|
|
114
|
-
onKeyDown: (event: React_2.KeyboardEvent<HTMLElement>) => void;
|
|
115
|
-
// (undocumented)
|
|
116
|
-
onSubmit: (event?: React_2.FormEvent<HTMLFormElement> | React_2.SyntheticEvent<HTMLElement>) => void;
|
|
117
|
-
// (undocumented)
|
|
118
|
-
ref: React_2.RefObject<HTMLFormElement>;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// @public
|
|
122
|
-
export function FormFooter({ align, children, }: FormFooterProps): jsx.JSX.Element;
|
|
123
|
-
|
|
124
|
-
// @public (undocumented)
|
|
125
|
-
interface FormFooterProps {
|
|
126
|
-
align?: Align;
|
|
127
|
-
children?: ReactNode;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// @public
|
|
131
|
-
export const FormHeader: ({ children, description, title }: FormHeaderProps) => jsx.JSX.Element;
|
|
132
|
-
|
|
133
|
-
// @public (undocumented)
|
|
134
|
-
interface FormHeaderProps {
|
|
135
|
-
children?: ReactNode;
|
|
136
|
-
description?: ReactNode;
|
|
137
|
-
title?: ReactNode;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// @public (undocumented)
|
|
141
|
-
export interface FormProps<FormValues> {
|
|
142
|
-
children: (args: {
|
|
143
|
-
formProps: FormChildrenProps;
|
|
144
|
-
disabled: boolean;
|
|
145
|
-
dirty: boolean;
|
|
146
|
-
submitting: boolean;
|
|
147
|
-
getState: () => FormState<FormValues>;
|
|
148
|
-
getValues: () => FormValues;
|
|
149
|
-
setFieldValue: (name: string, value: any) => void;
|
|
150
|
-
reset: (initialValues?: FormValues) => void;
|
|
151
|
-
}) => ReactNode;
|
|
152
|
-
isDisabled?: boolean;
|
|
153
|
-
onSubmit: OnSubmitHandler<FormValues>;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// @public
|
|
157
|
-
export const FormSection: ({ children, description, title }: FormSectionProps) => jsx.JSX.Element;
|
|
158
|
-
|
|
159
|
-
// @public (undocumented)
|
|
160
|
-
interface FormSectionProps {
|
|
161
|
-
children?: ReactNode;
|
|
162
|
-
description?: ReactNode;
|
|
163
|
-
title?: ReactNode;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// @public
|
|
167
|
-
export const HelperMessage: ({ children, testId }: MessageProps) => jsx.JSX.Element;
|
|
168
|
-
|
|
169
|
-
// @public
|
|
170
|
-
interface InternalMessageProps {
|
|
171
|
-
appearance?: MessageAppearance;
|
|
172
|
-
children: ReactNode;
|
|
173
|
-
// (undocumented)
|
|
174
|
-
fieldId?: string;
|
|
175
|
-
testId?: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// @public
|
|
179
|
-
export const Label: FC<LabelProps>;
|
|
180
|
-
|
|
181
|
-
// @public (undocumented)
|
|
182
|
-
export interface LabelProps {
|
|
183
|
-
// (undocumented)
|
|
184
|
-
children: ReactNode;
|
|
185
|
-
// (undocumented)
|
|
186
|
-
htmlFor: string;
|
|
187
|
-
// (undocumented)
|
|
188
|
-
id?: string;
|
|
189
|
-
// (undocumented)
|
|
190
|
-
testId?: string;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// @public
|
|
194
|
-
export const Legend: FC<LegendProps>;
|
|
195
|
-
|
|
196
|
-
// @public (undocumented)
|
|
197
|
-
export interface LegendProps {
|
|
198
|
-
// (undocumented)
|
|
199
|
-
children: ReactNode;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// @public (undocumented)
|
|
203
|
-
type MessageAppearance = 'default' | 'error' | 'valid';
|
|
204
|
-
|
|
205
|
-
// @public
|
|
206
|
-
type MessageProps = Pick<InternalMessageProps, 'children' | 'testId'>;
|
|
207
|
-
|
|
208
|
-
// @public (undocumented)
|
|
209
|
-
interface Meta {
|
|
210
|
-
// (undocumented)
|
|
211
|
-
dirty: boolean;
|
|
212
|
-
// (undocumented)
|
|
213
|
-
dirtySinceLastSubmit: boolean;
|
|
214
|
-
// (undocumented)
|
|
215
|
-
error?: string;
|
|
216
|
-
// (undocumented)
|
|
217
|
-
submitError?: boolean;
|
|
218
|
-
// (undocumented)
|
|
219
|
-
submitFailed: boolean;
|
|
220
|
-
// (undocumented)
|
|
221
|
-
submitting: boolean;
|
|
222
|
-
// (undocumented)
|
|
223
|
-
touched: boolean;
|
|
224
|
-
// (undocumented)
|
|
225
|
-
valid: boolean;
|
|
226
|
-
// (undocumented)
|
|
227
|
-
validating?: boolean;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// @public (undocumented)
|
|
231
|
-
export type OnSubmitHandler<FormData> = (values: FormData, form: FormApi<FormData>, callback?: (errors?: Record<string, string>) => void) => Object | Promise<Object | void> | void;
|
|
232
|
-
|
|
233
|
-
// @public
|
|
234
|
-
export const RangeField: FC<RangeFieldProps>;
|
|
235
|
-
|
|
236
|
-
// @public (undocumented)
|
|
237
|
-
export interface RangeFieldProps {
|
|
238
|
-
// (undocumented)
|
|
239
|
-
children: (args: {
|
|
240
|
-
fieldProps: RangeProps;
|
|
241
|
-
error?: string;
|
|
242
|
-
meta: Meta;
|
|
243
|
-
}) => React_2.ReactNode;
|
|
244
|
-
defaultValue: ((currentDefaultValue?: number) => number) | number;
|
|
245
|
-
id?: string;
|
|
246
|
-
isDisabled?: boolean;
|
|
247
|
-
label?: ReactNode;
|
|
248
|
-
name: string;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// @public (undocumented)
|
|
252
|
-
type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
|
|
253
|
-
|
|
254
|
-
// @public (undocumented)
|
|
255
|
-
export function RequiredAsterisk(): jsx.JSX.Element;
|
|
256
|
-
|
|
257
|
-
// @public (undocumented)
|
|
258
|
-
type SupportedElements = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
259
|
-
|
|
260
|
-
// @public
|
|
261
|
-
export const ValidMessage: ({ children, testId }: MessageProps) => jsx.JSX.Element;
|
|
262
|
-
|
|
263
|
-
// (No @packageDocumentation comment for this package)
|
|
264
|
-
|
|
265
|
-
```
|