@skedulo/sked-ui 0.0.0-preview-react-18

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.
Files changed (203) hide show
  1. package/README.md +107 -0
  2. package/dist/components/IntersectionObserverWrapper/IntersectionObserverWrapper.d.ts +39 -0
  3. package/dist/components/IntersectionObserverWrapper/IntersectionObserverWrapper.stories.d.ts +1 -0
  4. package/dist/components/avatar/Avatar.d.ts +46 -0
  5. package/dist/components/avatar/Avatar.stories.d.ts +1 -0
  6. package/dist/components/avatar/AvatarDetail.d.ts +18 -0
  7. package/dist/components/avatar/AvatarGroup.d.ts +27 -0
  8. package/dist/components/avatar/Slot.d.ts +42 -0
  9. package/dist/components/avatar/__tests__/Avatar.spec.d.ts +1 -0
  10. package/dist/components/avatar/__tests__/AvatarDetail.spec.d.ts +1 -0
  11. package/dist/components/avatar/__tests__/GroupAvatars.spec.d.ts +1 -0
  12. package/dist/components/avatar/__tests__/Slot.spec.d.ts +1 -0
  13. package/dist/components/badge/Badge.d.ts +18 -0
  14. package/dist/components/badge/Badge.stories.d.ts +17 -0
  15. package/dist/components/badge/__tests__/Badge.spec.d.ts +1 -0
  16. package/dist/components/button-group/ButtonGroup.d.ts +6 -0
  17. package/dist/components/button-group/ButtonGroup.stories.d.ts +1 -0
  18. package/dist/components/button-group/__tests__/ButtonGroup.spec.d.ts +1 -0
  19. package/dist/components/buttons/Buttons.stories.d.ts +1 -0
  20. package/dist/components/buttons/button/Button.d.ts +60 -0
  21. package/dist/components/buttons/button/__tests__/Button.spec.d.ts +1 -0
  22. package/dist/components/buttons/button-dropdown/ButtonDropdown.d.ts +14 -0
  23. package/dist/components/buttons/button-dropdown/__tests__/ButtonDropdown.spec.d.ts +1 -0
  24. package/dist/components/buttons/icon-button/IconButton.d.ts +13 -0
  25. package/dist/components/buttons/icon-button/__tests__/IconButton.spec.d.ts +1 -0
  26. package/dist/components/buttons/icon-button-dropdown/IconButtonDropdown.d.ts +5 -0
  27. package/dist/components/buttons/icon-button-dropdown/__tests__/IconButtonDropdown.spec.d.ts +1 -0
  28. package/dist/components/buttons/interfaces.d.ts +10 -0
  29. package/dist/components/calendar-controls/CalendarControls-utils.d.ts +7 -0
  30. package/dist/components/calendar-controls/CalendarControls.d.ts +30 -0
  31. package/dist/components/calendar-controls/CalendarControls.stories.d.ts +1 -0
  32. package/dist/components/calendar-controls/elements/DateSelector.d.ts +47 -0
  33. package/dist/components/calendar-controls/elements/NavigationButtons.d.ts +6 -0
  34. package/dist/components/calendar-controls/elements/RangePicker.d.ts +21 -0
  35. package/dist/components/calendar-controls/elements/TodayButton.d.ts +5 -0
  36. package/dist/components/datepicker/DateTime.d.ts +51 -0
  37. package/dist/components/datepicker/DateTime.stories.d.ts +1 -0
  38. package/dist/components/datepicker/Datepicker.d.ts +125 -0
  39. package/dist/components/datepicker/Datepicker.stories.d.ts +1 -0
  40. package/dist/components/datepicker/Time.d.ts +43 -0
  41. package/dist/components/datepicker/Time.stories.d.ts +1 -0
  42. package/dist/components/datepicker/__tests__/DateTime.spec.d.ts +1 -0
  43. package/dist/components/datepicker/__tests__/Datepicker.spec.d.ts +1 -0
  44. package/dist/components/datepicker/__tests__/Time.spec.d.ts +1 -0
  45. package/dist/components/dynamic-table/DynamicTable-utils.d.ts +45 -0
  46. package/dist/components/dynamic-table/DynamicTable.d.ts +79 -0
  47. package/dist/components/dynamic-table/DynamicTable.stories.d.ts +1 -0
  48. package/dist/components/dynamic-table/__tests__/DynamicTable-renders.spec.d.ts +1 -0
  49. package/dist/components/dynamic-table/__tests__/DynamicTable-test-utils.d.ts +3 -0
  50. package/dist/components/dynamic-table/__tests__/DynamicTable-utils.spec.d.ts +1 -0
  51. package/dist/components/dynamic-table/__tests__/DynamicTable.spec.d.ts +1 -0
  52. package/dist/components/dynamic-table/__tests__/__mocks__/table-data.d.ts +16 -0
  53. package/dist/components/dynamic-table/interfaces.d.ts +52 -0
  54. package/dist/components/emptystate/EmptyState.d.ts +9 -0
  55. package/dist/components/emptystate/EmptyState.spec.d.ts +1 -0
  56. package/dist/components/emptystate/EmptyState.stories.d.ts +1 -0
  57. package/dist/components/filter-bar/FilterBar.d.ts +54 -0
  58. package/dist/components/filter-bar/FilterBar.stories.d.ts +1 -0
  59. package/dist/components/filter-bar/__tests__/FilterBar.spec.d.ts +1 -0
  60. package/dist/components/filter-bar/filter-list/FilterList.d.ts +10 -0
  61. package/dist/components/filter-bar/filter-list/FilterListWithApply.d.ts +24 -0
  62. package/dist/components/filter-bar/filter-list/FilterSearch.d.ts +21 -0
  63. package/dist/components/filter-bar/filter-list/RemoteSearch.d.ts +25 -0
  64. package/dist/components/filter-bar/filter-list/__tests__/FilterList.spec.d.ts +1 -0
  65. package/dist/components/filter-bar/filter-list/__tests__/FilterListWithApply.spec.d.ts +1 -0
  66. package/dist/components/filter-bar/filter-list/__tests__/FilterSearch.spec.d.ts +1 -0
  67. package/dist/components/filter-bar/filter-list/__tests__/RemoteSearch.spec.d.ts +1 -0
  68. package/dist/components/filter-bar/filter-pill/FilterPill.d.ts +23 -0
  69. package/dist/components/filter-bar/filter-pill/__tests__/FilterPill.spec.d.ts +1 -0
  70. package/dist/components/filter-bar/interfaces.d.ts +43 -0
  71. package/dist/components/forms/Forms.stories.d.ts +1 -0
  72. package/dist/components/forms/ReadOnly.d.ts +11 -0
  73. package/dist/components/forms/SkedFormValidation.d.ts +98 -0
  74. package/dist/components/forms/SkedFormValidation.spec.d.ts +1 -0
  75. package/dist/components/forms/__tests__/ReadOnly.spec.d.ts +1 -0
  76. package/dist/components/forms/elements/AsyncMultiSearchSelect.d.ts +3 -0
  77. package/dist/components/forms/elements/AsyncSearchSelect.d.ts +6 -0
  78. package/dist/components/forms/elements/AsyncSelectSearch.stories.d.ts +1 -0
  79. package/dist/components/forms/elements/FormElements.d.ts +54 -0
  80. package/dist/components/forms/elements/MultiSearchSelect.d.ts +3 -0
  81. package/dist/components/forms/elements/MultiSearchSelect.stories.d.ts +1 -0
  82. package/dist/components/forms/elements/NumberInput.d.ts +17 -0
  83. package/dist/components/forms/elements/PlainAsyncMultiSearchSelect.d.ts +8 -0
  84. package/dist/components/forms/elements/PlainAsyncMultiSearchSelect.stories.d.ts +1 -0
  85. package/dist/components/forms/elements/PlainMultiSearchSelect.d.ts +24 -0
  86. package/dist/components/forms/elements/PlainMultiSearchSelect.stories.d.ts +1 -0
  87. package/dist/components/forms/elements/SearchSelect.d.ts +6 -0
  88. package/dist/components/forms/elements/SearchSelect.stories.d.ts +1 -0
  89. package/dist/components/forms/elements/TextArea.d.ts +25 -0
  90. package/dist/components/forms/elements/TextArea.spec.d.ts +1 -0
  91. package/dist/components/forms/elements/__tests__/AsyncMultiSearchSelect.spec.d.ts +1 -0
  92. package/dist/components/forms/elements/__tests__/AsyncSearchSelect.spec.d.ts +1 -0
  93. package/dist/components/forms/elements/__tests__/FormElements.spec.d.ts +1 -0
  94. package/dist/components/forms/elements/__tests__/MultiSearchSelect.spec.d.ts +1 -0
  95. package/dist/components/forms/elements/__tests__/NumberInput.spec.d.ts +1 -0
  96. package/dist/components/forms/elements/__tests__/PlainAsyncMultiSearchSelect.spec.d.ts +1 -0
  97. package/dist/components/forms/elements/__tests__/PlainMultiSearchSelect.spec.d.ts +1 -0
  98. package/dist/components/forms/elements/__tests__/SearchSelect-renders.spec.d.ts +1 -0
  99. package/dist/components/forms/elements/__tests__/SearchSelect.spec.d.ts +1 -0
  100. package/dist/components/forms/elements/__tests__/__mocks__/searchData.d.ts +11 -0
  101. package/dist/components/forms/elements/interfaces.d.ts +105 -0
  102. package/dist/components/forms/elements/select-components.d.ts +38 -0
  103. package/dist/components/forms/elements/select-hooks.d.ts +38 -0
  104. package/dist/components/forms/elements/select-utils.d.ts +22 -0
  105. package/dist/components/icon/Icon.d.ts +26 -0
  106. package/dist/components/icon/Icon.spec.d.ts +1 -0
  107. package/dist/components/icon/Icon.stories.d.ts +1 -0
  108. package/dist/components/icon/iconPaths.d.ts +131 -0
  109. package/dist/components/info-card/InfoCard.d.ts +5 -0
  110. package/dist/components/info-card/InfoCard.stories.d.ts +1 -0
  111. package/dist/components/info-card/InfoCardBody.d.ts +13 -0
  112. package/dist/components/info-card/InfoCardFooter.d.ts +2 -0
  113. package/dist/components/info-card/InfoCardHeader.d.ts +11 -0
  114. package/dist/components/info-card/index.d.ts +4 -0
  115. package/dist/components/inline-banner/InlineBanner.d.ts +9 -0
  116. package/dist/components/inline-banner/InlineBanner.spec.d.ts +1 -0
  117. package/dist/components/inline-banner/InlineBanner.stories.d.ts +1 -0
  118. package/dist/components/link/Link.d.ts +5 -0
  119. package/dist/components/link/Link.spec.d.ts +1 -0
  120. package/dist/components/link/Link.stories.d.ts +17 -0
  121. package/dist/components/loader/Loading.d.ts +16 -0
  122. package/dist/components/loader/Loading.stories.d.ts +1 -0
  123. package/dist/components/loader/__tests__/Loading.spec.d.ts +1 -0
  124. package/dist/components/loader/spinner/LoadingSpinner.d.ts +21 -0
  125. package/dist/components/lozenge/CustomLozenge.d.ts +21 -0
  126. package/dist/components/lozenge/Lozenge.d.ts +22 -0
  127. package/dist/components/lozenge/Lozenge.stories.d.ts +1 -0
  128. package/dist/components/lozenge/__tests__/Lozenge.spec.d.ts +1 -0
  129. package/dist/components/menus/Menus.stories.d.ts +1 -0
  130. package/dist/components/menus/actionmenu/ActionMenu.d.ts +13 -0
  131. package/dist/components/menus/cardactionmenu/CardActionMenu.d.ts +10 -0
  132. package/dist/components/menus/index.d.ts +2 -0
  133. package/dist/components/menus/menu/Menu.d.ts +18 -0
  134. package/dist/components/modals/Modal.spec.d.ts +1 -0
  135. package/dist/components/modals/Modal.stories.d.ts +1 -0
  136. package/dist/components/modals/Modals.d.ts +33 -0
  137. package/dist/components/pagination/Pagination-utils.d.ts +1 -0
  138. package/dist/components/pagination/Pagination-utils.spec.d.ts +1 -0
  139. package/dist/components/pagination/Pagination.d.ts +3 -0
  140. package/dist/components/pagination/Pagination.spec.d.ts +1 -0
  141. package/dist/components/pagination/Pagination.stories.d.ts +1 -0
  142. package/dist/components/pagination/PaginationCount/PaginationCount.d.ts +3 -0
  143. package/dist/components/pagination/PaginationCount/PaginationCount.spec.d.ts +1 -0
  144. package/dist/components/pagination/PaginationPages/PaginationPages.d.ts +14 -0
  145. package/dist/components/pagination/PaginationPages/PaginationPages.spec.d.ts +1 -0
  146. package/dist/components/pagination/interfaces.d.ts +18 -0
  147. package/dist/components/pill/Pill.d.ts +25 -0
  148. package/dist/components/pill/Pill.spec.d.ts +1 -0
  149. package/dist/components/pill/Pill.stories.d.ts +1 -0
  150. package/dist/components/popout/PopOut.d.ts +61 -0
  151. package/dist/components/popout/PopOut.stories.d.ts +1 -0
  152. package/dist/components/popout/PopOutBase.d.ts +39 -0
  153. package/dist/components/popout/useClickAway.d.ts +2 -0
  154. package/dist/components/popout/usePopOut.d.ts +9 -0
  155. package/dist/components/popups/info-window/InfoWindow.d.ts +45 -0
  156. package/dist/components/popups/info-window/InfoWindow.spec.d.ts +1 -0
  157. package/dist/components/popups/info-window/InfoWindow.stories.d.ts +1 -0
  158. package/dist/components/popups/info-window/InfoWindowOld.d.ts +160 -0
  159. package/dist/components/popups/info-window/InfoWindowPopOut.d.ts +84 -0
  160. package/dist/components/popups/info-window/LegacyInfoWindow.d.ts +159 -0
  161. package/dist/components/popups/info-window/PortalWrapper.d.ts +6 -0
  162. package/dist/components/popups/info-window/info-window-utils.d.ts +43 -0
  163. package/dist/components/popups/info-window/info-window-utils.spec.d.ts +1 -0
  164. package/dist/components/popups/info-window/useClickAway.d.ts +25 -0
  165. package/dist/components/popups/info-window/useInfoWindowModifiers.d.ts +2 -0
  166. package/dist/components/popups/overflow-tooltip/OverflowTooltip.d.ts +30 -0
  167. package/dist/components/popups/tooltip/LegacyInfoWindow.d.ts +154 -0
  168. package/dist/components/popups/tooltip/Tooltip.d.ts +21 -0
  169. package/dist/components/popups/tooltip/Tooltip.spec.d.ts +1 -0
  170. package/dist/components/popups/tooltip/Tooltip.stories.d.ts +1 -0
  171. package/dist/components/popups/tooltip/info-window-utils.d.ts +43 -0
  172. package/dist/components/popups/tooltip/info-window-utils.spec.d.ts +1 -0
  173. package/dist/components/portal/Portal.d.ts +22 -0
  174. package/dist/components/search-box/SearchBox.d.ts +9 -0
  175. package/dist/components/search-box/SearchBox.spec.d.ts +1 -0
  176. package/dist/components/status-icon/StatusIcon.d.ts +11 -0
  177. package/dist/components/status-icon/StatusIcon.spec.d.ts +1 -0
  178. package/dist/components/status-icon/StatusIcon.stories.d.ts +1 -0
  179. package/dist/components/table/Table.d.ts +16 -0
  180. package/dist/components/table/Table.spec.d.ts +1 -0
  181. package/dist/components/table/Table.stories.d.ts +1 -0
  182. package/dist/components/tabs/Tabs/Tabs.d.ts +36 -0
  183. package/dist/components/tabs/Tabs/TabsMenuItem.d.ts +22 -0
  184. package/dist/components/tabs/Tabs/TabsRoutingUtils.d.ts +28 -0
  185. package/dist/components/tabs/Tabs/__tests__/Tabs.spec.d.ts +1 -0
  186. package/dist/components/tabs/Tabs/__tests__/TabsMenuItem.spec.d.ts +1 -0
  187. package/dist/components/tabs/Tabs/__tests__/TabsRoutingUtils.spec.d.ts +1 -0
  188. package/dist/components/tabs/Tabs/interfaces.d.ts +64 -0
  189. package/dist/components/tabs/Tabs.stories.d.ts +1 -0
  190. package/dist/components/text/MultilineContent.d.ts +6 -0
  191. package/dist/components/text/MultilineContent.spec.d.ts +1 -0
  192. package/dist/hooks/useDebounce.d.ts +1 -0
  193. package/dist/index.d.ts +59 -0
  194. package/dist/index.js +66690 -0
  195. package/dist/utils/Option.d.ts +58 -0
  196. package/dist/utils/Option.spec.d.ts +1 -0
  197. package/dist/utils/Route.d.ts +4 -0
  198. package/dist/utils/Strings.d.ts +1 -0
  199. package/dist/utils/Types.d.ts +6 -0
  200. package/dist/utils/__tests__/Route.spec.d.ts +1 -0
  201. package/dist/utils/testing-utils.d.ts +7 -0
  202. package/package.json +179 -0
  203. package/yarn.lock +17865 -0
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import { IPopOutProps } from '../../popout/PopOut';
3
+ import { ICursorOptions } from './info-window-utils';
4
+ export interface IRequiredProps {
5
+ /**
6
+ * Content to be shown inside the info window
7
+ */
8
+ content: JSX.Element | JSX.Element[] | React.ReactNode | string;
9
+ /**
10
+ * Preferred direction around the trigger to open the info window
11
+ */
12
+ position: IPopOutProps['placement'];
13
+ }
14
+ export declare type IPopOutPropsSubset = IRequiredProps & Omit<IPopOutProps, 'children' | 'trigger' | 'showArrow'>;
15
+ export declare type IInfoWindowEvent = 'click' | 'mount';
16
+ export declare type IInfoWindowProps = IPopOutPropsSubset & {
17
+ children: React.ReactNode;
18
+ /**
19
+ * Event type used to trigger the info window, 'hover' is now deprecated
20
+ */
21
+ event?: IInfoWindowEvent;
22
+ /**
23
+ * Deprecated: Cursor options control what happens to the info window while moving the mouse within the trigger
24
+ */
25
+ cursorOption?: ICursorOptions;
26
+ /**
27
+ * ClassName to be given to the wrapper around the info window content
28
+ */
29
+ containerClassName?: string;
30
+ /**
31
+ * Data attributes to be applied to the wrapper around the trigger component
32
+ */
33
+ dataAttributes?: {
34
+ [key: string]: string;
35
+ };
36
+ /**
37
+ * Render a close button within the wrapper around the info window content
38
+ */
39
+ withCloseButton?: boolean;
40
+ /**
41
+ * Styles to apply to the wrapper around the trigger component
42
+ */
43
+ style?: React.CSSProperties;
44
+ };
45
+ export declare const InfoWindow: (props: IInfoWindowProps) => JSX.Element;
@@ -0,0 +1,160 @@
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 {};
@@ -0,0 +1,84 @@
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 {};
@@ -0,0 +1,159 @@
1
+ import * as React from 'react';
2
+ import { IAnchorScores, ICursorOptions, ICursorPoints, Position } from './info-window-utils';
3
+ declare type ILegacyInfoWindowEvent = 'click' | 'hover' | 'mount';
4
+ 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 ILegacyInfoWindowRequiredProps {
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 ILegacyInfoWindowProps = ILegacyInfoWindowRequiredProps & {
25
+ children?: React.ReactNode;
26
+ /**
27
+ * ILegacyInfoWindowEvent type used to trigger the info window
28
+ */
29
+ event?: ILegacyInfoWindowEvent;
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 render of the info window after the trigger event has been fired
36
+ */
37
+ delayShow?: number;
38
+ /**
39
+ * Prevent the display of the pop out 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 LegacyInfoWindow 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<ILegacyInfoWindowProps, 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: ILegacyInfoWindowProps);
103
+ componentDidMount(): void;
104
+ componentDidUpdate(oldProps: ILegacyInfoWindowProps): 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 declare const InfoWindowContext: React.Context<InfoWindowState>;
155
+ interface InfoWindowState {
156
+ closeInfoWindow: () => void;
157
+ }
158
+ export declare const useLegacyInfoWindow: () => InfoWindowState;
159
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface ModalProps {
3
+ children?: React.ReactNode;
4
+ }
5
+ export declare const PortalWrapper: ({ children }: ModalProps) => React.ReactPortal;
6
+ export {};
@@ -0,0 +1,43 @@
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 {};
@@ -0,0 +1,25 @@
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;
@@ -0,0 +1,2 @@
1
+ import { StrictModifier } from 'react-popper';
2
+ export declare const useInfoWindowModifiers: (updatePositionWhenChanged: any) => (StrictModifier<import("react-popper").StrictModifierNames> | Partial<import("@popperjs/core").Modifier<"handleOverflowPositions", {}>>)[];
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import { ITooltipPosition, ITooltipProps } from '../tooltip/Tooltip';
3
+ export interface IOverflowTooltipProps extends Pick<ITooltipProps, 'dataAttributes'> {
4
+ /** Maximum width the element expands to before being cut off */
5
+ maxWidth?: number;
6
+ className?: string;
7
+ tooltipClassName?: string;
8
+ position?: ITooltipPosition;
9
+ }
10
+ export interface IOverflowTooltipState {
11
+ overflow: boolean;
12
+ }
13
+ /**
14
+ * OverflowTooltip will ellipse content after the specified maxWidth prop or from the
15
+ * parent containers calculated width and apply a Tooltip to allow users to see the full
16
+ * content on hover
17
+ * @requires Tooltip
18
+ */
19
+ export declare class OverflowTooltip extends React.PureComponent<IOverflowTooltipProps, IOverflowTooltipState> {
20
+ static defaultProps: {
21
+ position: string;
22
+ };
23
+ _element: HTMLDivElement;
24
+ constructor(props: IOverflowTooltipProps);
25
+ componentDidMount(): void;
26
+ refElement: (element: HTMLDivElement) => void;
27
+ checkOverflow: () => void;
28
+ isTextOverflow(): boolean;
29
+ render(): JSX.Element;
30
+ }