@atlaskit/form 8.8.2 → 8.8.4
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 +21 -0
- package/dist/cjs/checkbox-field.js +15 -29
- package/dist/cjs/entry-points/checkbox-field.js +0 -2
- package/dist/cjs/entry-points/field.js +0 -2
- package/dist/cjs/entry-points/fieldset.js +0 -2
- package/dist/cjs/entry-points/form-footer.js +0 -2
- package/dist/cjs/entry-points/form-header.js +0 -2
- package/dist/cjs/entry-points/form-section.js +0 -2
- package/dist/cjs/entry-points/form.js +0 -2
- package/dist/cjs/entry-points/label.js +0 -2
- package/dist/cjs/entry-points/messages.js +0 -1
- package/dist/cjs/entry-points/range-field.js +0 -2
- package/dist/cjs/field.js +49 -85
- package/dist/cjs/fieldset.js +27 -23
- package/dist/cjs/form-footer.js +4 -6
- package/dist/cjs/form-header.js +9 -23
- package/dist/cjs/form-section.js +9 -21
- package/dist/cjs/form.js +40 -63
- package/dist/cjs/index.js +0 -11
- package/dist/cjs/label.js +29 -23
- package/dist/cjs/messages.js +54 -55
- package/dist/cjs/range-field.js +8 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/checkbox-field.js +6 -5
- package/dist/es2019/field.js +16 -31
- package/dist/es2019/fieldset.js +21 -12
- package/dist/es2019/form-footer.js +2 -1
- package/dist/es2019/form-header.js +6 -10
- package/dist/es2019/form-section.js +5 -9
- package/dist/es2019/form.js +4 -11
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/label.js +22 -11
- package/dist/es2019/messages.js +47 -31
- package/dist/es2019/range-field.js +2 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/checkbox-field.js +15 -22
- package/dist/esm/field.js +49 -73
- package/dist/esm/fieldset.js +27 -18
- package/dist/esm/form-footer.js +4 -3
- package/dist/esm/form-header.js +9 -15
- package/dist/esm/form-section.js +8 -14
- package/dist/esm/form.js +40 -53
- package/dist/esm/index.js +2 -1
- package/dist/esm/label.js +29 -18
- package/dist/esm/messages.js +53 -38
- package/dist/esm/range-field.js +8 -15
- package/dist/esm/version.json +1 -1
- package/dist/types/messages.d.ts +11 -7
- package/package.json +5 -4
- package/report.api.md +27 -9
package/dist/esm/form.js
CHANGED
|
@@ -3,7 +3,6 @@ import React, { createContext, useCallback, useEffect, useMemo, useRef, useState
|
|
|
3
3
|
import { createForm } from 'final-form';
|
|
4
4
|
import createDecorator from 'final-form-focus';
|
|
5
5
|
import set from 'lodash/set';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* __Form context__
|
|
9
8
|
*
|
|
@@ -17,67 +16,62 @@ export var FormContext = /*#__PURE__*/createContext({
|
|
|
17
16
|
return undefined;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
19
|
+
|
|
20
20
|
/**
|
|
21
21
|
* __Is disabled context__
|
|
22
22
|
*
|
|
23
23
|
* An is disabled context creates the context for when a value is disabled.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
25
|
export var IsDisabledContext = /*#__PURE__*/createContext(false);
|
|
27
26
|
export default function Form(props) {
|
|
28
27
|
var formRef = useRef(null);
|
|
29
28
|
var onSubmitRef = useRef(props.onSubmit);
|
|
30
29
|
onSubmitRef.current = props.onSubmit;
|
|
31
|
-
|
|
32
30
|
var _useState = useState(function () {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
// Types here would break the existing API
|
|
32
|
+
var finalForm = createForm({
|
|
33
|
+
onSubmit: function onSubmit() {
|
|
34
|
+
return onSubmitRef.current.apply(onSubmitRef, arguments);
|
|
35
|
+
},
|
|
36
|
+
destroyOnUnregister: true,
|
|
37
|
+
initialValues: {},
|
|
38
|
+
mutators: {
|
|
39
|
+
setDefaultValue: function setDefaultValue(_ref, state) {
|
|
40
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
43
41
|
name = _ref2[0],
|
|
44
42
|
defaultValue = _ref2[1];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
set(values, name, _value);
|
|
56
|
-
/* eslint-enable */
|
|
43
|
+
if (state.formState.initialValues) {
|
|
44
|
+
var _initialValues = state.formState.initialValues;
|
|
45
|
+
var values = state.formState.values;
|
|
46
|
+
var _value = name && typeof defaultValue === 'function' ? defaultValue(_initialValues[name]) : defaultValue;
|
|
47
|
+
|
|
48
|
+
/* eslint-disable no-param-reassign */
|
|
49
|
+
set(_initialValues, name, _value);
|
|
50
|
+
set(values, name, _value);
|
|
51
|
+
/* eslint-enable */
|
|
52
|
+
}
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
createDecorator(function () {
|
|
62
|
-
return formRef.current ? Array.from(formRef.current.querySelectorAll('input')) : [];
|
|
63
|
-
})(finalForm);
|
|
64
|
-
return finalForm;
|
|
65
|
-
}),
|
|
66
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
67
|
-
form = _useState2[0];
|
|
55
|
+
});
|
|
68
56
|
|
|
57
|
+
createDecorator(function () {
|
|
58
|
+
return formRef.current ? Array.from(formRef.current.querySelectorAll('input')) : [];
|
|
59
|
+
})(finalForm);
|
|
60
|
+
return finalForm;
|
|
61
|
+
}),
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
63
|
+
form = _useState2[0];
|
|
69
64
|
var _useState3 = useState({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
dirty: false,
|
|
66
|
+
submitting: false
|
|
67
|
+
}),
|
|
68
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
69
|
+
state = _useState4[0],
|
|
70
|
+
setState = _useState4[1];
|
|
77
71
|
useEffect(function () {
|
|
78
72
|
var unsubscribe = form.subscribe(function (_ref3) {
|
|
79
73
|
var dirty = _ref3.dirty,
|
|
80
|
-
|
|
74
|
+
submitting = _ref3.submitting;
|
|
81
75
|
setState({
|
|
82
76
|
dirty: dirty,
|
|
83
77
|
submitting: submitting
|
|
@@ -95,41 +89,34 @@ export default function Form(props) {
|
|
|
95
89
|
form.resumeValidation();
|
|
96
90
|
return unsubscribe;
|
|
97
91
|
}, [form]);
|
|
98
|
-
|
|
99
92
|
var handleSubmit = function handleSubmit(e) {
|
|
100
93
|
if (e) {
|
|
101
94
|
e.preventDefault();
|
|
102
95
|
}
|
|
103
|
-
|
|
104
96
|
form.submit();
|
|
105
97
|
};
|
|
106
|
-
|
|
107
98
|
var handleReset = function handleReset(initialValues) {
|
|
108
99
|
form.reset(initialValues);
|
|
109
100
|
};
|
|
110
|
-
|
|
111
101
|
var handleKeyDown = function handleKeyDown(e) {
|
|
112
102
|
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey) && formRef.current) {
|
|
113
103
|
var submitButton = formRef.current.querySelector('button:not([type]), button[type="submit"], input[type="submit"]');
|
|
114
|
-
|
|
115
104
|
if (submitButton) {
|
|
116
105
|
submitButton.click();
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
e.preventDefault();
|
|
120
108
|
}
|
|
121
109
|
};
|
|
122
|
-
|
|
123
110
|
var _props$isDisabled = props.isDisabled,
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
|
112
|
+
children = props.children;
|
|
126
113
|
var dirty = state.dirty,
|
|
127
|
-
|
|
114
|
+
submitting = state.submitting;
|
|
115
|
+
|
|
128
116
|
/**
|
|
129
117
|
* This method is needed in FormContext to use it on the field level
|
|
130
118
|
* to check the current value of the field in case of the component re-mounting.
|
|
131
119
|
*/
|
|
132
|
-
|
|
133
120
|
var getCurrentValue = useCallback(function (name) {
|
|
134
121
|
var formState = form.getState();
|
|
135
122
|
return (formState === null || formState === void 0 ? void 0 : formState.values[name]) || undefined;
|
package/dist/esm/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { default as CheckboxField } from './checkbox-field';
|
|
|
7
7
|
export { default as RangeField } from './range-field';
|
|
8
8
|
export { default as Label } from './label';
|
|
9
9
|
export { HelperMessage, ErrorMessage, ValidMessage } from './messages';
|
|
10
|
-
export { default as Fieldset } from './fieldset';
|
|
10
|
+
export { default as Fieldset } from './fieldset';
|
|
11
|
+
// eslint-disable-next-line import/no-unresolved
|
package/dist/esm/label.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { subtleHeading } from '@atlaskit/theme/colors';
|
|
3
5
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
4
6
|
import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
5
7
|
import { h200 } from '@atlaskit/theme/typography';
|
|
@@ -10,19 +12,32 @@ var labelStyles = css({
|
|
|
10
12
|
marginTop: 0,
|
|
11
13
|
marginBottom: gridSize / 2,
|
|
12
14
|
fontFamily: fontFamily
|
|
13
|
-
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* TODO: Address duplication with packages/design-system/form/src/fieldset.tsx
|
|
19
|
+
* in https://product-fabric.atlassian.net/browse/DSP-7731
|
|
20
|
+
*/
|
|
21
|
+
var getFieldsetLabelDynamicStyles = function getFieldsetLabelDynamicStyles(mode) {
|
|
22
|
+
return css([h200({
|
|
23
|
+
theme: {
|
|
24
|
+
mode: mode
|
|
25
|
+
}
|
|
26
|
+
}), {
|
|
27
|
+
color: "var(--ds-text-subtle, ".concat(subtleHeading({
|
|
28
|
+
theme: {
|
|
29
|
+
mode: mode
|
|
30
|
+
}
|
|
31
|
+
}), ")")
|
|
32
|
+
}]);
|
|
33
|
+
};
|
|
14
34
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
36
|
+
var lightH200Styles = getFieldsetLabelDynamicStyles('light');
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
39
|
+
var darkH200Styles = getFieldsetLabelDynamicStyles('dark');
|
|
20
40
|
|
|
21
|
-
var darkH200Styles = css(h200({
|
|
22
|
-
theme: {
|
|
23
|
-
mode: 'dark'
|
|
24
|
-
}
|
|
25
|
-
}));
|
|
26
41
|
/**
|
|
27
42
|
* __Label__
|
|
28
43
|
*
|
|
@@ -31,20 +46,16 @@ var darkH200Styles = css(h200({
|
|
|
31
46
|
* It's recommended that a label has a `4px` spacing above its associated
|
|
32
47
|
* control element.
|
|
33
48
|
*/
|
|
34
|
-
|
|
35
49
|
var Label = function Label(_ref) {
|
|
36
50
|
var children = _ref.children,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
htmlFor = _ref.htmlFor,
|
|
52
|
+
id = _ref.id;
|
|
40
53
|
var _useGlobalTheme = useGlobalTheme(),
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
mode = _useGlobalTheme.mode;
|
|
43
55
|
return jsx("label", {
|
|
44
56
|
css: [mode === 'light' ? lightH200Styles : darkH200Styles, labelStyles],
|
|
45
57
|
id: id,
|
|
46
58
|
htmlFor: htmlFor
|
|
47
59
|
}, children);
|
|
48
60
|
};
|
|
49
|
-
|
|
50
61
|
export default Label;
|
package/dist/esm/messages.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { css, jsx } from '@emotion/react';
|
|
4
5
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
@@ -9,28 +10,20 @@ import { fontFamily as getFontFamily, gridSize as getGridSize } from '@atlaskit/
|
|
|
9
10
|
import { h200 } from '@atlaskit/theme/typography';
|
|
10
11
|
import { FieldId } from './field';
|
|
11
12
|
var gridSize = getGridSize();
|
|
12
|
-
var fontFamily = getFontFamily();
|
|
13
|
+
var fontFamily = getFontFamily();
|
|
13
14
|
|
|
15
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
14
16
|
var lightH200Styles = css(h200({
|
|
15
17
|
theme: {
|
|
16
18
|
mode: 'light'
|
|
17
19
|
}
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
+
}));
|
|
21
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
20
22
|
var darkH200Styles = css(h200({
|
|
21
23
|
theme: {
|
|
22
24
|
mode: 'dark'
|
|
23
25
|
}
|
|
24
26
|
}));
|
|
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
27
|
var messageStyles = css({
|
|
35
28
|
display: 'flex',
|
|
36
29
|
marginTop: "".concat(gridSize * 0.5, "px"),
|
|
@@ -38,32 +31,60 @@ var messageStyles = css({
|
|
|
38
31
|
fontFamily: "".concat(fontFamily),
|
|
39
32
|
fontWeight: 'normal'
|
|
40
33
|
});
|
|
34
|
+
var messageAppearanceStyles = {
|
|
35
|
+
default: css({
|
|
36
|
+
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
37
|
+
}),
|
|
38
|
+
error: css({
|
|
39
|
+
color: "var(--ds-text-danger, #AE2A19)"
|
|
40
|
+
}),
|
|
41
|
+
valid: css({
|
|
42
|
+
color: "var(--ds-text-success, #216E4E)"
|
|
43
|
+
})
|
|
44
|
+
};
|
|
41
45
|
var iconWrapperStyles = css({
|
|
42
46
|
display: 'flex'
|
|
43
47
|
});
|
|
44
|
-
|
|
45
48
|
var IconWrapper = function IconWrapper(_ref) {
|
|
46
49
|
var children = _ref.children;
|
|
47
50
|
return jsx("span", {
|
|
48
51
|
css: iconWrapperStyles
|
|
49
52
|
}, children);
|
|
50
53
|
};
|
|
51
|
-
|
|
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
|
+
};
|
|
52
64
|
var Message = function Message(_ref2) {
|
|
53
65
|
var children = _ref2.children,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
_ref2$appearance = _ref2.appearance,
|
|
67
|
+
appearance = _ref2$appearance === void 0 ? 'default' : _ref2$appearance,
|
|
68
|
+
fieldId = _ref2.fieldId,
|
|
69
|
+
testId = _ref2.testId;
|
|
59
70
|
var _useGlobalTheme = useGlobalTheme(),
|
|
60
|
-
|
|
71
|
+
mode = _useGlobalTheme.mode;
|
|
72
|
+
var icon = messageIcons[appearance];
|
|
61
73
|
|
|
74
|
+
/**
|
|
75
|
+
* The wrapping span is necessary to preserve spaces between children.
|
|
76
|
+
* Otherwise the flex layout of the message will remove any whitespace
|
|
77
|
+
* between children.
|
|
78
|
+
*
|
|
79
|
+
* If the child is just a string, this is not required and we can use one
|
|
80
|
+
* less DOM element.
|
|
81
|
+
*/
|
|
82
|
+
var content = typeof children === 'string' ? children : jsx("span", null, children);
|
|
62
83
|
return jsx("div", {
|
|
63
|
-
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles,
|
|
84
|
+
css: [mode === 'light' ? lightH200Styles : darkH200Styles, messageStyles, messageAppearanceStyles[appearance]],
|
|
64
85
|
"data-testid": testId,
|
|
65
86
|
id: fieldId
|
|
66
|
-
},
|
|
87
|
+
}, icon && jsx(IconWrapper, null, icon), content);
|
|
67
88
|
};
|
|
68
89
|
|
|
69
90
|
/**
|
|
@@ -75,7 +96,7 @@ var Message = function Message(_ref2) {
|
|
|
75
96
|
*/
|
|
76
97
|
export var HelperMessage = function HelperMessage(_ref3) {
|
|
77
98
|
var children = _ref3.children,
|
|
78
|
-
|
|
99
|
+
testId = _ref3.testId;
|
|
79
100
|
return jsx(FieldId.Consumer, null, function (fieldId) {
|
|
80
101
|
return jsx(Message, {
|
|
81
102
|
fieldId: fieldId ? "".concat(fieldId, "-helper") : undefined,
|
|
@@ -83,6 +104,7 @@ export var HelperMessage = function HelperMessage(_ref3) {
|
|
|
83
104
|
}, children);
|
|
84
105
|
});
|
|
85
106
|
};
|
|
107
|
+
|
|
86
108
|
/**
|
|
87
109
|
* __Error message__
|
|
88
110
|
*
|
|
@@ -90,21 +112,18 @@ export var HelperMessage = function HelperMessage(_ref3) {
|
|
|
90
112
|
* 'Invalid username, needs to be more than 4 characters'.
|
|
91
113
|
*
|
|
92
114
|
*/
|
|
93
|
-
|
|
94
115
|
export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
95
116
|
var children = _ref4.children,
|
|
96
|
-
|
|
117
|
+
testId = _ref4.testId;
|
|
97
118
|
return jsx(FieldId.Consumer, null, function (fieldId) {
|
|
98
119
|
return jsx(Message, {
|
|
99
|
-
|
|
120
|
+
appearance: "error",
|
|
100
121
|
fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
|
|
101
122
|
testId: testId
|
|
102
|
-
},
|
|
103
|
-
size: "small",
|
|
104
|
-
label: "error"
|
|
105
|
-
})), children);
|
|
123
|
+
}, children);
|
|
106
124
|
});
|
|
107
125
|
};
|
|
126
|
+
|
|
108
127
|
/**
|
|
109
128
|
* __Valid message__
|
|
110
129
|
*
|
|
@@ -112,18 +131,14 @@ export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
|
112
131
|
* a helper message could be 'Nice one, this username is available'.
|
|
113
132
|
*
|
|
114
133
|
*/
|
|
115
|
-
|
|
116
134
|
export var ValidMessage = function ValidMessage(_ref5) {
|
|
117
135
|
var children = _ref5.children,
|
|
118
|
-
|
|
136
|
+
testId = _ref5.testId;
|
|
119
137
|
return jsx(FieldId.Consumer, null, function (fieldId) {
|
|
120
138
|
return jsx(Message, {
|
|
139
|
+
appearance: "valid",
|
|
121
140
|
fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
|
|
122
|
-
testId: testId
|
|
123
|
-
|
|
124
|
-
}, jsx(IconWrapper, null, jsx(SuccessIcon, {
|
|
125
|
-
size: "small",
|
|
126
|
-
label: "success"
|
|
127
|
-
})), children);
|
|
141
|
+
testId: testId
|
|
142
|
+
}, children);
|
|
128
143
|
});
|
|
129
144
|
};
|
package/dist/esm/range-field.js
CHANGED
|
@@ -2,16 +2,12 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["children"],
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
_excluded2 = ["isInvalid", "isRequired"],
|
|
6
|
+
_excluded3 = ["fieldProps"];
|
|
8
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
|
|
12
9
|
import React from 'react';
|
|
13
10
|
import Field from './field';
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* __Range field__
|
|
17
13
|
*
|
|
@@ -23,9 +19,8 @@ import Field from './field';
|
|
|
23
19
|
*/
|
|
24
20
|
var RangeField = function RangeField(props) {
|
|
25
21
|
var children = props.children,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
strippedProps = _objectWithoutProperties(props, _excluded);
|
|
23
|
+
// isInvalid and isRequired are specifically invalid for range inputs
|
|
29
24
|
return (
|
|
30
25
|
/*#__PURE__*/
|
|
31
26
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -33,16 +28,14 @@ var RangeField = function RangeField(props) {
|
|
|
33
28
|
transform: Number
|
|
34
29
|
}), function (_ref) {
|
|
35
30
|
var _ref$fieldProps = _ref.fieldProps,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
isInvalid = _ref$fieldProps.isInvalid,
|
|
32
|
+
isRequired = _ref$fieldProps.isRequired,
|
|
33
|
+
fieldProps = _objectWithoutProperties(_ref$fieldProps, _excluded2),
|
|
34
|
+
rest = _objectWithoutProperties(_ref, _excluded3);
|
|
41
35
|
return children(_objectSpread({
|
|
42
36
|
fieldProps: fieldProps
|
|
43
37
|
}, rest));
|
|
44
38
|
})
|
|
45
39
|
);
|
|
46
40
|
};
|
|
47
|
-
|
|
48
41
|
export default RangeField;
|
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.4",
|
|
4
4
|
"description": "A form allows users to input information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/icon": "^21.11.0",
|
|
43
43
|
"@atlaskit/theme": "^12.2.0",
|
|
44
|
-
"@atlaskit/tokens": "^0.
|
|
44
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"@emotion/react": "^11.7.1",
|
|
47
47
|
"final-form": "^4.20.1",
|
|
@@ -55,18 +55,19 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@atlaskit/button": "^16.5.0",
|
|
58
|
-
"@atlaskit/calendar": "^
|
|
58
|
+
"@atlaskit/calendar": "^13.0.0",
|
|
59
59
|
"@atlaskit/checkbox": "^12.4.0",
|
|
60
60
|
"@atlaskit/datetime-picker": "^12.3.0",
|
|
61
61
|
"@atlaskit/docs": "^9.0.0",
|
|
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
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
### Table of contents
|
|
9
9
|
|
|
10
10
|
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
11
12
|
|
|
12
13
|
### Main Entry Types
|
|
13
14
|
|
|
@@ -199,6 +200,15 @@ interface FormSectionProps {
|
|
|
199
200
|
// @public
|
|
200
201
|
export const HelperMessage: React_2.FC<MessageProps>;
|
|
201
202
|
|
|
203
|
+
// @public
|
|
204
|
+
interface InternalMessageProps {
|
|
205
|
+
appearance?: MessageAppearance;
|
|
206
|
+
children: ReactNode;
|
|
207
|
+
// (undocumented)
|
|
208
|
+
fieldId?: string;
|
|
209
|
+
testId?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
202
212
|
// @public
|
|
203
213
|
export const Label: FC<LabelProps>;
|
|
204
214
|
|
|
@@ -211,14 +221,10 @@ export interface LabelProps {
|
|
|
211
221
|
}
|
|
212
222
|
|
|
213
223
|
// @public (undocumented)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
fieldId?: string;
|
|
219
|
-
testId?: string;
|
|
220
|
-
valid?: boolean;
|
|
221
|
-
}
|
|
224
|
+
type MessageAppearance = 'default' | 'error' | 'valid';
|
|
225
|
+
|
|
226
|
+
// @public
|
|
227
|
+
type MessageProps = Pick<InternalMessageProps, 'children' | 'testId'>;
|
|
222
228
|
|
|
223
229
|
// @public (undocumented)
|
|
224
230
|
interface Meta {
|
|
@@ -283,3 +289,15 @@ export const ValidMessage: React_2.FC<MessageProps>;
|
|
|
283
289
|
```
|
|
284
290
|
|
|
285
291
|
<!--SECTION END: Main Entry Types-->
|
|
292
|
+
|
|
293
|
+
### Peer Dependencies
|
|
294
|
+
|
|
295
|
+
<!--SECTION START: Peer Dependencies-->
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"react": "^16.8.0"
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
<!--SECTION END: Peer Dependencies-->
|