Sha256: c41624b6de46969ee50ef924ddf4152538bfe812e561007a1b627050c8054e94

Contents?: true

Size: 859 Bytes

Versions: 54

Compression:

Stored size: 859 Bytes

Contents

<%= pb_rails("typeahead", props: { async: true, load_options: 'asyncPillsPromiseOptionsUsers', label: "Github Users", name: :foo, pills: true, placeholder: "type the name of a Github user" }) %>

<%= javascript_tag defer: "defer" do %>
  const filterUserResults = function(results) {
    return results.items.map(function(result) {
      return {
        imageUrl: result.avatar_url,
        label: result.login,
        value: result.id,
      }
    })
  }

  window.asyncPillsPromiseOptionsUsers = function(inputValue) {
    return new Promise(function(resolve) {
      if (inputValue) {
        fetch(`https://api.github.com/search/users?q=${inputValue}`)
          .then(function(response) { return response.json() })
          .then(function(results) { resolve(filterUserResults(results))})
      } else {
        resolve([])
      }
    })
  }
<% end %>

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.11.1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.11.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.10.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.9.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.8.4 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.8.3 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.8.2 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.8.1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.8.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.7.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.7.0 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.6.2.pre.alpha1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.6.2 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.6.1.pre.alpha1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb
playbook_ui-7.6.1 app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.html.erb