@atlaskit/form 10.2.0 → 10.3.0

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.
@@ -9,10 +9,15 @@ import Form, { ErrorMessage, Field, FormFooter, HelperMessage } from '../src';
9
9
  export default () => (
10
10
  <div
11
11
  style={{
12
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
12
13
  display: 'flex',
14
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
13
15
  width: '400px',
16
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
14
17
  maxWidth: '100%',
18
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
15
19
  margin: '0 auto',
20
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
16
21
  flexDirection: 'column',
17
22
  }}
18
23
  >
package/dist/cjs/label.js CHANGED
@@ -5,16 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.Legend = exports.Label = void 0;
7
7
  var _react = require("@emotion/react");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var _colors = require("@atlaskit/theme/colors");
9
10
  /** @jsx jsx */
10
11
 
11
12
  var fieldsetLabelStyles = (0, _react.css)({
12
13
  display: 'inline-block',
13
- color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
14
14
  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)",
15
- fontWeight: "var(--ds-font-weight-semibold, 600)",
16
15
  marginBlockEnd: "var(--ds-space-050, 4px)",
17
- marginBlockStart: 0
16
+ marginBlockStart: "var(--ds-space-0, 0px)"
17
+ });
18
+ var oldFieldsetLabelStyles = (0, _react.css)({
19
+ color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
20
+ fontWeight: "var(--ds-font-weight-semibold, 600)"
21
+ });
22
+ var newFieldsetLabelStyles = (0, _react.css)({
23
+ color: "var(--ds-text-subtle, #44546F)",
24
+ fontWeight: "var(--ds-font-weight-bold, 700)"
18
25
  });
19
26
 
20
27
  /**
@@ -22,7 +29,7 @@ var fieldsetLabelStyles = (0, _react.css)({
22
29
  *
23
30
  * A label represents a caption for an item in a user interface.
24
31
  *
25
- * It's recommended that a label has a `4px` spacing above its associated
32
+ * It's recommended that a label has a `space.050` spacing above its associated
26
33
  * control element.
27
34
  */
