vueless 0.0.411 → 0.0.413

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.411",
3
+ "version": "0.0.413",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -190,7 +190,7 @@
190
190
  :columns="columns"
191
191
  :config="config"
192
192
  :attrs="keysAttrs"
193
- v-bind="getRowAttrs(row)"
193
+ v-bind="getRowAttrs(row.id)"
194
194
  :class="cx([getRowAttrs(row.id).class, getRowClasses(row)])"
195
195
  @click="onClickRow"
196
196
  @toggle-row-visibility="onToggleRowVisibility"
@@ -331,7 +331,7 @@ const props = defineProps({
331
331
  * Show date divider line between dates.
332
332
  */
333
333
  dateDivider: {
334
- type: [Array, Boolean],
334
+ type: [Boolean, Array],
335
335
  default: getDefault(defaultConfig, UTable).dateDivider,
336
336
  },
337
337
 
@@ -610,7 +610,7 @@ function shouldDisplayDateSeparator(rowIndex) {
610
610
  }
611
611
 
612
612
  function getRowAttrs(rowId) {
613
- return selectedRows.value.includes(rowId) ? bodyRowCheckedAttrs : bodyRowAttrs;
613
+ return selectedRows.value.includes(rowId) ? bodyRowCheckedAttrs.value : bodyRowAttrs.value;
614
614
  }
615
615
 
616
616
  function getRowClasses(row) {
@@ -36,7 +36,10 @@
36
36
  />
37
37
  </div>
38
38
 
39
- <div v-if="isCellObject(value)">
39
+ <div
40
+ v-if="isCellObject(value)"
41
+ :class="cx([bodyCellPrimaryAttrs.class, getCellContentClasses(row, key)])"
42
+ >
40
43
  <slot :name="`cell-${key}`" :value="value" :row="row">
41
44
  <div v-bind="bodyCellPrimaryAttrs" ref="cellRef" :data-test="`${dataTest}-${key}-cell`">
42
45
  {{ getCellPrimaryContent(value) }}
@@ -196,6 +199,12 @@ function getCellClasses(row, key) {
196
199
  return typeof cellClasses === "function" ? cellClasses(row[key].value, row) : cellClasses;
197
200
  }
198
201
 
202
+ function getCellContentClasses(row, key) {
203
+ const cellClasses = row[key]?.contentClasses || "";
204
+
205
+ return typeof cellClasses === "function" ? cellClasses(row[key].value, row) : cellClasses;
206
+ }
207
+
199
208
  function isCellObject(value) {
200
209
  return typeof value === "object" && value !== null && ("primary" in value || "value" in value);
201
210
  }
@@ -34,8 +34,9 @@
34
34
  />
35
35
  </label>
36
36
 
37
- <template #footer>
38
- <slot name="footer" />
37
+ <template #bottom>
38
+ <!-- @slot Use it to add something below the checkbox. -->
39
+ <slot name="bottom" />
39
40
  </template>
40
41
  </ULabel>
41
42
  </template>
@@ -10,6 +10,7 @@
10
10
  :data-test="dataTest"
11
11
  >
12
12
  <div v-bind="listAttrs">
13
+ <!-- @slot Use it to add URadio directly. -->
13
14
  <slot>
14
15
  <UCheckbox
15
16
  v-for="(option, index) in options"
@@ -7,7 +7,7 @@
7
7
  :size="size"
8
8
  :color="color"
9
9
  :placement="placement"
10
- v-bind="checkboxAttrs"
10
+ v-bind="multiStateCheckboxAttrs"
11
11
  @input="onClickCheckbox"
12
12
  />
13
13
  </template>
@@ -114,7 +114,7 @@ const isChecked = ref(false);
114
114
 
115
115
  const selected = computed(() => props.options[index.value]);
116
116
 
117
- const { checkboxAttrs } = useAttrs(props, { selected });
117
+ const { multiStateCheckboxAttrs } = useAttrs(props, { selected });
118
118
 
119
119
  watchEffect(setIndex);
120
120
 
@@ -1,5 +1,5 @@
1
1
  export default /*tw*/ {
2
- checkbox: "{UCheckbox}",
2
+ multiStateCheckbox: "{UCheckbox}",
3
3
  defaults: {
4
4
  color: "brand",
5
5
  size: "md",
@@ -8,7 +8,7 @@ export default function useAttrs(props, { selected }) {
8
8
 
9
9
  const keysAttrs = getKeysAttrs();
10
10
 
11
- const { checkboxAttrs } = keysAttrs;
11
+ const { multiStateCheckboxAttrs: checkboxAttrs } = keysAttrs;
12
12
 
13
13
  keysAttrs.checkboxAttrs = computed(() => {
14
14
  if (selected.value.icon) {
@@ -18,7 +18,7 @@
18
18
  color="gray"
19
19
  :checked="selectedItem === ''"
20
20
  :disabled="disabled"
21
- v-bind="unselectedRadioAttrs"
21
+ v-bind="unselectedColorPickerRadioAttrs"
22
22
  @update:model-value="onUpdateValue('')"
23
23
  />
24
24
 
@@ -43,7 +43,7 @@
43
43
  :color="color"
44
44
  :checked="selectedItem === color"
45
45
  :disabled="disabled"
46
- v-bind="radioAttrs"
46
+ v-bind="colorPickerRadioAttrs"
47
47
  @update:model-value="onUpdateValue(color)"
48
48
  />
49
49
  </div>
@@ -169,10 +169,10 @@ const {
169
169
  config,
170
170
  colorPickerLabelAttrs,
171
171
  listAttrs,
172
- radioAttrs,
172
+ colorPickerRadioAttrs,
173
+ unselectedColorPickerRadioAttrs,
173
174
  unselectedIconAttrs,
174
175
  unselectedAttrs,
175
- unselectedRadioAttrs,
176
176
  } = useAttrs(props);
177
177
 
178
178
  const selectedItem = computed({
@@ -12,11 +12,11 @@ export default /*tw*/ {
12
12
  },
13
13
  unselected: "relative flex",
14
14
  unselectedIcon: "{UIcon} absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",
15
- unselectedRadio: {
15
+ unselectedColorPickerRadio: {
16
16
  component: "{URadio}",
17
17
  radio: "checked:text-white !border-gray-300",
18
18
  },
19
- radio: {
19
+ colorPickerRadio: {
20
20
  component: "{URadio}",
21
21
  radio: `
22
22
  bg-{color}-600 border-{color}-600 hover:border-{color}-600 active:bg-{color}-800
@@ -95,7 +95,7 @@ const props = defineProps({
95
95
  },
96
96
 
97
97
  /**
98
- * Set label placement related from the default slot.
98
+ * Label placement.
99
99
  * @values top, topInside, topWithDesc, left, right
100
100
  */
101
101
  labelAlign: {
@@ -183,7 +183,7 @@ const props = defineProps({
183
183
  },
184
184
 
185
185
  /**
186
- * Set label placement related from the default slot.
186
+ * Label placement.
187
187
  * @values top, topInside, topWithDesc, left, right
188
188
  */
189
189
  labelAlign: {
@@ -9,13 +9,13 @@
9
9
  :description="description"
10
10
  v-bind="inputLabelAttrs"
11
11
  >
12
- <div ref="dropZoneRef" :ondrop="onDrop" v-bind="dropzoneWrapperAttrs">
12
+ <div ref="dropZoneRef" :ondrop="onDrop" v-bind="dropzoneAttrs">
13
13
  <UText v-if="hasSlotContent($slots['top'])" :size="size" v-bind="descriptionTopAttrs">
14
- <!-- @slot Use it to add something at the top of the file block. -->
14
+ <!-- @slot Use it to add something above the component content. -->
15
15
  <slot name="top" />
16
16
  </UText>
17
17
 
18
- <div v-bind="contentWrapperAttrs">
18
+ <div v-bind="contentAttrs">
19
19
  <!-- @slot Use it to add something before the placeholder. -->
20
20
  <slot name="left" />
21
21
 
@@ -40,7 +40,7 @@
40
40
  </template>
41
41
  </UFiles>
42
42
 
43
- <div v-bind="buttonWrapperAttrs">
43
+ <div v-bind="buttonsAttrs">
44
44
  <template v-if="Array.isArray(currentFiles) || !currentFiles">
45
45
  <UButton
46
46
  filled
@@ -86,7 +86,7 @@
86
86
  </div>
87
87
 
88
88
  <UText v-if="hasSlotContent($slots['bottom'])" :size="size" v-bind="descriptionBottomAttrs">
89
- <!-- @slot Use it to add something at the bottom of the file block. -->
89
+ <!-- @slot Use it to add something below the component content. -->
90
90
  <slot name="bottom" />
91
91
  </UText>
92
92
  </div>
@@ -115,7 +115,15 @@ defineOptions({ inheritAttrs: false });
115
115
 
116
116
  const props = defineProps({
117
117
  /**
118
- * Set label.
118
+ * Input value.
119
+ */
120
+ modelValue: {
121
+ type: [Array, File],
122
+ default: null,
123
+ },
124
+
125
+ /**
126
+ * Input label.
119
127
  */
120
128
  label: {
121
129
  type: String,
@@ -123,7 +131,7 @@ const props = defineProps({
123
131
  },
124
132
 
125
133
  /**
126
- * Set description.
134
+ * Input description.
127
135
  */
128
136
  description: {
129
137
  type: String,
@@ -131,7 +139,15 @@ const props = defineProps({
131
139
  },
132
140
 
133
141
  /**
134
- * Set label placement related from the default slot.
142
+ * Error message.
143
+ */
144
+ error: {
145
+ type: String,
146
+ default: "",
147
+ },
148
+
149
+ /**
150
+ * Label placement.
135
151
  * @values top, topInside, topWithDesc
136
152
  */
137
153
  labelAlign: {
@@ -139,21 +155,17 @@ const props = defineProps({
139
155
  default: getDefault(defaultConfig, UInputFile).labelAlign,
140
156
  },
141
157
 
142
- modelValue: {
143
- type: [Array, File],
144
- default: null,
145
- },
146
-
147
158
  /**
148
- * Allow selecting multiple files.
159
+ * Input size.
160
+ * @values sm, md, lg
149
161
  */
150
- multiple: {
151
- type: Boolean,
152
- default: getDefault(defaultConfig, UInputFile).multiple,
162
+ size: {
163
+ type: String,
164
+ default: getDefault(defaultConfig, UInputFile).size,
153
165
  },
154
166
 
155
167
  /**
156
- * Set max file size in megabytes.
168
+ * Max file size in megabytes.
157
169
  */
158
170
  maxFileSize: {
159
171
  type: Number,
@@ -161,7 +173,7 @@ const props = defineProps({
161
173
  },
162
174
 
163
175
  /**
164
- * Set allowed file types.
176
+ * Allowed file types.
165
177
  */
166
178
  allowedFileTypes: {
167
179
  type: Array,
@@ -169,20 +181,11 @@ const props = defineProps({
169
181
  },
170
182
 
171
183
  /**
172
- * Set size.
173
- * @values sm, md, lg
174
- */
175
- size: {
176
- type: String,
177
- default: getDefault(defaultConfig, UInputFile).size,
178
- },
179
-
180
- /**
181
- * Set error text for component.
184
+ * Allow selecting multiple files.
182
185
  */
183
- error: {
184
- type: String,
185
- default: "",
186
+ multiple: {
187
+ type: Boolean,
188
+ default: getDefault(defaultConfig, UInputFile).multiple,
186
189
  },
187
190
 
188
191
  /**
@@ -242,15 +245,15 @@ const {
242
245
  config,
243
246
  inputLabelAttrs,
244
247
  chooseFileButtonAttrs,
245
- dropzoneWrapperAttrs,
248
+ dropzoneAttrs,
246
249
  descriptionTopAttrs,
247
250
  descriptionBottomAttrs,
248
- contentWrapperAttrs,
251
+ contentAttrs,
249
252
  clearButtonAttrs,
250
253
  placeholderAttrs,
251
254
  inputAttrs,
252
255
  fileListAttrs,
253
- buttonWrapperAttrs,
256
+ buttonsAttrs,
254
257
  removeItemButtonAttrs,
255
258
  hasSlotContent,
256
259
  } = useAttrs(props);
@@ -285,10 +288,7 @@ const accept = computed(() => {
285
288
  });
286
289
 
287
290
  const isValue = computed(() => {
288
- return (
289
- (Array.isArray(currentFiles.value) && currentFiles.value?.length) ||
290
- (!Array.isArray(currentFiles.value) && currentFiles.value)
291
- );
291
+ return Array.isArray(currentFiles.value) ? !!currentFiles.value?.length : !!currentFiles.value;
292
292
  });
293
293
 
294
294
  const fileList = computed(() => {
@@ -389,13 +389,13 @@ function onClickResetFiles() {
389
389
  function onDragOver(event) {
390
390
  event.preventDefault();
391
391
 
392
- dropZoneRef.value.classList.add(...config.value.dropzoneWrapperHover.split(" "));
392
+ dropZoneRef.value.classList.add(...config.value.dropzoneHover.split(" "));
393
393
  }
394
394
 
395
395
  function onDragLeave(event) {
396
396
  event.preventDefault();
397
397
 
398
- dropZoneRef.value.classList.remove(...config.value.dropzoneWrapperHover.split(" "));
398
+ dropZoneRef.value.classList.remove(...config.value.dropzoneHover.split(" "));
399
399
  }
400
400
 
401
401
  function onDrop(event) {
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  inputLabel: "{ULabel} w-full",
3
- dropzoneWrapper: {
3
+ dropzone: {
4
4
  base: `
5
5
  p-3 size-auto w-full bg-white transition
6
6
  rounded-dynamic border border-solid border-gray-300
@@ -21,9 +21,11 @@ export default /*tw*/ {
21
21
  { labelAlign: "topInside", label: true, size: "lg", class: "pt-9" },
22
22
  ],
23
23
  },
24
+ dropzoneHover: "border-gray-400 border-dashed",
25
+ dropzoneError: "hover:border-red-400 border-dashed border-red-300",
24
26
  descriptionTop: "{UText} text-gray-700 mb-2",
25
27
  descriptionBottom: "{UText} text-gray-700 mt-2",
26
- contentWrapper: {
28
+ content: {
27
29
  base: "p-3 gap-6 flex justify-between items-start relative w-full rounded-dynamic bg-brand-50",
28
30
  variants: {
29
31
  multiple: {
@@ -47,6 +49,8 @@ export default /*tw*/ {
47
49
  },
48
50
  },
49
51
  },
52
+ fileList: "{UFiles} w-full",
53
+ buttons: "flex gap-3 items-center",
50
54
  chooseFileButton: {
51
55
  component: "{UButton}",
52
56
  variants: {
@@ -57,11 +61,7 @@ export default /*tw*/ {
57
61
  },
58
62
  clearButton: "{UButton}",
59
63
  removeItemButton: "{UButton} ml-2",
60
- dropzoneWrapperHover: "border-gray-400 border-dashed",
61
- dropzoneWrapperError: "hover:border-red-400 border-dashed border-red-300",
62
64
  input: "sr-only",
63
- buttonWrapper: "flex gap-3 items-center",
64
- fileList: "{UFiles} w-full",
65
65
  i18n: {
66
66
  sizeError: "File size is too big.",
67
67
  formatError: "Format is not supported.",
@@ -14,7 +14,7 @@
14
14
  :data-test="`${dataTest}-base-currency`"
15
15
  :left-icon="leftIcon"
16
16
  :right-icon="rightIcon"
17
- v-bind="inputAttrs"
17
+ v-bind="moneyInputAttrs"
18
18
  @keyup="onKeyup"
19
19
  @blur="onBlur"
20
20
  @input="onInput"
@@ -72,7 +72,7 @@ const props = defineProps({
72
72
  },
73
73
 
74
74
  /**
75
- * Set label placement related from the default slot.
75
+ * Label placement.
76
76
  * @values top, topInside, topWithDesc, left, right
77
77
  */
78
78
  labelAlign: {
@@ -232,7 +232,7 @@ const moneyInputRef = ref(null);
232
232
 
233
233
  const elementId = props.id || useId();
234
234
 
235
- const { inputAttrs } = useAttrs(props);
235
+ const { moneyInputAttrs } = useAttrs(props);
236
236
 
237
237
  const { formattedValue, rawValue, setValue } = useFormatCurrency(`#${elementId}`, () => ({
238
238
  minFractionDigits: props.minFractionDigits,
@@ -1,5 +1,5 @@
1
1
  export default /*tw*/ {
2
- input: "{UInput}",
2
+ moneyInput: "{UInput}",
3
3
  defaults: {
4
4
  symbol: "$",
5
5
  size: "md",
@@ -6,7 +6,7 @@
6
6
  filled
7
7
  square
8
8
  round
9
- :disabled="isRemoveButtonDisabled"
9
+ :disabled="isRemoveButtonDisabled || disabled"
10
10
  v-bind="removeButtonAttrs"
11
11
  @click="onClickRemove"
12
12
  >
@@ -22,7 +22,7 @@
22
22
 
23
23
  <div v-bind="numberAttrs">
24
24
  <div v-bind="valueAttrs" v-text="count" />
25
- <div v-bind="textAttrs" v-text="label" />
25
+ <div v-bind="labelAttrs" v-text="label" />
26
26
  </div>
27
27
 
28
28
  <UButton
@@ -31,7 +31,7 @@
31
31
  filled
32
32
  square
33
33
  round
34
- :disabled="isAddButtonDisabled"
34
+ :disabled="isAddButtonDisabled || disabled"
35
35
  v-bind="addButtonAttrs"
36
36
  @click="onClickAdd"
37
37
  >
@@ -101,6 +101,31 @@ const props = defineProps({
101
101
  default: "",
102
102
  },
103
103
 
104
+ /**
105
+ * Label placement.
106
+ * @values top, topWithDesc, left, right
107
+ */
108
+ labelAlign: {
109
+ type: String,
110
+ default: getDefault(defaultConfig, UInputNumber).labelAlign,
111
+ },
112
+
113
+ /**
114
+ * Input description.
115
+ */
116
+ description: {
117
+ type: String,
118
+ default: "",
119
+ },
120
+
121
+ /**
122
+ * Error message.
123
+ */
124
+ error: {
125
+ type: String,
126
+ default: "",
127
+ },
128
+
104
129
  /**
105
130
  * Input size.
106
131
  * @values sm, md, lg
@@ -110,6 +135,14 @@ const props = defineProps({
110
135
  default: getDefault(defaultConfig, UInputNumber).size,
111
136
  },
112
137
 
138
+ /**
139
+ * Disable the input.
140
+ */
141
+ disabled: {
142
+ type: Boolean,
143
+ default: getDefault(defaultConfig, UInputNumber).disabled,
144
+ },
145
+
113
146
  /**
114
147
  * Component config object.
115
148
  */
@@ -138,7 +171,7 @@ const emit = defineEmits([
138
171
  const {
139
172
  config,
140
173
  valueAttrs,
141
- textAttrs,
174
+ labelAttrs,
142
175
  removeButtonAttrs,
143
176
  removeIconAttrs,
144
177
  addButtonAttrs,
@@ -15,7 +15,7 @@ export default /*tw*/ {
15
15
  },
16
16
  },
17
17
  },
18
- text: {
18
+ label: {
19
19
  base: "pt-1 !leading-none text-gray-500",
20
20
  variants: {
21
21
  size: {
@@ -8,7 +8,7 @@
8
8
  v-bind="inputLabelAttrs"
9
9
  :data-test="dataTest"
10
10
  >
11
- <div v-bind="wrapperAttrs">
11
+ <div v-bind="containerAttrs">
12
12
  <div v-if="counter || hasSlotContent($slots['counter'])" v-bind="counterAttrs">
13
13
  <!--
14
14
  @slot Use it to customise counter.
@@ -177,7 +177,7 @@ const hovered = ref(null);
177
177
  const {
178
178
  config,
179
179
  inputLabelAttrs,
180
- wrapperAttrs,
180
+ containerAttrs,
181
181
  counterAttrs,
182
182
  totalAttrs,
183
183
  starsAttrs,
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  inputLabel: "{ULabel}",
3
- wrapper: {
3
+ container: {
4
4
  base: "flex items-center text-gray-500 !leading-none",
5
5
  variants: {
6
6
  size: {
@@ -13,7 +13,7 @@
13
13
  :placeholder="placeholder"
14
14
  inputmode="search"
15
15
  :left-icon="leftIcon"
16
- v-bind="inputAttrs"
16
+ v-bind="searchInputAttrs"
17
17
  :data-test="dataTest"
18
18
  @update:model-value="onUpdateValue"
19
19
  @keyup.enter="onKeyupEnter"
@@ -69,7 +69,7 @@
69
69
  :label="searchButtonLabel"
70
70
  :size="buttonSize"
71
71
  no-ring
72
- v-bind="buttonAttrs"
72
+ v-bind="searchButtonAttrs"
73
73
  :data-test="`${dataTest}-search-button`"
74
74
  @click="onClickSearch"
75
75
  />
@@ -111,22 +111,6 @@ const props = defineProps({
111
111
  default: getDefault(defaultConfig, UInputSearch).size,
112
112
  },
113
113
 
114
- /**
115
- * Left icon name.
116
- */
117
- leftIcon: {
118
- type: String,
119
- default: "",
120
- },
121
-
122
- /**
123
- * Right icon name.
124
- */
125
- rightIcon: {
126
- type: String,
127
- default: "",
128
- },
129
-
130
114
  /**
131
115
  * Input placeholder.
132
116
  */
@@ -185,7 +169,31 @@ const props = defineProps({
185
169
  },
186
170
 
187
171
  /**
188
- * Set input read-only.
172
+ * Time in milliseconds before value emit.
173
+ */
174
+ debounce: {
175
+ type: [Number, String],
176
+ default: getDefault(defaultConfig, UInputSearch).debounce,
177
+ },
178
+
179
+ /**
180
+ * Left icon name.
181
+ */
182
+ leftIcon: {
183
+ type: String,
184
+ default: "",
185
+ },
186
+
187
+ /**
188
+ * Right icon name.
189
+ */
190
+ rightIcon: {
191
+ type: String,
192
+ default: "",
193
+ },
194
+
195
+ /**
196
+ * Make input read-only.
189
197
  */
190
198
  readonly: {
191
199
  type: Boolean,
@@ -193,7 +201,7 @@ const props = defineProps({
193
201
  },
194
202
 
195
203
  /**
196
- * Set input disabled.
204
+ * Make input disabled.
197
205
  */
198
206
  disabled: {
199
207
  type: Boolean,
@@ -208,11 +216,6 @@ const props = defineProps({
208
216
  default: "",
209
217
  },
210
218
 
211
- debounce: {
212
- type: [Number, String],
213
- default: getDefault(defaultConfig, UInputSearch).debounce,
214
- },
215
-
216
219
  /**
217
220
  * Component config object.
218
221
  */
@@ -260,7 +263,8 @@ defineExpose({ inputRef });
260
263
 
261
264
  const elementId = props.id || useId();
262
265
 
263
- const { config, inputAttrs, searchIconAttrs, clearIconAttrs, buttonAttrs } = useAttrs(props);
266
+ const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonAttrs } =
267
+ useAttrs(props);
264
268
 
265
269
  const iconSize = computed(() => {
266
270
  const sizes = {
@@ -1,8 +1,8 @@
1
1
  export default /*tw*/ {
2
- input: "{UInput}",
2
+ searchInput: "{UInput}",
3
3
  clearIcon: "{UIcon}",
4
4
  searchIcon: "{UIcon}",
5
- button: "{UButton} rounded-l-none ml-1 outline outline-1 outline-gray-900",
5
+ searchButton: "{UButton} rounded-l-none ml-1 outline outline-1 outline-gray-900",
6
6
  defaults: {
7
7
  size: "md",
8
8
  labelAlign: "topInside",