vueless 0.0.336 → 0.0.338

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": "0.0.336",
3
+ "version": "0.0.338",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -51,6 +51,7 @@
51
51
 
52
52
  <UDropdownList
53
53
  v-if="isShownOptions"
54
+ ref="dropdownListRef"
54
55
  v-model="selectedItem"
55
56
  :size="size"
56
57
  :options="options"
@@ -58,13 +59,12 @@
58
59
  :label-key="labelKey"
59
60
  v-bind="dropdownListAttrs"
60
61
  :data-test="`${dataTest}-list`"
61
- @click="onClickList"
62
62
  />
63
63
  </div>
64
64
  </template>
65
65
 
66
66
  <script setup>
67
- import { provide, ref, watch } from "vue";
67
+ import { nextTick, ref, watch } from "vue";
68
68
 
69
69
  import UIcon from "../ui.image-icon/UIcon.vue";
70
70
  import UBadge from "../ui.text-badge/UBadge.vue";
@@ -208,10 +208,9 @@ const emit = defineEmits([
208
208
  "select",
209
209
  ]);
210
210
 
211
- provide("hideDropdownOptions", hideOptions);
212
-
213
211
  const isShownOptions = ref(false);
214
212
  const selectedItem = ref("");
213
+ const dropdownListRef = ref(null);
215
214
 
216
215
  const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIconAttrs } = useAttrs(
217
216
  props,
@@ -222,17 +221,19 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
222
221
 
223
222
  watch(selectedItem, () => {
224
223
  emit("select", selectedItem.value);
224
+
225
+ hideOptions();
225
226
  });
226
227
 
227
228
  function onClickBadge() {
228
229
  isShownOptions.value = !isShownOptions.value;
230
+
231
+ if (isShownOptions.value) {
232
+ nextTick(() => dropdownListRef.value.wrapperRef.focus());
233
+ }
229
234
  }
230
235
 
231
236
  function hideOptions() {
232
237
  isShownOptions.value = false;
233
238
  }
234
-
235
- function onClickList() {
236
- hideOptions();
237
- }
238
239
  </script>
@@ -14,9 +14,9 @@ export default {
14
14
  args: {
15
15
  label: "Dropdown",
16
16
  options: [
17
- { label: "option 1", value: "1" },
18
- { label: "option 2", value: "2" },
19
- { label: "option 3", value: "3" },
17
+ { label: "option 1", id: "1" },
18
+ { label: "option 2", id: "2" },
19
+ { label: "option 3", id: "3" },
20
20
  ],
21
21
  },
22
22
  argTypes: {
@@ -6,7 +6,7 @@
6
6
  v-bind="wrapperAttrs"
7
7
  @keydown.self.down.prevent="pointerForward"
8
8
  @keydown.self.up.prevent="pointerBackward"
9
- @keydown.enter.tab.stop.self="addPointerElement"
9
+ @keydown.enter.stop.self="addPointerElement"
10
10
  >
11
11
  <ul :id="`listbox-${id}`" v-bind="listAttrs" role="listbox">
12
12
  <li
@@ -16,11 +16,14 @@ export default /*tw*/ {
16
16
  true: "rounded-full",
17
17
  },
18
18
  tabindex: {
19
- true: "cursor-pointer focus:ring-dynamic focus:ring-offset-dynamic focus:ring-{color}-700/15",
19
+ true: `
20
+ cursor-pointer focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-{color}-700/15
21
+ focus:ring-dynamic focus:ring-offset-dynamic focus:ring-{color}-700/15
22
+ `,
20
23
  },
21
24
  color: {
22
- grayscale: "focus:ring-gray-700/15",
23
- white: "focus:ring-gray-700/15",
25
+ grayscale: "focus:ring-gray-700/15 focus-within:ring-gray-700/15",
26
+ white: "focus:ring-gray-700/15 focus-within:ring-gray-700/15",
24
27
  },
25
28
  },
26
29
  compoundVariants: [
@@ -66,6 +69,6 @@ export default /*tw*/ {
66
69
  { pattern: `border-(${colors})-100` },
67
70
  { pattern: `border-(${colors})-600` },
68
71
  { pattern: `text-(${colors})-600` },
69
- { pattern: `ring-(${colors})-700`, variants: ["focus"] },
72
+ { pattern: `ring-(${colors})-700`, variants: ["focus", "focus-within"] },
70
73
  ],
71
74
  };
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.336",
4
+ "version": "0.0.338",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",