28
35
  var Label = exports.Label = function Label(_ref) {
@@ -31,7 +38,7 @@ var Label = exports.Label = function Label(_ref) {
31
38
  id = _ref.id,
32
39
  testId = _ref.testId;
33
40
  return (0, _react.jsx)("label", {
34
- css: fieldsetLabelStyles,
41
+ css: [fieldsetLabelStyles, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.form-label-typography-updates') ? newFieldsetLabelStyles : oldFieldsetLabelStyles],
35
42
  id: id,
36
43
  htmlFor: htmlFor,
37
44
  "data-testid": testId
@@ -46,7 +53,7 @@ var Label = exports.Label = function Label(_ref) {
46
53
  var Legend = exports.Legend = function Legend(_ref2) {
47
54
  var children = _ref2.children;
48
55
  return (0, _react.jsx)("legend", {
49
- css: fieldsetLabelStyles
56
+ css: [fieldsetLabelStyles, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.form-label-typography-updates') ? newFieldsetLabelStyles : oldFieldsetLabelStyles]
50
57
  }, children);
51
58
  };
52
59
  var _default = exports.default = Label;
@@ -1,14 +1,21 @@
1
1
  /** @jsx jsx */
2
2
 
3
3
  import { css, jsx } from '@emotion/react';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { N200 } from '@atlaskit/theme/colors';
5
6
  const fieldsetLabelStyles = css({
6
7
  display: 'inline-block',
7
- color: `var(--ds-text-subtle, ${N200})`,
8
8
  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)",
9
- fontWeight: "var(--ds-font-weight-semibold, 600)",
10
9
  marginBlockEnd: "var(--ds-space-050, 4px)",
11
- marginBlockStart: 0
10
+ marginBlockStart: "var(--ds-space-0, 0px)"
11
+ });
12
+ const oldFieldsetLabelStyles = css({
13
+ color: `var(--ds-text-subtle, ${N200})`,
14
+ fontWeight: "var(--ds-font-weight-semibold, 600)"
15
+ });
16
+ const newFieldsetLabelStyles = css({
17
+ color: "var(--ds-text-subtle, #44546F)",
18
+ fontWeight: "var(--ds-font-weight-bold, 700)"
12
19
  });
13
20
 
14
21
  /**
@@ -16,7 +23,7 @@ const fieldsetLabelStyles = css({
16
23
  *
17
24
  * A label represents a caption for an item in a user interface.
18
25
  *
19
- * It's recommended that a label has a `4px` spacing above its associated
26
+ * It's recommended that a label has a `space.050` spacing above its associated
20
27
  * control element.
21
28
  */
22
29
  export const Label = ({
@@ -25,7 +32,7 @@ export const Label = ({
25
32
  id,
26
33
  testId
27
34
  }) => jsx("label", {
28
- css: fieldsetLabelStyles,
35
+ css: [fieldsetLabelStyles, getBooleanFF('platform.design-system-team.form-label-typography-updates') ? newFieldsetLabelStyles : oldFieldsetLabelStyles],
29
36
  id: id,
30
37
  htmlFor: htmlFor,
31
38
  "data-testid": testId
@@ -40,7 +47,7 @@ export const Legend = ({
40
47
  children
41
48
  }) => {
42
49
  return jsx("legend", {
43
- css: fieldsetLabelStyles
50
+ css: [fieldsetLabelStyles, getBooleanFF('platform.design-system-team.form-label-typography-updates') ? newFieldsetLabelStyles : oldFieldsetLabelStyles]
44
51
  }, children);
45
52
  };
46
53
  export default Label;
package/dist/esm/label.js CHANGED
@@ -1,14 +1,21 @@
1
1
  /** @jsx jsx */
2
2
 
3
3
  import { css, jsx } from '@emotion/react';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { N200 } from '@atlaskit/theme/colors';
5
6
  var fieldsetLabelStyles = css({
6
7
  display: 'inline-block',
7
- color: "var(--ds-text-subtle, ".concat(N200, ")"),
8
8
  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)",
9
- fontWeight: "var(--ds-font-weight-semibold, 600)",
10
9
  marginBlockEnd: "var(--ds-space-050, 4px)",
11
- marginBlockStart: 0
10
+ marginBlockStart: "var(--ds-space-0, 0px)"
11
+ });
12
+ var oldFieldsetLabelStyles = css({
13
+ color: "var(--ds-text-subtle, ".concat(N200, ")"),
14
+ fontWeight: "var(--ds-font-weight-semibold, 600)"
15
+ });
16
+ var newFieldsetLabelStyles = css({
17
+ color: "var(--ds-text-subtle, #44546F)",
18
+ fontWeight: "var(--ds-font-weight-bold, 700)"
12
19
  });
13
20
 
14
21
  /**
@@ -16,7 +23,7 @@ var fieldsetLabelStyles = css({
16
23
  *
17
24
  * A label represents a caption for an item in a user interface.
18
25
  *
19
- * It's recommended that a label has a `4px` spacing above its associated
26
+ * It's recommended that a label has a `space.050` spacing above its associated
20
27
  * control element.
21
28
  */
22
29
  export var Label = function Label(_ref) {
@@ -25,7 +32,7 @@ export var Label = function Label(_ref) {
25
32
  id = _ref.id,
26
33
  testId = _ref.testId;
27
34
  return jsx("label", {
28
- css: fieldsetLabelStyles,
35
+ css: [fieldsetLabelStyles, getBooleanFF('platform.design-system-team.form-label-typography-updates') ? newFieldsetLabelStyles : oldFieldsetLabelStyles],
29
36
  id: id,
30
37
  htmlFor: htmlFor,
31
38
  "data-testid": testId
@@ -40,7 +47,7 @@ export var Label = function Label(_ref) {
40
47
  export var Legend = function Legend(_ref2) {
41
48
  var children = _ref2.children;
42
49
  return jsx("legend", {
43
- css: fieldsetLabelStyles
50
+ css: [fieldsetLabelStyles, getBooleanFF('platform.design-system-team.form-label-typography-updates') ? newFieldsetLabelStyles : oldFieldsetLabelStyles]
44
51
  }, children);
45
52
  };
46
53
  export default Label;
@@ -1,5 +1,5 @@
1
- import { FC, ReactNode } from 'react';
2
- import { FieldProps, Meta } from './field';
1
+ import { type FC, type ReactNode } from 'react';
2
+ import { type FieldProps, type Meta } from './field';
3
3
  export interface CheckboxFieldProps extends FieldProps<string | undefined> {
4
4
  isChecked: boolean;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { FormEvent, ReactNode } from 'react';
2
+ import { type FormEvent, type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  type SupportedElements = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
5
5
  export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  export interface FieldsetProps {
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { Align } from './types';
4
+ import { type Align } from './types';
5
5
  export interface FormFooterProps {
6
6
  /**
7
7
  * Content to render in the footer of the form.
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  export interface FormSectionProps {
5
5
  /**
@@ -1,6 +1,6 @@
1
- import React, { ReactNode } from 'react';
2
- import { FieldConfig, FieldSubscriber, FieldSubscription, FormApi, FormState, Unsubscribe } from 'final-form';
3
- import { OnSubmitHandler } from './types';
1
+ import React, { type ReactNode } from 'react';
2
+ import { type FieldConfig, type FieldSubscriber, type FieldSubscription, type FormApi, type FormState, type Unsubscribe } from 'final-form';
3
+ import { type OnSubmitHandler } from './types';
4
4
  type DefaultValue<FieldValue> = (value?: FieldValue) => FieldValue;
5
5
  type RegisterField = <FieldValue>(name: string, defaultValue: FieldValue | DefaultValue<FieldValue>, subscriber: FieldSubscriber<FieldValue>, subscription: FieldSubscription, config: FieldConfig<FieldValue>) => Unsubscribe;
6
6
  type GetCurrentValue = <FormValues>(name: string) => FormValues[keyof FormValues] | undefined;
@@ -14,7 +14,7 @@ export interface LegendProps {
14
14
  *
15
15
  * A label represents a caption for an item in a user interface.
16
16
  *
17
- * It's recommended that a label has a `4px` spacing above its associated
17
+ * It's recommended that a label has a `space.050` spacing above its associated
18
18
  * control element.
19
19
  */
20
20
  export declare const Label: FC<LabelProps>;
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  type MessageAppearance = 'default' | 'error' | 'valid';
5
5
  /**
@@ -1,5 +1,5 @@
1
- import React, { FC, ReactNode } from 'react';
2
- import { FieldProps, Meta } from './field';
1
+ import React, { type FC, type ReactNode } from 'react';
2
+ import { type FieldProps, type Meta } from './field';
3
3
  type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
4
4
  export interface RangeFieldProps {
5
5
  children: (args: {
@@ -1,4 +1,4 @@
1
- import { FormApi as FinalFormAPI } from 'final-form';
1
+ import { type FormApi as FinalFormAPI } from 'final-form';
2
2
  export type Align = 'start' | 'end';
3
3
  export type FormApi<FormData> = FinalFormAPI<FormData>;
4
4
  export type OnSubmitHandler<FormData> = (values: FormData, form: FormApi<FormData>, callback?: (errors?: Record<string, string>) => void) => void | Object | Promise<Object | void>;
@@ -1,4 +1,4 @@
1
- import { FormState, FormSubscription } from 'final-form';
1
+ import { type FormState, type FormSubscription } from 'final-form';
2
2
  /**
3
3
  * A hook to return a recent form state for use within the `<Form>` as it requires context access.
4
4
  * This is useful for previewing form state, or for building custom fields that need to react to form state.
@@ -1,5 +1,5 @@
1
- import { FC, ReactNode } from 'react';
2
- import { FieldProps, Meta } from './field';
1
+ import { type FC, type ReactNode } from 'react';
2
+ import { type FieldProps, type Meta } from './field';
3
3
  export interface CheckboxFieldProps extends FieldProps<string | undefined> {
4
4
  isChecked: boolean;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { FormEvent, ReactNode } from 'react';
2
+ import { type FormEvent, type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  type SupportedElements = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
5
5
  export interface FieldProps<FieldValue, Element extends SupportedElements = HTMLInputElement> {
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  export interface FieldsetProps {
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { Align } from './types';
4
+ import { type Align } from './types';
5
5
  export interface FormFooterProps {
6
6
  /**
7
7
  * Content to render in the footer of the form.
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  export interface FormSectionProps {
5
5
  /**
@@ -1,6 +1,6 @@
1
- import React, { ReactNode } from 'react';
2
- import { FieldConfig, FieldSubscriber, FieldSubscription, FormApi, FormState, Unsubscribe } from 'final-form';
3
- import { OnSubmitHandler } from './types';
1
+ import React, { type ReactNode } from 'react';
2
+ import { type FieldConfig, type FieldSubscriber, type FieldSubscription, type FormApi, type FormState, type Unsubscribe } from 'final-form';
3
+ import { type OnSubmitHandler } from './types';
4
4
  type DefaultValue<FieldValue> = (value?: FieldValue) => FieldValue;
5
5
  type RegisterField = <FieldValue>(name: string, defaultValue: FieldValue | DefaultValue<FieldValue>, subscriber: FieldSubscriber<FieldValue>, subscription: FieldSubscription, config: FieldConfig<FieldValue>) => Unsubscribe;
6
6
  type GetCurrentValue = <FormValues>(name: string) => FormValues[keyof FormValues] | undefined;
@@ -14,7 +14,7 @@ export interface LegendProps {
14
14
  *
15
15
  * A label represents a caption for an item in a user interface.
16
16
  *
17
- * It's recommended that a label has a `4px` spacing above its associated
17
+ * It's recommended that a label has a `space.050` spacing above its associated
18
18
  * control element.
19
19
  */
20
20
  export declare const Label: FC<LabelProps>;
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  type MessageAppearance = 'default' | 'error' | 'valid';
5
5
  /**
@@ -1,5 +1,5 @@
1
- import React, { FC, ReactNode } from 'react';
2
- import { FieldProps, Meta } from './field';
1
+ import React, { type FC, type ReactNode } from 'react';
2
+ import { type FieldProps, type Meta } from './field';
3
3
  type RangeProps = Omit<FieldProps<number>, 'isInvalid' | 'isRequired'>;
4
4
  export interface RangeFieldProps {
5
5
  children: (args: {
@@ -1,4 +1,4 @@
1
- import { FormApi as FinalFormAPI } from 'final-form';
1
+ import { type FormApi as FinalFormAPI } from 'final-form';
2
2
  export type Align = 'start' | 'end';
3
3
  export type FormApi<FormData> = FinalFormAPI<FormData>;
4
4
  export type OnSubmitHandler<FormData> = (values: FormData, form: FormApi<FormData>, callback?: (errors?: Record<string, string>) => void) => void | Object | Promise<Object | void>;
@@ -1,4 +1,4 @@
1
- import { FormState, FormSubscription } from 'final-form';
1
+ import { type FormState, type FormSubscription } from 'final-form';
2
2
  /**
3
3
  * A hook to return a recent form state for use within the `<Form>` as it requires context access.
4
4
  * This is useful for previewing form state, or for building custom fields that need to react to form state.
@@ -1,4 +1,4 @@
1
- import { FormProps } from '../src/form';
1
+ import { type FormProps } from '../src/form';
2
2
 
3
3
  export default function FormReactProps(props: FormProps<any>) {
4
4
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/form",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "A form allows users to input information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/heading": "^2.2.0",
32
32
  "@atlaskit/icon": "^22.3.0",
33
33
  "@atlaskit/platform-feature-flags": "^0.2.5",
34
- "@atlaskit/primitives": "^6.3.0",
34
+ "@atlaskit/primitives": "^6.4.0",
35
35
  "@atlaskit/theme": "^12.8.0",
36
36
  "@atlaskit/tokens": "^1.49.0",
37
37
  "@babel/runtime": "^7.0.0",
@@ -50,18 +50,17 @@
50
50
  "@af/integration-testing": "*",
51
51
  "@af/visual-regression": "*",
52
52
  "@atlaskit/banner": "^12.3.0",
53
- "@atlaskit/button": "^17.15.0",
54
- "@atlaskit/checkbox": "^13.3.0",
53
+ "@atlaskit/button": "^17.17.0",
54
+ "@atlaskit/checkbox": "^13.4.0",
55
55
  "@atlaskit/ds-lib": "^2.3.0",
56
56
  "@atlaskit/modal-dialog": "^12.13.0",
57
57
  "@atlaskit/radio": "^6.3.0",
58
58
  "@atlaskit/range": "^7.2.0",
59
- "@atlaskit/select": "^17.9.0",
59
+ "@atlaskit/select": "^17.10.0",
60
60
  "@atlaskit/ssr": "*",
61
61
  "@atlaskit/textfield": "^6.3.0",
62
62
  "@atlaskit/toggle": "^13.1.0",
63
63
  "@atlaskit/visual-regression": "*",
64
- "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
65
64
  "@testing-library/react": "^12.1.5",
66
65
  "@testing-library/react-hooks": "^8.0.1",
67
66
  "@testing-library/user-event": "^14.4.3",
@@ -124,10 +123,12 @@
124
123
  ".": "./src/index.tsx"
125
124
  },
126
125
  "homepage": "https://atlassian.design/components/form/",
127
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
128
126
  "platform-feature-flags": {
129
127
  "platform.design-system-team.form-header-typography-updates_4f1g6": {
130
128
  "type": "boolean"
129
+ },
130
+ "platform.design-system-team.form-label-typography-updates": {
131
+ "type": "boolean"
131
132
  }
132
133
  }
133
134
  }