@atlaskit/popup 1.5.1 → 1.5.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,11 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 1.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 1.5.1
4
10
 
5
11
  ### Patch Changes
@@ -54,8 +54,7 @@ function check({
54
54
 
55
55
  describe('Convert boundaries props', () => {
56
56
  check({
57
- it:
58
- 'should turn `boundariesElement="scrollParents"` to `boundary="clippingParents"`',
57
+ it: 'should turn `boundariesElement="scrollParents"` to `boundary="clippingParents"`',
59
58
  original: `
60
59
  import Popup from '@atlaskit/popup';
61
60
 
@@ -95,8 +94,7 @@ describe('Convert boundaries props', () => {
95
94
  });
96
95
 
97
96
  check({
98
- it:
99
- 'should turn `boundariesElement="window"` into `rootBoundary="document"`',
97
+ it: 'should turn `boundariesElement="window"` into `rootBoundary="document"`',
100
98
  original: `
101
99
  import Popup from '@atlaskit/popup';
102
100
 
@@ -136,8 +134,7 @@ describe('Convert boundaries props', () => {
136
134
  });
137
135
 
138
136
  check({
139
- it:
140
- 'should turn `boundariesElement="viewport"` into `rootBoundary="viewport"`',
137
+ it: 'should turn `boundariesElement="viewport"` into `rootBoundary="viewport"`',
141
138
  original: `
142
139
  import Popup from '@atlaskit/popup';
143
140
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,14 +12,6 @@
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
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "af:exports": {
@@ -40,7 +32,7 @@
40
32
  "@atlaskit/popper": "^5.0.0",
41
33
  "@atlaskit/portal": "^4.0.0",
42
34
  "@atlaskit/theme": "^12.2.0",
43
- "@atlaskit/tokens": "^0.10.0",
35
+ "@atlaskit/tokens": "^0.11.0",
44
36
  "@babel/runtime": "^7.0.0",
45
37
  "@emotion/react": "^11.7.1",
46
38
  "bind-event-listener": "^2.1.1",
@@ -51,10 +43,10 @@
51
43
  "react-dom": "^16.8.0"
52
44
  },
53
45
  "devDependencies": {
54
- "@atlaskit/button": "^16.3.0",
46
+ "@atlaskit/button": "^16.4.0",
55
47
  "@atlaskit/docs": "*",
56
48
  "@atlaskit/icon": "^21.11.0",
57
- "@atlaskit/menu": "^1.3.0",
49
+ "@atlaskit/menu": "^1.4.0",
58
50
  "@atlaskit/radio": "^5.4.0",
59
51
  "@atlaskit/section-message": "^6.3.0",
60
52
  "@atlaskit/select": "^15.7.0",
package/report.api.md CHANGED
@@ -1,6 +1,10 @@
1
- ## API Report File for "@atlaskit/popup".
1
+ ## API Report File for "@atlaskit/popup"
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
4
8
 
5
9
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
10
 
@@ -16,160 +20,65 @@ import { ReactNode } from 'react';
16
20
  import { Ref } from 'react';
17
21
  import { SetStateAction } from 'react';
18
22
 
19
- declare interface BaseProps {
20
- /**
21
- * Used to either show or hide the popup.
22
- * When set to `false` popup will not render anything to the DOM.
23
- */
24
- isOpen: boolean;
25
- /**
26
- * Render props for content that is displayed inside the popup.
27
- */
23
+ // @public (undocumented)
24
+ interface BaseProps {
25
+ autoFocus?: boolean;
26
+ boundary?: 'clippingParents' | HTMLElement;
28
27
  content: (props: ContentProps) => React_2.ReactNode;
29
- /**
30
- * Id that is assigned to the popup container element.
31
- */
28
+ fallbackPlacements?: Placement[];
32
29
  id?: string;
33
- /**
34
- * Distance the popup should be offset from the reference in the format of [along, away] (units in px).
35
- * Defaults to [0, 8] - which means the popup will be 8px away from the edge of the reference specified
36
- * by the `placement` prop.
37
- */
30
+ isOpen: boolean;
38
31
  offset?: [number, number];
39
- /**
40
- * Placement of where the popup should be displayed relative to the trigger element.
41
- * Defaults to `"auto"`.
42
- */
32
+ onClose?(event: Event | React_2.MouseEvent | React_2.KeyboardEvent): void;
43
33
  placement?: Placement;
44
- /**
45
- * Defines a list of placements to try.
46
- * When no space is available on the preferred placement,
47
- * the modifier will test the ones provided in the list, and use the first useful one.
48
- */
49
- fallbackPlacements?: Placement[];
50
- /**
51
- * The boundary element that the popup will check for overflow.
52
- * Defaults to `"clippingParents"` which are parent scroll containers,
53
- * but can be set to any element.
54
- */
55
- boundary?: 'clippingParents' | HTMLElement;
56
- /**
57
- * The root boundary that the popup will check for overflow.
58
- * Defaults to `"viewport"` but can be set to `"document"`.
59
- */
34
+ popupComponent?: ComponentType<PopupComponentProps>;
60
35
  rootBoundary?: 'viewport' | 'document';
61
- /**
62
- * Allows the Popup to be placed on the opposite side of its trigger if it does not fit in the viewport.
63
- * Defaults to `true`.
64
- */
65
36
  shouldFlip?: boolean;
66
- /**
67
- * A `testId` prop is provided for specified elements,
68
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
69
- * serving as a hook for automated tests.
70
- */
71
- testId?: string;
72
- /**
73
- * Handler that is called when the popup wants to close itself.
74
- * Generally this will be either when clicking away from the popup or pressing the escape key.
75
- * You'll want to use this to set open state accordingly and then pump it back into the `isOpen` prop.
76
- */
77
- onClose?(event: Event | React_2.MouseEvent | React_2.KeyboardEvent): void;
78
- /**
79
- * The element that is shown when `isOpen` prop is `true`.
80
- * The result of the `content` prop will be placed as children here.
81
- * Defaults to an element with an elevation of `e200` with _no padding_.
82
- */
83
- popupComponent?: ComponentType<PopupComponentProps>;
84
- /**
85
- * Controls whether the popup takes focus when opening.
86
- * This changes the `popupComponent` component tabIndex to `null`.
87
- * Defaults to `true`.
88
- */
89
- autoFocus?: boolean;
90
- /**
91
- * Controls if the event which handles clicks outside the popup is be bound with
92
- * `capture: true`.
93
- */
94
37
  shouldUseCaptureOnOutsideClick?: boolean;
38
+ testId?: string;
95
39
  }
96
40
 
97
- export declare interface ContentProps {
98
- /**
99
- * Will reposition the popup if any of the content has changed.
100
- * Useful for when positions change and the popup was not aware.
101
- */
102
- update: PopperChildrenProps['update'];
103
- /**
104
- * Passed through from the parent popup.
105
- */
41
+ // @public (undocumented)
42
+ export interface ContentProps {
106
43
  isOpen: boolean;
107
- /**
108
- * Passed through from the parent popup.
109
- */
110
44
  onClose?: BaseProps['onClose'];
111
- /**
112
- * Escape hatch to set the initial focus for a specific element when the popup is opened.
113
- */
114
45
  setInitialFocusRef: Dispatch<SetStateAction<HTMLElement | null>>;
46
+ update: PopperChildrenProps['update'];
115
47
  }
116
48
 
117
- declare const Popup: FC<PopupProps>;
49
+ // @public (undocumented)
50
+ const Popup: FC<PopupProps>;
118
51
  export { Popup };
119
52
  export default Popup;
120
53
 
121
- export declare interface PopupComponentProps {
122
- /**
123
- * Children passed passed through by the parent popup.
124
- */
125
- children: ReactNode;
126
- /**
127
- * Placement passed through by the parent popup.
128
- */
54
+ // @public (undocumented)
55
+ export interface PopupComponentProps {
129
56
  'data-placement': Placement;
130
- /**
131
- * Test id passed through by the parent popup.
132
- */
133
57
  'data-testid'?: string;
134
- /**
135
- * Id passed through by the parent popup.
136
- */
58
+ children: ReactNode;
137
59
  id?: string;
138
- /**
139
- * Ref that should be assigned to the root element.
140
- */
141
60
  ref: Ref<HTMLDivElement>;
142
- /**
143
- * Style that should be assigned to the root element.
144
- */
145
61
  style: CSSProperties;
146
- /**
147
- * Tab index passed through by the parent popup.
148
- */
149
62
  tabIndex: number | undefined;
150
63
  }
151
64
 
152
- export declare interface PopupProps extends BaseProps {
153
- /**
154
- * Render props used to anchor the popup to your content.
155
- * Make this an interactive element,
156
- * such as an `@atlaskit/button` component.
157
- */
65
+ // @public (undocumented)
66
+ export interface PopupProps extends BaseProps {
158
67
  trigger: (props: TriggerProps) => React_2.ReactNode;
159
- /**
160
- * Z-index that the popup should be displayed in.
161
- * This is passed to the portal component.
162
- * Defaults to `layers.layer()` from `@atlaskit/theme`.
163
- */
164
68
  zIndex?: number;
165
69
  }
166
70
 
167
- export declare interface TriggerProps {
168
- ref: Ref<any>;
71
+ // @public (undocumented)
72
+ export interface TriggerProps {
73
+ // (undocumented)
169
74
  'aria-controls'?: string;
75
+ // (undocumented)
170
76
  'aria-expanded': boolean;
77
+ // (undocumented)
171
78
  'aria-haspopup': boolean;
79
+ // (undocumented)
80
+ ref: Ref<any>;
172
81
  }
173
82
 
174
- export {};
83
+ // (No @packageDocumentation comment for this package)
175
84
  ```
@@ -1,4 +0,0 @@
1
- import { Popup } from './popup';
2
- export type { ContentProps, PopupComponentProps, PopupProps, TriggerProps, } from './types';
3
- export { Popup };
4
- export default Popup;
@@ -1,4 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import { PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, }: PopperWrapperProps): jsx.JSX.Element;
4
- export default PopperWrapper;
@@ -1,5 +0,0 @@
1
- /** @jsx jsx */
2
- import { FC } from 'react';
3
- import { PopupProps } from './types';
4
- export declare const Popup: FC<PopupProps>;
5
- export default Popup;
@@ -1,3 +0,0 @@
1
- import { FC } from 'react';
2
- import { RepositionOnUpdateProps } from './types';
3
- export declare const RepositionOnUpdate: FC<RepositionOnUpdateProps>;
@@ -1,169 +0,0 @@
1
- import React, { ComponentType, CSSProperties, Dispatch, ReactNode, Ref, SetStateAction } from 'react';
2
- import { Placement, PopperChildrenProps } from '@atlaskit/popper';
3
- export interface TriggerProps {
4
- ref: Ref<any>;
5
- 'aria-controls'?: string;
6
- 'aria-expanded': boolean;
7
- 'aria-haspopup': boolean;
8
- }
9
- export declare type PopupRef = HTMLDivElement | null;
10
- export declare type TriggerRef = HTMLElement | HTMLButtonElement | null;
11
- export interface ContentProps {
12
- /**
13
- * Will reposition the popup if any of the content has changed.
14
- * Useful for when positions change and the popup was not aware.
15
- */
16
- update: PopperChildrenProps['update'];
17
- /**
18
- * Passed through from the parent popup.
19
- */
20
- isOpen: boolean;
21
- /**
22
- * Passed through from the parent popup.
23
- */
24
- onClose?: BaseProps['onClose'];
25
- /**
26
- * Escape hatch to set the initial focus for a specific element when the popup is opened.
27
- */
28
- setInitialFocusRef: Dispatch<SetStateAction<HTMLElement | null>>;
29
- }
30
- export interface PopupComponentProps {
31
- /**
32
- * Children passed passed through by the parent popup.
33
- */
34
- children: ReactNode;
35
- /**
36
- * Placement passed through by the parent popup.
37
- */
38
- 'data-placement': Placement;
39
- /**
40
- * Test id passed through by the parent popup.
41
- */
42
- 'data-testid'?: string;
43
- /**
44
- * Id passed through by the parent popup.
45
- */
46
- id?: string;
47
- /**
48
- * Ref that should be assigned to the root element.
49
- */
50
- ref: Ref<HTMLDivElement>;
51
- /**
52
- * Style that should be assigned to the root element.
53
- */
54
- style: CSSProperties;
55
- /**
56
- * Tab index passed through by the parent popup.
57
- */
58
- tabIndex: number | undefined;
59
- }
60
- interface BaseProps {
61
- /**
62
- * Used to either show or hide the popup.
63
- * When set to `false` popup will not render anything to the DOM.
64
- */
65
- isOpen: boolean;
66
- /**
67
- * Render props for content that is displayed inside the popup.
68
- */
69
- content: (props: ContentProps) => React.ReactNode;
70
- /**
71
- * Id that is assigned to the popup container element.
72
- */
73
- id?: string;
74
- /**
75
- * Distance the popup should be offset from the reference in the format of [along, away] (units in px).
76
- * Defaults to [0, 8] - which means the popup will be 8px away from the edge of the reference specified
77
- * by the `placement` prop.
78
- */
79
- offset?: [
80
- number,
81
- number
82
- ];
83
- /**
84
- * Placement of where the popup should be displayed relative to the trigger element.
85
- * Defaults to `"auto"`.
86
- */
87
- placement?: Placement;
88
- /**
89
- * Defines a list of placements to try.
90
- * When no space is available on the preferred placement,
91
- * the modifier will test the ones provided in the list, and use the first useful one.
92
- */
93
- fallbackPlacements?: Placement[];
94
- /**
95
- * The boundary element that the popup will check for overflow.
96
- * Defaults to `"clippingParents"` which are parent scroll containers,
97
- * but can be set to any element.
98
- */
99
- boundary?: 'clippingParents' | HTMLElement;
100
- /**
101
- * The root boundary that the popup will check for overflow.
102
- * Defaults to `"viewport"` but can be set to `"document"`.
103
- */
104
- rootBoundary?: 'viewport' | 'document';
105
- /**
106
- * Allows the Popup to be placed on the opposite side of its trigger if it does not fit in the viewport.
107
- * Defaults to `true`.
108
- */
109
- shouldFlip?: boolean;
110
- /**
111
- * A `testId` prop is provided for specified elements,
112
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
113
- * serving as a hook for automated tests.
114
- */
115
- testId?: string;
116
- /**
117
- * Handler that is called when the popup wants to close itself.
118
- * Generally this will be either when clicking away from the popup or pressing the escape key.
119
- * You'll want to use this to set open state accordingly and then pump it back into the `isOpen` prop.
120
- */
121
- onClose?(event: Event | React.MouseEvent | React.KeyboardEvent): void;
122
- /**
123
- * The element that is shown when `isOpen` prop is `true`.
124
- * The result of the `content` prop will be placed as children here.
125
- * Defaults to an element with an elevation of `e200` with _no padding_.
126
- */
127
- popupComponent?: ComponentType<PopupComponentProps>;
128
- /**
129
- * Controls whether the popup takes focus when opening.
130
- * This changes the `popupComponent` component tabIndex to `null`.
131
- * Defaults to `true`.
132
- */
133
- autoFocus?: boolean;
134
- /**
135
- * Controls if the event which handles clicks outside the popup is be bound with
136
- * `capture: true`.
137
- */
138
- shouldUseCaptureOnOutsideClick?: boolean;
139
- }
140
- export interface PopupProps extends BaseProps {
141
- /**
142
- * Render props used to anchor the popup to your content.
143
- * Make this an interactive element,
144
- * such as an `@atlaskit/button` component.
145
- */
146
- trigger: (props: TriggerProps) => React.ReactNode;
147
- /**
148
- * Z-index that the popup should be displayed in.
149
- * This is passed to the portal component.
150
- * Defaults to `layers.layer()` from `@atlaskit/theme`.
151
- */
152
- zIndex?: number;
153
- }
154
- export interface PopperWrapperProps extends BaseProps {
155
- triggerRef: TriggerRef;
156
- }
157
- export declare type CloseManagerHook = Pick<PopupProps, 'isOpen' | 'onClose'> & {
158
- popupRef: PopupRef;
159
- triggerRef: TriggerRef;
160
- shouldUseCaptureOnOutsideClick?: boolean;
161
- };
162
- export declare type FocusManagerHook = {
163
- popupRef: PopupRef;
164
- initialFocusRef: HTMLElement | null;
165
- };
166
- export declare type RepositionOnUpdateProps = {
167
- update: PopperChildrenProps['update'];
168
- };
169
- export {};
@@ -1,2 +0,0 @@
1
- import { CloseManagerHook } from './types';
2
- export declare const useCloseManager: ({ isOpen, onClose, popupRef, triggerRef, shouldUseCaptureOnOutsideClick: capture, }: CloseManagerHook) => void;
@@ -1,2 +0,0 @@
1
- import { FocusManagerHook } from './types';
2
- export declare const useFocusManager: ({ popupRef, initialFocusRef, }: FocusManagerHook) => void;