@atlaskit/form 11.0.2 → 11.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/field.compiled.css +1 -0
- package/dist/cjs/field.js +23 -14
- package/dist/cjs/fieldset.compiled.css +1 -0
- package/dist/cjs/fieldset.js +11 -14
- package/dist/cjs/form-footer.compiled.css +4 -0
- package/dist/cjs/form-footer.js +11 -18
- package/dist/cjs/form-header.compiled.css +2 -0
- package/dist/cjs/form-header.js +15 -21
- package/dist/cjs/form-section.compiled.css +2 -0
- package/dist/cjs/form-section.js +17 -21
- package/dist/cjs/label.compiled.css +6 -0
- package/dist/cjs/label.js +15 -24
- package/dist/cjs/messages.compiled.css +10 -0
- package/dist/cjs/messages.js +34 -50
- package/dist/cjs/range-field.js +15 -13
- package/dist/cjs/required-asterisk.compiled.css +3 -0
- package/dist/cjs/required-asterisk.js +13 -21
- package/dist/es2019/field.compiled.css +1 -0
- package/dist/es2019/field.js +18 -15
- package/dist/es2019/fieldset.compiled.css +1 -0
- package/dist/es2019/fieldset.js +8 -13
- package/dist/es2019/form-footer.compiled.css +4 -0
- package/dist/es2019/form-footer.js +8 -17
- package/dist/es2019/form-header.compiled.css +2 -0
- package/dist/es2019/form-header.js +12 -20
- package/dist/es2019/form-section.compiled.css +2 -0
- package/dist/es2019/form-section.js +14 -20
- package/dist/es2019/label.compiled.css +6 -0
- package/dist/es2019/label.js +11 -22
- package/dist/es2019/messages.compiled.css +10 -0
- package/dist/es2019/messages.js +27 -48
- package/dist/es2019/range-field.js +21 -24
- package/dist/es2019/required-asterisk.compiled.css +3 -0
- package/dist/es2019/required-asterisk.js +10 -20
- package/dist/esm/field.compiled.css +1 -0
- package/dist/esm/field.js +18 -15
- package/dist/esm/fieldset.compiled.css +1 -0
- package/dist/esm/fieldset.js +8 -13
- package/dist/esm/form-footer.compiled.css +4 -0
- package/dist/esm/form-footer.js +8 -17
- package/dist/esm/form-header.compiled.css +2 -0
- package/dist/esm/form-header.js +12 -20
- package/dist/esm/form-section.compiled.css +2 -0
- package/dist/esm/form-section.js +14 -20
- package/dist/esm/label.compiled.css +6 -0
- package/dist/esm/label.js +11 -22
- package/dist/esm/messages.compiled.css +10 -0
- package/dist/esm/messages.js +29 -48
- package/dist/esm/range-field.js +15 -13
- package/dist/esm/required-asterisk.compiled.css +3 -0
- package/dist/esm/required-asterisk.js +10 -20
- package/dist/types/checkbox-field.d.ts +1 -1
- package/dist/types/field.d.ts +1 -2
- package/dist/types/fieldset.d.ts +2 -3
- package/dist/types/form-footer.d.ts +3 -3
- package/dist/types/form-header.d.ts +2 -3
- package/dist/types/form-section.d.ts +2 -3
- package/dist/types/label.d.ts +0 -1
- package/dist/types/messages.d.ts +4 -14
- package/dist/types/required-asterisk.d.ts +2 -2
- package/dist/types-ts4.5/checkbox-field.d.ts +1 -1
- package/dist/types-ts4.5/field.d.ts +1 -2
- package/dist/types-ts4.5/fieldset.d.ts +2 -3
- package/dist/types-ts4.5/form-footer.d.ts +3 -3
- package/dist/types-ts4.5/form-header.d.ts +2 -3
- package/dist/types-ts4.5/form-section.d.ts +2 -3
- package/dist/types-ts4.5/label.d.ts +0 -1
- package/dist/types-ts4.5/messages.d.ts +4 -14
- package/dist/types-ts4.5/required-asterisk.d.ts +2 -2
- package/package.json +12 -7
- package/__perf__/default.tsx +0 -56
package/dist/esm/field.js
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
+
/* field.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
5
|
+
import "./field.compiled.css";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
8
|
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
9
|
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
|
-
/**
|
|
7
|
-
* @jsxRuntime classic
|
|
8
|
-
* @jsx jsx
|
|
9
|
-
*/
|
|
10
10
|
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
|
-
import { css, jsx } from '@emotion/react';
|
|
14
11
|
import invariant from 'tiny-invariant';
|
|
15
12
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
16
13
|
import { FieldId } from './field-id-context';
|
|
17
14
|
import { FormContext, IsDisabledContext } from './form';
|
|
18
15
|
import { Label } from './label';
|
|
19
16
|
import RequiredAsterisk from './required-asterisk';
|
|
20
|
-
var fieldWrapperStyles =
|
|
21
|
-
marginBlockStart: "var(--ds-space-100, 8px)"
|
|
22
|
-
});
|
|
17
|
+
var fieldWrapperStyles = null;
|
|
23
18
|
function isEvent(event) {
|
|
24
19
|
return Boolean(event && event.target);
|
|
25
20
|
}
|
|
26
21
|
function isFunction(x) {
|
|
27
22
|
return typeof x === 'function';
|
|
28
23
|
}
|
|
24
|
+
|
|
25
|
+
// Must be exported to satisfy error TS4023 from Jira builds
|
|
26
|
+
// src/packages/servicedesk/virtual-agent/common/src/ui/base-text-field/index.tsx(10,14):
|
|
27
|
+
// error TS4023: Exported variable `BaseTextField` has or is using name
|
|
28
|
+
// `FieldComponentProps` from external module
|
|
29
|
+
// `/opt/atlassian/pipelines/agent/build/jira/tsDist/@atlaskit__form/app/src/field`
|
|
30
|
+
// but cannot be named.
|
|
31
|
+
|
|
29
32
|
function usePreviousRef(current) {
|
|
30
33
|
var ref = useRef(current);
|
|
31
34
|
|
|
@@ -240,14 +243,14 @@ export default function Field(props) {
|
|
|
240
243
|
'aria-labelledby': "".concat(fieldId, "-label"),
|
|
241
244
|
id: fieldId
|
|
242
245
|
});
|
|
243
|
-
return
|
|
244
|
-
|
|
245
|
-
"
|
|
246
|
-
}, props.label &&
|
|
246
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
247
|
+
"data-testid": props.testId,
|
|
248
|
+
className: ax(["_1pfhu2gc"])
|
|
249
|
+
}, props.label && /*#__PURE__*/React.createElement(Label, {
|
|
247
250
|
htmlFor: fieldId,
|
|
248
251
|
id: "".concat(fieldId, "-label"),
|
|
249
252
|
testId: props.testId && "".concat(props.testId, "--label")
|
|
250
|
-
}, props.label, props.isRequired &&
|
|
253
|
+
}, props.label, props.isRequired && /*#__PURE__*/React.createElement(RequiredAsterisk, null), props.elementAfterLabel), /*#__PURE__*/React.createElement(FieldId.Provider, {
|
|
251
254
|
value: fieldId
|
|
252
255
|
}, props.children({
|
|
253
256
|
fieldProps: extendedFieldProps,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._1pfhu2gc{margin-block-start:var(--ds-space-100,8px)}
|
package/dist/esm/fieldset.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
/* fieldset.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./fieldset.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
5
|
import { Legend } from './label';
|
|
9
|
-
var fieldSetStyles =
|
|
10
|
-
marginBlockStart: "var(--ds-space-100, 8px)"
|
|
11
|
-
});
|
|
6
|
+
var fieldSetStyles = null;
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
9
|
* __Fieldset__
|
|
@@ -23,8 +18,8 @@ var fieldSetStyles = css({
|
|
|
23
18
|
var Fieldset = function Fieldset(_ref) {
|
|
24
19
|
var children = _ref.children,
|
|
25
20
|
legend = _ref.legend;
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
}, legend &&
|
|
21
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
22
|
+
className: ax(["_1pfhu2gc"])
|
|
23
|
+
}, legend && /*#__PURE__*/React.createElement(Legend, null, legend), children);
|
|
29
24
|
};
|
|
30
25
|
export default Fieldset;
|
package/dist/esm/form-footer.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { css, jsx } from '@emotion/react';
|
|
8
|
-
var formFooterWrapperStyles = css({
|
|
9
|
-
display: 'flex',
|
|
10
|
-
justifyContent: 'flex-end',
|
|
11
|
-
marginBlockStart: "var(--ds-space-300, 24px)"
|
|
12
|
-
});
|
|
13
|
-
var justifyContentStyles = css({
|
|
14
|
-
justifyContent: 'flex-start'
|
|
15
|
-
});
|
|
1
|
+
/* form-footer.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./form-footer.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
var formFooterWrapperStyles = null;
|
|
6
|
+
var justifyContentStyles = null;
|
|
16
7
|
|
|
17
8
|
/**
|
|
18
9
|
* __Form footer__
|
|
@@ -27,7 +18,7 @@ export default function FormFooter(_ref) {
|
|
|
27
18
|
var _ref$align = _ref.align,
|
|
28
19
|
align = _ref$align === void 0 ? 'end' : _ref$align,
|
|
29
20
|
children = _ref.children;
|
|
30
|
-
return
|
|
31
|
-
|
|
21
|
+
return /*#__PURE__*/React.createElement("footer", {
|
|
22
|
+
className: ax(["_1e0c1txw _1bahesu3 _1pfh1ejb", align === 'start' && "_1bah1y6m"])
|
|
32
23
|
}, children);
|
|
33
24
|
}
|
package/dist/esm/form-header.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/* form-header.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
/* eslint-disable @atlaskit/design-system/use-primitives */
|
|
3
|
+
import "./form-header.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
6
|
import Heading from '@atlaskit/heading';
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
minWidth: '100%',
|
|
12
|
-
marginBlockStart: 'space.100'
|
|
13
|
-
});
|
|
14
|
-
var formHeaderDescriptionStyles = xcss({
|
|
15
|
-
marginBlockStart: 'space.100'
|
|
16
|
-
});
|
|
7
|
+
var formHeaderContentStyles = null;
|
|
8
|
+
var formHeaderDescriptionStyles = null;
|
|
17
9
|
|
|
18
10
|
/**
|
|
19
11
|
* __Form header__.
|
|
@@ -29,12 +21,12 @@ var FormHeader = function FormHeader(_ref) {
|
|
|
29
21
|
var children = _ref.children,
|
|
30
22
|
description = _ref.description,
|
|
31
23
|
title = _ref.title;
|
|
32
|
-
return
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", null, title && /*#__PURE__*/React.createElement(Heading, {
|
|
33
25
|
size: "large"
|
|
34
|
-
}, title), description &&
|
|
35
|
-
|
|
36
|
-
}, description), children &&
|
|
37
|
-
|
|
26
|
+
}, title), description && /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: ax(["_1pfhu2gc"])
|
|
28
|
+
}, description), children && /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: ax(["_1ul91osq _1pfhu2gc"])
|
|
38
30
|
}, children));
|
|
39
31
|
};
|
|
40
32
|
export default FormHeader;
|
package/dist/esm/form-section.js
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/* form-section.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./form-section.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
5
|
import Heading from '@atlaskit/heading';
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
marginBlockStart: 'space.100'
|
|
12
|
-
});
|
|
13
|
-
var formSectionWrapperStyles = xcss({
|
|
14
|
-
marginBlockStart: 'space.300'
|
|
15
|
-
});
|
|
6
|
+
var formSectionDescriptionStyles = null;
|
|
7
|
+
var formSectionWrapperStyles = null;
|
|
16
8
|
var FormSectionWrapper = function FormSectionWrapper(_ref) {
|
|
17
9
|
var children = _ref.children;
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: ax(["_1pfh1ejb"])
|
|
20
13
|
}, children);
|
|
21
14
|
};
|
|
22
15
|
var FormSectionDescription = function FormSectionDescription(_ref2) {
|
|
23
16
|
var children = _ref2.children;
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: ax(["_1pfhu2gc"])
|
|
26
20
|
}, children);
|
|
27
21
|
};
|
|
28
22
|
|
|
@@ -40,8 +34,8 @@ var FormSection = function FormSection(_ref3) {
|
|
|
40
34
|
var children = _ref3.children,
|
|
41
35
|
description = _ref3.description,
|
|
42
36
|
title = _ref3.title;
|
|
43
|
-
return
|
|
37
|
+
return /*#__PURE__*/React.createElement(FormSectionWrapper, null, title && /*#__PURE__*/React.createElement(Heading, {
|
|
44
38
|
size: "medium"
|
|
45
|
-
}, title), description &&
|
|
39
|
+
}, title), description && /*#__PURE__*/React.createElement(FormSectionDescription, null, description), children);
|
|
46
40
|
};
|
|
47
41
|
export default FormSection;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._11c8qk37{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._1e0c1o8l{display:inline-block}
|
|
3
|
+
._1pfhze3t{margin-block-start:var(--ds-space-0,0)}
|
|
4
|
+
._6rth1b66{margin-block-end:var(--ds-space-050,4px)}
|
|
5
|
+
._k48pmoej{font-weight:var(--ds-font-weight-bold,700)}
|
|
6
|
+
._syaz1gjq{color:var(--ds-text-subtle,#44546f)}
|
package/dist/esm/label.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { css, jsx } from '@emotion/react';
|
|
8
|
-
var fieldsetLabelStyles = css({
|
|
9
|
-
display: 'inline-block',
|
|
10
|
-
color: "var(--ds-text-subtle, #44546F)",
|
|
11
|
-
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
12
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
13
|
-
marginBlockEnd: "var(--ds-space-050, 4px)",
|
|
14
|
-
marginBlockStart: "var(--ds-space-0, 0px)"
|
|
15
|
-
});
|
|
1
|
+
/* label.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./label.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
var fieldsetLabelStyles = null;
|
|
16
6
|
|
|
17
7
|
/**
|
|
18
8
|
* __Label__
|
|
@@ -27,11 +17,11 @@ export var Label = function Label(_ref) {
|
|
|
27
17
|
htmlFor = _ref.htmlFor,
|
|
28
18
|
id = _ref.id,
|
|
29
19
|
testId = _ref.testId;
|
|
30
|
-
return
|
|
31
|
-
css: fieldsetLabelStyles,
|
|
20
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
32
21
|
id: id,
|
|
33
22
|
htmlFor: htmlFor,
|
|
34
|
-
"data-testid": testId
|
|
23
|
+
"data-testid": testId,
|
|
24
|
+
className: ax(["_11c8qk37 _1e0c1o8l _syaz1gjq _k48pmoej _6rth1b66 _1pfhze3t"])
|
|
35
25
|
}, children);
|
|
36
26
|
};
|
|
37
27
|
|
|
@@ -42,8 +32,7 @@ export var Label = function Label(_ref) {
|
|
|
42
32
|
*/
|
|
43
33
|
export var Legend = function Legend(_ref2) {
|
|
44
34
|
var children = _ref2.children;
|
|
45
|
-
return
|
|
46
|
-
|
|
35
|
+
return /*#__PURE__*/React.createElement("legend", {
|
|
36
|
+
className: ax(["_11c8qk37 _1e0c1o8l _syaz1gjq _k48pmoej _6rth1b66 _1pfhze3t"])
|
|
47
37
|
}, children);
|
|
48
|
-
};
|
|
49
|
-
export default Label;
|
|
38
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
._11c8qk37{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,system-ui,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._zulp12x7{gap:var(--ds-space-075,6px)}
|
|
3
|
+
._1bah1q9y{justify-content:baseline}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
5
|
+
._1pfh1b66{margin-block-start:var(--ds-space-050,4px)}
|
|
6
|
+
._4cvr1h6o{align-items:center}
|
|
7
|
+
._4t3i7vkz{height:1pc}
|
|
8
|
+
._syaz1wmz{color:var(--ds-text-subtlest,#6b778c)}
|
|
9
|
+
._syaze6sf{color:var(--ds-text-danger,#ae2a19)}
|
|
10
|
+
._syazy73q{color:var(--ds-text-success,#216e4e)}
|
package/dist/esm/messages.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
+
/* messages.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
|
|
3
|
+
import "./messages.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
6
|
import { createContext, useContext, useEffect, useRef, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
-
import { css, jsx } from '@emotion/react';
|
|
11
7
|
import ErrorIcon from '@atlaskit/icon/utility/migration/error';
|
|
12
8
|
import SuccessIcon from '@atlaskit/icon/utility/migration/success--editor-success';
|
|
13
|
-
import { N200 } from '@atlaskit/theme/colors';
|
|
14
9
|
import { FieldId } from './field-id-context';
|
|
15
10
|
|
|
16
11
|
/**
|
|
@@ -21,43 +16,29 @@ import { FieldId } from './field-id-context';
|
|
|
21
16
|
* Public API of the various message components.
|
|
22
17
|
*/
|
|
23
18
|
|
|
24
|
-
var messageStyles =
|
|
25
|
-
display: 'flex',
|
|
26
|
-
justifyContent: 'baseline',
|
|
27
|
-
gap: "var(--ds-space-075, 6px)",
|
|
28
|
-
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
29
|
-
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
30
|
-
});
|
|
19
|
+
var messageStyles = null;
|
|
31
20
|
var messageAppearanceStyles = {
|
|
32
|
-
default:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
valid: css({
|
|
39
|
-
color: "var(--ds-text-success, #216E4E)"
|
|
40
|
-
})
|
|
21
|
+
default: "_syaz1wmz",
|
|
22
|
+
error: "_syaze6sf",
|
|
23
|
+
valid: "_syazy73q"
|
|
24
|
+
};
|
|
25
|
+
var iconWrapperStyles = {
|
|
26
|
+
root: "_1e0c1txw _4t3i7vkz _4cvr1h6o"
|
|
41
27
|
};
|
|
42
|
-
var iconWrapperStyles = css({
|
|
43
|
-
display: 'flex',
|
|
44
|
-
height: '16px',
|
|
45
|
-
alignItems: 'center'
|
|
46
|
-
});
|
|
47
28
|
var IconWrapper = function IconWrapper(_ref) {
|
|
48
29
|
var children = _ref.children;
|
|
49
|
-
return
|
|
50
|
-
|
|
30
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
31
|
+
className: ax([iconWrapperStyles.root])
|
|
51
32
|
}, children);
|
|
52
33
|
};
|
|
53
34
|
var messageIcons = {
|
|
54
|
-
error:
|
|
35
|
+
error: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
55
36
|
LEGACY_margin: "0 -2px 0 0",
|
|
56
37
|
color: "currentColor",
|
|
57
38
|
LEGACY_size: "small",
|
|
58
39
|
label: "error"
|
|
59
40
|
}),
|
|
60
|
-
valid:
|
|
41
|
+
valid: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
61
42
|
LEGACY_margin: "0 -2px 0 0",
|
|
62
43
|
color: "currentColor",
|
|
63
44
|
LEGACY_size: "small",
|
|
@@ -92,16 +73,16 @@ var Message = function Message(_ref2) {
|
|
|
92
73
|
* If the child is just a string, this is not required and we can use one
|
|
93
74
|
* less DOM element.
|
|
94
75
|
*/
|
|
95
|
-
var content = typeof children === 'string' ? children :
|
|
96
|
-
return
|
|
97
|
-
css: [messageStyles, messageAppearanceStyles[appearance]],
|
|
76
|
+
var content = typeof children === 'string' ? children : /*#__PURE__*/React.createElement("span", null, children);
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
78
|
"data-testid": testId,
|
|
99
79
|
id: fieldId,
|
|
100
80
|
ref: messageRef
|
|
101
81
|
// For backwards compatability, if there is a wrapper, aria-live is not needed
|
|
102
82
|
,
|
|
103
|
-
"aria-live": !hasMessageWrapper ? 'polite' : undefined
|
|
104
|
-
|
|
83
|
+
"aria-live": !hasMessageWrapper ? 'polite' : undefined,
|
|
84
|
+
className: ax(["_zulp12x7 _11c8qk37 _1e0c1txw _1bah1q9y _1pfh1b66", messageAppearanceStyles[appearance]])
|
|
85
|
+
}, icon && /*#__PURE__*/React.createElement(IconWrapper, null, icon), content);
|
|
105
86
|
};
|
|
106
87
|
|
|
107
88
|
/**
|
|
@@ -114,8 +95,8 @@ var Message = function Message(_ref2) {
|
|
|
114
95
|
export var HelperMessage = function HelperMessage(_ref3) {
|
|
115
96
|
var children = _ref3.children,
|
|
116
97
|
testId = _ref3.testId;
|
|
117
|
-
return
|
|
118
|
-
return
|
|
98
|
+
return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) {
|
|
99
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
119
100
|
fieldId: fieldId ? "".concat(fieldId, "-helper") : undefined,
|
|
120
101
|
testId: testId
|
|
121
102
|
}, children);
|
|
@@ -132,8 +113,8 @@ export var HelperMessage = function HelperMessage(_ref3) {
|
|
|
132
113
|
export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
133
114
|
var children = _ref4.children,
|
|
134
115
|
testId = _ref4.testId;
|
|
135
|
-
return
|
|
136
|
-
return
|
|
116
|
+
return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) {
|
|
117
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
137
118
|
appearance: "error",
|
|
138
119
|
fieldId: fieldId ? "".concat(fieldId, "-error") : undefined,
|
|
139
120
|
testId: testId
|
|
@@ -151,8 +132,8 @@ export var ErrorMessage = function ErrorMessage(_ref4) {
|
|
|
151
132
|
export var ValidMessage = function ValidMessage(_ref5) {
|
|
152
133
|
var children = _ref5.children,
|
|
153
134
|
testId = _ref5.testId;
|
|
154
|
-
return
|
|
155
|
-
return
|
|
135
|
+
return /*#__PURE__*/React.createElement(FieldId.Consumer, null, function (fieldId) {
|
|
136
|
+
return /*#__PURE__*/React.createElement(Message, {
|
|
156
137
|
appearance: "valid",
|
|
157
138
|
fieldId: fieldId ? "".concat(fieldId, "-valid") : undefined,
|
|
158
139
|
testId: testId
|
|
@@ -166,7 +147,7 @@ export var ValidMessage = function ValidMessage(_ref5) {
|
|
|
166
147
|
* A message wrapper context allows the children to check
|
|
167
148
|
* if it is contained within the MessageWrapper.
|
|
168
149
|
*/
|
|
169
|
-
|
|
150
|
+
var MessageWrapperContext = /*#__PURE__*/createContext({
|
|
170
151
|
isWrapper: false
|
|
171
152
|
});
|
|
172
153
|
|
|
@@ -184,9 +165,9 @@ export var MessageWrapper = function MessageWrapper(_ref6) {
|
|
|
184
165
|
var contextValue = {
|
|
185
166
|
isWrapper: true
|
|
186
167
|
};
|
|
187
|
-
return
|
|
168
|
+
return /*#__PURE__*/React.createElement(MessageWrapperContext.Provider, {
|
|
188
169
|
value: contextValue
|
|
189
|
-
},
|
|
170
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
190
171
|
"aria-live": "polite",
|
|
191
172
|
"data-testid": "message-wrapper"
|
|
192
173
|
}, children));
|
package/dist/esm/range-field.js
CHANGED
|
@@ -17,24 +17,26 @@ import Field from './field';
|
|
|
17
17
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
|
|
18
18
|
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
|
|
19
19
|
*/
|
|
20
|
-
var RangeField = function RangeField(
|
|
21
|
-
var children =
|
|
22
|
-
strippedProps = _objectWithoutProperties(
|
|
23
|
-
// isInvalid and isRequired are specifically invalid for range inputs
|
|
20
|
+
var RangeField = function RangeField(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
strippedProps = _objectWithoutProperties(_ref, _excluded);
|
|
24
23
|
return (
|
|
25
24
|
/*#__PURE__*/
|
|
26
25
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
27
26
|
React.createElement(Field, _extends({}, strippedProps, {
|
|
28
27
|
transform: Number
|
|
29
|
-
}), function (
|
|
30
|
-
var
|
|
31
|
-
isInvalid =
|
|
32
|
-
isRequired =
|
|
33
|
-
fieldProps = _objectWithoutProperties(
|
|
34
|
-
rest = _objectWithoutProperties(
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
}), function (_ref2) {
|
|
29
|
+
var _ref2$fieldProps = _ref2.fieldProps,
|
|
30
|
+
isInvalid = _ref2$fieldProps.isInvalid,
|
|
31
|
+
isRequired = _ref2$fieldProps.isRequired,
|
|
32
|
+
fieldProps = _objectWithoutProperties(_ref2$fieldProps, _excluded2),
|
|
33
|
+
rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
34
|
+
return (
|
|
35
|
+
// isInvalid and isRequired are specifically invalid for range inputs
|
|
36
|
+
children(_objectSpread({
|
|
37
|
+
fieldProps: fieldProps
|
|
38
|
+
}, rest))
|
|
39
|
+
);
|
|
38
40
|
})
|
|
39
41
|
);
|
|
40
42
|
};
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { css, jsx } from '@emotion/react';
|
|
7
|
-
import { R400 } from '@atlaskit/theme/colors';
|
|
8
|
-
var requiredIndicatorStyles = css({
|
|
9
|
-
color: "var(--ds-text-danger, ".concat(R400, ")"),
|
|
10
|
-
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
11
|
-
paddingInlineStart: "var(--ds-space-025, 2px)"
|
|
12
|
-
});
|
|
1
|
+
/* required-asterisk.tsx generated by @compiled/babel-plugin v0.36.0 */
|
|
2
|
+
import "./required-asterisk.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
var requiredIndicatorStyles = null;
|
|
13
6
|
export default function RequiredAsterisk() {
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
title: "required"
|
|
20
|
-
}, "*")
|
|
21
|
-
);
|
|
7
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
8
|
+
"aria-hidden": "true",
|
|
9
|
+
title: "required",
|
|
10
|
+
className: ax(["_syaz1ick _ect41sbm _bozgv77o"])
|
|
11
|
+
}, "*");
|
|
22
12
|
}
|
|
@@ -3,7 +3,7 @@ import { type FieldProps, type Meta } from './field';
|
|
|
3
3
|
export interface CheckboxFieldProps extends FieldProps<string | undefined> {
|
|
4
4
|
isChecked: boolean;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface CheckboxProps {
|
|
7
7
|
/**
|
|
8
8
|
* Content to render in the checkbox field. This is a function that is called with information about the field.
|
|
9
9
|
*/
|
package/dist/types/field.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type FormEvent, type ReactNode } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
6
|
type SupportedElements = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
8
7
|
export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
|
|
9
8
|
id: string;
|
|
@@ -81,5 +80,5 @@ export interface FieldComponentProps<FieldValue, Element extends SupportedElemen
|
|
|
81
80
|
*/
|
|
82
81
|
testId?: string;
|
|
83
82
|
}
|
|
84
|
-
export default function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>):
|
|
83
|
+
export default function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>): JSX.Element;
|
|
85
84
|
export {};
|
package/dist/types/fieldset.d.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
export interface FieldsetProps {
|
|
6
|
+
interface FieldsetProps {
|
|
8
7
|
/**
|
|
9
8
|
* Content to render in the fieldset.
|
|
10
9
|
*/
|
|
@@ -24,5 +23,5 @@ export interface FieldsetProps {
|
|
|
24
23
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
|
|
25
24
|
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
|
|
26
25
|
*/
|
|
27
|
-
declare const Fieldset: ({ children, legend }: FieldsetProps) =>
|
|
26
|
+
declare const Fieldset: ({ children, legend }: FieldsetProps) => JSX.Element;
|
|
28
27
|
export default Fieldset;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
6
|
import { type Align } from './types';
|
|
8
|
-
|
|
7
|
+
interface FormFooterProps {
|
|
9
8
|
/**
|
|
10
9
|
* Content to render in the footer of the form.
|
|
11
10
|
*/
|
|
@@ -24,4 +23,5 @@ export interface FormFooterProps {
|
|
|
24
23
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
25
24
|
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
26
25
|
*/
|
|
27
|
-
export default function FormFooter({ align, children }: FormFooterProps):
|
|
26
|
+
export default function FormFooter({ align, children }: FormFooterProps): JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
export interface FormHeaderProps {
|
|
6
|
+
interface FormHeaderProps {
|
|
8
7
|
/**
|
|
9
8
|
* Title of the form. This is a header.
|
|
10
9
|
*/
|
|
@@ -28,5 +27,5 @@ export interface FormHeaderProps {
|
|
|
28
27
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
29
28
|
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout).
|
|
30
29
|
*/
|
|
31
|
-
declare const FormHeader: ({ children, description, title }: FormHeaderProps) =>
|
|
30
|
+
declare const FormHeader: ({ children, description, title }: FormHeaderProps) => JSX.Element;
|
|
32
31
|
export default FormHeader;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import { type ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
export interface FormSectionProps {
|
|
6
|
+
interface FormSectionProps {
|
|
8
7
|
/**
|
|
9
8
|
* Title of the form section.
|
|
10
9
|
*/
|
|
@@ -28,5 +27,5 @@ export interface FormSectionProps {
|
|
|
28
27
|
* - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
|
|
29
28
|
* - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout).
|
|
30
29
|
*/
|
|
31
|
-
declare const FormSection: ({ children, description, title }: FormSectionProps) =>
|
|
30
|
+
declare const FormSection: ({ children, description, title }: FormSectionProps) => JSX.Element;
|
|
32
31
|
export default FormSection;
|