@atlaskit/form 8.4.0 → 8.4.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/form
2
2
 
3
+ ## 8.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 8.4.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`2cf338dd802`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2cf338dd802) - Added homepage to package.json
14
+
15
+ ## 8.4.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [`34282240102`](https://bitbucket.org/atlassian/atlassian-frontend/commits/34282240102) - Adds explicit type to button usages components.
20
+
21
+ ## 8.4.1
22
+
23
+ ### Patch Changes
24
+
25
+ - [`b9b3ab10494`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b9b3ab10494) - There was a bug in 8.4.0 where the props in FormSection were not recognized. This has now been fixed.
26
+
3
27
  ## 8.4.0
4
28
 
5
29
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.4.0",
3
+ "version": "8.4.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.4.0",
3
+ "version": "8.4.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.4.0",
3
+ "version": "8.4.4",
4
4
  "sideEffects": false
5
5
  }
@@ -4,17 +4,38 @@ export interface CheckboxFieldProps extends FieldProps<string | undefined> {
4
4
  isChecked: boolean;
5
5
  }
6
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
+ */
7
10
  children: (args: {
8
11
  fieldProps: CheckboxFieldProps;
9
12
  error?: string;
10
13
  valid: boolean;
11
14
  meta: Meta;
12
15
  }) => ReactNode;
16
+ /**
17
+ * Sets the default state of the checkbox as checked.
18
+ */
13
19
  defaultIsChecked?: boolean;
20
+ /**
21
+ * Sets whether the field is required for submission. Required fields are marked with a red asterisk.
22
+ */
14
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
+ */
15
27
  isDisabled?: boolean;
28
+ /**
29
+ * Label displayed beside the checkbox.
30
+ */
16
31
  label?: ReactNode;
32
+ /**
33
+ * Specifies the name of the field. This is important for referencing the form data.
34
+ */
17
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
+ */
18
39
  value?: string;
19
40
  }
20
41
  /**
@@ -25,20 +25,47 @@ export interface Meta {
25
25
  submitError?: boolean;
26
26
  validating?: boolean;
27
27
  }
28
- interface FieldComponentProps<FieldValue, Element extends SupportedElements> {
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
+ */
29
32
  children: (args: {
30
33
  fieldProps: FieldProps<FieldValue, Element>;
31
34
  error?: string;
32
35
  valid: boolean;
33
36
  meta: Meta;
34
37
  }) => React.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
+ */
35
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
+ */
36
45
  id?: string;
46
+ /**
47
+ * Sets whether the field is required for submission. Required fields are marked with a red asterisk.
48
+ */
37
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
+ */
38
53
  isDisabled?: boolean;
54
+ /**
55
+ * Label displayed above the form field.
56
+ */
39
57
  label?: ReactNode;
58
+ /**
59
+ * Specifies the name of the field. This is important for referencing the form data.
60
+ */
40
61
  name: string;
62
+ /**
63
+ * Access the current field value and transform it to return a different field value.
64
+ */
41
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
+ */
42
69
  validate?: (value: FieldValue | undefined, formState: Object, fieldState: Meta) => string | void | Promise<string | void>;
43
70
  }
44
71
  /**
@@ -1,12 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactNode } from 'react';
3
- interface FieldsetProps {
3
+ export interface FieldsetProps {
4
4
  /**
5
- * Children to be rendered in the fieldset.
5
+ * Content to render in the fieldset.
6
6
  */
7
7
  children: ReactNode;
8
8
  /**
9
- * Legend of the the fieldset.
9
+ * Label describing the contents of the fieldset.
10
10
  */
11
11
  legend?: ReactNode;
12
12
  }
@@ -1,13 +1,13 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactNode } from 'react';
3
3
  import { Align } from './types';
