gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commita06fc778a06fc778Reset virtual-list window when the host changes resetKeyAtlasa06fc778/components/modal/demo.hl

2.8 KB

  1. // demo.hl — `/modal`: four modals on one page, opened by the page's buttons, and the reason each one closed with. The page opens a
  2. // modal by its dialog's id (`showModal()`), closes one itself (`close('saved')`), and hears the modal's bubbling `close` on a wrapper element.
  3. parent '../main.hl'
  4. import Modal from './modal.hl'
  5. __title = 'Modal · Hybriel components'
  6. String lastClosed = 'nothing yet'
  7. String saved = ''
  8. Hybrid paragraphs = longText()
  9. longText() {
  10. out = []
  11. let i = 1
  12. while (i <= 20) { out.push('Paragraph ' + i + ': the page behind stays where it was while this scrolls.') i = i + 1 }
  13. return out
  14. }
  15. View {
  16. modalDemo { on close(e) { emit demoClosed(e) }
  17. h1 { "Modal" }
  18. p { class = "muted" "A window over the page: the page behind is dimmed and blocked. Esc, the × and a click on the dim background close it; the page is told how it was closed." }
  19. p { class = "modal-openers"
  20. button { type = "button" id = "open-info" "Information" on click(e) { emit demoOpen('info') } }
  21. button { type = "button" id = "open-confirm" "Confirm (OK / Cancel)" on click(e) { emit demoOpen('confirm') } }
  22. button { type = "button" id = "open-form" "A form (no background close)" on click(e) { emit demoOpen('form') } }
  23. button { type = "button" id = "open-long" "Long text" on click(e) { emit demoOpen('long') } }
  24. }
  25. p { "Last closed: " output { id = "modal-last" lastClosed } }
  26. p { "Saved name: " output { id = "modal-saved" saved } }
  27. p { a { id = "readme" href = "/modal/README.md" "README (how to use it)" } }
  28. Modal { id = "info" title = "Information"
  29. p { "A modal holds any content. Close it with the ×, Esc or a click on the dim background." }
  30. }
  31. Modal { id = "confirm" title = "Delete the draft?"
  32. p { "The draft will be gone. This cannot be undone." }
  33. footer {
  34. button { type = "button" value = "cancel" "Cancel" }
  35. button { type = "button" value = "ok" "Delete" }
  36. }
  37. }
  38. Modal { id = "form" title = "Your name" backdropClose = "false"
  39. p { "A click on the background does not close this one: only the ×, Esc, Cancel or Save." }
  40. p { label { "Name " input { id = "modal-name" type = "text" autocomplete = "off" } } }
  41. footer {
  42. button { type = "button" value = "cancel" "Cancel" }
  43. button { type = "button" id = "modal-save" "Save" on click(e) { emit demoSave(e) } }
  44. }
  45. }
  46. Modal { id = "long" title = "Long text"
  47. p { "The window keeps inside the screen; its content scrolls, the page behind does not." }
  48. for (t of paragraphs) { p { t } }
  49. }
  50. }
  51. }
  52. on demoOpen(id) { document.getElementById(id).showModal() }
  53. // "Save" is the page's own button: the page takes the name and closes the modal itself, with its own reason
  54. on demoSave(e) {
  55. saved = document.getElementById('modal-name').value
  56. document.getElementById('form').close('saved')
  57. }
  58. on demoClosed(e) { lastClosed = e.detail.id + ': ' + e.detail.reason }

Branches

Latest commits

  • a06fc778Reset virtual-list window when the host changes resetKeyAtlas
  • 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
  • 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
  • f5f131c5Record AP29 autoplay comparisons and passing gatesmre
  • 51c38187Gate media autoplay on first load and after client mountmre
  • a3f2223dRecord successful B44 deployment and live proofmre
  • 06c1e021Record passing B44 browser rerunmre
  • c9861533Record B44 component proof and browser gate blockermre
  • 1b7413beIgnore detached media events and space demo option outputsmre
  • ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
  • df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
  • 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
  • 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
  • 9b872cedRecord IC28 deployment and live icon verificationmre
  • 46fefaa7Count the icons entry in the offline home-page checkmre
  • c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
  • 5e090ffdRecord IC28 review evidence and gate resultsmre
  • adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre
  • c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre