@atlaskit/drawer 7.2.0 → 7.2.1

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,11 @@
1
1
  # @atlaskit/drawer
2
2
 
3
+ ## 7.2.1
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
+
3
9
  ## 7.2.0
4
10
 
5
11
  ### Minor Changes
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/constants.js",
5
5
  "module:es2019": "../dist/es2019/constants.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/constants.d.ts"
7
+ "types": "../dist/types/constants.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/constants.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -46,7 +46,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
46
46
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
47
 
48
48
  var packageName = "@atlaskit/drawer";
49
- var packageVersion = "7.2.0";
49
+ var packageVersion = "7.2.1";
50
50
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
51
51
 
52
52
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.2.0",
3
+ "version": "7.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -9,7 +9,7 @@ import Blanket from './blanket';
9
9
  import FocusLock from './focus-lock';
10
10
  import DrawerPrimitive from './primitives';
11
11
  const packageName = "@atlaskit/drawer";
12
- const packageVersion = "7.2.0";
12
+ const packageVersion = "7.2.1";
13
13
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
14
14
 
15
15
  const createAndFireOnClick = (createAnalyticsEvent, trigger) => createAndFireEventOnAtlaskit({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.2.0",
3
+ "version": "7.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -19,7 +19,7 @@ import Blanket from './blanket';
19
19
  import FocusLock from './focus-lock';
20
20
  import DrawerPrimitive from './primitives';
21
21
  var packageName = "@atlaskit/drawer";
22
- var packageVersion = "7.2.0";
22
+ var packageVersion = "7.2.1";
23
23
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
24
24
 
25
25
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.2.0",
3
+ "version": "7.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -22,10 +22,10 @@ export declare class DrawerBase extends Component<DrawerProps, {
22
22
  handleKeyDown: (event: KeyboardEvent) => void;
23
23
  render(): JSX.Element | null;
24
24
  }
25
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "children" | "onKeyDown" | "isOpen" | "testId" | "icon" | "onClose" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
25
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "children" | "onKeyDown" | "onClose" | "isOpen" | "testId" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
26
26
  width: DrawerWidth;
27
27
  isFocusLockEnabled: boolean;
28
28
  shouldReturnFocus: boolean;
29
29
  autoFocusFirstElem: boolean;
30
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "isOpen" | "testId" | "analyticsContext" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "icon" | "onClose" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & React.RefAttributes<any>>;
30
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "onClose" | "isOpen" | "testId" | "analyticsContext" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & React.RefAttributes<any>>;
31
31
  export default _default;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ declare type BlanketProps = {
3
+ isOpen: boolean;
4
+ onBlanketClicked: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
+ testId?: string;
6
+ };
7
+ /**
8
+ * A wrapper around `@atlaskit/blanket` that adds a fade in/out transition.
9
+ */
10
+ declare const Blanket: ({ isOpen, onBlanketClicked, testId }: BlanketProps) => JSX.Element;
11
+ export default Blanket;
@@ -0,0 +1,6 @@
1
+ import { Component } from 'react';
2
+ import { FocusLockProps } from './types';
3
+ export default class FocusLock extends Component<FocusLockProps> {
4
+ componentDidMount(): void;
5
+ render(): JSX.Element;
6
+ }
@@ -0,0 +1,31 @@
1
+ import React, { Component } from 'react';
2
+ import { DrawerProps, DrawerWidth } from './types';
3
+ export declare class DrawerBase extends Component<DrawerProps, {
4
+ renderPortal: boolean;
5
+ }> {
6
+ static defaultProps: {
7
+ width: DrawerWidth;
8
+ isFocusLockEnabled: boolean;
9
+ shouldReturnFocus: boolean;
10
+ autoFocusFirstElem: boolean;
11
+ };
12
+ state: {
13
+ renderPortal: boolean;
14
+ };
15
+ body: HTMLBodyElement | null | undefined;
16
+ componentDidMount(): void;
17
+ componentWillUnmount(): void;
18
+ componentDidUpdate(prevProps: DrawerProps): void;
19
+ private handleBlanketClick;
20
+ private handleBackButtonClick;
21
+ private handleClose;
22
+ handleKeyDown: (event: KeyboardEvent) => void;
23
+ render(): JSX.Element | null;
24
+ }
25
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "children" | "onKeyDown" | "onClose" | "isOpen" | "testId" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
26
+ width: DrawerWidth;
27
+ isFocusLockEnabled: boolean;
28
+ shouldReturnFocus: boolean;
29
+ autoFocusFirstElem: boolean;
30
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "onClose" | "isOpen" | "testId" | "analyticsContext" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & React.RefAttributes<any>>;
31
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { CSSObject, jsx } from '@emotion/react';
3
+ import { ContentProps } from '../types';
4
+ declare const _default: {
5
+ component: ({ cssFn, ...props }: ContentProps) => jsx.JSX.Element;
6
+ cssFn: () => CSSObject;
7
+ };
8
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { FC, MouseEventHandler } from 'react';
3
+ interface IconButtonProps {
4
+ testId?: string;
5
+ onClick?: MouseEventHandler<HTMLButtonElement>;
6
+ }
7
+ declare const IconButton: FC<IconButtonProps>;
8
+ export default IconButton;
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { DrawerPrimitiveProps } from '../types';
4
+ declare const DrawerPrimitive: ({ children, icon: Icon, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, ...props }: DrawerPrimitiveProps) => jsx.JSX.Element;
5
+ export default DrawerPrimitive;
@@ -0,0 +1,9 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ import { CSSObject } from '@emotion/react';
4
+ import { SidebarProps } from '../types';
5
+ declare const _default: {
6
+ component: FC<SidebarProps>;
7
+ cssFn: () => CSSObject;
8
+ };
9
+ export default _default;
@@ -0,0 +1,128 @@
1
+ import { ComponentType, ReactNode, SyntheticEvent } from 'react';
2
+ import { CSSObject } from '@emotion/react';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
+ export declare type Widths = {
5
+ extended: string;
6
+ full: string;
7
+ medium: number;
8
+ narrow: number;
9
+ wide: number;
10
+ };
11
+ export declare type DrawerWidth = 'extended' | 'full' | 'medium' | 'narrow' | 'wide';
12
+ export interface BaseProps {
13
+ /**
14
+ * A unique hook to be used for testing.
15
+ */
16
+ testId?: string;
17
+ /**
18
+ * The content of the drawer.
19
+ */
20
+ children?: ReactNode;
21
+ /**
22
+ * Icon to be rendered in your drawer as a component, if available.
23
+ */
24
+ icon?: ComponentType<any>;
25
+ /**
26
+ * Available drawer sizes.
27
+ */
28
+ width?: DrawerWidth;
29
+ /**
30
+ * A callback function that will be called when the drawer has finished its opening transition.
31
+ */
32
+ onOpenComplete?: (node: HTMLElement | null) => void;
33
+ /**
34
+ * A callback function that will be called when the drawer has finished its close transition.
35
+ */
36
+ onCloseComplete?: (node: HTMLElement | null) => void;
37
+ /**
38
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release.
39
+ * Boolean that controls if drawer should be retained/discarded
40
+ */
41
+ shouldUnmountOnExit?: boolean;
42
+ /**
43
+ * Override drawer components.
44
+ */
45
+ overrides?: OverridesType;
46
+ }
47
+ export declare type DefaultsType = {
48
+ Sidebar: {
49
+ component: React.ComponentType<SidebarProps>;
50
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
51
+ };
52
+ Content: {
53
+ component: React.ComponentType<ContentProps>;
54
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
55
+ };
56
+ };
57
+ export declare type OverridesType = {
58
+ Sidebar?: {
59
+ component?: React.ComponentType<SidebarProps>;
60
+ /**
61
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
62
+ */
63
+ cssFn?: (defaultStyles: CSSObject) => CSSObject;
64
+ };
65
+ Content?: {
66
+ component?: React.ComponentType<ContentProps>;
67
+ /**
68
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
69
+ */
70
+ cssFn?: (defaultStyles: CSSObject) => CSSObject;
71
+ };
72
+ };
73
+ export declare type DrawerPrimitiveDefaults = Pick<DefaultsType, 'Sidebar' | 'Content'>;
74
+ export declare type DrawerPrimitiveOverrides = Pick<OverridesType, 'Sidebar' | 'Content'>;
75
+ export interface SidebarProps extends React.HTMLProps<HTMLDivElement> {
76
+ /**
77
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
78
+ */
79
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
80
+ }
81
+ export declare type SidebarCSSProps = Omit<SidebarProps, 'cssFn'>;
82
+ export interface ContentProps extends React.HTMLProps<HTMLDivElement> {
83
+ /**
84
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
85
+ */
86
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
87
+ }
88
+ export declare type ContentCSSProps = Omit<ContentProps, 'cssFn'>;
89
+ export interface DrawerPrimitiveProps extends BaseProps {
90
+ in: boolean;
91
+ onClose: (event: SyntheticEvent<HTMLElement>) => void;
92
+ }
93
+ export declare type DrawerProps = BaseProps & FocusLockProps & WithAnalyticsEventsProps & {
94
+ /**
95
+ * Callback function called while the drawer is displayed and `keydown` event is triggered.
96
+ */
97
+ onKeyDown?: (event: SyntheticEvent) => void;
98
+ /**
99
+ * Callback function called when the drawer is closed.
100
+ */
101
+ onClose?: (event: SyntheticEvent<HTMLElement>, analyticsEvent: any) => void;
102
+ /**
103
+ * Controls if the drawer is open or closed.
104
+ */
105
+ isOpen: boolean;
106
+ };
107
+ export interface FocusLockProps {
108
+ /**
109
+ * Controls whether to focus the first tabbable element inside the focus lock.
110
+ */
111
+ autoFocusFirstElem?: boolean | (() => HTMLElement | null);
112
+ /**
113
+ * Content inside the focus lock.
114
+ */
115
+ children?: ReactNode;
116
+ /**
117
+ * Whether the focus lock is active or not.
118
+ */
119
+ isFocusLockEnabled?: boolean;
120
+ /**
121
+ * Whether to return the focus to the previous active element on closing the drawer.
122
+ */
123
+ shouldReturnFocus?: boolean;
124
+ }
125
+ /**
126
+ * Type of keyboard event that triggers which key will should close the drawer.
127
+ */
128
+ export declare type CloseTrigger = 'backButton' | 'blanket' | 'escKey';
@@ -0,0 +1,7 @@
1
+ declare type OverridesFunc<X extends Record<string, any>, Y extends Record<string, any>> = (key: string) => Record<string, any>;
2
+ export declare type ExtenderType = <D extends Record<string, any>, O extends Record<string, any>>(d: D, o?: O) => OverridesFunc<D, O>;
3
+ /**
4
+ * @deprecated Please avoid using this function as we intend to remote it in a future release. See DSP-2673 for more information.
5
+ */
6
+ export declare const createExtender: ExtenderType;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { DrawerWidth } from './components/types';
2
+ export declare const transitionDuration = "0.22s";
3
+ export declare const transitionDurationMs = 220;
4
+ export declare const transitionTimingFunction: import("@atlaskit/motion/curves").AnimationCurve;
5
+ export declare const widths: DrawerWidth[];
6
+ export declare const animationTimingFunction: () => import("@atlaskit/motion/curves").AnimationCurve;
@@ -0,0 +1,2 @@
1
+ export { default } from './components';
2
+ export type { BaseProps, CloseTrigger, ContentCSSProps, ContentProps, DefaultsType, DrawerPrimitiveDefaults, DrawerPrimitiveOverrides, DrawerPrimitiveProps, DrawerProps, DrawerWidth, FocusLockProps, OverridesType, SidebarCSSProps, SidebarProps, Widths, } from './components/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.2.0",
3
+ "version": "7.2.1",
4
4
  "description": "A drawer is a panel that slides in from the left side of the screen.",
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
  "homepage": "https://atlassian.design/components/drawer",
@@ -46,7 +53,7 @@
46
53
  "@atlaskit/checkbox": "^12.3.9",
47
54
  "@atlaskit/code": "^14.3.3",
48
55
  "@atlaskit/docs": "*",
49
- "@atlaskit/dropdown-menu": "^11.4.0",
56
+ "@atlaskit/dropdown-menu": "^11.5.0",
50
57
  "@atlaskit/ds-lib": "^2.1.0",
51
58
  "@atlaskit/menu": "^1.3.0",
52
59
  "@atlaskit/section-message": "^6.2.0",
@@ -55,13 +62,13 @@
55
62
  "@atlaskit/visual-regression": "*",
56
63
  "@atlaskit/webdriver-runner": "*",
57
64
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
58
- "@testing-library/dom": "^7.7.3",
59
- "@testing-library/react": "^8.0.1",
65
+ "@testing-library/dom": "^8.17.1",
66
+ "@testing-library/react": "^12.1.5",
60
67
  "enzyme": "^3.10.0",
61
68
  "lodash": "^4.17.21",
62
69
  "react-dom": "^16.8.0",
63
70
  "react-lorem-component": "^0.13.0",
64
- "typescript": "4.3.5",
71
+ "typescript": "4.5.5",
65
72
  "wait-for-expect": "^1.2.0"
66
73
  },
67
74
  "techstack": {