@atlaskit/form 8.5.7 → 8.5.9

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CheckboxField/package.json +8 -1
  3. package/Field/package.json +8 -1
  4. package/Fieldset/package.json +8 -1
  5. package/Form/package.json +8 -1
  6. package/FormFooter/package.json +8 -1
  7. package/FormHeader/package.json +8 -1
  8. package/FormSection/package.json +8 -1
  9. package/Label/package.json +8 -1
  10. package/Messages/package.json +8 -1
  11. package/RangeField/package.json +8 -1
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/version.json +1 -1
  15. package/dist/types-ts4.0/checkbox-field.d.ts +51 -0
  16. package/dist/types-ts4.0/entry-points/checkbox-field.d.ts +2 -0
  17. package/dist/types-ts4.0/entry-points/field.d.ts +2 -0
  18. package/dist/types-ts4.0/entry-points/fieldset.d.ts +1 -0
  19. package/dist/types-ts4.0/entry-points/form-footer.d.ts +1 -0
  20. package/dist/types-ts4.0/entry-points/form-header.d.ts +1 -0
  21. package/dist/types-ts4.0/entry-points/form-section.d.ts +1 -0
  22. package/dist/types-ts4.0/entry-points/form.d.ts +1 -0
  23. package/dist/types-ts4.0/entry-points/label.d.ts +2 -0
  24. package/dist/types-ts4.0/entry-points/messages.d.ts +1 -0
  25. package/dist/types-ts4.0/entry-points/range-field.d.ts +2 -0
  26. package/dist/types-ts4.0/field.d.ts +78 -0
  27. package/dist/types-ts4.0/fieldset.d.ts +24 -0
  28. package/dist/types-ts4.0/form-footer.d.ts +23 -0
  29. package/dist/types-ts4.0/form-header.d.ts +32 -0
  30. package/dist/types-ts4.0/form-section.d.ts +28 -0
  31. package/dist/types-ts4.0/form.d.ts +51 -0
  32. package/dist/types-ts4.0/index.d.ts +16 -0
  33. package/dist/types-ts4.0/label.d.ts +16 -0
  34. package/dist/types-ts4.0/messages.d.ts +48 -0
  35. package/dist/types-ts4.0/range-field.d.ts +41 -0
  36. package/dist/types-ts4.0/types.d.ts +4 -0
  37. package/package.json +21 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/form
2
2
 
3
+ ## 8.5.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 8.5.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [`0fbb2840aba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0fbb2840aba) - Add isInvalid prop to `@atlastkit/Select`. The prop indicates whether if the component is in the error state. If true, it visually shows a red border around the input.
14
+
15
+ This replaces validationState to make Select more consistent like other components that uses isInvalid prop.
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 8.5.7
4
20
 
