vueless 1.0.2-beta.7 → 1.0.2-beta.8

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": "1.0.2-beta.7",
3
+ "version": "1.0.2-beta.8",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -151,7 +151,6 @@ function getDayState(day: Date) {
151
151
  const isCurrentDay = isToday(day);
152
152
  const isAnotherMonthDay = isAnotherMothDay(day, activeMonthDate.value);
153
153
  const isAnotherMonthDayInRange = isAnotherMonthDay && isDayInRange;
154
- const isCurrentDayInRange = isCurrentDay && isDayInRange;
155
154
  const isFirstDayInRange = props.range && isSameDay(day, localSelectedDate.value);
156
155
  const isRangeSameDay =
157
156
  props.selectedDateTo &&
@@ -160,8 +159,6 @@ function getDayState(day: Date) {
160
159
  isSameDay(day, props.selectedDateTo);
161
160
  const isLastDayInRange =
162
161
  props.selectedDateTo && props.range && isSameDay(day, props.selectedDateTo);
163
- const isCurrentFirstDayInRange = isFirstDayInRange && isCurrentDay;
164
- const isCurrentLastDayInRange = isLastDayInRange && isCurrentDay;
165
162
  const isAnotherMonthFirstDayInRange = isFirstDayInRange && isAnotherMonthDay;
166
163
  const isAnotherMonthLastDayInRange = isLastDayInRange && isAnotherMonthDay;
167
164
  const isActiveDay = props.activeDate && isSameDay(props.activeDate, day) && !props.range;
@@ -179,11 +176,8 @@ function getDayState(day: Date) {
179
176
  isSelectedDay,
180
177
  isCurrentDay,
181
178
  isAnotherMonthDay,
182
- isCurrentDayInRange,
183
179
  isFirstDayInRange,
184
180
  isLastDayInRange,
185
- isCurrentFirstDayInRange,
186
- isCurrentLastDayInRange,
187
181
  isAnotherMonthFirstDayInRange,
188
182
  isAnotherMonthLastDayInRange,
189
183
  isActiveDay,
@@ -238,8 +232,6 @@ const {
238
232
  anotherMonthLastDayInRangeAttrs,
239
233
  selectedDayAttrs,
240
234
  activeDayAttrs,
241
- currentLastDayInRangeAttrs,
242
- currentFirstDayInRangeAttrs,
243
235
  anotherMonthDayInRangeAttrs,
244
236
  } = useUI<Config>(defaultConfig);
245
237
 
@@ -274,50 +266,6 @@ defineExpose({
274
266
  @mouseover="onMouseoverDay(day)"
275
267
  />
276
268
 
277
- <UButton
278
- v-else-if="getDayState(day).isCurrentDay && !getDayState(day).isDayInRange"
279
- tabindex="-1"
280
- variant="ghost"
281
- color="primary"
282
- size="md"
283
- square
284
- v-bind="currentDayAttrs"
285
- :disabled="dateIsOutOfRange(day, minDate, maxDate, locale, dateFormat)"
286
- :label="formatDate(day, 'j', locale)"
287
- @mousedown.prevent.capture
288
- @click="onClickDay(day)"
289
- />
290
-
291
- <UButton
292
- v-else-if="getDayState(day).isCurrentFirstDayInRange"
293
- tabindex="-1"
294
- variant="soft"
295
- color="primary"
296
- size="md"
297
- square
298
- v-bind="currentFirstDayInRangeAttrs"
299
- :disabled="dateIsOutOfRange(day, minDate, maxDate, locale, dateFormat)"
300
- :label="formatDate(day, 'j', locale)"
301
- @mousedown.prevent.capture
302
- @click="onClickDay(day)"
303
- @mouseover="onMouseoverDay(day)"
304
- />
305
-
306
- <UButton
307
- v-else-if="getDayState(day).isCurrentLastDayInRange"
308
- tabindex="-1"
309
- variant="soft"
310
- color="primary"
311
- size="md"
312
- square
313
- v-bind="currentLastDayInRangeAttrs"
314
- :disabled="dateIsOutOfRange(day, minDate, maxDate, locale, dateFormat)"
315
- :label="formatDate(day, 'j', locale)"
316
- @mousedown.prevent.capture
317
- @click="onClickDay(day)"
318
- @mouseover="onMouseoverDay(day)"
319
- />
320
-
321
269
  <UButton
322
270
  v-else-if="getDayState(day).isRangeSameDay"
323
271
  tabindex="-1"
@@ -394,13 +342,16 @@ defineExpose({
394
342
  />
395
343
 
396
344
  <UButton
397
- v-else-if="getDayState(day).isDayInRange && getDayState(day).isCurrentDay"
345
+ v-else-if="
346
+ getDayState(day).isAnotherMonthDayInRange ||
347
+ getDayState(day).isInRangePreviewAnotherMonth
348
+ "
398
349
  tabindex="-1"
399
350
  variant="ghost"
400
351
  color="primary"
401
352
  size="md"
402
353
  square
403
- v-bind="currentDayInRangeAttrs"
354
+ v-bind="anotherMonthDayInRangeAttrs"
404
355
  :disabled="dateIsOutOfRange(day, minDate, maxDate, locale, dateFormat)"
405
356
  :label="formatDate(day, 'j', locale)"
406
357
  @mousedown.prevent.capture
@@ -410,15 +361,15 @@ defineExpose({
410
361
 
411
362
  <UButton
412
363
  v-else-if="
413
- getDayState(day).isAnotherMonthDayInRange ||
414
- getDayState(day).isInRangePreviewAnotherMonth
364
+ getDayState(day).isCurrentDay &&
365
+ (getDayState(day).isDayInRange || getDayState(day).isInRangePreview)
415
366
  "
416
367
  tabindex="-1"
417
368
  variant="ghost"
418
369
  color="primary"
419
370
  size="md"
420
371
  square
421
- v-bind="anotherMonthDayInRangeAttrs"
372
+ v-bind="currentDayInRangeAttrs"
422
373
  :disabled="dateIsOutOfRange(day, minDate, maxDate, locale, dateFormat)"
423
374
  :label="formatDate(day, 'j', locale)"
424
375
  @mousedown.prevent.capture
@@ -441,6 +392,21 @@ defineExpose({
441
392
  @mouseover="onMouseoverDay(day)"
442
393
  />
443
394
 
395
+ <UButton
396
+ v-else-if="getDayState(day).isCurrentDay && !getDayState(day).isDayInRange"
397
+ tabindex="-1"
398
+ variant="ghost"
399
+ color="primary"
400
+ size="md"
401
+ square
402
+ v-bind="currentDayAttrs"
403
+ :disabled="dateIsOutOfRange(day, minDate, maxDate, locale, dateFormat)"
404
+ :label="formatDate(day, 'j', locale)"
405
+ @mousedown.prevent.capture
406
+ @click="onClickDay(day)"
407
+ @mouseover="onMouseoverDay(day)"
408
+ />
409
+
444
410
  <UButton
445
411
  v-else-if="getDayState(day).isActiveDay"
446
412
  tabindex="-1"
@@ -38,8 +38,6 @@ export default /*tw*/ {
38
38
  firstDayInRange: "{>day} {>edgeDateInRange} {>firstDateInRange}",
39
39
  anotherMonthFirstDayInRange: "{>day} {>anotherMonthDay} {>edgeDateInRange} {>firstDateInRange}",
40
40
  lastDayInRange: "{>day} {>edgeDateInRange} {>lastDateInRange}",
41
- currentLastDayInRange: "{>day} {>edgeDateInRange} {>lastDateInRange} {>currentDate}",
42
- currentFirstDayInRange: "{>day} {>edgeDateInRange} {>firstDateInRange} {>currentDate}",
43
41
  anotherMonthLastDayInRange: "{>day} {>anotherMonthDay} {>edgeDateInRange} {>lastDateInRange}",
44
42
  selectedDay: "{>day} {>selectedDate}",
45
43
  activeDay: "{>day} {>activeDate}",
@@ -38,6 +38,7 @@ export default {
38
38
  args: {
39
39
  label: "Select a date",
40
40
  modelValue: null,
41
+ openDirectionY: "bottom",
41
42
  },
42
43
  argTypes: {
43
44
  ...getArgTypes(COMPONENT_NAME),
@@ -224,16 +224,14 @@ const { userFormatDate } = useUserFormat(
224
224
  props.userDateFormat,
225
225
  );
226
226
 
227
- watch(
228
- calendarValue,
229
- () => {
227
+ watch(calendarValue, () => {
228
+ if (calendarValue.value.from && calendarValue.value.to) {
230
229
  localValue.value = {
231
230
  from: calendarValue.value.from,
232
231
  to: calendarValue.value.to,
233
232
  };
234
- },
235
- { deep: true },
236
- );
233
+ }
234
+ });
237
235
 
238
236
  watch(
239
237
  () => props.modelValue,
@@ -33,7 +33,9 @@ function isGraterThanTo(value: string) {
33
33
  const parsedValue = parseDate(value, INPUT_RANGE_FORMAT, props.locale);
34
34
  const parsedTo = parseDate(localValue.value.to, props.dateFormat, props.locale);
35
35
 
36
- return parsedValue && parsedTo && parsedValue > parsedTo;
36
+ if (!parsedValue || !parsedTo) return false;
37
+
38
+ return parsedValue > parsedTo && !isSameDay(parsedValue, parsedTo);
37
39
  }
38
40
 
39
41
  function isSmallerThanFrom(value: string) {
@@ -42,7 +44,9 @@ function isSmallerThanFrom(value: string) {
42
44
  const parsedValue = parseDate(value, INPUT_RANGE_FORMAT, props.locale);
43
45
  const parsedFrom = parseDate(localValue.value.from, props.dateFormat, props.locale);
44
46
 
45
- return parsedValue && parsedFrom && parsedValue < parsedFrom;
47
+ if (!parsedValue || !parsedFrom) return false;
48
+
49
+ return parsedValue < parsedFrom && !isSameDay(parsedValue, parsedFrom);
46
50
  }
47
51
 
48
52
  function validateInput(value: string, type: `${InputRangeType}`) {
@@ -44,6 +44,7 @@ export default {
44
44
  from: fromDate,
45
45
  to: toDate,
46
46
  },
47
+ openDirectionY: "bottom",
47
48
  },
48
49
  argTypes: {
49
50
  ...getArgTypes(COMPONENT_NAME),