@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouestfrance/sipa-bms-ui",
3
- "version": "8.5.3",
3
+ "version": "8.5.4",
4
4
  "author": "Ouest-France BMS",
5
5
  "license": "ISC",
6
6
  "scripts": {
@@ -36,9 +36,9 @@
36
36
  "@commitlint/config-conventional": "19.8.1",
37
37
  "@formkit/vue": "1.6.9",
38
38
  "@mdx-js/react": "3.1.1",
39
- "@storybook/addon-docs": "9.1.4",
40
- "@storybook/addon-links": "9.1.4",
41
- "@storybook/vue3-vite": "9.1.4",
39
+ "@storybook/addon-docs": "9.1.5",
40
+ "@storybook/addon-links": "9.1.5",
41
+ "@storybook/vue3-vite": "9.1.5",
42
42
  "@types/lodash": "4.17.20",
43
43
  "@types/uuid": "10.0.0",
44
44
  "@vitejs/plugin-vue": "6.0.1",
@@ -64,11 +64,11 @@
64
64
  "normalize.css": "8.0.1",
65
65
  "path": "0.12.7",
66
66
  "prettier": "3.6.2",
67
- "sass": "1.92.0",
67
+ "sass": "1.92.1",
68
68
  "semantic-release": "24.2.7",
69
- "start-server-and-test": "2.0.13",
70
- "storybook": "9.1.4",
71
- "storybook-addon-pseudo-states": "9.1.4",
69
+ "start-server-and-test": "2.1.0",
70
+ "storybook": "9.1.5",
71
+ "storybook-addon-pseudo-states": "9.1.5",
72
72
  "storybook-vue3-router": "^6.0.2",
73
73
  "typescript": "5.2.2",
74
74
  "uuid": "11.1.0",
@@ -83,6 +83,7 @@ const displayValue = computed(() => {
83
83
 
84
84
  const selectItem = (option: any) => {
85
85
  modelValue.value = option.value;
86
+ setFocus();
86
87
  open.value = false;
87
88
  };
88
89
 
@@ -10,7 +10,6 @@
10
10
  :required="required"
11
11
  :small="small"
12
12
  @input="onInput"
13
- v-model:focus="isInputFocused"
14
13
  >
15
14
  <template #icon-start>
16
15
  <slot name="icon-start"></slot>
@@ -20,12 +19,8 @@
20
19
  <span v-if="inputText.length" class="icon" @click="clearInput">
21
20
  <X />
22
21
  </span>
23
- <span
24
- v-else
25
- class="icon"
26
- @click.stop="isInputFocused = !isInputFocused"
27
- >
28
- <ChevronDown v-if="!isInputFocused" />
22
+ <span v-else class="icon" @click.stop="toggleList">
23
+ <ChevronDown v-if="!showDataList" />
29
24
  <ChevronUp v-else />
30
25
  </span>
31
26
  </slot>
@@ -33,9 +28,9 @@
33
28
  </RawInputText>
34
29
  <template #datalist>
35
30
  <FieldDatalist
36
- v-show="isInputFocused"
31
+ v-show="showDataList"
37
32
  data-testid="autocomplete-menu"
38
- :is-input-focused="isInputFocused"
33
+ :is-input-focused="showDataList"
39
34
  :can-add-new-option="canAddNewOption"
40
35
  :new-option="inputText"
41
36
  :options="filteredMenuItems"
@@ -90,7 +85,7 @@ const getValidOptionByValue = (value: string | null) =>
90
85
  const inputText = ref<string>(
91
86
  getValidOptionByValue(modelValue.value)?.label ?? '',
92
87
  );
93
- const isInputFocused = ref<boolean>(props.open);
88
+ const showDataList = ref<boolean>(props.open);
94
89
  const autocompleteInput: Ref<HTMLElement | null> = ref(null);
95
90
 
96
91
  const classes = computed(() => {
@@ -106,7 +101,8 @@ const selectItem = (option: InputOption) => {
106
101
  const existingOption =
107
102
  getValidOptionByLabel(option.label) || getValidOptionByValue(option.value);
108
103
  modelValue.value = existingOption?.value ?? null;
109
- isInputFocused.value = false;
104
+ showDataList.value = false;
105
+ setFocus();
110
106
  };
111
107
 
112
108
  const displayItem = (option: InputOption) => {
@@ -136,7 +132,7 @@ watch(
136
132
  },
137
133
  );
138
134
  const onInput = () => {
139
- isInputFocused.value = true;
135
+ showDataList.value = true;
140
136
  if (inputText.value === '') {
141
137
  clearInput();
142
138
  }
@@ -144,14 +140,19 @@ const onInput = () => {
144
140
 
145
141
  const setFocus = () => {
146
142
  if (autocompleteInput.value) {
147
- autocompleteInput.value.focus();
143
+ (autocompleteInput.value as any).setFocus();
148
144
  }
149
145
  };
146
+
150
147
  const clearInput = () => {
151
148
  inputText.value = '';
152
149
  modelValue.value = null;
150
+ setFocus();
151
+ };
152
+ const toggleList = () => {
153
+ showDataList.value = !showDataList.value;
154
+ setFocus();
153
155
  };
154
-
155
156
  defineExpose({
156
157
  setFocus,
157
158
  });