@dosgato/dialog 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,7 @@ function onKeyDown(choice, idx) {
47
47
  <ul class="dialog-btn-group" class:disabled class:valid class:invalid aria-disabled={disabled} role="radiogroup" aria-labelledby={groupid} on:blur>
48
48
  {#each choices as choice, i}
49
49
  {@const selected = choice.value === value}
50
- <li bind:this={elements[i]} role="radio" class:selected tabindex={selected ? 0 : -1} aria-controls={ariaControls} on:click={onClick(choice, i)} on:keydown={onKeyDown(choice, i)} on:blur aria-describedby="{groupid} {messagesid}">{choice.label || choice.value}</li>
50
+ <li bind:this={elements[i]} role="radio" class:selected aria-checked={selected} tabindex={selected ? 0 : -1} aria-controls={ariaControls} on:click={onClick(choice, i)} on:keydown={onKeyDown(choice, i)} on:blur aria-describedby="{groupid} {messagesid}">{choice.label || choice.value}</li>
51
51
  {/each}
52
52
  </ul>
53
53
 
@@ -20,12 +20,12 @@ let inputvalue = '';
20
20
  let popupvalue = undefined;
21
21
  let savedLabel = '';
22
22
  let changed = false;
23
+ let menuid;
23
24
  if (defaultValue) {
24
25
  const selected = choices.find(c => c.value === defaultValue);
25
26
  inputvalue = selected.label || selected.value;
26
27
  savedLabel = inputvalue;
27
28
  }
28
- const listId = randomid();
29
29
  const liveTextId = randomid();
30
30
  const helpTextId = randomid();
31
31
  $: filteredChoices = changed
@@ -51,8 +51,8 @@ async function checkifchanged(e) {
51
51
  </script>
52
52
 
53
53
  <FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:setVal let:valid let:invalid let:id let:onBlur let:onChange let:messagesid>
54
- <input bind:this={inputelement} bind:value={inputvalue} {id} {placeholder} class="dialog-input {className}" class:valid class:invalid aria-invalid={invalid} {onBlur} {onChange} aria-owns={listId} autocapitalize="none" type="text" autocomplete="off" aria-autocomplete="list" role="combobox" aria-expanded="false" {disabled} aria-describedby={`${messagesid ?? ''} ${helptext.length ? helpTextId : ''}`} on:keydown={checkifchanged}>
55
- <PopupMenu align="bottomleft" items={filteredChoices} buttonelement={inputelement} bind:value={popupvalue} on:change={onchangepopup(setVal)} emptyText="No options available"/>
54
+ <input bind:this={inputelement} bind:value={inputvalue} {id} {placeholder} class="dialog-input {className}" class:valid class:invalid aria-invalid={invalid} aria-expanded={false} aria-controls={menuid} {onBlur} {onChange} autocapitalize="none" type="text" autocomplete="off" aria-autocomplete="list" role="combobox" {disabled} aria-describedby={`${messagesid ?? ''} ${helptext.length ? helpTextId : ''}`} on:keydown={checkifchanged}>
55
+ <PopupMenu bind:menuid align="bottomleft" items={filteredChoices} buttonelement={inputelement} bind:value={popupvalue} on:change={onchangepopup(setVal)} emptyText="No options available"/>
56
56
  {#if helptext.length}
57
57
  <span id={helpTextId} class="field-help-text">{helptext}</span>
58
58
  {/if}
@@ -13,7 +13,12 @@ export let getOptions;
13
13
  // that it finds, so that we can display labels on pills
14
14
  let valueToLabel = {};
15
15
  async function wrapGetOptions(search) {
16
- const opts = await getOptions(search);
16
+ let opts = await getOptions(search);
17
+ // if no options are returned with the search term, we can end up with an infinite loop
18
+ // the first time reactToValue calls wrapGetOptions
19
+ if (opts.length === 0) {
20
+ opts = await getOptions('');
21
+ }
17
22
  for (const opt of opts)
18
23
  valueToLabel[opt.value] = opt.label || opt.value;
19
24
  valueToLabel = valueToLabel;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dosgato/dialog",
3
3
  "description": "A component library for building forms that edit a JSON document.",
4
- "version": "0.0.11",
4
+ "version": "0.0.12",
5
5
  "dependencies": {
6
- "@txstate-mws/svelte-components": "^1.2.9",
6
+ "@txstate-mws/svelte-components": "^1.2.11",
7
7
  "@txstate-mws/svelte-forms": "^0.0.18",
8
8
  "@iconify/svelte": "^2.2.1",
9
9
  "@iconify-icons/mdi": "^1.2.22",