Files
ETB/ETB-FrontEnd/node_modules/.cache/babel-loader/bf230080d86bf0ed4c1554470c75459df340fb30946884e020bb7c1bb47e855b.json
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

1 line
6.9 KiB
JSON

{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { moveHighlight, listReducer, ListActionTypes, handleItemSelection } from '../useList';\nimport { SelectActionTypes } from './useSelect.types';\nexport function selectReducer(state, action) {\n const {\n open\n } = state;\n const {\n context: {\n selectionMode\n }\n } = action;\n if (action.type === SelectActionTypes.buttonClick) {\n var _state$selectedValues;\n const itemToHighlight = (_state$selectedValues = state.selectedValues[0]) != null ? _state$selectedValues : moveHighlight(null, 'start', action.context);\n return _extends({}, state, {\n open: !open,\n highlightedValue: !open ? itemToHighlight : null\n });\n }\n if (action.type === SelectActionTypes.browserAutoFill) {\n return handleItemSelection(action.item, state, action.context);\n }\n const newState = listReducer(state, action);\n switch (action.type) {\n case ListActionTypes.keyDown:\n if (state.open) {\n if (action.event.key === 'Escape') {\n return _extends({}, newState, {\n open: false\n });\n }\n } else {\n if (action.event.key === 'ArrowDown') {\n var _state$selectedValues2;\n return _extends({}, state, {\n open: true,\n highlightedValue: (_state$selectedValues2 = state.selectedValues[0]) != null ? _state$selectedValues2 : moveHighlight(null, 'start', action.context)\n });\n }\n if (action.event.key === 'ArrowUp') {\n var _state$selectedValues3;\n return _extends({}, state, {\n open: true,\n highlightedValue: (_state$selectedValues3 = state.selectedValues[0]) != null ? _state$selectedValues3 : moveHighlight(null, 'end', action.context)\n });\n }\n }\n break;\n case ListActionTypes.itemClick:\n if (selectionMode === 'single') {\n return _extends({}, newState, {\n open: false\n });\n }\n break;\n case ListActionTypes.blur:\n return _extends({}, newState, {\n open: false\n });\n default:\n return newState;\n }\n return newState;\n}","map":{"version":3,"names":["_extends","moveHighlight","listReducer","ListActionTypes","handleItemSelection","SelectActionTypes","selectReducer","state","action","open","context","selectionMode","type","buttonClick","_state$selectedValues","itemToHighlight","selectedValues","highlightedValue","browserAutoFill","item","newState","keyDown","event","key","_state$selectedValues2","_state$selectedValues3","itemClick","blur"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/base/useSelect/selectReducer.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport { moveHighlight, listReducer, ListActionTypes, handleItemSelection } from '../useList';\nimport { SelectActionTypes } from './useSelect.types';\nexport function selectReducer(state, action) {\n const {\n open\n } = state;\n const {\n context: {\n selectionMode\n }\n } = action;\n if (action.type === SelectActionTypes.buttonClick) {\n var _state$selectedValues;\n const itemToHighlight = (_state$selectedValues = state.selectedValues[0]) != null ? _state$selectedValues : moveHighlight(null, 'start', action.context);\n return _extends({}, state, {\n open: !open,\n highlightedValue: !open ? itemToHighlight : null\n });\n }\n if (action.type === SelectActionTypes.browserAutoFill) {\n return handleItemSelection(action.item, state, action.context);\n }\n const newState = listReducer(state, action);\n switch (action.type) {\n case ListActionTypes.keyDown:\n if (state.open) {\n if (action.event.key === 'Escape') {\n return _extends({}, newState, {\n open: false\n });\n }\n } else {\n if (action.event.key === 'ArrowDown') {\n var _state$selectedValues2;\n return _extends({}, state, {\n open: true,\n highlightedValue: (_state$selectedValues2 = state.selectedValues[0]) != null ? _state$selectedValues2 : moveHighlight(null, 'start', action.context)\n });\n }\n if (action.event.key === 'ArrowUp') {\n var _state$selectedValues3;\n return _extends({}, state, {\n open: true,\n highlightedValue: (_state$selectedValues3 = state.selectedValues[0]) != null ? _state$selectedValues3 : moveHighlight(null, 'end', action.context)\n });\n }\n }\n break;\n case ListActionTypes.itemClick:\n if (selectionMode === 'single') {\n return _extends({}, newState, {\n open: false\n });\n }\n break;\n case ListActionTypes.blur:\n return _extends({}, newState, {\n open: false\n });\n default:\n return newState;\n }\n return newState;\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,SAASC,aAAa,EAAEC,WAAW,EAAEC,eAAe,EAAEC,m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