vueless 0.0.413 → 0.0.414

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.413",
3
+ "version": "0.0.414",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -198,7 +198,7 @@ const emit = defineEmits([
198
198
  /**
199
199
  * Triggers when option is added.
200
200
  */
201
- "addOption",
201
+ "add",
202
202
  /**
203
203
  * Triggers on click option.
204
204
  */
@@ -260,7 +260,7 @@ const wrapperHeight = computed(() => {
260
260
  });
261
261
 
262
262
  function onClickAddOption() {
263
- emit("addOption");
263
+ emit("add");
264
264
  }
265
265
 
266
266
  function select(option, key) {
@@ -189,7 +189,7 @@ defineOptions({ inheritAttrs: false });
189
189
 
190
190
  const props = defineProps({
191
191
  /**
192
- * Calendar value in JS Date Object or String formatted in provided props.dateFormat.
192
+ * Calendar value (JavaScript Date object or string formatted in given `dateFormat`).
193
193
  */
194
194
  modelValue: {
195
195
  type: [String, Object],
@@ -197,7 +197,7 @@ const props = defineProps({
197
197
  },
198
198
 
199
199
  /**
200
- * Calendar view.
200
+ * Calendar view variant.
201
201
  * @values day, month, year
202
202
  */
203
203
  view: {
@@ -206,7 +206,7 @@ const props = defineProps({
206
206
  },
207
207
 
208
208
  /**
209
- * Enable range selection.
209
+ * Enable date range selection.
210
210
  */
211
211
  range: {
212
212
  type: Boolean,
@@ -214,7 +214,7 @@ const props = defineProps({
214
214
  },
215
215
 
216
216
  /**
217
- * Enable timepicker.
217
+ * Show timepicker.
218
218
  */
219
219
  timepicker: {
220
220
  type: Boolean,
@@ -222,7 +222,7 @@ const props = defineProps({
222
222
  },
223
223
 
224
224
  /**
225
- * Date format.
225
+ * Date string format.
226
226
  */
227
227
  dateFormat: {
228
228
  type: String,
@@ -238,7 +238,7 @@ const props = defineProps({
238
238
  },
239
239
 
240
240
  /**
241
- * User friendly date format.
241
+ * User-friendly date format (it will be shown in UI).
242
242
  */
243
243
  userDateFormat: {
244
244
  type: String,
@@ -254,7 +254,7 @@ const props = defineProps({
254
254
  },
255
255
 
256
256
  /**
257
- * Min date in JS Date Object or Date String formatted in provided props.dateFormat.
257
+ * Min date (JavaScript Date object or string formatted in given `dateFormat`).
258
258
  */
259
259
  minDate: {
260
260
  type: [Date, String],
@@ -262,7 +262,7 @@ const props = defineProps({
262
262
  },
263
263
 
264
264
  /**
265
- * Max date in JS Date Object or Date String formatted in provided props.dateFormat.
265
+ * Max date (JavaScript Date object or string formatted in given `dateFormat`).
266
266
  */
267
267
  maxDate: {
268
268
  type: [Date, String],
@@ -316,7 +316,7 @@ const emit = defineEmits([
316
316
  "keydown",
317
317
 
318
318
  /**
319
- * Triggers when the date input value is changed by the user.
319
+ * Triggers when the user changes the date input value.
320
320
  * @property {string} value
321
321
  */
322
322
  "userDateChange",
@@ -86,6 +86,14 @@ import { UDatePicker } from "./constants.js";
86
86
  defineOptions({ inheritAttrs: false });
87
87
 
88
88
  const props = defineProps({
89
+ /**
90
+ * Datepicker value (JavaScript Date object or string formatted in given `dateFormat`).
91
+ */
92
+ modelValue: {
93
+ type: [Object, String],
94
+ default: null,
95
+ },
96
+
89
97
  /**
90
98
  * Datepicker label.
91
99
  */
@@ -95,7 +103,7 @@ const props = defineProps({
95
103
  },
96
104
 
97
105
  /**
98
- * Label placement.
106
+ * Datepicker label placement.
99
107
  * @values top, topInside, topWithDesc, left, right
100
108
  */
101
109
  labelAlign: {
@@ -112,11 +120,28 @@ const props = defineProps({
112
120
  },
113
121
 
114
122
  /**
115
- * Datepicker value in JS Date Object or String formatted in provided props.dateFormat.
123
+ * Datepicker description.
116
124
  */
117
- modelValue: {
118
- type: [Object, String],
119
- default: null,
125
+ description: {
126
+ type: String,
127
+ default: "",
128
+ },
129
+
130
+ /**
131
+ * Datepicker error message.
132
+ */
133
+ error: {
134
+ type: String,
135
+ default: "",
136
+ },
137
+
138
+ /**
139
+ * Datepicker size.
140
+ * @values sm, md, lg
141
+ */
142
+ size: {
143
+ type: String,
144
+ default: getDefault(defaultConfig, UDatePicker).size,
120
145
  },
121
146
 
122
147
  /**
@@ -138,7 +163,7 @@ const props = defineProps({
138
163
  },
139
164
 
140
165
  /**
141
- * Min date in format date string or Date.
166
+ * Min date (JavaScript Date object or string formatted in given `dateFormat`).
142
167
  */
143
168
  minDate: {
144
169
  type: [String, Date],
@@ -146,7 +171,7 @@ const props = defineProps({
146
171
  },
147
172
 
148
173
  /**
149
- * Max date in format date string or Date.
174
+ * Max date (JavaScript Date object or string formatted in given `dateFormat`).
150
175
  */
151
176
  maxDate: {
152
177
  type: [String, Date],
@@ -154,44 +179,35 @@ const props = defineProps({
154
179
  },
155
180
 
156
181
  /**
157
- * Disable component.
158
- */
159
- disabled: {
160
- type: Boolean,
161
- default: getDefault(defaultConfig, UDatePicker).disabled,
162
- },
163
-
164
- /**
165
- * Enable timepicker.
182
+ * Date string format.
166
183
  */
167
- timepicker: {
168
- type: Boolean,
169
- default: getDefault(defaultConfig, UDatePicker).timepicker,
184
+ dateFormat: {
185
+ type: String,
186
+ default: getDefault(defaultConfig, UDatePicker).dateFormat,
170
187
  },
171
188
 
172
189
  /**
173
- * Error message.
190
+ * Same as date format, but used when timepicker is enabled.
174
191
  */
175
- error: {
192
+ dateTimeFormat: {
176
193
  type: String,
177
- default: "",
194
+ default: getDefault(defaultConfig, UDatePicker).dateTimeFormat,
178
195
  },
179
196
 
180
197
  /**
181
- * Datepicker description.
198
+ * User-friendly date format (it will be shown in UI).
182
199
  */
183
- description: {
200
+ userDateFormat: {
184
201
  type: String,
185
- default: "",
202
+ default: getDefault(defaultConfig, UDatePicker).userDateFormat,
186
203
  },
187
204
 
188
205
  /**
189
- * Datepicker size.
190
- * @values sm, md, lg
206
+ * Same as user format, but used when timepicker is enabled.
191
207
  */
192
- size: {
208
+ userDateTimeFormat: {
193
209
  type: String,
194
- default: getDefault(defaultConfig, UDatePicker).size,
210
+ default: getDefault(defaultConfig, UDatePicker).userDateTimeFormat,
195
211
  },
196
212
 
197
213
  /**
@@ -211,35 +227,19 @@ const props = defineProps({
211
227
  },
212
228
 
213
229
  /**
214
- * Date format.
215
- */
216
- dateFormat: {
217
- type: String,
218
- default: getDefault(defaultConfig, UDatePicker).dateFormat,
219
- },
220
-
221
- /**
222
- * Same as date format, but used when timepicker is enabled.
230
+ * Make datepicker disabled.
223
231
  */
224
- dateTimeFormat: {
225
- type: String,
226
- default: getDefault(defaultConfig, UDatePicker).dateTimeFormat,
227
- },
228
-
229
- /**
230
- * User friendly date format.
231
- */
232
- userDateFormat: {
233
- type: String,
234
- default: getDefault(defaultConfig, UDatePicker).userDateFormat,
232
+ disabled: {
233
+ type: Boolean,
234
+ default: getDefault(defaultConfig, UDatePicker).disabled,
235
235
  },
236
236
 
237
237
  /**
238
- * Same as user format, but used when timepicker is enabled.
238
+ * Show timepicker.
239
239
  */
240
- userDateTimeFormat: {
241
- type: String,
242
- default: getDefault(defaultConfig, UDatePicker).userDateTimeFormat,
240
+ timepicker: {
241
+ type: Boolean,
242
+ default: getDefault(defaultConfig, UDatePicker).timepicker,
243
243
  },
244
244
 
245
245
  /**
@@ -390,9 +390,9 @@ function onInput() {
390
390
  nextTick(() => {
391
391
  calendarRef.value?.wrapperRef?.blur();
392
392
  emit("input", {
393
- userFormatDate: formatUserDate(userFormatDate.value),
394
393
  value: localValue.value,
395
394
  formattedDate: formattedDate.value,
395
+ userFormatDate: formatUserDate(userFormatDate.value),
396
396
  });
397
397
  });
398
398
  }
@@ -16,7 +16,8 @@ import defaultConfig from "../config.js?raw"
16
16
  <Source code={getSource(defaultConfig)} language="jsx" dark />
17
17
 
18
18
  ## Formatting tokens
19
- Each character in the table below can be used in `dateFormat` and `userDateFormat` / `userDateTimeFormat` options to achieve the format you need.
19
+ Each character in the table below can be used in `dateFormat` / `dateTimeFormat` and `userDateFormat` / `userDateTimeFormat` options
20
+ to achieve the format you need.
20
21
 
21
22
  <Markdown>
22
23
  {`
@@ -47,6 +48,6 @@ Each character in the table below can be used in `dateFormat` and `userDateForma
47
48
  </Markdown>
48
49
 
49
50
  ## Escaping Formatting Tokens
50
- You may escape formatting tokens using \\\\.
51
+ You may escape formatting tokens using `\\`.
51
52
 
52
53
  <Source code={`dateFormat: "Y-m-d\\Z", // Displays: 2017-01-22Z`} language="jsx" dark />
@@ -123,7 +123,7 @@
123
123
  :attrs="keysAttrs"
124
124
  />
125
125
 
126
- <div v-if="inputRangeToError || inputRangeFromError" v-bind="inputRangeErrorAttrs">
126
+ <div v-if="inputRangeToError || inputRangeFromError" v-bind="rangeInputErrorAttrs">
127
127
  {{ inputRangeToError || inputRangeFromError }}
128
128
  </div>
129
129
 
@@ -198,7 +198,7 @@ defineOptions({ inheritAttrs: false });
198
198
 
199
199
  const props = defineProps({
200
200
  /**
201
- * Datepicker value in JS Date Objects or Strings formatted in provided props.dateFormat.
201
+ * Datepicker value (JavaScript Date object or string formatted in given `dateFormat`).
202
202
  */
203
203
  modelValue: {
204
204
  type: Object,
@@ -248,7 +248,7 @@ const props = defineProps({
248
248
  },
249
249
 
250
250
  /**
251
- * Min date in format date string or Date.
251
+ * Min date (JavaScript Date object or string formatted in given `dateFormat`).
252
252
  */
253
253
  minDate: {
254
254
  type: [String, Date],
@@ -256,13 +256,21 @@ const props = defineProps({
256
256
  },
257
257
 
258
258
  /**
259
- * Max date in format date string or Date.
259
+ * Max date (JavaScript Date object or string formatted in given `dateFormat`).
260
260
  */
261
261
  maxDate: {
262
262
  type: [String, Date],
263
263
  default: getDefault(defaultConfig, UDatePickerRange).maxDate,
264
264
  },
265
265
 
266
+ /**
267
+ * Date string format.
268
+ */
269
+ dateFormat: {
270
+ type: String,
271
+ default: getDefault(defaultConfig, UDatePickerRange).dateFormat,
272
+ },
273
+
266
274
  /**
267
275
  * Datepicker size.
268
276
  * @values sm, md, lg
@@ -289,7 +297,7 @@ const props = defineProps({
289
297
  },
290
298
 
291
299
  /**
292
- * Label text for input type.
300
+ * Label text for an input type.
293
301
  */
294
302
  label: {
295
303
  type: String,
@@ -297,7 +305,7 @@ const props = defineProps({
297
305
  },
298
306
 
299
307
  /**
300
- * Input placeholder for input type.
308
+ * Input placeholder for an input type.
301
309
  */
302
310
  placeholder: {
303
311
  type: String,
@@ -305,7 +313,7 @@ const props = defineProps({
305
313
  },
306
314
 
307
315
  /**
308
- * Datepicker description for input type.
316
+ * Datepicker description for an input type.
309
317
  */
310
318
  description: {
311
319
  type: String,
@@ -313,7 +321,7 @@ const props = defineProps({
313
321
  },
314
322
 
315
323
  /**
316
- * Error message for input type.
324
+ * Error message for an input type.
317
325
  */
318
326
  error: {
319
327
  type: String,
@@ -328,14 +336,6 @@ const props = defineProps({
328
336
  default: getDefault(defaultConfig, UDatePickerRange).disabled,
329
337
  },
330
338
 
331
- /**
332
- * Date format.
333
- */
334
- dateFormat: {
335
- type: String,
336
- default: getDefault(defaultConfig, UDatePickerRange).dateFormat,
337
- },
338
-
339
339
  /**
340
340
  * Unique element id.
341
341
  */
@@ -364,7 +364,7 @@ const props = defineProps({
364
364
  const emit = defineEmits([
365
365
  /**
366
366
  * Triggers when date picker range value changes.
367
- * @property {string} value
367
+ * @property {object} range
368
368
  */
369
369
  "update:modelValue",
370
370
  ]);
@@ -412,7 +412,7 @@ const {
412
412
  buttonAttrs,
413
413
  shiftRangeButtonAttrs,
414
414
  rangeInputWrapperAttrs,
415
- inputRangeErrorAttrs,
415
+ rangeInputErrorAttrs,
416
416
  } = useAttrs(props, { isShownMenu, isTop, isRight, isPeriod });
417
417
 
418
418
  const calendarValue = ref(props.modelValue);
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-bind="periodsRowAttrs">
2
+ <div v-bind="periodRowAttrs">
3
3
  <template v-for="periodButton in periods" :key="periodButton.name">
4
4
  <UButton
5
5
  v-if="periodButton.name !== period"
@@ -27,7 +27,7 @@
27
27
  </template>
28
28
  </div>
29
29
 
30
- <div v-bind="periodsRowAttrs">
30
+ <div v-bind="periodRowAttrs">
31
31
  <UButton
32
32
  v-if="customRangeButton.range.to && customRangeButton.range.from && PERIOD.custom !== period"
33
33
  square
@@ -276,7 +276,7 @@ const isDatePeriodOutOfRange = inject("isDatePeriodOutOfRange", null);
276
276
 
277
277
  const {
278
278
  periodButtonAttrs,
279
- periodsRowAttrs,
279
+ periodRowAttrs,
280
280
  periodButtonActiveAttrs,
281
281
  customRangeDescription,
282
282
  rangeSwitchWrapperAttrs,
@@ -44,7 +44,7 @@ export default /*tw*/ {
44
44
  leaveActiveClass: "transition transform ease-in duration-75",
45
45
  leaveToClass: "opacity-0 scale-95",
46
46
  },
47
- periodsRow: "mb-1 flex min-w-64 gap-1",
47
+ periodRow: "mb-1 flex min-w-64 gap-1",
48
48
  periodButton: "{UButton} h-[3.125rem] w-full",
49
49
  periodButtonActive: "!bg-gray-800/20",
50
50
  rangeSwitchWrapper: "flex items-center justify-between py-2",
@@ -85,7 +85,7 @@ export default /*tw*/ {
85
85
  block: "focus-within:z-10 focus-within:ring-0 rounded-l-none",
86
86
  input: "rounded-l-none",
87
87
  },
88
- inputRangeError: "text-xs font-normal leading-none mt-2 text-center text-red-500",
88
+ rangeInputError: "text-xs font-normal leading-none mt-2 text-center text-red-500",
89
89
  calendar: {
90
90
  component: "{UCalendar}",
91
91
  wrapper: "p-0 w-full border-none shadow-none",
@@ -15,7 +15,7 @@ export default {
15
15
  title: "Form Inputs & Controls / Date Picker Range",
16
16
  component: UDatePickerRange,
17
17
  args: {
18
- value: {
18
+ modelValue: {
19
19
  from: new Date(2022, 1, 14),
20
20
  to: new Date(2022, 2, 20),
21
21
  },
@@ -39,18 +39,13 @@ const DefaultTemplate = (args) => ({
39
39
 
40
40
  return { args, slots };
41
41
  },
42
- data() {
43
- return {
44
- value: this.args.value,
45
- };
46
- },
47
42
  template: `
48
- <UDatePickerRange open-direction-y="bottom" v-bind="args" v-model="value">
43
+ <UDatePickerRange open-direction-y="bottom" v-bind="args" v-model="args.modelValue">
49
44
  ${args.slotTemplate || getSlotsFragment()}
50
45
  </UDatePickerRange>
51
46
 
52
47
  <div class="mt-4">
53
- {{ value }}
48
+ {{ args.modelValue }}
54
49
  </div>
55
50
  `,
56
51
  });
@@ -70,7 +65,7 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
70
65
  :key="index"
71
66
  open-direction-y="bottom"
72
67
  v-bind="args"
73
- v-model="args.value"
68
+ v-model="args.modelValue"
74
69
  :[args.enum]="option"
75
70
  />
76
71
  </URow>
@@ -89,7 +84,7 @@ const OpenDirectionTemplate = (args) => ({
89
84
  open-direction-y="top"
90
85
  open-direction-x="left"
91
86
  v-bind="args"
92
- v-model="args.value"
87
+ v-model="args.modelValue"
93
88
  label="Top Left"
94
89
  />
95
90
  <UDatePickerRange
@@ -97,7 +92,7 @@ const OpenDirectionTemplate = (args) => ({
97
92
  open-direction-y="top"
98
93
  open-direction-x="right"
99
94
  v-bind="args"
100
- v-model="args.value"
95
+ v-model="args.modelValue"
101
96
  label="Top Right"
102
97
  />
103
98
  <UDatePickerRange
@@ -105,7 +100,7 @@ const OpenDirectionTemplate = (args) => ({
105
100
  open-direction-y="bottom"
106
101
  open-direction-x="left"
107
102
  v-bind="args"
108
- v-model="args.value"
103
+ v-model="args.modelValue"
109
104
  label="Bottom Left"
110
105
  />
111
106
  <UDatePickerRange
@@ -113,7 +108,7 @@ const OpenDirectionTemplate = (args) => ({
113
108
  open-direction-y="bottom"
114
109
  open-direction-x="right"
115
110
  v-bind="args"
116
- v-model="args.value"
111
+ v-model="args.modelValue"
117
112
  label="Bottom Right"
118
113
  />
119
114
  </URow>
@@ -145,14 +140,14 @@ export const MinMax = DefaultTemplate.bind({});
145
140
  MinMax.args = {
146
141
  minDate: new Date(2022, 2, 22),
147
142
  maxDate: new Date(2022, 2, 26),
148
- value: { from: new Date(2022, 2, 24), to: new Date(2022, 2, 25) },
143
+ modelValue: { from: new Date(2022, 2, 24), to: new Date(2022, 2, 25) },
149
144
  };
150
145
 
151
146
  export const DateFormat = DefaultTemplate.bind({});
152
147
  DateFormat.args = {
153
148
  dateFormat: "d.m.Y",
154
149
  userDateFormat: "d.m.Y",
155
- value: { from: "28.06.2024", to: "30.06.2024" },
150
+ modelValue: { from: "28.06.2024", to: "30.06.2024" },
156
151
  };
157
152
 
158
153
  export const CustomRangeButton = DefaultTemplate.bind({});
@@ -165,7 +160,7 @@ CustomRangeButton.args = {
165
160
  label: "Next 2 days",
166
161
  description: "Some description",
167
162
  },
168
- value: { from: null, to: null },
163
+ modelValue: { from: null, to: null },
169
164
  };
170
165
 
171
166
  export const LeftIcon = DefaultTemplate.bind({});