Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. const comboBox = Machine(
  2. {
  3. id: 'combobox',
  4. context: {
  5. value: '',
  6. highlightedIndex: 0,
  7. items: ['hello'],
  8. matchedItems: [],
  9. },
  10. initial: 'idle',
  11. states: {
  12. idle: {
  13. on: {
  14. FOCUS: 'focused',
  15. },
  16. },
  17. focused: {
  18. type: 'parallel',
  19. states: {
  20. editing: {
  21. on: {
  22. CHANGE: {
  23. target: 'editing',
  24. actions: 'change',
  25. },
  26. BLUR: '#combobox.complete',
  27. },
  28. },
  29. suggesting: {
  30. initial: 'idle',
  31. states: {
  32. idle: {
  33. on: {
  34. CHANGE: 'navigating'
  35. },
  36. },
  37. navigating: {
  38. on: {
  39. NAVIGATE: 'navigating',
  40. SELECT: 'idle',
  41. EMPTY: 'idle',
  42. },
  43. },
  44. },
  45. },
  46. },
  47. },
  48. complete: {},
  49. },
  50. },
  51. {
  52. actions: {
  53. //change: assign(),
  54. change: () => {}
  55. },
  56. }
  57. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement