ropav 0.1.7 → 0.1.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/README.md +1 -1
- package/dist/ancestry.js +136 -0
- package/dist/calendar.css +173 -0
- package/dist/calendar.js +714 -0
- package/dist/calendar2.js +37 -0
- package/dist/chevron-left.js +12 -0
- package/dist/color-picker.js +38 -88
- package/dist/combobox.css +251 -0
- package/dist/combobox.js +410 -0
- package/dist/components/calendar/calendar.d.ts +30 -0
- package/dist/components/calendar/calendarBehavior.d.ts +49 -0
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.js +3 -0
- package/dist/components/calendar/types.d.ts +53 -0
- package/dist/components/calendar/useCalendar.d.ts +24 -0
- package/dist/components/color-picker/useColorPickerDrag.d.ts +1 -1
- package/dist/components/color-picker/useColorPickerSaturation.d.ts +1 -1
- package/dist/components/color-picker/useColorPickerSlider.d.ts +1 -1
- package/dist/components/combobox/combobox.d.ts +29 -0
- package/dist/components/combobox/comboboxModel.d.ts +4 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/combobox/types.d.ts +43 -0
- package/dist/components/combobox/useCombobox.d.ts +45 -0
- package/dist/components/date-picker/date-picker.d.ts +33 -0
- package/dist/components/date-picker/datePickerModel.d.ts +10 -0
- package/dist/components/date-picker/index.d.ts +4 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/date-picker/types.d.ts +57 -0
- package/dist/components/date-picker/useDatePicker.d.ts +29 -0
- package/dist/components/date-picker/useDatePickerValueState.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdownMenuContext.d.ts +7 -18
- package/dist/components/dropdown-menu/dropdownMenuInteraction.d.ts +3 -3
- package/dist/components/dropdown-menu/dropdownMenuInteractionTypes.d.ts +58 -29
- package/dist/components/dropdown-menu/useDropdownMenuDataController.d.ts +4 -3
- package/dist/components/dropdown-menu/useDropdownMenuDataRegistration.d.ts +6 -4
- package/dist/components/dropdown-menu/useDropdownMenuPresentation.d.ts +3 -4
- package/dist/components/dropdown-menu/useDropdownMenuTargetBindings.d.ts +5 -5
- package/dist/components/dropzone/dropzone.d.ts +31 -0
- package/dist/components/dropzone/dropzoneModel.d.ts +16 -0
- package/dist/components/dropzone/index.d.ts +3 -0
- package/dist/components/dropzone/index.js +2 -0
- package/dist/components/dropzone/types.d.ts +56 -0
- package/dist/components/dropzone/useDropzone.d.ts +25 -0
- package/dist/components/file-input/file-input.d.ts +29 -0
- package/dist/components/file-input/index.d.ts +3 -0
- package/dist/components/file-input/index.js +2 -0
- package/dist/components/file-input/types.d.ts +37 -0
- package/dist/components/file-input/useFileInput.d.ts +15 -0
- package/dist/components/floating/index.js +1 -1
- package/dist/components/floating/useFloatingPosition.d.ts +1 -13
- package/dist/components/floating/useFloatingTargetLifecycle.d.ts +32 -0
- package/dist/components/floating/useHoverDisclosure.d.ts +10 -0
- package/dist/components/hover-card/hover-card.d.ts +25 -0
- package/dist/components/hover-card/index.d.ts +3 -0
- package/dist/components/hover-card/index.js +2 -0
- package/dist/components/hover-card/types.d.ts +45 -0
- package/dist/components/hover-card/useHoverCard.d.ts +22 -0
- package/dist/components/hover-card/useHoverCardDisclosure.d.ts +19 -0
- package/dist/components/multi-select/index.d.ts +3 -0
- package/dist/components/multi-select/index.js +2 -0
- package/dist/components/multi-select/multi-select.d.ts +30 -0
- package/dist/components/multi-select/multiSelectModel.d.ts +3 -0
- package/dist/components/multi-select/types.d.ts +49 -0
- package/dist/components/multi-select/useMultiSelect.d.ts +46 -0
- package/dist/components/number-input/useNumberInput.d.ts +1 -3
- package/dist/components/popover/usePopoverBindings.d.ts +3 -6
- package/dist/components/scroll-area/useScrollArea.d.ts +4 -4
- package/dist/components/scroll-area/useScrollAreaAttributes.d.ts +3 -3
- package/dist/components/scroll-area/useScrollAreaPointer.d.ts +1 -1
- package/dist/components/segmented-control/index.d.ts +3 -0
- package/dist/components/segmented-control/index.js +2 -0
- package/dist/components/segmented-control/segmented-control.d.ts +26 -0
- package/dist/components/segmented-control/types.d.ts +47 -0
- package/dist/components/segmented-control/useSegmentedControl.d.ts +15 -0
- package/dist/components/select/useSelect.d.ts +31 -19
- package/dist/components/slider/useRangeSlider.d.ts +1 -1
- package/dist/components/slider/useRangeSliderPointer.d.ts +1 -1
- package/dist/components/tags-input/index.d.ts +3 -0
- package/dist/components/tags-input/index.js +2 -0
- package/dist/components/tags-input/tags-input.d.ts +27 -0
- package/dist/components/tags-input/tagsInputModel.d.ts +12 -0
- package/dist/components/tags-input/types.d.ts +37 -0
- package/dist/components/tags-input/useTagsInput.d.ts +23 -0
- package/dist/components/tooltip/useTooltipTargetBindings.d.ts +12 -0
- package/dist/date-picker.css +49 -0
- package/dist/date-picker.js +809 -0
- package/dist/dialog.js +9 -20
- package/dist/direction.js +6 -0
- package/dist/dropdown-menu.css +21 -3
- package/dist/dropdown-menu.js +341 -261
- package/dist/dropzone.css +135 -0
- package/dist/dropzone.js +431 -0
- package/dist/file-input.css +135 -0
- package/dist/file-input.js +198 -0
- package/dist/hover-card.css +80 -0
- package/dist/hover-card.js +402 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +14 -3
- package/dist/internal/composables/useOverlayLayer.d.ts +12 -0
- package/dist/modal.js +1 -1
- package/dist/multi-select.css +316 -0
- package/dist/multi-select.js +481 -0
- package/dist/nativeChoice.js +169 -0
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +36 -38
- package/dist/pagination.js +1 -10
- package/dist/pointerSession.js +130 -0
- package/dist/popover.css +21 -3
- package/dist/popover.js +37 -62
- package/dist/scroll-area.js +52 -62
- package/dist/segmented-control.css +176 -0
- package/dist/segmented-control.js +382 -0
- package/dist/select.css +50 -48
- package/dist/select.js +121 -271
- package/dist/slider.js +70 -129
- package/dist/tags-input.css +197 -0
- package/dist/tags-input.js +380 -0
- package/dist/tooltip.js +35 -30
- package/dist/useEditableOptionList.js +216 -0
- package/dist/useFlatOptionCollection.js +134 -0
- package/dist/useFloatingPosition.js +4 -160
- package/dist/useFloatingTargetLifecycle.js +127 -0
- package/dist/useFormControl.js +1 -0
- package/dist/{floating.js → useHoverDisclosure.js} +338 -421
- package/dist/useNativeChoiceTransaction.js +46 -0
- package/dist/useNativeFileSelection.js +86 -0
- package/dist/useOverlayZIndex.js +246 -15
- package/dist/utils/date.d.ts +13 -0
- package/dist/utils/dateAvailability.d.ts +7 -0
- package/dist/utils/dom/ancestry.d.ts +1 -0
- package/dist/utils/dom/direction.d.ts +2 -0
- package/dist/utils/dom/files.d.ts +3 -0
- package/dist/utils/dom/nativeChoice.d.ts +17 -0
- package/dist/utils/dom/pointerSession.d.ts +20 -0
- package/dist/utils/dom/scroll.d.ts +2 -1
- package/dist/utils/optionFilter.d.ts +5 -0
- package/docs/public-floating-api.md +7 -4
- package/docs/public-styles-api.md +25 -12
- package/package.json +39 -3
- package/src/styles/_mixins.scss +26 -0
- package/src/styles/styles-manifest.json +1 -2
- package/dist/components/floating/hoverDisclosureInteractionModel.d.ts +0 -42
- package/dist/components/floating/useHoverDisclosureInteractions.d.ts +0 -32
- package/dist/components/floating/useHoverDisclosureOpenState.d.ts +0 -25
- package/dist/components/floating/useHoverDisclosureTargetBinding.d.ts +0 -27
- package/dist/components/select/useSelectNativeControl.d.ts +0 -9
- package/dist/components/select/useSelectNativeValue.d.ts +0 -9
- package/dist/pointer.js +0 -9
- package/dist/utils/dom/pointer.d.ts +0 -2
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
import './date-picker.css';
|
|
2
|
+
import { t as useControllableValue } from "./useControllableValue.js";
|
|
3
|
+
import { t as useStylesApi } from "./styles-api.js";
|
|
4
|
+
import { n as toPresenceAttribute } from "./attributes.js";
|
|
5
|
+
import { t as bem } from "./bem.js";
|
|
6
|
+
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
|
|
7
|
+
import { t as x_default } from "./x.js";
|
|
8
|
+
import { a as parseDateKey, i as normalizeDate, n as isDateUnavailable, o as toLocalDate, r as isValidDate, t as calendar_default } from "./calendar.js";
|
|
9
|
+
import { i as useFormControl, n as provideNestedFormControlOwner } from "./useFormControl.js";
|
|
10
|
+
import { t as useControlState } from "./useControlState.js";
|
|
11
|
+
import { i as isNodeWithinElement } from "./events.js";
|
|
12
|
+
import { t as input_default } from "./input.js";
|
|
13
|
+
import { t as popover_default } from "./popover.js";
|
|
14
|
+
import { computed, createComponent, createIf, createSlot, createTemplateRefSetter, defineVaporComponent, extend, nextTick, on, ref, renderEffect, setDynamicProps, setInsertionState, shallowRef, template, unref, watch, withModifiers } from "vue";
|
|
15
|
+
//#region src/components/date-picker/datePickerModel.ts
|
|
16
|
+
var defaultDatePickerFormat = {
|
|
17
|
+
year: "numeric",
|
|
18
|
+
month: "2-digit",
|
|
19
|
+
day: "2-digit"
|
|
20
|
+
};
|
|
21
|
+
var timeZonePartsFormatters = /* @__PURE__ */ new Map();
|
|
22
|
+
var flexibleLiteralPattern = String.raw`(?:[\p{P}\p{Z}\s]+)`;
|
|
23
|
+
function formatDatePickerValue(value, locale, format = defaultDatePickerFormat) {
|
|
24
|
+
if (!value || !isValidDate(value)) return "";
|
|
25
|
+
return formatCivilDate(new Intl.DateTimeFormat(locale, format), value);
|
|
26
|
+
}
|
|
27
|
+
function escapeRegExp(value) {
|
|
28
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
29
|
+
}
|
|
30
|
+
function getDigitMap(locale, numberingSystem) {
|
|
31
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
32
|
+
numberingSystem,
|
|
33
|
+
useGrouping: false
|
|
34
|
+
});
|
|
35
|
+
return new Map(Array.from({ length: 10 }, (_, digit) => [formatter.format(digit).replace(/\p{Cf}/gu, ""), String(digit)]));
|
|
36
|
+
}
|
|
37
|
+
function normalizeLocalizedValue(value, digitMap) {
|
|
38
|
+
const normalized = value.normalize("NFKC").replace(/\p{Cf}/gu, "");
|
|
39
|
+
return Array.from(normalized, (character) => digitMap.get(character) ?? character).join("");
|
|
40
|
+
}
|
|
41
|
+
function normalizeLocalizedText(value, digitMap, locale) {
|
|
42
|
+
return normalizeLocalizedValue(value, digitMap).toLocaleLowerCase(locale);
|
|
43
|
+
}
|
|
44
|
+
function getTimeZonePartsFormatter(timeZone) {
|
|
45
|
+
const existing = timeZonePartsFormatters.get(timeZone);
|
|
46
|
+
if (existing) return existing;
|
|
47
|
+
const formatter = new Intl.DateTimeFormat("en-US-u-ca-gregory-nu-latn", {
|
|
48
|
+
timeZone,
|
|
49
|
+
year: "numeric",
|
|
50
|
+
month: "numeric",
|
|
51
|
+
day: "numeric",
|
|
52
|
+
hour: "numeric",
|
|
53
|
+
minute: "numeric",
|
|
54
|
+
second: "numeric",
|
|
55
|
+
hourCycle: "h23"
|
|
56
|
+
});
|
|
57
|
+
timeZonePartsFormatters.set(timeZone, formatter);
|
|
58
|
+
return formatter;
|
|
59
|
+
}
|
|
60
|
+
function getUtcTime(parts) {
|
|
61
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
62
|
+
date.setUTCHours(parts.hour, parts.minute, parts.second, 0);
|
|
63
|
+
date.setUTCFullYear(parts.year, parts.month - 1, parts.day);
|
|
64
|
+
return date.getTime();
|
|
65
|
+
}
|
|
66
|
+
function readDateTimeParts(formatter, value) {
|
|
67
|
+
const values = Object.fromEntries(formatter.formatToParts(value).filter((part) => part.type !== "literal").map((part) => [part.type, Number(part.value)]));
|
|
68
|
+
const parts = {
|
|
69
|
+
year: values.year,
|
|
70
|
+
month: values.month,
|
|
71
|
+
day: values.day,
|
|
72
|
+
hour: values.hour,
|
|
73
|
+
minute: values.minute,
|
|
74
|
+
second: values.second
|
|
75
|
+
};
|
|
76
|
+
return Object.values(parts).every(Number.isInteger) ? parts : null;
|
|
77
|
+
}
|
|
78
|
+
function createCivilDateInstant(value, timeZone) {
|
|
79
|
+
const targetTime = getUtcTime({
|
|
80
|
+
year: value.getFullYear(),
|
|
81
|
+
month: value.getMonth() + 1,
|
|
82
|
+
day: value.getDate(),
|
|
83
|
+
hour: 12,
|
|
84
|
+
minute: 0,
|
|
85
|
+
second: 0
|
|
86
|
+
});
|
|
87
|
+
const formatter = getTimeZonePartsFormatter(timeZone);
|
|
88
|
+
let candidateTime = targetTime;
|
|
89
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
90
|
+
const candidate = new Date(candidateTime);
|
|
91
|
+
const parts = readDateTimeParts(formatter, candidate);
|
|
92
|
+
if (!parts) return null;
|
|
93
|
+
const difference = getUtcTime(parts) - targetTime;
|
|
94
|
+
if (difference === 0) return candidate;
|
|
95
|
+
candidateTime -= difference;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function getCivilDateParts(formatter, value) {
|
|
100
|
+
const instant = createCivilDateInstant(value, formatter.resolvedOptions().timeZone);
|
|
101
|
+
return instant ? formatter.formatToParts(instant) : null;
|
|
102
|
+
}
|
|
103
|
+
function formatCivilDate(formatter, value) {
|
|
104
|
+
const instant = createCivilDateInstant(value, formatter.resolvedOptions().timeZone);
|
|
105
|
+
return instant ? formatter.format(instant) : "";
|
|
106
|
+
}
|
|
107
|
+
function getDatePartStyle(part, partValue, options) {
|
|
108
|
+
const configuredStyle = options[part];
|
|
109
|
+
if (part === "month" && configuredStyle && !["numeric", "2-digit"].includes(configuredStyle)) return "named";
|
|
110
|
+
if (configuredStyle === "2-digit") return "2-digit";
|
|
111
|
+
if (configuredStyle === "numeric") return "numeric";
|
|
112
|
+
if (!/^[0-9]+$/.test(partValue)) return part === "month" ? "named" : null;
|
|
113
|
+
return part === "year" && partValue.length === 2 ? "2-digit" : "numeric";
|
|
114
|
+
}
|
|
115
|
+
function getDatePartPattern(field) {
|
|
116
|
+
if (field.style === "named") return "(.+?)";
|
|
117
|
+
if (field.part === "day" || field.part === "month" || field.style === "2-digit") return "([0-9]{1,2})";
|
|
118
|
+
return "([0-9]+)";
|
|
119
|
+
}
|
|
120
|
+
function getLiteralPattern(value, digitMap, locale) {
|
|
121
|
+
const normalized = normalizeLocalizedText(value, digitMap, locale);
|
|
122
|
+
if (!normalized) return "";
|
|
123
|
+
return /^[\p{P}\p{Z}\s]+$/u.test(normalized) ? flexibleLiteralPattern : escapeRegExp(normalized);
|
|
124
|
+
}
|
|
125
|
+
function createDatePattern(formatter, digitMap) {
|
|
126
|
+
const fields = [];
|
|
127
|
+
const resolvedOptions = formatter.resolvedOptions();
|
|
128
|
+
const parts = getCivilDateParts(formatter, new Date(2001, 10, 22));
|
|
129
|
+
if (!parts) return null;
|
|
130
|
+
const patternParts = [];
|
|
131
|
+
for (const part of parts) {
|
|
132
|
+
if (part.type === "literal") {
|
|
133
|
+
patternParts.push(getLiteralPattern(part.value, digitMap, resolvedOptions.locale));
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (part.type === "weekday" || part.type === "era") {
|
|
137
|
+
patternParts.push("(?:.+?)");
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (part.type !== "day" && part.type !== "month" && part.type !== "year") return null;
|
|
141
|
+
if (fields.some((field) => field.part === part.type)) return null;
|
|
142
|
+
const normalizedPart = normalizeLocalizedValue(part.value, digitMap);
|
|
143
|
+
const style = getDatePartStyle(part.type, normalizedPart, resolvedOptions);
|
|
144
|
+
if (!style) return null;
|
|
145
|
+
const field = {
|
|
146
|
+
part: part.type,
|
|
147
|
+
style
|
|
148
|
+
};
|
|
149
|
+
fields.push(field);
|
|
150
|
+
patternParts.push(getDatePartPattern(field));
|
|
151
|
+
}
|
|
152
|
+
if (!fields.some((field) => field.part === "day") || !fields.some((field) => field.part === "month") || !fields.some((field) => field.part === "year")) return null;
|
|
153
|
+
return {
|
|
154
|
+
fields,
|
|
155
|
+
pattern: new RegExp(`^${patternParts.join("")}$`, "u")
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function getLocalizedMonthMap(formatter, digitMap) {
|
|
159
|
+
const months = /* @__PURE__ */ new Map();
|
|
160
|
+
const locale = formatter.resolvedOptions().locale;
|
|
161
|
+
for (let month = 0; month < 12; month += 1) {
|
|
162
|
+
const monthName = getCivilDateParts(formatter, new Date(2e3, month, 15))?.find((part) => part.type === "month")?.value;
|
|
163
|
+
if (!monthName) continue;
|
|
164
|
+
const normalized = normalizeLocalizedText(monthName, digitMap, locale);
|
|
165
|
+
months.set(normalized, months.has(normalized) ? null : month + 1);
|
|
166
|
+
}
|
|
167
|
+
return months;
|
|
168
|
+
}
|
|
169
|
+
function getCalendarYearOffset(calendar) {
|
|
170
|
+
if (calendar === "buddhist") return 543;
|
|
171
|
+
if (calendar === "gregory" || calendar === "iso8601") return 0;
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
function getGregorianYear(displayedYear, yearStyle, calendarYearOffset) {
|
|
175
|
+
if (yearStyle !== "2-digit") return displayedYear - calendarYearOffset;
|
|
176
|
+
return 2e3 + (displayedYear - calendarYearOffset % 100 + 100) % 100;
|
|
177
|
+
}
|
|
178
|
+
function getParsedDate(match, fields, formatter, digitMap) {
|
|
179
|
+
const values = Object.fromEntries(fields.map((field, index) => [field.part, match[index + 1]]));
|
|
180
|
+
const calendarYearOffset = getCalendarYearOffset(formatter.resolvedOptions().calendar);
|
|
181
|
+
if (calendarYearOffset === null) return null;
|
|
182
|
+
const yearField = fields.find((field) => field.part === "year");
|
|
183
|
+
const monthField = fields.find((field) => field.part === "month");
|
|
184
|
+
if (!yearField || !monthField) return null;
|
|
185
|
+
const displayedYear = Number(values.year);
|
|
186
|
+
const day = Number(values.day);
|
|
187
|
+
const month = monthField.style === "named" ? getLocalizedMonthMap(formatter, digitMap).get(values.month) ?? null : Number(values.month);
|
|
188
|
+
if (!Number.isInteger(displayedYear) || !Number.isInteger(day) || month === null || !Number.isInteger(month)) return null;
|
|
189
|
+
const year = getGregorianYear(displayedYear, yearField.style, calendarYearOffset);
|
|
190
|
+
const parsed = /* @__PURE__ */ new Date(0);
|
|
191
|
+
parsed.setHours(0, 0, 0, 0);
|
|
192
|
+
parsed.setFullYear(year, month - 1, day);
|
|
193
|
+
if (parsed.getFullYear() !== year || parsed.getMonth() !== month - 1 || parsed.getDate() !== day) return null;
|
|
194
|
+
return parsed;
|
|
195
|
+
}
|
|
196
|
+
function normalizeComparableValue(value, digitMap, locale) {
|
|
197
|
+
return normalizeLocalizedText(value, digitMap, locale).replace(/[0-9]+/g, (digits) => String(Number(digits))).replace(/[\p{P}\p{Z}\s]+/gu, " ").trim();
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Parses ISO date keys or supported locale values produced by `formatDatePickerValue`.
|
|
201
|
+
*
|
|
202
|
+
* Locale parsing supports Gregorian, ISO 8601, and Buddhist date-only formats.
|
|
203
|
+
* Two-digit years resolve to the corresponding Gregorian year from 2000 through 2099.
|
|
204
|
+
*/
|
|
205
|
+
function parseDatePickerValue(value, locale, format = defaultDatePickerFormat) {
|
|
206
|
+
const normalized = value.trim();
|
|
207
|
+
if (!normalized) return null;
|
|
208
|
+
const isoDate = parseDateKey(normalized);
|
|
209
|
+
if (isoDate) return isoDate;
|
|
210
|
+
const formatter = new Intl.DateTimeFormat(locale, format);
|
|
211
|
+
const resolvedOptions = formatter.resolvedOptions();
|
|
212
|
+
if (getCalendarYearOffset(resolvedOptions.calendar) === null) return null;
|
|
213
|
+
const digitMap = getDigitMap(locale, resolvedOptions.numberingSystem);
|
|
214
|
+
const localizedValue = normalizeLocalizedText(normalized, digitMap, resolvedOptions.locale);
|
|
215
|
+
const datePattern = createDatePattern(formatter, digitMap);
|
|
216
|
+
if (!datePattern) return null;
|
|
217
|
+
const match = datePattern.pattern.exec(localizedValue);
|
|
218
|
+
if (!match) return null;
|
|
219
|
+
const parsed = getParsedDate(match, datePattern.fields, formatter, digitMap);
|
|
220
|
+
if (!parsed) return null;
|
|
221
|
+
return normalizeComparableValue(formatCivilDate(formatter, parsed), digitMap, resolvedOptions.locale) === normalizeComparableValue(localizedValue, digitMap, resolvedOptions.locale) ? parsed : null;
|
|
222
|
+
}
|
|
223
|
+
function normalizeDatePickerValue(value) {
|
|
224
|
+
return normalizeDate(value);
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/components/date-picker/useDatePickerValueState.ts
|
|
228
|
+
function useDatePickerValueState(options) {
|
|
229
|
+
const { props } = options;
|
|
230
|
+
const control = useControlState(props);
|
|
231
|
+
const initialValue = normalizeDatePickerValue(props.defaultValue);
|
|
232
|
+
const controllable = useControllableValue({
|
|
233
|
+
modelValue: () => props.modelValue,
|
|
234
|
+
defaultValue: () => initialValue,
|
|
235
|
+
onChange(value) {
|
|
236
|
+
options.onChange(normalizeDate(value));
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const selectedDate = computed(() => normalizeDatePickerValue(controllable.value.value));
|
|
240
|
+
const inputValue = shallowRef(formatValue(selectedDate.value));
|
|
241
|
+
const hasInvalidInput = shallowRef(false);
|
|
242
|
+
const isInputEditable = computed(() => Boolean(props.allowInput) && !control.disabled && !props.readonly);
|
|
243
|
+
const isInvalid = computed(() => control.invalid || hasInvalidInput.value);
|
|
244
|
+
const validationMessage = computed(() => {
|
|
245
|
+
if (props.validationMessage !== void 0) return props.validationMessage;
|
|
246
|
+
return hasInvalidInput.value ? props.invalidDateMessage : void 0;
|
|
247
|
+
});
|
|
248
|
+
const canClear = computed(() => Boolean(props.clearable && selectedDate.value) && !control.disabled && !props.readonly);
|
|
249
|
+
function formatValue(value) {
|
|
250
|
+
if (!value) return "";
|
|
251
|
+
return props.formatDate?.(toLocalDate(value)) ?? formatDatePickerValue(value, props.locale, props.dateFormat ?? defaultDatePickerFormat);
|
|
252
|
+
}
|
|
253
|
+
function parseValue(value) {
|
|
254
|
+
return normalizeDate(props.parseDate ? props.parseDate(value) : parseDatePickerValue(value, props.locale, props.dateFormat ?? defaultDatePickerFormat));
|
|
255
|
+
}
|
|
256
|
+
function isUnavailable(date) {
|
|
257
|
+
return isDateUnavailable(date, {
|
|
258
|
+
min: props.min,
|
|
259
|
+
max: props.max,
|
|
260
|
+
disabledDates: props.disabledDates
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function reconcileControlledInput() {
|
|
264
|
+
if (!controllable.isControlled.value) return false;
|
|
265
|
+
nextTick(() => {
|
|
266
|
+
inputValue.value = formatValue(selectedDate.value);
|
|
267
|
+
});
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
function setSelectedDate(value) {
|
|
271
|
+
const normalized = normalizeDate(value);
|
|
272
|
+
controllable.setValue(normalized);
|
|
273
|
+
if (!reconcileControlledInput()) inputValue.value = formatValue(normalized);
|
|
274
|
+
hasInvalidInput.value = false;
|
|
275
|
+
}
|
|
276
|
+
function updateInput(value) {
|
|
277
|
+
if (!isInputEditable.value) return;
|
|
278
|
+
inputValue.value = value;
|
|
279
|
+
if (!value.trim()) {
|
|
280
|
+
setSelectedDate(null);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const parsed = parseValue(value);
|
|
284
|
+
hasInvalidInput.value = !parsed || isUnavailable(parsed);
|
|
285
|
+
if (!hasInvalidInput.value && parsed) {
|
|
286
|
+
controllable.setValue(parsed);
|
|
287
|
+
reconcileControlledInput();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function blurInput() {
|
|
291
|
+
if (!props.allowInput || !inputValue.value.trim()) return;
|
|
292
|
+
if (inputValue.value === formatValue(selectedDate.value)) {
|
|
293
|
+
hasInvalidInput.value = false;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const parsed = parseValue(inputValue.value);
|
|
297
|
+
hasInvalidInput.value = !parsed || isUnavailable(parsed);
|
|
298
|
+
if (!hasInvalidInput.value && parsed) inputValue.value = formatValue(parsed);
|
|
299
|
+
}
|
|
300
|
+
function selectDate(value) {
|
|
301
|
+
if (control.disabled || props.readonly) return false;
|
|
302
|
+
setSelectedDate(value);
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
function clear() {
|
|
306
|
+
if (!canClear.value) return false;
|
|
307
|
+
setSelectedDate(null);
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
function resetValue() {
|
|
311
|
+
controllable.resetValue(initialValue);
|
|
312
|
+
inputValue.value = formatValue(initialValue);
|
|
313
|
+
hasInvalidInput.value = false;
|
|
314
|
+
}
|
|
315
|
+
watch([
|
|
316
|
+
() => selectedDate.value?.getTime(),
|
|
317
|
+
() => props.locale,
|
|
318
|
+
() => props.dateFormat,
|
|
319
|
+
() => props.formatDate
|
|
320
|
+
], () => {
|
|
321
|
+
inputValue.value = formatValue(selectedDate.value);
|
|
322
|
+
hasInvalidInput.value = false;
|
|
323
|
+
}, { flush: "sync" });
|
|
324
|
+
useFormControl({
|
|
325
|
+
elements: () => [options.getInput()],
|
|
326
|
+
isControlled: () => controllable.isControlled.value,
|
|
327
|
+
initializeDefault(element) {
|
|
328
|
+
element.defaultValue = formatValue(initialValue);
|
|
329
|
+
},
|
|
330
|
+
validationMessage: () => validationMessage.value,
|
|
331
|
+
readResetValue: resetValue,
|
|
332
|
+
syncControlledValue([element]) {
|
|
333
|
+
element.value = inputValue.value;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return {
|
|
337
|
+
control,
|
|
338
|
+
selectedDate,
|
|
339
|
+
inputValue,
|
|
340
|
+
isInputEditable,
|
|
341
|
+
isInvalid,
|
|
342
|
+
validationMessage,
|
|
343
|
+
canClear,
|
|
344
|
+
updateInput,
|
|
345
|
+
blurInput,
|
|
346
|
+
selectDate,
|
|
347
|
+
clear
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/components/date-picker/useDatePicker.ts
|
|
352
|
+
function useDatePicker(props, emit, elements) {
|
|
353
|
+
const valueState = useDatePickerValueState({
|
|
354
|
+
props,
|
|
355
|
+
getInput: elements.getInput,
|
|
356
|
+
onChange(value) {
|
|
357
|
+
emit.value(value);
|
|
358
|
+
emit.change(value);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
const { control, selectedDate, inputValue, isInputEditable, isInvalid, validationMessage: effectiveValidationMessage, canClear, updateInput: onInputUpdate, blurInput: onInputBlur } = valueState;
|
|
362
|
+
const rootClass = computed(() => bem("rp-date-picker", {
|
|
363
|
+
[`size-${props.size}`]: Boolean(props.size),
|
|
364
|
+
[`radius-${props.radius}`]: Boolean(props.radius),
|
|
365
|
+
disabled: control.disabled,
|
|
366
|
+
readonly: props.readonly,
|
|
367
|
+
invalid: isInvalid.value,
|
|
368
|
+
valid: control.valid && !isInvalid.value
|
|
369
|
+
}));
|
|
370
|
+
let openPicker;
|
|
371
|
+
let closePicker;
|
|
372
|
+
let suppressFocusOpen = false;
|
|
373
|
+
let pointerDownStartedFocused;
|
|
374
|
+
function getInputTriggerAttrs(slotProps) {
|
|
375
|
+
const popover = slotProps;
|
|
376
|
+
const trigger = popover.triggerProps;
|
|
377
|
+
const attrs = props.inputAttrs ?? {};
|
|
378
|
+
if (!trigger["aria-haspopup"]) return attrs;
|
|
379
|
+
openPicker = popover.open;
|
|
380
|
+
closePicker = popover.close;
|
|
381
|
+
return {
|
|
382
|
+
...attrs,
|
|
383
|
+
role: "combobox",
|
|
384
|
+
"aria-autocomplete": "none",
|
|
385
|
+
"aria-controls": trigger["aria-controls"],
|
|
386
|
+
"aria-expanded": trigger["aria-expanded"],
|
|
387
|
+
"aria-haspopup": trigger["aria-haspopup"],
|
|
388
|
+
"aria-readonly": isInputEditable.value ? attrs["aria-readonly"] : true,
|
|
389
|
+
autocomplete: attrs.autocomplete ?? "off",
|
|
390
|
+
inputmode: isInputEditable.value ? attrs.inputmode : "none",
|
|
391
|
+
onBeforeinput(event) {
|
|
392
|
+
if (!isInputEditable.value) event.preventDefault();
|
|
393
|
+
attrs.onBeforeinput?.(event);
|
|
394
|
+
},
|
|
395
|
+
onInput(event) {
|
|
396
|
+
if (!isInputEditable.value && event.currentTarget instanceof HTMLInputElement) event.currentTarget.value = inputValue.value;
|
|
397
|
+
attrs.onInput?.(event);
|
|
398
|
+
},
|
|
399
|
+
onPointerdown(event) {
|
|
400
|
+
pointerDownStartedFocused = event.currentTarget instanceof HTMLElement && event.currentTarget.ownerDocument.activeElement === event.currentTarget;
|
|
401
|
+
attrs.onPointerdown?.(event);
|
|
402
|
+
},
|
|
403
|
+
onFocusin(event) {
|
|
404
|
+
if (!suppressFocusOpen) popover.open();
|
|
405
|
+
attrs.onFocusin?.(event);
|
|
406
|
+
},
|
|
407
|
+
onClick(event) {
|
|
408
|
+
if (pointerDownStartedFocused !== false) popover.open();
|
|
409
|
+
pointerDownStartedFocused = void 0;
|
|
410
|
+
attrs.onClick?.(event);
|
|
411
|
+
},
|
|
412
|
+
onBlur(event) {
|
|
413
|
+
pointerDownStartedFocused = void 0;
|
|
414
|
+
onInputBlur();
|
|
415
|
+
attrs.onBlur?.(event);
|
|
416
|
+
},
|
|
417
|
+
onKeydown(event) {
|
|
418
|
+
if (event.key === "ArrowDown") {
|
|
419
|
+
event.preventDefault();
|
|
420
|
+
popover.open();
|
|
421
|
+
nextTick(elements.focusCalendar);
|
|
422
|
+
} else if (event.key === "Escape") trigger.onKeydown(event);
|
|
423
|
+
attrs.onKeydown?.(event);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function focusInput() {
|
|
428
|
+
elements.getInput()?.focus({ preventScroll: true });
|
|
429
|
+
}
|
|
430
|
+
function focusInputWithoutOpening() {
|
|
431
|
+
suppressFocusOpen = true;
|
|
432
|
+
try {
|
|
433
|
+
focusInput();
|
|
434
|
+
} finally {
|
|
435
|
+
suppressFocusOpen = false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function onCalendarKeydown(event) {
|
|
439
|
+
if (event.key !== "Escape") return;
|
|
440
|
+
event.stopPropagation();
|
|
441
|
+
focusInputWithoutOpening();
|
|
442
|
+
closePicker?.();
|
|
443
|
+
}
|
|
444
|
+
function onFocusOut(event) {
|
|
445
|
+
if (isNodeWithinElement(event.relatedTarget, event.currentTarget)) return;
|
|
446
|
+
closePicker?.();
|
|
447
|
+
}
|
|
448
|
+
function selectCalendarDate(value) {
|
|
449
|
+
if (!valueState.selectDate(value)) return;
|
|
450
|
+
if (props.closeOnSelect === false) return;
|
|
451
|
+
focusInputWithoutOpening();
|
|
452
|
+
closePicker?.();
|
|
453
|
+
}
|
|
454
|
+
function clearFromControl(event) {
|
|
455
|
+
const clearButton = event.currentTarget;
|
|
456
|
+
const shouldRestoreFocus = clearButton instanceof HTMLElement && clearButton.ownerDocument.activeElement === clearButton;
|
|
457
|
+
valueState.clear();
|
|
458
|
+
if (shouldRestoreFocus) focusInputWithoutOpening();
|
|
459
|
+
}
|
|
460
|
+
function openDatePicker() {
|
|
461
|
+
focusInputWithoutOpening();
|
|
462
|
+
openPicker?.();
|
|
463
|
+
}
|
|
464
|
+
function onOpenUpdate(open) {
|
|
465
|
+
emit.open(open);
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
control,
|
|
469
|
+
selectedDate,
|
|
470
|
+
inputValue,
|
|
471
|
+
isInvalid,
|
|
472
|
+
effectiveValidationMessage,
|
|
473
|
+
rootClass,
|
|
474
|
+
canClear,
|
|
475
|
+
getInputTriggerAttrs,
|
|
476
|
+
onInputUpdate,
|
|
477
|
+
onCalendarKeydown,
|
|
478
|
+
onFocusOut,
|
|
479
|
+
clearFromControl,
|
|
480
|
+
selectCalendarDate,
|
|
481
|
+
openDatePicker,
|
|
482
|
+
onOpenUpdate
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/components/date-picker/date-picker.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
487
|
+
var t0 = template("<button data-v-c39b1387></button>");
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/components/date-picker/date-picker.vue
|
|
490
|
+
var date_picker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
491
|
+
name: "RpDatePicker",
|
|
492
|
+
inheritAttrs: false,
|
|
493
|
+
__name: "date-picker",
|
|
494
|
+
props: {
|
|
495
|
+
id: {},
|
|
496
|
+
name: {},
|
|
497
|
+
form: {},
|
|
498
|
+
modelValue: { default: void 0 },
|
|
499
|
+
defaultValue: { default: null },
|
|
500
|
+
defaultMonth: {},
|
|
501
|
+
open: {
|
|
502
|
+
type: Boolean,
|
|
503
|
+
default: void 0
|
|
504
|
+
},
|
|
505
|
+
locale: { default: void 0 },
|
|
506
|
+
dateFormat: { default: () => ({ ...defaultDatePickerFormat }) },
|
|
507
|
+
formatDate: {
|
|
508
|
+
type: Function,
|
|
509
|
+
default: void 0
|
|
510
|
+
},
|
|
511
|
+
parseDate: {
|
|
512
|
+
type: Function,
|
|
513
|
+
default: void 0
|
|
514
|
+
},
|
|
515
|
+
firstDayOfWeek: { default: 0 },
|
|
516
|
+
weekdayFormat: { default: "short" },
|
|
517
|
+
min: {},
|
|
518
|
+
max: {},
|
|
519
|
+
disabledDates: {},
|
|
520
|
+
fixedWeeks: {
|
|
521
|
+
type: Boolean,
|
|
522
|
+
default: true
|
|
523
|
+
},
|
|
524
|
+
hideOutsideDates: {
|
|
525
|
+
type: Boolean,
|
|
526
|
+
default: false
|
|
527
|
+
},
|
|
528
|
+
allowInput: {
|
|
529
|
+
type: Boolean,
|
|
530
|
+
default: false
|
|
531
|
+
},
|
|
532
|
+
clearable: {
|
|
533
|
+
type: Boolean,
|
|
534
|
+
default: true
|
|
535
|
+
},
|
|
536
|
+
closeOnSelect: {
|
|
537
|
+
type: Boolean,
|
|
538
|
+
default: true
|
|
539
|
+
},
|
|
540
|
+
disabled: {
|
|
541
|
+
type: Boolean,
|
|
542
|
+
default: void 0
|
|
543
|
+
},
|
|
544
|
+
readonly: {
|
|
545
|
+
type: Boolean,
|
|
546
|
+
default: false
|
|
547
|
+
},
|
|
548
|
+
required: {
|
|
549
|
+
type: Boolean,
|
|
550
|
+
default: void 0
|
|
551
|
+
},
|
|
552
|
+
invalid: {
|
|
553
|
+
type: Boolean,
|
|
554
|
+
default: void 0
|
|
555
|
+
},
|
|
556
|
+
valid: {
|
|
557
|
+
type: Boolean,
|
|
558
|
+
default: void 0
|
|
559
|
+
},
|
|
560
|
+
size: {},
|
|
561
|
+
radius: {},
|
|
562
|
+
calendarSize: { default: void 0 },
|
|
563
|
+
calendarRadius: { default: void 0 },
|
|
564
|
+
placeholder: { default: "Select date" },
|
|
565
|
+
ariaLabel: {},
|
|
566
|
+
describedby: {},
|
|
567
|
+
labelledby: {},
|
|
568
|
+
inputAttrs: {},
|
|
569
|
+
validationMessage: { default: void 0 },
|
|
570
|
+
invalidDateMessage: { default: "Enter a valid date." },
|
|
571
|
+
clearLabel: { default: "Clear date" },
|
|
572
|
+
toggleLabel: { default: "Open calendar" },
|
|
573
|
+
calendarAriaLabel: { default: "Choose a date" },
|
|
574
|
+
previousLabel: { default: "Previous month" },
|
|
575
|
+
nextLabel: { default: "Next month" },
|
|
576
|
+
placement: { default: "bottom-start" },
|
|
577
|
+
keepMounted: {
|
|
578
|
+
type: Boolean,
|
|
579
|
+
default: false
|
|
580
|
+
},
|
|
581
|
+
popoverId: {},
|
|
582
|
+
classNames: {},
|
|
583
|
+
styles: {}
|
|
584
|
+
},
|
|
585
|
+
emits: [
|
|
586
|
+
"update:modelValue",
|
|
587
|
+
"update:open",
|
|
588
|
+
"change"
|
|
589
|
+
],
|
|
590
|
+
setup(__props, { expose: __expose, emit: __emit, slots: $slots }) {
|
|
591
|
+
const props = __props;
|
|
592
|
+
const emit = __emit;
|
|
593
|
+
provideNestedFormControlOwner();
|
|
594
|
+
const inputComponentRef = ref(null);
|
|
595
|
+
const calendarComponentRef = ref(null);
|
|
596
|
+
const { control, selectedDate, inputValue, isInvalid, effectiveValidationMessage, rootClass, canClear, getInputTriggerAttrs, onInputUpdate, onCalendarKeydown, onFocusOut, clearFromControl, selectCalendarDate, openDatePicker, onOpenUpdate } = useDatePicker(props, {
|
|
597
|
+
value: (value) => emit("update:modelValue", value),
|
|
598
|
+
change: (value) => emit("change", value),
|
|
599
|
+
open: (open) => emit("update:open", open)
|
|
600
|
+
}, {
|
|
601
|
+
getInput: () => inputComponentRef.value?.nativeElement ?? null,
|
|
602
|
+
focusCalendar: () => calendarComponentRef.value?.focus()
|
|
603
|
+
});
|
|
604
|
+
const popoverDisabled = computed(() => control.disabled || props.readonly);
|
|
605
|
+
const { getPartAttrs, getRootAttrs } = useStylesApi(props, "root");
|
|
606
|
+
const rootAttrs = computed(() => getRootAttrs({
|
|
607
|
+
"data-disabled": toPresenceAttribute(control.disabled),
|
|
608
|
+
"data-readonly": toPresenceAttribute(props.readonly),
|
|
609
|
+
"data-invalid": toPresenceAttribute(isInvalid.value),
|
|
610
|
+
onFocusout: onFocusOut
|
|
611
|
+
}));
|
|
612
|
+
const popoverClassNames = computed(() => ({
|
|
613
|
+
root: rootClass.value,
|
|
614
|
+
content: props.classNames?.content
|
|
615
|
+
}));
|
|
616
|
+
const popoverStyles = computed(() => ({ content: props.styles?.content }));
|
|
617
|
+
const inputClassNames = computed(() => ({
|
|
618
|
+
root: props.classNames?.control,
|
|
619
|
+
input: props.classNames?.input
|
|
620
|
+
}));
|
|
621
|
+
const inputStyles = computed(() => ({
|
|
622
|
+
root: props.styles?.control,
|
|
623
|
+
input: props.styles?.input
|
|
624
|
+
}));
|
|
625
|
+
const calendarClassNames = computed(() => ({
|
|
626
|
+
root: props.classNames?.calendar,
|
|
627
|
+
header: props.classNames?.calendarHeader,
|
|
628
|
+
previousControl: props.classNames?.calendarControl,
|
|
629
|
+
nextControl: props.classNames?.calendarControl,
|
|
630
|
+
monthLabel: props.classNames?.calendarMonthLabel,
|
|
631
|
+
weekdays: props.classNames?.calendarWeekdays,
|
|
632
|
+
weekday: props.classNames?.calendarWeekday,
|
|
633
|
+
grid: props.classNames?.calendarGrid,
|
|
634
|
+
week: props.classNames?.calendarWeek,
|
|
635
|
+
dayCell: props.classNames?.calendarDayCell,
|
|
636
|
+
day: props.classNames?.calendarDay
|
|
637
|
+
}));
|
|
638
|
+
const calendarStyles = computed(() => ({
|
|
639
|
+
root: props.styles?.calendar,
|
|
640
|
+
header: props.styles?.calendarHeader,
|
|
641
|
+
previousControl: props.styles?.calendarControl,
|
|
642
|
+
nextControl: props.styles?.calendarControl,
|
|
643
|
+
monthLabel: props.styles?.calendarMonthLabel,
|
|
644
|
+
weekdays: props.styles?.calendarWeekdays,
|
|
645
|
+
weekday: props.styles?.calendarWeekday,
|
|
646
|
+
grid: props.styles?.calendarGrid,
|
|
647
|
+
week: props.styles?.calendarWeek,
|
|
648
|
+
dayCell: props.styles?.calendarDayCell,
|
|
649
|
+
day: props.styles?.calendarDay
|
|
650
|
+
}));
|
|
651
|
+
function getIndicatorAttrs(slotProps) {
|
|
652
|
+
const popover = slotProps;
|
|
653
|
+
return {
|
|
654
|
+
...getPartAttrs("indicator", { class: "rp-date-picker__indicator" }),
|
|
655
|
+
"aria-controls": popover.triggerProps["aria-controls"]
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
__expose({
|
|
659
|
+
nativeElement: computed(() => inputComponentRef.value?.nativeElement ?? null),
|
|
660
|
+
focus: () => inputComponentRef.value?.focus(),
|
|
661
|
+
open: openDatePicker
|
|
662
|
+
});
|
|
663
|
+
const _setTemplateRef = createTemplateRefSetter();
|
|
664
|
+
return createComponent(popover_default, { $: [() => rootAttrs.value, {
|
|
665
|
+
id: () => __props.popoverId,
|
|
666
|
+
"class-names": () => popoverClassNames.value,
|
|
667
|
+
styles: () => popoverStyles.value,
|
|
668
|
+
placement: () => __props.placement,
|
|
669
|
+
open: () => __props.open,
|
|
670
|
+
"keep-mounted": () => __props.keepMounted,
|
|
671
|
+
disabled: () => popoverDisabled.value,
|
|
672
|
+
"aria-label": () => __props.calendarAriaLabel,
|
|
673
|
+
"content-class": () => `rp-date-picker__popover rp-date-picker__popover--size-${__props.calendarSize ?? __props.size ?? "md"}`,
|
|
674
|
+
"onUpdate:open": () => unref(onOpenUpdate)
|
|
675
|
+
}] }, {
|
|
676
|
+
"default": (slotProps) => {
|
|
677
|
+
const n11 = createComponent(input_default, {
|
|
678
|
+
id: () => unref(control).id,
|
|
679
|
+
name: () => __props.name,
|
|
680
|
+
form: () => unref(control).form,
|
|
681
|
+
"model-value": () => unref(inputValue),
|
|
682
|
+
type: "text",
|
|
683
|
+
size: () => __props.size,
|
|
684
|
+
radius: () => __props.radius,
|
|
685
|
+
placeholder: () => __props.placeholder,
|
|
686
|
+
disabled: () => unref(control).disabled || void 0,
|
|
687
|
+
readonly: () => __props.readonly || void 0,
|
|
688
|
+
required: () => unref(control).required || void 0,
|
|
689
|
+
invalid: () => unref(isInvalid) || void 0,
|
|
690
|
+
valid: () => unref(control).valid && !unref(isInvalid) ? true : void 0,
|
|
691
|
+
"aria-label": () => __props.ariaLabel,
|
|
692
|
+
describedby: () => __props.describedby,
|
|
693
|
+
labelledby: () => __props.labelledby,
|
|
694
|
+
"input-attrs": () => unref(getInputTriggerAttrs)(slotProps),
|
|
695
|
+
"class-names": () => inputClassNames.value,
|
|
696
|
+
styles: () => inputStyles.value,
|
|
697
|
+
"validation-message": () => unref(effectiveValidationMessage),
|
|
698
|
+
"onUpdate:modelValue": () => unref(onInputUpdate)
|
|
699
|
+
}, { "right": extend(() => {
|
|
700
|
+
return [createIf(() => __props.clearable, () => {
|
|
701
|
+
const n5 = t0();
|
|
702
|
+
renderEffect(() => {
|
|
703
|
+
const _canClear = unref(canClear);
|
|
704
|
+
setDynamicProps(n5, [unref(getPartAttrs)("clear", { class: ["rp-date-picker__clear", { "rp-date-picker__clear--hidden": !_canClear }] }), {
|
|
705
|
+
type: "button",
|
|
706
|
+
"aria-label": __props.clearLabel,
|
|
707
|
+
"aria-hidden": !_canClear ? "true" : void 0,
|
|
708
|
+
disabled: !_canClear || void 0
|
|
709
|
+
}]);
|
|
710
|
+
});
|
|
711
|
+
setInsertionState(n5, null, 0);
|
|
712
|
+
createSlot("clear-icon", null, () => {
|
|
713
|
+
return createComponent(unref(x_default), { "aria-hidden": "true" });
|
|
714
|
+
}, 1);
|
|
715
|
+
on(n5, "mousedown", withModifiers(() => {}, ["prevent"]));
|
|
716
|
+
on(n5, "click", withModifiers((e) => unref(clearFromControl)(e), ["stop"]));
|
|
717
|
+
return n5;
|
|
718
|
+
}, null, 129), createIf(() => $slots["calendar-icon"], () => {
|
|
719
|
+
const n9 = t0();
|
|
720
|
+
renderEffect(() => {
|
|
721
|
+
const _slotProps = slotProps;
|
|
722
|
+
setDynamicProps(n9, [getIndicatorAttrs(_slotProps), {
|
|
723
|
+
type: "button",
|
|
724
|
+
disabled: popoverDisabled.value,
|
|
725
|
+
"aria-label": __props.toggleLabel,
|
|
726
|
+
"aria-expanded": _slotProps.isOpen,
|
|
727
|
+
"aria-haspopup": "dialog"
|
|
728
|
+
}]);
|
|
729
|
+
});
|
|
730
|
+
setInsertionState(n9, null, 0);
|
|
731
|
+
createSlot("calendar-icon", null, null, 1);
|
|
732
|
+
on(n9, "mousedown", withModifiers(() => {}, ["prevent"]));
|
|
733
|
+
on(n9, "click", withModifiers((e) => unref(openDatePicker)(e), ["stop"]));
|
|
734
|
+
return n9;
|
|
735
|
+
}, null, 129)];
|
|
736
|
+
}, { _: 8 }) });
|
|
737
|
+
_setTemplateRef(n11, inputComponentRef, null, "inputComponentRef");
|
|
738
|
+
return n11;
|
|
739
|
+
},
|
|
740
|
+
"content": () => {
|
|
741
|
+
const n19 = createComponent(calendar_default, {
|
|
742
|
+
"model-value": () => unref(selectedDate),
|
|
743
|
+
"default-month": () => __props.defaultMonth,
|
|
744
|
+
locale: () => __props.locale,
|
|
745
|
+
"first-day-of-week": () => __props.firstDayOfWeek,
|
|
746
|
+
"weekday-format": () => __props.weekdayFormat,
|
|
747
|
+
min: () => __props.min,
|
|
748
|
+
max: () => __props.max,
|
|
749
|
+
"disabled-dates": () => __props.disabledDates,
|
|
750
|
+
"fixed-weeks": () => __props.fixedWeeks,
|
|
751
|
+
"hide-outside-dates": () => __props.hideOutsideDates,
|
|
752
|
+
readonly: () => __props.readonly,
|
|
753
|
+
size: () => __props.calendarSize ?? __props.size,
|
|
754
|
+
radius: () => __props.calendarRadius ?? __props.radius,
|
|
755
|
+
"aria-label": () => __props.calendarAriaLabel,
|
|
756
|
+
"previous-label": () => __props.previousLabel,
|
|
757
|
+
"next-label": () => __props.nextLabel,
|
|
758
|
+
"class-names": () => calendarClassNames.value,
|
|
759
|
+
styles: () => calendarStyles.value,
|
|
760
|
+
onKeydown: () => unref(onCalendarKeydown),
|
|
761
|
+
"onUpdate:modelValue": () => unref(selectCalendarDate)
|
|
762
|
+
}, { $: [
|
|
763
|
+
() => $slots.day ? {
|
|
764
|
+
name: "day",
|
|
765
|
+
fn: (dayProps) => {
|
|
766
|
+
return createSlot("day", { $: [() => dayProps] }, null, 1);
|
|
767
|
+
}
|
|
768
|
+
} : void 0,
|
|
769
|
+
() => $slots["previous-icon"] ? {
|
|
770
|
+
name: "previous-icon",
|
|
771
|
+
fn: () => {
|
|
772
|
+
return createSlot("previous-icon", null, null, 1);
|
|
773
|
+
}
|
|
774
|
+
} : void 0,
|
|
775
|
+
() => $slots["next-icon"] ? {
|
|
776
|
+
name: "next-icon",
|
|
777
|
+
fn: () => {
|
|
778
|
+
return createSlot("next-icon", null, null, 1);
|
|
779
|
+
}
|
|
780
|
+
} : void 0
|
|
781
|
+
] });
|
|
782
|
+
_setTemplateRef(n19, calendarComponentRef, null, "calendarComponentRef");
|
|
783
|
+
return n19;
|
|
784
|
+
}
|
|
785
|
+
}, true);
|
|
786
|
+
}
|
|
787
|
+
}), [["__scopeId", "data-v-c39b1387"]]);
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region src/components/date-picker/types.ts
|
|
790
|
+
var datePickerParts = [
|
|
791
|
+
"root",
|
|
792
|
+
"control",
|
|
793
|
+
"input",
|
|
794
|
+
"clear",
|
|
795
|
+
"indicator",
|
|
796
|
+
"content",
|
|
797
|
+
"calendar",
|
|
798
|
+
"calendarHeader",
|
|
799
|
+
"calendarControl",
|
|
800
|
+
"calendarMonthLabel",
|
|
801
|
+
"calendarWeekdays",
|
|
802
|
+
"calendarWeekday",
|
|
803
|
+
"calendarGrid",
|
|
804
|
+
"calendarWeek",
|
|
805
|
+
"calendarDayCell",
|
|
806
|
+
"calendarDay"
|
|
807
|
+
];
|
|
808
|
+
//#endregion
|
|
809
|
+
export { normalizeDatePickerValue as a, formatDatePickerValue as i, date_picker_default as n, parseDatePickerValue as o, defaultDatePickerFormat as r, datePickerParts as t };
|