@atlaskit/form 8.8.2 → 8.8.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/CHANGELOG.md +15 -0
- package/dist/cjs/fieldset.js +26 -13
- package/dist/cjs/label.js +26 -13
- package/dist/cjs/messages.js +44 -25
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/fieldset.js +19 -9
- package/dist/es2019/label.js +19 -9
- package/dist/es2019/messages.js +43 -25
- package/dist/es2019/version.json +1 -1
- package/dist/esm/fieldset.js +25 -13
- package/dist/esm/label.js +25 -13
- package/dist/esm/messages.js +44 -25
- package/dist/esm/version.json +1 -1
- package/dist/types/messages.d.ts +11 -7
- package/package.json +3 -2
- package/report.api.md +14 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/form
|
|
2
2
|
|
|
3
|
+
## 8.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1b8e257525f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1b8e257525f) - [ux] Message content now preserves whitespace between elements.
|
|
8
|
+
- [`ea1ad1d867f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ea1ad1d867f) - Message typings have been corrected, removing a number of props. These props existed only in the type and had no effect when used.
|
|
9
|
+
|
|
10
|
+
The props which were removed from the typings are:
|
|
11
|
+
|
|
12
|
+
- `error`
|
|
13
|
+
- `fieldId`
|
|
14
|
+
- `valid`
|
|
15
|
+
|
|
16
|
+
- [`b96e69cdf36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b96e69cdf36) - [ux] DSP-6625: Updated Form label text color token to match the design.
|
|
17
|
+
|
|
3
18
|
## 8.8.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/fieldset.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
9
|
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
|
|
10
12
|
var _components = require("@atlaskit/theme/components");
|
|
11
13
|
|
|
12
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -24,19 +26,30 @@ var fieldsetLabelStyles = (0, _react.css)({
|
|
|
24
26
|
});
|
|
25
27
|
var fieldSetStyles = (0, _react.css)({
|
|
26
28
|
marginTop: "".concat(gridSize, "px")
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* TODO: Address duplication with packages/design-system/form/src/label.tsx
|
|
32
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
var getFieldsetLabelDynamicStyles = function getFieldsetLabelDynamicStyles(mode) {
|
|
36
|
+
return (0, _react.css)([(0, _typography.h200)({
|
|
37
|
+
theme: {
|
|
38
|
+
mode: mode
|
|
39
|
+
}
|
|
40
|
+
}), {
|
|
41
|
+
color: "var(--ds-text-subtle, ".concat((0, _colors.subtleHeading)({
|
|
42
|
+
theme: {
|
|
43
|
+
mode: mode
|
|
44
|
+
}
|
|
45
|
+
}), ")")
|
|
46
|
+
}]);
|
|
47
|
+
}; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
var lightH200Styles = getFieldsetLabelDynamicStyles('light'); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
51
|
+
|
|
52
|
+
var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
40
53
|
|
|
41
54
|
var FieldsetLabel = function FieldsetLabel(_ref) {
|
|
42
55
|
var children = _ref.children;
|
package/dist/cjs/label.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
9
|
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
|
|
10
12
|
var _components = require("@atlaskit/theme/components");
|
|
11
13
|
|
|
12
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -21,19 +23,30 @@ var labelStyles = (0, _react.css)({
|
|
|
21
23
|
marginTop: 0,
|
|
22
24
|
marginBottom: gridSize / 2,
|
|
23
25
|
fontFamily: fontFamily
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* TODO: Address duplication with packages/design-system/form/src/fieldset.tsx
|
|
29
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
var getFieldsetLabelDynamicStyles = function getFieldsetLabelDynamicStyles(mode) {
|
|
33
|
+
return (0, _react.css)([(0, _typography.h200)({
|
|
34
|
+
theme: {
|
|
35
|
+
mode: mode
|
|
36
|
+
}
|
|
37
|
+
}), {
|
|
38
|
+
color: "var(--ds-text-subtle, ".concat((0, _colors.subtleHeading)({
|
|
39
|
+
theme: {
|
|
40
|
+
mode: mode
|
|
41
|
+
}
|
|
42
|
+
}), ")")
|
|
43
|
+
}]);
|
|
44
|
+
}; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var lightH200Styles = getFieldsetLabelDynamicStyles('light'); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
48
|
+
|
|
49
|
+
var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
37
50
|
/**
|
|
38
51
|
* __Label__
|
|
39
52
|
*
|
package/dist/cjs/messages.js
CHANGED
|
@@ -40,15 +40,6 @@ var darkH200Styles = (0, _react2.css)((0, _typography.h200)({
|
|
|
40
40
|
mode: 'dark'
|
|
41
41
|
}
|
|
42
42
|
}));
|
|
43
|
-
var messageErrorColorStyles = (0, _react2.css)({
|
|
44
|
-
color: "var(--ds-text-danger, #AE2A19)"
|
|
45
|
-
});
|
|
46
|
-
var messageNeutralColorStyles = (0, _react2.css)({
|
|
47
|
-
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
|
48
|
-
});
|
|
49
|
-
var messageValidColorStyles = (0, _react2.css)({
|
|
50
|
-
color: "var(--ds-text-success, #216E4E)"
|
|
51
|
-
});
|
|
52
43
|
var messageStyles = (0, _react2.css)({
|
|
53
44
|
display: 'flex',
|
|
54
45
|
marginTop: "".concat(gridSize * 0.5, "px"),
|
|
@@ -56,6 +47,17 @@ var messageStyles = (0, _react2.css)({
|
|
|
56
47
|
fontFamily: "".concat(fontFamily),
|
|
57
48
|
fontWeight: 'normal'
|
|
58
49
|
});
|
|
50
|
+
var messageAppearanceStyles = {
|
|
51
|
+
default: (0, _react2.css)({
|
|
52
|
+
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
|
53
|
+
}),
|
|
54
|
+
error: (0, _react2.css)({
|
|
55
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
56
|
+
}),
|
|
57
|
+
valid: (0, _react2.css)({
|
|
58
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
59
|
+
})
|
|
60
|
+
};
|
|
59
61
|
var iconWrapperStyles = (0, _react2.css)({
|
|
60
62
|
display: 'flex'
|
|
61
63
|
});
|
|
@@ -67,23 +69,44 @@ var IconWrapper = function IconWrapper(_ref) {
|
|
|
67
69
|
}, children);
|
|
68
70
|
};
|
|
69
71
|
|
|
72
|
+
var messageIcons = {
|
|
73
|
+
error: (0, _react2.jsx)(_error.default, {
|
|
74
|
+
size: "small",
|
|
75
|
+
label: "error"
|
|
76
|
+
}),
|
|
77
|
+
valid: (0, _react2.jsx)(_success.default, {
|
|
78
|
+
size: "small",
|
|
79
|
+
label: "success"
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
|
|
70
83
|
var Message = function Message(_ref2) {
|
|
71
84
|
var children = _ref2.children,
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
_ref2$appearance = _ref2.appearance,
|
|
86
|
+
appearance = _ref2$appearance === void 0 ? 'default' : _ref2$appearance,
|
|
74
87
|
fieldId = _ref2.fieldId,
|
|
75
88
|
testId = _ref2.testId;
|
|
76
89
|
|
|
77
90
|
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
78
91
|
mode = _useGlobalTheme.mode;
|
|
79
92
|
|
|
93
|
+
var icon = messageIcons[appearance];
|
|
94
|
+
/**
|
|
95
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
96
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
97
|
+
* between children.
|
|
98
|
+
*
|
|
99
|
+
* If the child is just a string, this is not required and we can use one
|
|
100
|
+
* less DOM element.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
var content = typeof children === 'string' ? children : (0, _react2.jsx)("span", null, children);
|
|
80
104
|
return (0, _react2.jsx)("div", {
|
|
81
|
-
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles,
|
|
105
|
+
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
82
106
|
"data-testid": testId,
|
|
83
107
|
id: fieldId
|
|
84
|
-
},
|
|
108
|
+
}, icon && (0, _react2.jsx)(IconWrapper, null, icon), content);
|
|
85
109
|
};
|
|
86
|
-
|
|
87
110
|
/**
|
|
88
111
|
* __Helper message__
|
|
89
112
|
*
|
|
@@ -91,6 +114,8 @@ var Message = function Message(_ref2) {
|
|
|
91
114
|
* 'Password should be more than 4 characters'
|
|
92
115
|
*
|
|
93
116
|
*/
|
|
117
|
+
|
|
118
|
+
|
|
94
119
|
var HelperMessage = function HelperMessage(_ref3) {
|
|
95
120
|
var children = _ref3.children,
|
|
96
121
|
testId = _ref3.testId;
|
|
@@ -117,13 +142,10 @@ var ErrorMessage = function ErrorMessage(_ref4) {
|
|
|
117
142
|
testId = _ref4.testId;
|
|
118
143
|
return (0, _react2.jsx)(_field.FieldId.Consumer, null, function (fieldId) {
|
|
119
144
|
return (0, _react2.jsx)(Message, {
|
|
120
|
-
|
|
145
|
+
appearance: "error",
|
|
121
146
|
fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
|
|
122
147
|
testId: testId
|
|
123
|
-
},
|
|
124
|
-
size: "small",
|
|
125
|
-
label: "error"
|
|
126
|
-
})), children);
|
|
148
|
+
}, children);
|
|
127
149
|
});
|
|
128
150
|
};
|
|
129
151
|
/**
|
|
@@ -142,13 +164,10 @@ var ValidMessage = function ValidMessage(_ref5) {
|
|
|
142
164
|
testId = _ref5.testId;
|
|
143
165
|
return (0, _react2.jsx)(_field.FieldId.Consumer, null, function (fieldId) {
|
|
144
166
|
return (0, _react2.jsx)(Message, {
|
|
167
|
+
appearance: "valid",
|
|
145
168
|
fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
|
|
146
|
-
testId: testId
|
|
147
|
-
|
|
148
|
-
}, (0, _react2.jsx)(IconWrapper, null, (0, _react2.jsx)(_success.default, {
|
|
149
|
-
size: "small",
|
|
150
|
-
label: "success"
|
|
151
|
-
})), children);
|
|
169
|
+
testId: testId
|
|
170
|
+
}, children);
|
|
152
171
|
});
|
|
153
172
|
};
|
|
154
173
|
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/fieldset.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { subtleHeading } from '@atlaskit/theme/colors';
|
|
3
4
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
4
5
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
5
6
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -13,19 +14,28 @@ const fieldsetLabelStyles = css({
|
|
|
13
14
|
});
|
|
14
15
|
const fieldSetStyles = css({
|
|
15
16
|
marginTop: `${gridSize}px`
|
|
16
|
-
});
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* TODO: Address duplication with packages/design-system/form/src/label.tsx
|
|
20
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
21
|
+
*/
|
|
17
22
|
|
|
18
|
-
const
|
|
23
|
+
const getFieldsetLabelDynamicStyles = mode => css([h200({
|
|
19
24
|
theme: {
|
|
20
|
-
mode
|
|
25
|
+
mode
|
|
21
26
|
}
|
|
22
|
-
})
|
|
27
|
+
}), {
|
|
28
|
+
color: `var(--ds-text-subtle, ${subtleHeading({
|
|
29
|
+
theme: {
|
|
30
|
+
mode
|
|
31
|
+
}
|
|
32
|
+
})})`
|
|
33
|
+
}]); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}));
|
|
35
|
+
|
|
36
|
+
const lightH200Styles = getFieldsetLabelDynamicStyles('light'); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
37
|
+
|
|
38
|
+
const darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
29
39
|
|
|
30
40
|
const FieldsetLabel = ({
|
|
31
41
|
children
|
package/dist/es2019/label.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { subtleHeading } from '@atlaskit/theme/colors';
|
|
3
4
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
4
5
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
5
6
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -10,19 +11,28 @@ const labelStyles = css({
|
|
|
10
11
|
marginTop: 0,
|
|
11
12
|
marginBottom: gridSize / 2,
|
|
12
13
|
fontFamily: fontFamily
|
|
13
|
-
});
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* TODO: Address duplication with packages/design-system/form/src/fieldset.tsx
|
|
17
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
18
|
+
*/
|
|
14
19
|
|
|
15
|
-
const
|
|
20
|
+
const getFieldsetLabelDynamicStyles = mode => css([h200({
|
|
16
21
|
theme: {
|
|
17
|
-
mode
|
|
22
|
+
mode
|
|
18
23
|
}
|
|
19
|
-
})
|
|
24
|
+
}), {
|
|
25
|
+
color: `var(--ds-text-subtle, ${subtleHeading({
|
|
26
|
+
theme: {
|
|
27
|
+
mode
|
|
28
|
+
}
|
|
29
|
+
})})`
|
|
30
|
+
}]); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}));
|
|
32
|
+
|
|
33
|
+
const lightH200Styles = getFieldsetLabelDynamicStyles('light'); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
34
|
+
|
|
35
|
+
const darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
26
36
|
/**
|
|
27
37
|
* __Label__
|
|
28
38
|
*
|
package/dist/es2019/messages.js
CHANGED
|
@@ -22,15 +22,6 @@ const darkH200Styles = css(h200({
|
|
|
22
22
|
mode: 'dark'
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
|
-
const messageErrorColorStyles = css({
|
|
26
|
-
color: "var(--ds-text-danger, #AE2A19)"
|
|
27
|
-
});
|
|
28
|
-
const messageNeutralColorStyles = css({
|
|
29
|
-
color: `var(--ds-text-subtlest, ${N200})`
|
|
30
|
-
});
|
|
31
|
-
const messageValidColorStyles = css({
|
|
32
|
-
color: "var(--ds-text-success, #216E4E)"
|
|
33
|
-
});
|
|
34
25
|
const messageStyles = css({
|
|
35
26
|
display: 'flex',
|
|
36
27
|
marginTop: `${gridSize * 0.5}px`,
|
|
@@ -38,6 +29,17 @@ const messageStyles = css({
|
|
|
38
29
|
fontFamily: `${fontFamily}`,
|
|
39
30
|
fontWeight: 'normal'
|
|
40
31
|
});
|
|
32
|
+
const messageAppearanceStyles = {
|
|
33
|
+
default: css({
|
|
34
|
+
color: `var(--ds-text-subtlest, ${N200})`
|
|
35
|
+
}),
|
|
36
|
+
error: css({
|
|
37
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
38
|
+
}),
|
|
39
|
+
valid: css({
|
|
40
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
41
|
+
})
|
|
42
|
+
};
|
|
41
43
|
const iconWrapperStyles = css({
|
|
42
44
|
display: 'flex'
|
|
43
45
|
});
|
|
@@ -50,23 +52,43 @@ const IconWrapper = ({
|
|
|
50
52
|
}, children);
|
|
51
53
|
};
|
|
52
54
|
|
|
55
|
+
const messageIcons = {
|
|
56
|
+
error: jsx(ErrorIcon, {
|
|
57
|
+
size: "small",
|
|
58
|
+
label: "error"
|
|
59
|
+
}),
|
|
60
|
+
valid: jsx(SuccessIcon, {
|
|
61
|
+
size: "small",
|
|
62
|
+
label: "success"
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
|
|
53
66
|
const Message = ({
|
|
54
67
|
children,
|
|
55
|
-
|
|
56
|
-
valid,
|
|
68
|
+
appearance = 'default',
|
|
57
69
|
fieldId,
|
|
58
70
|
testId
|
|
59
71
|
}) => {
|
|
60
72
|
const {
|
|
61
73
|
mode
|
|
62
74
|
} = useGlobalTheme();
|
|
75
|
+
const icon = messageIcons[appearance];
|
|
76
|
+
/**
|
|
77
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
78
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
79
|
+
* between children.
|
|
80
|
+
*
|
|
81
|
+
* If the child is just a string, this is not required and we can use one
|
|
82
|
+
* less DOM element.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
const content = typeof children === 'string' ? children : jsx("span", null, children);
|
|
63
86
|
return jsx("div", {
|
|
64
|
-
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles,
|
|
87
|
+
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
65
88
|
"data-testid": testId,
|
|
66
89
|
id: fieldId
|
|
67
|
-
},
|
|
90
|
+
}, icon && jsx(IconWrapper, null, icon), content);
|
|
68
91
|
};
|
|
69
|
-
|
|
70
92
|
/**
|
|
71
93
|
* __Helper message__
|
|
72
94
|
*
|
|
@@ -74,6 +96,8 @@ const Message = ({
|
|
|
74
96
|
* 'Password should be more than 4 characters'
|
|
75
97
|
*
|
|
76
98
|
*/
|
|
99
|
+
|
|
100
|
+
|
|
77
101
|
export const HelperMessage = ({
|
|
78
102
|
children,
|
|
79
103
|
testId
|
|
@@ -93,13 +117,10 @@ export const ErrorMessage = ({
|
|
|
93
117
|
children,
|
|
94
118
|
testId
|
|
95
119
|
}) => jsx(FieldId.Consumer, null, fieldId => jsx(Message, {
|
|
96
|
-
|
|
120
|
+
appearance: "error",
|
|
97
121
|
fieldId: fieldId ? `${fieldId}-error` : undefined,
|
|
98
122
|
testId: testId
|
|
99
|
-
},
|
|
100
|
-
size: "small",
|
|
101
|
-
label: "error"
|
|
102
|
-
})), children));
|
|
123
|
+
}, children));
|
|
103
124
|
/**
|
|
104
125
|
* __Valid message__
|
|
105
126
|
*
|
|
@@ -112,10 +133,7 @@ export const ValidMessage = ({
|
|
|
112
133
|
children,
|
|
113
134
|
testId
|
|
114
135
|
}) => jsx(FieldId.Consumer, null, fieldId => jsx(Message, {
|
|
136
|
+
appearance: "valid",
|
|
115
137
|
fieldId: fieldId ? `${fieldId}-valid` : undefined,
|
|
116
|
-
testId: testId
|
|
117
|
-
|
|
118
|
-
}, jsx(IconWrapper, null, jsx(SuccessIcon, {
|
|
119
|
-
size: "small",
|
|
120
|
-
label: "success"
|
|
121
|
-
})), children));
|
|
138
|
+
testId: testId
|
|
139
|
+
}, children));
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/fieldset.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { subtleHeading } from '@atlaskit/theme/colors';
|
|
3
4
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
4
5
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
5
6
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -13,19 +14,30 @@ var fieldsetLabelStyles = css({
|
|
|
13
14
|
});
|
|
14
15
|
var fieldSetStyles = css({
|
|
15
16
|
marginTop: "".concat(gridSize, "px")
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* TODO: Address duplication with packages/design-system/form/src/label.tsx
|
|
20
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var getFieldsetLabelDynamicStyles = function getFieldsetLabelDynamicStyles(mode) {
|
|
24
|
+
return css([h200({
|
|
25
|
+
theme: {
|
|
26
|
+
mode: mode
|
|
27
|
+
}
|
|
28
|
+
}), {
|
|
29
|
+
color: "var(--ds-text-subtle, ".concat(subtleHeading({
|
|
30
|
+
theme: {
|
|
31
|
+
mode: mode
|
|
32
|
+
}
|
|
33
|
+
}), ")")
|
|
34
|
+
}]);
|
|
35
|
+
}; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var lightH200Styles = getFieldsetLabelDynamicStyles('light'); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
39
|
+
|
|
40
|
+
var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
29
41
|
|
|
30
42
|
var FieldsetLabel = function FieldsetLabel(_ref) {
|
|
31
43
|
var children = _ref.children;
|
package/dist/esm/label.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { subtleHeading } from '@atlaskit/theme/colors';
|
|
3
4
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
4
5
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
5
6
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -10,19 +11,30 @@ var labelStyles = css({
|
|
|
10
11
|
marginTop: 0,
|
|
11
12
|
marginBottom: gridSize / 2,
|
|
12
13
|
fontFamily: fontFamily
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* TODO: Address duplication with packages/design-system/form/src/fieldset.tsx
|
|
17
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
var getFieldsetLabelDynamicStyles = function getFieldsetLabelDynamicStyles(mode) {
|
|
21
|
+
return css([h200({
|
|
22
|
+
theme: {
|
|
23
|
+
mode: mode
|
|
24
|
+
}
|
|
25
|
+
}), {
|
|
26
|
+
color: "var(--ds-text-subtle, ".concat(subtleHeading({
|
|
27
|
+
theme: {
|
|
28
|
+
mode: mode
|
|
29
|
+
}
|
|
30
|
+
}), ")")
|
|
31
|
+
}]);
|
|
32
|
+
}; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var lightH200Styles = getFieldsetLabelDynamicStyles('light'); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
36
|
+
|
|
37
|
+
var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
26
38
|
/**
|
|
27
39
|
* __Label__
|
|
28
40
|
*
|
package/dist/esm/messages.js
CHANGED
|
@@ -22,15 +22,6 @@ var darkH200Styles = css(h200({
|
|
|
22
22
|
mode: 'dark'
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
|
-
var messageErrorColorStyles = css({
|
|
26
|
-
color: "var(--ds-text-danger, #AE2A19)"
|
|
27
|
-
});
|
|
28
|
-
var messageNeutralColorStyles = css({
|
|
29
|
-
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
30
|
-
});
|
|
31
|
-
var messageValidColorStyles = css({
|
|
32
|
-
color: "var(--ds-text-success, #216E4E)"
|
|
33
|
-
});
|
|
34
25
|
var messageStyles = css({
|
|
35
26
|
display: 'flex',
|
|
36
27
|
marginTop: "".concat(gridSize * 0.5, "px"),
|
|
@@ -38,6 +29,17 @@ var messageStyles = css({
|
|
|
38
29
|
fontFamily: "".concat(fontFamily),
|
|
39
30
|
fontWeight: 'normal'
|
|
40
31
|
});
|
|
32
|
+
var messageAppearanceStyles = {
|
|
33
|
+
default: css({
|
|
34
|
+
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
35
|
+
}),
|
|
36
|
+
error: css({
|
|
37
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
38
|
+
}),
|
|
39
|
+
valid: css({
|
|
40
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
41
|
+
})
|
|
42
|
+
};
|
|
41
43
|
var iconWrapperStyles = css({
|
|
42
44
|
display: 'flex'
|
|
43
45
|
});
|
|
@@ -49,23 +51,44 @@ var IconWrapper = function IconWrapper(_ref) {
|
|
|
49
51
|
}, children);
|
|
50
52
|
};
|
|
51
53
|
|
|
54
|
+
var messageIcons = {
|
|
55
|
+
error: jsx(ErrorIcon, {
|
|
56
|
+
size: "small",
|
|
57
|
+
label: "error"
|
|
58
|
+
}),
|
|
59
|
+
valid: jsx(SuccessIcon, {
|
|
60
|
+
size: "small",
|
|
61
|
+
label: "success"
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
|
|
52
65
|
var Message = function Message(_ref2) {
|
|
53
66
|
var children = _ref2.children,
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
_ref2$appearance = _ref2.appearance,
|
|
68
|
+
appearance = _ref2$appearance === void 0 ? 'default' : _ref2$appearance,
|
|
56
69
|
fieldId = _ref2.fieldId,
|
|
57
70
|
testId = _ref2.testId;
|
|
58
71
|
|
|
59
72
|
var _useGlobalTheme = useGlobalTheme(),
|
|
60
73
|
mode = _useGlobalTheme.mode;
|
|
61
74
|
|
|
75
|
+
var icon = messageIcons[appearance];
|
|
76
|
+
/**
|
|
77
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
78
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
79
|
+
* between children.
|
|
80
|
+
*
|
|
81
|
+
* If the child is just a string, this is not required and we can use one
|
|
82
|
+
* less DOM element.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
var content = typeof children === 'string' ? children : jsx("span", null, children);
|
|
62
86
|
return jsx("div", {
|
|
63
|
-
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles,
|
|
87
|
+
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
64
88
|
"data-testid": testId,
|
|
65
89
|
id: fieldId
|
|
66
|
-
},
|
|
90
|
+
}, icon && jsx(IconWrapper, null, icon), content);
|
|
67
91
|
};
|
|
68
|
-
|
|
69
92
|
/**
|
|
70
93
|
* __Helper message__
|
|
71
94
|
*
|
|
@@ -73,6 +96,8 @@ var Message = function Message(_ref2) {
|
|
|
73
96
|
* 'Password should be more than 4 characters'
|
|
74
97
|
*
|
|
75
98
|
*/
|
|
99
|
+
|
|
100
|
+
|
|
76
101
|
export var HelperMessage = function HelperMessage(_ref3) {
|
|
77
102
|
var children = _ref3.children,
|
|
78
103
|
testId = _ref3.testId;
|
|
@@ -96,13 +121,10 @@ export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
|
96
121
|
testId = _ref4.testId;
|
|
97
122
|
return jsx(FieldId.Consumer, null, function (fieldId) {
|
|
98
123
|
return jsx(Message, {
|
|
99
|
-
|
|
124
|
+
appearance: "error",
|
|
100
125
|
fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
|
|
101
126
|
testId: testId
|
|
102
|
-
},
|
|
103
|
-
size: "small",
|
|
104
|
-
label: "error"
|
|
105
|
-
})), children);
|
|
127
|
+
}, children);
|
|
106
128
|
});
|
|
107
129
|
};
|
|
108
130
|
/**
|
|
@@ -118,12 +140,9 @@ export var ValidMessage = function ValidMessage(_ref5) {
|
|
|
118
140
|
testId = _ref5.testId;
|
|
119
141
|
return jsx(FieldId.Consumer, null, function (fieldId) {
|
|
120
142
|
return jsx(Message, {
|
|
143
|
+
appearance: "valid",
|
|
121
144
|
fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
|
|
122
|
-
testId: testId
|
|
123
|
-
|
|
124
|
-
}, jsx(IconWrapper, null, jsx(SuccessIcon, {
|
|
125
|
-
size: "small",
|
|
126
|
-
label: "success"
|
|
127
|
-
})), children);
|
|
145
|
+
testId: testId
|
|
146
|
+
}, children);
|
|
128
147
|
});
|
|
129
148
|
};
|
package/dist/esm/version.json
CHANGED
package/dist/types/messages.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
|
|
3
|
+
declare type MessageAppearance = 'default' | 'error' | 'valid';
|
|
4
|
+
/**
|
|
5
|
+
* API for the internal `<Message />` component. This is not public API.
|
|
6
|
+
*/
|
|
7
|
+
interface InternalMessageProps {
|
|
4
8
|
/**
|
|
5
9
|
* The content of the message
|
|
6
10
|
*/
|
|
@@ -12,15 +16,15 @@ interface MessageProps {
|
|
|
12
16
|
*/
|
|
13
17
|
testId?: string;
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
error?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Checks whether message input is valid.
|
|
19
|
+
* Determines the appearance of the message.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
appearance?: MessageAppearance;
|
|
22
22
|
fieldId?: string;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Public API of the various message components.
|
|
26
|
+
*/
|
|
27
|
+
declare type MessageProps = Pick<InternalMessageProps, 'children' | 'testId'>;
|
|
24
28
|
/**
|
|
25
29
|
* __Helper message__
|
|
26
30
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/form",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.3",
|
|
4
4
|
"description": "A form allows users to input information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -62,11 +62,12 @@
|
|
|
62
62
|
"@atlaskit/dropdown-menu": "^11.5.0",
|
|
63
63
|
"@atlaskit/droplist": "^11.0.0",
|
|
64
64
|
"@atlaskit/ds-lib": "^2.1.1",
|
|
65
|
+
"@atlaskit/lozenge": "^11.2.4",
|
|
65
66
|
"@atlaskit/modal-dialog": "^12.4.0",
|
|
66
67
|
"@atlaskit/radio": "^5.4.0",
|
|
67
68
|
"@atlaskit/range": "^7.0.0",
|
|
68
69
|
"@atlaskit/section-message": "^6.3.0",
|
|
69
|
-
"@atlaskit/select": "^16.
|
|
70
|
+
"@atlaskit/select": "^16.1.0",
|
|
70
71
|
"@atlaskit/ssr": "*",
|
|
71
72
|
"@atlaskit/textarea": "^4.5.0",
|
|
72
73
|
"@atlaskit/textfield": "^5.3.0",
|
package/report.api.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- API Report Version: 2.
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/form"
|
|
4
4
|
|
|
@@ -199,6 +199,15 @@ interface FormSectionProps {
|
|
|
199
199
|
// @public
|
|
200
200
|
export const HelperMessage: React_2.FC<MessageProps>;
|
|
201
201
|
|
|
202
|
+
// @public
|
|
203
|
+
interface InternalMessageProps {
|
|
204
|
+
appearance?: MessageAppearance;
|
|
205
|
+
children: ReactNode;
|
|
206
|
+
// (undocumented)
|
|
207
|
+
fieldId?: string;
|
|
208
|
+
testId?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
202
211
|
// @public
|
|
203
212
|
export const Label: FC<LabelProps>;
|
|
204
213
|
|
|
@@ -211,14 +220,10 @@ export interface LabelProps {
|
|
|
211
220
|
}
|
|
212
221
|
|
|
213
222
|
// @public (undocumented)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
fieldId?: string;
|
|
219
|
-
testId?: string;
|
|
220
|
-
valid?: boolean;
|
|
221
|
-
}
|
|
223
|
+
type MessageAppearance = 'default' | 'error' | 'valid';
|
|
224
|
+
|
|
225
|
+
// @public
|
|
226
|
+
type MessageProps = Pick<InternalMessageProps, 'children' | 'testId'>;
|
|
222
227
|
|
|
223
228
|
// @public (undocumented)
|
|
224
229
|
interface Meta {
|