5
21
  ### Patch Changes
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/checkbox-field.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/checkbox-field.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/checkbox-field.d.ts"
7
+ "types": "../dist/types/entry-points/checkbox-field.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/checkbox-field.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/field.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/field.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/field.d.ts"
7
+ "types": "../dist/types/entry-points/field.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/field.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/fieldset.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/fieldset.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/fieldset.d.ts"
7
+ "types": "../dist/types/entry-points/fieldset.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/fieldset.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
package/Form/package.json CHANGED
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/form.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/form.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/form.d.ts"
7
+ "types": "../dist/types/entry-points/form.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/form.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/form-footer.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/form-footer.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/form-footer.d.ts"
7
+ "types": "../dist/types/entry-points/form-footer.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/form-footer.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/form-header.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/form-header.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/form-header.d.ts"
7
+ "types": "../dist/types/entry-points/form-header.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/form-header.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/form-section.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/form-section.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/form-section.d.ts"
7
+ "types": "../dist/types/entry-points/form-section.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/form-section.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/label.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/label.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/label.d.ts"
7
+ "types": "../dist/types/entry-points/label.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/label.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/messages.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/messages.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/messages.d.ts"
7
+ "types": "../dist/types/entry-points/messages.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/messages.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/range-field.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/range-field.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/range-field.d.ts"
7
+ "types": "../dist/types/entry-points/range-field.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/range-field.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.5.7",
3
+ "version": "8.5.9",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.5.7",
3
+ "version": "8.5.9",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.5.7",
3
+ "version": "8.5.9",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,51 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { FieldProps, Meta } from './field';
3
+ export interface CheckboxFieldProps extends FieldProps<string | undefined> {
4
+ isChecked: boolean;
5
+ }
6
+ export interface CheckboxProps {
7
+ /**
8
+ * Content to render in the checkbox field. This is a function that is called with information about the field.
9
+ */
10
+ children: (args: {
11
+ fieldProps: CheckboxFieldProps;
12
+ error?: string;
13
+ valid: boolean;
14
+ meta: Meta;
15
+ }) => ReactNode;
16
+ /**
17
+ * Sets the default state of the checkbox as checked.
18
+ */
19
+ defaultIsChecked?: boolean;
20
+ /**
21
+ * Sets whether the field is required for submission. Required fields are marked with a red asterisk.
22
+ */
23
+ isRequired?: boolean;
24
+ /**
25
+ * Sets whether the field is disabled. Users cannot edit or focus on the fields. If the parent form component is disabled, then the field will always be disabled.
26
+ */
27
+ isDisabled?: boolean;
28
+ /**
29
+ * Label displayed beside the checkbox.
30
+ */
31
+ label?: ReactNode;
32
+ /**
33
+ * Specifies the name of the field. This is important for referencing the form data.
34
+ */
35
+ name: string;
36
+ /**
37
+ * The value of the checkbox. This is the value used in the form state when the checkbox is checked.
38
+ */
39
+ value?: string;
40
+ }
41
+ /**
42
+ * __Checkbox field__
43
+ *
44
+ * A checkbox field is a form field that lets users select an item. Users can check or uncheck the checkbox.
45
+ *
46
+ * - [Examples] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
47
+ * - [Code] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
48
+ * - [Usage] https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#checkboxfield-reference
49
+ */
50
+ declare const CheckboxField: FC<CheckboxProps>;
51
+ export default CheckboxField;
@@ -0,0 +1,2 @@
1
+ export { default as CheckboxField } from '../checkbox-field';
2
+ export type { CheckboxFieldProps } from '../checkbox-field';
@@ -0,0 +1,2 @@
1
+ export { default } from '../field';
2
+ export type { FieldProps, Meta } from '../field';
@@ -0,0 +1 @@
1
+ export { default as Fieldset } from '../fieldset';
@@ -0,0 +1 @@
1
+ export { default as FormFooter } from '../form-footer';
@@ -0,0 +1 @@
1
+ export { default as FormHeader } from '../form-header';
@@ -0,0 +1 @@
1
+ export { default as FormSection } from '../form-section';
@@ -0,0 +1 @@
1
+ export { default } from '../form';
@@ -0,0 +1,2 @@
1
+ export { default as Label } from '../label';
2
+ export type { LabelProps } from '../label';
@@ -0,0 +1 @@
1
+ export { HelperMessage, ErrorMessage, ValidMessage } from '../messages';
@@ -0,0 +1,2 @@
1
+ export { default as RangeField } from '../range-field';
2
+ export type { RangeFieldProps } from '../range-field';
@@ -0,0 +1,78 @@
1
+ /** @jsx jsx */
2
+ import { FormEvent, ReactNode } from 'react';
3
+ declare type SupportedElements = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
4
+ export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
5
+ id: string;
6
+ isRequired: boolean;
7
+ isDisabled: boolean;
8
+ isInvalid: boolean;
9
+ onChange: (value: FormEvent<Element> | FieldValue) => void;
10
+ onBlur: () => void;
11
+ onFocus: () => void;
12
+ value: FieldValue;
13
+ name: string;
14
+ 'aria-invalid': 'true' | 'false';
15
+ 'aria-labelledby': string;
16
+ }
17
+ export interface Meta {
18
+ dirty: boolean;
19
+ dirtySinceLastSubmit: boolean;
20
+ submitFailed: boolean;
21
+ submitting: boolean;
22
+ touched: boolean;
23
+ valid: boolean;
24
+ error?: string;
25
+ submitError?: boolean;
26
+ validating?: boolean;
27
+ }
28
+ export interface FieldComponentProps<FieldValue, Element extends SupportedElements> {
29
+ /**
30
+ * Content to render in the field. This is a function that is called with props for the field component and other information about the field.
31
+ */
32
+ children: (args: {
33
+ fieldProps: FieldProps<FieldValue, Element>;
34
+ error?: string;
35
+ valid: boolean;
36
+ meta: Meta;
37
+ }) => ReactNode;
38
+ /**
39
+ * Sets the default value of the field. If a function is provided, it is called with the current default value of the field.
40
+ */
41
+ defaultValue?: FieldValue | ((currentDefaultValue?: FieldValue) => FieldValue);
42
+ /**
43
+ * Passed to the ID attribute of the field. This is randomly generated if it is not specified.
44
+ */
45
+ id?: string;
46
+ /**
47
+ * Sets whether the field is required for submission. Required fields are marked with a red asterisk.
48
+ */
49
+ isRequired?: boolean;
50
+ /**
51
+ * Sets whether the field is disabled. Users cannot edit or focus on the fields. If the parent form component is disabled, then the field will always be disabled.
52
+ */
53
+ isDisabled?: boolean;
54
+ /**
55
+ * Label displayed above the form field.
56
+ */
57
+ label?: ReactNode;
58
+ /**
59
+ * Specifies the name of the field. This is important for referencing the form data.
60
+ */
61
+ name: string;
62
+ /**
63
+ * Access the current field value and transform it to return a different field value.
64
+ */
65
+ transform?: (event: FormEvent<Element> | FieldValue, current: FieldValue) => FieldValue;
66
+ /**
67
+ * Checks whether the field input is valid. This is usually used to display a message relevant to the current value using `ErrorMessage`, `HelperMessage` or `ValidMessage`.
68
+ */
69
+ validate?: (value: FieldValue | undefined, formState: Object, fieldState: Meta) => string | void | Promise<string | void>;
70
+ }
71
+ /**
72
+ * __Field id__
73
+ *
74
+ * A field id uses the context API. It provides the id of the field to message components. This links the message with the field of screenreaders.
75
+ */
76
+ export declare const FieldId: import("react").Context<string | undefined>;
77
+ export default function Field<FieldValue = string, Element extends SupportedElements = HTMLInputElement>(props: FieldComponentProps<FieldValue, Element>): JSX.Element;
78
+ export {};
@@ -0,0 +1,24 @@
1
+ /** @jsx jsx */
2
+ import { ReactNode } from 'react';
3
+ export interface FieldsetProps {
4
+ /**
5
+ * Content to render in the fieldset.
6
+ */
7
+ children: ReactNode;
8
+ /**
9
+ * Label describing the contents of the fieldset.
10
+ */
11
+ legend?: ReactNode;
12
+ }
13
+ /**
14
+ * __Fieldset__
15
+ *
16
+ * A fieldset groups a number of fields together. For example, when multiple CheckboxFields share the same name,
17
+ * a fieldset can be used to group them together. This makes the form more accessible.
18
+ *
19
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
20
+ * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
21
+ * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields)
22
+ */
23
+ declare const Fieldset: ({ children, legend }: FieldsetProps) => JSX.Element;
24
+ export default Fieldset;
@@ -0,0 +1,23 @@
1
+ /** @jsx jsx */
2
+ import { ReactNode } from 'react';
3
+ import { Align } from './types';
4
+ export interface FormFooterProps {
5
+ /**
6
+ * Content to render in the footer of the form.
7
+ */
8
+ children?: ReactNode;
9
+ /**
10
+ * Sets the alignment of the footer contents. This is often a button. This should be left-aligned in single-page forms, flags, cards, and section messages.
11
+ */
12
+ align?: Align;
13
+ }
14
+ /**
15
+ * __Form footer__
16
+ *
17
+ * A form footer has the content to be shown at the bottom of the form. This is usually the submit button.
18
+ *
19
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
20
+ * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
21
+ * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
22
+ */
23
+ export default function FormFooter({ align, children, }: FormFooterProps): JSX.Element;
@@ -0,0 +1,32 @@
1
+ /** @jsx jsx */
2
+ import { ReactNode } from 'react';
3
+ export interface FormHeaderProps {
4
+ /**
5
+ * Title of the form. This is a header.
6
+ */
7
+ title?: ReactNode;
8
+ /**
9
+ * Description or subtitle of the form.
10
+ */
11
+ description?: ReactNode;
12
+ /**
13
+ * Child content to render in the form below the title and description.
14
+ */
15
+ children?: ReactNode;
16
+ }
17
+ declare const FormHeaderContent: React.FC;
18
+ declare const FormHeaderDescription: React.FC;
19
+ declare const FormHeaderTitle: React.FC;
20
+ /**
21
+ * __Form header__
22
+ *
23
+ * A form header contains the form component's heading and subheadings. This provides the correct padding
24
+ * and styling for it.
25
+ *
26
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
27
+ * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
28
+ * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
29
+ */
30
+ declare const FormHeader: React.FC<FormHeaderProps>;
31
+ export default FormHeader;
32
+ export { FormHeaderContent, FormHeaderDescription, FormHeaderTitle };
@@ -0,0 +1,28 @@
1
+ /** @jsx jsx */
2
+ import React, { ReactNode } from 'react';
3
+ export interface FormSectionProps {
4
+ /**
5
+ * Title of the form section.
6
+ */
7
+ title?: ReactNode;
8
+ /**
9
+ * Content or components to render after the description.
10
+ */
11
+ children?: ReactNode;
12
+ /**
13
+ * Description of the contents of the section.
14
+ */
15
+ description?: ReactNode;
16
+ }
17
+ /**
18
+ * __Form section__
19
+ *
20
+ * A form section is used to define a section of a form layout. This contains a section title, content
21
+ * and a description of the section.
22
+ *
23
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
24
+ * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
25
+ * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
26
+ */
27
+ declare const FormSection: React.FC<FormSectionProps>;
28
+ export default FormSection;
@@ -0,0 +1,51 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { FieldConfig, FieldSubscriber, FieldSubscription, FormState, Unsubscribe } from 'final-form';
3
+ import { OnSubmitHandler } from './types';
4
+ declare type DefaultValue<FieldValue> = (value?: FieldValue) => FieldValue;
5
+ declare type RegisterField = <FieldValue>(name: string, defaultValue: FieldValue | DefaultValue<FieldValue>, subscriber: FieldSubscriber<FieldValue>, subscription: FieldSubscription, config: FieldConfig<FieldValue>) => Unsubscribe;
6
+ /**
7
+ * __Form context__
8
+ *
9
+ * A form context creates a context for the field values and allows them to be accessed by the children.
10
+ */
11
+ export declare const FormContext: React.Context<RegisterField>;
12
+ /**
13
+ * __Is disabled context__
14
+ *
15
+ * An is disabled context creates the context for when a value is disabled.
16
+ */
17
+ export declare const IsDisabledContext: React.Context<boolean>;
18
+ interface FormChildrenProps {
19
+ ref: React.RefObject<HTMLFormElement>;
20
+ onSubmit: (event?: React.FormEvent<HTMLFormElement> | React.SyntheticEvent<HTMLElement>) => void;
21
+ onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
22
+ }
23
+ export interface FormProps<FormValues> {
24
+ /**
25
+ * The contents rendered inside of the form. This is a function where the props will be passed from the form. The function props you can access are `dirty`, `submitting` and `disabled`.
26
+ * You can read more about these props in [react-final form documentation](https://final-form.org/docs/final-form/types/FormState).
27
+ */
28
+ children: (args: {
29
+ formProps: FormChildrenProps;
30
+ disabled: boolean;
31
+ dirty: boolean;
32
+ submitting: boolean;
33
+ getState: () => FormState<FormValues>;
34
+ /**
35
+ * @deprecated
36
+ */
37
+ getValues: () => FormValues;
38
+ setFieldValue: (name: string, value: any) => void;
39
+ reset: (initialValues?: FormValues) => void;
40
+ }) => ReactNode;
41
+ /**
42
+ * Event handler called when the form is submitted. Fields must be free of validation errors.
43
+ */
44
+ onSubmit: OnSubmitHandler<FormValues>;
45
+ /**
46
+ * Sets the form and its fields as disabled. Users cannot edit or focus on the fields.
47
+ */
48
+ isDisabled?: boolean;
49
+ }
50
+ export default function Form<FormValues extends Record<string, any> = {}>(props: FormProps<FormValues>): JSX.Element;
51
+ export {};
@@ -0,0 +1,16 @@
1
+ export { default } from './form';
2
+ export type { FormProps } from './form';
3
+ export { default as FormHeader } from './form-header';
4
+ export { default as FormFooter } from './form-footer';
5
+ export { default as FormSection } from './form-section';
6
+ export { default as Field } from './field';
7
+ export type { FieldProps } from './field';
8
+ export { default as CheckboxField } from './checkbox-field';
9
+ export type { CheckboxFieldProps } from './checkbox-field';
10
+ export { default as RangeField } from './range-field';
11
+ export type { RangeFieldProps } from './range-field';
12
+ export { default as Label } from './label';
13
+ export type { LabelProps } from './label';
14
+ export { HelperMessage, ErrorMessage, ValidMessage } from './messages';
15
+ export { default as Fieldset } from './fieldset';
16
+ export type { OnSubmitHandler, FormApi } from './types';
@@ -0,0 +1,16 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ export interface LabelProps {
4
+ id?: string;
5
+ htmlFor: string;
6
+ }
7
+ /**
8
+ * __Label__
9
+ *
10
+ * A label represents a caption for an item in a user interface.
11
+ *
12
+ * It's recommended that a label has a `4px` spacing above its associated
13
+ * control element.
14
+ */
15
+ declare const Label: FC<LabelProps>;
16
+ export default Label;
@@ -0,0 +1,48 @@
1
+ /** @jsx jsx */
2
+ import React, { ReactNode } from 'react';
3
+ interface MessageProps {
4
+ /**
5
+ * The content of the message
6
+ */
7
+ children: ReactNode;
8
+ /**
9
+ * A testId prop is provided for specified elements, which is a unique string
10
+ * that appears as a data attribute data-testid in the rendered code,
11
+ * serving as a hook for automated tests
12
+ */
13
+ testId?: string;
14
+ /**
15
+ * Checks whether message input is invalid and should show an error.
16
+ */
17
+ error?: boolean;
18
+ /**
19
+ * Checks whether message input is valid.
20
+ */
21
+ valid?: boolean;
22
+ fieldId?: string;
23
+ }
24
+ /**
25
+ * __Helper message__
26
+ *
27
+ * A helper message tells the user what kind of input the field takes. For example, a helper message could be
28
+ * 'Password should be more than 4 characters'
29
+ *
30
+ */
31
+ export declare const HelperMessage: React.FC<MessageProps>;
32
+ /**
33
+ * __Error message__
34
+ *
35
+ * An error message is used to tell a user that the field input is invalid. For example, an error message could be
36
+ * 'Invalid username, needs to be more than 4 characters'.
37
+ *
38
+ */
39
+ export declare const ErrorMessage: React.FC<MessageProps>;
40
+ /**
41
+ * __Valid message__
42
+ *
43
+ * A valid message is used to tell a user that the field input is valid. For example,
44
+ * a helper message could be 'Nice one, this username is available'.
45
+ *
46
+ */
47
+ export declare const ValidMessage: React.FC<MessageProps>;
48
+ export {};
@@ -0,0 +1,41 @@
1
+ import React, { FC, ReactNode } from 'react';
2
+ import { FieldProps, Meta } from './field';
3
+ declare type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
4
+ export interface RangeFieldProps {
5
+ children: (args: {
6
+ fieldProps: RangeProps;
7
+ error?: string;
8
+ meta: Meta;
9
+ }) => React.ReactNode;
10
+ /**
11
+ * Specifies the name of the field. This is important for referencing the form data.
12
+ */
13
+ name: string;
14
+ /**
15
+ * Sets the default value of the field. If a function is provided, it is called with the current default value of the field.
16
+ */
17
+ defaultValue: number | ((currentDefaultValue?: number) => number);
18
+ /**
19
+ * Value passed to the `id` attribute of the field. This is randomly generated if it is not specified.
20
+ */
21
+ id?: string;
22
+ /**
23
+ * Sets whether the field is disabled. Users cannot edit or focus on the fields. If the parent form component is disabled, then the field will always be disabled.
24
+ */
25
+ isDisabled?: boolean;
26
+ /**
27
+ * Displays a label above the range field and identifies the form fields.
28
+ */
29
+ label?: ReactNode;
30
+ }
31
+ /**
32
+ * __Range field__
33
+ *
34
+ * A range field is where a user can submit a range input as a part of a form.
35
+ *
36
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
37
+ * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
38
+ * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/fields#rangefield-reference)
39
+ */
40
+ declare const RangeField: FC<RangeFieldProps>;
41
+ export default RangeField;
@@ -0,0 +1,4 @@
1
+ import { FormApi as FinalFormAPI } from 'final-form';
2
+ export declare type Align = 'start' | 'end';
3
+ export declare type FormApi<FormData> = FinalFormAPI<FormData>;
4
+ export declare type OnSubmitHandler<FormData> = (values: FormData, form: FormApi<FormData>, callback?: (errors?: Record<string, string>) => void) => void | Object | Promise<Object | void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.5.7",
3
+ "version": "8.5.9",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlaskit:designLink": "https://atlassian.design/guidelines/product/patterns/forms",
@@ -39,7 +46,7 @@
39
46
  "homepage": "https://atlassian.design/components/form/",
