UNPKG

@empathyco/x-components

Version:
50 lines (47 loc) 1.46 kB
import { StateMachine } from '../../../../services/state-machine.service.js'; /** * State machine that defines the different states through which the search box * can transition. */ const machine = new StateMachine({ initial: 'initial', states: { initial: { UserAcceptedAQuery: 'filled', UserIsTypingAQuery: 'typing', }, typing: { UserAcceptedAQuery: 'filled', UserClearedQuery: 'empty', }, filled: { UserIsTypingAQuery: 'typing', UserFocusedSearchBox: 'focused', UserClearedQuery: 'empty', }, empty: { UserAcceptedAQuery: 'filled', UserIsTypingAQuery: 'typing', }, focused: { UserBlurredSearchBox: 'filled', UserClearedQuery: 'empty', UserIsTypingAQuery: 'typing', }, }, }); /** * Default implementation for the {@link SearchBoxActions.setInputStatus}. * * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions, * provided by Vuex. * @param context.commit - commit context. * @param event - The event used to transition the state machine. * @public */ const setInputStatus = ({ commit }, event) => { machine.transition(event); commit('setInputStatus', machine.currentState); }; export { setInputStatus }; //# sourceMappingURL=set-input-status.action.js.map