@instructure/ui-popover 8.12.1-snapshot.51 → 8.13.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.
@@ -1,13 +1,15 @@
1
1
  import React, { Component } from 'react';
2
- import type { RequestAnimationFrameType } from '@instructure/ui-dom-utils';
3
- import type { PopoverProps } from './props';
2
+ import type { PositionProps } from '@instructure/ui-position';
3
+ import type { DialogProps } from '@instructure/ui-dialog';
4
+ import type { PopoverProps, PopoverState } from './props';
4
5
  /**
5
6
  ---
6
7
  category: components
7
8
  tags: overlay, portal, dialog
8
9
  ---
10
+ @tsProps
9
11
  **/
10
- declare class Popover extends Component<PopoverProps> {
12
+ declare class Popover extends Component<PopoverProps, PopoverState> {
11
13
  static readonly componentId = "Popover";
12
14
  static allowedProps: readonly (keyof {
13
15
  isShowingContent?: boolean | undefined;
@@ -17,17 +19,17 @@ declare class Popover extends Component<PopoverProps> {
17
19
  color?: "primary" | "primary-inverse" | undefined;
18
20
  shadow?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Shadow | undefined;
19
21
  stacking?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Stacking | undefined;
20
- contentRef?: ((...args: any[]) => any) | undefined;
21
- defaultFocusElement?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | ((...args: any[]) => any) | undefined;
22
+ contentRef?: ((contentElement: Element | null) => void) | undefined;
23
+ defaultFocusElement?: import("@instructure/shared-types").UIElement | undefined;
24
+ liveRegion?: import("@instructure/shared-types").LiveRegion | undefined;
22
25
  screenReaderLabel?: string | undefined;
23
26
  offsetX?: string | number | undefined;
24
27
  offsetY?: string | number | undefined;
25
- placement: import("@instructure/ui-position").PlacementPropValues;
28
+ placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
26
29
  constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
27
30
  mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
28
31
  positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
29
32
  insertAt?: "top" | "bottom" | undefined;
30
- liveRegion?: import("@instructure/shared-types").LiveRegion | undefined;
31
33
  id?: string | undefined;
32
34
  shouldAlignArrow?: boolean | undefined;
33
35
  shouldTrackPosition?: boolean | undefined;
@@ -37,19 +39,21 @@ declare class Popover extends Component<PopoverProps> {
37
39
  shouldCloseOnDocumentClick?: boolean | undefined;
38
40
  shouldCloseOnEscape?: boolean | undefined;
39
41
  shouldFocusContentOnTriggerBlur?: boolean | undefined;
40
- onShowContent?: ((...args: any[]) => any) | undefined;
41
- onHideContent?: ((...args: any[]) => any) | undefined;
42
- onPositioned?: ((...args: any[]) => any) | undefined;
43
- onPositionChanged?: ((...args: any[]) => any) | undefined;
44
- onClick?: ((...args: any[]) => any) | undefined;
45
- onFocus?: ((...args: any[]) => any) | undefined;
46
- onBlur?: ((...args: any[]) => any) | undefined;
47
- onKeyDown?: ((...args: any[]) => any) | undefined;
48
- onKeyUp?: ((...args: any[]) => any) | undefined;
49
- onMouseOver?: ((...args: any[]) => any) | undefined;
50
- onMouseOut?: ((...args: any[]) => any) | undefined;
51
- renderTrigger?: React.ReactNode | ((...args: any[]) => any);
52
- children?: React.ReactNode | ((...args: any[]) => React.ReactNode);
42
+ onShowContent?: ((event: Event) => void) | undefined;
43
+ onHideContent?: ((event: Event, args: {
44
+ documentClick: boolean;
45
+ }) => void) | undefined;
46
+ onPositioned?: ((position: import("@instructure/ui-position/types/Position/props").PositionObject) => void) | undefined;
47
+ onPositionChanged?: ((position: import("@instructure/ui-position/types/Position/props").PositionObject) => void) | undefined;
48
+ onClick?: ((event: Event) => void) | undefined;
49
+ onFocus?: ((event: Event) => void) | undefined;
50
+ onBlur?: ((event: Event) => void) | undefined;
51
+ onKeyDown?: ((event: Event) => void) | undefined;
52
+ onKeyUp?: ((event: Event) => void) | undefined;
53
+ onMouseOver?: ((event: Event) => void) | undefined;
54
+ onMouseOut?: ((event: Event) => void) | undefined;
55
+ renderTrigger?: React.ReactNode | (() => React.ReactNode);
56
+ children?: React.ReactNode | (() => React.ReactNode);
53
57
  elementRef?: ((element: Element | null) => void) | undefined;
54
58
  })[];
55
59
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
@@ -60,17 +64,17 @@ declare class Popover extends Component<PopoverProps> {
60
64
  color?: "primary" | "primary-inverse" | undefined;
61
65
  shadow?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Shadow | undefined;
62
66
  stacking?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Stacking | undefined;
63
- contentRef?: ((...args: any[]) => any) | undefined;
64
- defaultFocusElement?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | ((...args: any[]) => any) | undefined;
67
+ contentRef?: ((contentElement: Element | null) => void) | undefined;
68
+ defaultFocusElement?: import("@instructure/shared-types").UIElement | undefined;
69
+ liveRegion?: import("@instructure/shared-types").LiveRegion | undefined;
65
70
  screenReaderLabel?: string | undefined;
66
71
  offsetX?: string | number | undefined;
67
72
  offsetY?: string | number | undefined;
68
- placement: import("@instructure/ui-position").PlacementPropValues;
73
+ placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
69
74
  constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
70
75
  mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
71
76
  positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
72
77
  insertAt?: "top" | "bottom" | undefined;
73
- liveRegion?: import("@instructure/shared-types").LiveRegion | undefined;
74
78
  id?: string | undefined;
75
79
  shouldAlignArrow?: boolean | undefined;
76
80
  shouldTrackPosition?: boolean | undefined;
@@ -80,19 +84,21 @@ declare class Popover extends Component<PopoverProps> {
80
84
  shouldCloseOnDocumentClick?: boolean | undefined;
81
85
  shouldCloseOnEscape?: boolean | undefined;
82
86
  shouldFocusContentOnTriggerBlur?: boolean | undefined;
83
- onShowContent?: ((...args: any[]) => any) | undefined;
84
- onHideContent?: ((...args: any[]) => any) | undefined;
85
- onPositioned?: ((...args: any[]) => any) | undefined;
86
- onPositionChanged?: ((...args: any[]) => any) | undefined;
87
- onClick?: ((...args: any[]) => any) | undefined;
88
- onFocus?: ((...args: any[]) => any) | undefined;
89
- onBlur?: ((...args: any[]) => any) | undefined;
90
- onKeyDown?: ((...args: any[]) => any) | undefined;
91
- onKeyUp?: ((...args: any[]) => any) | undefined;
92
- onMouseOver?: ((...args: any[]) => any) | undefined;
93
- onMouseOut?: ((...args: any[]) => any) | undefined;
94
- renderTrigger?: React.ReactNode | ((...args: any[]) => any);
95
- children?: React.ReactNode | ((...args: any[]) => React.ReactNode);
87
+ onShowContent?: ((event: Event) => void) | undefined;
88
+ onHideContent?: ((event: Event, args: {
89
+ documentClick: boolean;
90
+ }) => void) | undefined;
91
+ onPositioned?: ((position: import("@instructure/ui-position/types/Position/props").PositionObject) => void) | undefined;
92
+ onPositionChanged?: ((position: import("@instructure/ui-position/types/Position/props").PositionObject) => void) | undefined;
93
+ onClick?: ((event: Event) => void) | undefined;
94
+ onFocus?: ((event: Event) => void) | undefined;
95
+ onBlur?: ((event: Event) => void) | undefined;
96
+ onKeyDown?: ((event: Event) => void) | undefined;
97
+ onKeyUp?: ((event: Event) => void) | undefined;
98
+ onMouseOver?: ((event: Event) => void) | undefined;
99
+ onMouseOut?: ((event: Event) => void) | undefined;
100
+ renderTrigger?: React.ReactNode | (() => React.ReactNode);
101
+ children?: React.ReactNode | (() => React.ReactNode);
96
102
  elementRef?: ((element: Element | null) => void) | undefined;
97
103
  }>;
98
104
  static defaultProps: {
@@ -104,7 +110,6 @@ declare class Popover extends Component<PopoverProps> {
104
110
  offsetY: number;
105
111
  color: string;
106
112
  on: string[];
107
- contentRef: (el: any) => void;
108
113
  withArrow: boolean;
109
114
  constrain: string;
110
115
  insertAt: string;
@@ -116,64 +121,44 @@ declare class Popover extends Component<PopoverProps> {
116
121
  shouldCloseOnDocumentClick: boolean;
117
122
  shouldFocusContentOnTriggerBlur: boolean;
118
123
  shouldCloseOnEscape: boolean;
119
- onShowContent: (event: any) => void;
120
- onHideContent: (event: any, { documentClick }: {
121
- documentClick: any;
122
- }) => void;
123
- onClick: (event: any) => void;
124
- onFocus: (event: any) => void;
125
- onBlur: (event: any) => void;
126
- onMouseOver: (event: any) => void;
127
- onMouseOut: (event: any) => void;
128
- onKeyDown: (event: any) => void;
129
- onKeyUp: (event: any) => void;
130
- onPositioned: (position: any) => void;
131
- onPositionChanged: (position: any) => void;
132
- renderTrigger: null;
133
- children: null;
134
124
  };
135
- _handleMouseOver: (...args: any[]) => any | undefined;
136
- _handleMouseOut: (...args: any[]) => any | undefined;
137
- constructor(props: any);
138
- _raf: RequestAnimationFrameType[];
125
+ constructor(props: PopoverProps);
126
+ private _handleMouseOver;
127
+ private _handleMouseOut;
128
+ private _id;
129
+ private _raf;
130
+ private _trigger?;
131
+ private _view;
132
+ private _dialog;
133
+ private _contentElement;
134
+ private _focusRegion?;
135
+ private mouseOutTimeout?;
139
136
  ref: Element | null;
140
137
  handleRef: (el: Element | null) => void;
141
138
  get isTooltip(): boolean | undefined;
142
139
  componentDidMount(): void;
143
140
  componentWillUnmount(): void;
144
- shouldComponentUpdate(nextProps: any, nextState: any, nextContext: any): boolean;
145
- componentDidUpdate(prevProps: any, prevState: any, snapShot: any): void;
146
- computeOffsets(placement: any): {
141
+ shouldComponentUpdate(nextProps: PopoverProps, nextState: PopoverState): boolean;
142
+ componentDidUpdate(prevProps: PopoverProps, prevState: PopoverState): void;
143
+ computeOffsets(placement: PopoverProps['placement']): {
147
144
  offsetX: string | number | undefined;
148
145
  offsetY: string | number | undefined;
149
146
  };
150
- get placement(): import("@instructure/ui-position").PlacementPropValues;
151
- get positionProps(): {
152
- offsetX: any;
153
- offsetY: any;
154
- shouldTrackPosition: any;
155
- insertAt: "top" | "bottom" | undefined;
156
- placement: import("@instructure/ui-position").PlacementPropValues;
157
- constrain: import("@instructure/ui-position").PositionConstraint | undefined;
158
- onPositioned: (position: any) => void;
159
- onPositionChanged: (position: any) => void;
160
- target: import("@instructure/ui-position").PositionMountNode | undefined;
161
- mountNode: import("@instructure/ui-position").PositionMountNode | undefined;
162
- id: any;
163
- };
164
- get shown(): any;
165
- get defaultFocusElement(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | ((...args: any[]) => any) | undefined;
166
- show: (event: any) => void;
167
- hide: (event: any, documentClick?: boolean) => void;
168
- toggle: (event: any) => void;
169
- handleDialogDismiss: (...args: any[]) => void;
170
- handleDialogBlur: (event: any) => void;
171
- handleTriggerKeyDown: (event: any) => void;
172
- handleTriggerKeyUp: (event: any) => void;
173
- handleTriggerBlur: (event: any) => void;
174
- handlePositioned: (position: any) => void;
175
- handlePositionChanged: (position: any) => void;
176
- renderTrigger(): any;
147
+ get placement(): PopoverProps['placement'];
148
+ get positionProps(): Partial<PositionProps>;
149
+ get shown(): boolean | undefined;
150
+ get defaultFocusElement(): import("@instructure/shared-types").UIElement | undefined;
151
+ show: (event: Event) => void;
152
+ hide: (event: Event, documentClick?: boolean) => void;
153
+ toggle: (event: Event) => void;
154
+ handleDialogDismiss: DialogProps['onDismiss'];
155
+ handleDialogBlur: (event: Event) => void;
156
+ handleTriggerKeyDown: (event: KeyboardEvent) => void;
157
+ handleTriggerKeyUp: (event: KeyboardEvent) => void;
158
+ handleTriggerBlur: (event: Event) => void;
159
+ handlePositioned: PositionProps['onPositioned'];
160
+ handlePositionChanged: PositionProps['onPositionChanged'];
161
+ renderTrigger(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
177
162
  renderContent(): JSX.Element | null;
178
163
  render(): JSX.Element;
179
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Popover/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAiBxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAS1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C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AAS,wBAOZ;IAED,iBAAiB;IAiBjB,oBAAoB;IAUpB,qBAAqB,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY;IAOtE,kBAAkB,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY;IAsCnE,cAAc,CAAC,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC;;;;IA2BnD,IAAI,SAAS,IAAI,YAAY,CAAC,WAAW,CAAC,CAWzC;IAED,IAAI,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAc1C;IAED,IAAI,KAAK,wBAIR;IAED,IAAI,mBAAmB,8DAEtB;IAED,IAAI,UAAW,KAAK,UAKnB;IAED,IAAI,UAAW,KAAK,mCAenB;IAED,MAAM,UAAW,KAAK,UAMrB;IAED,mBAAmB,EAAE,WAAW,CAAC,WAAW,CAAC,CAY5C;IAED,gBAAgB,UAAW,KAAK,UAS/B;IAED,oBAAoB,UAAW,aAAa,UAa3C;IAED,kBAAkB,UAAW,aAAa,UAOzC;IAED,iBAAiB,UAAW,KAAK,UAYhC;IAED,gBAAgB,EAAE,aAAa,CAAC,cAAc,CAAC,CAO9C;IAED,qBAAqB,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAOxD;IAED,aAAa;IAsEb,aAAa;IAmFb,MAAM;CAsBP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -1,56 +1,202 @@
1
1
  import React from 'react';
2
2
  import type { Shadow, Stacking } from '@instructure/emotion';
3
- import type { PlacementPropValues, PositionConstraint, PositionMountNode } from '@instructure/ui-position';
3
+ import type { PlacementPropValues, PositionConstraint, PositionMountNode, PositionObject } from '@instructure/ui-position';
4
4
  import type { BidirectionalProps } from '@instructure/ui-i18n';
5
- import type { PropValidators, LiveRegion } from '@instructure/shared-types';
5
+ import type { PropValidators, LiveRegion, UIElement } from '@instructure/shared-types';
6
6
  declare type PopoverOwnProps = {
7
+ /**
8
+ * Whether or not the `<Popover />` content is shown
9
+ */
7
10
  isShowingContent?: boolean;
11
+ /**
12
+ * Whether or not to show the content by default, when uncontrolled
13
+ */
8
14
  defaultIsShowingContent?: boolean;
15
+ /**
16
+ * The action that causes the content to display (`click`, `hover`, `focus`)
17
+ */
9
18
  on?: ('click' | 'hover' | 'focus') | ('click' | 'hover' | 'focus')[];
19
+ /**
20
+ * Whether or not an arrow pointing to the trigger should be rendered
21
+ */
10
22
  withArrow?: boolean;
23
+ /**
24
+ * Color variant of the popover content
25
+ */
11
26
  color?: 'primary' | 'primary-inverse';
27
+ /**
28
+ * Controls the shadow depth for the `<Popover />`
29
+ */
12
30
  shadow?: Shadow;
31
+ /**
32
+ * Controls the z-index depth for the `<Popover />` content
33
+ */
13
34
  stacking?: Stacking;
14
- contentRef?: (...args: any[]) => any;
15
- defaultFocusElement?: React.ReactElement | ((...args: any[]) => any);
35
+ /**
36
+ * A function that returns a reference to the content element
37
+ */
38
+ contentRef?: (contentElement: Element | null) => void;
39
+ /**
40
+ * An element or a function returning an element to focus by default
41
+ */
42
+ defaultFocusElement?: UIElement;
43
+ /**
44
+ * An element, function returning an element, or array of elements that will
45
+ * not be hidden from the screen reader when the `<Popover />` is open
46
+ */
47
+ liveRegion?: LiveRegion;
48
+ /**
49
+ * An accessible label for the `<Popover />` content
50
+ */
16
51
  screenReaderLabel?: string;
52
+ /**
53
+ * The horizontal offset for the positioned content
54
+ */
17
55
  offsetX?: string | number;
56
+ /**
57
+ * The vertical offset for the positioned content
58
+ */
18
59
  offsetY?: string | number;
19
- placement: PlacementPropValues;
60
+ /**
61
+ * The placement of the content in relation to the trigger
62
+ *
63
+ * One of: 'top', 'bottom', 'start', 'end', 'top start', 'top center',
64
+ * 'top end', 'top stretch', 'bottom start', 'bottom center', 'bottom end',
65
+ * 'bottom stretch', 'start top', 'start center', 'start bottom',
66
+ * 'start stretch', 'end top', 'end center', 'end bottom', 'end stretch',
67
+ * 'center start', 'center end', 'offscreen'
68
+ */
69
+ placement?: PlacementPropValues;
70
+ /**
71
+ * The parent in which to constrain the popover.
72
+ *
73
+ * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
74
+ * or a function returning an element
75
+ */
20
76
  constrain?: PositionConstraint;
77
+ /**
78
+ * An element or a function returning an element to use as the mount node
79
+ * for the `<Popover />` (defaults to `document.body`)
80
+ */
21
81
  mountNode?: PositionMountNode;
82
+ /**
83
+ * Target element for positioning the Popover (if it differs from the trigger)
84
+ */
22
85
  positionTarget?: PositionMountNode;
86
+ /**
87
+ * Insert the element at the 'top' of the mountNode or at the 'bottom'
88
+ */
23
89
  insertAt?: 'bottom' | 'top';
24
- liveRegion?: LiveRegion;
90
+ /**
91
+ * An id is generated if not supplied.
92
+ */
25
93
  id?: string;
94
+ /**
95
+ * Whether or not the content should offset to align by its arrow
96
+ */
26
97
  shouldAlignArrow?: boolean;
98
+ /**
99
+ * Whether or not position should be tracked or just set on initial render
100
+ */
27
101
  shouldTrackPosition?: boolean;
102
+ /**
103
+ * Should the `<Popover />` render offscreen when visually hidden
104
+ */
28
105
  shouldRenderOffscreen?: boolean;
106
+ /**
107
+ * Whether focus should contained within the `<Popover/>` when it is open
108
+ */
29
109
  shouldContainFocus?: boolean;
110
+ /**
111
+ * Whether focus should be returned to the trigger when the `<Popover/>` is closed
112
+ */
30
113
  shouldReturnFocus?: boolean;
114
+ /**
115
+ * Should the `<Popover />` hide when clicks occur outside the content
116
+ */
31
117
  shouldCloseOnDocumentClick?: boolean;
118
+ /**
119
+ * Should the `<Popover />` hide when the escape key is pressed
120
+ */
32
121
  shouldCloseOnEscape?: boolean;
122
+ /**
123
+ * Should the content become focused when the trigger is blurred
124
+ */
33
125
  shouldFocusContentOnTriggerBlur?: boolean;
34
- onShowContent?: (...args: any[]) => any;
35
- onHideContent?: (...args: any[]) => any;
36
- onPositioned?: (...args: any[]) => any;
37
- onPositionChanged?: (...args: any[]) => any;
38
- onClick?: (...args: any[]) => any;
39
- onFocus?: (...args: any[]) => any;
40
- onBlur?: (...args: any[]) => any;
41
- onKeyDown?: (...args: any[]) => any;
42
- onKeyUp?: (...args: any[]) => any;
43
- onMouseOver?: (...args: any[]) => any;
44
- onMouseOut?: (...args: any[]) => any;
45
- renderTrigger?: React.ReactNode | ((...args: any[]) => any);
46
- children?: React.ReactNode | ((...args: any[]) => React.ReactNode);
126
+ /**
127
+ * Callback fired when content is shown. When controlled, this callback is
128
+ * fired when the Popover expects to be shown
129
+ */
130
+ onShowContent?: (event: Event) => void;
131
+ /**
132
+ * Callback fired when content is hidden. When controlled, this callback is
133
+ * fired when the Popover expects to be hidden
134
+ */
135
+ onHideContent?: (event: Event, args: {
136
+ documentClick: boolean;
137
+ }) => void;
138
+ /**
139
+ * Callback fired when content has been is initially positioned.
140
+ * If `shouldRenderOffscreen` is true, it will only fire once, the first
141
+ * time the content is shown
142
+ */
143
+ onPositioned?: (position: PositionObject) => void;
144
+ /**
145
+ * Callback fired when the position changes
146
+ */
147
+ onPositionChanged?: (position: PositionObject) => void;
148
+ /**
149
+ * Callback fired when component is clicked
150
+ */
151
+ onClick?: (event: Event) => void;
152
+ /**
153
+ * Callback fired when trigger is focused
154
+ */
155
+ onFocus?: (event: Event) => void;
156
+ /**
157
+ * Callback fired when component is blurred
158
+ */
159
+ onBlur?: (event: Event) => void;
160
+ /**
161
+ * Callback fired on keydown
162
+ */
163
+ onKeyDown?: (event: Event) => void;
164
+ /**
165
+ * Callback fired on keyup
166
+ */
167
+ onKeyUp?: (event: Event) => void;
168
+ /**
169
+ * Callback fired when mouse is over trigger
170
+ */
171
+ onMouseOver?: (event: Event) => void;
172
+ /**
173
+ * Callback fired when mouse leaves trigger
174
+ */
175
+ onMouseOut?: (event: Event) => void;
176
+ /**
177
+ * The element that triggers the popover
178
+ */
179
+ renderTrigger?: React.ReactNode | (() => React.ReactNode);
180
+ /**
181
+ * The content to be shown by the popover
182
+ */
183
+ children?: React.ReactNode | (() => React.ReactNode);
184
+ /**
185
+ * Provides a reference to the underlying HTML root element
186
+ */
47
187
  elementRef?: (element: Element | null) => void;
48
188
  };
49
189
  declare type PopoverProps = PopoverOwnProps & BidirectionalProps;
190
+ declare type PopoverState = {
191
+ placement: PopoverOwnProps['placement'];
192
+ offsetX: PopoverOwnProps['offsetX'];
193
+ offsetY: PopoverOwnProps['offsetY'];
194
+ isShowingContent?: boolean;
195
+ };
50
196
  declare type PropKeys = keyof PopoverOwnProps;
51
197
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
52
198
  declare const propTypes: PropValidators<PropKeys>;
53
199
  declare const allowedProps: AllowedPropKeys;
54
- export type { PopoverProps };
200
+ export type { PopoverProps, PopoverState };
55
201
  export { propTypes, allowedProps };
56
202
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Popover/props.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA8B3E,aAAK,eAAe,GAAG;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EAAE,CAAA;IACpE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,QAAQ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c,CAAC,QAAQ,CAiDvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eA0CnB,CAAA;AAED,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
package/LICENSE.md DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- title: The MIT License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.