* @param {DropzoneState} state * @param {{type: string} & DropzoneState} action * @returns {DropzoneState}
(state, action)
| 1048 | * @returns {DropzoneState} |
| 1049 | */ |
| 1050 | function reducer(state, action) { |
| 1051 | /* istanbul ignore next */ |
| 1052 | switch (action.type) { |
| 1053 | case "focus": |
| 1054 | return { |
| 1055 | ...state, |
| 1056 | isFocused: true, |
| 1057 | }; |
| 1058 | case "blur": |
| 1059 | return { |
| 1060 | ...state, |
| 1061 | isFocused: false, |
| 1062 | }; |
| 1063 | case "openDialog": |
| 1064 | return { |
| 1065 | ...initialState, |
| 1066 | isFileDialogActive: true, |
| 1067 | }; |
| 1068 | case "closeDialog": |
| 1069 | return { |
| 1070 | ...state, |
| 1071 | isFileDialogActive: false, |
| 1072 | }; |
| 1073 | case "setDraggedFiles": |
| 1074 | return { |
| 1075 | ...state, |
| 1076 | isDragActive: action.isDragActive, |
| 1077 | isDragAccept: action.isDragAccept, |
| 1078 | isDragReject: action.isDragReject, |
| 1079 | }; |
| 1080 | case "setFiles": |
| 1081 | return { |
| 1082 | ...state, |
| 1083 | acceptedFiles: action.acceptedFiles, |
| 1084 | fileRejections: action.fileRejections, |
| 1085 | isDragReject: false, |
| 1086 | }; |
| 1087 | case "setDragGlobal": |
| 1088 | return { |
| 1089 | ...state, |
| 1090 | isDragGlobal: action.isDragGlobal, |
| 1091 | }; |
| 1092 | case "reset": |
| 1093 | return { |
| 1094 | ...initialState, |
| 1095 | }; |
| 1096 | default: |
| 1097 | return state; |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | function noop() {} |
| 1102 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…