@witchcraft/ui 0.0.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 +236 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +34 -0
- package/dist/module.d.ts +34 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +124 -0
- package/dist/runtime/assets/base.css +1 -0
- package/dist/runtime/assets/locales/en.json +33 -0
- package/dist/runtime/assets/style.css +1 -0
- package/dist/runtime/assets/tailwind.css +1 -0
- package/dist/runtime/assets/theme.css +1 -0
- package/dist/runtime/build/WitchcraftUiResolver.d.ts +5 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +17 -0
- package/dist/runtime/build/generateTheme.d.ts +1 -0
- package/dist/runtime/build/generateTheme.js +14 -0
- package/dist/runtime/build/unpluginIconViteOptions.d.ts +2 -0
- package/dist/runtime/build/unpluginIconViteOptions.js +10 -0
- package/dist/runtime/components/Aria/Aria.vue +18 -0
- package/dist/runtime/components/Focus.stories.d.ts +11 -0
- package/dist/runtime/components/Focus.stories.js +53 -0
- package/dist/runtime/components/Icon/Icon.vue +39 -0
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +12 -0
- package/dist/runtime/components/LibButton/LibButton.stories.js +94 -0
- package/dist/runtime/components/LibButton/LibButton.vue +247 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +14 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +29 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +132 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +7 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +58 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +125 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +7 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +51 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +448 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +7 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +36 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +95 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +11 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +98 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +67 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +370 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +314 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +27 -0
- package/dist/runtime/components/LibDatePicker/helpers.d.ts +25 -0
- package/dist/runtime/components/LibDatePicker/helpers.js +28 -0
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +9 -0
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +46 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +91 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +53 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +10 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +63 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +273 -0
- package/dist/runtime/components/LibInput/LibInput.stories.d.ts +33 -0
- package/dist/runtime/components/LibInput/LibInput.stories.js +339 -0
- package/dist/runtime/components/LibInput/LibInput.vue +372 -0
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +6 -0
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +25 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +66 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +23 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +60 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +127 -0
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +15 -0
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +126 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +121 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +6 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +109 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +133 -0
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +6 -0
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +40 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +261 -0
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +6 -0
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +20 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +49 -0
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +147 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +441 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +10 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +81 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +192 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +19 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +63 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +243 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +126 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +26 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +78 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +148 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +27 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +112 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +198 -0
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +16 -0
- package/dist/runtime/components/LibTable/LibTable.stories.js +156 -0
- package/dist/runtime/components/LibTable/LibTable.vue +177 -0
- package/dist/runtime/components/Template/NAME.vue +49 -0
- package/dist/runtime/components/Template/TemplateStory.d.ts +7 -0
- package/dist/runtime/components/Template/TemplateStory.js +22 -0
- package/dist/runtime/components/TestControls/TestControls.vue +19 -0
- package/dist/runtime/components/index.d.ts +19 -0
- package/dist/runtime/components/index.js +19 -0
- package/dist/runtime/components/reset.stories.d.ts +5 -0
- package/dist/runtime/components/reset.stories.js +19 -0
- package/dist/runtime/components/shared/props.d.ts +135 -0
- package/dist/runtime/components/shared/props.js +14 -0
- package/dist/runtime/components/shared/storyHelpers/playInput.d.ts +8 -0
- package/dist/runtime/components/shared/storyHelpers/playInput.js +26 -0
- package/dist/runtime/components/shared/storyHelpers/playSuggestions.d.ts +12 -0
- package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +83 -0
- package/dist/runtime/composables/index.d.ts +11 -0
- package/dist/runtime/composables/index.js +11 -0
- package/dist/runtime/composables/useAccesibilityOutline.d.ts +41 -0
- package/dist/runtime/composables/useAccesibilityOutline.js +58 -0
- package/dist/runtime/composables/useAriaLabel.d.ts +6 -0
- package/dist/runtime/composables/useAriaLabel.js +15 -0
- package/dist/runtime/composables/useDarkMode.d.ts +38 -0
- package/dist/runtime/composables/useDarkMode.js +79 -0
- package/dist/runtime/composables/useDivideAttrs.d.ts +27 -0
- package/dist/runtime/composables/useDivideAttrs.js +26 -0
- package/dist/runtime/composables/useGlobalResizeObserver.d.ts +3 -0
- package/dist/runtime/composables/useGlobalResizeObserver.js +28 -0
- package/dist/runtime/composables/useInjectedDarkMode.d.ts +2 -0
- package/dist/runtime/composables/useInjectedDarkMode.js +13 -0
- package/dist/runtime/composables/useInjectedI18n.d.ts +2 -0
- package/dist/runtime/composables/useInjectedI18n.js +7 -0
- package/dist/runtime/composables/useInjectedLocale.d.ts +2 -0
- package/dist/runtime/composables/useInjectedLocale.js +21 -0
- package/dist/runtime/composables/useNotificationHandler.d.ts +4 -0
- package/dist/runtime/composables/useNotificationHandler.js +21 -0
- package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +68 -0
- package/dist/runtime/composables/useScrollNearContainerEdges.js +116 -0
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +7 -0
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +85 -0
- package/dist/runtime/composables/useSetupDarkMode.d.ts +12 -0
- package/dist/runtime/composables/useSetupDarkMode.js +4 -0
- package/dist/runtime/composables/useSetupI18n.d.ts +20 -0
- package/dist/runtime/composables/useSetupI18n.js +50 -0
- package/dist/runtime/composables/useSetupLocale.d.ts +9 -0
- package/dist/runtime/composables/useSetupLocale.js +21 -0
- package/dist/runtime/composables/useShowDevOnlyKey.d.ts +7 -0
- package/dist/runtime/composables/useShowDevOnlyKey.js +20 -0
- package/dist/runtime/composables/useSuggestions.d.ts +38 -0
- package/dist/runtime/composables/useSuggestions.js +226 -0
- package/dist/runtime/directives/index.d.ts +4 -0
- package/dist/runtime/directives/index.js +4 -0
- package/dist/runtime/directives/vDetectFlex.d.ts +2 -0
- package/dist/runtime/directives/vDetectFlex.js +109 -0
- package/dist/runtime/directives/vExtractRootEl.d.ts +22 -0
- package/dist/runtime/directives/vExtractRootEl.js +13 -0
- package/dist/runtime/directives/vResizableCols.d.ts +60 -0
- package/dist/runtime/directives/vResizableCols.js +252 -0
- package/dist/runtime/directives/vResizeObserver.d.ts +2 -0
- package/dist/runtime/directives/vResizeObserver.js +34 -0
- package/dist/runtime/globalResizeObserver.d.ts +5 -0
- package/dist/runtime/globalResizeObserver.js +5 -0
- package/dist/runtime/helpers/NotificationHandler.d.ts +48 -0
- package/dist/runtime/helpers/NotificationHandler.js +162 -0
- package/dist/runtime/helpers/addValue.d.ts +1 -0
- package/dist/runtime/helpers/addValue.js +8 -0
- package/dist/runtime/helpers/base64ToImg.d.ts +1 -0
- package/dist/runtime/helpers/base64ToImg.js +11 -0
- package/dist/runtime/helpers/copy.d.ts +1 -0
- package/dist/runtime/helpers/copy.js +10 -0
- package/dist/runtime/helpers/createNoonUtcDate.d.ts +7 -0
- package/dist/runtime/helpers/createNoonUtcDate.js +14 -0
- package/dist/runtime/helpers/defaultTranslationFunction.d.ts +16 -0
- package/dist/runtime/helpers/defaultTranslationFunction.js +14 -0
- package/dist/runtime/helpers/getTimeZoneList.d.ts +1 -0
- package/dist/runtime/helpers/getTimeZoneList.js +3 -0
- package/dist/runtime/helpers/hasModifiers.d.ts +1 -0
- package/dist/runtime/helpers/hasModifiers.js +1 -0
- package/dist/runtime/helpers/index.d.ts +8 -0
- package/dist/runtime/helpers/index.js +8 -0
- package/dist/runtime/helpers/readFile.d.ts +1 -0
- package/dist/runtime/helpers/readFile.js +13 -0
- package/dist/runtime/helpers/resizeObserverWrapper.d.ts +8 -0
- package/dist/runtime/helpers/resizeObserverWrapper.js +37 -0
- package/dist/runtime/helpers/storybook.d.ts +7 -0
- package/dist/runtime/helpers/storybook.js +42 -0
- package/dist/runtime/main.lib.d.ts +26 -0
- package/dist/runtime/main.lib.js +8 -0
- package/dist/runtime/nuxt/plugins/vue-plugin.d.ts +2 -0
- package/dist/runtime/nuxt/plugins/vue-plugin.js +12 -0
- package/dist/runtime/tailwind/index.d.ts +1 -0
- package/dist/runtime/tailwind/index.js +1 -0
- package/dist/runtime/tailwind/themeConvertionOpts.d.ts +2 -0
- package/dist/runtime/tailwind/themeConvertionOpts.js +12 -0
- package/dist/runtime/theme.d.ts +2 -0
- package/dist/runtime/theme.js +2 -0
- package/dist/runtime/types/index.d.ts +119 -0
- package/dist/runtime/types/index.js +0 -0
- package/dist/runtime/utils/twMerge.d.ts +10 -0
- package/dist/runtime/utils/twMerge.js +10 -0
- package/dist/runtime/vue/VueComponentsPlugin.d.ts +2 -0
- package/dist/runtime/vue/VueComponentsPlugin.js +10 -0
- package/dist/runtime/vue/registerComponents.d.ts +19 -0
- package/dist/runtime/vue/registerComponents.js +10 -0
- package/dist/runtime/vue/registerDirectives.d.ts +3 -0
- package/dist/runtime/vue/registerDirectives.js +9 -0
- package/dist/types.d.mts +7 -0
- package/dist/types.d.ts +7 -0
- package/package.json +207 -0
- package/src/module.ts +176 -0
- package/src/runtime/assets/base.css +67 -0
- package/src/runtime/assets/locales/en.json +33 -0
- package/src/runtime/assets/style.css +144 -0
- package/src/runtime/assets/tailwind.css +5 -0
- package/src/runtime/assets/theme.css +65 -0
- package/src/runtime/build/WitchcraftUiResolver.ts +27 -0
- package/src/runtime/build/generateTheme.ts +16 -0
- package/src/runtime/build/unpluginIconViteOptions.ts +11 -0
- package/src/runtime/components/Aria/Aria.vue +27 -0
- package/src/runtime/components/Focus.stories.ts +67 -0
- package/src/runtime/components/Icon/Icon.vue +39 -0
- package/src/runtime/components/LibButton/LibButton.stories.ts +107 -0
- package/src/runtime/components/LibButton/LibButton.vue +247 -0
- package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +41 -0
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +132 -0
- package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +69 -0
- package/src/runtime/components/LibColorInput/LibColorInput.vue +125 -0
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +60 -0
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +448 -0
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +51 -0
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +95 -0
- package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +114 -0
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +67 -0
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +370 -0
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +314 -0
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +27 -0
- package/src/runtime/components/LibDatePicker/helpers.ts +55 -0
- package/src/runtime/components/LibDebug/LibDebug.stories.ts +58 -0
- package/src/runtime/components/LibDebug/LibDebug.vue +91 -0
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +53 -0
- package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +79 -0
- package/src/runtime/components/LibFileInput/LibFileInput.vue +273 -0
- package/src/runtime/components/LibInput/LibInput.stories.ts +367 -0
- package/src/runtime/components/LibInput/LibInput.vue +372 -0
- package/src/runtime/components/LibLabel/LibLabel.stories.ts +37 -0
- package/src/runtime/components/LibLabel/LibLabel.vue +66 -0
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +83 -0
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +127 -0
- package/src/runtime/components/LibNotifications/LibNotification.stories.ts +142 -0
- package/src/runtime/components/LibNotifications/LibNotification.vue +121 -0
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +124 -0
- package/src/runtime/components/LibNotifications/LibNotifications.vue +133 -0
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +53 -0
- package/src/runtime/components/LibPagination/LibPagination.vue +261 -0
- package/src/runtime/components/LibPalette/LibPalette.stories.ts +32 -0
- package/src/runtime/components/LibPalette/LibPalette.vue +49 -0
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +157 -0
- package/src/runtime/components/LibPopup/LibPopup.vue +441 -0
- package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +94 -0
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +192 -0
- package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +81 -0
- package/src/runtime/components/LibRecorder/LibRecorder.vue +243 -0
- package/src/runtime/components/LibRoot/LibRoot.vue +126 -0
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +98 -0
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +148 -0
- package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +137 -0
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +198 -0
- package/src/runtime/components/LibTable/LibTable.stories.ts +170 -0
- package/src/runtime/components/LibTable/LibTable.vue +177 -0
- package/src/runtime/components/Template/NAME.vue +49 -0
- package/src/runtime/components/Template/TemplateStory.ts +38 -0
- package/src/runtime/components/TestControls/TestControls.vue +19 -0
- package/src/runtime/components/index.ts +22 -0
- package/src/runtime/components/reset.stories.ts +32 -0
- package/src/runtime/components/shared/props.ts +142 -0
- package/src/runtime/components/shared/storyHelpers/playInput.ts +35 -0
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +105 -0
- package/src/runtime/composables/index.ts +13 -0
- package/src/runtime/composables/useAccesibilityOutline.ts +104 -0
- package/src/runtime/composables/useAriaLabel.ts +23 -0
- package/src/runtime/composables/useDarkMode.ts +146 -0
- package/src/runtime/composables/useDivideAttrs.ts +52 -0
- package/src/runtime/composables/useGlobalResizeObserver.ts +33 -0
- package/src/runtime/composables/useInjectedDarkMode.ts +15 -0
- package/src/runtime/composables/useInjectedI18n.ts +10 -0
- package/src/runtime/composables/useInjectedLocale.ts +24 -0
- package/src/runtime/composables/useNotificationHandler.ts +32 -0
- package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +93 -0
- package/src/runtime/composables/useScrollNearContainerEdges.ts +205 -0
- package/src/runtime/composables/useSetupDarkMode.ts +14 -0
- package/src/runtime/composables/useSetupI18n.ts +77 -0
- package/src/runtime/composables/useSetupLocale.ts +32 -0
- package/src/runtime/composables/useShowDevOnlyKey.ts +28 -0
- package/src/runtime/composables/useSuggestions.ts +297 -0
- package/src/runtime/directives/index.ts +6 -0
- package/src/runtime/directives/vDetectFlex.ts +159 -0
- package/src/runtime/directives/vExtractRootEl.ts +38 -0
- package/src/runtime/directives/vResizableCols.ts +378 -0
- package/src/runtime/directives/vResizeObserver.ts +45 -0
- package/src/runtime/globalResizeObserver.ts +12 -0
- package/src/runtime/helpers/NotificationHandler.ts +227 -0
- package/src/runtime/helpers/addValue.ts +10 -0
- package/src/runtime/helpers/base64ToImg.ts +14 -0
- package/src/runtime/helpers/copy.ts +11 -0
- package/src/runtime/helpers/createNoonUtcDate.ts +21 -0
- package/src/runtime/helpers/defaultTranslationFunction.ts +33 -0
- package/src/runtime/helpers/getTimeZoneList.ts +4 -0
- package/src/runtime/helpers/hasModifiers.ts +1 -0
- package/src/runtime/helpers/index.ts +10 -0
- package/src/runtime/helpers/readFile.ts +22 -0
- package/src/runtime/helpers/resizeObserverWrapper.ts +45 -0
- package/src/runtime/helpers/storybook.ts +52 -0
- package/src/runtime/main.lib.ts +31 -0
- package/src/runtime/nuxt/plugins/vue-plugin.ts +19 -0
- package/src/runtime/tailwind/index.ts +3 -0
- package/src/runtime/tailwind/themeConvertionOpts.ts +15 -0
- package/src/runtime/theme.ts +5 -0
- package/src/runtime/types/index.ts +116 -0
- package/src/runtime/utils/twMerge.ts +13 -0
- package/src/runtime/vue/VueComponentsPlugin.ts +16 -0
- package/src/runtime/vue/registerComponents.ts +31 -0
- package/src/runtime/vue/registerDirectives.ts +12 -0
- package/types/components.d.ts +27 -0
- package/types/global.d.ts +16 -0
- package/types/index.d.ts +5 -0
- package/types/vite.d.ts +2 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<lib-button
|
|
3
|
+
v-bind="{...$attrs, class:undefined}"
|
|
4
|
+
:class="!($attrs as any).unstyle && twMerge(`
|
|
5
|
+
rounded-full
|
|
6
|
+
after:rounded-full
|
|
7
|
+
`,
|
|
8
|
+
($attrs as any)?.class
|
|
9
|
+
)"
|
|
10
|
+
:title="`${t('dark-mode-switcher.title')}${t(`dark-mode-switcher.${darkModeState}`)}`"
|
|
11
|
+
:label="showLabel
|
|
12
|
+
? t(`dark-mode-switcher.${darkModeState}`)
|
|
13
|
+
: ''
|
|
14
|
+
"
|
|
15
|
+
@click="cycleDarkMode"
|
|
16
|
+
>
|
|
17
|
+
<template #icon>
|
|
18
|
+
<icon
|
|
19
|
+
v-if="darkModeState==='dark'"
|
|
20
|
+
class="w-[1em] flex items-center"
|
|
21
|
+
>
|
|
22
|
+
<i-fa-solid-moon/>
|
|
23
|
+
</icon>
|
|
24
|
+
<icon
|
|
25
|
+
v-else-if="darkModeState==='light'"
|
|
26
|
+
class="w-[1em]"
|
|
27
|
+
>
|
|
28
|
+
<i-ph-sun-bold/>
|
|
29
|
+
</icon>
|
|
30
|
+
<icon
|
|
31
|
+
v-else
|
|
32
|
+
class="w-[1em]"
|
|
33
|
+
>
|
|
34
|
+
<i-fa6-solid-circle-half-stroke/>
|
|
35
|
+
</icon>
|
|
36
|
+
</template>
|
|
37
|
+
</lib-button>
|
|
38
|
+
</template>
|
|
39
|
+
<script lang="ts" setup>
|
|
40
|
+
import { type ButtonHTMLAttributes,onMounted,useAttrs, watch } from "vue"
|
|
41
|
+
|
|
42
|
+
import { useInjectedDarkMode } from "../../composables/useInjectedDarkMode.js"
|
|
43
|
+
import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
|
|
44
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
45
|
+
import Icon from "../Icon/Icon.vue"
|
|
46
|
+
import LibButton from "../LibButton/LibButton.vue"
|
|
47
|
+
import type { TailwindClassProp } from "../shared/props.js"
|
|
48
|
+
|
|
49
|
+
const t = useInjectedI18n()
|
|
50
|
+
|
|
51
|
+
const emit = defineEmits<{
|
|
52
|
+
/** Emits whether dark mode should be enabled. */
|
|
53
|
+
(e: "update:darkMode", value: boolean): void
|
|
54
|
+
/** Emits the change, but as a state string (dark, light, system) */
|
|
55
|
+
(e: "update:darkModeState", value: "dark" | "light" | "system"): void
|
|
56
|
+
}>()
|
|
57
|
+
const $attrs = useAttrs()
|
|
58
|
+
|
|
59
|
+
// eslint-disable-next-line no-use-before-define
|
|
60
|
+
withDefaults(defineProps<Props>(), { })
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
darkMode,
|
|
65
|
+
cycleDarkMode,
|
|
66
|
+
darkModeState,
|
|
67
|
+
} = useInjectedDarkMode()
|
|
68
|
+
|
|
69
|
+
watch(darkMode, value => emit("update:darkMode", value))
|
|
70
|
+
watch(darkModeState, value => emit("update:darkModeState", value))
|
|
71
|
+
|
|
72
|
+
onMounted(() => {
|
|
73
|
+
emit("update:darkMode", darkMode.value)
|
|
74
|
+
})
|
|
75
|
+
</script>
|
|
76
|
+
<script lang="ts">
|
|
77
|
+
export default {
|
|
78
|
+
name: "lib-dark-mode-switcher"
|
|
79
|
+
}
|
|
80
|
+
type RealProps = {
|
|
81
|
+
showLabel?: boolean
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface Props
|
|
85
|
+
extends
|
|
86
|
+
/** @vue-ignore */
|
|
87
|
+
Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
|
|
88
|
+
& TailwindClassProp
|
|
89
|
+
& {
|
|
90
|
+
disabled?: boolean
|
|
91
|
+
unstyle?: boolean
|
|
92
|
+
}>,
|
|
93
|
+
RealProps
|
|
94
|
+
{ }
|
|
95
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import * as components from "../index.js.js";
|
|
3
|
+
declare const singleMeta: Meta<typeof components.LibDatePicker>;
|
|
4
|
+
export default singleMeta;
|
|
5
|
+
type Story = StoryObj<typeof components.LibDatePicker>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const DateRange: Story;
|
|
8
|
+
export declare const IconTriggerFirst: Story;
|
|
9
|
+
export declare const BottomSlot: Story;
|
|
10
|
+
export declare const DateWithTime: Story;
|
|
11
|
+
export declare const WithDifferentFallbackDate: Story;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { CalendarDate, fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { createNoonUtcDate } from "../../helpers/createNoonUtcDate.js";
|
|
4
|
+
import * as components from "../index.js";
|
|
5
|
+
function html(strings, ...values) {
|
|
6
|
+
return String.raw(strings, ...values);
|
|
7
|
+
}
|
|
8
|
+
const singleMeta = {
|
|
9
|
+
component: components.LibDatePicker,
|
|
10
|
+
title: "Components/DatePicker",
|
|
11
|
+
args: {
|
|
12
|
+
// @ts-expect-error custom prop just for story
|
|
13
|
+
slot: "",
|
|
14
|
+
timeZone: getLocalTimeZone()
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export default singleMeta;
|
|
18
|
+
function toUTC(m, timeZone) {
|
|
19
|
+
return toTimeZone(fromDate(m, timeZone), "UTC").toAbsoluteString();
|
|
20
|
+
}
|
|
21
|
+
export const Primary = {
|
|
22
|
+
render: (args) => ({
|
|
23
|
+
components: {
|
|
24
|
+
...components
|
|
25
|
+
},
|
|
26
|
+
setup: () => {
|
|
27
|
+
const modelValue = ref(args.modelValue);
|
|
28
|
+
const timeZone = ref(args.timeZone);
|
|
29
|
+
const debugUtcDate = computed(() => {
|
|
30
|
+
const m = modelValue.value;
|
|
31
|
+
const z = timeZone.value;
|
|
32
|
+
return m instanceof Date ? toUTC(m, z) : typeof m === "object" ? `Start: ${m.start ? toUTC(m.start, z) : "undefined"}, End: ${m.end ? toUTC(m.end, z) : "undefined"}` : "undefined";
|
|
33
|
+
});
|
|
34
|
+
return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate };
|
|
35
|
+
},
|
|
36
|
+
template: `
|
|
37
|
+
<div>Date: {{modelValue ?? "undefined"}}</div>
|
|
38
|
+
<div>Date UTC: {{debugUtcDate}}</div>
|
|
39
|
+
<div>Detected timezone (via @internationalized/date): {{getLocalTimeZone()}}</div>
|
|
40
|
+
<LibTimeZonePicker
|
|
41
|
+
v-model="timeZone"
|
|
42
|
+
label="Override Time Zone"
|
|
43
|
+
wrapper-class="[&_.suggestions]:max-h-[200px] [&_.suggestions]:overflow-y-auto"
|
|
44
|
+
/>
|
|
45
|
+
<div>
|
|
46
|
+
This component has no border, added here to see it's size.
|
|
47
|
+
</div>
|
|
48
|
+
<div class="border border-neutral-500">
|
|
49
|
+
<LibDatePicker v-bind="args" v-model="modelValue" :time-zone="timeZone">
|
|
50
|
+
${args.slot}
|
|
51
|
+
</LibDatePicker>
|
|
52
|
+
</div>
|
|
53
|
+
`
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
export const DateRange = {
|
|
57
|
+
...Primary,
|
|
58
|
+
args: {
|
|
59
|
+
modelValue: { start: void 0, end: void 0 }
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export const IconTriggerFirst = {
|
|
63
|
+
...Primary,
|
|
64
|
+
args: {
|
|
65
|
+
...Primary.args,
|
|
66
|
+
class: "[&_.trigger]:order-first"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export const BottomSlot = {
|
|
70
|
+
...Primary,
|
|
71
|
+
args: {
|
|
72
|
+
// @ts-expect-error see above
|
|
73
|
+
slot: html`
|
|
74
|
+
<template #default="slotProps">
|
|
75
|
+
<LibButton>Custom content can be added here.</LibButton>
|
|
76
|
+
<p class="break-all">
|
|
77
|
+
Content has access to the internal temporary/suggested date value and can change it (e.g. set it to today).
|
|
78
|
+
</p>
|
|
79
|
+
<p>Temp value:</p>
|
|
80
|
+
{{ slotProps.tempValue }}
|
|
81
|
+
</template>
|
|
82
|
+
`
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export const DateWithTime = {
|
|
86
|
+
...Primary,
|
|
87
|
+
args: {
|
|
88
|
+
...Primary.args,
|
|
89
|
+
showTime: true
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
export const WithDifferentFallbackDate = {
|
|
93
|
+
...Primary,
|
|
94
|
+
args: {
|
|
95
|
+
...Primary.args,
|
|
96
|
+
fallbackDate: createNoonUtcDate(new CalendarDate(2e3, 1, 1)).toDate()
|
|
97
|
+
}
|
|
98
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getLocalTimeZone } from "@internationalized/date"
|
|
3
|
+
import { computed, useAttrs } from "vue"
|
|
4
|
+
|
|
5
|
+
import LibRangeDatePicker from "./LibRangeDatePicker.vue"
|
|
6
|
+
import LibSingleDatePicker from "./LibSingleDatePicker.vue"
|
|
7
|
+
|
|
8
|
+
import type { RangeDate,SingleDate } from "../../types/index.js"
|
|
9
|
+
import { getFallbackId } from "../shared/props.js"
|
|
10
|
+
|
|
11
|
+
const attrs = useAttrs()
|
|
12
|
+
|
|
13
|
+
withDefaults(defineProps<{
|
|
14
|
+
showTime?: boolean
|
|
15
|
+
id?: string
|
|
16
|
+
/** The fallback suggested date when the modelValue is undefined (it will not update modelValue, it only serves as a suggestions and is used internally in the temporary value). If ignoring the time element, you should probably use the {@link createNoonTodayUtc} function (`createNonTodayUtc().toDate(())`) in the helpers, otherwise `new Date()` (the default) will do. */
|
|
17
|
+
fallbackDate?: Date
|
|
18
|
+
/** The local user's timezone, defaults to @internationalized/date's getLocalTimeZone(). */
|
|
19
|
+
timeZone?: string
|
|
20
|
+
}>(), {
|
|
21
|
+
showTime: false,
|
|
22
|
+
id: undefined,
|
|
23
|
+
fallbackDate: () => new Date(),
|
|
24
|
+
timeZone: getLocalTimeZone()
|
|
25
|
+
})
|
|
26
|
+
const fallbackId = getFallbackId()
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* modelValue can be undefined or an object with start/end undefined, but it must be passed, otherwise we can't tell the difference between a single date and a range date.
|
|
30
|
+
*
|
|
31
|
+
* In the case of an undefined date, the current date at NOON UTC will be used to avoid the date changing.
|
|
32
|
+
*
|
|
33
|
+
* The @internationalized/date library's fromDate function is used internally to convert the date given (should be UTC) to the local time zone. It's converted back via it's toDate function.
|
|
34
|
+
*/
|
|
35
|
+
const date = defineModel<SingleDate | RangeDate>({ required: true })
|
|
36
|
+
const isRange = computed(() => date.value !== undefined && !(date.value instanceof Date))
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<LibSingleDatePicker
|
|
42
|
+
v-if="!isRange"
|
|
43
|
+
v-bind="attrs"
|
|
44
|
+
:id="id ?? fallbackId"
|
|
45
|
+
:use-time="showTime"
|
|
46
|
+
:time-zone="timeZone"
|
|
47
|
+
:fallback-date="fallbackDate"
|
|
48
|
+
v-model="date as SingleDate"
|
|
49
|
+
>
|
|
50
|
+
<template #default="slotProps">
|
|
51
|
+
<slot v-bind="slotProps"/>
|
|
52
|
+
</template>
|
|
53
|
+
</LibSingleDatePicker>
|
|
54
|
+
<LibRangeDatePicker
|
|
55
|
+
v-else
|
|
56
|
+
:id="id ?? fallbackId"
|
|
57
|
+
v-bind="attrs"
|
|
58
|
+
:use-time="showTime"
|
|
59
|
+
:time-zone="timeZone"
|
|
60
|
+
:fallback-date="fallbackDate"
|
|
61
|
+
v-model="date as RangeDate"
|
|
62
|
+
>
|
|
63
|
+
<template #default="slotProps">
|
|
64
|
+
<slot v-bind="slotProps"/>
|
|
65
|
+
</template>
|
|
66
|
+
</LibRangeDatePicker>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type DateValue, getLocalTimeZone } from "@internationalized/date"
|
|
3
|
+
import type { DateRange } from "radix-vue"
|
|
4
|
+
import { DateRangePickerArrow, DateRangePickerCalendar, DateRangePickerCell, DateRangePickerCellTrigger, DateRangePickerContent, DateRangePickerField, DateRangePickerGrid, DateRangePickerGridBody, DateRangePickerGridHead, DateRangePickerGridRow, DateRangePickerHeadCell,DateRangePickerHeader, DateRangePickerHeading, DateRangePickerInput, DateRangePickerNext, DateRangePickerPrev, DateRangePickerRoot, DateRangePickerTrigger } from "radix-vue"
|
|
5
|
+
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
|
|
6
|
+
|
|
7
|
+
import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
|
|
8
|
+
|
|
9
|
+
import { useInjectedLocale } from "../../composables/useInjectedLocale.js"
|
|
10
|
+
import type { RangeDate } from "../../types/index.js"
|
|
11
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
12
|
+
import Icon from "../Icon/Icon.vue"
|
|
13
|
+
const attrs = useAttrs()
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<{
|
|
16
|
+
useTime?: boolean
|
|
17
|
+
id: string
|
|
18
|
+
fallbackDate?: Date
|
|
19
|
+
timeZone?: string
|
|
20
|
+
updateInterval?: number
|
|
21
|
+
}>(), {
|
|
22
|
+
timeZone: getLocalTimeZone(),
|
|
23
|
+
useTime: false,
|
|
24
|
+
fallbackDate: _ => getNow({ withTime: _.useTime ?? false }).toDate(_.timeZone ?? getLocalTimeZone()),
|
|
25
|
+
updateInterval: 10000
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const date = defineModel<RangeDate>({ required: true })
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const tempDate = ref({
|
|
32
|
+
start: convertDateWithFallback(date.value?.start, props),
|
|
33
|
+
end: convertDateWithFallback(date.value?.end, props)
|
|
34
|
+
})
|
|
35
|
+
watch(() => props.timeZone, () => {
|
|
36
|
+
tempDate.value = {
|
|
37
|
+
start: convertDateWithFallback(date.value?.start, props),
|
|
38
|
+
end: convertDateWithFallback(date.value?.end, props)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const interval = setInterval(() => {
|
|
43
|
+
if (!date.value.start) {
|
|
44
|
+
// update suggested date if none is set
|
|
45
|
+
tempDate.value.start = convertDateWithFallback(date.value.start, props)
|
|
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
|
+
|
|
53
|
+
onBeforeUnmount(() => {
|
|
54
|
+
clearInterval(interval)
|
|
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
|
+
})
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<DateRangePickerRoot
|
|
69
|
+
:id="id"
|
|
70
|
+
:locale="locale"
|
|
71
|
+
class="root"
|
|
72
|
+
v-model="tempDate as DateRange"
|
|
73
|
+
>
|
|
74
|
+
<DateRangePickerField
|
|
75
|
+
v-slot="{ segments }"
|
|
76
|
+
:class="twMerge(`
|
|
77
|
+
container
|
|
78
|
+
flex items-center justify-between
|
|
79
|
+
select-none
|
|
80
|
+
data-[invalid]:border-red-500
|
|
81
|
+
metadata-input-border
|
|
82
|
+
rounded-sm
|
|
83
|
+
`, (attrs as any).class)"
|
|
84
|
+
>
|
|
85
|
+
<div class="segments flex items-center flex-1 overflow-scroll scrollbar-hidden whitespace-nowrap">
|
|
86
|
+
<div :class="twMerge(`start-segment flex items-center`, date.start === undefined && 'text-neutral-400')">
|
|
87
|
+
<template
|
|
88
|
+
v-for="item in segments.start"
|
|
89
|
+
:key="item.part"
|
|
90
|
+
>
|
|
91
|
+
<DateRangePickerInput
|
|
92
|
+
v-if="item.part === 'literal'"
|
|
93
|
+
:part="item.part"
|
|
94
|
+
type="start"
|
|
95
|
+
class="input-literal"
|
|
96
|
+
>
|
|
97
|
+
{{ item.value }}
|
|
98
|
+
</DateRangePickerInput>
|
|
99
|
+
<DateRangePickerInput
|
|
100
|
+
v-else
|
|
101
|
+
type="start"
|
|
102
|
+
:part="item.part"
|
|
103
|
+
class="
|
|
104
|
+
input
|
|
105
|
+
focus-outline-hidden
|
|
106
|
+
border
|
|
107
|
+
border-transparent
|
|
108
|
+
group
|
|
109
|
+
"
|
|
110
|
+
>
|
|
111
|
+
<div
|
|
112
|
+
class="
|
|
113
|
+
group-focus:z-[2]
|
|
114
|
+
group-focus:bg-accent-500/50
|
|
115
|
+
group-focus:rounded-xs
|
|
116
|
+
px-[2px]
|
|
117
|
+
"
|
|
118
|
+
>
|
|
119
|
+
{{ item.value }}
|
|
120
|
+
</div>
|
|
121
|
+
</DateRangePickerInput>
|
|
122
|
+
</template>
|
|
123
|
+
</div>
|
|
124
|
+
<div class="range-separator text-center px-1">
|
|
125
|
+
–
|
|
126
|
+
</div>
|
|
127
|
+
<div :class="twMerge(`end-segment flex items-center`, date.end === undefined && 'text-neutral-400')">
|
|
128
|
+
<template
|
|
129
|
+
v-for="item in segments.end"
|
|
130
|
+
:key="item.part"
|
|
131
|
+
>
|
|
132
|
+
<DateRangePickerInput
|
|
133
|
+
v-if="item.part === 'literal'"
|
|
134
|
+
:part="item.part"
|
|
135
|
+
type="end"
|
|
136
|
+
class="input-literal"
|
|
137
|
+
>
|
|
138
|
+
{{ item.value }}
|
|
139
|
+
</DateRangePickerInput>
|
|
140
|
+
<DateRangePickerInput
|
|
141
|
+
v-else
|
|
142
|
+
type="end"
|
|
143
|
+
:part="item.part"
|
|
144
|
+
class="
|
|
145
|
+
input
|
|
146
|
+
focus-outline-hidden
|
|
147
|
+
border
|
|
148
|
+
border-transparent
|
|
149
|
+
group
|
|
150
|
+
"
|
|
151
|
+
>
|
|
152
|
+
<div
|
|
153
|
+
class="
|
|
154
|
+
group-focus:z-[2]
|
|
155
|
+
group-focus:bg-accent-500/50
|
|
156
|
+
group-focus:rounded-xs
|
|
157
|
+
px-[2px]
|
|
158
|
+
"
|
|
159
|
+
>
|
|
160
|
+
{{ item.value }}
|
|
161
|
+
</div>
|
|
162
|
+
</DateRangePickerInput>
|
|
163
|
+
</template>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
<DateRangePickerTrigger
|
|
167
|
+
class="
|
|
168
|
+
trigger
|
|
169
|
+
px-1
|
|
170
|
+
focus-outline
|
|
171
|
+
rounded-tr-sm
|
|
172
|
+
rounded-br-sm
|
|
173
|
+
bg-bg
|
|
174
|
+
border-l
|
|
175
|
+
border-neutral-300
|
|
176
|
+
dark:border-neutral-700
|
|
177
|
+
dark:bg-neutral-800
|
|
178
|
+
"
|
|
179
|
+
>
|
|
180
|
+
<Icon>
|
|
181
|
+
<i-radix-icons-calendar/>
|
|
182
|
+
</Icon>
|
|
183
|
+
</DateRangePickerTrigger>
|
|
184
|
+
</DateRangePickerField>
|
|
185
|
+
|
|
186
|
+
<!-- @vue-expect-error to exists -->
|
|
187
|
+
<DateRangePickerContent
|
|
188
|
+
:side-offset="4"
|
|
189
|
+
to="#root"
|
|
190
|
+
class="
|
|
191
|
+
mx-2
|
|
192
|
+
rounded-sm
|
|
193
|
+
bg-bg
|
|
194
|
+
dark:bg-neutral-800
|
|
195
|
+
border
|
|
196
|
+
border-neutral-300
|
|
197
|
+
dark:border-neutral-700
|
|
198
|
+
shadow-lg
|
|
199
|
+
will-change-[transform,opacity]
|
|
200
|
+
data-[state=open]:data-[side=top]:animate-slideDownAndFade
|
|
201
|
+
data-[state=open]:data-[side=right]:animate-slideLeftAndFade
|
|
202
|
+
data-[state=open]:data-[side=bottom]:animate-slideUpAndFade
|
|
203
|
+
data-[state=open]:data-[side=left]:animate-slideRightAndFade
|
|
204
|
+
text-fg
|
|
205
|
+
dark:text-neutral-200
|
|
206
|
+
"
|
|
207
|
+
>
|
|
208
|
+
<DateRangePickerArrow class="fill-neutral-500"/>
|
|
209
|
+
<DateRangePickerCalendar
|
|
210
|
+
v-slot="{ weekDays, grid }"
|
|
211
|
+
class="p-2 flex flex-col"
|
|
212
|
+
>
|
|
213
|
+
<DateRangePickerHeader class="flex items-center justify-between">
|
|
214
|
+
<DateRangePickerPrev
|
|
215
|
+
class="
|
|
216
|
+
inline-flex
|
|
217
|
+
items-center
|
|
218
|
+
cursor-pointer
|
|
219
|
+
active:scale-125
|
|
220
|
+
justify-center
|
|
221
|
+
rounded-sm
|
|
222
|
+
outlined
|
|
223
|
+
px-1
|
|
224
|
+
"
|
|
225
|
+
:prev-page="(date: DateValue) => date.subtract({ years: 1 })"
|
|
226
|
+
>
|
|
227
|
+
<Icon class="scale-150">
|
|
228
|
+
<i-radix-icons-double-arrow-left/>
|
|
229
|
+
</Icon>
|
|
230
|
+
</DateRangePickerPrev>
|
|
231
|
+
<DateRangePickerPrev
|
|
232
|
+
class="
|
|
233
|
+
inline-flex
|
|
234
|
+
items-center
|
|
235
|
+
cursor-pointer
|
|
236
|
+
active:scale-125
|
|
237
|
+
justify-center
|
|
238
|
+
rounded-sm
|
|
239
|
+
outlined
|
|
240
|
+
px-1
|
|
241
|
+
"
|
|
242
|
+
>
|
|
243
|
+
<Icon class="scale-150">
|
|
244
|
+
<i-radix-icons-chevron-left/>
|
|
245
|
+
</Icon>
|
|
246
|
+
</DateRangePickerPrev>
|
|
247
|
+
|
|
248
|
+
<DateRangePickerHeading class="min-w-[14ch] text-center"/>
|
|
249
|
+
<DateRangePickerNext
|
|
250
|
+
class="
|
|
251
|
+
inline-flex
|
|
252
|
+
items-center
|
|
253
|
+
cursor-pointer
|
|
254
|
+
active:scale-125
|
|
255
|
+
justify-center
|
|
256
|
+
rounded-sm
|
|
257
|
+
outlined
|
|
258
|
+
px-1
|
|
259
|
+
"
|
|
260
|
+
>
|
|
261
|
+
<Icon class="scale-150">
|
|
262
|
+
<i-radix-icons-chevron-right/>
|
|
263
|
+
</Icon>
|
|
264
|
+
</DateRangePickerNext>
|
|
265
|
+
<DateRangePickerNext
|
|
266
|
+
class="
|
|
267
|
+
inline-flex
|
|
268
|
+
items-center
|
|
269
|
+
cursor-pointer
|
|
270
|
+
active:scale-125
|
|
271
|
+
justify-center
|
|
272
|
+
rounded-sm
|
|
273
|
+
outlined
|
|
274
|
+
px-1
|
|
275
|
+
"
|
|
276
|
+
:next-page="(date: DateValue) => date.add({ years: 1 })"
|
|
277
|
+
>
|
|
278
|
+
<Icon class="scale-150">
|
|
279
|
+
<i-radix-icons-double-arrow-right/>
|
|
280
|
+
</Icon>
|
|
281
|
+
</DateRangePickerNext>
|
|
282
|
+
</DateRangePickerHeader>
|
|
283
|
+
<div
|
|
284
|
+
class="
|
|
285
|
+
flex
|
|
286
|
+
flex-col
|
|
287
|
+
pt-4
|
|
288
|
+
"
|
|
289
|
+
>
|
|
290
|
+
<DateRangePickerGrid
|
|
291
|
+
class="border-collapse select-none"
|
|
292
|
+
v-for="month in grid"
|
|
293
|
+
:key="month.value.toString()"
|
|
294
|
+
>
|
|
295
|
+
<DateRangePickerGridHead>
|
|
296
|
+
<DateRangePickerGridRow class="mb-1 flex justify-between">
|
|
297
|
+
<DateRangePickerHeadCell
|
|
298
|
+
class="
|
|
299
|
+
w-6
|
|
300
|
+
rounded-md
|
|
301
|
+
text-xs
|
|
302
|
+
text-accent-500
|
|
303
|
+
"
|
|
304
|
+
v-for="day in weekDays"
|
|
305
|
+
:key="day"
|
|
306
|
+
>
|
|
307
|
+
{{ day }}
|
|
308
|
+
</DateRangePickerHeadCell>
|
|
309
|
+
</DateRangePickerGridRow>
|
|
310
|
+
</DateRangePickerGridHead>
|
|
311
|
+
<DateRangePickerGridBody>
|
|
312
|
+
<DateRangePickerGridRow
|
|
313
|
+
class="flex w-full justify-between my-1"
|
|
314
|
+
v-for="(weekDates, index) in month.rows"
|
|
315
|
+
:key="`weekDate-${index}`"
|
|
316
|
+
>
|
|
317
|
+
<DateRangePickerCell
|
|
318
|
+
:date="weekDate"
|
|
319
|
+
v-for="weekDate in weekDates"
|
|
320
|
+
:key="weekDate.toString()"
|
|
321
|
+
>
|
|
322
|
+
<DateRangePickerCellTrigger
|
|
323
|
+
:day="weekDate"
|
|
324
|
+
:month="month.value"
|
|
325
|
+
class="
|
|
326
|
+
relative
|
|
327
|
+
flex
|
|
328
|
+
items-center
|
|
329
|
+
justify-center
|
|
330
|
+
whitespace-nowrap
|
|
331
|
+
rounded-sm
|
|
332
|
+
border
|
|
333
|
+
border-transparent
|
|
334
|
+
bg-transparent
|
|
335
|
+
text-sm
|
|
336
|
+
w-6
|
|
337
|
+
h-6
|
|
338
|
+
focus:shadow
|
|
339
|
+
focus-outline
|
|
340
|
+
hover:border-accent-500
|
|
341
|
+
data-[selected]:bg-accent-700
|
|
342
|
+
data-[selected]:shadow
|
|
343
|
+
data-[disabled]:text-neutral-500
|
|
344
|
+
data-[selected]:text-white
|
|
345
|
+
data-[unavailable]:pointer-events-none
|
|
346
|
+
data-[unavailable]:text-neutral-500
|
|
347
|
+
data-[unavailable]:line-through
|
|
348
|
+
before:absolute
|
|
349
|
+
before:bottom-[1px]
|
|
350
|
+
before:hidden
|
|
351
|
+
before:rounded-full
|
|
352
|
+
before:w-4
|
|
353
|
+
before:h-[2px]
|
|
354
|
+
before:bg-white
|
|
355
|
+
data-[today]:before:block
|
|
356
|
+
data-[today]:before:bg-accent-500
|
|
357
|
+
data-[selected]:before:bg-white
|
|
358
|
+
"
|
|
359
|
+
/>
|
|
360
|
+
</DateRangePickerCell>
|
|
361
|
+
</DateRangePickerGridRow>
|
|
362
|
+
</DateRangePickerGridBody>
|
|
363
|
+
</DateRangePickerGrid>
|
|
364
|
+
</div>
|
|
365
|
+
<slot v-bind="{tempValue: tempDate}"/>
|
|
366
|
+
<slot/>
|
|
367
|
+
</DateRangePickerCalendar>
|
|
368
|
+
</DateRangePickerContent>
|
|
369
|
+
</DateRangePickerRoot>
|
|
370
|
+
</template>
|