@via-profit/ui-kit 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/CONTRIBUTING.md +0 -0
  3. package/LICENSE +21 -0
  4. package/README.md +17 -0
  5. package/dist/Autocomplete/index.d.ts +46 -0
  6. package/dist/Autocomplete/index.js +187 -0
  7. package/dist/Autocomplete/popper-options.d.ts +4 -0
  8. package/dist/Autocomplete/popper-options.js +33 -0
  9. package/dist/Button/ButtonAccent.d.ts +10 -0
  10. package/dist/Button/ButtonAccent.js +48 -0
  11. package/dist/Button/ButtonBase.d.ts +4 -0
  12. package/dist/Button/ButtonBase.js +38 -0
  13. package/dist/Button/ButtonStandard.d.ts +19 -0
  14. package/dist/Button/ButtonStandard.js +50 -0
  15. package/dist/Button/index.d.ts +9 -0
  16. package/dist/Button/index.js +27 -0
  17. package/dist/Calendar/CalendarBottomBar.d.ts +4 -0
  18. package/dist/Calendar/CalendarBottomBar.js +28 -0
  19. package/dist/Calendar/CalendarCell.d.ts +8 -0
  20. package/dist/Calendar/CalendarCell.js +61 -0
  21. package/dist/Calendar/CalendarDateContainer.d.ts +6 -0
  22. package/dist/Calendar/CalendarDateContainer.js +13 -0
  23. package/dist/Calendar/CalendarEmptyCell.d.ts +4 -0
  24. package/dist/Calendar/CalendarEmptyCell.js +29 -0
  25. package/dist/Calendar/CalendarMonthControl.d.ts +6 -0
  26. package/dist/Calendar/CalendarMonthControl.js +49 -0
  27. package/dist/Calendar/CalendarPaper.d.ts +6 -0
  28. package/dist/Calendar/CalendarPaper.js +20 -0
  29. package/dist/Calendar/CalendarTopBar.d.ts +4 -0
  30. package/dist/Calendar/CalendarTopBar.js +30 -0
  31. package/dist/Calendar/CalendarWeekDayLabel.d.ts +6 -0
  32. package/dist/Calendar/CalendarWeekDayLabel.js +17 -0
  33. package/dist/Calendar/CalendarWeekDaysBar.d.ts +10 -0
  34. package/dist/Calendar/CalendarWeekDaysBar.js +32 -0
  35. package/dist/Calendar/CalendarWeekRow.d.ts +6 -0
  36. package/dist/Calendar/CalendarWeekRow.js +14 -0
  37. package/dist/Calendar/IconChevronLeft.d.ts +3 -0
  38. package/dist/Calendar/IconChevronLeft.js +9 -0
  39. package/dist/Calendar/IconChevronRight.d.ts +3 -0
  40. package/dist/Calendar/IconChevronRight.js +9 -0
  41. package/dist/Calendar/index.d.ts +18 -0
  42. package/dist/Calendar/index.js +166 -0
  43. package/dist/Calendar/use-calendar.d.ts +50 -0
  44. package/dist/Calendar/use-calendar.js +197 -0
  45. package/dist/DatePicker/index.d.ts +3 -0
  46. package/dist/DatePicker/index.js +8 -0
  47. package/dist/ErrorBoundary/index.d.ts +19 -0
  48. package/dist/ErrorBoundary/index.js +78 -0
  49. package/dist/Image/index.d.ts +7 -0
  50. package/dist/Image/index.js +45 -0
  51. package/dist/MaskedField/index.d.ts +33 -0
  52. package/dist/MaskedField/index.js +63 -0
  53. package/dist/MaskedField/templates.d.ts +11 -0
  54. package/dist/MaskedField/templates.js +81 -0
  55. package/dist/MaskedField/useMasked.d.ts +18 -0
  56. package/dist/MaskedField/useMasked.js +96 -0
  57. package/dist/Menu/MenuItem.d.ts +10 -0
  58. package/dist/Menu/MenuItem.js +47 -0
  59. package/dist/Menu/MenuItemInner.d.ts +7 -0
  60. package/dist/Menu/MenuItemInner.js +48 -0
  61. package/dist/Menu/MenuWrapper.d.ts +10 -0
  62. package/dist/Menu/MenuWrapper.js +77 -0
  63. package/dist/Menu/index.d.ts +196 -0
  64. package/dist/Menu/index.js +452 -0
  65. package/dist/Menu/popper-options.d.ts +4 -0
  66. package/dist/Menu/popper-options.js +33 -0
  67. package/dist/Menu/reducer.d.ts +14 -0
  68. package/dist/Menu/reducer.js +19 -0
  69. package/dist/Modal/CloseIcon.d.ts +3 -0
  70. package/dist/Modal/CloseIcon.js +37 -0
  71. package/dist/Modal/ModalConfirmBox.d.ts +9 -0
  72. package/dist/Modal/ModalConfirmBox.js +148 -0
  73. package/dist/Modal/ModalDialog.d.ts +7 -0
  74. package/dist/Modal/ModalDialog.js +99 -0
  75. package/dist/Modal/ModalDrawer.d.ts +11 -0
  76. package/dist/Modal/ModalDrawer.js +150 -0
  77. package/dist/Modal/ModalMessageBox.d.ts +8 -0
  78. package/dist/Modal/ModalMessageBox.js +147 -0
  79. package/dist/Modal/index.d.ts +12 -0
  80. package/dist/Modal/index.js +54 -0
  81. package/dist/NoSSR/index.d.ts +7 -0
  82. package/dist/NoSSR/index.js +15 -0
  83. package/dist/PhoneField/CountryFlag.d.ts +6 -0
  84. package/dist/PhoneField/CountryFlag.js +52 -0
  85. package/dist/PhoneField/flags/BYFlag.d.ts +3 -0
  86. package/dist/PhoneField/flags/BYFlag.js +44 -0
  87. package/dist/PhoneField/flags/JPFlag.d.ts +3 -0
  88. package/dist/PhoneField/flags/JPFlag.js +34 -0
  89. package/dist/PhoneField/flags/KZFlag.d.ts +3 -0
  90. package/dist/PhoneField/flags/KZFlag.js +45 -0
  91. package/dist/PhoneField/flags/RUFlag.d.ts +3 -0
  92. package/dist/PhoneField/flags/RUFlag.js +32 -0
  93. package/dist/PhoneField/flags/UAFlag.d.ts +3 -0
  94. package/dist/PhoneField/flags/UAFlag.js +31 -0
  95. package/dist/PhoneField/flags/USFlag.d.ts +3 -0
  96. package/dist/PhoneField/flags/USFlag.js +34 -0
  97. package/dist/PhoneField/flags/UnknownFlag.d.ts +3 -0
  98. package/dist/PhoneField/flags/UnknownFlag.js +34 -0
  99. package/dist/PhoneField/index.d.ts +49 -0
  100. package/dist/PhoneField/index.js +82 -0
  101. package/dist/PhoneField/templates.d.ts +3 -0
  102. package/dist/PhoneField/templates.js +18 -0
  103. package/dist/PhoneField/usePhoneUtils.d.ts +65 -0
  104. package/dist/PhoneField/usePhoneUtils.js +157 -0
  105. package/dist/SelectBox/IconChevronDown.d.ts +3 -0
  106. package/dist/SelectBox/IconChevronDown.js +9 -0
  107. package/dist/SelectBox/SelectButton.d.ts +10 -0
  108. package/dist/SelectBox/SelectButton.js +80 -0
  109. package/dist/SelectBox/index.d.ts +40 -0
  110. package/dist/SelectBox/index.js +188 -0
  111. package/dist/SelectBox/popper-options.d.ts +4 -0
  112. package/dist/SelectBox/popper-options.js +33 -0
  113. package/dist/TextField/TextFieldContainer.d.ts +7 -0
  114. package/dist/TextField/TextFieldContainer.js +52 -0
  115. package/dist/TextField/TextFieldErrorText.d.ts +8 -0
  116. package/dist/TextField/TextFieldErrorText.js +75 -0
  117. package/dist/TextField/TextFieldIconWrapper.d.ts +8 -0
  118. package/dist/TextField/TextFieldIconWrapper.js +73 -0
  119. package/dist/TextField/TextFieldInput.d.ts +7 -0
  120. package/dist/TextField/TextFieldInput.js +60 -0
  121. package/dist/TextField/TextFieldLabel.d.ts +7 -0
  122. package/dist/TextField/TextFieldLabel.js +50 -0
  123. package/dist/TextField/TextFieldLabelAsterisk.d.ts +7 -0
  124. package/dist/TextField/TextFieldLabelAsterisk.js +51 -0
  125. package/dist/TextField/TextFieldWrapper.d.ts +14 -0
  126. package/dist/TextField/TextFieldWrapper.js +76 -0
  127. package/dist/TextField/index.d.ts +14 -0
  128. package/dist/TextField/index.js +93 -0
  129. package/dist/ThemeProvider/createTheme.d.ts +36 -0
  130. package/dist/ThemeProvider/createTheme.js +34 -0
  131. package/dist/ThemeProvider/index.d.ts +8 -0
  132. package/dist/ThemeProvider/index.js +12 -0
  133. package/dist/Typography/Base.d.ts +6 -0
  134. package/dist/Typography/Base.js +11 -0
  135. package/dist/Typography/Blockquote.d.ts +6 -0
  136. package/dist/Typography/Blockquote.js +23 -0
  137. package/dist/Typography/Del.d.ts +6 -0
  138. package/dist/Typography/Del.js +10 -0
  139. package/dist/Typography/Em.d.ts +6 -0
  140. package/dist/Typography/Em.js +10 -0
  141. package/dist/Typography/H1.d.ts +6 -0
  142. package/dist/Typography/H1.js +11 -0
  143. package/dist/Typography/H2.d.ts +6 -0
  144. package/dist/Typography/H2.js +11 -0
  145. package/dist/Typography/H3.d.ts +6 -0
  146. package/dist/Typography/H3.js +11 -0
  147. package/dist/Typography/H4.d.ts +6 -0
  148. package/dist/Typography/H4.js +11 -0
  149. package/dist/Typography/H5.d.ts +6 -0
  150. package/dist/Typography/H5.js +11 -0
  151. package/dist/Typography/List.d.ts +14 -0
  152. package/dist/Typography/List.js +17 -0
  153. package/dist/Typography/Paragraph.d.ts +6 -0
  154. package/dist/Typography/Paragraph.js +11 -0
  155. package/dist/Typography/SectionDescription.d.ts +8 -0
  156. package/dist/Typography/SectionDescription.js +17 -0
  157. package/dist/Typography/SectionTitle.d.ts +8 -0
  158. package/dist/Typography/SectionTitle.js +31 -0
  159. package/dist/Typography/Span.d.ts +6 -0
  160. package/dist/Typography/Span.js +10 -0
  161. package/dist/Typography/Strong.d.ts +6 -0
  162. package/dist/Typography/Strong.js +10 -0
  163. package/dist/Typography/U.d.ts +6 -0
  164. package/dist/Typography/U.js +10 -0
  165. package/dist/color/Color.d.ts +44 -0
  166. package/dist/color/Color.js +346 -0
  167. package/dist/color/index.d.ts +3 -0
  168. package/dist/color/index.js +22 -0
  169. package/dist/index.d.ts +4 -0
  170. package/dist/index.js +23 -0
  171. package/package.json +113 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const react_1 = __importDefault(require("react"));
