@atlaskit/inline-edit 12.2.0 → 12.2.2

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,17 @@
1
1
  # @atlaskit/inline-edit
2
2
 
3
+ ## 12.2.2
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
+ ## 12.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`be93a207731`](https://bitbucket.org/atlassian/atlassian-frontend/commits/be93a207731) - Action buttons now use interactive elevation design tokens. There is no change to their appearance when design tokens are not enabled.
14
+
3
15
  ## 12.2.0
4
16
 
5
17
  ### Minor Changes
@@ -51,7 +51,7 @@ var buttonStyles = (0, _react2.css)({
51
51
  var analyticsAttributes = {
52
52
  componentName: 'inlineEdit',
53
53
  packageName: "@atlaskit/inline-edit",
54
- packageVersion: "12.2.0"
54
+ packageVersion: "12.2.2"
55
55
  };
56
56
 
57
57
  var noop = function noop() {};
@@ -29,10 +29,38 @@ var buttonsContainerStyles = (0, _react.css)({
29
29
  flexShrink: 0
30
30
  });
31
31
  var buttonWrapperElevationDarkStyles = (0, _react.css)({
32
- boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.DN50A, ", 0 0 1px ").concat(_colors.DN60A), ")")
32
+ boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.DN50A, ", 0 0 1px ").concat(_colors.DN60A), ")"),
33
+ // These buttons are floating, so they need an override to overlay interaction states
34
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
35
+ '& > button': {
36
+ backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.DN70, ")")
37
+ },
38
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
39
+ '& > button:hover': {
40
+ backgroundColor: "var(--ds-surface-overlay-hovered, ".concat(_colors.DN60, ")")
41
+ },
42
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
43
+ '& > button:active': {
44
+ backgroundColor: "var(--ds-surface-overlay-pressed, ".concat(_colors.B75, ")"),
45
+ color: "var(--ds-text, ".concat(_colors.B400, ")")
46
+ }
33
47
  });
34
48
  var buttonWrapperElevationLightStyles = (0, _react.css)({
35
- boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")")
49
+ boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"),
50
+ // These buttons are floating, so they need an override to overlay interaction states
51
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
52
+ '& > button': {
53
+ backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N20A, ")")
54
+ },
55
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
56
+ '& > button:hover': {
57
+ backgroundColor: "var(--ds-surface-overlay-hovered, ".concat(_colors.N30A, ")")
58
+ },
59
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
60
+ '& > button:active': {
61
+ backgroundColor: "var(--ds-surface-overlay-pressed, rgba(179, 212, 255, 0.6))",
62
+ color: "var(--ds-text, ".concat(_colors.B400, ")")
63
+ }
36
64
  });