40
47
  "dependencies": {
41
48
  "@atlaskit/icon": "^21.10.0",
42
- "@atlaskit/theme": "^12.1.0",
49
+ "@atlaskit/theme": "^12.2.0",
43
50
  "@atlaskit/tokens": "^0.10.0",
44
51
  "@babel/runtime": "^7.0.0",
45
52
  "@emotion/core": "^10.0.9",
@@ -54,33 +61,34 @@
54
61
  },
55
62
  "devDependencies": {
56
63
  "@atlaskit/button": "^16.3.0",
57
- "@atlaskit/calendar": "^12.3.0",
64
+ "@atlaskit/calendar": "^12.4.0",
58
65
  "@atlaskit/checkbox": "^12.3.0",
59
- "@atlaskit/datetime-picker": "^12.1.0",
66
+ "@atlaskit/datetime-picker": "^12.2.0",
60
67
  "@atlaskit/docs": "^9.0.0",
61
- "@atlaskit/dropdown-menu": "^11.3.0",
68
+ "@atlaskit/dropdown-menu": "^11.5.0",
62
69
  "@atlaskit/droplist": "^11.0.0",
63
- "@atlaskit/modal-dialog": "^12.2.0",
64
- "@atlaskit/radio": "^5.3.0",
70
+ "@atlaskit/ds-lib": "^2.1.1",
71
+ "@atlaskit/modal-dialog": "^12.3.0",
72
+ "@atlaskit/radio": "^5.4.0",
65
73
  "@atlaskit/range": "^6.0.0",
66
- "@atlaskit/section-message": "^6.1.0",
67
- "@atlaskit/select": "^15.6.0",
74
+ "@atlaskit/section-message": "^6.2.0",
75
+ "@atlaskit/select": "^15.7.0",
68
76
  "@atlaskit/ssr": "*",
69
77
  "@atlaskit/textarea": "^4.3.0",
70
- "@atlaskit/textfield": "^5.1.0",
71
- "@atlaskit/toggle": "^12.4.0",
78
+ "@atlaskit/textfield": "^5.2.0",
79
+ "@atlaskit/toggle": "^12.5.0",
72
80
  "@atlaskit/tooltip": "^17.5.0",
73
81
  "@atlaskit/visual-regression": "*",
74
82
  "@atlaskit/webdriver-runner": "*",
75
83
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
76
- "@testing-library/react": "^8.0.1",
84
+ "@testing-library/react": "^12.1.5",
77
85
  "@types/final-form-focus": "^1.1.1",
78
86
  "enzyme": "^3.10.0",
79
87
  "react-dom": "^16.8.0",
80
88
  "react-router": "^4.2.0",
81
89
  "react-router-dom": "^4.2.2",
82
90
  "react-test-renderer": "^16.8.0",
83
- "typescript": "4.3.5",
91
+ "typescript": "4.5.5",
84
92
  "validator": "^9.4.1",
85
93
  "wait-for-expect": "^1.2.0"
86
94
  },