Sha256: 9a1fddefa9a168c72eff44d784db787969f7ee3806d3a48df15ca64c03ba5326

Contents?: true

Size: 1.06 KB

Versions: 2087

Compression:

Stored size: 1.06 KB

Contents

<%= pb_rails("date_picker", props: {
  label: "onChange",
  picker_id: "date-picker-hooks-onchange"
}) %>

<%= javascript_tag do %>
  window.addEventListener("DOMContentLoaded", () => {
    <%# Access flatpickr instance with picker id and assign it a variable %>
    const fp = document.querySelector("#date-picker-hooks-onchange")._flatpickr

    <%# Define Hook %>
    const changeHook = () => {
      alert('date changed')
    }
    <%# Push one or more hooks to onChange config array %>
    fp.config.onChange.push(changeHook)
  })
<% end %>

<%= pb_rails("date_picker", props: {
  label: "onOpen",
  picker_id: "date-picker-hooks-onopen"
}) %>

<%= javascript_tag do %>
  window.addEventListener("DOMContentLoaded", () => {
    <%# Access flatpickr instance with picker id and assign it a variable %>
    const fp = document.querySelector("#date-picker-hooks-onopen")._flatpickr

    <%# Define Hook %>
    const openHook = () => {
      alert('calendar opened')
    }
    <%# Push one or more hooks to onOpen config array %>
    fp.config.onOpen.push(openHook)
  })
<% end %>

Version data entries

2,087 entries across 2,087 versions & 2 rubygems

Version Path
playbook_ui-6.5.2 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb
playbook_ui-6.5.1 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb
playbook_ui-6.5.0 app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.html.erb