UNPKG

@trail-ui/react

Version:
726 lines (705 loc) 25.4 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/editable-table/editable-components/multiselect.tsx var multiselect_exports = {}; __export(multiselect_exports, { default: () => EditableMultiSelect }); module.exports = __toCommonJS(multiselect_exports); var import_react7 = require("react"); var import_react_select = __toESM(require("react-select")); // src/toast/index.ts var toast_exports = {}; __export(toast_exports, { customToast: () => customToast }); // src/flag/flag.tsx var import_react4 = require("react"); var import_theme4 = require("@trail-ui/theme"); var import_icons = require("@trail-ui/icons"); // src/button/button.tsx var import_react2 = require("react"); var import_react_aria_components = require("react-aria-components"); var import_theme2 = require("@trail-ui/theme"); // src/spinner/spinner.tsx var import_theme = require("@trail-ui/theme"); var import_react = require("react"); // src/spinner/spinners/bars.tsx var import_jsx_runtime = require("react/jsx-runtime"); var Bars = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 135 140", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", ...props, children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("rect", { y: "10", width: "15", height: "120", rx: "6", children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "height", begin: "0.5s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "y", begin: "0.5s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("rect", { x: "30", y: "10", width: "15", height: "120", rx: "6", children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "height", begin: "0.25s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "y", begin: "0.25s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("rect", { x: "60", width: "15", height: "140", rx: "6", children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "height", begin: "0s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "y", begin: "0s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("rect", { x: "90", y: "10", width: "15", height: "120", rx: "6", children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "height", begin: "0.25s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "y", begin: "0.25s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("rect", { x: "120", y: "10", width: "15", height: "120", rx: "6", children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "height", begin: "0.5s", dur: "1s", values: "120;110;100;90;80;70;60;50;40;140;120", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "animate", { attributeName: "y", begin: "0.5s", dur: "1s", values: "10;15;20;25;30;35;40;45;50;0;10", calcMode: "linear", repeatCount: "indefinite" } ) ] }) ] }); // src/spinner/spinners/dots.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); var Dots = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 120 30", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", ...props, children: [ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("circle", { cx: "15", cy: "15", r: "15", children: [ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { attributeName: "r", from: "15", to: "15", begin: "0s", dur: "0.8s", values: "15;9;15", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { attributeName: "fill-opacity", from: "1", to: "1", begin: "0s", dur: "0.8s", values: "1;.5;1", calcMode: "linear", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("circle", { cx: "60", cy: "15", r: "9", fillOpacity: "0.3", children: [ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { attributeName: "r", from: "9", to: "9", begin: "0s", dur: "0.8s", values: "9;15;9", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { attributeName: "fill-opacity", from: "0.5", to: "0.5", begin: "0s", dur: "0.8s", values: ".5;1;.5", calcMode: "linear", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("circle", { cx: "105", cy: "15", r: "15", children: [ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { attributeName: "r", from: "15", to: "15", begin: "0s", dur: "0.8s", values: "15;9;15", calcMode: "linear", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "animate", { attributeName: "fill-opacity", from: "1", to: "1", begin: "0s", dur: "0.8s", values: "1;.5;1", calcMode: "linear", repeatCount: "indefinite" } ) ] }) ] }); // src/spinner/spinners/ring.tsx var import_jsx_runtime3 = require("react/jsx-runtime"); var Ring = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( "svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 38 38", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { transform: "translate(2.5 2.5)", strokeWidth: "5", children: [ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { strokeOpacity: ".5", cx: "16", cy: "16", r: "16" }), /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M32 16c0-9.94-8.06-16-16-16", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( "animateTransform", { attributeName: "transform", type: "rotate", from: "0 16 16", to: "360 16 16", dur: "1s", repeatCount: "indefinite" } ) }) ] }) }) } ); // src/spinner/spinners/spin.tsx var import_jsx_runtime4 = require("react/jsx-runtime"); var Spin = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { children: [ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("circle", { cx: "12", cy: "12", r: "9.5", fill: "none", strokeWidth: "3", strokeLinecap: "round", children: [ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( "animate", { attributeName: "stroke-dasharray", dur: "1.5s", calcMode: "spline", values: "0 150;42 150;42 150;42 150", keyTimes: "0;0.475;0.95;1", keySplines: "0.42,0,0.58,1;0.42,0,0.58,1;0.42,0,0.58,1", repeatCount: "indefinite" } ), /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( "animate", { attributeName: "stroke-dashoffset", dur: "1.5s", calcMode: "spline", values: "0;-16;-59;-59", keyTimes: "0;0.475;0.95;1", keySplines: "0.42,0,0.58,1;0.42,0,0.58,1;0.42,0,0.58,1", repeatCount: "indefinite" } ) ] }), /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( "animateTransform", { attributeName: "transform", type: "rotate", dur: "2s", values: "0 12 12;360 12 12", repeatCount: "indefinite" } ) ] }) }); // src/spinner/spinner.tsx var import_jsx_runtime5 = require("react/jsx-runtime"); var SPINNERS = { bars: Bars, dots: Dots, ring: Ring, spin: Spin }; var DEFAULT_SPINNER = "spin"; function Spinner(props, ref) { const { className, variant = DEFAULT_SPINNER, color, size, ...spinnerProps } = props; const defaultSpinner = variant in SPINNERS ? variant : DEFAULT_SPINNER; const SpinnerComponent = SPINNERS[defaultSpinner]; const styles = (0, import_react.useMemo)( () => (0, import_theme.spinner)({ color, size, className }), [className, color, size] ); return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SpinnerComponent, { "aria-hidden": true, className: styles, ref, ...spinnerProps }); } var _Spinner = (0, import_react.forwardRef)(Spinner); // src/button/button.tsx var import_jsx_runtime6 = require("react/jsx-runtime"); function Button(props, ref) { const { appearance, // size = 'md', spacing = "default", fullWidth, isLoading, spinner: spinner2 = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(_Spinner, { color: "current", size: "sm", ...props.spinnerProps }), spinnerPlacement = "start", startContent: startContentProp, endContent: endContentProp, disableAnimation, className, children, ...otherProps } = props; const styles = (0, import_react2.useMemo)( () => (0, import_theme2.button)({ // size, isLoading, spinnerPlacement, startContentProp: !!startContentProp, endContentProp: !!endContentProp, appearance, spacing, fullWidth, disableAnimation, className }), [ isLoading, spinnerPlacement, startContentProp, endContentProp, appearance, spacing, fullWidth, disableAnimation, className ] ); const getIconClone = (icon) => (0, import_react2.isValidElement)(icon) ? (0, import_react2.cloneElement)(icon, { "aria-hidden": true, focusable: false, tabIndex: -1 }) : null; const startContent = getIconClone(startContentProp); const endContent = getIconClone(endContentProp); return ( // @ts-ignore /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_aria_components.Button, { ref, className: styles, ...otherProps, children: () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [ !isLoading && startContent, isLoading && spinnerPlacement === "start" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "shrink-0", children: [ spinner2, /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { "aria-atomic": "true", "aria-live": "polite", className: "sr-only", children: [ "Loading", " " ] }) ] }), children, isLoading && spinnerPlacement === "end" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "shrink-0", children: [ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { "aria-atomic": "true", "aria-live": "polite", className: "sr-only", children: [ "Loading", " " ] }), spinner2 ] }), !isLoading && endContent ] }) }) ); } var _Button = (0, import_react2.forwardRef)(Button); // src/button/icon-button.tsx var import_theme3 = require("@trail-ui/theme"); var import_react3 = require("react"); var import_react_aria_components2 = require("react-aria-components"); var import_jsx_runtime7 = require("react/jsx-runtime"); function IconButton(props, ref) { const { appearance, spacing, disableAnimation, className, children, ...otherProps } = props; const styles = (0, import_react3.useMemo)( () => (0, import_theme3.button)({ isIconOnly: true, appearance, spacing, disableAnimation, className }), [className, disableAnimation, appearance, spacing] ); const element = children; const _children = (0, import_react3.isValidElement)(element) ? (0, import_react3.cloneElement)(element, { "aria-hidden": true, focusable: false }) : null; return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_aria_components2.Button, { ref, className: styles, ...otherProps, children: _children }); } var _IconButton = (0, import_react3.forwardRef)(IconButton); // src/flag/flag.tsx var import_jsx_runtime8 = require("react/jsx-runtime"); function Flag(props) { let flagIcon; const { title, desc, variant, hasActionBtn, actionBtnText, isClosable, onActionClick, onClose } = props; const variantProps = (0, import_theme4.filterVariantProps)(props, import_theme4.flag.variantKeys); const styles = (0, import_react4.useMemo)( () => (0, import_theme4.flag)({ ...variantProps, variant }), [variantProps, variant] ); switch (variant) { case "default": flagIcon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.SettingsIcon, { height: 24, width: 24 }); break; case "success": flagIcon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.CheckCircleIcon, { height: 24, width: 24 }); break; case "error": flagIcon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.ErrorIcon, { height: 24, width: 24 }); break; case "warning": flagIcon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.WarningIcon, { height: 24, width: 24 }); break; case "info": flagIcon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.InfoIcon, { height: 24, width: 24 }); break; default: break; } return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "shadow-medium flex w-full gap-1.5 rounded text-base", children: [ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${styles} flex w-12 min-w-12 items-center justify-center rounded-l`, children: flagIcon }), /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex w-full items-center p-2", children: [ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex w-full flex-col", children: [ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "font-semibold text-neutral-900", children: title }), /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm font-normal text-neutral-700", children: desc }) ] }), hasActionBtn && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(_Button, { appearance: "link", onPress: onActionClick, children: actionBtnText || "Action" }), isClosable && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( _IconButton, { spacing: "compact", appearance: "transparent", onPress: onClose, "aria-label": "Close", className: "ml-auto h-auto p-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.CloseIcon, { height: 24, width: 24, className: "text-neutral-600" }) } ) ] }) ] }) }); } // src/toast/toast.tsx var import_react_toastify = require("react-toastify"); var import_jsx_runtime9 = require("react/jsx-runtime"); function capitalizeText(text) { return (text == null ? void 0 : text.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ")) || ""; } function customToast(message, type, title, options = {}) { (0, import_react_toastify.toast)( /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-full overflow-hidden rounded", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flag, { variant: type, title: title != null ? title : capitalizeText(type), desc: message }) }), { delay: 1e3, ...options } ); } // src/toast/index.ts __reExport(toast_exports, require("react-toastify")); // src/editable-table/helpers.tsx function areArraysSame(a, b) { if (a.length !== b.length) return false; const countMap = /* @__PURE__ */ new Map(); for (const value of a) { countMap.set(value, (countMap.get(value) || 0) + 1); } for (const value of b) { if (!countMap.has(value)) return false; countMap.set(value, countMap.get(value) - 1); if (countMap.get(value) < 0) return false; } return true; } // src/editable-table/focus-handler/focus-handler-provider.tsx var import_react6 = __toESM(require("react")); // src/editable-table/table-context/table-context-provider.tsx var import_react5 = require("react"); var import_jsx_runtime10 = require("react/jsx-runtime"); var EditableTableContext = (0, import_react5.createContext)({ handleSaveData: () => { }, idSelector: () => { }, table: {} }); function useTableContext(cell) { const { handleSaveData, idSelector, table } = (0, import_react5.useContext)( EditableTableContext ); function updateData(value) { var _a; const accessorKey = cell.column.columnDef.accessorKey; handleSaveData({ accessorKey, columnId: cell.column.id, rowId: idSelector(cell.row.original), value }); (_a = table.options.meta) == null ? void 0 : _a.updateData(cell.row.id, cell.column.id, value); } return { updateData, idSelector, table }; } // src/editable-table/focus-handler/focus-handler-provider.tsx var import_jsx_runtime11 = require("react/jsx-runtime"); var FocusHandlerContext = (0, import_react6.createContext)({ tableRef: import_react6.default.createRef(), focusedCell: { columnIndex: 0, rowIndex: 0, isHeader: true }, setFocusedCell: () => { } }); function useFocusHandler(cell, isHeader) { var _a, _b; const { focusedCell, setFocusedCell, tableRef } = (0, import_react6.useContext)(FocusHandlerContext); const { table } = useTableContext(cell); const pageIndex = (_a = table == null ? void 0 : table.getState().pagination.pageIndex) != null ? _a : 0; const pageSize = (_b = table == null ? void 0 : table.getState().pagination.pageSize) != null ? _b : 10; const localRowIndex = cell ? cell.row.index - pageIndex * pageSize : 0; const isCurrentCellFocused = focusedCell.isHeader === isHeader && focusedCell.rowIndex === localRowIndex && focusedCell.columnIndex === (cell == null ? void 0 : cell.column.getIndex()); function focusCurrentCell() { if (!cell) return; setFocusedCell({ columnIndex: cell.column.getIndex(), rowIndex: localRowIndex, // 👈 Should be page-local isHeader: isHeader != null ? isHeader : false }); } return { focusedCell, setFocusedCell, tableRef, isCurrentCellFocused, focusCurrentCell }; } // src/editable-table/editable-components/multiselect.tsx var import_jsx_runtime12 = require("react/jsx-runtime"); function EditableMultiSelect({ cell, onCancel }) { const [open, setOpen] = (0, import_react7.useState)(false); const [value, setValue] = (0, import_react7.useState)([]); const [initialValue, setInitialValue] = (0, import_react7.useState)( [] ); const selectRef = (0, import_react7.useRef)(null); const { updateData } = useTableContext(cell); const { isCurrentCellFocused, focusCurrentCell, tableRef } = useFocusHandler(cell, false); const metaData = cell.column.columnDef.meta; const cancelAndExit = () => { setValue(cell.getValue()); requestAnimationFrame(() => { onCancel(); }); }; const saveAndExit = () => { const isEmpty = !areArraysSame(value, initialValue) && value.length === 0; if (isEmpty) { customToast("Value cannot be empty", "error"); cancelAndExit(); return; } if (!areArraysSame(value, initialValue)) { updateData(value); } requestAnimationFrame(() => { onCancel(); }); }; function onKeyDown(e) { if (e.key === "Enter") { e.preventDefault(); saveAndExit(); } else if (e.key === "Escape") { cancelAndExit(); e.preventDefault(); e.stopPropagation(); } else if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) { e.stopPropagation(); } } const onBlur = (e) => { if (!areArraysSame(value, initialValue)) { cancelAndExit(); } else { saveAndExit(); } }; (0, import_react7.useEffect)(() => { var _a; setInitialValue(cell.getValue()); setValue(cell.getValue()); (_a = selectRef.current) == null ? void 0 : _a.focus(); const inputElement = document.querySelector("#multi-input input"); if (inputElement) { inputElement.removeAttribute("aria-readonly"); inputElement.removeAttribute("aria-autocomplete"); inputElement.setAttribute("aria-haspopup", "listbox"); } }, []); (0, import_react7.useEffect)(() => { var _a, _b; if (isCurrentCellFocused && ((_a = tableRef.current) == null ? void 0 : _a.contains(document.activeElement))) (_b = selectRef.current) == null ? void 0 : _b.focus(); }, [isCurrentCellFocused]); return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [ open && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "sr-only", "aria-live": "polite", children: "Use Up and Down arrow keys to choose options, press Enter/Space to select the currently focused option, press Escape to exit the multiselect and the editing mode, press Tab to save the selected option to exit the editing mode." }), /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( import_react_select.default, { id: "multi-input", ref: selectRef, "aria-label": metaData.label, placeholder: metaData.placeholder, styles: metaData.customStyles, className: `max-w-[${cell.column.columnDef.size}px] w-full shadow-red-500`, isMulti: true, isSearchable: false, isClearable: false, closeMenuOnSelect: false, tabSelectsValue: false, menuPosition: "fixed", defaultValue: { label: "", value: "" }, value: metaData.options.filter((opt) => value.includes(opt.value)), onMenuOpen: () => setOpen(true), onMenuClose: () => { setOpen(false); updateData(value); }, onChange: (selectedOptions) => { setValue(selectedOptions.map((opt) => opt.value)); }, onBlur, onKeyDown, onFocus: focusCurrentCell, options: metaData.options } ) ] }); }