@skedulo/sked-ui 0.0.0-preview-react-18 → 0.0.1-react-18-preview
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/dist/components/IntersectionObserverWrapper/IntersectionObserverWrapper.d.ts +1 -1
- package/dist/components/avatar/Avatar.d.ts +2 -2
- package/dist/components/avatar/AvatarDetail.d.ts +3 -2
- package/dist/components/badge/Badge.d.ts +2 -2
- package/dist/components/badge/Badge.stories.d.ts +3 -3
- package/dist/components/button-group/ButtonGroup.d.ts +1 -1
- package/dist/components/buttons/button-dropdown/ButtonDropdown.d.ts +1 -1
- package/dist/components/buttons/icon-button/IconButton.d.ts +1 -1
- package/dist/components/buttons/icon-button-dropdown/IconButtonDropdown.d.ts +1 -1
- package/dist/components/calendar-controls/CalendarControls.d.ts +2 -2
- package/dist/components/calendar-controls/elements/NavigationButtons.d.ts +2 -2
- package/dist/components/datepicker/DateTime.d.ts +11 -7
- package/dist/components/datepicker/Datepicker.d.ts +9 -9
- package/dist/components/datepicker/Time.d.ts +3 -2
- package/dist/components/dynamic-table/DynamicTable-utils.d.ts +7 -7
- package/dist/components/dynamic-table/DynamicTable.d.ts +2 -2
- package/dist/components/dynamic-table/interfaces.d.ts +3 -3
- package/dist/components/emptystate/EmptyState.d.ts +1 -1
- package/dist/components/filter-bar/FilterBar.d.ts +5 -5
- package/dist/components/filter-bar/filter-list/FilterList.d.ts +2 -2
- package/dist/components/filter-bar/filter-list/FilterListWithApply.d.ts +2 -2
- package/dist/components/filter-bar/filter-list/FilterSearch.d.ts +3 -3
- package/dist/components/filter-bar/filter-list/RemoteSearch.d.ts +3 -3
- package/dist/components/filter-bar/filter-pill/FilterPill.d.ts +2 -2
- package/dist/components/forms/ReadOnly.d.ts +1 -1
- package/dist/components/forms/SkedFormValidation.d.ts +3 -3
- package/dist/components/forms/elements/AsyncMultiSearchSelect.d.ts +2 -2
- package/dist/components/forms/elements/AsyncSearchSelect.d.ts +2 -2
- package/dist/components/forms/elements/FormElements.d.ts +6 -6
- package/dist/components/forms/elements/MultiSearchSelect.d.ts +2 -2
- package/dist/components/forms/elements/SearchSelect.d.ts +2 -2
- package/dist/components/forms/elements/interfaces.d.ts +6 -3
- package/dist/components/forms/elements/select-components.d.ts +3 -3
- package/dist/components/forms/elements/select-hooks.d.ts +1 -1
- package/dist/components/icon/Icon.d.ts +1 -1
- package/dist/components/info-card/InfoCard.d.ts +1 -1
- package/dist/components/inline-banner/InlineBanner.d.ts +1 -1
- package/dist/components/link/Link.d.ts +1 -1
- package/dist/components/link/Link.stories.d.ts +3 -3
- package/dist/components/loader/spinner/LoadingSpinner.d.ts +1 -1
- package/dist/components/modals/Modals.d.ts +5 -3
- package/dist/components/pagination/PaginationCount/PaginationCount.d.ts +1 -1
- package/dist/components/pagination/PaginationPages/PaginationPages.d.ts +4 -4
- package/dist/components/popout/PopOut.d.ts +3 -3
- package/dist/components/popups/info-window/InfoWindow.d.ts +1 -1
- package/dist/components/popups/info-window/LegacyInfoWindow.d.ts +3 -1
- package/dist/components/popups/overflow-tooltip/OverflowTooltip.d.ts +3 -2
- package/dist/components/popups/tooltip/Tooltip.d.ts +2 -2
- package/dist/components/portal/Portal.d.ts +1 -1
- package/dist/components/search-box/SearchBox.d.ts +1 -1
- package/dist/components/status-icon/StatusIcon.d.ts +1 -1
- package/dist/components/table/Table.d.ts +6 -6
- package/dist/components/tabs/Tabs/Tabs.d.ts +2 -2
- package/dist/components/tabs/Tabs/interfaces.d.ts +1 -0
- package/dist/index.js +2842 -3789
- package/package.json +8 -7
- package/yarn.lock +5 -11
- package/dist/components/popout/useClickAway.d.ts +0 -2
- package/dist/components/popups/info-window/InfoWindow.spec.d.ts +0 -1
- package/dist/components/popups/info-window/InfoWindowOld.d.ts +0 -160
- package/dist/components/popups/info-window/InfoWindowPopOut.d.ts +0 -84
- package/dist/components/popups/info-window/PortalWrapper.d.ts +0 -6
- package/dist/components/popups/info-window/useClickAway.d.ts +0 -25
- package/dist/components/popups/tooltip/LegacyInfoWindow.d.ts +0 -154
- package/dist/components/popups/tooltip/info-window-utils.d.ts +0 -43
- package/dist/components/popups/tooltip/info-window-utils.spec.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skedulo/sked-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "v0.0.1-react-18-preview",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"release": "npx semantic-release",
|
|
23
23
|
"lint": "eslint './src/**/*.{ts,tsx}'",
|
|
24
24
|
"check:types": "tsc --noEmit --pretty",
|
|
25
|
-
"lint:fix": "./node_modules/.bin/prettier --check --require-pragma false --write",
|
|
25
|
+
"lint:fix": "./node_modules/.bin/prettier --check --require-pragma false --write 'src/**/*.{ts,tsx}'",
|
|
26
26
|
"prepare": "husky install"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"@storybook/addons": "^6.5.12",
|
|
92
92
|
"@storybook/react": "^6.5.12",
|
|
93
93
|
"@storybook/theming": "^6.5.12",
|
|
94
|
+
"@testing-library/dom": "8.20.1",
|
|
94
95
|
"@testing-library/jest-dom": "^6.4.8",
|
|
95
96
|
"@testing-library/react": "13.4.0",
|
|
96
97
|
"@types/classnames": "^2.3.1",
|
|
@@ -147,12 +148,12 @@
|
|
|
147
148
|
"peerDependencies": {
|
|
148
149
|
"@types/classnames": ">=2.2.6",
|
|
149
150
|
"@types/lodash": ">=4.14.178",
|
|
150
|
-
"@types/react": "
|
|
151
|
-
"@types/react-dom": "
|
|
151
|
+
"@types/react": "18.3.1",
|
|
152
|
+
"@types/react-dom": "18.3.1",
|
|
152
153
|
"classnames": ">=2.2.6",
|
|
153
154
|
"lodash": ">=4",
|
|
154
|
-
"react": ">=
|
|
155
|
-
"react-dom": ">=
|
|
155
|
+
"react": ">=18.3.0",
|
|
156
|
+
"react-dom": ">=18.3.0"
|
|
156
157
|
},
|
|
157
158
|
"dependencies": {
|
|
158
159
|
"@popperjs/core": "^2.5.4",
|
|
@@ -169,7 +170,7 @@
|
|
|
169
170
|
"react-textarea-autosize": "8.3.2"
|
|
170
171
|
},
|
|
171
172
|
"resolutions": {
|
|
172
|
-
"@types/react": "
|
|
173
|
+
"@types/react": "18.3.0"
|
|
173
174
|
},
|
|
174
175
|
"lint-staged": {
|
|
175
176
|
"*.{ts,tsx}": [
|
package/yarn.lock
CHANGED
|
@@ -3484,7 +3484,7 @@
|
|
|
3484
3484
|
regenerator-runtime "^0.13.7"
|
|
3485
3485
|
resolve-from "^5.0.0"
|
|
3486
3486
|
|
|
3487
|
-
"@testing-library/dom@^8.5.0":
|
|
3487
|
+
"@testing-library/dom@8.20.1", "@testing-library/dom@^8.5.0":
|
|
3488
3488
|
version "8.20.1"
|
|
3489
3489
|
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.20.1.tgz#2e52a32e46fc88369eef7eef634ac2a192decd9f"
|
|
3490
3490
|
integrity sha512-/DiOQ5xBxgdYRC8LNk7U+RWat0S3qRLeIw3ZIkMQ9kkVlRmwD/Eg8k8CqIpD6GW7u20JIUOfMKbxtiLutpjQ4g==
|
|
@@ -3839,13 +3839,12 @@
|
|
|
3839
3839
|
dependencies:
|
|
3840
3840
|
"@types/react" "*"
|
|
3841
3841
|
|
|
3842
|
-
"@types/react@*", "@types/react@
|
|
3843
|
-
version "
|
|
3844
|
-
resolved "https://registry.yarnpkg.com/@types/react/-/react-
|
|
3845
|
-
integrity sha512-
|
|
3842
|
+
"@types/react@*", "@types/react@18.3.0":
|
|
3843
|
+
version "18.3.0"
|
|
3844
|
+
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.0.tgz#2e6ac50dea2f68f774b20f1bd536ef82365cd64a"
|
|
3845
|
+
integrity sha512-DiUcKjzE6soLyln8NNZmyhcQjVv+WsUIFSqetMN0p8927OztKT4VTfFTqsbAi5oAGIcgOmOajlfBqyptDDjZRw==
|
|
3846
3846
|
dependencies:
|
|
3847
3847
|
"@types/prop-types" "*"
|
|
3848
|
-
"@types/scheduler" "*"
|
|
3849
3848
|
csstype "^3.0.2"
|
|
3850
3849
|
|
|
3851
3850
|
"@types/react@18.3.7":
|
|
@@ -3873,11 +3872,6 @@
|
|
|
3873
3872
|
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d"
|
|
3874
3873
|
integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==
|
|
3875
3874
|
|
|
3876
|
-
"@types/scheduler@*":
|
|
3877
|
-
version "0.16.2"
|
|
3878
|
-
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
|
|
3879
|
-
integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==
|
|
3880
|
-
|
|
3881
3875
|
"@types/source-list-map@*":
|
|
3882
3876
|
version "0.1.2"
|
|
3883
3877
|
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IAnchorScores, ICursorOptions, ICursorPoints, Position as PositionType } from './info-window-utils';
|
|
3
|
-
interface InfoWindowState {
|
|
4
|
-
closeInfoWindow: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const InfoWindowContext: React.Context<InfoWindowState>;
|
|
7
|
-
export declare type Position = PositionType;
|
|
8
|
-
export declare type IEvent = 'click' | 'hover' | 'mount';
|
|
9
|
-
export interface IInfoWindowStyles<T> {
|
|
10
|
-
triangleStyles: {
|
|
11
|
-
top: T;
|
|
12
|
-
left: T;
|
|
13
|
-
};
|
|
14
|
-
contentStyles: {
|
|
15
|
-
top: T;
|
|
16
|
-
left: T;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface IRequiredProps {
|
|
20
|
-
/**
|
|
21
|
-
* Content to be shown inside the info window
|
|
22
|
-
*/
|
|
23
|
-
content: JSX.Element | JSX.Element[] | React.ReactNode | string;
|
|
24
|
-
/**
|
|
25
|
-
* Preferred direction around the trigger to open the info window
|
|
26
|
-
*/
|
|
27
|
-
position: Position;
|
|
28
|
-
}
|
|
29
|
-
export declare type IInfoWindowProps = IRequiredProps & {
|
|
30
|
-
children?: React.ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* IEvent type used to trigger the info window
|
|
33
|
-
*/
|
|
34
|
-
event?: IEvent;
|
|
35
|
-
/**
|
|
36
|
-
* Cursor options control what happens to the info window while moving the mouse within the trigger
|
|
37
|
-
*/
|
|
38
|
-
cursorOption?: ICursorOptions;
|
|
39
|
-
/**
|
|
40
|
-
* Delay the render of the info window after the trigger event has been fired
|
|
41
|
-
*/
|
|
42
|
-
delayShow?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Prevent the display of the info window regardless of the trigger event
|
|
45
|
-
*/
|
|
46
|
-
preventShow?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* ClassName to be given to the wrapper around the info window content
|
|
49
|
-
*/
|
|
50
|
-
containerClassName?: string;
|
|
51
|
-
/**
|
|
52
|
-
* ClassName to be given to the wrapper around the trigger component
|
|
53
|
-
*/
|
|
54
|
-
className?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Data attributes to be applied to the wrapper around the trigger component
|
|
57
|
-
*/
|
|
58
|
-
dataAttributes?: {
|
|
59
|
-
[key: string]: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Apply 'display: inline-block' style to the wrapper around the trigger component
|
|
63
|
-
*/
|
|
64
|
-
displayInline?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Render a close button within the wrapper around the info window content
|
|
67
|
-
*/
|
|
68
|
-
withCloseButton?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Offset the trigger points used to calculate the render positions by this number of pixels
|
|
71
|
-
*/
|
|
72
|
-
positionOffset?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Will be called when the mouse over event is fired on the trigger component
|
|
75
|
-
*/
|
|
76
|
-
onMouseOver?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
77
|
-
/**
|
|
78
|
-
* Will be called when the mouse leave event is fired on the trigger component
|
|
79
|
-
*/
|
|
80
|
-
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
81
|
-
/**
|
|
82
|
-
* Will be called when the info window is closed (regardless of the trigger event)
|
|
83
|
-
*/
|
|
84
|
-
onClose?: () => void;
|
|
85
|
-
/**
|
|
86
|
-
* Styles to apply to the wrapper around the trigger component
|
|
87
|
-
*/
|
|
88
|
-
style?: React.CSSProperties;
|
|
89
|
-
};
|
|
90
|
-
interface IState {
|
|
91
|
-
show: boolean;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* The infowindow module allows us to create an element next to an element. By setting props, we can determine the direction of its placement and how it gets triggered. The infowindow module has some smarts that will
|
|
95
|
-
detect if it's about to get rendered off the screen. If it is, it will adjust the placement of the infowindow until it can be rendered. If it cannot be rendered in any direction, the code will pick the direction
|
|
96
|
-
where the least amount of overflow is occuring. The order it tries to find a new placement in is top, right, down, left.
|
|
97
|
-
The above example uses a button as the trigger for the info window, but any html element can be used as long as its passed as a child of the <InfoWindow /> component
|
|
98
|
-
*/
|
|
99
|
-
export declare class InfoWindow extends React.PureComponent<IInfoWindowProps, IState> {
|
|
100
|
-
private _showDelayId;
|
|
101
|
-
private _triggerRef;
|
|
102
|
-
private _renderContainer;
|
|
103
|
-
private _contentRef;
|
|
104
|
-
private _triangleRef;
|
|
105
|
-
private _cursorPosition;
|
|
106
|
-
private _triggerRect;
|
|
107
|
-
constructor(props: IInfoWindowProps);
|
|
108
|
-
componentDidMount(): void;
|
|
109
|
-
componentDidUpdate(oldProps: IInfoWindowProps): void;
|
|
110
|
-
componentWillUnmount(): void;
|
|
111
|
-
computeStylesFromDisplayPosition: (anchor: IAnchorScores, triangleRect: ClientRect) => IInfoWindowStyles<number>;
|
|
112
|
-
setTriggerRef: (div: HTMLDivElement) => void;
|
|
113
|
-
setContentRef: (div: HTMLDivElement) => void;
|
|
114
|
-
setTriangleRef: (span: HTMLSpanElement) => void;
|
|
115
|
-
showHideToggle: () => void;
|
|
116
|
-
setShow: (show: boolean) => void;
|
|
117
|
-
handleBodyClick: (e: MouseEvent) => void;
|
|
118
|
-
handleScroll: () => void;
|
|
119
|
-
onTriggerClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
120
|
-
onMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
121
|
-
onMouseLeave: (e: React.MouseEvent<any>) => void;
|
|
122
|
-
onMouseMove: (e: MouseEvent) => void;
|
|
123
|
-
getDisplayPosition: (triggerPoint: ICursorPoints, triggerRect: ClientRect, triangleRect: ClientRect, contentRect: ClientRect) => IAnchorScores;
|
|
124
|
-
closeInfoWindow(): void;
|
|
125
|
-
notTargetArea(e: MouseEvent): boolean;
|
|
126
|
-
registerMousePosition(e: MouseEvent | React.MouseEvent<any> | null): void;
|
|
127
|
-
detachEventListeners(): void;
|
|
128
|
-
attachEventListeners(): void;
|
|
129
|
-
computeStyles(): {
|
|
130
|
-
contentStyles: React.CSSProperties;
|
|
131
|
-
triangleStyles: React.CSSProperties;
|
|
132
|
-
position: PositionType;
|
|
133
|
-
} | {
|
|
134
|
-
position: PositionType;
|
|
135
|
-
triangleStyles: {
|
|
136
|
-
top: string;
|
|
137
|
-
left: string;
|
|
138
|
-
} | {
|
|
139
|
-
top: string;
|
|
140
|
-
left: string;
|
|
141
|
-
};
|
|
142
|
-
contentStyles: {
|
|
143
|
-
top: string;
|
|
144
|
-
left: string;
|
|
145
|
-
} | {
|
|
146
|
-
top: string;
|
|
147
|
-
left: string;
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
removeRenderingContainer(): void;
|
|
151
|
-
createRenderContainer(): HTMLDivElement;
|
|
152
|
-
/**
|
|
153
|
-
* The first render wont be positioned properly since we don't have the width/height to calculate the position.
|
|
154
|
-
* `runStyleRender` runs a second render when we have the contentContainer rendered to calculate the position.
|
|
155
|
-
*/
|
|
156
|
-
renderContent(runStyleRender?: boolean): void;
|
|
157
|
-
render(): JSX.Element;
|
|
158
|
-
}
|
|
159
|
-
export declare const useInfoWindow: () => InfoWindowState;
|
|
160
|
-
export {};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ICursorOptions, Position as PositionType } from './info-window-utils';
|
|
3
|
-
declare type Position = PositionType;
|
|
4
|
-
declare type IEvent = 'click' | 'hover' | 'mount';
|
|
5
|
-
export interface IPopOutRequiredProps {
|
|
6
|
-
/**
|
|
7
|
-
* Content to be shown inside the info window
|
|
8
|
-
*/
|
|
9
|
-
content: JSX.Element | JSX.Element[] | React.ReactNode | string;
|
|
10
|
-
/**
|
|
11
|
-
* Preferred direction around the trigger to open the info window
|
|
12
|
-
*/
|
|
13
|
-
position: Position;
|
|
14
|
-
}
|
|
15
|
-
export declare type IInfoWindowPopOutProps = IPopOutRequiredProps & {
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* IEvent type used to trigger the info window
|
|
19
|
-
*/
|
|
20
|
-
event?: IEvent;
|
|
21
|
-
/**
|
|
22
|
-
* Cursor options control what happens to the info window while moving the mouse within the trigger
|
|
23
|
-
*/
|
|
24
|
-
cursorOption?: ICursorOptions;
|
|
25
|
-
/**
|
|
26
|
-
* Delay the render of the info window after the trigger event has been fired
|
|
27
|
-
*/
|
|
28
|
-
delayShow?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Prevent the display of the info window regardless of the trigger event
|
|
31
|
-
*/
|
|
32
|
-
preventShow?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* ClassName to be given to the wrapper around the info window content
|
|
35
|
-
*/
|
|
36
|
-
containerClassName?: string;
|
|
37
|
-
/**
|
|
38
|
-
* ClassName to be given to the wrapper around the trigger component
|
|
39
|
-
*/
|
|
40
|
-
className?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Data attributes to be applied to the wrapper around the trigger component
|
|
43
|
-
*/
|
|
44
|
-
dataAttributes?: {
|
|
45
|
-
[key: string]: string;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Apply 'display: inline-block' style to the wrapper around the trigger component
|
|
49
|
-
*/
|
|
50
|
-
displayInline?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Render a close button within the wrapper around the info window content
|
|
53
|
-
*/
|
|
54
|
-
withCloseButton?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Offset the trigger points used to calculate the render positions by this number of pixels
|
|
57
|
-
*/
|
|
58
|
-
positionOffset?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Will be called when the mouse over event is fired on the trigger component
|
|
61
|
-
*/
|
|
62
|
-
onMouseOver?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Will be called when the mouse leave event is fired on the trigger component
|
|
65
|
-
*/
|
|
66
|
-
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Will be called when the info window is closed (regardless of the trigger event)
|
|
69
|
-
*/
|
|
70
|
-
onClose?: () => void;
|
|
71
|
-
/**
|
|
72
|
-
* Styles to apply to the wrapper around the trigger component
|
|
73
|
-
*/
|
|
74
|
-
style?: React.CSSProperties;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* The infowindow module allows us to create an element next to an element. By setting props, we can determine the direction of its placement and how it gets triggered. The infowindow module has some smarts that will
|
|
78
|
-
detect if it's about to get rendered off the screen. If it is, it will adjust the placement of the infowindow until it can be rendered. If it cannot be rendered in any direction, the code will pick the direction
|
|
79
|
-
where the least amount of overflow is occuring. The order it tries to find a new placement in is top, right, down, left.
|
|
80
|
-
The above example uses a button as the trigger for the info window, but any html element can be used as long as its passed as a child of the <InfoWindow /> component
|
|
81
|
-
*/
|
|
82
|
-
export declare const UnmemoizedInfoWindowPopOut: (props: IInfoWindowPopOutProps) => JSX.Element;
|
|
83
|
-
export declare const InfoWindowPopOut: React.MemoExoticComponent<(props: IInfoWindowPopOutProps) => JSX.Element>;
|
|
84
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Triggers callback when user clicks outside target area.
|
|
4
|
-
* https://github.com/streamich/react-use/blob/master/src/useClickAway.ts
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
*
|
|
8
|
-
* const Demo = () => {
|
|
9
|
-
* const ref = useRef<HTMLDivElement>(null)
|
|
10
|
-
*
|
|
11
|
-
* useClickAway(ref, () => {
|
|
12
|
-
* console.log('OUTSIDE CLICKED')
|
|
13
|
-
* })
|
|
14
|
-
*
|
|
15
|
-
* return <div ref={ref}>Content</div>
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
|
-
* Reference:
|
|
19
|
-
*
|
|
20
|
-
* useClickAway(ref, onMouseEvent)
|
|
21
|
-
* useClickAway(ref, onMouseEvent, ['click'])
|
|
22
|
-
* useClickAway(ref, onMouseEvent, ['mousedown', 'touchstart'])
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
export declare const useClickAway: <E extends Event = Event>(ref: RefObject<HTMLElement | null>, onClickAway: (event: E) => void, events?: string[]) => void;
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IAnchorScores, ICursorOptions, ICursorPoints, Position } from './info-window-utils';
|
|
3
|
-
export declare type IEvent = 'click' | 'hover' | 'mount';
|
|
4
|
-
export interface IInfoWindowStyles<T> {
|
|
5
|
-
triangleStyles: {
|
|
6
|
-
top: T;
|
|
7
|
-
left: T;
|
|
8
|
-
};
|
|
9
|
-
contentStyles: {
|
|
10
|
-
top: T;
|
|
11
|
-
left: T;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface IRequiredProps {
|
|
15
|
-
/**
|
|
16
|
-
* Content to be shown inside the info window
|
|
17
|
-
*/
|
|
18
|
-
content: JSX.Element | JSX.Element[] | React.ReactNode | string;
|
|
19
|
-
/**
|
|
20
|
-
* Preferred direction around the trigger to open the info window
|
|
21
|
-
*/
|
|
22
|
-
position: Position;
|
|
23
|
-
}
|
|
24
|
-
export declare type IInfoWindowProps = IRequiredProps & {
|
|
25
|
-
children?: React.ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
* IEvent type used to trigger the info window
|
|
28
|
-
*/
|
|
29
|
-
event?: IEvent;
|
|
30
|
-
/**
|
|
31
|
-
* Cursor options control what happens to the info window while moving the mouse within the trigger
|
|
32
|
-
*/
|
|
33
|
-
cursorOption?: ICursorOptions;
|
|
34
|
-
/**
|
|
35
|
-
* Delay the render of the info window after the trigger event has been fired
|
|
36
|
-
*/
|
|
37
|
-
delayShow?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Prevent the display of the info window regardless of the trigger event
|
|
40
|
-
*/
|
|
41
|
-
preventShow?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* ClassName to be given to the wrapper around the info window content
|
|
44
|
-
*/
|
|
45
|
-
containerClassName?: string;
|
|
46
|
-
/**
|
|
47
|
-
* ClassName to be given to the wrapper around the trigger component
|
|
48
|
-
*/
|
|
49
|
-
className?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Data attributes to be applied to the wrapper around the trigger component
|
|
52
|
-
*/
|
|
53
|
-
dataAttributes?: {
|
|
54
|
-
[key: string]: string;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Apply 'display: inline-block' style to the wrapper around the trigger component
|
|
58
|
-
*/
|
|
59
|
-
displayInline?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Render a close button within the wrapper around the info window content
|
|
62
|
-
*/
|
|
63
|
-
withCloseButton?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Offset the trigger points used to calculate the render positions by this number of pixels
|
|
66
|
-
*/
|
|
67
|
-
positionOffset?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Will be called when the mouse over event is fired on the trigger component
|
|
70
|
-
*/
|
|
71
|
-
onMouseOver?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Will be called when the mouse leave event is fired on the trigger component
|
|
74
|
-
*/
|
|
75
|
-
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
76
|
-
/**
|
|
77
|
-
* Will be called when the info window is closed (regardless of the trigger event)
|
|
78
|
-
*/
|
|
79
|
-
onClose?: () => void;
|
|
80
|
-
/**
|
|
81
|
-
* Styles to apply to the wrapper around the trigger component
|
|
82
|
-
*/
|
|
83
|
-
style?: React.CSSProperties;
|
|
84
|
-
};
|
|
85
|
-
interface IState {
|
|
86
|
-
show: boolean;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* The infowindow module allows us to create an element next to an element. By setting props, we can determine the direction of its placement and how it gets triggered. The infowindow module has some smarts that will
|
|
90
|
-
detect if it's about to get rendered off the screen. If it is, it will adjust the placement of the infowindow until it can be rendered. If it cannot be rendered in any direction, the code will pick the direction
|
|
91
|
-
where the least amount of overflow is occuring. The order it tries to find a new placement in is top, right, down, left.
|
|
92
|
-
The above example uses a button as the trigger for the info window, but any html element can be used as long as its passed as a child of the <InfoWindow /> component
|
|
93
|
-
*/
|
|
94
|
-
export declare class LegacyInfoWindow extends React.PureComponent<IInfoWindowProps, IState> {
|
|
95
|
-
private _showDelayId;
|
|
96
|
-
private _triggerRef;
|
|
97
|
-
private _renderContainer;
|
|
98
|
-
private _contentRef;
|
|
99
|
-
private _triangleRef;
|
|
100
|
-
private _cursorPosition;
|
|
101
|
-
private _triggerRect;
|
|
102
|
-
constructor(props: IInfoWindowProps);
|
|
103
|
-
componentDidMount(): void;
|
|
104
|
-
componentDidUpdate(oldProps: IInfoWindowProps): void;
|
|
105
|
-
componentWillUnmount(): void;
|
|
106
|
-
computeStylesFromDisplayPosition: (anchor: IAnchorScores, triangleRect: ClientRect) => IInfoWindowStyles<number>;
|
|
107
|
-
setTriggerRef: (div: HTMLDivElement) => void;
|
|
108
|
-
setContentRef: (div: HTMLDivElement) => void;
|
|
109
|
-
setTriangleRef: (span: HTMLSpanElement) => void;
|
|
110
|
-
showHideToggle: () => void;
|
|
111
|
-
setShow: (show: boolean) => void;
|
|
112
|
-
handleBodyClick: (e: MouseEvent) => void;
|
|
113
|
-
handleScroll: () => void;
|
|
114
|
-
onTriggerClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
115
|
-
onMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
116
|
-
onMouseLeave: (e: React.MouseEvent<any>) => void;
|
|
117
|
-
onMouseMove: (e: MouseEvent) => void;
|
|
118
|
-
getDisplayPosition: (triggerPoint: ICursorPoints, triggerRect: ClientRect, triangleRect: ClientRect, contentRect: ClientRect) => IAnchorScores;
|
|
119
|
-
closeInfoWindow(): void;
|
|
120
|
-
notTargetArea(e: MouseEvent): boolean;
|
|
121
|
-
registerMousePosition(e: MouseEvent | React.MouseEvent<any> | null): void;
|
|
122
|
-
detachEventListeners(): void;
|
|
123
|
-
attachEventListeners(): void;
|
|
124
|
-
computeStyles(): {
|
|
125
|
-
contentStyles: React.CSSProperties;
|
|
126
|
-
triangleStyles: React.CSSProperties;
|
|
127
|
-
position: Position;
|
|
128
|
-
} | {
|
|
129
|
-
position: Position;
|
|
130
|
-
triangleStyles: {
|
|
131
|
-
top: string;
|
|
132
|
-
left: string;
|
|
133
|
-
} | {
|
|
134
|
-
top: string;
|
|
135
|
-
left: string;
|
|
136
|
-
};
|
|
137
|
-
contentStyles: {
|
|
138
|
-
top: string;
|
|
139
|
-
left: string;
|
|
140
|
-
} | {
|
|
141
|
-
top: string;
|
|
142
|
-
left: string;
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
removeRenderingContainer(): void;
|
|
146
|
-
createRenderContainer(): HTMLDivElement;
|
|
147
|
-
/**
|
|
148
|
-
* The first render wont be positioned properly since we don't have the width/height to calculate the position.
|
|
149
|
-
* `runStyleRender` runs a second render when we have the contentContainer rendered to calculate the position.
|
|
150
|
-
*/
|
|
151
|
-
renderContent(runStyleRender?: boolean): void;
|
|
152
|
-
render(): JSX.Element;
|
|
153
|
-
}
|
|
154
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface ICursorPoints {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
}
|
|
5
|
-
export interface ICursorOptions {
|
|
6
|
-
rule: 'follow' | 'follow-x' | 'follow-y';
|
|
7
|
-
keepOnMouseMove?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare type Position = 'top' | 'right' | 'bottom' | 'left';
|
|
10
|
-
export declare const getPositionEvalOrder: (position: Position) => Position[];
|
|
11
|
-
interface IAnchorPoint {
|
|
12
|
-
position: Position;
|
|
13
|
-
point: ICursorPoints;
|
|
14
|
-
}
|
|
15
|
-
export interface IAnchorScores extends IAnchorPoint {
|
|
16
|
-
display: ClientRect;
|
|
17
|
-
displayScore: number;
|
|
18
|
-
distanceScore: number;
|
|
19
|
-
weightedScore: number;
|
|
20
|
-
}
|
|
21
|
-
export declare const getAnchorPoints: (triggerPoint: ICursorPoints, triggerRect: ClientRect, triangleRect: ClientRect, windowRect: ClientRect, cursorOptions: ICursorOptions) => IAnchorPoint[];
|
|
22
|
-
export declare const getPositionScores: (triggerPoint: ICursorPoints, triggerRect: ClientRect, contentRect: ClientRect, triangleRect: ClientRect, windowRect: ClientRect, cursorOptions: ICursorOptions, anchorOffset?: number) => IAnchorScores[];
|
|
23
|
-
export declare const getBestFit: (desiredOrder: Position[], positionScores: IAnchorScores[]) => IAnchorScores;
|
|
24
|
-
export declare const adjustContentDisplayCoordinates: (anchor: IAnchorScores, windowRect: ClientRect) => {
|
|
25
|
-
display: {
|
|
26
|
-
left: number;
|
|
27
|
-
right: number;
|
|
28
|
-
height: number;
|
|
29
|
-
width: number;
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
bottom: number;
|
|
33
|
-
top: number;
|
|
34
|
-
toJSON(): any;
|
|
35
|
-
};
|
|
36
|
-
displayScore: number;
|
|
37
|
-
distanceScore: number;
|
|
38
|
-
weightedScore: number;
|
|
39
|
-
position: Position;
|
|
40
|
-
point: ICursorPoints;
|
|
41
|
-
};
|
|
42
|
-
export declare const notTargetAreas: (elements: (Element | HTMLElement)[], e: MouseEvent) => boolean;
|
|
43
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|