Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fileMachine = Machine({
- id: 'myform',
- context: {
- hello: 'world',
- },
- type: 'parallel',
- states: {
- YESNOCHECKBOX: {
- initial: 'IDLE',
- states: {
- IDLE: {
- on: {
- 'YESNOCHECKBOX.COMPLETE': 'COMPLETE',
- },
- },
- COMPLETE: {
- on: {
- 'YESNOCHECKBOX.CHANGE': 'COMPLETE',
- 'YESNOCHECKBOX.TOGGLE': 'IDLE',
- },
- },
- },
- },
- YESNORADIO: {
- initial: 'IDLE',
- states: {
- IDLE: {
- on: {
- 'YESNORADIO.COMPLETE': 'COMPLETE',
- },
- },
- COMPLETE: {
- on: {
- 'YESNORADIO.CHANGE': 'COMPLETE',
- },
- },
- },
- },
- FIRSTNAME: {
- initial: 'IDLE',
- states: {
- IDLE: {
- on: {
- 'FIRSTNAME.SINGLE': 'COMPLETE.SINGLE',
- couples: 'complete.couples',
- family: 'complete.family',
- singleParent: 'complete.singleParent',
- },
- },
- complete: {
- initial: 'single',
- states: {
- single: {
- on: {
- couples: 'couples',
- family: 'family',
- singleParent: 'singleParent',
- },
- },
- couples: {
- on: {
- single: 'single',
- family: 'family',
- singleParent: 'singleParent',
- },
- },
- family: {
- on: {
- single: 'single',
- couples: 'couples',
- singleParent: 'singleParent',
- },
- },
- singleParent: {
- on: {
- single: 'single',
- couples: 'couples',
- family: 'family',
- },
- },
- },
- },
- },
- },
- FIRSTNAME: {
- initial: 'IDLE',
- states: {
- IDLE: {
- on: {
- 'FIRSTNAME.FOCUS': 'EDITING',
- },
- },
- EDITING: {
- on: {
- 'FIRSTNAME.BLUR': 'VALIDATING',
- },
- },
- VALIDATING: {
- on: {
- 'FIRSTNAME.RESOLVE': 'COMPLETE',
- 'FIRSTNAME.REJECT': 'EDITING',
- },
- },
- COMPLETE: {
- on: {
- 'FIRSTNAME.FOCUS': 'EDITING',
- },
- },
- },
- },
- LASTNAME: {
- initial: 'IDLE',
- states: {
- IDLE: {
- on: {
- 'LASTNAME.FOCUS': 'EDITING',
- },
- },
- EDITING: {
- on: {
- 'LASTNAME.BLUR': 'VALIDATING',
- },
- },
- VALIDATING: {
- on: {
- 'LASTNAME.RESOLVE': 'COMPLETE',
- 'LASTNAME.REJECT': 'EDITING',
- },
- },
- COMPLETE: {
- on: {
- 'LASTNAME.FOCUS': 'EDITING',
- },
- },
- },
- },
- },
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement