vueless 0.0.383 → 0.0.385

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.
@@ -31,6 +31,8 @@ export default /*tw*/ {
31
31
  firstDayInRange: "",
32
32
  anotherMonthFirstDayInRange: "",
33
33
  lastDayInRange: "",
34
+ currentLastDayInRange: "",
35
+ currentFirstDayInRange: "",
34
36
  anotherMonthLastDayInRange: "",
35
37
  selectedDay: "",
36
38
  activeDay: "",
@@ -38,9 +40,12 @@ export default /*tw*/ {
38
40
  month: "{UButton} mx-auto flex h-12 w-full",
39
41
  currentMonth: "",
40
42
  currentMonthInRange: "",
43
+ currentLastMonthInRange: "",
44
+ currentFirstMonthInRange: "",
41
45
  lastMonthInRange: "",
42
46
  firstMonthInRange: "",
43
47
  singleMonthInRange: "rounded-dynamic",
48
+ singleCurrentMonthInRange: "rounded-dynamic",
44
49
  monthInRange: "",
45
50
  selectedMonth: "",
46
51
  activeMonth: "",
@@ -52,6 +57,9 @@ export default /*tw*/ {
52
57
  lastYearInRange: "",
53
58
  yearInRange: "",
54
59
  singleYearInRange: "rounded-dynamic",
60
+ singleCurrentYearInRange: "rounded-dynamic",
61
+ currentLastYearInRange: "",
62
+ currentFirstYearInRange: "",
55
63
  selectedYear: "",
56
64
  activeYear: "",
57
65
  timepicker: "mt-2 pl-1 pt-3 text-sm flex items-center justify-between gap-2 border-t border-brand-200",
@@ -67,6 +67,22 @@ export default function useAttrs(props) {
67
67
  extendingKeysClasses.currentDate.value,
68
68
  ]),
69
69
  },
70
+ currentFirstDayInRange: {
71
+ base: computed(() => [
72
+ extendingKeysClasses.day.value,
73
+ extendingKeysClasses.edgeDateInRange.value,
74
+ extendingKeysClasses.firstDateInRange.value,
75
+ extendingKeysClasses.currentDate.value,
76
+ ]),
77
+ },
78
+ currentLastDayInRange: {
79
+ base: computed(() => [
80
+ extendingKeysClasses.day.value,
81
+ extendingKeysClasses.edgeDateInRange.value,
82
+ extendingKeysClasses.lastDateInRange.value,
83
+ extendingKeysClasses.currentDate.value,
84
+ ]),
85
+ },
70
86
  firstDayInRange: {
71
87
  base: computed(() => [
72
88
  extendingKeysClasses.day.value,
@@ -115,6 +131,29 @@ export default function useAttrs(props) {
115
131
  extendingKeysClasses.dateInRange.value,
116
132
  ]),
117
133
  },
134
+ singleCurrentMonthInRange: {
135
+ base: computed(() => [
136
+ extendingKeysClasses.year.value,
137
+ extendingKeysClasses.dateInRange.value,
138
+ extendingKeysClasses.currentDate.value,
139
+ ]),
140
+ },
141
+ currentFirstYearInRange: {
142
+ base: computed(() => [
143
+ extendingKeysClasses.year.value,
144
+ extendingKeysClasses.edgeDateInRange.value,
145
+ extendingKeysClasses.firstDateInRange.value,
146
+ extendingKeysClasses.currentDate.value,
147
+ ]),
148
+ },
149
+ currentLastYearInRange: {
150
+ base: computed(() => [
151
+ extendingKeysClasses.year.value,
152
+ extendingKeysClasses.edgeDateInRange.value,
153
+ extendingKeysClasses.lastDateInRange.value,
154
+ extendingKeysClasses.currentDate.value,
155
+ ]),
156
+ },
118
157
  currentMonthInRange: {
119
158
  base: computed(() => [
120
159
  extendingKeysClasses.month.value,
@@ -129,6 +168,22 @@ export default function useAttrs(props) {
129
168
  extendingKeysClasses.lastDateInRange.value,
130
169
  ]),
131
170
  },
171
+ currentFirstMonthInRange: {
172
+ base: computed(() => [
173
+ extendingKeysClasses.month.value,
174
+ extendingKeysClasses.edgeDateInRange.value,
175
+ extendingKeysClasses.firstDateInRange.value,
176
+ extendingKeysClasses.currentDate.value,
177
+ ]),
178
+ },
179
+ currentLastMonthInRange: {
180
+ base: computed(() => [
181
+ extendingKeysClasses.month.value,
182
+ extendingKeysClasses.edgeDateInRange.value,
183
+ extendingKeysClasses.lastDateInRange.value,
184
+ extendingKeysClasses.currentDate.value,
185
+ ]),
186
+ },
132
187
  firstMonthInRange: {
133
188
  base: computed(() => [
134
189
  extendingKeysClasses.month.value,
@@ -160,6 +215,13 @@ export default function useAttrs(props) {
160
215
  extendingKeysClasses.dateInRange.value,
161
216
  ]),
162
217
  },
218
+ singleCurrentYearInRange: {
219
+ base: computed(() => [
220
+ extendingKeysClasses.year.value,
221
+ extendingKeysClasses.dateInRange.value,
222
+ extendingKeysClasses.currentDate.value,
223
+ ]),
224
+ },
163
225
  singleYearInRange: {
164
226
  base: computed(() => [
165
227
  extendingKeysClasses.year.value,
@@ -10,8 +10,8 @@ export default /*tw*/ {
10
10
  base: "absolute mb-3 z-40",
11
11
  variants: {
12
12
  openDirectionX: {
13
- left: "right-0",
14
- right: "left-0",
13
+ left: "left-0 right-auto",
14
+ right: "right-0 left-auto",
15
15
  },
16
16
  openDirectionY: {
17
17
  top: "bottom-full mt-0",
@@ -1,66 +1,44 @@
1
- import useUI from "../composables/useUI.js";
2
- import { cva } from "../utils/utilUI.js";
3
1
  import { computed, watchEffect } from "vue";
4
2
  import { merge } from "lodash-es";
3
+ import useUI from "../composables/useUI.js";
5
4
 
6
5
  import defaultConfig from "./config.js";
7
6
  import { POSITION } from "../composables/useAutoPosition.js";
8
7
 
9
8
  export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
10
- const { config, getAttrs, isSystemKey, hasSlotContent, isCVA } = useUI(
9
+ const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
11
10
  defaultConfig,
12
11
  () => props.config,
13
12
  );
14
- const attrs = {};
15
-
16
- for (const key in defaultConfig) {
17
- if (isSystemKey(key)) continue;
18
-
19
- const classes = computed(() => {
20
- let value = config.value[key];
21
13
 
22
- if (isCVA(value)) {
23
- value = cva(value)({
24
- ...props,
25
- openDirectionY: isTop.value ? POSITION.top : POSITION.bottom,
26
- openDirectionX: isRight.value ? POSITION.right : POSITION.left,
27
- error: Boolean(props.error),
28
- description: Boolean(props.description),
29
- });
30
- }
14
+ const mutatedProps = computed(() => ({
15
+ openDirectionY: isTop.value ? POSITION.top : POSITION.bottom,
16
+ openDirectionX: isRight.value ? POSITION.right : POSITION.left,
17
+ error: Boolean(props.error),
18
+ description: Boolean(props.description),
19
+ }));
31
20
 
32
- return value;
33
- });
21
+ const extendingKeys = ["inputFocused"];
22
+ const extendingKeysClasses = getExtendingKeysClasses(extendingKeys, mutatedProps);
34
23
 
35
- attrs[`${key}Attrs`] = getAttrs(key, { classes });
36
-
37
- if (key === "input") {
38
- const inputAttrs = attrs[`${key}Attrs`];
39
-
40
- attrs[`${key}Attrs`] = computed(() => ({
41
- ...inputAttrs.value,
42
- config: {
43
- ...inputAttrs.value.config,
44
- ...(isShownCalendar.value ? config.value.inputFocused : {}),
45
- },
46
- }));
47
- }
24
+ const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
25
+ input: {
26
+ extend: computed(() => [isShownCalendar.value && extendingKeysClasses.inputFocused.value]),
27
+ },
28
+ });
48
29
 
49
- if (key === "calendar") {
50
- /* Merging DatePicker's i18n translations into Calendar's i18n translations. */
51
- watchEffect(() => {
52
- const calendarConfig = attrs[`${key}Attrs`].value.config || {};
30
+ /* Merging DatePicker's i18n translations into Calendar's i18n translations. */
31
+ watchEffect(() => {
32
+ const calendarConfig = keysAttrs.calendarAttrs.value.config || {};
53
33
 
54
- if (!calendarConfig.i18n || props.config.i18n) {
55
- attrs[`${key}Attrs`].value.config.i18n = merge(calendarConfig.i18n, config.value.i18n);
56
- }
57
- });
34
+ if (!calendarConfig.i18n || props.config.i18n) {
35
+ keysAttrs.calendarAttrs.value.config.i18n = merge(calendarConfig.i18n, config.value.i18n);
58
36
  }
59
- }
37
+ });
60
38
 
61
39
  return {
62
- ...attrs,
63
40
  config,
41
+ ...keysAttrs,
64
42
  hasSlotContent,
65
43
  };
66
44
  }
@@ -98,7 +98,7 @@
98
98
  :is-period="isPeriod"
99
99
  :custom-range-button="customRangeButton"
100
100
  :locale="locale"
101
- :attrs="periodDatesMenuAttrs"
101
+ :attrs="keysAttrs"
102
102
  :date-format="dateFormat"
103
103
  :min-date="minDate"
104
104
  :max-date="maxDate"
@@ -120,7 +120,7 @@
120
120
  :locale="locale"
121
121
  :date-format="dateFormat"
122
122
  :config="config"
123
- :attrs="rangeInputsAttrs"
123
+ :attrs="keysAttrs"
124
124
  />
125
125
 
126
126
  <div v-if="inputRangeToError || inputRangeFromError" v-bind="inputRangeErrorAttrs">
@@ -403,6 +403,7 @@ const elementId = props.id || useId();
403
403
 
404
404
  const {
405
405
  config,
406
+ keysAttrs,
406
407
  wrapperAttrs,
407
408
  calendarAttrs,
408
409
  inputAttrs,
@@ -412,8 +413,6 @@ const {
412
413
  shiftRangeButtonAttrs,
413
414
  rangeInputWrapperAttrs,
414
415
  inputRangeErrorAttrs,
415
- periodDatesMenuAttrs,
416
- rangeInputsAttrs,
417
416
  } = useAttrs(props, { isShownMenu, isTop, isRight, isPeriod });
418
417
 
419
418
  const calendarValue = ref(props.modelValue);
@@ -5,7 +5,7 @@
5
5
  v-model="rangeStart"
6
6
  :error="inputRangeFromError"
7
7
  size="md"
8
- v-bind="attrs.rangeInputFirstAttrs"
8
+ v-bind="rangeInputFirstAttrs"
9
9
  :name="rangeInputName"
10
10
  @input="onInputRangeInput($event, INPUT_RANGE_TYPE.start)"
11
11
  />
@@ -15,7 +15,7 @@
15
15
  v-model="rangeEnd"
16
16
  :error="inputRangeToError"
17
17
  size="md"
18
- v-bind="attrs.rangeInputLastAttrs"
18
+ v-bind="rangeInputLastAttrs"
19
19
  :name="rangeInputName"
20
20
  @input="onInputRangeInput($event, INPUT_RANGE_TYPE.end)"
21
21
  />
@@ -58,6 +58,8 @@ const props = defineProps({
58
58
  },
59
59
  });
60
60
 
61
+ const { rangeInputFirstAttrs, rangeInputLastAttrs } = props.attrs;
62
+
61
63
  const localValue = defineModel("localValue", { required: true, type: Object });
62
64
  const inputRangeFromError = defineModel("inputRangeFromError", { required: true, type: String });
63
65
  const inputRangeToError = defineModel("inputRangeToError", { required: true, type: String });
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-bind="attrs.periodsRowAttrs">
2
+ <div v-bind="periodsRowAttrs">
3
3
  <template v-for="periodButton in periods" :key="periodButton.name">
4
4
  <UButton
5
5
  v-if="periodButton.name !== period"
@@ -9,7 +9,7 @@
9
9
  size="xs"
10
10
  variant="thirdary"
11
11
  :label="periodButton.title"
12
- v-bind="attrs.periodButtonAttrs"
12
+ v-bind="periodButtonAttrs"
13
13
  @click="onClickPeriodButton(periodButton.name)"
14
14
  />
15
15
 
@@ -21,13 +21,13 @@
21
21
  size="xs"
22
22
  variant="thirdary"
23
23
  :label="periodButton.title"
24
- v-bind="attrs.periodButtonActiveAttrs"
24
+ v-bind="periodButtonActiveAttrs"
25
25
  @click="onClickPeriodButton(periodButton.name)"
26
26
  />
27
27
  </template>
28
28
  </div>
29
29
 
30
- <div v-bind="attrs.periodsRowAttrs">
30
+ <div v-bind="periodsRowAttrs">
31
31
  <UButton
32
32
  v-if="customRangeButton.range.to && customRangeButton.range.from && PERIOD.custom !== period"
33
33
  square
@@ -35,13 +35,13 @@
35
35
  no-ring
36
36
  size="xs"
37
37
  variant="thirdary"
38
- v-bind="attrs.periodButtonAttrs"
38
+ v-bind="periodButtonAttrs"
39
39
  @click="onClickCustomRangeButton"
40
40
  >
41
41
  {{ customRangeButton.label }}
42
42
  <span
43
43
  v-if="customRangeButton.description"
44
- v-bind="attrs.customRangeDescription"
44
+ v-bind="customRangeDescription"
45
45
  v-text="customRangeButton.description"
46
46
  />
47
47
  </UButton>
@@ -53,13 +53,13 @@
53
53
  no-ring
54
54
  size="xs"
55
55
  variant="thirdary"
56
- v-bind="attrs.periodButtonActiveAttrs"
56
+ v-bind="periodButtonActiveAttrs"
57
57
  @click="onClickCustomRangeButton"
58
58
  >
59
59
  {{ customRangeButton.label }}
60
60
  <span
61
61
  v-if="customRangeButton.description"
62
- v-bind="attrs.customRangeDescription"
62
+ v-bind="customRangeDescription"
63
63
  v-text="customRangeButton.description"
64
64
  />
65
65
  </UButton>
@@ -73,7 +73,7 @@
73
73
  variant="thirdary"
74
74
  :label="locale.ownRange"
75
75
  :left-icon="config.defaults.ownRangeIcon"
76
- v-bind="attrs.periodButtonAttrs"
76
+ v-bind="periodButtonAttrs"
77
77
  @click="onClickOwnRange"
78
78
  />
79
79
 
@@ -86,13 +86,13 @@
86
86
  variant="thirdary"
87
87
  :label="locale.ownRange"
88
88
  :left-icon="config.defaults.ownRangeIcon"
89
- v-bind="attrs.periodButtonActiveAttrs"
89
+ v-bind="periodButtonActiveAttrs"
90
90
  @click="onClickOwnRange"
91
91
  />
92
92
  </div>
93
93
 
94
94
  <template v-if="!isPeriod.ownRange && !isPeriod.custom">
95
- <div v-bind="attrs.rangeSwitchWrapperAttrs">
95
+ <div v-bind="rangeSwitchWrapperAttrs">
96
96
  <UButton
97
97
  square
98
98
  no-ring
@@ -100,11 +100,11 @@
100
100
  color="gray"
101
101
  variant="thirdary"
102
102
  :left-icon="config.defaults.prevIcon"
103
- v-bind="attrs.rangeSwitchButtonAttrs"
103
+ v-bind="rangeSwitchButtonAttrs"
104
104
  @click="emit('clickPrev')"
105
105
  />
106
106
 
107
- <div v-bind="attrs.rangeSwitchTitleAttrs">
107
+ <div v-bind="rangeSwitchTitleAttrs">
108
108
  {{ rangeSwitchTitle }}
109
109
  </div>
110
110
 
@@ -115,12 +115,12 @@
115
115
  color="gray"
116
116
  variant="thirdary"
117
117
  :left-icon="config.defaults.nextIcon"
118
- v-bind="attrs.rangeSwitchButtonAttrs"
118
+ v-bind="rangeSwitchButtonAttrs"
119
119
  @click="emit('clickNext')"
120
120
  />
121
121
  </div>
122
122
 
123
- <div v-if="isDatePeriodOutOfRange" v-bind="attrs.periodDateListAttrs">
123
+ <div v-if="isDatePeriodOutOfRange" v-bind="periodDateListAttrs">
124
124
  <template v-for="(date, index) in periodDateList" :key="date.title">
125
125
  <UButton
126
126
  v-if="getDatePeriodState(date, index).isActive"
@@ -128,7 +128,7 @@
128
128
  size="sm"
129
129
  variant="thirdary"
130
130
  :disabled="isDatePeriodOutOfRange(date)"
131
- v-bind="attrs.periodDateActiveAttrs"
131
+ v-bind="periodDateActiveAttrs"
132
132
  :label="String(date.title)"
133
133
  :class="{ 'rounded-dynamic': getDatePeriodState(date, index).isSingleItem }"
134
134
  @click="selectDate(date), toggleMenu()"
@@ -140,7 +140,7 @@
140
140
  size="sm"
141
141
  variant="thirdary"
142
142
  :disabled="isDatePeriodOutOfRange(date)"
143
- v-bind="attrs.firstPeriodGridDateAttrs"
143
+ v-bind="firstPeriodGridDateAttrs"
144
144
  :label="String(date.title)"
145
145
  :class="{ 'rounded-dynamic': getDatePeriodState(date, index).isSingleItem }"
146
146
  @click="selectDate(date), toggleMenu()"
@@ -152,7 +152,7 @@
152
152
  size="sm"
153
153
  variant="thirdary"
154
154
  :disabled="isDatePeriodOutOfRange(date)"
155
- v-bind="attrs.firstPeriodListDateAttrs"
155
+ v-bind="firstPeriodListDateAttrs"
156
156
  :label="String(date.title)"
157
157
  :class="{ 'rounded-dynamic': getDatePeriodState(date, index).isSingleItem }"
158
158
  @click="selectDate(date), toggleMenu()"
@@ -164,7 +164,7 @@
164
164
  size="sm"
165
165
  variant="thirdary"
166
166
  :disabled="isDatePeriodOutOfRange(date)"
167
- v-bind="attrs.lastPeriodGridDateAttrs"
167
+ v-bind="lastPeriodGridDateAttrs"
168
168
  :label="String(date.title)"
169
169
  :class="{ 'rounded-dynamic': getDatePeriodState(date, index).isSingleItem }"
170
170
  @click="selectDate(date), toggleMenu()"
@@ -176,7 +176,7 @@
176
176
  size="sm"
177
177
  variant="thirdary"
178
178
  :disabled="isDatePeriodOutOfRange(date)"
179
- v-bind="attrs.lastPeriodListDateAttrs"
179
+ v-bind="lastPeriodListDateAttrs"
180
180
  :label="String(date.title)"
181
181
  :class="{ 'rounded-dynamic': getDatePeriodState(date, index).isSingleItem }"
182
182
  @click="selectDate(date), toggleMenu()"
@@ -188,7 +188,7 @@
188
188
  size="sm"
189
189
  variant="thirdary"
190
190
  :disabled="isDatePeriodOutOfRange(date)"
191
- v-bind="attrs.periodDateInRangeAttrs"
191
+ v-bind="periodDateInRangeAttrs"
192
192
  :label="String(date.title)"
193
193
  :class="{ 'rounded-dynamic': getDatePeriodState(date, index).isSingleItem }"
194
194
  @click="selectDate(date), toggleMenu()"
@@ -200,7 +200,7 @@
200
200
  size="sm"
201
201
  variant="thirdary"
202
202
  :disabled="isDatePeriodOutOfRange(date)"
203
- v-bind="attrs.periodDateAttrs"
203
+ v-bind="periodDateAttrs"
204
204
  :label="String(date.title)"
205
205
  @click="selectDate(date), toggleMenu()"
206
206
  />
@@ -274,6 +274,24 @@ const period = defineModel("period", { required: true, type: String });
274
274
 
275
275
  const isDatePeriodOutOfRange = inject("isDatePeriodOutOfRange", null);
276
276
 
277
+ const {
278
+ periodButtonAttrs,
279
+ periodsRowAttrs,
280
+ periodButtonActiveAttrs,
281
+ customRangeDescription,
282
+ rangeSwitchWrapperAttrs,
283
+ rangeSwitchButtonAttrs,
284
+ rangeSwitchTitleAttrs,
285
+ periodDateListAttrs,
286
+ periodDateActiveAttrs,
287
+ firstPeriodGridDateAttrs,
288
+ firstPeriodListDateAttrs,
289
+ lastPeriodGridDateAttrs,
290
+ lastPeriodListDateAttrs,
291
+ periodDateInRangeAttrs,
292
+ periodDateAttrs,
293
+ } = props.attrs;
294
+
277
295
  const periods = computed(() => [
278
296
  { name: PERIOD.week, title: props.locale.week },
279
297
  { name: PERIOD.month, title: props.locale.month },
@@ -19,11 +19,12 @@ export default /*tw*/ {
19
19
  `,
20
20
  variants: {
21
21
  openDirectionX: {
22
- left: "right-0",
23
- right: "left-0",
22
+ left: "left-0 right-auto",
23
+ right: "right-0 left-auto",
24
24
  },
25
25
  openDirectionY: {
26
26
  top: "bottom-full mt-0",
27
+ bottom: "top-full mb-0",
27
28
  },
28
29
  },
29
30
  compoundVariants: [
@@ -64,20 +65,25 @@ export default /*tw*/ {
64
65
  periodDateActive: "bg-gray-100",
65
66
  customRangeDescription: "",
66
67
  rangeInputWrapper: "flex mt-4 -space-x-px group/range-input-wrapper",
67
- rangeInputFirst: "group/range-input-first",
68
- rangeInputLast: "group/range-input-last",
69
- rangeInput: {
68
+ rangeInputFirst: {
70
69
  component: "{UInput}",
71
70
  label: {
72
71
  component: "{ULabel}",
73
72
  wrapper: "w-full hover:z-10 focus:z-10",
74
73
  description: "hidden",
75
74
  },
76
- block: `
77
- focus-within:z-10 focus-within:ring-0
78
- group-[]/range-input-first:rounded-r-none group-[]/range-input-last:rounded-l-none
79
- `,
80
- input: "group-[]/range-input-first:rounded-r-none group-[]/range-input-last:rounded-l-none",
75
+ block: "focus-within:z-10 focus-within:ring-0 rounded-r-none",
76
+ input: "rounded-r-none",
77
+ },
78
+ rangeInputLast: {
79
+ component: "{UInput}",
80
+ label: {
81
+ component: "{ULabel}",
82
+ wrapper: "w-full hover:z-10 focus:z-10",
83
+ description: "hidden",
84
+ },
85
+ block: "focus-within:z-10 focus-within:ring-0 rounded-l-none",
86
+ input: "rounded-l-none",
81
87
  },
82
88
  inputRangeError: "text-xs font-normal leading-none mt-2 text-center text-red-500",
83
89
  calendar: {