@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,76 +1,83 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import {
|
|
3
|
-
import { DatePickerArrow, DatePickerCalendar, DatePickerCell, DatePickerCellTrigger, DatePickerContent, DatePickerField, DatePickerGrid, DatePickerGridBody, DatePickerGridHead, DatePickerGridRow, DatePickerHeadCell, DatePickerHeader, DatePickerHeading, DatePickerInput, DatePickerNext, DatePickerPrev, DatePickerRoot, DatePickerTrigger } from "
|
|
4
|
-
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
watch(() => props.timeZone, () => {
|
|
33
|
-
tempDate.value = convertDateWithFallback(date.value, props)
|
|
34
|
-
})
|
|
35
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getLocalTimeZone } from "@internationalized/date";
|
|
3
|
+
import { DatePickerArrow, DatePickerCalendar, DatePickerCell, DatePickerCellTrigger, DatePickerContent, DatePickerField, DatePickerGrid, DatePickerGridBody, DatePickerGridHead, DatePickerGridRow, DatePickerHeadCell, DatePickerHeader, DatePickerHeading, DatePickerInput, DatePickerNext, DatePickerPrev, DatePickerRoot, DatePickerTrigger } 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 locale = useInjectedLocale().timeLocale;
|
|
18
|
+
const date = defineModel({ type: null, ...{ required: true } });
|
|
19
|
+
let justSet = false;
|
|
20
|
+
const tempDate = ref();
|
|
21
|
+
function updateTempDate() {
|
|
22
|
+
tempDate.value = convertDateWithFallback(date.value, props);
|
|
23
|
+
}
|
|
24
|
+
updateTempDate();
|
|
25
|
+
watch(date, () => {
|
|
26
|
+
if (!justSet) {
|
|
27
|
+
updateTempDate();
|
|
28
|
+
} else {
|
|
29
|
+
justSet = false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
36
32
|
watch(tempDate, () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
justSet = true;
|
|
34
|
+
date.value = toEmittableDate(toRaw(tempDate.value));
|
|
35
|
+
});
|
|
36
|
+
watch(() => props.timeZone, () => {
|
|
37
|
+
updateTempDate();
|
|
38
|
+
});
|
|
40
39
|
const interval = setInterval(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, props.updateInterval)
|
|
46
|
-
|
|
40
|
+
if (!date.value) {
|
|
41
|
+
updateTempDate();
|
|
42
|
+
}
|
|
43
|
+
}, props.updateInterval);
|
|
47
44
|
onBeforeUnmount(() => {
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
|
|
45
|
+
clearInterval(interval);
|
|
46
|
+
});
|
|
51
47
|
</script>
|
|
52
48
|
|
|
53
49
|
<template>
|
|
54
50
|
<DatePickerRoot
|
|
55
51
|
:id="id"
|
|
56
52
|
:locale="locale"
|
|
57
|
-
class="root"
|
|
58
|
-
v-model="tempDate
|
|
53
|
+
class="date-picker--root"
|
|
54
|
+
v-model="tempDate"
|
|
59
55
|
>
|
|
60
56
|
<DatePickerField
|
|
61
57
|
v-slot="{ segments }"
|
|
62
|
-
:class="
|
|
63
|
-
|
|
58
|
+
:class="
|
|
59
|
+
twMerge(
|
|
60
|
+
`
|
|
61
|
+
date-picker--field
|
|
64
62
|
flex items-center justify-between
|
|
65
63
|
select-none
|
|
66
64
|
data-[invalid]:border-red-500
|
|
67
65
|
metadata-input-border
|
|
68
66
|
rounded-sm
|
|
69
67
|
`,
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
attrs.class
|
|
69
|
+
)
|
|
70
|
+
"
|
|
72
71
|
>
|
|
73
|
-
<div :class="twMerge(`
|
|
72
|
+
<div :class="twMerge(`
|
|
73
|
+
date-picker--segment
|
|
74
|
+
flex
|
|
75
|
+
items-center
|
|
76
|
+
overflow-scroll
|
|
77
|
+
scrollbar-hidden
|
|
78
|
+
whitespace-nowrap
|
|
79
|
+
`, date === void 0 && 'text-neutral-400')"
|
|
80
|
+
>
|
|
74
81
|
<template
|
|
75
82
|
v-for="item in segments"
|
|
76
83
|
:key="item.part"
|
|
@@ -78,7 +85,7 @@ onBeforeUnmount(() => {
|
|
|
78
85
|
<DatePickerInput
|
|
79
86
|
v-if="item.part === 'literal'"
|
|
80
87
|
:part="item.part"
|
|
81
|
-
class="
|
|
88
|
+
class="date-picker--segment-literal"
|
|
82
89
|
>
|
|
83
90
|
{{ item.value }}
|
|
84
91
|
</DatePickerInput>
|
|
@@ -86,7 +93,7 @@ onBeforeUnmount(() => {
|
|
|
86
93
|
v-else
|
|
87
94
|
:part="item.part"
|
|
88
95
|
class="
|
|
89
|
-
input
|
|
96
|
+
date-range-picker--segment-input
|
|
90
97
|
focus-outline-hidden
|
|
91
98
|
border
|
|
92
99
|
border-transparent
|
|
@@ -95,6 +102,7 @@ onBeforeUnmount(() => {
|
|
|
95
102
|
>
|
|
96
103
|
<div
|
|
97
104
|
class="
|
|
105
|
+
date-picker--segment-value
|
|
98
106
|
group-focus:z-[2]
|
|
99
107
|
group-focus:bg-accent-500/50
|
|
100
108
|
group-focus:rounded-xs
|
|
@@ -109,7 +117,7 @@ onBeforeUnmount(() => {
|
|
|
109
117
|
|
|
110
118
|
<DatePickerTrigger
|
|
111
119
|
class="
|
|
112
|
-
trigger
|
|
120
|
+
date-picker--trigger
|
|
113
121
|
px-1
|
|
114
122
|
focus-outline
|
|
115
123
|
rounded-tr-sm
|
|
@@ -126,48 +134,65 @@ onBeforeUnmount(() => {
|
|
|
126
134
|
</Icon>
|
|
127
135
|
</DatePickerTrigger>
|
|
128
136
|
</DatePickerField>
|
|
129
|
-
|
|
130
|
-
<!-- @vue-expect-error to exists -->
|
|
137
|
+
<!-- @vue-expect-error to exists-->
|
|
131
138
|
<DatePickerContent
|
|
132
139
|
:side-offset="4"
|
|
140
|
+
:avoid-collisions="true"
|
|
141
|
+
:prioritize-position="true"
|
|
142
|
+
side="bottom"
|
|
133
143
|
to="#root"
|
|
134
144
|
class="
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
date-picker--content
|
|
146
|
+
z-100
|
|
147
|
+
mx-2
|
|
148
|
+
rounded-sm
|
|
149
|
+
bg-bg
|
|
150
|
+
dark:bg-neutral-800
|
|
151
|
+
border
|
|
152
|
+
border-neutral-300
|
|
153
|
+
dark:border-neutral-700
|
|
154
|
+
shadow-lg
|
|
155
|
+
will-change-[transform,opacity]
|
|
156
|
+
data-[state=open]:data-[side=top]:animate-slideDownAndFade
|
|
157
|
+
data-[state=open]:data-[side=right]:animate-slideLeftAndFade
|
|
158
|
+
data-[state=open]:data-[side=bottom]:animate-slideUpAndFade
|
|
159
|
+
data-[state=open]:data-[side=left]:animate-slideRightAndFade
|
|
160
|
+
text-fg
|
|
161
|
+
dark:text-neutral-200
|
|
162
|
+
"
|
|
151
163
|
>
|
|
152
|
-
<DatePickerArrow class="fill-neutral-500"/>
|
|
164
|
+
<DatePickerArrow class="date-picker--arrow fill-neutral-500"/>
|
|
153
165
|
<!-- We set some max-width so it's not so hard to style the slot (which otherwise grows the calendar really wide. The min width is the header (4 icons + their padding + 14ch month), hence the complicated formula. -->
|
|
154
166
|
<DatePickerCalendar
|
|
155
167
|
v-slot="{ weekDays, grid }"
|
|
156
|
-
class="
|
|
168
|
+
class="
|
|
169
|
+
date-picker--calendar
|
|
170
|
+
p-2
|
|
171
|
+
flex
|
|
172
|
+
flex-col
|
|
173
|
+
max-w-[calc(1.2em*4+var(--spacing)*8+14ch)]
|
|
174
|
+
"
|
|
157
175
|
>
|
|
158
|
-
<DatePickerHeader class="
|
|
176
|
+
<DatePickerHeader class="
|
|
177
|
+
date-picker--header
|
|
178
|
+
flex
|
|
179
|
+
items-center
|
|
180
|
+
justify-between
|
|
181
|
+
"
|
|
182
|
+
>
|
|
159
183
|
<DatePickerPrev
|
|
160
184
|
class="
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
185
|
+
date-picker--year-prev
|
|
186
|
+
inline-flex
|
|
187
|
+
items-center
|
|
188
|
+
cursor-pointer
|
|
189
|
+
active:scale-125
|
|
190
|
+
justify-center
|
|
191
|
+
rounded-sm
|
|
192
|
+
outlined
|
|
193
|
+
px-1
|
|
194
|
+
"
|
|
195
|
+
:prev-page="(date2) => date2.subtract({ years: 1 })"
|
|
171
196
|
>
|
|
172
197
|
<Icon class="scale-150">
|
|
173
198
|
<i-radix-icons-double-arrow-left/>
|
|
@@ -175,15 +200,16 @@ onBeforeUnmount(() => {
|
|
|
175
200
|
</DatePickerPrev>
|
|
176
201
|
<DatePickerPrev
|
|
177
202
|
class="
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
203
|
+
date-picker--prev
|
|
204
|
+
inline-flex
|
|
205
|
+
items-center
|
|
206
|
+
cursor-pointer
|
|
207
|
+
active:scale-125
|
|
208
|
+
justify-center
|
|
209
|
+
rounded-sm
|
|
210
|
+
outlined
|
|
211
|
+
px-1
|
|
212
|
+
"
|
|
187
213
|
>
|
|
188
214
|
<Icon class="scale-150">
|
|
189
215
|
<i-radix-icons-chevron-left/>
|
|
@@ -193,15 +219,16 @@ onBeforeUnmount(() => {
|
|
|
193
219
|
<DatePickerHeading class="min-w-[14ch] text-center"/>
|
|
194
220
|
<DatePickerNext
|
|
195
221
|
class="
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
222
|
+
date-picker--next
|
|
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
|
+
"
|
|
205
232
|
>
|
|
206
233
|
<Icon class="scale-150">
|
|
207
234
|
<i-radix-icons-chevron-right/>
|
|
@@ -209,16 +236,17 @@ onBeforeUnmount(() => {
|
|
|
209
236
|
</DatePickerNext>
|
|
210
237
|
<DatePickerNext
|
|
211
238
|
class="
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
239
|
+
date-picker--year-next
|
|
240
|
+
inline-flex
|
|
241
|
+
items-center
|
|
242
|
+
cursor-pointer
|
|
243
|
+
active:scale-125
|
|
244
|
+
justify-center
|
|
245
|
+
rounded-sm
|
|
246
|
+
outlined
|
|
247
|
+
px-1
|
|
248
|
+
"
|
|
249
|
+
:next-page="(date2) => date2.add({ years: 1 })"
|
|
222
250
|
>
|
|
223
251
|
<Icon class="scale-150">
|
|
224
252
|
<i-radix-icons-double-arrow-right/>
|
|
@@ -227,25 +255,37 @@ onBeforeUnmount(() => {
|
|
|
227
255
|
</DatePickerHeader>
|
|
228
256
|
<div
|
|
229
257
|
class="
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
258
|
+
date-picker--grid-wrapper
|
|
259
|
+
flex
|
|
260
|
+
flex-col
|
|
261
|
+
pt-4
|
|
262
|
+
"
|
|
234
263
|
>
|
|
235
264
|
<DatePickerGrid
|
|
236
|
-
class="
|
|
265
|
+
class="
|
|
266
|
+
date-picker--grid
|
|
267
|
+
border-collapse
|
|
268
|
+
select-none
|
|
269
|
+
"
|
|
237
270
|
v-for="month in grid"
|
|
238
271
|
:key="month.value.toString()"
|
|
239
272
|
>
|
|
240
|
-
<DatePickerGridHead>
|
|
241
|
-
<DatePickerGridRow class="
|
|
273
|
+
<DatePickerGridHead class="date-picker--grid-head">
|
|
274
|
+
<DatePickerGridRow class="
|
|
275
|
+
date-picker--grid-row
|
|
276
|
+
mb-1
|
|
277
|
+
flex
|
|
278
|
+
justify-between
|
|
279
|
+
"
|
|
280
|
+
>
|
|
242
281
|
<DatePickerHeadCell
|
|
243
282
|
class="
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
283
|
+
date-picker--head-cell
|
|
284
|
+
w-6
|
|
285
|
+
rounded-md
|
|
286
|
+
text-xs
|
|
287
|
+
text-accent-500
|
|
288
|
+
"
|
|
249
289
|
v-for="day in weekDays"
|
|
250
290
|
:key="day"
|
|
251
291
|
>
|
|
@@ -253,14 +293,21 @@ onBeforeUnmount(() => {
|
|
|
253
293
|
</DatePickerHeadCell>
|
|
254
294
|
</DatePickerGridRow>
|
|
255
295
|
</DatePickerGridHead>
|
|
256
|
-
<DatePickerGridBody>
|
|
296
|
+
<DatePickerGridBody class="date-picker--grid-body">
|
|
257
297
|
<DatePickerGridRow
|
|
258
|
-
class="
|
|
298
|
+
class="
|
|
299
|
+
date-picker--grid-row
|
|
300
|
+
flex
|
|
301
|
+
w-full
|
|
302
|
+
justify-between
|
|
303
|
+
my-1
|
|
304
|
+
"
|
|
259
305
|
v-for="(weekDates, index) in month.rows"
|
|
260
306
|
:key="`weekDate-${index}`"
|
|
261
307
|
>
|
|
262
308
|
<DatePickerCell
|
|
263
309
|
:date="weekDate"
|
|
310
|
+
class="date-picker--cell"
|
|
264
311
|
v-for="weekDate in weekDates"
|
|
265
312
|
:key="weekDate.toString()"
|
|
266
313
|
>
|
|
@@ -268,46 +315,50 @@ onBeforeUnmount(() => {
|
|
|
268
315
|
:day="weekDate"
|
|
269
316
|
:month="month.value"
|
|
270
317
|
class="
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
318
|
+
date-picker--cell-trigger
|
|
319
|
+
relative
|
|
320
|
+
flex
|
|
321
|
+
items-center
|
|
322
|
+
justify-center
|
|
323
|
+
whitespace-nowrap
|
|
324
|
+
rounded-sm
|
|
325
|
+
border
|
|
326
|
+
border-transparent
|
|
327
|
+
bg-transparent
|
|
328
|
+
text-sm
|
|
329
|
+
w-6
|
|
330
|
+
h-6
|
|
331
|
+
focus:shadow
|
|
332
|
+
focus-outline
|
|
333
|
+
hover:border-accent-500
|
|
334
|
+
data-[selected]:bg-accent-500
|
|
335
|
+
dark:data-[selected]:bg-accent-500/80
|
|
336
|
+
data-[selected]:shadow
|
|
337
|
+
data-[disabled]:text-neutral-500
|
|
338
|
+
data-[selected]:text-white
|
|
339
|
+
data-[unavailable]:pointer-events-none
|
|
340
|
+
data-[unavailable]:text-neutral-500
|
|
341
|
+
data-[unavailable]:line-through
|
|
342
|
+
data-[outside-view]:text-neutral-500
|
|
343
|
+
before:absolute
|
|
344
|
+
before:bottom-[1px]
|
|
345
|
+
before:hidden
|
|
346
|
+
before:rounded-full
|
|
347
|
+
before:w-4
|
|
348
|
+
before:h-[2px]
|
|
349
|
+
before:bg-white
|
|
350
|
+
data-[today]:before:block
|
|
351
|
+
data-[today]:before:bg-accent-700
|
|
352
|
+
dark:data-[today]:before:bg-accent-300
|
|
353
|
+
data-[selected]:before:bg-white
|
|
354
|
+
"
|
|
304
355
|
/>
|
|
305
356
|
</DatePickerCell>
|
|
306
357
|
</DatePickerGridRow>
|
|
307
358
|
</DatePickerGridBody>
|
|
308
359
|
</DatePickerGrid>
|
|
309
360
|
</div>
|
|
310
|
-
<slot v-bind="{tempValue: tempDate}"/>
|
|
361
|
+
<slot v-bind="{ tempValue: tempDate }"/>
|
|
311
362
|
</DatePickerCalendar>
|
|
312
363
|
</DatePickerContent>
|
|
313
364
|
</DatePickerRoot>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SingleDate } 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: SingleDate;
|
|
11
|
+
};
|
|
12
|
+
declare var __VLS_157: {
|
|
13
|
+
tempValue: any;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_157) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: SingleDate) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: SingleDate) => 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
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { getLocalTimeZone } from "@internationalized/date"
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const label = defineModel<string>("label", { default: "Time Zone" })
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getLocalTimeZone } from "@internationalized/date";
|
|
3
|
+
import { getTimeZoneList } from "../../helpers/getTimeZoneList.js";
|
|
4
|
+
import LibInputDeprecated from "../LibInputDeprecated/LibInputDeprecated.vue";
|
|
5
|
+
const timeZone = defineModel({ type: String, ...{ default: getLocalTimeZone() } });
|
|
6
|
+
const label = defineModel("label", { type: String, ...{ default: "Time Zone" } });
|
|
8
7
|
</script>
|
|
8
|
+
|
|
9
9
|
<template>
|
|
10
|
-
<
|
|
10
|
+
<LibInputDeprecated
|
|
11
11
|
:restrict-to-suggestions="true"
|
|
12
12
|
:suggestions="getTimeZoneList()"
|
|
13
13
|
:suggestions-filter="(_, items) => items"
|
|
@@ -22,6 +22,5 @@ const label = defineModel<string>("label", { default: "Time Zone" })
|
|
|
22
22
|
</span>
|
|
23
23
|
</slot>
|
|
24
24
|
</template>
|
|
25
|
-
</
|
|
25
|
+
</LibInputDeprecated>
|
|
26
26
|
</template>
|
|
27
|
-
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_PublicProps = {
|
|
2
|
+
modelValue?: string;
|
|
3
|
+
"label"?: string;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_7: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_7) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: string) => any;
|
|
11
|
+
"update:label": (value: string) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
14
|
+
"onUpdate:label"?: ((value: string) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|