37
65
  var buttonWrapperBaseStyles = (0, _react.css)({
38
66
  boxSizing: 'border-box',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.2.0",
3
+ "version": "12.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ const buttonStyles = css({
20
20
  const analyticsAttributes = {
21
21
  componentName: 'inlineEdit',
22
22
  packageName: "@atlaskit/inline-edit",
23
- packageVersion: "12.2.0"
23
+ packageVersion: "12.2.2"
24
24
  };
25
25
 
26
26
  const noop = () => {};
@@ -3,7 +3,7 @@ import { css, jsx } from '@emotion/react';
3
3
  import Button from '@atlaskit/button/standard-button';
4
4
  import ConfirmIcon from '@atlaskit/icon/glyph/check';
5
5
  import CancelIcon from '@atlaskit/icon/glyph/cross';
6
- import { DN50A, DN60A, N0, N50A, N60A } from '@atlaskit/theme/colors';
6
+ import { B400, B75, DN50A, DN60, DN60A, DN70, N0, N20A, N30A, N50A, N60A } from '@atlaskit/theme/colors';
7
7
  import { fontSize, gridSize } from './constants';
8
8
  const buttonsContainerStyles = css({
9
9
  display: 'flex',
@@ -14,10 +14,38 @@ const buttonsContainerStyles = css({
14
14
  flexShrink: 0
15
15
  });
16
16
  const buttonWrapperElevationDarkStyles = css({
17
- boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${DN50A}, 0 0 1px ${DN60A}`})`
17
+ boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${DN50A}, 0 0 1px ${DN60A}`})`,
18
+ // These buttons are floating, so they need an override to overlay interaction states
19
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
20
+ '& > button': {
21
+ backgroundColor: `var(--ds-surface-overlay, ${DN70})`
22
+ },
23
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
24
+ '& > button:hover': {
25
+ backgroundColor: `var(--ds-surface-overlay-hovered, ${DN60})`
26
+ },
27
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
28
+ '& > button:active': {
29
+ backgroundColor: `var(--ds-surface-overlay-pressed, ${B75})`,
30
+ color: `var(--ds-text, ${B400})`
31
+ }
18
32
  });
19
33
  const buttonWrapperElevationLightStyles = css({
20
- boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`
34
+ boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
35
+ // These buttons are floating, so they need an override to overlay interaction states
36
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
37
+ '& > button': {
38
+ backgroundColor: `var(--ds-surface-overlay, ${N20A})`
39
+ },
40
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
41
+ '& > button:hover': {
42
+ backgroundColor: `var(--ds-surface-overlay-hovered, ${N30A})`
43
+ },
44
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
45
+ '& > button:active': {
46
+ backgroundColor: "var(--ds-surface-overlay-pressed, rgba(179, 212, 255, 0.6))",
47
+ color: `var(--ds-text, ${B400})`
48
+ }
21
49
  });
22
50
  const buttonWrapperBaseStyles = css({
23
51
  boxSizing: 'border-box',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.2.0",
3
+ "version": "12.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -26,7 +26,7 @@ var buttonStyles = css({
26
26
  var analyticsAttributes = {
27
27
  componentName: 'inlineEdit',
28
28
  packageName: "@atlaskit/inline-edit",
29
- packageVersion: "12.2.0"
29
+ packageVersion: "12.2.2"
30
30
  };
31
31
 
32
32
  var noop = function noop() {};
@@ -3,7 +3,7 @@ import { css, jsx } from '@emotion/react';
3
3
  import Button from '@atlaskit/button/standard-button';
4
4
  import ConfirmIcon from '@atlaskit/icon/glyph/check';
5
5
  import CancelIcon from '@atlaskit/icon/glyph/cross';
6
- import { DN50A, DN60A, N0, N50A, N60A } from '@atlaskit/theme/colors';
6
+ import { B400, B75, DN50A, DN60, DN60A, DN70, N0, N20A, N30A, N50A, N60A } from '@atlaskit/theme/colors';
7
7
  import { fontSize, gridSize } from './constants';
8
8
  var buttonsContainerStyles = css({
9
9
  display: 'flex',
@@ -14,10 +14,38 @@ var buttonsContainerStyles = css({
14
14
  flexShrink: 0
15
15
  });
16
16
  var buttonWrapperElevationDarkStyles = css({
17
- boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(DN50A, ", 0 0 1px ").concat(DN60A), ")")
17
+ boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(DN50A, ", 0 0 1px ").concat(DN60A), ")"),
18
+ // These buttons are floating, so they need an override to overlay interaction states
19
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
20
+ '& > button': {
21
+ backgroundColor: "var(--ds-surface-overlay, ".concat(DN70, ")")
22
+ },
23
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
24
+ '& > button:hover': {
25
+ backgroundColor: "var(--ds-surface-overlay-hovered, ".concat(DN60, ")")
26
+ },
27
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
28
+ '& > button:active': {
29
+ backgroundColor: "var(--ds-surface-overlay-pressed, ".concat(B75, ")"),
30
+ color: "var(--ds-text, ".concat(B400, ")")
31
+ }
18
32
  });
19
33
  var buttonWrapperElevationLightStyles = css({
20
- boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")")
34
+ boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")"),
35
+ // These buttons are floating, so they need an override to overlay interaction states
36
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
37
+ '& > button': {
38
+ backgroundColor: "var(--ds-surface-overlay, ".concat(N20A, ")")
39
+ },
40
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
41
+ '& > button:hover': {
42
+ backgroundColor: "var(--ds-surface-overlay-hovered, ".concat(N30A, ")")
43
+ },
44
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
45
+ '& > button:active': {
46
+ backgroundColor: "var(--ds-surface-overlay-pressed, rgba(179, 212, 255, 0.6))",
47
+ color: "var(--ds-text, ".concat(B400, ")")
48
+ }
21
49
  });
22
50
  var buttonWrapperBaseStyles = css({
23
51
  boxSizing: 'border-box',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.2.0",
3
+ "version": "12.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@
2
2
  declare const useButtonFocusHook: (isEditing: boolean | undefined, isEditingState: boolean) => {
3
3
  editButtonRef: import("react").RefObject<HTMLButtonElement>;
4
4
  editViewRef: import("react").MutableRefObject<HTMLElement | undefined>;
5
- shouldBeEditing: boolean | undefined;
5
+ shouldBeEditing: boolean;
6
6
  doNotFocusOnEditButton: () => boolean;
7
7
  };
8
8
  export default useButtonFocusHook;
@@ -0,0 +1 @@
1
+ export { default } from '../inline-edit';
@@ -0,0 +1 @@
1
+ export { default } from '../inline-editable-textfield';
@@ -0,0 +1 @@
1
+ export type { InlineEditableTextfieldProps, InlineEditProps } from '../types';
@@ -0,0 +1,3 @@
1
+ export { default } from './inline-edit';
2
+ export { default as InlineEditableTextfield } from './inline-editable-textfield';
3
+ export type { InlineEditProps, InlineEditableTextfieldProps } from './types';
@@ -0,0 +1,4 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { InlineEditProps } from './types';
3
+ declare const InlineEdit: <FieldValue extends unknown = string>(props: InlineEditProps<FieldValue>) => jsx.JSX.Element;
4
+ export default InlineEdit;
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { InlineEditableTextfieldProps } from './types';
4
+ declare const InlineEditableTextfield: (props: InlineEditableTextfieldProps) => jsx.JSX.Element;
5
+ export default InlineEditableTextfield;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import { ThemeModes } from '@atlaskit/theme/types';
5
+ interface ButtonsProp {
6
+ mode: ThemeModes;
7
+ confirmButtonLabel: string;
8
+ cancelButtonLabel: string;
9
+ onMouseDown: () => void;
10
+ onCancelClick: (event: React.MouseEvent<HTMLElement>) => void;
11
+ }
12
+ declare const Buttons: ({ mode, confirmButtonLabel, cancelButtonLabel, onMouseDown, onCancelClick, }: ButtonsProp) => jsx.JSX.Element;
13
+ export default Buttons;
@@ -0,0 +1,3 @@
1
+ export declare const gridSize: number;
2
+ export declare const fontSize: number;
3
+ export declare const borderRadius: number;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const useButtonFocusHook: (isEditing: boolean | undefined, isEditingState: boolean) => {
3
+ editButtonRef: import("react").RefObject<HTMLButtonElement>;
4
+ editViewRef: import("react").MutableRefObject<HTMLElement | undefined>;
5
+ shouldBeEditing: boolean;
6
+ doNotFocusOnEditButton: () => boolean;
7
+ };
8
+ export default useButtonFocusHook;
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ interface ReadViewProps {
5
+ editButtonLabel: string;
6
+ onEditRequested: () => void;
7
+ postReadViewClick: () => void;
8
+ editButtonRef: React.RefObject<HTMLButtonElement>;
9
+ readViewFitContainerWidth?: boolean;
10
+ readView: () => React.ReactNode;
11
+ }
12
+ declare const ReadView: ({ editButtonLabel, onEditRequested, postReadViewClick, editButtonRef, readViewFitContainerWidth, readView, }: ReadViewProps) => jsx.JSX.Element;
13
+ export default ReadView;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FieldProps } from '@atlaskit/form';
4
+ interface CommonProps extends WithAnalyticsEventsProps {
5
+ /** Additional information to be included in the `context` of analytics events that come from button. */
6
+ analyticsContext?: Record<string, any>;
7
+ /** Accessibility label for the cancel action button. */
8
+ cancelButtonLabel?: string;
9
+ /** Accessibility label for the confirm action button, which saves the field value into `editValue`. */
10
+ confirmButtonLabel?: string;
11
+ /** The user input entered into the field during `editView`. This value is updated and saved by `onConfirm`. */
12
+ defaultValue: any;
13
+ /** Label above the input field that communicates what value should be entered. */
14
+ label?: string;
15
+ /** Displays an inline dialog with a message when the field input is invalid. This is handled by `react-final-form`. */
16
+ validate?: (value: any, formState: {}, fieldState: {}) => string | void | Promise<string | void>;
17
+ /**
18
+ * Sets the view when the element blurs and loses focus (this can happen when a user clicks away).
19
+ * When set to true, inline edit stays in `editView` when blurred. */
20
+ keepEditViewOpenOnBlur?: boolean;
21
+ /** Sets whether the confirm and cancel action buttons are displayed in the bottom right of the field. */
22
+ hideActionButtons?: boolean;
23
+ /** Determines whether the input value can be confirmed as empty. */
24
+ isRequired?: boolean;
25
+ /** Determines whether the `readView` has 100% width within its container, or whether it fits the content. */
26
+ readViewFitContainerWidth?: boolean;
27
+ /** Accessibility label for button, which is used to enter `editView` from keyboard. */
28
+ editButtonLabel?: string;
29
+ /** Exits `editView` and switches back to `readView`. This is called when the cancel action button (x) is clicked. */
30
+ onCancel?: () => void;
31
+ /**
32
+ * Determines whether it begins in `editView` or `readView`. When set to true, `isEditing` begins as true and the inline edit
33
+ * starts in `editView`.
34
+ */
35
+ startWithEditViewOpen?: boolean;
36
+ }
37
+ export interface ExtendedFieldProps<FieldValue> extends FieldProps<FieldValue> {
38
+ errorMessage?: string | undefined;
39
+ }
40
+ export interface InlineEditProps<FieldValue> extends CommonProps {
41
+ /** The component shown when user is editing (when the inline edit is not in `readView`). */
42
+ editView: (fieldProps: ExtendedFieldProps<FieldValue>, ref: React.RefObject<any>) => React.ReactNode;
43
+ /** Sets whether the component shows the `readView` or the `editView`. This is used to manage the state of the input in stateless inline edit. */
44
+ isEditing?: boolean;
45
+ /**
46
+ Saves and confirms the value entered into the field. It exits `editView` and returns to `readView`.
47
+ */
48
+ onConfirm: (value: any, analyticsEvent: UIAnalyticsEvent) => void;
49
+ /** Handler called when readView is clicked. */
50
+ onEdit?: () => void;
51
+ /** The component shown when not in `editView`. This is when the inline edit is read-only and not being edited.*/
52
+ readView: () => React.ReactNode;
53
+ }
54
+ export interface InlineEditableTextfieldProps extends CommonProps {
55
+ /** Sets height of the text field to compact. The top and bottom padding is decreased. */
56
+ isCompact?: boolean;
57
+ /**
58
+ * Calls the `editView` handler. It confirms the changes.
59
+ * The field value is passed as an argument to this function.
60
+ */
61
+ onConfirm: (value: string, analyticsEvent: UIAnalyticsEvent) => void;
62
+ /** Text shown in `readView` when the field value is an empty string. */
63
+ placeholder: string;
64
+ /** A `testId` prop is provided for specific elements. This is a unique string that appears as a data attribute `data-testid` in the rendered code and serves as a hook for automated tests.
65
+ */
66
+ testId?: string;
67
+ }
68
+ export {};
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/inline-edit.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/inline-edit.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/inline-edit.d.ts"
7
+ "types": "../dist/types/entry-points/inline-edit.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/inline-edit.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/inline-editable-textfield.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/inline-editable-textfield.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/inline-editable-textfield.d.ts"
7
+ "types": "../dist/types/entry-points/inline-editable-textfield.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/inline-editable-textfield.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.2.0",
3
+ "version": "12.2.2",
4
4
  "description": "An inline edit displays a custom input component that switches between reading and editing on the same page.",
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.ts",
17
24
  "homepage": "https://atlassian.design/components/inline-edit/",
@@ -52,13 +59,13 @@
52
59
  "@atlaskit/webdriver-runner": "*",
53
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
54
61
  "@emotion/styled": "^11.0.0",
55
- "@testing-library/dom": "^7.7.3",
56
- "@testing-library/react": "^8.0.1",
62
+ "@testing-library/dom": "^8.17.1",
63
+ "@testing-library/react": "^12.1.5",
57
64
  "ast-types": "^0.13.3",
58
65
  "jscodeshift": "^0.13.0",
59
66
  "react-dom": "^16.8.0",
60
67
  "storybook-addon-performance": "^0.16.0",
61
- "typescript": "4.3.5",
68
+ "typescript": "4.5.5",
62
69
  "wait-for-expect": "^1.2.0"
63
70
  },
64
71
  "keywords": [
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/types.d.ts"
7
+ "types": "../dist/types/entry-points/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }