@via-profit/ui-kit 0.1.8 → 0.2.1-alpha.3
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/Accordion/index.d.ts +4 -4
- package/Autocomplete/AutocompleteContainer.d.ts +34 -7
- package/Autocomplete/AutocompleteContainer.js +28 -24
- package/Autocomplete/AutocompleteItem.d.ts +1 -1
- package/Autocomplete/AutocompleteTextField.d.ts +3 -0
- package/Autocomplete/AutocompleteTextField.js +63 -1
- package/Autocomplete/OverrideMenuList.d.ts +4 -0
- package/Autocomplete/OverrideMenuList.js +39 -0
- package/Autocomplete/context.d.ts +9 -1
- package/Autocomplete/context.js +15 -1
- package/Autocomplete/index.js +9 -10
- package/Autocomplete2/Autocomplete2.d.ts +12 -0
- package/Autocomplete2/Autocomplete2.js +83 -0
- package/Autocomplete2/Autocomplete2TextField.d.ts +7 -0
- package/Autocomplete2/Autocomplete2TextField.js +39 -0
- package/Autocomplete2/index.d.ts +2 -0
- package/Autocomplete2/index.js +7 -0
- package/Avatar/AvatarBase.d.ts +4 -4
- package/Avatar/index.js +1 -1
- package/Badge/BadgeBase.d.ts +4 -4
- package/Badge/BadgeDeleteButton.js +6 -6
- package/Badge/BadgeOutlined.js +2 -2
- package/Badge/BadgeStandard.js +1 -1
- package/Button/ButtonBase.d.ts +3 -3
- package/Button/ButtonOutlined.js +1 -1
- package/Button/ButtonPlain.js +1 -1
- package/Button/ButtonStandard.js +4 -11
- package/Calendar/CalendarCell.js +22 -4
- package/Calendar/CalendarComponent.d.ts +226 -0
- package/Calendar/CalendarComponent.js +572 -0
- package/Calendar/CalendarControlButton.js +16 -9
- package/Calendar/CalendarDayBadge.js +1 -1
- package/Calendar/CalendarEmptyCell.d.ts +2 -2
- package/Calendar/CalendarEmptyCell.js +8 -3
- package/Calendar/CalendarHeading.js +2 -1
- package/Calendar/CalendarMonthCell.js +0 -5
- package/Calendar/CalendarSubheading.js +3 -2
- package/Calendar/CalendarWeekDayCell.d.ts +10 -0
- package/Calendar/CalendarWeekDayCell.js +32 -0
- package/Calendar/CalendarWeekDayWeekNumber.d.ts +7 -0
- package/Calendar/CalendarWeekDayWeekNumber.js +38 -0
- package/Calendar/CalendarWeekRow.d.ts +2 -2
- package/Calendar/CalendarWeekRow.js +2 -1
- package/Calendar/CalendarWeekRowButton.d.ts +13 -0
- package/Calendar/CalendarWeekRowButton.js +31 -0
- package/Calendar/CalendarYearCell.js +5 -5
- package/Calendar/CalendarYearsSelector.d.ts +39 -1
- package/Calendar/CalendarYearsSelector.js +52 -16
- package/Calendar/IconChevronDown.d.ts +3 -0
- package/Calendar/IconChevronDown.js +31 -0
- package/Calendar/index.d.ts +7 -220
- package/Calendar/index.js +19 -274
- package/Calendar/use-calendar.d.ts +1 -1
- package/Calendar/use-calendar.js +102 -155
- package/Color/Color.d.ts +138 -0
- package/Color/Color.js +324 -0
- package/Color/ColorGenerator.d.ts +29 -0
- package/Color/ColorGenerator.js +141 -0
- package/Color/ColorParser.d.ts +20 -0
- package/Color/ColorParser.js +284 -0
- package/Color/index.d.ts +4 -122
- package/Color/index.js +18 -473
- package/DatePicker/index.d.ts +2 -17
- package/DatePicker/index.js +47 -61
- package/DatePicker/useDatePickerFormat.js +5 -5
- package/ErrorBoundary/Fallback.d.ts +3 -0
- package/ErrorBoundary/Fallback.js +51 -0
- package/ErrorBoundary/RenderError.d.ts +6 -0
- package/ErrorBoundary/RenderError.js +80 -0
- package/ErrorBoundary/index.d.ts +7 -11
- package/ErrorBoundary/index.js +4 -51
- package/Highlighted/index.d.ts +3 -3
- package/LoadingIndicator/Spinner.d.ts +5 -3
- package/LoadingIndicator/Spinner.js +61 -32
- package/LoadingIndicator/index.d.ts +3 -3
- package/LoadingIndicator/index.js +15 -2
- package/MaskedField/index.d.ts +1 -1
- package/MaskedField/index.js +11 -10
- package/Menu/AutoHeightWrapper.d.ts +6 -0
- package/Menu/AutoHeightWrapper.js +43 -0
- package/Menu/MeasuredItem.d.ts +10 -0
- package/Menu/MeasuredItem.js +51 -0
- package/Menu/MenuContainer.d.ts +53 -20
- package/Menu/MenuContainer.js +18 -11
- package/Menu/MenuItem.d.ts +24 -7
- package/Menu/MenuItem.js +13 -6
- package/Menu/MenuList.d.ts +4 -2
- package/Menu/MenuList.js +26 -6
- package/Menu/VirtualizedItem.d.ts +22 -0
- package/Menu/VirtualizedItem.js +69 -0
- package/Menu/VirtualizedList.d.ts +18 -0
- package/Menu/VirtualizedList.js +28 -0
- package/Menu/VirtualizedListComponent.d.ts +20 -0
- package/Menu/VirtualizedListComponent.js +305 -0
- package/Menu/index.d.ts +3 -1
- package/Menu/index.js +4 -7
- package/Modal/BaseModal/RenderModal.d.ts +3 -3
- package/Modal/BaseModal/index.d.ts +3 -3
- package/Modal/ConfirmBox/index.d.ts +5 -5
- package/Modal/Drawer/index.d.ts +5 -5
- package/Modal/MessageBox/index.d.ts +5 -5
- package/Popper/Popper.d.ts +148 -0
- package/Popper/Popper.js +113 -0
- package/Popper/PopperContainer.d.ts +2 -0
- package/Popper/PopperContainer.js +3 -6
- package/Popper/index.d.ts +5 -22
- package/Popper/index.js +18 -264
- package/Popper/usePopprer.d.ts +110 -0
- package/Popper/usePopprer.js +505 -0
- package/Selectbox/SelectboxButton.d.ts +5 -0
- package/Selectbox/SelectboxButton.js +48 -8
- package/Selectbox/SelectboxButtonWrapper.d.ts +2 -0
- package/Selectbox/SelectboxButtonWrapper.js +1 -17
- package/Selectbox/SelectboxMenu.d.ts +12 -0
- package/Selectbox/SelectboxMenu.js +50 -0
- package/Selectbox/index.d.ts +13 -13
- package/Selectbox/index.js +115 -97
- package/Surface/index.d.ts +5 -5
- package/Surface/index.js +1 -1
- package/Swiper/Swiper.d.ts +44 -0
- package/Swiper/Swiper.js +139 -0
- package/Swiper/SwiperContainer.d.ts +7 -0
- package/Swiper/SwiperContainer.js +14 -0
- package/Swiper/SwiperSlide.d.ts +7 -0
- package/Swiper/SwiperSlide.js +55 -0
- package/Swiper/SwiperTrack.d.ts +14 -0
- package/Swiper/SwiperTrack.js +58 -0
- package/Swiper/SwiperWrapper.d.ts +14 -0
- package/Swiper/SwiperWrapper.js +60 -0
- package/Swiper/index.d.ts +7 -0
- package/Swiper/index.js +26 -0
- package/Switch/SwitchDot.js +1 -1
- package/Switch/SwitchTrack.js +1 -1
- package/Switch/index.d.ts +8 -8
- package/TextArea/index.d.ts +7 -7
- package/TextField/TextFieldContainer.d.ts +2 -2
- package/TextField/TextFieldContainer.js +5 -3
- package/TextField/TextFieldErrorText.d.ts +2 -2
- package/TextField/TextFieldErrorText.js +5 -4
- package/TextField/TextFieldIconWrapper.d.ts +3 -3
- package/TextField/TextFieldIconWrapper.js +5 -3
- package/TextField/TextFieldInput.d.ts +2 -2
- package/TextField/TextFieldInput.js +6 -4
- package/TextField/TextFieldInputWrapper.d.ts +2 -2
- package/TextField/TextFieldInputWrapper.js +5 -3
- package/TextField/TextFieldLabel.d.ts +2 -2
- package/TextField/TextFieldLabel.js +5 -3
- package/TextField/TextFieldLabelAsterisk.d.ts +2 -2
- package/TextField/TextFieldLabelAsterisk.js +5 -3
- package/TextField/index.d.ts +15 -8
- package/TextField/index.js +49 -22
- package/ThemeProvider/createTheme.js +2 -2
- package/package.json +1 -1
- package/Calendar/reducer.d.ts +0 -14
- package/Calendar/reducer.js +0 -26
- /package/Calendar/{IconChevronRight.d.ts → CalendarIconNext.d.ts} +0 -0
- /package/Calendar/{IconChevronRight.js → CalendarIconNext.js} +0 -0
package/Accordion/index.d.ts
CHANGED
|
@@ -38,19 +38,19 @@ export interface AccordionOverrides {
|
|
|
38
38
|
/**
|
|
39
39
|
* Accordion container component
|
|
40
40
|
*/
|
|
41
|
-
readonly Container?: React.
|
|
41
|
+
readonly Container?: React.ComponentType<AccordionContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
42
|
/**
|
|
43
43
|
* Accordion header component
|
|
44
44
|
*/
|
|
45
|
-
readonly Header?: React.
|
|
45
|
+
readonly Header?: React.ComponentType<AccordionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
46
46
|
/**
|
|
47
47
|
* Accordion content component
|
|
48
48
|
*/
|
|
49
|
-
readonly Content?: React.
|
|
49
|
+
readonly Content?: React.ComponentType<AccordionContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
50
|
/**
|
|
51
51
|
* Accordion footer component
|
|
52
52
|
*/
|
|
53
|
-
readonly Actions?: React.
|
|
53
|
+
readonly Actions?: React.ComponentType<AccordionActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
54
54
|
}
|
|
55
55
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
56
56
|
readonly children: React.ReactNode | React.ReactNode[];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Value, OnRequestClose, GetOptionSelected } from '../Menu';
|
|
3
2
|
import { AutocompleteTextFieldProps } from './AutocompleteTextField';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { PositionStrategy } from '../Popper';
|
|
4
|
+
import { AnchorPos, GetOptionSelected, MenuItemProps, OnRequestClose, Value } from '../Menu';
|
|
6
5
|
export interface AutocompleteProps<T, Multiple extends boolean | undefined = undefined> extends Omit<AutocompleteTextFieldProps, 'value' | 'onChange' | 'children' | 'overrides'> {
|
|
7
6
|
readonly items: readonly T[];
|
|
8
7
|
readonly value: Value<T, Multiple>;
|
|
@@ -16,15 +15,43 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined = und
|
|
|
16
15
|
*/
|
|
17
16
|
readonly isOpen?: boolean;
|
|
18
17
|
/**
|
|
19
|
-
* Loading indicator
|
|
18
|
+
* Loading indicator visibility\
|
|
20
19
|
* If `true` then visible, otherwise - hidden
|
|
21
20
|
*/
|
|
22
21
|
/**
|
|
23
22
|
* Anchor position\
|
|
24
23
|
* \
|
|
25
|
-
* Default: `
|
|
24
|
+
* Default: `bottom-fill`
|
|
26
25
|
*/
|
|
27
26
|
readonly anchorPos?: AnchorPos;
|
|
27
|
+
/**
|
|
28
|
+
* When enabled, the popper will automatically try to find the best placement
|
|
29
|
+
* if the preferred placement doesn't fit in the viewport.
|
|
30
|
+
* The component will iterate through possible placements until it finds one that fits.
|
|
31
|
+
*
|
|
32
|
+
* **Default**: `true`
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
readonly autoFlip?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The positioning strategy to use.
|
|
38
|
+
* - `'fixed'`: Positions relative to the viewport. Works reliably in all cases.
|
|
39
|
+
* - `'absolute'`: Positions relative to the nearest positioned ancestor.
|
|
40
|
+
* When using 'absolute', make sure a parent element has `position: relative`.
|
|
41
|
+
*
|
|
42
|
+
* **Default**: `fixed`
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
readonly positionStrategy?: PositionStrategy;
|
|
46
|
+
/**
|
|
47
|
+
* Minimum distance (in pixels) that the popper must maintain from the viewport edges.
|
|
48
|
+
* Used to prevent the popper from being positioned too close to the screen boundaries.
|
|
49
|
+
* The popper will try to flip to another placement if it cannot maintain this margin.
|
|
50
|
+
*
|
|
51
|
+
* **Default**: `8`
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
readonly viewportMargin?: number;
|
|
28
55
|
/**
|
|
29
56
|
* Text field loading state\
|
|
30
57
|
* If `true` then text field has been contained the loading indicator, otherwise - nop
|
|
@@ -110,13 +137,13 @@ export interface AutocompleteOverrides {
|
|
|
110
137
|
/**
|
|
111
138
|
* Element wrapper
|
|
112
139
|
*/
|
|
113
|
-
readonly TextField?: React.
|
|
140
|
+
readonly TextField?: React.ComponentType<AutocompleteTextFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
114
141
|
}
|
|
115
142
|
export type Children<T> = (data: {
|
|
116
143
|
item: T;
|
|
117
144
|
index: number;
|
|
118
145
|
inputValue: string;
|
|
119
|
-
}, itemProps:
|
|
146
|
+
}, itemProps: MenuItemProps) => React.ReactNode;
|
|
120
147
|
export type ItemToString<T, Multiple extends boolean | undefined = undefined> = (item: Multiple extends undefined ? T : readonly T[]) => string;
|
|
121
148
|
export type OnChange<T, Multiple extends boolean | undefined = undefined> = (item: Value<T, Multiple>) => void;
|
|
122
149
|
export type FilterItems<T> = (items: readonly T[], data: {
|
|
@@ -38,15 +38,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
const react_1 = __importDefault(require("react"));
|
|
41
|
-
const Menu_1 = __importDefault(require("../Menu"));
|
|
42
41
|
const AutocompleteTextField_1 = __importDefault(require("./AutocompleteTextField"));
|
|
43
42
|
const Button_1 = __importDefault(require("../Button"));
|
|
44
43
|
const Spinner_1 = __importDefault(require("../LoadingIndicator/Spinner"));
|
|
45
44
|
const context_1 = __importStar(require("./context"));
|
|
46
45
|
const IconClear_1 = __importDefault(require("./IconClear"));
|
|
47
46
|
const ClickOutside_1 = require("../ClickOutside");
|
|
47
|
+
const OverrideMenuList_1 = __importDefault(require("./OverrideMenuList"));
|
|
48
|
+
const Menu_1 = __importDefault(require("../Menu"));
|
|
49
|
+
//
|
|
48
50
|
const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
49
|
-
const { items, value, multiple, isOpen = false, isLoading = false, clearOnBlur = true, anchorPos = '
|
|
51
|
+
const { items, value, multiple, isOpen = false, isLoading = false, clearOnBlur = true, anchorPos = 'bottom-fill', openOnFocus = true, autoFlip, viewportMargin, positionStrategy, requiredAsterisk, startIcon, fullWidth, placeholder, label, error, errorText, inputRef, filterItems, children, onChange, selectedItemToString, clearable = true, onInputChange, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides } = props, nativeInputProps = __rest(props, ["items", "value", "multiple", "isOpen", "isLoading", "clearOnBlur", "anchorPos", "openOnFocus", "autoFlip", "viewportMargin", "positionStrategy", "requiredAsterisk", "startIcon", "fullWidth", "placeholder", "label", "error", "errorText", "inputRef", "filterItems", "children", "onChange", "selectedItemToString", "clearable", "onInputChange", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides"]);
|
|
52
|
+
const [actualPlacement, setActualPlacement] = react_1.default.useState(anchorPos);
|
|
50
53
|
const menuRef = react_1.default.useRef(null);
|
|
51
54
|
const fieldInputRef = react_1.default.useRef(null);
|
|
52
55
|
const isFocusedRef = react_1.default.useRef(false);
|
|
@@ -85,13 +88,13 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
85
88
|
case 'NumpadEnter':
|
|
86
89
|
if (currentOpen) {
|
|
87
90
|
event.preventDefault();
|
|
88
|
-
(_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
91
|
+
(_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.selectHighlightedItem();
|
|
89
92
|
}
|
|
90
93
|
break;
|
|
91
94
|
case 'ArrowUp':
|
|
92
95
|
{
|
|
93
96
|
event.preventDefault();
|
|
94
|
-
(_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.
|
|
97
|
+
(_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.highlightPrevItem();
|
|
95
98
|
}
|
|
96
99
|
break;
|
|
97
100
|
case 'ArrowDown':
|
|
@@ -101,20 +104,20 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
101
104
|
onRequestOpen(event);
|
|
102
105
|
}
|
|
103
106
|
if (currentOpen) {
|
|
104
|
-
(_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.
|
|
107
|
+
(_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.highlightNextItem();
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
break;
|
|
108
111
|
case 'Home':
|
|
109
112
|
{
|
|
110
113
|
event.preventDefault();
|
|
111
|
-
(_d = menuRef.current) === null || _d === void 0 ? void 0 : _d.
|
|
114
|
+
(_d = menuRef.current) === null || _d === void 0 ? void 0 : _d.highlightFirstItem();
|
|
112
115
|
}
|
|
113
116
|
break;
|
|
114
117
|
case 'End':
|
|
115
118
|
{
|
|
116
119
|
event.preventDefault();
|
|
117
|
-
(_e = menuRef.current) === null || _e === void 0 ? void 0 : _e.
|
|
120
|
+
(_e = menuRef.current) === null || _e === void 0 ? void 0 : _e.highlightLastItem();
|
|
118
121
|
}
|
|
119
122
|
break;
|
|
120
123
|
// case 'PageUp':
|
|
@@ -135,10 +138,9 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
135
138
|
const applyFilterForItems = react_1.default.useCallback((inputValue, itemList) => {
|
|
136
139
|
const query = inputValue.toLowerCase().trim();
|
|
137
140
|
// Apply filter
|
|
138
|
-
|
|
141
|
+
return typeof filterItems !== 'function' || query.length === 0
|
|
139
142
|
? itemList
|
|
140
143
|
: filterItems(itemList, { query, inputValue });
|
|
141
|
-
return newItems;
|
|
142
144
|
}, [filterItems]);
|
|
143
145
|
/**
|
|
144
146
|
* Only affected value change action
|
|
@@ -232,7 +234,7 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
232
234
|
multiple,
|
|
233
235
|
]);
|
|
234
236
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
235
|
-
react_1.default.useMemo(() => (react_1.default.createElement(overridesMap.TextField, Object.assign({ placeholder: placeholder, label: label, error: error, requiredAsterisk: requiredAsterisk, errorText: errorText, fullWidth: fullWidth, startIcon: startIcon, isLoading: currentLoading, endIcon: clearable ? (react_1.default.createElement(Button_1.default, { iconOnly: true, type: "button", onClick: () => (currentLoading ? 'undefined' : clear()) }, currentLoading ? react_1.default.createElement(Spinner_1.default, null) : react_1.default.createElement(IconClear_1.default, null))) : undefined }, nativeInputProps, { onKeyDown: event => {
|
|
237
|
+
react_1.default.useMemo(() => (react_1.default.createElement(overridesMap.TextField, Object.assign({ placeholder: placeholder, anchorPos: actualPlacement, isOpen: currentOpen, label: label, error: error, requiredAsterisk: requiredAsterisk, errorText: errorText, fullWidth: fullWidth, startIcon: startIcon, isLoading: currentLoading, endIcon: clearable ? (react_1.default.createElement(Button_1.default, { iconOnly: true, type: "button", variant: "plain", onClick: () => (currentLoading ? 'undefined' : clear()) }, currentLoading ? react_1.default.createElement(Spinner_1.default, null) : react_1.default.createElement(IconClear_1.default, null))) : undefined }, nativeInputProps, { onKeyDown: event => {
|
|
236
238
|
inputKeydownEvent(event);
|
|
237
239
|
if (typeof nativeInputProps.onKeyDown === 'function') {
|
|
238
240
|
nativeInputProps.onKeyDown(event);
|
|
@@ -256,16 +258,12 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
256
258
|
}
|
|
257
259
|
}, onFocus: event => {
|
|
258
260
|
isFocusedRef.current = true;
|
|
259
|
-
if (openOnFocus &&
|
|
260
|
-
!currentOpen &&
|
|
261
|
-
filteredItems.length > 0
|
|
262
|
-
// && inputValue.trim() !== ''
|
|
263
|
-
) {
|
|
264
|
-
onRequestOpen(event);
|
|
265
|
-
}
|
|
266
|
-
if (!openOnFocus && !currentOpen && inputValue !== '' && filteredItems.length > 0) {
|
|
261
|
+
if (openOnFocus && !currentOpen && filteredItems.length > 0) {
|
|
267
262
|
onRequestOpen(event);
|
|
268
263
|
}
|
|
264
|
+
// if (!openOnFocus && !currentOpen && inputValue !== '' && filteredItems.length > 0) {
|
|
265
|
+
// onRequestOpen(event);
|
|
266
|
+
// }
|
|
269
267
|
if (typeof nativeInputProps.onFocus === 'function') {
|
|
270
268
|
nativeInputProps.onFocus(event);
|
|
271
269
|
}
|
|
@@ -307,8 +305,9 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
307
305
|
} }))), [
|
|
308
306
|
overridesMap,
|
|
309
307
|
placeholder,
|
|
308
|
+
actualPlacement,
|
|
309
|
+
currentOpen,
|
|
310
310
|
label,
|
|
311
|
-
onRequestClose,
|
|
312
311
|
error,
|
|
313
312
|
requiredAsterisk,
|
|
314
313
|
errorText,
|
|
@@ -324,14 +323,16 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
324
323
|
dispatch,
|
|
325
324
|
inputRef,
|
|
326
325
|
openOnFocus,
|
|
327
|
-
currentOpen,
|
|
328
326
|
filteredItems.length,
|
|
329
327
|
onRequestOpen,
|
|
330
328
|
onInputChange,
|
|
331
|
-
items,
|
|
332
329
|
applyFilterForItems,
|
|
330
|
+
items,
|
|
331
|
+
onRequestClose,
|
|
333
332
|
]),
|
|
334
|
-
react_1.default.useMemo(() => (react_1.default.createElement(Menu_1.default, { ref: menuRef, anchorPos:
|
|
333
|
+
react_1.default.useMemo(() => (react_1.default.createElement(Menu_1.default, { ref: menuRef, onAnchorPosChanged: setActualPlacement, anchorPos: actualPlacement, multiple: multiple, items: filteredItems, value: currentValue, isOpen: currentOpen, autofocus: false, autoFlip: autoFlip, viewportMargin: viewportMargin, offset: 0, overrides: {
|
|
334
|
+
List: OverrideMenuList_1.default,
|
|
335
|
+
}, positionStrategy: positionStrategy, anchorElement: anchorElement, closeOutsideClick: false, getOptionSelected: getOptionSelected, onRequestClose: onRequestClose, closeOnSelect: !multiple, onSelectItem: item => {
|
|
335
336
|
if (!multiple) {
|
|
336
337
|
dispatch({
|
|
337
338
|
type: 'setPartial',
|
|
@@ -344,19 +345,22 @@ const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
|
344
345
|
onChange(item);
|
|
345
346
|
}
|
|
346
347
|
} }, ({ index, item }, itemProps) => children({ index, item: item, inputValue }, itemProps))), [
|
|
347
|
-
|
|
348
|
+
actualPlacement,
|
|
348
349
|
multiple,
|
|
349
350
|
filteredItems,
|
|
350
351
|
currentValue,
|
|
351
352
|
currentOpen,
|
|
353
|
+
autoFlip,
|
|
354
|
+
viewportMargin,
|
|
355
|
+
positionStrategy,
|
|
352
356
|
anchorElement,
|
|
353
357
|
getOptionSelected,
|
|
354
358
|
onRequestClose,
|
|
359
|
+
onChange,
|
|
355
360
|
dispatch,
|
|
356
361
|
applyFilterForItems,
|
|
357
362
|
selectedItemToString,
|
|
358
363
|
items,
|
|
359
|
-
onChange,
|
|
360
364
|
children,
|
|
361
365
|
inputValue,
|
|
362
366
|
])));
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { MenuItemProps } from '../Menu/MenuItem';
|
|
3
3
|
export interface AutocompleteItemProps extends MenuItemProps {
|
|
4
4
|
readonly variant?: 'standard' | 'virtual';
|
|
5
|
-
readonly startIcon?:
|
|
5
|
+
readonly startIcon?: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const AutocompleteItem: React.ForwardRefExoticComponent<AutocompleteItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export default AutocompleteItem;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextFieldProps } from '../TextField';
|
|
3
|
+
import { AnchorPos } from '../Menu';
|
|
3
4
|
export interface AutocompleteTextFieldProps extends TextFieldProps {
|
|
4
5
|
/**
|
|
5
6
|
* Text field loading state\
|
|
6
7
|
* If `true` then text field has been contained the loading indicator, otherwise - nop
|
|
7
8
|
*/
|
|
8
9
|
readonly isLoading?: boolean;
|
|
10
|
+
readonly anchorPos?: AnchorPos;
|
|
11
|
+
readonly isOpen?: boolean;
|
|
9
12
|
/**
|
|
10
13
|
* Native <input> element reference
|
|
11
14
|
*/
|
|
@@ -1,9 +1,71 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
17
|
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const react_2 = require("@emotion/react");
|
|
7
20
|
const TextField_1 = __importDefault(require("../TextField"));
|
|
8
|
-
const
|
|
21
|
+
const TextFieldInputWrapper_1 = __importDefault(require("../TextField/TextFieldInputWrapper"));
|
|
22
|
+
const StyledTextFieldInputWrapper = (0, styled_1.default)(TextFieldInputWrapper_1.default) `
|
|
23
|
+
${({ theme, $isOpen, $anchorPos }) => $isOpen &&
|
|
24
|
+
$anchorPos &&
|
|
25
|
+
['bottom-fill', 'top-fill'].includes($anchorPos) &&
|
|
26
|
+
(0, react_2.css) `
|
|
27
|
+
border-width: 1px;
|
|
28
|
+
border-style: solid;
|
|
29
|
+
border-color: ${theme.isDark
|
|
30
|
+
? theme.color.textPrimary.darken(100).toString()
|
|
31
|
+
: theme.color.textPrimary.lighten(150).toString()};
|
|
32
|
+
`};
|
|
33
|
+
|
|
34
|
+
${({ focused, $anchorPos, $isOpen }) => $isOpen &&
|
|
35
|
+
$anchorPos &&
|
|
36
|
+
['bottom-fill', 'top-fill'].includes($anchorPos) &&
|
|
37
|
+
focused &&
|
|
38
|
+
(0, react_2.css) `
|
|
39
|
+
outline: none;
|
|
40
|
+
`};
|
|
41
|
+
|
|
42
|
+
${({ $anchorPos, $isOpen }) => $isOpen &&
|
|
43
|
+
$anchorPos === 'bottom-fill' &&
|
|
44
|
+
(0, react_2.css) `
|
|
45
|
+
border-bottom-left-radius: 0;
|
|
46
|
+
border-bottom-right-radius: 0;
|
|
47
|
+
border-bottom: 0;
|
|
48
|
+
`};
|
|
49
|
+
|
|
50
|
+
${({ $anchorPos, $isOpen }) => $isOpen &&
|
|
51
|
+
$anchorPos === 'top-fill' &&
|
|
52
|
+
(0, react_2.css) `
|
|
53
|
+
border-top-left-radius: 0;
|
|
54
|
+
border-top-right-radius: 0;
|
|
55
|
+
border-top: 0;
|
|
56
|
+
`};
|
|
57
|
+
`;
|
|
58
|
+
const WrapperContext = react_1.default.createContext({ anchorPos: undefined, isOpen: false });
|
|
59
|
+
const InputWrapper = react_1.default.forwardRef(function StyledInputWrapper(props, ref) {
|
|
60
|
+
const ctx = react_1.default.useContext(WrapperContext);
|
|
61
|
+
const { anchorPos, isOpen } = ctx;
|
|
62
|
+
return (react_1.default.createElement(StyledTextFieldInputWrapper, Object.assign({ "$anchorPos": anchorPos, "$isOpen": isOpen, ref: ref }, props)));
|
|
63
|
+
});
|
|
64
|
+
const AutocompleteTextField = (props, ref) => {
|
|
65
|
+
const { anchorPos, isOpen } = props, restProps = __rest(props, ["anchorPos", "isOpen"]);
|
|
66
|
+
return (react_1.default.createElement(WrapperContext.Provider, { value: { anchorPos, isOpen } },
|
|
67
|
+
react_1.default.createElement(TextField_1.default, Object.assign({ overrides: {
|
|
68
|
+
InputWrapper,
|
|
69
|
+
} }, restProps, { ref: ref }))));
|
|
70
|
+
};
|
|
9
71
|
exports.default = react_1.default.forwardRef(AutocompleteTextField);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const react_2 = require("@emotion/react");
|
|
9
|
+
const Menu_1 = require("../Menu");
|
|
10
|
+
const StyledMenuList = (0, styled_1.default)(Menu_1.MenuList) `
|
|
11
|
+
&:focus {
|
|
12
|
+
outline: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
--border-color: ${({ theme }) => theme.isDark
|
|
16
|
+
? theme.color.textPrimary.darken(100).toString()
|
|
17
|
+
: theme.color.textPrimary.lighten(150).toString()};
|
|
18
|
+
|
|
19
|
+
${({ anchorPos, theme }) => anchorPos === 'top-fill' &&
|
|
20
|
+
(0, react_2.css) `
|
|
21
|
+
border-bottom-left-radius: 0;
|
|
22
|
+
border-bottom-right-radius: 0;
|
|
23
|
+
border: 1px solid var(--border-color);
|
|
24
|
+
border-bottom: 0;
|
|
25
|
+
box-shadow: 0 1em -1.5em ${theme.color.surface.darken(50).alpha(0.6).toString()};
|
|
26
|
+
`};
|
|
27
|
+
|
|
28
|
+
${({ anchorPos, theme }) => anchorPos === 'bottom-fill' &&
|
|
29
|
+
(0, react_2.css) `
|
|
30
|
+
border-top-left-radius: 0;
|
|
31
|
+
border-top-right-radius: 0;
|
|
32
|
+
border: 1px solid var(--border-color);
|
|
33
|
+
border-top: 0;
|
|
34
|
+
box-shadow: 0 1em 1.5em ${theme.color.surface.darken(50).alpha(0.6).toString()};
|
|
35
|
+
`};
|
|
36
|
+
`;
|
|
37
|
+
const OverrideMenuList = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(StyledMenuList, Object.assign({ "data-anch-po": props.anchorPos }, props, { ref: ref }))));
|
|
38
|
+
OverrideMenuList.displayName = 'OverrideMenuList';
|
|
39
|
+
exports.default = OverrideMenuList;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { AnchorElement } from '../Menu';
|
|
2
|
+
import type { AnchorElement, Value } from '../Menu';
|
|
3
|
+
import { FilterItems, ItemToString } from './AutocompleteContainer';
|
|
3
4
|
type State = {
|
|
4
5
|
readonly currentOpen: boolean;
|
|
5
6
|
readonly currentLoading: boolean;
|
|
@@ -16,6 +17,13 @@ type ActionSetPartial = {
|
|
|
16
17
|
export declare const actionSetPartial: (payload: ActionSetPartial['payload']) => ActionSetPartial;
|
|
17
18
|
export declare const defaultState: State;
|
|
18
19
|
export declare const reducer: React.Reducer<State, Action>;
|
|
20
|
+
export declare const createInitialState: <T, Multiple extends boolean | undefined = undefined>(params: {
|
|
21
|
+
readonly items: readonly T[];
|
|
22
|
+
readonly value: Value<T, Multiple> | null;
|
|
23
|
+
readonly selectedItemToString: ItemToString<T, Multiple>;
|
|
24
|
+
readonly isOpen?: boolean | undefined;
|
|
25
|
+
readonly filterItems: FilterItems<T> | undefined;
|
|
26
|
+
}) => State;
|
|
19
27
|
interface ContextProviderProps {
|
|
20
28
|
readonly children: React.ReactNode | readonly React.ReactNode[];
|
|
21
29
|
readonly initialState?: Partial<State>;
|
package/Autocomplete/context.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useContext = exports.ContextProvider = exports.reducer = exports.defaultState = exports.actionSetPartial = void 0;
|
|
6
|
+
exports.useContext = exports.ContextProvider = exports.createInitialState = exports.reducer = exports.defaultState = exports.actionSetPartial = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const actionSetPartial = (payload) => ({
|
|
9
9
|
type: 'setPartial',
|
|
@@ -27,6 +27,20 @@ const reducer = (state, action) => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
exports.reducer = reducer;
|
|
30
|
+
const createInitialState = (params) => {
|
|
31
|
+
const { filterItems, isOpen, items, selectedItemToString, value } = params;
|
|
32
|
+
const inputValue = !value
|
|
33
|
+
? ''
|
|
34
|
+
: selectedItemToString(value);
|
|
35
|
+
const data = {
|
|
36
|
+
inputValue: inputValue,
|
|
37
|
+
query: inputValue.trim().toLocaleLowerCase(),
|
|
38
|
+
};
|
|
39
|
+
const filteredItems = filterItems ? filterItems(items, data) : items;
|
|
40
|
+
return Object.assign(Object.assign({}, exports.defaultState), { filteredItems,
|
|
41
|
+
inputValue, currentValue: value, currentOpen: Boolean(isOpen) });
|
|
42
|
+
};
|
|
43
|
+
exports.createInitialState = createInitialState;
|
|
30
44
|
const context = react_1.default.createContext({
|
|
31
45
|
state: exports.defaultState,
|
|
32
46
|
dispatch: () => undefined,
|
package/Autocomplete/index.js
CHANGED
|
@@ -34,16 +34,15 @@ const context_1 = require("./context");
|
|
|
34
34
|
__exportStar(require("./AutocompleteContainer"), exports);
|
|
35
35
|
__exportStar(require("./AutocompleteItem"), exports);
|
|
36
36
|
const Autocomplete = react_1.default.forwardRef((props, ref) => {
|
|
37
|
-
const { children, items, isOpen, multiple, selectedItemToString, value } = props, restProps = __rest(props, ["children", "items", "isOpen", "multiple", "selectedItemToString", "value"]);
|
|
38
|
-
return (react_1.default.createElement(context_1.ContextProvider, { initialState: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} },
|
|
46
|
-
react_1.default.createElement(AutocompleteContainer_1.default, Object.assign({}, restProps, { items: items, isOpen: isOpen, multiple: multiple, selectedItemToString: selectedItemToString, value: value, ref: ref }), children)));
|
|
37
|
+
const { children, items, filterItems, isOpen, multiple, selectedItemToString, value } = props, restProps = __rest(props, ["children", "items", "filterItems", "isOpen", "multiple", "selectedItemToString", "value"]);
|
|
38
|
+
return (react_1.default.createElement(context_1.ContextProvider, { initialState: (0, context_1.createInitialState)({
|
|
39
|
+
items,
|
|
40
|
+
selectedItemToString,
|
|
41
|
+
filterItems,
|
|
42
|
+
value,
|
|
43
|
+
isOpen,
|
|
44
|
+
}) },
|
|
45
|
+
react_1.default.createElement(AutocompleteContainer_1.default, Object.assign({}, restProps, { items: items, filterItems: filterItems, isOpen: isOpen, multiple: multiple, selectedItemToString: selectedItemToString, value: value, ref: ref }), children)));
|
|
47
46
|
});
|
|
48
47
|
Autocomplete.displayName = 'Autocomplete';
|
|
49
48
|
exports.default = Autocomplete;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type Item = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly label: string;
|
|
5
|
+
};
|
|
6
|
+
type Autocomplete2Props = {
|
|
7
|
+
readonly value: Item | null;
|
|
8
|
+
readonly items: readonly Item[];
|
|
9
|
+
readonly onChange: (value: Item | null) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Autocomplete2Props & React.RefAttributes<HTMLDivElement>>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const React = __importStar(require("react"));
|
|
30
|
+
const Autocomplete2TextField_1 = __importDefault(require("./Autocomplete2TextField"));
|
|
31
|
+
const Autocomplete2 = React.forwardRef((props, ref) => {
|
|
32
|
+
const { value, items, onChange } = props;
|
|
33
|
+
/**
|
|
34
|
+
* Get item ID
|
|
35
|
+
*/
|
|
36
|
+
const getItemID = React.useCallback((item) => (item ? item.id : '<no-value-id>'), []);
|
|
37
|
+
const [valueID, setValueID] = React.useState(() => getItemID(value));
|
|
38
|
+
/**
|
|
39
|
+
* Filter items list by input value
|
|
40
|
+
*/
|
|
41
|
+
const filterItems = React.useCallback((items, data) => {
|
|
42
|
+
const { query } = data;
|
|
43
|
+
return items.filter(item => item.label.toLocaleLowerCase().indexOf(query) !== -1);
|
|
44
|
+
}, []);
|
|
45
|
+
/**
|
|
46
|
+
* Input value
|
|
47
|
+
*/
|
|
48
|
+
const [inputValue, setInputValue] = React.useState(() => {
|
|
49
|
+
if (!value) {
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
return value.label;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Filtered items
|
|
56
|
+
*/
|
|
57
|
+
const [filteredItems, setFilteredItems] = React.useState(() => filterItems(items, { query: inputValue }));
|
|
58
|
+
/**
|
|
59
|
+
* Render filtered items list
|
|
60
|
+
*/
|
|
61
|
+
const renderItems = React.useCallback(() => (React.createElement("ol", null, filteredItems.map(item => (React.createElement("li", { key: item.id, onClick: () => onChange(item) }, item.label))))), [filteredItems, onChange]);
|
|
62
|
+
/**
|
|
63
|
+
* onChange text field input
|
|
64
|
+
*/
|
|
65
|
+
const handleInputChange = React.useCallback((input) => {
|
|
66
|
+
setInputValue(input);
|
|
67
|
+
setFilteredItems(filterItems(items, { query: input }));
|
|
68
|
+
}, [filterItems, items]);
|
|
69
|
+
/**
|
|
70
|
+
* value listener
|
|
71
|
+
*/
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
const newValueID = getItemID(value);
|
|
74
|
+
if (newValueID !== valueID) {
|
|
75
|
+
setValueID(newValueID);
|
|
76
|
+
}
|
|
77
|
+
}, [getItemID, inputValue, value, valueID]);
|
|
78
|
+
return (React.createElement("div", null,
|
|
79
|
+
React.createElement(Autocomplete2TextField_1.default, { ref: ref, value: inputValue, onChange: handleInputChange }),
|
|
80
|
+
renderItems()));
|
|
81
|
+
});
|
|
82
|
+
Autocomplete2.displayName = 'Autocomplete2';
|
|
83
|
+
exports.default = React.memo(Autocomplete2);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type Autocomplete2TextFieldProps = {
|
|
3
|
+
readonly value: string;
|
|
4
|
+
readonly onChange: (value: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Autocomplete2TextField: React.ForwardRefExoticComponent<Autocomplete2TextFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default Autocomplete2TextField;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const React = __importStar(require("react"));
|
|
30
|
+
const TextField_1 = __importDefault(require("../TextField"));
|
|
31
|
+
const Autocomplete2TextField = React.forwardRef((props, ref) => {
|
|
32
|
+
const { value, onChange } = props;
|
|
33
|
+
const handleChange = React.useCallback(event => {
|
|
34
|
+
onChange(event.target.value);
|
|
35
|
+
}, [onChange]);
|
|
36
|
+
return React.createElement(TextField_1.default, { value: value, onChange: handleChange, ref: ref });
|
|
37
|
+
});
|
|
38
|
+
Autocomplete2TextField.displayName = 'Autocomplete2TextField';
|
|
39
|
+
exports.default = Autocomplete2TextField;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Autocomplete2_1 = __importDefault(require("./Autocomplete2"));
|
|
7
|
+
exports.default = Autocomplete2_1.default;
|