@witchcraft/ui 0.2.1-beta.3 → 0.2.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/build/WitchcraftUiResolver.d.ts +2 -2
- package/dist/runtime/build/generateTheme.js +2 -2
- package/dist/runtime/components/Aria/Aria.vue +4 -2
- package/dist/runtime/components/Aria/Aria.vue.d.ts +1 -1
- package/dist/runtime/components/Icon/Icon.vue +3 -3
- package/dist/runtime/components/Icon/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/LibButton/LibButton.vue +9 -4
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +1 -1
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +3 -4
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +15 -8
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +10 -6
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibColorPicker/utils/truncate.js +1 -1
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +5 -2
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -6
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +7 -5
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +1 -1
- package/dist/runtime/components/LibDebug/LibDebug.vue +9 -4
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +1 -1
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +2 -1
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +4 -1
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +29 -13
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +2 -2
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +42 -12
- package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +3 -3
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +1 -2
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +2 -2
- package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -8
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +10 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +2 -2
- package/dist/runtime/components/LibPagination/LibPagination.vue +25 -12
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +2 -2
- package/dist/runtime/components/LibPalette/LibPalette.vue +6 -5
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +5 -5
- package/dist/runtime/components/LibPopup/LibPopup.vue +6 -4
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +3 -3
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +5 -3
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +9 -9
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +1 -1
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +2 -2
- package/dist/runtime/components/LibRoot/LibRoot.vue +11 -6
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +1 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +1 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +1 -1
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +5 -3
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +1 -1
- package/dist/runtime/components/LibTable/LibTable.vue +23 -8
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +1 -1
- package/dist/runtime/components/Template/NAME.vue +2 -3
- package/dist/runtime/components/Template/NAME.vue.d.ts +1 -1
- package/dist/runtime/components/TestControls/TestControls.vue +4 -2
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +1 -1
- package/dist/runtime/composables/useDragWithThreshold.d.ts +1 -1
- package/dist/runtime/composables/useInjectedI18n.d.ts +1 -1
- package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +1 -1
- package/dist/runtime/composables/useSetupI18n.d.ts +1 -1
- package/dist/runtime/composables/useSuggestions.d.ts +2 -2
- package/dist/runtime/helpers/NotificationHandler.d.ts +1 -1
- package/dist/runtime/helpers/base64ToImg.js +2 -2
- package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +1 -1
- package/dist/runtime/utils/notifyIfError.d.ts +1 -1
- package/package.json +4 -6
- package/src/module.ts +25 -28
- package/src/runtime/build/WitchcraftUiResolver.ts +3 -3
- package/src/runtime/build/generateTheme.ts +3 -2
- package/src/runtime/build/unpluginIconViteOptions.ts +1 -1
- package/src/runtime/components/Aria/Aria.vue +5 -6
- package/src/runtime/components/Focus.stories.ts +11 -12
- package/src/runtime/components/Icon/Icon.vue +5 -9
- package/src/runtime/components/LibButton/LibButton.stories.ts +21 -22
- package/src/runtime/components/LibButton/LibButton.vue +23 -21
- package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +6 -10
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +17 -19
- package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +8 -13
- package/src/runtime/components/LibColorInput/LibColorInput.vue +49 -45
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +14 -18
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +50 -52
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -2
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -2
- package/src/runtime/components/LibColorPicker/utils/truncate.ts +1 -2
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +5 -8
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
- package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +14 -15
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +1 -2
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +13 -13
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +9 -8
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +2 -1
- package/src/runtime/components/LibDatePicker/helpers.ts +0 -2
- package/src/runtime/components/LibDebug/LibDebug.stories.ts +11 -15
- package/src/runtime/components/LibDebug/LibDebug.vue +14 -11
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +8 -4
- package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +12 -15
- package/src/runtime/components/LibFileInput/LibFileInput.vue +65 -47
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +59 -67
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +73 -48
- package/src/runtime/components/LibLabel/LibLabel.stories.ts +4 -8
- package/src/runtime/components/LibLabel/LibLabel.vue +8 -8
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +10 -15
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +14 -18
- package/src/runtime/components/LibNotifications/LibNotification.stories.ts +30 -34
- package/src/runtime/components/LibNotifications/LibNotification.vue +27 -17
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +11 -15
- package/src/runtime/components/LibNotifications/LibNotifications.vue +21 -16
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +5 -9
- package/src/runtime/components/LibPagination/LibPagination.vue +46 -32
- package/src/runtime/components/LibPalette/LibPalette.stories.ts +3 -7
- package/src/runtime/components/LibPalette/LibPalette.vue +13 -12
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +19 -23
- package/src/runtime/components/LibPopup/LibPopup.vue +31 -35
- package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +13 -17
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +36 -33
- package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +11 -12
- package/src/runtime/components/LibRecorder/LibRecorder.vue +34 -34
- package/src/runtime/components/LibRoot/LibRoot.vue +16 -12
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +20 -24
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +17 -21
- package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +16 -19
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +27 -30
- package/src/runtime/components/LibTable/LibTable.stories.ts +30 -33
- package/src/runtime/components/LibTable/LibTable.vue +38 -24
- package/src/runtime/components/Reset.stories.ts +3 -6
- package/src/runtime/components/Scrolling.stories.ts +5 -8
- package/src/runtime/components/Template/NAME.vue +11 -11
- package/src/runtime/components/Template/TemplateStory.ts +9 -10
- package/src/runtime/components/TestControls/TestControls.vue +5 -5
- package/src/runtime/components/shared/props.ts +4 -6
- package/src/runtime/components/shared/storyHelpers/playInput.ts +2 -3
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +5 -9
- package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
- package/src/runtime/composables/useAriaLabel.ts +1 -1
- package/src/runtime/composables/useDarkMode.ts +15 -19
- package/src/runtime/composables/useDragWithThreshold.ts +6 -8
- package/src/runtime/composables/useGlobalResizeObserver.ts +0 -1
- package/src/runtime/composables/useInjectedDarkMode.ts +2 -2
- package/src/runtime/composables/useInjectedI18n.ts +1 -1
- package/src/runtime/composables/useInjectedLocale.ts +3 -4
- package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +4 -4
- package/src/runtime/composables/useScrollNearContainerEdges.ts +12 -13
- package/src/runtime/composables/useSetupI18n.ts +4 -7
- package/src/runtime/composables/useSetupLocale.ts +3 -5
- package/src/runtime/composables/useSuggestions.ts +25 -30
- package/src/runtime/directives/vDetectFlex.ts +5 -8
- package/src/runtime/directives/vExtractRootEl.ts +1 -1
- package/src/runtime/directives/vResizableCols.ts +3 -7
- package/src/runtime/directives/vResizeObserver.ts +1 -2
- package/src/runtime/globalResizeObserver.ts +0 -1
- package/src/runtime/helpers/NotificationHandler.ts +8 -12
- package/src/runtime/helpers/base64ToImg.ts +2 -3
- package/src/runtime/helpers/createNoonUtcDate.ts +0 -1
- package/src/runtime/helpers/defaultTranslationFunction.ts +0 -1
- package/src/runtime/helpers/getTimeZoneList.ts +0 -1
- package/src/runtime/helpers/readFile.ts +2 -2
- package/src/runtime/helpers/resizeObserverWrapper.ts +0 -1
- package/src/runtime/helpers/storybook.ts +2 -3
- package/src/runtime/main.lib.ts +0 -2
- package/src/runtime/nuxt/plugins/vue-plugin.ts +4 -5
- package/src/runtime/tailwind/themeConvertionOpts.ts +3 -4
- package/src/runtime/theme.ts +0 -1
- package/src/runtime/types/index.ts +3 -4
- package/src/runtime/utils/notifyIfError.ts +2 -2
- package/src/runtime/utils/twMerge.ts +2 -2
- package/src/runtime/vue/VueComponentsPlugin.ts +1 -2
- package/src/runtime/vue/registerComponents.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<lib-button
|
|
3
|
-
v-bind="{...$attrs, class:undefined}"
|
|
3
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
4
4
|
:class="!($attrs as any).unstyle && twMerge(`
|
|
5
5
|
dark-mode-switcher
|
|
6
6
|
rounded-full
|
|
@@ -19,15 +19,19 @@
|
|
|
19
19
|
<component :is="darkModeState==='dark' ? IFaSolidMoon : darkModeState==='light' ? IPhSunBold : IFa6SolidCircleHalfStroke"/>
|
|
20
20
|
</icon>
|
|
21
21
|
</template>
|
|
22
|
-
<template
|
|
22
|
+
<template
|
|
23
|
+
#default
|
|
24
|
+
v-if="showLabel"
|
|
25
|
+
>
|
|
23
26
|
<div class="dark-mode-switcher--label pr-[2px]">
|
|
24
27
|
{{ t(`dark-mode-switcher.${darkModeState}`) }}
|
|
25
28
|
</div>
|
|
26
29
|
</template>
|
|
27
30
|
</lib-button>
|
|
28
31
|
</template>
|
|
32
|
+
|
|
29
33
|
<script lang="ts" setup>
|
|
30
|
-
import { type ButtonHTMLAttributes,onMounted,useAttrs, watch } from "vue"
|
|
34
|
+
import { type ButtonHTMLAttributes, onMounted, useAttrs, watch } from "vue"
|
|
31
35
|
|
|
32
36
|
import IFaSolidMoon from "~icons/fa-solid/moon"
|
|
33
37
|
import IFa6SolidCircleHalfStroke from "~icons/fa6-solid/circle-half-stroke"
|
|
@@ -40,7 +44,6 @@ import Icon from "../Icon/Icon.vue"
|
|
|
40
44
|
import LibButton from "../LibButton/LibButton.vue"
|
|
41
45
|
import type { TailwindClassProp } from "../shared/props.js"
|
|
42
46
|
|
|
43
|
-
|
|
44
47
|
const t = useInjectedI18n()
|
|
45
48
|
|
|
46
49
|
const emit = defineEmits<{
|
|
@@ -53,14 +56,12 @@ const $attrs = useAttrs()
|
|
|
53
56
|
|
|
54
57
|
withDefaults(defineProps<Props>(), { showLabel: true })
|
|
55
58
|
|
|
56
|
-
|
|
57
59
|
const {
|
|
58
60
|
darkMode,
|
|
59
61
|
cycleDarkMode,
|
|
60
|
-
darkModeState
|
|
62
|
+
darkModeState
|
|
61
63
|
} = useInjectedDarkMode()
|
|
62
64
|
|
|
63
|
-
|
|
64
65
|
watch(darkMode, value => emit("update:darkMode", value))
|
|
65
66
|
watch(darkModeState, value => emit("update:darkModeState", value))
|
|
66
67
|
|
|
@@ -68,9 +69,10 @@ onMounted(() => {
|
|
|
68
69
|
emit("update:darkMode", darkMode.value)
|
|
69
70
|
})
|
|
70
71
|
</script>
|
|
72
|
+
|
|
71
73
|
<script lang="ts">
|
|
72
74
|
export default {
|
|
73
|
-
name: "
|
|
75
|
+
name: "LibDarkModeSwitcher"
|
|
74
76
|
}
|
|
75
77
|
type RealProps = {
|
|
76
78
|
showLabel?: boolean
|
|
@@ -79,7 +81,7 @@ type RealProps = {
|
|
|
79
81
|
interface Props
|
|
80
82
|
extends
|
|
81
83
|
/** @vue-ignore */
|
|
82
|
-
Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
|
|
84
|
+
Partial<Omit<ButtonHTMLAttributes, "class" | "color" | "disabled">
|
|
83
85
|
& TailwindClassProp
|
|
84
86
|
& {
|
|
85
87
|
disabled?: boolean
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import { CalendarDate,fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date"
|
|
2
|
+
import { CalendarDate, fromDate, getLocalTimeZone, toTimeZone } from "@internationalized/date"
|
|
3
3
|
import type { Meta, StoryObj } from "@storybook/vue3"
|
|
4
|
-
import { computed,ref } from "vue"
|
|
4
|
+
import { computed, ref } from "vue"
|
|
5
5
|
|
|
6
6
|
import { createNoonUtcDate } from "../../helpers/createNoonUtcDate.js"
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
8
7
|
import * as components from "../index.js"
|
|
9
8
|
|
|
10
9
|
function html(strings: TemplateStringsArray, ...values: any[]): string {
|
|
@@ -16,21 +15,20 @@ const singleMeta: Meta<typeof components.LibDatePicker> = {
|
|
|
16
15
|
args: {
|
|
17
16
|
// @ts-expect-error custom prop just for story
|
|
18
17
|
slot: "",
|
|
19
|
-
timeZone: getLocalTimeZone()
|
|
18
|
+
timeZone: getLocalTimeZone()
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
export default singleMeta
|
|
24
23
|
type Story = StoryObj<typeof components.LibDatePicker>
|
|
25
24
|
|
|
26
|
-
|
|
27
25
|
function toUTC(m: Date, timeZone: string) {
|
|
28
26
|
return toTimeZone(fromDate(m, timeZone), "UTC").toAbsoluteString()
|
|
29
27
|
}
|
|
30
28
|
export const Primary: Story = {
|
|
31
29
|
render: (args: any) => ({
|
|
32
30
|
components: {
|
|
33
|
-
...components
|
|
31
|
+
...components
|
|
34
32
|
},
|
|
35
33
|
setup: () => {
|
|
36
34
|
const modelValue = ref(args.modelValue)
|
|
@@ -41,10 +39,11 @@ export const Primary: Story = {
|
|
|
41
39
|
return m instanceof Date
|
|
42
40
|
? toUTC(m, z)
|
|
43
41
|
: typeof m === "object"
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
? `Start: ${m.start ? toUTC(m.start, z) : "undefined"}, End: ${m.end ? toUTC(m.end, z) : "undefined"}`
|
|
43
|
+
: "undefined"
|
|
46
44
|
})
|
|
47
|
-
return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate }
|
|
45
|
+
return { args, getLocalTimeZone, modelValue, timeZone, debugUtcDate }
|
|
46
|
+
},
|
|
48
47
|
template: `
|
|
49
48
|
<div>Date: {{modelValue ?? "undefined"}}</div>
|
|
50
49
|
<div>Date UTC: {{debugUtcDate}}</div>
|
|
@@ -62,15 +61,15 @@ export const Primary: Story = {
|
|
|
62
61
|
${args.slot}
|
|
63
62
|
</LibDatePicker>
|
|
64
63
|
</div>
|
|
65
|
-
|
|
66
|
-
})
|
|
64
|
+
`
|
|
65
|
+
})
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
export const DateRange: Story = {
|
|
70
69
|
...Primary,
|
|
71
70
|
args: {
|
|
72
|
-
modelValue: { start: undefined, end: undefined }
|
|
73
|
-
}
|
|
71
|
+
modelValue: { start: undefined, end: undefined }
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
export const IconTriggerFirst: Story = {
|
|
@@ -78,7 +77,7 @@ export const IconTriggerFirst: Story = {
|
|
|
78
77
|
args: {
|
|
79
78
|
...Primary.args,
|
|
80
79
|
class: "[&_.trigger]:order-first"
|
|
81
|
-
}
|
|
80
|
+
}
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
export const BottomSlot: Story = {
|
|
@@ -102,7 +101,7 @@ export const DateWithTime: Story = {
|
|
|
102
101
|
...Primary,
|
|
103
102
|
args: {
|
|
104
103
|
...Primary.args,
|
|
105
|
-
showTime: true
|
|
104
|
+
showTime: true
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
export const WithDifferentFallbackDate: Story = {
|
|
@@ -5,7 +5,7 @@ import { computed, useAttrs } from "vue"
|
|
|
5
5
|
import LibRangeDatePicker from "./LibRangeDatePicker.vue"
|
|
6
6
|
import LibSingleDatePicker from "./LibSingleDatePicker.vue"
|
|
7
7
|
|
|
8
|
-
import type { RangeDate,SingleDate } from "../../types/index.js"
|
|
8
|
+
import type { RangeDate, SingleDate } from "../../types/index.js"
|
|
9
9
|
import { getFallbackId } from "../shared/props.js"
|
|
10
10
|
|
|
11
11
|
const attrs = useAttrs()
|
|
@@ -34,7 +34,6 @@ const fallbackId = getFallbackId()
|
|
|
34
34
|
*/
|
|
35
35
|
const date = defineModel<SingleDate | RangeDate>({ required: true })
|
|
36
36
|
const isRange = computed(() => date.value !== undefined && !(date.value instanceof Date))
|
|
37
|
-
|
|
38
37
|
</script>
|
|
39
38
|
|
|
40
39
|
<template>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { CalendarDate,
|
|
2
|
+
import type { CalendarDate, DateValue, ZonedDateTime } from "@internationalized/date"
|
|
3
|
+
import { getLocalTimeZone } from "@internationalized/date"
|
|
3
4
|
import type { DateRange } from "reka-ui"
|
|
4
|
-
import { DateRangePickerArrow, DateRangePickerCalendar, DateRangePickerCell, DateRangePickerCellTrigger, DateRangePickerContent, DateRangePickerField, DateRangePickerGrid, DateRangePickerGridBody, DateRangePickerGridHead, DateRangePickerGridRow, DateRangePickerHeadCell,DateRangePickerHeader, DateRangePickerHeading, DateRangePickerInput, DateRangePickerNext, DateRangePickerPrev, DateRangePickerRoot, DateRangePickerTrigger } from "reka-ui"
|
|
5
|
+
import { DateRangePickerArrow, DateRangePickerCalendar, DateRangePickerCell, DateRangePickerCellTrigger, DateRangePickerContent, DateRangePickerField, DateRangePickerGrid, DateRangePickerGridBody, DateRangePickerGridHead, DateRangePickerGridRow, DateRangePickerHeadCell, DateRangePickerHeader, DateRangePickerHeading, DateRangePickerInput, DateRangePickerNext, DateRangePickerPrev, DateRangePickerRoot, DateRangePickerTrigger } from "reka-ui"
|
|
5
6
|
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
|
|
6
7
|
|
|
7
|
-
import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
|
|
8
|
+
import { convertDateWithFallback, getNow, toEmittableDate } from "./helpers.js"
|
|
8
9
|
|
|
9
10
|
import IRadixIconsCalendar from "~icons/radix-icons/calendar"
|
|
10
11
|
import IRadixIconsChevronLeft from "~icons/radix-icons/chevron-left"
|
|
@@ -16,6 +17,7 @@ import { useInjectedLocale } from "../../composables/useInjectedLocale.js"
|
|
|
16
17
|
import type { RangeDate } from "../../types/index.js"
|
|
17
18
|
import { twMerge } from "../../utils/twMerge.js"
|
|
18
19
|
import Icon from "../Icon/Icon.vue"
|
|
20
|
+
|
|
19
21
|
const attrs = useAttrs()
|
|
20
22
|
|
|
21
23
|
const props = withDefaults(defineProps<{
|
|
@@ -33,7 +35,6 @@ const props = withDefaults(defineProps<{
|
|
|
33
35
|
|
|
34
36
|
const date = defineModel<RangeDate>({ required: true })
|
|
35
37
|
|
|
36
|
-
|
|
37
38
|
let justSet = false
|
|
38
39
|
|
|
39
40
|
const tempDate = ref<{
|
|
@@ -71,7 +72,6 @@ watch(() => props.timeZone, () => {
|
|
|
71
72
|
updateTempDate()
|
|
72
73
|
})
|
|
73
74
|
|
|
74
|
-
|
|
75
75
|
const interval = setInterval(() => {
|
|
76
76
|
// update suggested date if none is set
|
|
77
77
|
if (!date.value.start) updateTempDate(["start"])
|
|
@@ -83,8 +83,6 @@ onBeforeUnmount(() => {
|
|
|
83
83
|
})
|
|
84
84
|
|
|
85
85
|
const locale = useInjectedLocale().timeLocale
|
|
86
|
-
|
|
87
|
-
|
|
88
86
|
</script>
|
|
89
87
|
|
|
90
88
|
<template>
|
|
@@ -106,7 +104,8 @@ const locale = useInjectedLocale().timeLocale
|
|
|
106
104
|
`, (attrs as any).class)"
|
|
107
105
|
>
|
|
108
106
|
<div class="date-range-picker--segments-input flex items-center flex-1 overflow-scroll scrollbar-hidden whitespace-nowrap">
|
|
109
|
-
<div
|
|
107
|
+
<div
|
|
108
|
+
:class="twMerge(`
|
|
110
109
|
date-range-picker--start-segment
|
|
111
110
|
flex
|
|
112
111
|
items-center
|
|
@@ -153,7 +152,8 @@ const locale = useInjectedLocale().timeLocale
|
|
|
153
152
|
<div class="date-range-picker--range-separator text-center px-1">
|
|
154
153
|
–
|
|
155
154
|
</div>
|
|
156
|
-
<div
|
|
155
|
+
<div
|
|
156
|
+
:class="twMerge(`
|
|
157
157
|
date-range-picker--end-segment
|
|
158
158
|
flex
|
|
159
159
|
items-center
|
|
@@ -219,13 +219,12 @@ const locale = useInjectedLocale().timeLocale
|
|
|
219
219
|
</DateRangePickerField>
|
|
220
220
|
|
|
221
221
|
<!-- side=bottom makes months easier to click through -->
|
|
222
|
-
<!-- @vue-expect-error to exists-->
|
|
223
222
|
<DateRangePickerContent
|
|
224
223
|
:side-offset="4"
|
|
225
224
|
:avoid-collisions="true"
|
|
226
225
|
:prioritize-position="true"
|
|
227
226
|
side="bottom"
|
|
228
|
-
|
|
227
|
+
:portal="{ to: '#root' }"
|
|
229
228
|
class="
|
|
230
229
|
date-range-picker--content
|
|
231
230
|
z-100
|
|
@@ -343,7 +342,8 @@ const locale = useInjectedLocale().timeLocale
|
|
|
343
342
|
:key="month.value.toString()"
|
|
344
343
|
>
|
|
345
344
|
<DateRangePickerGridHead class="date-range-picker--grid-head">
|
|
346
|
-
<DateRangePickerGridRow
|
|
345
|
+
<DateRangePickerGridRow
|
|
346
|
+
class="
|
|
347
347
|
date-range-picker--grid-row
|
|
348
348
|
mb-1
|
|
349
349
|
flex
|
|
@@ -430,7 +430,7 @@ const locale = useInjectedLocale().timeLocale
|
|
|
430
430
|
</DateRangePickerGridBody>
|
|
431
431
|
</DateRangePickerGrid>
|
|
432
432
|
</div>
|
|
433
|
-
<slot v-bind="{tempValue: tempDate}"/>
|
|
433
|
+
<slot v-bind="{ tempValue: tempDate }"/>
|
|
434
434
|
</DateRangePickerCalendar>
|
|
435
435
|
</DateRangePickerContent>
|
|
436
436
|
</DateRangePickerRoot>
|
|
@@ -3,7 +3,7 @@ import { type DateValue, getLocalTimeZone } from "@internationalized/date"
|
|
|
3
3
|
import { DatePickerArrow, DatePickerCalendar, DatePickerCell, DatePickerCellTrigger, DatePickerContent, DatePickerField, DatePickerGrid, DatePickerGridBody, DatePickerGridHead, DatePickerGridRow, DatePickerHeadCell, DatePickerHeader, DatePickerHeading, DatePickerInput, DatePickerNext, DatePickerPrev, DatePickerRoot, DatePickerTrigger } from "reka-ui"
|
|
4
4
|
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
|
|
5
5
|
|
|
6
|
-
import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
|
|
6
|
+
import { convertDateWithFallback, getNow, toEmittableDate } from "./helpers.js"
|
|
7
7
|
|
|
8
8
|
import IRadixIconsCalendar from "~icons/radix-icons/calendar"
|
|
9
9
|
import IRadixIconsChevronLeft from "~icons/radix-icons/chevron-left"
|
|
@@ -69,7 +69,6 @@ const interval = setInterval(() => {
|
|
|
69
69
|
onBeforeUnmount(() => {
|
|
70
70
|
clearInterval(interval)
|
|
71
71
|
})
|
|
72
|
-
|
|
73
72
|
</script>
|
|
74
73
|
|
|
75
74
|
<template>
|
|
@@ -92,7 +91,8 @@ onBeforeUnmount(() => {
|
|
|
92
91
|
(attrs as any).class)
|
|
93
92
|
"
|
|
94
93
|
>
|
|
95
|
-
<div
|
|
94
|
+
<div
|
|
95
|
+
:class="twMerge(`
|
|
96
96
|
date-picker--segment
|
|
97
97
|
flex
|
|
98
98
|
items-center
|
|
@@ -157,13 +157,12 @@ onBeforeUnmount(() => {
|
|
|
157
157
|
</Icon>
|
|
158
158
|
</DatePickerTrigger>
|
|
159
159
|
</DatePickerField>
|
|
160
|
-
<!-- @vue-expect-error to exists-->
|
|
161
160
|
<DatePickerContent
|
|
162
161
|
:side-offset="4"
|
|
163
162
|
:avoid-collisions="true"
|
|
164
163
|
:prioritize-position="true"
|
|
165
164
|
side="bottom"
|
|
166
|
-
|
|
165
|
+
:portal="{ to: '#root' }"
|
|
167
166
|
class="
|
|
168
167
|
date-picker--content
|
|
169
168
|
z-100
|
|
@@ -196,7 +195,8 @@ onBeforeUnmount(() => {
|
|
|
196
195
|
max-w-[calc(1.2em*4+var(--spacing)*8+14ch)]
|
|
197
196
|
"
|
|
198
197
|
>
|
|
199
|
-
<DatePickerHeader
|
|
198
|
+
<DatePickerHeader
|
|
199
|
+
class="
|
|
200
200
|
date-picker--header
|
|
201
201
|
flex
|
|
202
202
|
items-center
|
|
@@ -294,7 +294,8 @@ onBeforeUnmount(() => {
|
|
|
294
294
|
:key="month.value.toString()"
|
|
295
295
|
>
|
|
296
296
|
<DatePickerGridHead class="date-picker--grid-head">
|
|
297
|
-
<DatePickerGridRow
|
|
297
|
+
<DatePickerGridRow
|
|
298
|
+
class="
|
|
298
299
|
date-picker--grid-row
|
|
299
300
|
mb-1
|
|
300
301
|
flex
|
|
@@ -381,7 +382,7 @@ onBeforeUnmount(() => {
|
|
|
381
382
|
</DatePickerGridBody>
|
|
382
383
|
</DatePickerGrid>
|
|
383
384
|
</div>
|
|
384
|
-
<slot v-bind="{tempValue: tempDate}"/>
|
|
385
|
+
<slot v-bind="{ tempValue: tempDate }"/>
|
|
385
386
|
</DatePickerCalendar>
|
|
386
387
|
</DatePickerContent>
|
|
387
388
|
</DatePickerRoot>
|
|
@@ -3,9 +3,11 @@ import { getLocalTimeZone } from "@internationalized/date"
|
|
|
3
3
|
|
|
4
4
|
import { getTimeZoneList } from "../../helpers/getTimeZoneList.js"
|
|
5
5
|
import LibInputDeprecated from "../LibInputDeprecated/LibInputDeprecated.vue"
|
|
6
|
+
|
|
6
7
|
const timeZone = defineModel<string>({ default: getLocalTimeZone() })
|
|
7
8
|
const label = defineModel<string>("label", { default: "Time Zone" })
|
|
8
9
|
</script>
|
|
10
|
+
|
|
9
11
|
<template>
|
|
10
12
|
<LibInputDeprecated
|
|
11
13
|
:restrict-to-suggestions="true"
|
|
@@ -24,4 +26,3 @@ const label = defineModel<string>("label", { default: "Time Zone" })
|
|
|
24
26
|
</template>
|
|
25
27
|
</LibInputDeprecated>
|
|
26
28
|
</template>
|
|
27
|
-
|
|
@@ -40,7 +40,6 @@ export function toEmittableDate(date: ZonedDateTime | CalendarDate): Date {
|
|
|
40
40
|
: toZoned(toCalendarDateTime(date, new Time(12, 0, 0)), "UTC").toDate()
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
/**
|
|
45
44
|
* @internal
|
|
46
45
|
*
|
|
@@ -52,4 +51,3 @@ export function getNow(opts: { withTime: boolean }): ZonedDateTime | CalendarDat
|
|
|
52
51
|
}
|
|
53
52
|
return today(getLocalTimeZone())
|
|
54
53
|
}
|
|
55
|
-
|
|
@@ -4,45 +4,42 @@ import type { Meta, StoryObj } from "@storybook/vue3"
|
|
|
4
4
|
|
|
5
5
|
import LibDebug from "./LibDebug.vue"
|
|
6
6
|
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
8
7
|
import * as components from "../index.js"
|
|
9
8
|
|
|
10
|
-
|
|
11
9
|
const meta: Meta<typeof LibDebug> = {
|
|
12
10
|
component: LibDebug,
|
|
13
11
|
title: "Components/Debug",
|
|
14
12
|
args: {
|
|
15
|
-
value: { any: ["any", { value: "any" }]}
|
|
16
|
-
}
|
|
13
|
+
value: { any: ["any", { value: "any" }] }
|
|
14
|
+
}
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export default meta
|
|
20
18
|
type Story = StoryObj<typeof LibDebug>
|
|
21
19
|
|
|
22
|
-
|
|
23
20
|
export const Primary: Story = {
|
|
24
21
|
render: args => ({
|
|
25
22
|
components,
|
|
26
23
|
setup: () => ({ args }),
|
|
27
24
|
template: `
|
|
28
25
|
<lib-debug v-bind="args" />
|
|
29
|
-
|
|
30
|
-
})
|
|
26
|
+
`
|
|
27
|
+
})
|
|
31
28
|
}
|
|
32
29
|
export const WithCustomTab: Story = {
|
|
33
30
|
...Primary,
|
|
34
31
|
args: {
|
|
35
32
|
...Primary.args,
|
|
36
|
-
value: { any: ["any", { value: "any" }]},
|
|
37
|
-
tab: 2
|
|
38
|
-
}
|
|
33
|
+
value: { any: ["any", { value: "any" }] },
|
|
34
|
+
tab: 2
|
|
35
|
+
}
|
|
39
36
|
}
|
|
40
37
|
export const NoValue: Story = {
|
|
41
38
|
...Primary,
|
|
42
39
|
args: {
|
|
43
40
|
...Primary.args,
|
|
44
|
-
value: undefined
|
|
45
|
-
}
|
|
41
|
+
value: undefined
|
|
42
|
+
}
|
|
46
43
|
}
|
|
47
44
|
export const StringWithWhitespace: Story = {
|
|
48
45
|
...Primary,
|
|
@@ -52,7 +49,6 @@ export const StringWithWhitespace: Story = {
|
|
|
52
49
|
Manually
|
|
53
50
|
Indented
|
|
54
51
|
String
|
|
55
|
-
|
|
56
|
-
}
|
|
52
|
+
`
|
|
53
|
+
}
|
|
57
54
|
}
|
|
58
|
-
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="debug--wrapper
|
|
3
4
|
text-fg
|
|
4
5
|
dark:text-bg
|
|
5
6
|
flex
|
|
@@ -13,11 +14,15 @@
|
|
|
13
14
|
>
|
|
14
15
|
<div class="debug--header flex justify-between">
|
|
15
16
|
<span class="debug--title font-bold">{{ title }}</span>
|
|
16
|
-
<LibButton
|
|
17
|
+
<LibButton
|
|
18
|
+
class="debug--copy-button w-min-content"
|
|
19
|
+
@click="copy()"
|
|
20
|
+
>
|
|
17
21
|
<icon><i-fa6-regular-copy/></icon>
|
|
18
22
|
</LibButton>
|
|
19
23
|
</div>
|
|
20
|
-
<pre
|
|
24
|
+
<pre
|
|
25
|
+
v-if="value"
|
|
21
26
|
:class="`
|
|
22
27
|
debug--value
|
|
23
28
|
[tab-size:${tab}]
|
|
@@ -28,9 +33,8 @@
|
|
|
28
33
|
</div>
|
|
29
34
|
</template>
|
|
30
35
|
|
|
31
|
-
|
|
32
36
|
<script setup lang="ts">
|
|
33
|
-
import {
|
|
37
|
+
import { useSlots } from "vue"
|
|
34
38
|
|
|
35
39
|
import IFa6RegularCopy from "~icons/fa-regular/copy"
|
|
36
40
|
|
|
@@ -41,7 +45,7 @@ const $slots = useSlots()
|
|
|
41
45
|
|
|
42
46
|
const props = withDefaults(defineProps<{
|
|
43
47
|
/** The value to debug, can be anything. */
|
|
44
|
-
|
|
48
|
+
|
|
45
49
|
value?: any
|
|
46
50
|
/** Sets the tab size in css. Defaults to 3. */
|
|
47
51
|
tab?: number
|
|
@@ -49,7 +53,7 @@ const props = withDefaults(defineProps<{
|
|
|
49
53
|
}>(), {
|
|
50
54
|
tab: 3,
|
|
51
55
|
title: "Debug",
|
|
52
|
-
value: undefined
|
|
56
|
+
value: undefined
|
|
53
57
|
})
|
|
54
58
|
|
|
55
59
|
const getStringValue = (value: any): string => value === undefined
|
|
@@ -75,8 +79,8 @@ const copy = (): void => {
|
|
|
75
79
|
const text = props.value
|
|
76
80
|
? getStringValue(props.value)
|
|
77
81
|
: $slots.default?.()?.[0]?.children
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
? findText([...$slots.default()[0]!.children as any[]])
|
|
83
|
+
: undefined
|
|
80
84
|
if (text === undefined) {
|
|
81
85
|
// eslint-disable-next-line no-console
|
|
82
86
|
console.warn("Cannot copy text, can't generate string value from `getStringValue` or `the default slot`.")
|
|
@@ -88,7 +92,6 @@ const copy = (): void => {
|
|
|
88
92
|
</script>
|
|
89
93
|
|
|
90
94
|
<script lang="ts">
|
|
91
|
-
|
|
92
95
|
/**
|
|
93
96
|
* Simple debug component for displaying objects and strings with whitespace.
|
|
94
97
|
*
|
|
@@ -97,7 +100,7 @@ const copy = (): void => {
|
|
|
97
100
|
* The value can be undefined, it will just display undefined.
|
|
98
101
|
*/
|
|
99
102
|
export default {
|
|
100
|
-
name: "
|
|
103
|
+
name: "LibDebug"
|
|
101
104
|
// https://v3.vuejs.org/guide/typescript-support.html#annotating-props
|
|
102
105
|
}
|
|
103
106
|
</script>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<DevOnly>
|
|
3
3
|
<slot v-if="doShow && $attrs?.['as-child'] !== undefined"/>
|
|
4
|
-
<div
|
|
4
|
+
<div
|
|
5
|
+
v-else-if="doShow"
|
|
5
6
|
:class="twMerge(`
|
|
6
7
|
dev-only
|
|
7
8
|
border
|
|
@@ -13,17 +14,19 @@
|
|
|
13
14
|
`,
|
|
14
15
|
($attrs.class as string)
|
|
15
16
|
)"
|
|
16
|
-
v-bind="{...$attrs, class: undefined}"
|
|
17
|
+
v-bind="{ ...$attrs, class: undefined }"
|
|
17
18
|
>
|
|
18
19
|
<slot/>
|
|
19
20
|
</div>
|
|
20
21
|
</DevOnly>
|
|
21
22
|
</template>
|
|
23
|
+
|
|
22
24
|
<script lang="ts" setup>
|
|
23
25
|
import { computed, inject, ref, useAttrs } from "vue"
|
|
24
26
|
|
|
25
27
|
import { showDevOnlyInjectionKey } from "../../composables/useShowDevOnlyKey.js"
|
|
26
28
|
import { twMerge } from "../../utils/twMerge.js"
|
|
29
|
+
|
|
27
30
|
const $attrs = useAttrs()
|
|
28
31
|
|
|
29
32
|
const props = withDefaults(defineProps<{
|
|
@@ -34,10 +37,10 @@ const props = withDefaults(defineProps<{
|
|
|
34
37
|
|
|
35
38
|
const injectedShow = inject(showDevOnlyInjectionKey, ref(false))
|
|
36
39
|
const doShow = computed(() => props.show || injectedShow.value)
|
|
37
|
-
|
|
38
40
|
</script>
|
|
41
|
+
|
|
39
42
|
<script lang="ts">
|
|
40
|
-
interface Props {
|
|
43
|
+
export interface Props {
|
|
41
44
|
show?: boolean
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -45,6 +48,7 @@ interface Props {
|
|
|
45
48
|
// This should be enough to bypass the type lint error.
|
|
46
49
|
declare module "vue" {
|
|
47
50
|
export interface GlobalComponents {
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
48
52
|
DevOnly: any
|
|
49
53
|
}
|
|
50
54
|
}
|
|
@@ -4,22 +4,19 @@ import { ref } from "vue"
|
|
|
4
4
|
|
|
5
5
|
import LibFileInput from "./LibFileInput.vue"
|
|
6
6
|
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
8
7
|
import * as components from "../index.js"
|
|
9
8
|
|
|
10
|
-
|
|
11
9
|
const meta: Meta<typeof LibFileInput> = {
|
|
12
10
|
component: LibFileInput,
|
|
13
11
|
title: "Components/FileInput",
|
|
14
12
|
args: {
|
|
15
13
|
|
|
16
|
-
}
|
|
14
|
+
}
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export default meta
|
|
20
18
|
type Story = StoryObj<typeof LibFileInput>
|
|
21
19
|
|
|
22
|
-
|
|
23
20
|
export const SingleFile: Story = {
|
|
24
21
|
render: args => ({
|
|
25
22
|
components,
|
|
@@ -32,16 +29,16 @@ export const SingleFile: Story = {
|
|
|
32
29
|
},
|
|
33
30
|
template: `
|
|
34
31
|
<lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
|
|
35
|
-
|
|
36
|
-
})
|
|
32
|
+
`
|
|
33
|
+
})
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
export const MultipleFile: Story = {
|
|
40
37
|
...SingleFile,
|
|
41
38
|
args: {
|
|
42
39
|
...SingleFile.args,
|
|
43
|
-
multiple: true
|
|
44
|
-
}
|
|
40
|
+
multiple: true
|
|
41
|
+
}
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
export const AnyFormat: Story = {
|
|
@@ -49,16 +46,16 @@ export const AnyFormat: Story = {
|
|
|
49
46
|
args: {
|
|
50
47
|
...SingleFile.args,
|
|
51
48
|
multiple: true,
|
|
52
|
-
formats: []
|
|
53
|
-
}
|
|
49
|
+
formats: []
|
|
50
|
+
}
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
export const Compact: Story = {
|
|
57
54
|
...SingleFile,
|
|
58
55
|
args: {
|
|
59
56
|
...SingleFile.args,
|
|
60
|
-
compact: true
|
|
61
|
-
}
|
|
57
|
+
compact: true
|
|
58
|
+
}
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
export const ErrorHandling: Story = {
|
|
@@ -68,12 +65,12 @@ export const ErrorHandling: Story = {
|
|
|
68
65
|
const errors = ref([])
|
|
69
66
|
const errorHandler = (e: any) => errors.value = e
|
|
70
67
|
return {
|
|
71
|
-
args, errors, errorHandler
|
|
68
|
+
args, errors, errorHandler
|
|
72
69
|
}
|
|
73
70
|
},
|
|
74
71
|
template: `
|
|
75
72
|
<lib-debug :title="'Errors'">{{errors}}</lib-debug>
|
|
76
73
|
<lib-file-input v-bind="{...args}" @errors="errorHandler"></lib-file-input>
|
|
77
|
-
|
|
78
|
-
})
|
|
74
|
+
`
|
|
75
|
+
})
|
|
79
76
|
}
|