vueless 0.0.718 → 0.0.720

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.718",
3
+ "version": "0.0.720",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -23,7 +23,7 @@ const props = withDefaults(defineProps<Props>(), {
23
23
 
24
24
  const emit = defineEmits([
25
25
  /**
26
- * Triggers when toggle item is selected.
26
+ * Triggers when toggle option is selected.
27
27
  * @property {string} modelValue
28
28
  */
29
29
  "update:modelValue",
@@ -34,24 +34,24 @@ const selectedValue = computed({
34
34
  set: (value) => emit("update:modelValue", value),
35
35
  });
36
36
 
37
- function isSelected(item: UToggleOption) {
37
+ function isSelected(option: UToggleOption) {
38
38
  if (Array.isArray(selectedValue.value)) {
39
- return selectedValue.value.includes(item.value);
39
+ return selectedValue.value.includes(option.value);
40
40
  }
41
41
 
42
- return selectedValue.value === item.value;
42
+ return selectedValue.value === option.value;
43
43
  }
44
44
 
45
- function onClickOption(item: UToggleOption) {
45
+ function onClickOption(option: UToggleOption) {
46
46
  if (props.multiple) {
47
47
  const newValue = Array.isArray(selectedValue.value) ? [...selectedValue.value] : [];
48
- const index = newValue.indexOf(item.value);
48
+ const index = newValue.indexOf(option.value);
49
49
 
50
- ~index ? newValue.splice(index, 1) : newValue.push(item.value);
50
+ ~index ? newValue.splice(index, 1) : newValue.push(option.value);
51
51
 
52
52
  emit("update:modelValue", newValue);
53
53
  } else {
54
- emit("update:modelValue", item.value);
54
+ emit("update:modelValue", option.value);
55
55
  }
56
56
  }
57
57
 
@@ -65,7 +65,7 @@ const mutatedProps = computed(() => ({
65
65
  selected: isSelected,
66
66
  }));
67
67
 
68
- const { toggleLabelAttrs, itemsAttrs, toggleButtonInactiveAttrs, toggleButtonActiveAttrs } =
68
+ const { toggleLabelAttrs, optionsAttrs, toggleButtonInactiveAttrs, toggleButtonActiveAttrs } =
69
69
  useUI<Config>(defaultConfig, mutatedProps);
70
70
  </script>
71
71
 
@@ -82,17 +82,17 @@ const { toggleLabelAttrs, itemsAttrs, toggleButtonInactiveAttrs, toggleButtonAct
82
82
  >
83
83
  <template #label>
84
84
  <!--
85
- @slot Use this to add custom content instead of the label.
85
+ @slot Use this to add custom content instead of the entire Toggle label.
86
86
  @binding {string} label
87
87
  -->
88
88
  <slot name="label" :label="label" />
89
89
  </template>
90
90
 
91
- <div v-bind="itemsAttrs">
91
+ <div v-bind="optionsAttrs">
92
92
  <UButton
93
- v-for="(item, index) in options"
94
- :key="item.value"
95
- :label="item.label"
93
+ v-for="(option, index) in options"
94
+ :key="option.value"
95
+ :label="option.label"
96
96
  tabindex="0"
97
97
  color="gray"
98
98
  :size="size"
@@ -100,38 +100,41 @@ const { toggleLabelAttrs, itemsAttrs, toggleButtonInactiveAttrs, toggleButtonAct
100
100
  :block="block"
101
101
  :square="square"
102
102
  :disabled="disabled"
103
- v-bind="isSelected(item) ? toggleButtonActiveAttrs : toggleButtonInactiveAttrs"
104
- :data-test="`${dataTest}-item-${index}`"
105
- @click="onClickOption(item)"
103
+ v-bind="isSelected(option) ? toggleButtonActiveAttrs : toggleButtonInactiveAttrs"
104
+ :data-test="`${dataTest}-option-${index}`"
105
+ @click="onClickOption(option)"
106
106
  >
107
107
  <template #left="{ iconName }">
108
108
  <!--
109
109
  @slot Use it to add something before the label.
110
+ @binding {object} option
110
111
  @binding {string} icon-name
111
112
  @binding {number} index
112
113
  -->
113
- <slot name="left" :icon-name="iconName" :index="index" />
114
+ <slot name="left" :option="option" :icon-name="iconName" :index="index" />
114
115
  </template>
115
116
 
116
117
  <template #default="{ label, iconName }">
117
118
  <!--
118
- @slot Use it to add something instead of the toggle item label.
119
+ @slot Use it to add something instead of the toggle option label.
120
+ @binding {object} option
119
121
  @binding {string} label
120
122
  @binding {string} icon-name
121
123
  @binding {number} index
122
124
  -->
123
- <slot name="default" :label="label" :icon-name="iconName" :index="index">
124
- {{ item.label }}
125
+ <slot name="option" :option="option" :label="label" :icon-name="iconName" :index="index">
126
+ {{ option.label }}
125
127
  </slot>
126
128
  </template>
127
129
 
128
130
  <template #right="{ iconName }">
129
131
  <!--
130
132
  @slot Use it to add something after the label.
133
+ @binding {object} option
131
134
  @binding {string} icon-name
132
135
  @binding {number} index
133
136
  -->
134
- <slot name="right" :icon-name="iconName" :index="index" />
137
+ <slot name="right" :option="option" :icon-name="iconName" :index="index" />
135
138
  </template>
136
139
  </UButton>
137
140
  </div>
@@ -17,7 +17,7 @@ export default /*tw*/ {
17
17
  },
18
18
  },
19
19
  },
20
- items: {
20
+ options: {
21
21
  base: "flex",
22
22
  variants: {
23
23
  size: {
@@ -1,7 +1,7 @@
1
1
  export default /*tw*/ {
2
2
  tabButton: {
3
3
  base: `
4
- {UButton} -mb-px rounded-none border-transparent
4
+ {UButton} -mb-px rounded-none border-b-2 border-transparent
5
5
  hover:bg-transparent dark:hover:bg-transparent
6
6
  active:bg-transparent dark:active:bg-transparent
7
7
  `,
@@ -10,7 +10,7 @@ export default /*tw*/ {
10
10
  },
11
11
  },
12
12
  tabButtonActive: {
13
- base: "{>tabButton} -mb-0.5 border-b-2 border-b-brand-600",
13
+ base: "{>tabButton} border-b-brand-600",
14
14
  defaults: {
15
15
  color: "brand",
16
16
  },
@@ -1,5 +1,10 @@
1
1
  export default /*tw*/ {
2
- tabs: "mb-6 flex border-b border-gray-200 dark:border-gray-700",
2
+ tabs: {
3
+ base: "mb-6 flex flex-nowrap border-b border-gray-200 dark:border-gray-700",
4
+ variants: {
5
+ block: "w-full",
6
+ },
7
+ },
3
8
  tab: "{UTab}",
4
9
  defaults: {
5
10
  size: "md",