vueless 0.0.291 → 0.0.293

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.291",
3
+ "version": "0.0.293",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -24,11 +24,11 @@ export default /*tw*/ {
24
24
  },
25
25
  },
26
26
  },
27
- icon: "{UIcon}",
28
- expandIconName: "add",
29
- collapseIconName: "remove",
27
+ toggleIcon: "{UIcon}",
30
28
  divider: "{UDivider} group-last:hidden",
31
29
  defaults: {
30
+ expandIcon: "add",
31
+ collapseIcon: "remove",
32
32
  size: "md",
33
33
  },
34
34
  };
@@ -4,11 +4,11 @@
4
4
  <div v-bind="titleAttrs">
5
5
  {{ title }}
6
6
  <UIcon
7
- :name="isOpened ? config.collapseIconName : config.expandIconName"
7
+ :name="isOpened ? config.defaults.collapseIcon : config.defaults.expandIcon"
8
8
  :size="size"
9
9
  color="gray"
10
10
  internal
11
- v-bind="iconAttrs"
11
+ v-bind="toggleIconAttrs"
12
12
  />
13
13
  </div>
14
14
 
@@ -95,8 +95,15 @@ const emit = defineEmits([
95
95
 
96
96
  const isOpened = ref(false);
97
97
 
98
- const { config, wrapperAttrs, descriptionAttrs, bodyAttrs, titleAttrs, iconAttrs, dividerAttrs } =
99
- useAttrs(props, { isOpened });
98
+ const {
99
+ config,
100
+ wrapperAttrs,
101
+ descriptionAttrs,
102
+ bodyAttrs,
103
+ titleAttrs,
104
+ toggleIconAttrs,
105
+ dividerAttrs,
106
+ } = useAttrs(props, { isOpened });
100
107
 
101
108
  const dividerSize = computed(() => {
102
109
  const sizes = {
@@ -12,8 +12,7 @@ export default /*tw*/ {
12
12
  },
13
13
  },
14
14
  badgeActive: "group",
15
- icon: "{UIcon} transition duration-300 group-[]:rotate-180",
16
- iconName: "keyboard_arrow_down",
15
+ dropdownIcon: "{UIcon} transition duration-300 group-[]:rotate-180",
17
16
  listWrapper: {
18
17
  base: `
19
18
  absolute z-10
@@ -33,6 +32,7 @@ export default /*tw*/ {
33
32
  },
34
33
  list: "{UDropdownList} w-fit",
35
34
  defaults: {
35
+ dropdownIcon: "keyboard_arrow_down",
36
36
  color: "brand",
37
37
  size: "md",
38
38
  weight: "medium",
@@ -15,11 +15,11 @@
15
15
  <UIcon
16
16
  v-if="!noIcon"
17
17
  internal
18
- :name="config.iconName"
18
+ :name="config.defaults.dropdownIcon"
19
19
  :size="iconSize"
20
20
  :color="color"
21
21
  :data-test="`${dataTest}-caret`"
22
- v-bind="iconAttrs"
22
+ v-bind="dropdownIconAttrs"
23
23
  />
24
24
  </template>
25
25
  </UBadge>
@@ -199,8 +199,15 @@ provide("hideDropdownOptions", hideOptions);
199
199
  const isShownOptions = ref(false);
200
200
  const selectedItem = ref("");
201
201
 
202
- const { config, listWrapperAttrs, wrapperAttrs, badgeAttrs, listAttrs, iconAttrs, hasSlotContent } =
203
- useAttrs(props, { isShownOptions });
202
+ const {
203
+ config,
204
+ listWrapperAttrs,
205
+ wrapperAttrs,
206
+ badgeAttrs,
207
+ listAttrs,
208
+ dropdownIconAttrs,
209
+ hasSlotContent,
210
+ } = useAttrs(props, { isShownOptions });
204
211
 
205
212
  const iconSize = computed(() => {
206
213
  const sizes = {
@@ -2,8 +2,7 @@ export default /*tw*/ {
2
2
  wrapper: "relative inline-block",
3
3
  button: "{UButton}",
4
4
  buttonActive: "group",
5
- icon: "{UIcon} transition duration-300 group-[]:rotate-180",
6
- iconName: "keyboard_arrow_down",
5
+ dropdownIcon: "{UIcon} transition duration-300 group-[]:rotate-180",
7
6
  listWrapper: {
8
7
  base: `
9
8
  absolute z-10 inline-block
@@ -23,6 +22,7 @@ export default /*tw*/ {
23
22
  },
24
23
  list: "{UDropdownList} w-fit",
25
24
  defaults: {
25
+ dropdownIcon: "keyboard_arrow_down",
26
26
  color: "brand",
27
27
  size: "md",
28
28
  variant: "primary",
@@ -18,11 +18,11 @@
18
18
  <UIcon
19
19
  v-if="!noIcon"
20
20
  internal
21
- :name="config.iconName"
21
+ :name="config.defaults.dropdownIcon"
22
22
  :size="iconSize"
23
23
  :color="iconColor"
24
24
  :data-test="`${dataTest}-caret`"
25
- v-bind="iconAttrs"
25
+ v-bind="dropdownIconAttrs"
26
26
  />
27
27
  </template>
28
28
  </UButton>
@@ -239,7 +239,7 @@ const {
239
239
  listWrapperAttrs,
240
240
  buttonAttrs,
241
241
  listAttrs,
242
- iconAttrs,
242
+ dropdownIconAttrs,
243
243
  wrapperAttrs,
244
244
  hasSlotContent,
245
245
  } = useAttrs(props, { isShownOptions });
@@ -3,8 +3,7 @@ export default /*tw*/ {
3
3
  trigger: "flex items-center relative space-x-0.5",
4
4
  link: "{ULink}",
5
5
  linkActive: "group",
6
- icon: "{UIcon} block transition duration-300 group-[]:rotate-180",
7
- iconName: "keyboard_arrow_down",
6
+ dropdownIcon: "{UIcon} block transition duration-300 group-[]:rotate-180",
8
7
  listWrapper: {
9
8
  base: `
10
9
  absolute z-10
@@ -24,6 +23,7 @@ export default /*tw*/ {
24
23
  },
25
24
  list: "{UDropdownList} w-fit",
26
25
  defaults: {
26
+ dropdownIcon: "keyboard_arrow_down",
27
27
  color: "brand",
28
28
  size: "md",
29
29
  labelKey: "label",
@@ -19,11 +19,11 @@
19
19
  v-if="!noIcon"
20
20
  internal
21
21
  interactive
22
- :name="config.iconName"
22
+ :name="config.defaults.dropdownIcon"
23
23
  :size="iconSize"
24
24
  :color="color"
25
25
  :data-test="`${dataTest}-caret`"
26
- v-bind="iconAttrs"
26
+ v-bind="dropdownIconAttrs"
27
27
  @click="onClickLink"
28
28
  />
29
29
  </template>
@@ -226,7 +226,7 @@ const {
226
226
  wrapperAttrs,
227
227
  linkAttrs,
228
228
  listAttrs,
229
- iconAttrs,
229
+ dropdownIconAttrs,
230
230
  triggerAttrs,
231
231
  hasSlotContent,
232
232
  } = useAttrs(props, { isShownOptions });
@@ -40,10 +40,10 @@ export default /*tw*/ {
40
40
  },
41
41
  },
42
42
  },
43
- icon: "{UIcon}",
44
- partialIconName: "remove",
45
- selectedIconName: "check",
43
+ checkedIcon: "{UIcon}",
46
44
  defaults: {
45
+ partiallyCheckedIcon: "remove",
46
+ checkedIcon: "check",
47
47
  color: "brand",
48
48
  size: "md",
49
49
  labelAlign: "right",
@@ -27,10 +27,10 @@
27
27
  <label v-if="isChecked" v-bind="iconWrapperAttrs" :for="id">
28
28
  <UIcon
29
29
  internal
30
- :name="partial ? config.partialIconName : config.selectedIconName"
30
+ :name="partial ? config.defaults.partiallyCheckedIcon : config.defaults.checkedIcon"
31
31
  :size="iconSize"
32
32
  color="white"
33
- v-bind="iconAttrs"
33
+ v-bind="checkedIconAttrs"
34
34
  />
35
35
  </label>
36
36
 
@@ -214,7 +214,7 @@ const checkboxName = ref("");
214
214
  const checkboxSize = ref(props.size);
215
215
  const checkboxColor = ref(props.color);
216
216
 
217
- const { config, checkboxAttrs, iconWrapperAttrs, labelAttrs, iconAttrs } = useAttrs(props, {
217
+ const { config, checkboxAttrs, iconWrapperAttrs, labelAttrs, checkedIconAttrs } = useAttrs(props, {
218
218
  checkboxColor,
219
219
  checkboxSize,
220
220
  });
@@ -41,9 +41,7 @@ export default /*tw*/ {
41
41
  { checked: true, size: "lg", class: "ml-[calc(100%-1.25rem)]" },
42
42
  ],
43
43
  },
44
- icon: "{UIcon}",
45
- selectedIconName: "check",
46
- unselectedIconName: "close",
44
+ toggleIcon: "{UIcon}",
47
45
  toggleLabel: {
48
46
  base: "absolute text-center text-2xs font-medium uppercase text-white",
49
47
  compoundVariants: [
@@ -59,6 +57,8 @@ export default /*tw*/ {
59
57
  active: "On",
60
58
  },
61
59
  defaults: {
60
+ enabledIcon: "check",
61
+ disabledIcon: "close",
62
62
  color: "brand",
63
63
  size: "md",
64
64
  labelAlign: "right",
@@ -25,10 +25,10 @@
25
25
  <UIcon
26
26
  v-if="toggleIcon"
27
27
  internal
28
- :name="checkedValue ? config.selectedIconName : config.unselectedIconName"
28
+ :name="checkedValue ? config.defaults.enabledIcon : config.defaults.disabledIcon"
29
29
  :color="iconColor"
30
30
  :size="iconSize"
31
- v-bind="iconAttrs"
31
+ v-bind="toggleIconAttrs"
32
32
  />
33
33
  </span>
34
34
 
@@ -172,8 +172,15 @@ const checkedValue = computed({
172
172
  set: (value) => emit("update:modelValue", value),
173
173
  });
174
174
 
175
- const { config, iconAttrs, labelAttrs, inputAttrs, wrapperAttrs, circleAttrs, toggleLabelAttrs } =
176
- useAttrs(props, { checked: checkedValue });
175
+ const {
176
+ config,
177
+ toggleIconAttrs,
178
+ labelAttrs,
179
+ inputAttrs,
180
+ wrapperAttrs,
181
+ circleAttrs,
182
+ toggleLabelAttrs,
183
+ } = useAttrs(props, { checked: checkedValue });
177
184
 
178
185
  const switchLabel = computed(() => {
179
186
  return checkedValue.value ? currentLocale.value.active : currentLocale.value.inactive;
@@ -38,6 +38,9 @@ export default /*tw*/ {
38
38
  md: "text-sm placeholder:text-sm",
39
39
  lg: "text-base placeholder:text-base",
40
40
  },
41
+ resizable: {
42
+ false: "resize-none",
43
+ },
41
44
  },
42
45
  },
43
46
  defaults: {
@@ -46,6 +49,7 @@ export default /*tw*/ {
46
49
  type: "text",
47
50
  inputmode: "text",
48
51
  labelAlign: "topInside",
52
+ resizable: false,
49
53
  disabled: false,
50
54
  readonly: false,
51
55
  noAutocomplete: false,
@@ -29,7 +29,7 @@
29
29
  :placeholder="placeholder"
30
30
  :readonly="readonly"
31
31
  :disabled="disabled"
32
- :rows="rows"
32
+ :rows="currentRows"
33
33
  :inputmode="inputmode"
34
34
  :data-test="dataTest"
35
35
  v-bind="textareaAttrs"
@@ -39,6 +39,8 @@
39
39
  @mouseleave="onMouseleave"
40
40
  @mousedown="onMousedown"
41
41
  @click="onClick"
42
+ @keydown.enter="onEnter"
43
+ @keydown.backspace="onBackspace"
42
44
  />
43
45
  </label>
44
46
  <label v-if="hasSlotContent($slots['right'])" :for="id" v-bind="rightSlotAttrs">
@@ -49,7 +51,7 @@
49
51
  </template>
50
52
 
51
53
  <script setup>
52
- import { computed, onMounted, ref, useSlots } from "vue";
54
+ import { computed, onMounted, ref, watch, useSlots } from "vue";
53
55
 
54
56
  import ULabel from "../ui.form-label";
55
57
  import { getRandomId, getDefault } from "../service.ui";
@@ -112,6 +114,14 @@ const props = defineProps({
112
114
  default: "",
113
115
  },
114
116
 
117
+ /**
118
+ * Allow resizing of the textarea.
119
+ */
120
+ resizable: {
121
+ type: Boolean,
122
+ default: getDefault(defaultConfig, UTextarea).resizable,
123
+ },
124
+
115
125
  /**
116
126
  * Make textarea read only.
117
127
  */
@@ -157,7 +167,7 @@ const props = defineProps({
157
167
  * Set number of visible rows.
158
168
  */
159
169
  rows: {
160
- type: String,
170
+ type: [String, Number],
161
171
  default: getDefault(defaultConfig, UTextarea).rows,
162
172
  },
163
173
 
@@ -236,6 +246,33 @@ const labelComponentRef = ref(null);
236
246
  const leftSlotWrapperRef = ref(null);
237
247
  const textareaWrapperRef = ref(null);
238
248
 
249
+ const currentRows = ref(props.rows);
250
+
251
+ watch(
252
+ () => props.rows,
253
+ (newRows) => {
254
+ currentRows.value = newRows;
255
+ },
256
+ );
257
+
258
+ function onEnter() {
259
+ currentRows.value++;
260
+ }
261
+
262
+ function onBackspace() {
263
+ const textarea = textareaRef.value;
264
+
265
+ if (!textarea) return;
266
+
267
+ const content = textarea.value;
268
+ const newlineCount = (content.match(/\n/g) || []).length;
269
+ const newRowCount = Math.max(props.rows, newlineCount + 1);
270
+
271
+ if (newRowCount < currentRows.value) {
272
+ currentRows.value = newRowCount;
273
+ }
274
+ }
275
+
239
276
  const localValue = computed({
240
277
  get() {
241
278
  return props.modelValue;
@@ -33,12 +33,12 @@ export default /*tw*/ {
33
33
  },
34
34
  },
35
35
  },
36
- icon: "{UIcon}",
36
+ placeholderIcon: "{UIcon}",
37
37
  defaults: {
38
38
  color: "grayscale",
39
39
  rounded: "md",
40
40
  size: "md",
41
- icon: "image",
41
+ placeholderIcon: "image",
42
42
  bordered: false,
43
43
  },
44
44
  safelist: (colors) => [
@@ -13,7 +13,7 @@
13
13
  :name="icon"
14
14
  :color="color === 'white' ? 'grayscale' : color"
15
15
  :size="size"
16
- v-bind="iconAttrs"
16
+ v-bind="placeholderIconAttrs"
17
17
  />
18
18
  </template>
19
19
  </div>
@@ -54,7 +54,7 @@ const props = defineProps({
54
54
  */
55
55
  icon: {
56
56
  type: String,
57
- default: getDefault(defaultConfig, UAvatar).icon,
57
+ default: getDefault(defaultConfig, UAvatar).placeholderIcon,
58
58
  },
59
59
 
60
60
  /**
@@ -132,7 +132,7 @@ const backgroundImage = computed(() => {
132
132
  return props.src ? `background-image: url(${src});` : "";
133
133
  });
134
134
 
135
- const { avatarAttrs, iconAttrs } = useAttrs(props);
135
+ const { avatarAttrs, placeholderIconAttrs } = useAttrs(props);
136
136
 
137
137
  function onClick(event) {
138
138
  emit("click", event);
@@ -10,8 +10,7 @@ export default /*tw*/ {
10
10
  },
11
11
  },
12
12
  },
13
- icon: "{UIcon}",
14
- iconName: "description",
13
+ fileIcon: "{UIcon}",
15
14
  image: "rounded-sm max-w-7",
16
15
  label: {
17
16
  base: "text-gray-700 whitespace-normal hover:underline hover:decoration-dashed hover:underline-offset-4",
@@ -27,6 +26,7 @@ export default /*tw*/ {
27
26
  },
28
27
  },
29
28
  defaults: {
29
+ fileIcon: "description",
30
30
  size: "md",
31
31
  },
32
32
  };
@@ -12,8 +12,8 @@
12
12
  interactive
13
13
  color="gray"
14
14
  :size="iconSize"
15
- :name="config.iconName"
16
- v-bind="iconAttrs"
15
+ :name="config.defaults.fileIcon"
16
+ v-bind="fileIconAttrs"
17
17
  @focus="onFocus"
18
18
  @blur="onBlur"
19
19
  />
@@ -103,7 +103,7 @@ const props = defineProps({
103
103
 
104
104
  const focus = ref(false);
105
105
 
106
- const { config, fileAttrs, infoAttrs, iconAttrs, labelAttrs, imageAttrs } = useAttrs(props, {
106
+ const { config, fileAttrs, infoAttrs, fileIconAttrs, labelAttrs, imageAttrs } = useAttrs(props, {
107
107
  focus,
108
108
  });
109
109
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.291",
4
+ "version": "0.0.293",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -586,7 +586,7 @@
586
586
  "kind": "expression",
587
587
  "type": "string"
588
588
  },
589
- "default": "image"
589
+ "default": "getDefault(defaultConfig, UAvatar).placeholderIcon"
590
590
  },
591
591
  {
592
592
  "name": "size",
@@ -8067,6 +8067,15 @@
8067
8067
  },
8068
8068
  "default": "\"\""
8069
8069
  },
8070
+ {
8071
+ "name": "resizable",
8072
+ "description": "Allow resizing of the textarea.",
8073
+ "value": {
8074
+ "kind": "expression",
8075
+ "type": "boolean"
8076
+ },
8077
+ "default": "false"
8078
+ },
8070
8079
  {
8071
8080
  "name": "readonly",
8072
8081
  "description": "Make textarea read only.",
@@ -8117,7 +8126,7 @@
8117
8126
  "description": "Set number of visible rows.",
8118
8127
  "value": {
8119
8128
  "kind": "expression",
8120
- "type": "string"
8129
+ "type": "string|number"
8121
8130
  },
8122
8131
  "default": "3"
8123
8132
  },