4
- interface FormFooterProps {
4
+ export interface FormFooterProps {
5
5
  /**
6
- * Children to be rendered in the footer.
6
+ * Content to render in the footer of the form.
7
7
  */
8
8
  children?: ReactNode;
9
9
  /**
10
- * Footer contents should be left-aligned in single-page forms, flags, cards and section messages with the primary button on the left.
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
11
  */
12
12
  align?: Align;
13
13
  }
@@ -21,4 +21,3 @@ interface FormFooterProps {
21
21
  * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
22
22
  */
23
23
  export default function FormFooter({ align, children, }: FormFooterProps): JSX.Element;
24
- export {};
@@ -1,16 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { ReactNode } from 'react';
3
- interface FormHeaderProps {
3
+ export interface FormHeaderProps {
4
4
  /**
5
- * Title of form header
5
+ * Title of the form. This is a header.
6
6
  */
7
7
  title?: ReactNode;
8
8
  /**
9
- * Subtitle or description of form header
9
+ * Description or subtitle of the form.
10
10
  */
11
11
  description?: ReactNode;
12
12
  /**
13
- * Child content rendered below the description
13
+ * Child content to render in the form below the title and description.
14
14
  */
15
15
  children?: ReactNode;
16
16
  }
@@ -1,5 +1,19 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
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
+ }
3
17
  /**
4
18
  * __Form section__
5
19
  *
@@ -10,5 +24,5 @@ import React from 'react';
10
24
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
11
25
  * - [Usage](https://atlaskit.atlassian.com/packages/design-system/form/docs/layout)
12
26
  */
13
- declare const FormSection: React.FC;
27
+ declare const FormSection: React.FC<FormSectionProps>;
14
28
  export default FormSection;
@@ -22,8 +22,8 @@ interface FormChildrenProps {
22
22
  }
23
23
  export interface FormProps<FormValues> {
24
24
  /**
25
- * 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,
26
- * submitting and disabled. You can read more about these props here: https://final-form.org/docs/final-form/types/FormState.
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
27
  */
28
28
  children: (args: {
29
29
  formProps: FormChildrenProps;
@@ -43,7 +43,7 @@ export interface FormProps<FormValues> {
43
43
  */
44
44
  onSubmit: OnSubmitHandler<FormValues>;
45
45
  /**
46
- * Sets the form and its fields as not mutable. User cannot edit or focus on the fields.
46
+ * Sets the form and its fields as disabled. Users cannot edit or focus on the fields.
47
47
  */
48
48
  isDisabled?: boolean;
49
49
  }
@@ -7,10 +7,25 @@ export interface RangeFieldProps {
7
7
  error?: string;
8
8
  meta: Meta;
9
9
  }) => React.ReactNode;
10
+ /**
11
+ * Specifies the name of the field. This is important for referencing the form data.
12
+ */
10
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
+ */
11
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
+ */
12
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
+ */
13
25
  isDisabled?: boolean;
26
+ /**
27
+ * Displays a label above the range field and identifies the form fields.
28
+ */
14
29
  label?: ReactNode;
15
30
  }
16
31
  /**
@@ -0,0 +1,5 @@
1
+ import type { FieldComponentProps as Props } from '../src/field';
2
+
3
+ export default function FieldProps(props: Props<any, any>) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { FieldsetProps as Props } from '../src/fieldset';
2
+
3
+ export default function FieldsetProps(props: Props) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { FormFooterProps as Props } from '../src/form-footer';
2
+
3
+ export default function FormFooterProps(props: Props) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { FormHeaderProps as Props } from '../src/form-header';
2
+
3
+ export default function FormHeaderProps(props: Props) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { FormProps } from '../src/form';
2
+
3
+ export default function FormReactProps(props: FormProps<any>) {
4
+ return null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { FormSectionProps as Props } from '../src/form-section';
2
+
3
+ export default function FormSectionProps(props: Props) {
4
+ return null;
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "8.4.0",
4
- "description": "Form package provides layout & validation for form fields",
3
+ "version": "8.4.4",
4
+ "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
@@ -35,10 +35,11 @@
35
35
  "name": "Form"
36
36
  }
37
37
  },
38
+ "homepage": "https://atlassian.design/components/form/",
38
39
  "dependencies": {
39
40
  "@atlaskit/icon": "^21.9.0",
40
41
  "@atlaskit/theme": "^12.0.0",
41
- "@atlaskit/tokens": "^0.2.0",
42
+ "@atlaskit/tokens": "^0.3.0",
42
43
  "@babel/runtime": "^7.0.0",
43
44
  "@emotion/core": "^10.0.9",
44
45
  "final-form": "^4.20.1",
@@ -55,17 +56,15 @@
55
56
  "@atlaskit/button": "^16.1.0",
56
57
  "@atlaskit/calendar": "^12.1.0",
57
58
  "@atlaskit/checkbox": "^12.3.0",
58
- "@atlaskit/datetime-picker": "^11.0.0",
59
+ "@atlaskit/datetime-picker": "^11.1.0",
59
60
  "@atlaskit/docs": "^9.0.0",
60
61
  "@atlaskit/dropdown-menu": "^10.1.0",
61
62
  "@atlaskit/droplist": "^11.0.0",
62
- "@atlaskit/modal-dialog": "^12.0.0",
63
- "@atlaskit/multi-select": "^15.0.0",
63
+ "@atlaskit/modal-dialog": "^12.1.0",
64
64
  "@atlaskit/radio": "^5.3.0",
65
- "@atlaskit/range": "^5.0.5",
65
+ "@atlaskit/range": "^5.1.0",
66
66
  "@atlaskit/section-message": "^6.1.0",
67
67
  "@atlaskit/select": "^15.2.0",
68
- "@atlaskit/single-select": "^10.0.0",
69
68
  "@atlaskit/ssr": "*",
70
69
  "@atlaskit/textarea": "^4.2.0",
71
70
  "@atlaskit/textfield": "^5.1.0",
@@ -97,7 +96,7 @@
97
96
  "@repo/internal": {
98
97
  "analytics": "analytics-next",
99
98
  "theming": [
100
- "new-theming-api",
99
+ "react-context",
101
100
  "tokens"
102
101
  ],
103
102
  "styling": "emotion",