@ozen-ui/kit
Version:
React component library
45 lines (44 loc) • 1.39 kB
JavaScript
import { useContext, createContext } from 'react';
import { isDev } from '../../constants/environment';
export var DataListBaseContextDefaultValue = {
optionsStore: {
setFocused: function () { },
availableOptions: { current: [] },
options: {
current: [],
},
currentOption: { current: null },
focused: { current: null },
setCurrentOption: function () { },
getOptionFullInfo: function () { return null; },
getOptionIndex: function () { return null; },
unregisterOption: function () { },
registerOption: function () { },
hasOptions: false,
},
optionsControl: {
isFocused: function () { return false; },
isSelected: function () { return false; },
},
scrollControl: {
scrollToOption: function () { },
},
valueControl: {
value: null,
hasValue: false,
setValue: function () { },
selectedOptionsLength: 0,
lastSelected: null,
},
multiple: false,
active: false,
disabled: true,
};
export var DataListBaseContext = createContext(DataListBaseContextDefaultValue);
export var useDataListBaseContext = function () {
return useContext(DataListBaseContext);
};
// Именованный провайдер
if (isDev) {
DataListBaseContext.displayName = 'DataListBaseContext';
}