18
+ const MenuItemInner_1 = __importDefault(require("./MenuItemInner"));
19
+ const MenuItem = (props, ref) => {
20
+ const { style, setRowHeight, index, children, selected, hovered } = props, nativeProps = __rest(props, ["style", "setRowHeight", "index", "children", "selected", "hovered"]);
21
+ const itemRef = react_1.default.useRef(null);
22
+ const heightRef = react_1.default.useRef(0);
23
+ /**
24
+ * Update list of sizes if height changed
25
+ */
26
+ react_1.default.useEffect(() => {
27
+ if (itemRef.current) {
28
+ const height = itemRef.current.getBoundingClientRect().height;
29
+ if (heightRef.current !== height) {
30
+ heightRef.current = height;
31
+ setRowHeight(index, height);
32
+ }
33
+ }
34
+ }, [setRowHeight, index]);
35
+ return (react_1.default.createElement("div", { style: style },
36
+ react_1.default.createElement("div", Object.assign({}, nativeProps, { ref: el => {
37
+ itemRef.current = el;
38
+ if (ref && typeof ref === 'object') {
39
+ ref.current = el;
40
+ }
41
+ if (ref && typeof ref === 'function') {
42
+ ref(el);
43
+ }
44
+ } }),
45
+ react_1.default.createElement(MenuItemInner_1.default, { selected: selected, hovered: hovered }, children))));
46
+ };
47
+ exports.default = react_1.default.forwardRef(MenuItem);
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface MenuItemInnerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ readonly selected: boolean;
4
+ readonly hovered: boolean;
5
+ }
6
+ declare const _default: React.ForwardRefExoticComponent<MenuItemInnerProps & React.RefAttributes<HTMLDivElement>>;
7
+ export default _default;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const react_1 = __importDefault(require("react"));
18
+ const styled_1 = __importDefault(require("@emotion/styled"));
19
+ const InnerContainer = styled_1.default.div `
20
+ cursor: pointer;
21
+ user-select: none;
22
+ padding: 0.4em 0.8em;
23
+ transition: all 240ms ease-out;
24
+ border-radius: ${({ theme }) => theme.shape.radiusFactor * 1}em;
25
+ background-color: ${({ theme, selected, hovered }) => {
26
+ if (selected && hovered) {
27
+ return theme.colors.accentPrimary().darken(0.1).toString();
28
+ }
29
+ if (selected) {
30
+ return theme.colors.accentPrimary().toString();
31
+ }
32
+ if (hovered) {
33
+ return theme.colors.backgroundGrey().darken(0.04).toString();
34
+ }
35
+ return 'inherit';
36
+ }};
37
+ color: ${({ theme, selected }) => {
38
+ if (selected) {
39
+ return theme.colors.accentPrimaryContrast().toString();
40
+ }
41
+ return 'inherit';
42
+ }};
43
+ `;
44
+ const MenuItemInner = (props, ref) => {
45
+ const { children, selected, hovered } = props, nativeProps = __rest(props, ["children", "selected", "hovered"]);
46
+ return (react_1.default.createElement(InnerContainer, Object.assign({}, nativeProps, { selected: selected, hovered: hovered, ref: ref }), children));
47
+ };
48
+ exports.default = react_1.default.forwardRef(MenuItemInner);
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface MenuWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ readonly isOpen: boolean;
4
+ readonly dimensions: {
5
+ readonly width: number;
6
+ readonly height: number;
7
+ };
8
+ }
9
+ declare const _default: React.ForwardRefExoticComponent<MenuWrapperProps & React.RefAttributes<HTMLDivElement>>;
10
+ export default _default;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const react_1 = __importDefault(require("react"));
18
+ const styled_1 = __importDefault(require("@emotion/styled"));
19
+ const StyledMenuWrapper = styled_1.default.div `
20
+ flex: 1;
21
+ display: flex;
22
+ flex-direction: column;
23
+ display: flex;
24
+ flex-direction: column;
25
+ transition: visibility 120ms ease-out, opacity 120ms ease-out;
26
+ opacity: ${props => (props.$isOpen ? 1 : 0)};
27
+ visibility: ${props => (props.$isOpen ? 'visible' : 'hidden')};
28
+ background-color: ${({ theme }) => theme.colors.backgroundPrimary().toString()};
29
+ border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
30
+ box-shadow: 0 4px 24px
31
+ ${({ theme }) => theme.colors.backgroundPrimary().darken(0.5).alpha(0.6).toString()};
32
+ &:focus {
33
+ outline: none;
34
+ }
35
+ & ::-webkit-scrollbar {
36
+ width: 0.6rem;
37
+ height: 0.6rem;
38
+ }
39
+
40
+ & ::-webkit-scrollbar-corner {
41
+ background: none;
42
+ }
43
+
44
+ & ::-webkit-scrollbar-track {
45
+ background: ${({ theme }) => theme.isDark
46
+ ? theme.colors.backgroundPrimary().darken(0.1).toString()
47
+ : theme.colors.backgroundPrimary().darken(0.05).toString()};
48
+ }
49
+
50
+ & ::-webkit-scrollbar-thumb {
51
+ background: ${({ theme }) => theme.isDark
52
+ ? theme.colors.backgroundSecondary().lighten(0.3).toString()
53
+ : theme.colors.backgroundSecondary().darken(0.3).toString()};
54
+ border-radius: 0.3rem;
55
+ }
56
+
57
+ & ::-webkit-scrollbar-thumb:horizontal:hover,
58
+ & ::-webkit-scrollbar-thumb:vertical:hover {
59
+ background: ${({ theme }) => theme.colors.accentPrimary().toString()};
60
+ }
61
+ `;
62
+ const MenuWrapperInner = styled_1.default.div `
63
+ padding: 0.4em;
64
+ box-sizing: content-box;
65
+ min-width: ${({ dimensions }) => dimensions.width}px;
66
+ min-height: ${({ dimensions }) => dimensions.height}px;
67
+ `;
68
+ const MenuWrapper = (props, ref) => {
69
+ const { isOpen, dimensions, children } = props, nativeProps = __rest(props, ["isOpen", "dimensions", "children"]);
70
+ const [isOpenState, setOpenState] = react_1.default.useState(false);
71
+ react_1.default.useEffect(() => {
72
+ setOpenState(isOpen);
73
+ }, [isOpen]);
74
+ return (react_1.default.createElement(StyledMenuWrapper, Object.assign({}, nativeProps, { ref: ref, "$isOpen": isOpenState }),
75
+ react_1.default.createElement(MenuWrapperInner, { dimensions: dimensions }, children)));
76
+ };
77
+ exports.default = react_1.default.forwardRef(MenuWrapper);
@@ -0,0 +1,196 @@
1
+ import React from 'react';
2
+ import { VariableSizeList as VirtualizedList } from 'react-window';
3
+ import options from './popper-options';
4
+ export interface MenuProps<T, Multiple extends boolean | undefined = undefined> {
5
+ /**
6
+ * List of items
7
+ */
8
+ readonly items: readonly T[];
9
+ /**
10
+ * Current value\
11
+ * If `Menu` component has `multiple` property then value must be an array of items
12
+ */
13
+ readonly value: Value<T, Multiple> | null;
14
+ /**
15
+ * Estimated item height. Need to calculate menu height\
16
+ * \
17
+ * **Default**: `50`
18
+ */
19
+ readonly estimatedItemSize?: number;
20
+ /**
21
+ * Menu open state
22
+ */
23
+ readonly isOpen?: boolean;
24
+ /**
25
+ * The threshold is the number of items from the end of the list,
26
+ * upon reaching which the additional loading of new items will begin\
27
+ * \
28
+ * **Default**: `10`
29
+ */
30
+ readonly endThreshold?: number;
31
+ /**
32
+ * The thresholdPercent is the persont of items from the end of the list in percents value\
33
+ * Dependent of `onEndReached` property\
34
+ * \
35
+ * **Default**: `30`
36
+ */
37
+ readonly thresholdPercent?: number;
38
+ /**
39
+ * Autofocus list after menu open\
40
+ * Dependent of `onEndReached` property\
41
+ * \
42
+ * **Default**: `true`
43
+ */
44
+ readonly autofocus?: boolean;
45
+ /**
46
+ * tabindex property for the list. Tabindex is required to be able to set focus on a list item\
47
+ * \
48
+ * **Default**: `-1`
49
+ */
50
+ readonly tabIndex?: number;
51
+ /**
52
+ * The delay in milliseconds before the focus moves to the list at the time of its opening.\
53
+ * Used only if `autofocus` property is true\
54
+ * \
55
+ * **Default**: `250`
56
+ */
57
+ readonly autofocusDelay?: number;
58
+ /**
59
+ * The number of items to render outside of the visible area. This property can be important for two reasons:
60
+ *
61
+ * - Overscanning by one row allows the tab key to focus on the next (not yet visible) item.
62
+ * - Overscanning slightly can reduce or prevent a flash of empty space when a user first starts scrolling.
63
+ *
64
+ * Note that overscanning too much can negatively impact performance.\
65
+ * \
66
+ * **Default**: `1`
67
+ */
68
+ readonly overscanCount?: number;
69
+ /**
70
+ * An HTML element. It's used to set the position of the menu.
71
+ */
72
+ readonly anchorElement: HTMLElement | null;
73
+ /**
74
+ * Close list if click outside of list\
75
+ * \
76
+ * **Default**: `true`
77
+ */
78
+ readonly closeOutsideClick?: boolean;
79
+ /**
80
+ * Allow the multiple selection
81
+ */
82
+ readonly multiple?: Multiple;
83
+ /**
84
+ * z-index property\
85
+ * \
86
+ * **Default**: `1`
87
+ */
88
+ readonly zIndex?: number;
89
+ /**
90
+ * @popperjs/core component options\
91
+ * \
92
+ * **Default**: used special preset
93
+ */
94
+ readonly popperOptions?: typeof options;
95
+ /**
96
+ * An element for the React.createPortal node\
97
+ * \
98
+ * **Default**: `document.body`
99
+ */
100
+ readonly portalNode?: (() => HTMLElement) | HTMLElement;
101
+ /**
102
+ * The reference of the outer list HTML element
103
+ */
104
+ readonly outerRef?: React.MutableRefObject<OuterListType | null>;
105
+ /**
106
+ * The API reference of the virtualized list
107
+ */
108
+ readonly listRef?: React.MutableRefObject<VirtualizedListType<T> | null>;
109
+ /**
110
+ * A function that determines which of the elements is currently selected
111
+ */
112
+ readonly getOptionSelected?: GetOptionSelected<T>;
113
+ /**
114
+ * The function that will be called when the list reaches the end
115
+ */
116
+ readonly onEndReached?: () => void;
117
+ /**
118
+ * Called when item selected
119
+ */
120
+ readonly onSelectItem?: OnSelectItem<T, Multiple>;
121
+ /**
122
+ * A function that renders each list item
123
+ */
124
+ readonly renderItem?: RenderItem<T>;
125
+ /**
126
+ * The function that will be called at the moment when you want to close the menu
127
+ */
128
+ readonly onRequestClose: OnRequestClose;
129
+ }
130
+ export type MenuRef<T> = {
131
+ /**
132
+ * Scroll to specified item index
133
+ */
134
+ scrollToItem: VirtualizedListType<T>['scrollToItem'];
135
+ /**
136
+ * Scroll by offset (px)
137
+ */
138
+ scrollTo: VirtualizedListType<T>['scrollTo'];
139
+ /**
140
+ * Scroll list to first of selected item
141
+ */
142
+ scrollToFirstSelected: () => void;
143
+ /**
144
+ * Select specified item by index
145
+ */
146
+ selectItem: (index: number) => void;
147
+ /**
148
+ * Hightlight specified item by index
149
+ */
150
+ highlightIndex: (index: number) => void;
151
+ /**
152
+ * Highlight the previous item relative to the currently highlighted one
153
+ */
154
+ hightlightPrevItem: () => void;
155
+ /**
156
+ * Highlight the next item relative to the currently highlighted one
157
+ */
158
+ hightlightNextItem: () => void;
159
+ /**
160
+ * Highlight the first item in list
161
+ */
162
+ hightlightFirstItem: () => void;
163
+ /**
164
+ * Highlight the last item in list
165
+ */
166
+ hightlightLastItem: () => void;
167
+ /**
168
+ * Select hightlighted item
169
+ */
170
+ selectHightlightedItem: () => void;
171
+ /**
172
+ * Force re-render popper element
173
+ */
174
+ updatePopper: () => void;
175
+ /**
176
+ * Force set focus to list
177
+ */
178
+ focus: () => void;
179
+ };
180
+ export type VirtualizedListType<T> = VirtualizedList<T>;
181
+ export type OuterListType = HTMLDivElement;
182
+ export type Value<T, Multiple> = Multiple extends undefined | undefined ? T : readonly T[];
183
+ export type GetOptionSelected<T> = (payload: {
184
+ readonly item: T;
185
+ readonly value: T;
186
+ }) => boolean;
187
+ export type RenderItem<T> = (payload: {
188
+ readonly item: T;
189
+ readonly index: number;
190
+ }) => React.ReactNode;
191
+ export type OnSelectItem<T, Multiple extends boolean | undefined = undefined> = (value: Value<T, Multiple>) => void;
192
+ export type OnRequestClose = (event?: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement> | KeyboardEvent | MouseEvent) => void;
193
+ declare const _default: <T, Multiple extends boolean | undefined = undefined>(props: MenuProps<T, Multiple> & {
194
+ ref?: React.Ref<MenuRef<T>> | undefined;
195
+ }) => JSX.Element;
196
+ export default _default;