@witchcraft/ui 0.0.1 → 0.1.1
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 +18 -28
- package/dist/module.d.mts +3 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -12
- package/dist/runtime/assets/base.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -2
- package/dist/runtime/assets/tailwind.css +1 -1
- package/dist/runtime/assets/utils.css +1 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
- package/dist/runtime/components/Aria/Aria.vue +5 -9
- package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
- package/dist/runtime/components/Icon/Icon.vue +12 -28
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +93 -117
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +69 -106
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
- package/dist/runtime/components/Template/NAME.vue +15 -36
- package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
- package/dist/runtime/components/TestControls/TestControls.vue +7 -10
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/components/index.d.ts +12 -11
- package/dist/runtime/components/index.js +12 -11
- package/dist/runtime/components/shared/props.d.ts +81 -16
- package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
- package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
- package/dist/runtime/composables/index.d.ts +5 -0
- package/dist/runtime/composables/index.js +5 -0
- package/dist/runtime/composables/useDivideAttrs.js +1 -0
- package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
- package/dist/runtime/composables/useDragWithThreshold.js +40 -0
- package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
- package/dist/runtime/composables/usePreHydrationValue.js +15 -0
- package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
- package/dist/runtime/composables/useSetupI18n.js +5 -1
- package/dist/runtime/composables/useSuggestions.d.ts +7 -5
- package/dist/runtime/composables/useSuggestions.js +94 -57
- package/dist/runtime/directives/vResizableCols.js +92 -84
- package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
- package/dist/runtime/helpers/index.d.ts +3 -1
- package/dist/runtime/helpers/index.js +3 -1
- package/dist/runtime/types/index.d.ts +6 -0
- package/dist/runtime/utils/notifyIfError.d.ts +14 -0
- package/dist/runtime/utils/notifyIfError.js +29 -0
- package/dist/types.d.mts +2 -6
- package/package.json +27 -29
- package/src/module.ts +31 -12
- package/src/runtime/assets/base.css +10 -1
- package/src/runtime/assets/locales/en.json +2 -2
- package/src/runtime/assets/tailwind.css +1 -1
- package/src/runtime/assets/{style.css → utils.css} +86 -4
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +10 -6
- package/src/runtime/components/LibButton/LibButton.vue +41 -47
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
- package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
- package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
- package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
- package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
- package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
- package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
- package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
- package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
- package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
- package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
- package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
- package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
- package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
- package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
- package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
- package/src/runtime/components/LibTable/LibTable.vue +8 -9
- package/src/runtime/components/Scrolling.stories.ts +58 -0
- package/src/runtime/components/Template/NAME.vue +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +1 -1
- package/src/runtime/components/index.ts +12 -12
- package/src/runtime/components/shared/props.ts +82 -19
- package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
- package/src/runtime/composables/index.ts +5 -0
- package/src/runtime/composables/useDarkMode.ts +2 -2
- package/src/runtime/composables/useDivideAttrs.ts +1 -0
- package/src/runtime/composables/useDragWithThreshold.ts +108 -0
- package/src/runtime/composables/usePreHydrationValue.ts +30 -0
- package/src/runtime/composables/useSetupI18n.ts +8 -2
- package/src/runtime/composables/useSuggestions.ts +92 -45
- package/src/runtime/directives/vResizableCols.ts +82 -74
- package/src/runtime/helpers/NotificationHandler.ts +5 -0
- package/src/runtime/helpers/index.ts +3 -1
- package/src/runtime/types/index.ts +5 -0
- package/src/runtime/utils/notifyIfError.ts +45 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -34
- package/dist/runtime/assets/style.css +0 -1
- package/dist/runtime/components/Focus.stories.d.ts +0 -11
- package/dist/runtime/components/Focus.stories.js +0 -53
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
- package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
- package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
- package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
- package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
- package/dist/runtime/components/reset.stories.d.ts +0 -5
- package/dist/runtime/components/reset.stories.js +0 -19
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/runtime/helpers/addValue.d.ts +0 -1
- package/dist/runtime/helpers/addValue.js +0 -8
- package/dist/types.d.ts +0 -7
- package/src/runtime/components/LibInput/LibInput.vue +0 -372
- package/src/runtime/helpers/addValue.ts +0 -10
- /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
|
@@ -1,89 +1,82 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { CalendarDate, getLocalTimeZone, ZonedDateTime } from "@internationalized/date";
|
|
3
|
+
import { DateRangePickerArrow, DateRangePickerCalendar, DateRangePickerCell, DateRangePickerCellTrigger, DateRangePickerContent, DateRangePickerField, DateRangePickerGrid, DateRangePickerGridBody, DateRangePickerGridHead, DateRangePickerGridRow, DateRangePickerHeadCell, DateRangePickerHeader, DateRangePickerHeading, DateRangePickerInput, DateRangePickerNext, DateRangePickerPrev, DateRangePickerRoot, DateRangePickerTrigger } from "reka-ui";
|
|
4
|
+
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue";
|
|
5
|
+
import { convertDateWithFallback, getNow, toEmittableDate } from "./helpers.js";
|
|
6
|
+
import { useInjectedLocale } from "../../composables/useInjectedLocale.js";
|
|
7
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
8
|
+
import Icon from "../Icon/Icon.vue";
|
|
9
|
+
const attrs = useAttrs();
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
useTime: { type: Boolean, required: false, default: false },
|
|
12
|
+
id: { type: String, required: true },
|
|
13
|
+
fallbackDate: { type: Date, required: false, default: (_) => getNow({ withTime: _.useTime ?? false }).toDate(_.timeZone ?? getLocalTimeZone()) },
|
|
14
|
+
timeZone: { type: String, required: false, default: getLocalTimeZone() },
|
|
15
|
+
updateInterval: { type: Number, required: false, default: 1e4 }
|
|
16
|
+
});
|
|
17
|
+
const date = defineModel({ type: Object, ...{ required: true } });
|
|
18
|
+
let justSet = false;
|
|
19
|
+
const tempDate = ref({});
|
|
20
|
+
function updateTempDate(keys = ["start", "end"]) {
|
|
21
|
+
const newValue = { ...tempDate.value };
|
|
22
|
+
for (const key of keys) {
|
|
23
|
+
newValue[key] = convertDateWithFallback(date.value?.[key], props);
|
|
24
|
+
}
|
|
25
|
+
tempDate.value = newValue;
|
|
26
|
+
}
|
|
27
|
+
watch([() => date.value.start, () => date.value.end], () => {
|
|
28
|
+
if (!justSet) {
|
|
29
|
+
updateTempDate();
|
|
30
|
+
} else {
|
|
31
|
+
justSet = false;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
watch(tempDate, () => {
|
|
35
|
+
if (!tempDate.value.start || !tempDate.value.end) return;
|
|
36
|
+
justSet = true;
|
|
37
|
+
date.value = {
|
|
38
|
+
start: tempDate.value.start ? toEmittableDate(toRaw(tempDate.value.start)) : void 0,
|
|
39
|
+
end: tempDate.value.end ? toEmittableDate(toRaw(tempDate.value.end)) : void 0
|
|
40
|
+
};
|
|
41
|
+
});
|
|
35
42
|
watch(() => props.timeZone, () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end: convertDateWithFallback(date.value?.end, props)
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
43
|
+
updateTempDate();
|
|
44
|
+
});
|
|
42
45
|
const interval = setInterval(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (!date.value.end) {
|
|
48
|
-
// update suggested date if none is set
|
|
49
|
-
tempDate.value.end = convertDateWithFallback(date.value.end, props)
|
|
50
|
-
}
|
|
51
|
-
}, props.updateInterval)
|
|
52
|
-
|
|
46
|
+
if (!date.value.start) updateTempDate(["start"]);
|
|
47
|
+
if (!date.value.end) updateTempDate(["end"]);
|
|
48
|
+
}, props.updateInterval);
|
|
53
49
|
onBeforeUnmount(() => {
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const locale = useInjectedLocale().timeLocale
|
|
58
|
-
|
|
59
|
-
watch(tempDate, () => {
|
|
60
|
-
date.value = {
|
|
61
|
-
start: tempDate.value.start ? toEmittableDate(toRaw(tempDate.value.start) as any) : undefined,
|
|
62
|
-
end: tempDate.value.end ? toEmittableDate(toRaw(tempDate.value.end) as any) : undefined
|
|
63
|
-
}
|
|
64
|
-
})
|
|
50
|
+
clearInterval(interval);
|
|
51
|
+
});
|
|
52
|
+
const locale = useInjectedLocale().timeLocale;
|
|
65
53
|
</script>
|
|
66
54
|
|
|
67
55
|
<template>
|
|
68
56
|
<DateRangePickerRoot
|
|
69
57
|
:id="id"
|
|
70
58
|
:locale="locale"
|
|
71
|
-
class="root"
|
|
72
|
-
v-model="tempDate
|
|
59
|
+
class="date-range-picker--root"
|
|
60
|
+
v-model="tempDate"
|
|
73
61
|
>
|
|
74
62
|
<DateRangePickerField
|
|
75
63
|
v-slot="{ segments }"
|
|
76
64
|
:class="twMerge(`
|
|
77
|
-
|
|
65
|
+
date-range-picker--field
|
|
78
66
|
flex items-center justify-between
|
|
79
67
|
select-none
|
|
80
68
|
data-[invalid]:border-red-500
|
|
81
69
|
metadata-input-border
|
|
82
70
|
rounded-sm
|
|
83
|
-
`,
|
|
71
|
+
`, attrs.class)"
|
|
84
72
|
>
|
|
85
|
-
<div class="segments flex items-center flex-1 overflow-scroll scrollbar-hidden whitespace-nowrap">
|
|
86
|
-
<div :class="twMerge(`
|
|
73
|
+
<div class="date-range-picker--segments-input flex items-center flex-1 overflow-scroll scrollbar-hidden whitespace-nowrap">
|
|
74
|
+
<div :class="twMerge(`
|
|
75
|
+
date-range-picker--start-segment
|
|
76
|
+
flex
|
|
77
|
+
items-center
|
|
78
|
+
`, date.start === void 0 && 'text-neutral-400')"
|
|
79
|
+
>
|
|
87
80
|
<template
|
|
88
81
|
v-for="item in segments.start"
|
|
89
82
|
:key="item.part"
|
|
@@ -92,7 +85,7 @@ watch(tempDate, () => {
|
|
|
92
85
|
v-if="item.part === 'literal'"
|
|
93
86
|
:part="item.part"
|
|
94
87
|
type="start"
|
|
95
|
-
class="
|
|
88
|
+
class="date-range-picker--segment-literal"
|
|
96
89
|
>
|
|
97
90
|
{{ item.value }}
|
|
98
91
|
</DateRangePickerInput>
|
|
@@ -101,7 +94,7 @@ watch(tempDate, () => {
|
|
|
101
94
|
type="start"
|
|
102
95
|
:part="item.part"
|
|
103
96
|
class="
|
|
104
|
-
input
|
|
97
|
+
date-range-picker--segment-input
|
|
105
98
|
focus-outline-hidden
|
|
106
99
|
border
|
|
107
100
|
border-transparent
|
|
@@ -110,6 +103,7 @@ watch(tempDate, () => {
|
|
|
110
103
|
>
|
|
111
104
|
<div
|
|
112
105
|
class="
|
|
106
|
+
date-range-picker--segment-value
|
|
113
107
|
group-focus:z-[2]
|
|
114
108
|
group-focus:bg-accent-500/50
|
|
115
109
|
group-focus:rounded-xs
|
|
@@ -121,10 +115,15 @@ watch(tempDate, () => {
|
|
|
121
115
|
</DateRangePickerInput>
|
|
122
116
|
</template>
|
|
123
117
|
</div>
|
|
124
|
-
<div class="range-separator text-center px-1">
|
|
118
|
+
<div class="date-range-picker--range-separator text-center px-1">
|
|
125
119
|
–
|
|
126
120
|
</div>
|
|
127
|
-
<div :class="twMerge(`
|
|
121
|
+
<div :class="twMerge(`
|
|
122
|
+
date-range-picker--end-segment
|
|
123
|
+
flex
|
|
124
|
+
items-center
|
|
125
|
+
`, date.end === void 0 && 'text-neutral-400')"
|
|
126
|
+
>
|
|
128
127
|
<template
|
|
129
128
|
v-for="item in segments.end"
|
|
130
129
|
:key="item.part"
|
|
@@ -133,7 +132,7 @@ watch(tempDate, () => {
|
|
|
133
132
|
v-if="item.part === 'literal'"
|
|
134
133
|
:part="item.part"
|
|
135
134
|
type="end"
|
|
136
|
-
class="
|
|
135
|
+
class="date-range-picker--segment-literal"
|
|
137
136
|
>
|
|
138
137
|
{{ item.value }}
|
|
139
138
|
</DateRangePickerInput>
|
|
@@ -142,7 +141,7 @@ watch(tempDate, () => {
|
|
|
142
141
|
type="end"
|
|
143
142
|
:part="item.part"
|
|
144
143
|
class="
|
|
145
|
-
input
|
|
144
|
+
date-range-picker--segment-input
|
|
146
145
|
focus-outline-hidden
|
|
147
146
|
border
|
|
148
147
|
border-transparent
|
|
@@ -151,6 +150,7 @@ watch(tempDate, () => {
|
|
|
151
150
|
>
|
|
152
151
|
<div
|
|
153
152
|
class="
|
|
153
|
+
date-range-picker--segment-value
|
|
154
154
|
group-focus:z-[2]
|
|
155
155
|
group-focus:bg-accent-500/50
|
|
156
156
|
group-focus:rounded-xs
|
|
@@ -165,7 +165,7 @@ watch(tempDate, () => {
|
|
|
165
165
|
</div>
|
|
166
166
|
<DateRangePickerTrigger
|
|
167
167
|
class="
|
|
168
|
-
trigger
|
|
168
|
+
date-range-picker--trigger
|
|
169
169
|
px-1
|
|
170
170
|
focus-outline
|
|
171
171
|
rounded-tr-sm
|
|
@@ -183,46 +183,53 @@ watch(tempDate, () => {
|
|
|
183
183
|
</DateRangePickerTrigger>
|
|
184
184
|
</DateRangePickerField>
|
|
185
185
|
|
|
186
|
-
<!--
|
|
186
|
+
<!-- side=bottom makes months easier to click through -->
|
|
187
|
+
<!-- @vue-expect-error to exists-->
|
|
187
188
|
<DateRangePickerContent
|
|
188
189
|
:side-offset="4"
|
|
190
|
+
:avoid-collisions="true"
|
|
191
|
+
:prioritize-position="true"
|
|
192
|
+
side="bottom"
|
|
189
193
|
to="#root"
|
|
190
194
|
class="
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
195
|
+
date-range-picker--content
|
|
196
|
+
z-100
|
|
197
|
+
mx-2
|
|
198
|
+
rounded-sm
|
|
199
|
+
bg-bg
|
|
200
|
+
dark:bg-neutral-800
|
|
201
|
+
border
|
|
202
|
+
border-neutral-300
|
|
203
|
+
dark:border-neutral-700
|
|
204
|
+
shadow-lg
|
|
205
|
+
will-change-[transform,opacity]
|
|
206
|
+
data-[state=open]:data-[side=top]:animate-slideDownAndFade
|
|
207
|
+
data-[state=open]:data-[side=right]:animate-slideLeftAndFade
|
|
208
|
+
data-[state=open]:data-[side=bottom]:animate-slideUpAndFade
|
|
209
|
+
data-[state=open]:data-[side=left]:animate-slideRightAndFade
|
|
210
|
+
text-fg
|
|
211
|
+
dark:text-neutral-200
|
|
212
|
+
"
|
|
207
213
|
>
|
|
208
|
-
<DateRangePickerArrow class="fill-neutral-500"/>
|
|
214
|
+
<DateRangePickerArrow class="date-range-picker--arrow fill-neutral-500"/>
|
|
209
215
|
<DateRangePickerCalendar
|
|
210
216
|
v-slot="{ weekDays, grid }"
|
|
211
|
-
class="p-2 flex flex-col"
|
|
217
|
+
class="date-range-picker--calendar p-2 flex flex-col"
|
|
212
218
|
>
|
|
213
|
-
<DateRangePickerHeader class="flex items-center justify-between">
|
|
219
|
+
<DateRangePickerHeader class="date-range-picker--header flex items-center justify-between">
|
|
214
220
|
<DateRangePickerPrev
|
|
215
221
|
class="
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
date-range-picker--year-prev
|
|
223
|
+
inline-flex
|
|
224
|
+
items-center
|
|
225
|
+
cursor-pointer
|
|
226
|
+
active:scale-125
|
|
227
|
+
justify-center
|
|
228
|
+
rounded-sm
|
|
229
|
+
outlined
|
|
230
|
+
px-1
|
|
231
|
+
"
|
|
232
|
+
:prev-page="(date2) => date2.subtract({ years: 1 })"
|
|
226
233
|
>
|
|
227
234
|
<Icon class="scale-150">
|
|
228
235
|
<i-radix-icons-double-arrow-left/>
|
|
@@ -230,6 +237,7 @@ watch(tempDate, () => {
|
|
|
230
237
|
</DateRangePickerPrev>
|
|
231
238
|
<DateRangePickerPrev
|
|
232
239
|
class="
|
|
240
|
+
date-range-picker--prev
|
|
233
241
|
inline-flex
|
|
234
242
|
items-center
|
|
235
243
|
cursor-pointer
|
|
@@ -245,18 +253,19 @@ watch(tempDate, () => {
|
|
|
245
253
|
</Icon>
|
|
246
254
|
</DateRangePickerPrev>
|
|
247
255
|
|
|
248
|
-
<DateRangePickerHeading class="min-w-[14ch] text-center"/>
|
|
256
|
+
<DateRangePickerHeading class="date-range-picker--heading min-w-[14ch] text-center"/>
|
|
249
257
|
<DateRangePickerNext
|
|
250
258
|
class="
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
date-range-picker--next
|
|
260
|
+
inline-flex
|
|
261
|
+
items-center
|
|
262
|
+
cursor-pointer
|
|
263
|
+
active:scale-125
|
|
264
|
+
justify-center
|
|
265
|
+
rounded-sm
|
|
266
|
+
outlined
|
|
267
|
+
px-1
|
|
268
|
+
"
|
|
260
269
|
>
|
|
261
270
|
<Icon class="scale-150">
|
|
262
271
|
<i-radix-icons-chevron-right/>
|
|
@@ -264,16 +273,17 @@ watch(tempDate, () => {
|
|
|
264
273
|
</DateRangePickerNext>
|
|
265
274
|
<DateRangePickerNext
|
|
266
275
|
class="
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
276
|
+
date-range-picker--year-next
|
|
277
|
+
inline-flex
|
|
278
|
+
items-center
|
|
279
|
+
cursor-pointer
|
|
280
|
+
active:scale-125
|
|
281
|
+
justify-center
|
|
282
|
+
rounded-sm
|
|
283
|
+
outlined
|
|
284
|
+
px-1
|
|
285
|
+
"
|
|
286
|
+
:next-page="(date2) => date2.add({ years: 1 })"
|
|
277
287
|
>
|
|
278
288
|
<Icon class="scale-150">
|
|
279
289
|
<i-radix-icons-double-arrow-right/>
|
|
@@ -282,25 +292,37 @@ watch(tempDate, () => {
|
|
|
282
292
|
</DateRangePickerHeader>
|
|
283
293
|
<div
|
|
284
294
|
class="
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
295
|
+
date-range-picker--grid-wrapper
|
|
296
|
+
flex
|
|
297
|
+
flex-col
|
|
298
|
+
pt-4
|
|
299
|
+
"
|
|
289
300
|
>
|
|
290
301
|
<DateRangePickerGrid
|
|
291
|
-
class="
|
|
302
|
+
class="
|
|
303
|
+
date-range-picker--grid
|
|
304
|
+
border-collapse
|
|
305
|
+
select-none
|
|
306
|
+
"
|
|
292
307
|
v-for="month in grid"
|
|
293
308
|
:key="month.value.toString()"
|
|
294
309
|
>
|
|
295
|
-
<DateRangePickerGridHead>
|
|
296
|
-
<DateRangePickerGridRow class="
|
|
310
|
+
<DateRangePickerGridHead class="date-range-picker--grid-head">
|
|
311
|
+
<DateRangePickerGridRow class="
|
|
312
|
+
date-range-picker--grid-row
|
|
313
|
+
mb-1
|
|
314
|
+
flex
|
|
315
|
+
justify-between
|
|
316
|
+
"
|
|
317
|
+
>
|
|
297
318
|
<DateRangePickerHeadCell
|
|
298
319
|
class="
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
320
|
+
date-range-picker--head-cell
|
|
321
|
+
w-6
|
|
322
|
+
rounded-md
|
|
323
|
+
text-xs
|
|
324
|
+
text-accent-500
|
|
325
|
+
"
|
|
304
326
|
v-for="day in weekDays"
|
|
305
327
|
:key="day"
|
|
306
328
|
>
|
|
@@ -308,14 +330,21 @@ watch(tempDate, () => {
|
|
|
308
330
|
</DateRangePickerHeadCell>
|
|
309
331
|
</DateRangePickerGridRow>
|
|
310
332
|
</DateRangePickerGridHead>
|
|
311
|
-
<DateRangePickerGridBody>
|
|
333
|
+
<DateRangePickerGridBody class="date-range-picker--grid-body">
|
|
312
334
|
<DateRangePickerGridRow
|
|
313
|
-
class="
|
|
335
|
+
class="
|
|
336
|
+
date-range-picker--grid-row
|
|
337
|
+
flex
|
|
338
|
+
w-full
|
|
339
|
+
justify-between
|
|
340
|
+
my-1
|
|
341
|
+
"
|
|
314
342
|
v-for="(weekDates, index) in month.rows"
|
|
315
343
|
:key="`weekDate-${index}`"
|
|
316
344
|
>
|
|
317
345
|
<DateRangePickerCell
|
|
318
346
|
:date="weekDate"
|
|
347
|
+
class="date-range-picker--cell"
|
|
319
348
|
v-for="weekDate in weekDates"
|
|
320
349
|
:key="weekDate.toString()"
|
|
321
350
|
>
|
|
@@ -323,47 +352,50 @@ watch(tempDate, () => {
|
|
|
323
352
|
:day="weekDate"
|
|
324
353
|
:month="month.value"
|
|
325
354
|
class="
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
355
|
+
date-range-picker--cell-trigger
|
|
356
|
+
relative
|
|
357
|
+
flex
|
|
358
|
+
items-center
|
|
359
|
+
justify-center
|
|
360
|
+
whitespace-nowrap
|
|
361
|
+
rounded-sm
|
|
362
|
+
border
|
|
363
|
+
border-transparent
|
|
364
|
+
bg-transparent
|
|
365
|
+
text-sm
|
|
366
|
+
w-6
|
|
367
|
+
h-6
|
|
368
|
+
focus:shadow
|
|
369
|
+
focus-outline
|
|
370
|
+
hover:border-accent-500
|
|
371
|
+
data-[selected]:bg-accent-500
|
|
372
|
+
dark:data-[selected]:bg-accent-500/80
|
|
373
|
+
data-[selected]:shadow
|
|
374
|
+
data-[disabled]:text-neutral-500
|
|
375
|
+
data-[selected]:text-white
|
|
376
|
+
data-[unavailable]:pointer-events-none
|
|
377
|
+
data-[unavailable]:text-neutral-500
|
|
378
|
+
data-[unavailable]:line-through
|
|
379
|
+
data-[outside-view]:text-neutral-500
|
|
380
|
+
before:absolute
|
|
381
|
+
before:bottom-[1px]
|
|
382
|
+
before:hidden
|
|
383
|
+
before:rounded-full
|
|
384
|
+
before:w-4
|
|
385
|
+
before:h-[2px]
|
|
386
|
+
before:bg-white
|
|
387
|
+
data-[today]:before:block
|
|
388
|
+
data-[today]:before:bg-accent-700
|
|
389
|
+
dark:data-[today]:before:bg-accent-300
|
|
390
|
+
data-[selected]:before:bg-white
|
|
391
|
+
"
|
|
359
392
|
/>
|
|
360
393
|
</DateRangePickerCell>
|
|
361
394
|
</DateRangePickerGridRow>
|
|
362
395
|
</DateRangePickerGridBody>
|
|
363
396
|
</DateRangePickerGrid>
|
|
364
397
|
</div>
|
|
365
|
-
<slot v-bind="{tempValue: tempDate}"/>
|
|
366
|
-
<slot/>
|
|
398
|
+
<slot v-bind="{ tempValue: tempDate }"/>
|
|
367
399
|
</DateRangePickerCalendar>
|
|
368
400
|
</DateRangePickerContent>
|
|
369
401
|
</DateRangePickerRoot>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RangeDate } from "../../types/index.js.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
useTime?: boolean;
|
|
4
|
+
id: string;
|
|
5
|
+
fallbackDate?: Date;
|
|
6
|
+
timeZone?: string;
|
|
7
|
+
updateInterval?: number;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
10
|
+
modelValue: RangeDate;
|
|
11
|
+
};
|
|
12
|
+
declare var __VLS_167: {
|
|
13
|
+
tempValue: any;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_167) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: RangeDate) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: RangeDate) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
fallbackDate: Date;
|
|
24
|
+
timeZone: string;
|
|
25
|
+
useTime: boolean;
|
|
26
|
+
updateInterval: number;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|