@ouestfrance/sipa-bms-ui 8.5.3 → 8.5.4

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.
@@ -38072,7 +38072,7 @@
38072
38072
  const inputText = vue.ref(
38073
38073
  getValidOptionByValue(modelValue.value)?.label ?? ""
38074
38074
  );
38075
- const isInputFocused = vue.ref(props.open);
38075
+ const showDataList = vue.ref(props.open);
38076
38076
  const autocompleteInput = vue.ref(null);
38077
38077
  const classes = vue.computed(() => {
38078
38078
  return { "is-error": props.errors?.length, "is-disabled": props.disabled };
@@ -38084,7 +38084,8 @@
38084
38084
  emits("select", option);
38085
38085
  const existingOption = getValidOptionByLabel(option.label) || getValidOptionByValue(option.value);
38086
38086
  modelValue.value = existingOption?.value ?? null;
38087
- isInputFocused.value = false;
38087
+ showDataList.value = false;
38088
+ setFocus();
38088
38089
  };
38089
38090
  const displayItem = (option) => {
38090
38091
  const existingOption = getValidOptionByLabel(option.label) || getValidOptionByValue(option.value);
@@ -38109,19 +38110,24 @@
38109
38110
  }
38110
38111
  );
38111
38112
  const onInput = () => {
38112
- isInputFocused.value = true;
38113
+ showDataList.value = true;
38113
38114
  if (inputText.value === "") {
38114
38115
  clearInput();
38115
38116
  }
38116
38117
  };
38117
38118
  const setFocus = () => {
38118
38119
  if (autocompleteInput.value) {
38119
- autocompleteInput.value.focus();
38120
+ autocompleteInput.value.setFocus();
38120
38121
  }
38121
38122
  };
38122
38123
  const clearInput = () => {
38123
38124
  inputText.value = "";
38124
38125
  modelValue.value = null;
38126
+ setFocus();
38127
+ };
38128
+ const toggleList = () => {
38129
+ showDataList.value = !showDataList.value;
38130
+ setFocus();
38125
38131
  };
38126
38132
  __expose({
38127
38133
  setFocus
@@ -38132,13 +38138,13 @@
38132
38138
  datalist: vue.withCtx(() => [
38133
38139
  vue.withDirectives(vue.createVNode(FieldDatalist, {
38134
38140
  "data-testid": "autocomplete-menu",
38135
- "is-input-focused": isInputFocused.value,
38141
+ "is-input-focused": showDataList.value,
38136
38142
  "can-add-new-option": _ctx.canAddNewOption,
38137
38143
  "new-option": inputText.value,
38138
38144
  options: filteredMenuItems.value,
38139
38145
  small: _ctx.small,
38140
38146
  onSelect: selectItem,
38141
- onAddNewOption: _cache[3] || (_cache[3] = (option) => emits("addNewOption", option))
38147
+ onAddNewOption: _cache[1] || (_cache[1] = (option) => emits("addNewOption", option))
38142
38148
  }, {
38143
38149
  option: vue.withCtx(({ option }) => [
38144
38150
  vue.renderSlot(_ctx.$slots, "option", { option }, () => [
@@ -38147,7 +38153,7 @@
38147
38153
  ]),
38148
38154
  _: 3
38149
38155
  }, 8, ["is-input-focused", "can-add-new-option", "new-option", "options", "small"]), [
38150
- [vue.vShow, isInputFocused.value]
38156
+ [vue.vShow, showDataList.value]
38151
38157
  ])
38152
38158
  ]),
38153
38159
  default: vue.withCtx(() => [
@@ -38155,16 +38161,14 @@
38155
38161
  ref_key: "autocompleteInput",
38156
38162
  ref: autocompleteInput,
38157
38163
  modelValue: inputText.value,
38158
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputText.value = $event),
38164
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputText.value = $event),
38159
38165
  type: vue.unref(InputType).TEXT,
38160
38166
  disabled: _ctx.disabled,
38161
38167
  class: vue.normalizeClass(classes.value),
38162
38168
  placeholder: _ctx.placeholder,
38163
38169
  required: _ctx.required,
38164
38170
  small: _ctx.small,
38165
- onInput,
38166
- focus: isInputFocused.value,
38167
- "onUpdate:focus": _cache[2] || (_cache[2] = ($event) => isInputFocused.value = $event)
38171
+ onInput
38168
38172
  }, {
38169
38173
  "icon-start": vue.withCtx(() => [
38170
38174
  vue.renderSlot(_ctx.$slots, "icon-start", {}, void 0, true)
@@ -38180,14 +38184,14 @@
38180
38184
  ])) : (vue.openBlock(), vue.createElementBlock("span", {
38181
38185
  key: 1,
38182
38186
  class: "icon",
38183
- onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => isInputFocused.value = !isInputFocused.value, ["stop"]))
38187
+ onClick: vue.withModifiers(toggleList, ["stop"])
38184
38188
  }, [
38185
- !isInputFocused.value ? (vue.openBlock(), vue.createBlock(vue.unref(ChevronDown), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(ChevronUp), { key: 1 }))
38189
+ !showDataList.value ? (vue.openBlock(), vue.createBlock(vue.unref(ChevronDown), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(ChevronUp), { key: 1 }))
38186
38190
  ]))
38187
38191
  ], true)
38188
38192
  ]),
38189
38193
  _: 3
38190
- }, 8, ["modelValue", "type", "disabled", "class", "placeholder", "required", "small", "focus"])
38194
+ }, 8, ["modelValue", "type", "disabled", "class", "placeholder", "required", "small"])
38191
38195
  ]),
38192
38196
  _: 3
38193
38197
  }, 16);
@@ -38195,7 +38199,7 @@
38195
38199
  }
38196
38200
  });
38197
38201
 
38198
- const RawAutocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-9b0bf4fb"]]);
38202
+ const RawAutocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__scopeId", "data-v-5d665f68"]]);
38199
38203
 
38200
38204
  const _hoisted_1$N = ["innerHTML"];
38201
38205
  const _hoisted_2$v = ["innerHTML"];
@@ -85453,6 +85457,7 @@
85453
85457
  });
85454
85458
  const selectItem = (option) => {
85455
85459
  modelValue.value = option.value;
85460
+ setFocus();
85456
85461
  open.value = false;
85457
85462
  };
85458
85463
  const setFocus = () => {
@@ -85511,7 +85516,7 @@
85511
85516
  }
85512
85517
  });
85513
85518
 
85514
- const BmsSelect = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-3898a72d"]]);
85519
+ const BmsSelect = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-6e3f7aab"]]);
85515
85520
 
85516
85521
  const _hoisted_1$E = { class: "dismiss-button" };
85517
85522
  const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({