vueless 1.0.2-beta.25 → 1.0.2-beta.27

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": "vueless",
3
- "version": "1.0.2-beta.25",
3
+ "version": "1.0.2-beta.27",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -139,22 +139,7 @@ watch(
139
139
  const marginTop = parseFloat(styles.marginTop || "0");
140
140
  const marginBottom = parseFloat(styles.marginBottom || "0");
141
141
 
142
- const [childDiv] = el.getElementsByTagName("div");
143
- const childStyles = childDiv && window.getComputedStyle(childDiv);
144
- const childMarginTop = parseFloat(childStyles?.marginTop || "0");
145
- const childMarginBottom = parseFloat(childStyles?.marginBottom || "0");
146
- const childPaddingTop = parseFloat(childStyles?.paddingTop || "0");
147
- const childPaddingBottom = parseFloat(childStyles?.paddingBottom || "0");
148
-
149
- return (
150
- elHeight +
151
- marginTop +
152
- marginBottom +
153
- childMarginTop +
154
- childMarginBottom +
155
- childPaddingTop +
156
- childPaddingBottom
157
- );
142
+ return elHeight + marginTop + marginBottom;
158
143
  })
159
144
  .reduce((acc, cur) => acc + cur, 0);
160
145
 
@@ -167,27 +152,29 @@ watch(
167
152
 
168
153
  const inputEl = listboxInputRef.value?.input as HTMLInputElement | undefined;
169
154
  let listboxInputHeight = 0;
170
- let listboxInputPaddingTop = 0;
171
- let listboxInputPaddingBottom = 0;
155
+
156
+ let listboxInputWrapperPaddingTop = 0;
172
157
 
173
158
  if (inputEl) {
174
159
  const listboxInputStyle = getComputedStyle(inputEl);
160
+ const listboxInputWrapperStyle = getComputedStyle(
161
+ inputEl.parentElement?.parentElement?.parentElement as Element,
162
+ );
175
163
 
176
164
  listboxInputHeight = parseFloat(listboxInputStyle.height || "0");
177
- listboxInputPaddingTop = parseFloat(listboxInputStyle.paddingTop || "0");
178
- listboxInputPaddingBottom = parseFloat(listboxInputStyle.paddingBottom || "0");
165
+
166
+ listboxInputWrapperPaddingTop = parseFloat(listboxInputWrapperStyle.paddingTop || "0");
179
167
  }
180
168
 
181
169
  wrapperMaxHeight.value = `${
182
170
  maxHeight +
183
- wrapperGap +
171
+ (props.searchable ? wrapperGap : 0) +
184
172
  wrapperPaddingTop +
185
173
  wrapperPaddingBottom +
186
174
  wrapperBorderTop +
187
175
  wrapperBorderBottom +
188
176
  listboxInputHeight +
189
- listboxInputPaddingTop +
190
- listboxInputPaddingBottom
177
+ (props.searchable ? listboxInputWrapperPaddingTop : 0)
191
178
  }px`;
192
179
  });
193
180
  },
@@ -58,10 +58,15 @@ const emit = defineEmits([
58
58
  "searchChange",
59
59
 
60
60
  /**
61
- * Triggers when the option is removed.
61
+ * Triggers when the option from multiple select is removed.
62
62
  * @property {string} option
63
63
  */
64
- "remove",
64
+ "removeOption",
65
+
66
+ /**
67
+ * Triggers when the select is cleared.
68
+ */
69
+ "clear",
65
70
 
66
71
  /**
67
72
  * Triggers when an option is selected.
@@ -331,7 +336,7 @@ function onClickClearItem(event: MouseEvent, option: Option) {
331
336
 
332
337
  emit("update:modelValue", value);
333
338
  emit("change", { value, options: props.options });
334
- emit("remove", option);
339
+ emit("removeOption", option);
335
340
  }
336
341
 
337
342
  function onClickClear() {
@@ -341,7 +346,7 @@ function onClickClear() {
341
346
 
342
347
  emit("update:modelValue", value);
343
348
  emit("change", { value, options: props.options });
344
- emit("remove", props.options);
349
+ emit("clear");
345
350
 
346
351
  deactivate();
347
352
  }