@procore/core-react 11.5.0-rc.4 → 11.5.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultiSelect/MultiSelect.styles.d.ts +1 -1
- package/dist/SuperSelect/SuperSelect.d.ts +57 -0
- package/dist/SuperSelect/SuperSelect.js +159 -0
- package/dist/SuperSelect/SuperSelect.js.map +1 -0
- package/dist/SuperSelect/SuperSelect.styles.d.ts +6 -0
- package/dist/SuperSelect/SuperSelect.styles.js +13 -0
- package/dist/SuperSelect/SuperSelect.styles.js.map +1 -0
- package/dist/SuperSelect/SuperSelect.types.d.ts +95 -0
- package/dist/SuperSelect/SuperSelect.types.js +2 -0
- package/dist/SuperSelect/SuperSelect.types.js.map +1 -0
- package/dist/SuperSelect/useSuperSelect.d.ts +61 -0
- package/dist/SuperSelect/useSuperSelect.js +474 -0
- package/dist/SuperSelect/useSuperSelect.js.map +1 -0
- package/dist/Typeahead/Typeahead.js +1 -1
- package/dist/Typeahead/Typeahead.js.map +1 -1
- package/dist/_typedoc/Avatar/Avatar.types.json +17 -17
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +22 -22
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +12 -12
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +7 -7
- package/dist/_typedoc/Button/Button.types.json +11 -11
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +7 -7
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +4 -4
- package/dist/_typedoc/Dropdown/Dropdown.types.json +36 -36
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +29 -29
- package/dist/_typedoc/Dropzone/Dropzone.types.json +41 -41
- package/dist/_typedoc/EmptyState/EmptyState.types.json +14 -14
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +26 -26
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +694 -694
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +4 -4
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +71 -71
- package/dist/_typedoc/Modal/Modal.types.json +27 -27
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +43 -43
- package/dist/_typedoc/PageLayout/PageLayout.types.json +7 -7
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +27 -27
- package/dist/_typedoc/Pill/Pill.types.json +1 -1
- package/dist/_typedoc/PillSelect/PillSelect.types.json +46 -46
- package/dist/_typedoc/Popover/Popover.types.json +10 -10
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +5 -5
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +18 -18
- package/dist/_typedoc/Section/Section.types.json +14 -14
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +20 -20
- package/dist/_typedoc/Select/Select.types.json +31 -31
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/Switch/Switch.types.json +3 -3
- package/dist/_typedoc/Table/Table.types.json +94 -94
- package/dist/_typedoc/Tabs/Tabs.types.json +15 -15
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +10 -10
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +7 -7
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +3 -3
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +25 -25
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +42 -42
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
- package/dist/_typedoc/Tile/Tile.types.json +30 -30
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +3 -3
- package/dist/_typedoc/Token/Token.types.json +4 -4
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +8 -8
- package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
- package/dist/_typedoc/Tree/Tree.types.json +86 -86
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +8 -8
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const StyledMultiSelectValues: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const StyledMultiSelectToken: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
export declare const StyledMultiSelectSearchInput: import("styled-components").StyledComponent<"input", any, {
|
|
5
|
-
$isNavigatingTokens
|
|
5
|
+
$isNavigatingTokens?: boolean | undefined;
|
|
6
6
|
}, never>;
|
|
7
7
|
export declare const StyledMultiSelectSearch: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const StyledMultiSelectSearchIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SuperSelectProps } from './SuperSelect.types';
|
|
4
|
+
export declare const SuperSelect: React.ForwardRefExoticComponent<SuperSelectProps & React.RefAttributes<{
|
|
5
|
+
activeMenuIndex: number | null;
|
|
6
|
+
activeTokenIndex: number | null;
|
|
7
|
+
components: {
|
|
8
|
+
Label?: React.FC<{
|
|
9
|
+
selectApi: any;
|
|
10
|
+
}> | undefined;
|
|
11
|
+
MenuItemLabel?: React.FC<{
|
|
12
|
+
selectApi: any;
|
|
13
|
+
option: any;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
Token?: React.FC<{
|
|
16
|
+
selectApi: any;
|
|
17
|
+
option: any;
|
|
18
|
+
index: number;
|
|
19
|
+
focused: boolean;
|
|
20
|
+
}> | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
floating: import("@floating-ui/react-dom-interactions").UseFloatingReturn<HTMLElement>;
|
|
23
|
+
getClearProps: () => React.AriaAttributes & React.HTMLAttributes<HTMLElement>;
|
|
24
|
+
getFloatingProps: (userProps?: any) => Record<string, unknown>;
|
|
25
|
+
getItemProps: (userProps?: any) => Record<string, unknown>;
|
|
26
|
+
getMultiInputProps: () => React.AriaAttributes & React.InputHTMLAttributes<HTMLInputElement>;
|
|
27
|
+
getOptionGroup: (option: any) => string;
|
|
28
|
+
getOptionIsBatch: (option: any) => boolean;
|
|
29
|
+
getOptionIsDisabled: (option: any) => boolean;
|
|
30
|
+
getOptionIsOptgroup: (item: any) => boolean;
|
|
31
|
+
getOptionLabel: (option: any) => string;
|
|
32
|
+
getOptionValue: (option: any) => import("./SuperSelect.types").SuperSelectValuePrimitive;
|
|
33
|
+
getReferenceProps: (userProps?: any) => Record<string, unknown>;
|
|
34
|
+
getTokenClearProps: (index: number) => React.AriaAttributes & React.SVGAttributes<SVGElement>;
|
|
35
|
+
getTypeaheadProps: () => React.AriaAttributes & import("../Typeahead/Typeahead.types").TypeaheadInputProps & import("..").TypeaheadProps;
|
|
36
|
+
isEmpty: () => boolean;
|
|
37
|
+
isSelected: (option: any) => boolean;
|
|
38
|
+
listId: string;
|
|
39
|
+
maxHeight: number;
|
|
40
|
+
multiple: boolean;
|
|
41
|
+
navigationListRef: React.MutableRefObject<(HTMLElement | null)[]>;
|
|
42
|
+
onSelect: (option: any) => void;
|
|
43
|
+
open: boolean;
|
|
44
|
+
sourceOptions: any[];
|
|
45
|
+
options: any[];
|
|
46
|
+
overlayId: string;
|
|
47
|
+
searchValue: string;
|
|
48
|
+
selectedIndex: number;
|
|
49
|
+
selectedOption: any;
|
|
50
|
+
selectedLabel: string;
|
|
51
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
52
|
+
setPointer: React.Dispatch<React.SetStateAction<boolean>>;
|
|
53
|
+
setSearchValue: import("lodash").DebouncedFunc<React.Dispatch<React.SetStateAction<string>>>;
|
|
54
|
+
value: import("./SuperSelect.types").SuperSelectValue;
|
|
55
|
+
virtuoso: React.RefObject<import("react-virtuoso").VirtuosoHandle>;
|
|
56
|
+
width: number;
|
|
57
|
+
}>>;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { FloatingFocusManager, FloatingPortal, } from '@floating-ui/react-dom-interactions';
|
|
13
|
+
import { Clear } from '@procore/core-icons';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { Box } from '../Box/Box';
|
|
16
|
+
import { StyledFooter, StyledGroup, StyledHeader, StyledItem, StyledOptions, StyledSearch, } from '../MenuImperative/MenuImperative.styles';
|
|
17
|
+
import { StyledMultiSelectArrow, StyledMultiSelectArrowContainer, StyledMultiSelectButton, StyledMultiSelectClearIcon, StyledMultiSelectSearch, StyledMultiSelectSearchIcon, StyledMultiSelectSearchInput, StyledMultiSelectToken, StyledMultiSelectValues, } from '../MultiSelect/MultiSelect.styles';
|
|
18
|
+
import { Button } from '../Select/Select';
|
|
19
|
+
import { Spinner } from '../Spinner/Spinner';
|
|
20
|
+
import { Token } from '../Token/Token';
|
|
21
|
+
import { Typeahead } from '../Typeahead/Typeahead';
|
|
22
|
+
import { Typography } from '../Typography/Typography';
|
|
23
|
+
import { useI18nContext } from '../_hooks/I18n';
|
|
24
|
+
import { spacing } from '../_styles/spacing';
|
|
25
|
+
import { StyledOverlay, StyledVirtuoso } from './SuperSelect.styles';
|
|
26
|
+
import { useSuperSelect } from './useSuperSelect';
|
|
27
|
+
var SuperSelectContext = React.createContext(null);
|
|
28
|
+
var SuperSelectLabel = function (_a) {
|
|
29
|
+
var selectApi = _a.selectApi;
|
|
30
|
+
return React.createElement(React.Fragment, null, selectApi.selectedLabel);
|
|
31
|
+
};
|
|
32
|
+
var SuperSelectToken = function (_a) {
|
|
33
|
+
var selectApi = _a.selectApi, option = _a.option, focused = _a.focused, index = _a.index;
|
|
34
|
+
return (React.createElement(StyledMultiSelectToken, null,
|
|
35
|
+
React.createElement(Token, { focused: focused },
|
|
36
|
+
React.createElement(Token.Label, null, selectApi.getOptionLabel(option)),
|
|
37
|
+
React.createElement(Token.Remove, __assign({}, selectApi.getTokenClearProps(index))))));
|
|
38
|
+
};
|
|
39
|
+
var SuperSelectMenuItemLabel = function (_a) {
|
|
40
|
+
var selectApi = _a.selectApi, option = _a.option;
|
|
41
|
+
return React.createElement("div", null, selectApi.getOptionLabel(option));
|
|
42
|
+
};
|
|
43
|
+
var SuperSelectMenuItem = React.forwardRef(function (props, ref) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
var selectApi = React.useContext(SuperSelectContext);
|
|
46
|
+
if (!selectApi) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
var index = props['data-index'];
|
|
50
|
+
var option = selectApi.options[index];
|
|
51
|
+
if (!option) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
var label = selectApi.getOptionLabel(option);
|
|
55
|
+
var value = selectApi === null || selectApi === void 0 ? void 0 : selectApi.getOptionValue(option);
|
|
56
|
+
function setNode(node) {
|
|
57
|
+
if (selectApi) {
|
|
58
|
+
selectApi.navigationListRef.current[index] = node;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (selectApi.getOptionIsOptgroup(option)) {
|
|
62
|
+
return (React.createElement(StyledGroup, __assign({ ref: setNode }, props, selectApi.getItemProps(), { role: "separator", "aria-disabled": true }), label));
|
|
63
|
+
}
|
|
64
|
+
var MenuItemLabelComponent = (_b = (_a = selectApi.components) === null || _a === void 0 ? void 0 : _a['MenuItemLabel']) !== null && _b !== void 0 ? _b : SuperSelectMenuItemLabel;
|
|
65
|
+
return (React.createElement(StyledItem, __assign({}, props, selectApi.getItemProps({
|
|
66
|
+
onClick: function () {
|
|
67
|
+
selectApi === null || selectApi === void 0 ? void 0 : selectApi.onSelect(option);
|
|
68
|
+
},
|
|
69
|
+
}), { ref: setNode, id: "item-".concat(value), role: "option", "aria-selected": selectApi.activeMenuIndex === index, "aria-setsize": selectApi.options.length || 0, "aria-posinset": index + 1, "$highlighted": selectApi.activeMenuIndex === index, "$disabled": selectApi.getOptionIsDisabled(option), "$selected": selectApi.isSelected(option) }),
|
|
70
|
+
React.createElement(MenuItemLabelComponent, { selectApi: selectApi, option: option })));
|
|
71
|
+
});
|
|
72
|
+
var SingleSelectReference = React.forwardRef(function SingleSelect(_a, ref) {
|
|
73
|
+
var _b, _c;
|
|
74
|
+
var selectApi = _a.selectApi, _d = _a.block, block = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.error, error = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, placeholder = _a.placeholder, _h = _a.tabIndex, tabIndex = _h === void 0 ? 0 : _h;
|
|
75
|
+
var LabelComponent = (_c = (_b = selectApi.components) === null || _b === void 0 ? void 0 : _b['Label']) !== null && _c !== void 0 ? _c : SuperSelectLabel;
|
|
76
|
+
var label = selectApi.selectedLabel ? (React.createElement(LabelComponent, { selectApi: selectApi })) : ('');
|
|
77
|
+
return (React.createElement(Button, __assign({}, selectApi.getReferenceProps(), { ref: selectApi.floating.reference, block: block, disabled: disabled, error: error, isMenuOpened: selectApi.open, label: label, loading: loading, onClear: selectApi.getClearProps().onClick, open: selectApi.open, placeholder: placeholder, tabIndex: tabIndex, role: "combobox" })));
|
|
78
|
+
});
|
|
79
|
+
var MultiSelectReference = React.forwardRef(function MultiSelect(_a, ref) {
|
|
80
|
+
var _b, _c, _d;
|
|
81
|
+
var selectApi = _a.selectApi, _e = _a.block, block = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.error, error = _g === void 0 ? false : _g, _h = _a.loading, loading = _h === void 0 ? false : _h, placeholder = _a.placeholder, _j = _a.tabIndex, tabIndex = _j === void 0 ? 0 : _j;
|
|
82
|
+
var searchRef = React.useRef(null);
|
|
83
|
+
React.useEffect(function () {
|
|
84
|
+
var _a;
|
|
85
|
+
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
86
|
+
}, [selectApi.value]);
|
|
87
|
+
if (!Array.isArray(selectApi.value)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
var TokenComponent = (_c = (_b = selectApi.components) === null || _b === void 0 ? void 0 : _b['Token']) !== null && _c !== void 0 ? _c : SuperSelectToken;
|
|
91
|
+
return (React.createElement(StyledMultiSelectButton, __assign({}, selectApi.getReferenceProps({
|
|
92
|
+
onClick: function () { var _a; return (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
93
|
+
}), { ref: ref, "$block": block, "$error": error, "$emptyValue": selectApi.isEmpty(), "$disabled": disabled, "$hasClearIcon": !selectApi.isEmpty() && !loading, "$loading": loading, "$open": selectApi.open, tabIndex: tabIndex }),
|
|
94
|
+
React.createElement(StyledMultiSelectValues, null, (_d = selectApi.value) === null || _d === void 0 ? void 0 :
|
|
95
|
+
_d.map(function (val, j) {
|
|
96
|
+
var option = selectApi.sourceOptions.find(function (o) { return selectApi.getOptionValue(o) === val; });
|
|
97
|
+
return (option && (React.createElement(TokenComponent, { index: j, focused: j === selectApi.activeTokenIndex, option: option, selectApi: selectApi })));
|
|
98
|
+
}),
|
|
99
|
+
React.createElement(StyledMultiSelectSearch, null,
|
|
100
|
+
React.createElement(StyledMultiSelectSearchInput, __assign({}, selectApi.getMultiInputProps(), { ref: searchRef, placeholder: selectApi.isEmpty() ? placeholder : '' })))),
|
|
101
|
+
React.createElement(StyledMultiSelectSearchIcon, null,
|
|
102
|
+
React.createElement(StyledMultiSelectClearIcon, __assign({}, selectApi.getClearProps(), { size: "sm", variant: "tertiary", disabled: disabled, icon: React.createElement(Clear, null), tabIndex: -1 })),
|
|
103
|
+
loading ? (React.createElement(Spinner, { color: "blue50", size: "xs" })) : (React.createElement(StyledMultiSelectArrowContainer, null,
|
|
104
|
+
React.createElement(StyledMultiSelectArrow, null))))));
|
|
105
|
+
});
|
|
106
|
+
function SelectComponent(_a, ref) {
|
|
107
|
+
var _b = _a.block, block = _b === void 0 ? false : _b, components = _a.components, defaultValue = _a.defaultValue, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.emptyMessage, emptyMessage = _d === void 0 ? 'No Results' : _d, _e = _a.error, error = _e === void 0 ? false : _e, footer = _a.footer, getOptionGroup = _a.getOptionGroup, getOptionIsBatch = _a.getOptionIsBatch, getOptionIsDisabled = _a.getOptionIsDisabled, getOptionLabel = _a.getOptionLabel, getOptionValue = _a.getOptionValue, header = _a.header, _f = _a.loading, loading = _f === void 0 ? false : _f, _g = _a.multiple, multiple = _g === void 0 ? false : _g, onChange = _a.onChange, options = _a.options, placeholder = _a.placeholder, _h = _a.search, search = _h === void 0 ? true : _h, _j = _a.tabIndex, tabIndex = _j === void 0 ? 0 : _j, value = _a.value;
|
|
108
|
+
var I18n = useI18nContext();
|
|
109
|
+
var selectApi = useSuperSelect({
|
|
110
|
+
components: components,
|
|
111
|
+
defaultValue: defaultValue,
|
|
112
|
+
disabled: disabled,
|
|
113
|
+
getOptionGroup: getOptionGroup,
|
|
114
|
+
getOptionIsBatch: getOptionIsBatch,
|
|
115
|
+
getOptionIsDisabled: getOptionIsDisabled,
|
|
116
|
+
getOptionLabel: getOptionLabel,
|
|
117
|
+
getOptionValue: getOptionValue,
|
|
118
|
+
multiple: multiple,
|
|
119
|
+
onChange: onChange,
|
|
120
|
+
options: options,
|
|
121
|
+
search: search,
|
|
122
|
+
value: value,
|
|
123
|
+
});
|
|
124
|
+
var _k = React.useState(0), listHeight = _k[0], setListHeight = _k[1];
|
|
125
|
+
React.useImperativeHandle(ref, function () { return selectApi; });
|
|
126
|
+
React.useEffect(function () {
|
|
127
|
+
if (value && onChange === undefined) {
|
|
128
|
+
console.warn('Must provide both a `value` and `onChange` prop for a controlled Select');
|
|
129
|
+
}
|
|
130
|
+
}, []);
|
|
131
|
+
var ReferenceComponent = multiple
|
|
132
|
+
? MultiSelectReference
|
|
133
|
+
: SingleSelectReference;
|
|
134
|
+
return (React.createElement(SuperSelectContext.Provider, { value: selectApi },
|
|
135
|
+
React.createElement(ReferenceComponent, { ref: selectApi.floating.reference, search: search, selectApi: selectApi, block: block, loading: loading, disabled: disabled, placeholder: placeholder, error: error, tabIndex: tabIndex }),
|
|
136
|
+
React.createElement(FloatingPortal, null, selectApi.open && (React.createElement(FloatingFocusManager, { context: selectApi.floating.context, order: search ? ['content', 'reference'] : ['reference', 'content'], initialFocus: multiple ? false : 0 },
|
|
137
|
+
React.createElement(StyledOverlay, __assign({}, selectApi.getFloatingProps(), { role: search ? 'dialog' : 'none', ref: selectApi.floating.floating, id: selectApi.overlayId, style: {
|
|
138
|
+
position: selectApi.floating.strategy,
|
|
139
|
+
left: selectApi.floating.x || 0,
|
|
140
|
+
top: selectApi.floating.y || 0,
|
|
141
|
+
width: selectApi.width,
|
|
142
|
+
maxHeight: selectApi.maxHeight,
|
|
143
|
+
zIndex: 10,
|
|
144
|
+
} }),
|
|
145
|
+
search && !multiple && (React.createElement(StyledSearch, null,
|
|
146
|
+
React.createElement(Typeahead, __assign({}, selectApi.getTypeaheadProps(), { placeholder: I18n.t('core.select.search') })))),
|
|
147
|
+
header && (React.createElement(StyledHeader, null,
|
|
148
|
+
React.createElement("div", null, header))),
|
|
149
|
+
selectApi.options.length > 0 ? (React.createElement(StyledOptions, { style: { height: listHeight + spacing.sm * 2 } },
|
|
150
|
+
React.createElement(StyledVirtuoso, { role: "listbox", id: selectApi.overlayId, ref: selectApi.virtuoso, data: selectApi.options, components: { Item: SuperSelectMenuItem }, initialTopMostItemIndex: selectApi.selectedIndex >= 0 ? selectApi.selectedIndex : 0, totalListHeightChanged: setListHeight, tabIndex: -1 }))) : (React.createElement(Box, { padding: "md lg" },
|
|
151
|
+
React.createElement(Typography, { italic: true, color: "gray50" }, emptyMessage))),
|
|
152
|
+
footer && (React.createElement(StyledFooter, { onKeyDown: function (e) {
|
|
153
|
+
if (e.key !== 'Escape') {
|
|
154
|
+
e.stopPropagation();
|
|
155
|
+
}
|
|
156
|
+
}, padding: "md lg" }, footer))))))));
|
|
157
|
+
}
|
|
158
|
+
export var SuperSelect = React.forwardRef(SelectComponent);
|
|
159
|
+
//# sourceMappingURL=SuperSelect.js.map
|
|
@@ -0,0 +1 @@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,EAAE,SAAS,CAAC,QAAQ,EACvB,IAAI,EAAE,SAAS,CAAC,OAAO,EACvB,UAAU,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,EACzC,uBAAuB,EACrB,SAAS,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAE5D,sBAAsB,EAAE,aAAa,EACrC,QAAQ,EAAE,CAAC,CAAC,GACZ,CACY,CACjB,CAAC,CAAC,CAAC,CACF,oBAAC,GAAG,IAAC,OAAO,EAAC,OAAO;oBAClB,oBAAC,UAAU,IAAC,MAAM,QAAC,KAAK,EAAC,QAAQ,IAC9B,YAAY,CACF,CACT,CACP;gBACA,MAAM,IAAI,CACT,oBAAC,YAAY,IACX,SAAS,EAAE,UAAC,CAAC;wBACX,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;4BACtB,CAAC,CAAC,eAAe,EAAE,CAAA;yBACpB;oBACH,CAAC,EACD,OAAO,EAAC,OAAO,IAEd,MAAM,CACM,CAChB,CACa,CACK,CACxB,CACc,CACW,CAC/B,CAAA;AACH,CAAC;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledOverlay: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../_utils/types").DivAttributes & import("..").CardProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
3
|
+
export declare const StyledVirtuoso: import("styled-components").StyledComponent<(<ItemData = any, Context = any>(props: import("react-virtuoso").VirtuosoProps<ItemData, Context> & {
|
|
4
|
+
ref?: any;
|
|
5
|
+
}) => ReactElement), any, {}, never>;
|
|
6
|
+
export declare const StyledEllipses: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { Virtuoso } from 'react-virtuoso';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { Card } from '../Card/Card';
|
|
8
|
+
import { getEllipsis } from '../_styles/mixins';
|
|
9
|
+
export var StyledOverlay = styled(Card)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
|
|
10
|
+
export var StyledVirtuoso = styled(Virtuoso)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex: 1 1 auto;\n"], ["\n flex: 1 1 auto;\n"])));
|
|
11
|
+
export var StyledEllipses = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n display: inline-flex;\n\n > div {\n display: inline-flex;\n width: 100%;\n }\n"], ["\n ", "\n display: inline-flex;\n\n > div {\n display: inline-flex;\n width: 100%;\n }\n"])), getEllipsis());
|
|
12
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
13
|
+
//# sourceMappingURL=SuperSelect.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuperSelect.styles.js","sourceRoot":"","sources":["../../src/SuperSelect/SuperSelect.styles.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,MAAM,CAAC,IAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,oHAAA,iDAGxC,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,0FAAA,uBAE7C,IAAA,CAAA;AAED,MAAM,CAAC,IAAM,cAAc,GAAG,MAAM,CAAC,GAAG,uKAAA,MACpC,EAAa,4FAOhB,KAPG,WAAW,EAAE,CAOhB,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSuperSelect } from './useSuperSelect';
|
|
3
|
+
export interface SuperSelectProps {
|
|
4
|
+
block?: boolean;
|
|
5
|
+
components?: {
|
|
6
|
+
Label?: React.FC<{
|
|
7
|
+
selectApi: SuperSelectApi;
|
|
8
|
+
}>;
|
|
9
|
+
MenuItemLabel?: React.FC<{
|
|
10
|
+
selectApi: SuperSelectApi;
|
|
11
|
+
option: any;
|
|
12
|
+
}>;
|
|
13
|
+
Token?: React.FC<{
|
|
14
|
+
selectApi: SuperSelectApi;
|
|
15
|
+
option: any;
|
|
16
|
+
index: number;
|
|
17
|
+
focused: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
defaultValue?: SuperSelectValue;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
emptyMessage: string;
|
|
23
|
+
error?: boolean;
|
|
24
|
+
footer?: React.ReactElement;
|
|
25
|
+
getOptionGroup?: (option: any) => string;
|
|
26
|
+
getOptionIsBatch?: (option: any) => boolean;
|
|
27
|
+
getOptionIsDisabled?: (option: any) => boolean;
|
|
28
|
+
getOptionLabel?: (option: any) => string;
|
|
29
|
+
getOptionValue?: (option: any) => SuperSelectValuePrimitive;
|
|
30
|
+
header?: React.ReactElement;
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
multiple?: boolean;
|
|
33
|
+
multipleOptions?: any[];
|
|
34
|
+
multipleOptionsLabel?: string;
|
|
35
|
+
onChange?: (value: SuperSelectValue) => void;
|
|
36
|
+
options: Record<string, any>[];
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
search?: boolean;
|
|
39
|
+
tabIndex?: number;
|
|
40
|
+
value?: SuperSelectValue;
|
|
41
|
+
}
|
|
42
|
+
export interface TokenNavigationProps {
|
|
43
|
+
activeIndex?: number | null;
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
onChange?: (value: SuperSelectValue) => void;
|
|
46
|
+
onNavigate?: (index: number | null) => void;
|
|
47
|
+
value?: SuperSelectValue;
|
|
48
|
+
}
|
|
49
|
+
export interface KeyboardSelectionProps {
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
onSelect?: () => void;
|
|
52
|
+
}
|
|
53
|
+
export declare type SuperSelectValuePrimitive = boolean | string | number;
|
|
54
|
+
export declare type SuperSelectValue = SuperSelectValuePrimitive | Array<SuperSelectValuePrimitive> | null;
|
|
55
|
+
export declare type SuperSelectOption = any;
|
|
56
|
+
export interface SuperSelectConfig {
|
|
57
|
+
components?: {
|
|
58
|
+
Label?: React.FC<{
|
|
59
|
+
selectApi: SuperSelectApi;
|
|
60
|
+
}>;
|
|
61
|
+
MenuItemLabel?: React.FC<{
|
|
62
|
+
selectApi: SuperSelectApi;
|
|
63
|
+
option: any;
|
|
64
|
+
}>;
|
|
65
|
+
Token?: React.FC<{
|
|
66
|
+
selectApi: SuperSelectApi;
|
|
67
|
+
option: any;
|
|
68
|
+
index: number;
|
|
69
|
+
focused: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
};
|
|
72
|
+
defaultValue?: SuperSelectValue;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
getOptionGroup?: (option: SuperSelectOption) => string;
|
|
75
|
+
getOptionIsBatch?: (option: SuperSelectOption) => boolean;
|
|
76
|
+
getOptionIsDisabled?: (option: SuperSelectOption) => boolean;
|
|
77
|
+
getOptionLabel?: (option: SuperSelectOption) => string;
|
|
78
|
+
getOptionValue?: (option: SuperSelectOption) => SuperSelectValuePrimitive;
|
|
79
|
+
multiple?: boolean;
|
|
80
|
+
onChange?: (value: SuperSelectValue) => void;
|
|
81
|
+
options?: Array<any>;
|
|
82
|
+
search?: boolean;
|
|
83
|
+
value?: SuperSelectValue;
|
|
84
|
+
}
|
|
85
|
+
export declare type SuperSelectApi = ReturnType<typeof useSuperSelect>;
|
|
86
|
+
export interface SuperSelectReferenceProps {
|
|
87
|
+
selectApi: SuperSelectApi;
|
|
88
|
+
block?: boolean;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
error?: boolean;
|
|
91
|
+
loading?: boolean;
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
search?: boolean;
|
|
94
|
+
tabIndex?: number;
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuperSelect.types.js","sourceRoot":"","sources":["../../src/SuperSelect/SuperSelect.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { VirtuosoHandle } from 'react-virtuoso';
|
|
4
|
+
import { TypeaheadInputProps, TypeaheadProps } from '../Typeahead/Typeahead.types';
|
|
5
|
+
import { SuperSelectConfig, SuperSelectOption, SuperSelectValue, SuperSelectValuePrimitive } from './SuperSelect.types';
|
|
6
|
+
declare function getOptionIsOptgroup(item: any): boolean;
|
|
7
|
+
export declare function useSuperSelect({ components, defaultValue, disabled, getOptionGroup, getOptionIsBatch, getOptionIsDisabled, getOptionLabel, getOptionValue, multiple, onChange, options: sourceOptions, search, value: value_, }: SuperSelectConfig): {
|
|
8
|
+
activeMenuIndex: number | null;
|
|
9
|
+
activeTokenIndex: number | null;
|
|
10
|
+
components: {
|
|
11
|
+
Label?: React.FC<{
|
|
12
|
+
selectApi: any;
|
|
13
|
+
}> | undefined;
|
|
14
|
+
MenuItemLabel?: React.FC<{
|
|
15
|
+
selectApi: any;
|
|
16
|
+
option: any;
|
|
17
|
+
}> | undefined;
|
|
18
|
+
Token?: React.FC<{
|
|
19
|
+
selectApi: any;
|
|
20
|
+
option: any;
|
|
21
|
+
index: number;
|
|
22
|
+
focused: boolean;
|
|
23
|
+
}> | undefined;
|
|
24
|
+
} | undefined;
|
|
25
|
+
floating: import("@floating-ui/react-dom-interactions").UseFloatingReturn<HTMLElement>;
|
|
26
|
+
getClearProps: () => React.AriaAttributes & React.HTMLAttributes<HTMLElement>;
|
|
27
|
+
getFloatingProps: (userProps?: any) => Record<string, unknown>;
|
|
28
|
+
getItemProps: (userProps?: any) => Record<string, unknown>;
|
|
29
|
+
getMultiInputProps: () => React.AriaAttributes & React.InputHTMLAttributes<HTMLInputElement>;
|
|
30
|
+
getOptionGroup: (option: any) => string;
|
|
31
|
+
getOptionIsBatch: (option: any) => boolean;
|
|
32
|
+
getOptionIsDisabled: (option: any) => boolean;
|
|
33
|
+
getOptionIsOptgroup: typeof getOptionIsOptgroup;
|
|
34
|
+
getOptionLabel: (option: any) => string;
|
|
35
|
+
getOptionValue: (option: any) => SuperSelectValuePrimitive;
|
|
36
|
+
getReferenceProps: (userProps?: any) => Record<string, unknown>;
|
|
37
|
+
getTokenClearProps: (index: number) => React.AriaAttributes & React.SVGAttributes<SVGElement>;
|
|
38
|
+
getTypeaheadProps: () => React.AriaAttributes & TypeaheadInputProps & TypeaheadProps;
|
|
39
|
+
isEmpty: () => boolean;
|
|
40
|
+
isSelected: (option: any) => boolean;
|
|
41
|
+
listId: string;
|
|
42
|
+
maxHeight: number;
|
|
43
|
+
multiple: boolean;
|
|
44
|
+
navigationListRef: React.MutableRefObject<(HTMLElement | null)[]>;
|
|
45
|
+
onSelect: (option: SuperSelectOption) => void;
|
|
46
|
+
open: boolean;
|
|
47
|
+
sourceOptions: any[];
|
|
48
|
+
options: any[];
|
|
49
|
+
overlayId: string;
|
|
50
|
+
searchValue: string;
|
|
51
|
+
selectedIndex: number;
|
|
52
|
+
selectedOption: any;
|
|
53
|
+
selectedLabel: string;
|
|
54
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
55
|
+
setPointer: React.Dispatch<React.SetStateAction<boolean>>;
|
|
56
|
+
setSearchValue: import("lodash").DebouncedFunc<React.Dispatch<React.SetStateAction<string>>>;
|
|
57
|
+
value: SuperSelectValue;
|
|
58
|
+
virtuoso: React.RefObject<VirtuosoHandle>;
|
|
59
|
+
width: number;
|
|
60
|
+
};
|
|
61
|
+
export {};
|