@witchcraft/ui 0.0.1 → 0.1.0
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.d.ts +3 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +20 -11
- 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/Icon/Icon.vue +10 -5
- package/dist/runtime/components/LibButton/LibButton.vue +41 -46
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +7 -3
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +111 -36
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +26 -9
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
- 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.stories.js +1 -1
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -8
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
- package/dist/runtime/components/LibDebug/LibDebug.vue +15 -5
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +54 -28
- package/dist/runtime/components/{LibInput/LibInput.stories.d.ts → LibInputDeprecated/LibInputDeprecated.stories.d.ts} +6 -6
- package/dist/runtime/components/{LibInput/LibInput.stories.js → LibInputDeprecated/LibInputDeprecated.stories.js} +64 -19
- package/{src/runtime/components/LibInput/LibInput.vue → dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -33
- package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +1 -1
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +5 -4
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +11 -12
- package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -10
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +2 -2
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +20 -11
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +2 -2
- package/dist/runtime/components/LibPagination/LibPagination.vue +19 -19
- package/dist/runtime/components/LibPalette/LibPalette.vue +3 -3
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +2 -2
- package/dist/runtime/components/LibPopup/LibPopup.vue +30 -66
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +3 -1
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +2 -2
- package/dist/runtime/components/LibRoot/LibRoot.vue +14 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +1 -1
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -7
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +42 -25
- package/dist/runtime/components/LibTable/LibTable.vue +8 -8
- package/dist/runtime/components/Scrolling.stories.d.ts +6 -0
- package/dist/runtime/components/Scrolling.stories.js +44 -0
- package/dist/runtime/components/Template/NAME.vue +1 -1
- package/dist/runtime/components/TestControls/TestControls.vue +1 -1
- 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 +3 -1
- 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/package.json +18 -20
- 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/Icon/Icon.vue +10 -5
- package/src/runtime/components/LibButton/LibButton.vue +41 -46
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -3
- package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -36
- 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 +25 -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 -8
- 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 -28
- 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 -33
- 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 -12
- package/src/runtime/components/LibNotifications/LibNotification.vue +19 -10
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
- package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -11
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
- package/src/runtime/components/LibPagination/LibPagination.vue +19 -19
- 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 -66
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -1
- package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -2
- 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 -7
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -25
- package/src/runtime/components/LibTable/LibTable.vue +8 -8
- 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 +3 -1
- 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/runtime/assets/style.css +0 -1
- package/dist/runtime/helpers/addValue.d.ts +0 -1
- package/dist/runtime/helpers/addValue.js +0 -8
- package/src/runtime/helpers/addValue.ts +0 -10
- /package/dist/runtime/components/{reset.stories.d.ts → Reset.stories.d.ts} +0 -0
- /package/dist/runtime/components/{reset.stories.js → Reset.stories.js} +0 -0
- /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { type DateValue, 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 "
|
|
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
6
|
import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
|
|
@@ -28,19 +28,35 @@ const props = withDefaults(defineProps<{
|
|
|
28
28
|
const locale = useInjectedLocale().timeLocale
|
|
29
29
|
|
|
30
30
|
const date = defineModel<SingleDate>({ required: true })
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
let justSet = false
|
|
33
|
+
const tempDate = ref()
|
|
34
|
+
function updateTempDate() {
|
|
33
35
|
tempDate.value = convertDateWithFallback(date.value, props)
|
|
34
|
-
}
|
|
36
|
+
}
|
|
35
37
|
|
|
38
|
+
updateTempDate()
|
|
39
|
+
|
|
40
|
+
watch(date, () => {
|
|
41
|
+
if (!justSet) {
|
|
42
|
+
updateTempDate()
|
|
43
|
+
} else {
|
|
44
|
+
justSet = false
|
|
45
|
+
}
|
|
46
|
+
})
|
|
36
47
|
watch(tempDate, () => {
|
|
48
|
+
justSet = true
|
|
37
49
|
date.value = toEmittableDate(toRaw(tempDate.value as any))
|
|
38
50
|
})
|
|
39
51
|
|
|
52
|
+
watch(() => props.timeZone, () => {
|
|
53
|
+
updateTempDate()
|
|
54
|
+
})
|
|
55
|
+
|
|
40
56
|
const interval = setInterval(() => {
|
|
41
57
|
if (!date.value) {
|
|
42
58
|
// update suggested date if none is set
|
|
43
|
-
|
|
59
|
+
updateTempDate()
|
|
44
60
|
}
|
|
45
61
|
}, props.updateInterval)
|
|
46
62
|
|
|
@@ -54,13 +70,13 @@ onBeforeUnmount(() => {
|
|
|
54
70
|
<DatePickerRoot
|
|
55
71
|
:id="id"
|
|
56
72
|
:locale="locale"
|
|
57
|
-
class="root"
|
|
73
|
+
class="date-picker--root"
|
|
58
74
|
v-model="tempDate as DateValue"
|
|
59
75
|
>
|
|
60
76
|
<DatePickerField
|
|
61
77
|
v-slot="{ segments }"
|
|
62
78
|
:class="twMerge(`
|
|
63
|
-
|
|
79
|
+
date-picker--field
|
|
64
80
|
flex items-center justify-between
|
|
65
81
|
select-none
|
|
66
82
|
data-[invalid]:border-red-500
|
|
@@ -70,7 +86,15 @@ onBeforeUnmount(() => {
|
|
|
70
86
|
(attrs as any).class)
|
|
71
87
|
"
|
|
72
88
|
>
|
|
73
|
-
<div :class="twMerge(`
|
|
89
|
+
<div :class="twMerge(`
|
|
90
|
+
date-picker--segment
|
|
91
|
+
flex
|
|
92
|
+
items-center
|
|
93
|
+
overflow-scroll
|
|
94
|
+
scrollbar-hidden
|
|
95
|
+
whitespace-nowrap
|
|
96
|
+
`, date === undefined && 'text-neutral-400')"
|
|
97
|
+
>
|
|
74
98
|
<template
|
|
75
99
|
v-for="item in segments"
|
|
76
100
|
:key="item.part"
|
|
@@ -78,7 +102,7 @@ onBeforeUnmount(() => {
|
|
|
78
102
|
<DatePickerInput
|
|
79
103
|
v-if="item.part === 'literal'"
|
|
80
104
|
:part="item.part"
|
|
81
|
-
class="
|
|
105
|
+
class="date-picker--segment-literal"
|
|
82
106
|
>
|
|
83
107
|
{{ item.value }}
|
|
84
108
|
</DatePickerInput>
|
|
@@ -86,7 +110,7 @@ onBeforeUnmount(() => {
|
|
|
86
110
|
v-else
|
|
87
111
|
:part="item.part"
|
|
88
112
|
class="
|
|
89
|
-
input
|
|
113
|
+
date-range-picker--segment-input
|
|
90
114
|
focus-outline-hidden
|
|
91
115
|
border
|
|
92
116
|
border-transparent
|
|
@@ -95,6 +119,7 @@ onBeforeUnmount(() => {
|
|
|
95
119
|
>
|
|
96
120
|
<div
|
|
97
121
|
class="
|
|
122
|
+
date-picker--segment-value
|
|
98
123
|
group-focus:z-[2]
|
|
99
124
|
group-focus:bg-accent-500/50
|
|
100
125
|
group-focus:rounded-xs
|
|
@@ -109,7 +134,7 @@ onBeforeUnmount(() => {
|
|
|
109
134
|
|
|
110
135
|
<DatePickerTrigger
|
|
111
136
|
class="
|
|
112
|
-
trigger
|
|
137
|
+
date-picker--trigger
|
|
113
138
|
px-1
|
|
114
139
|
focus-outline
|
|
115
140
|
rounded-tr-sm
|
|
@@ -126,47 +151,64 @@ onBeforeUnmount(() => {
|
|
|
126
151
|
</Icon>
|
|
127
152
|
</DatePickerTrigger>
|
|
128
153
|
</DatePickerField>
|
|
129
|
-
|
|
130
|
-
<!-- @vue-expect-error to exists -->
|
|
154
|
+
<!-- @vue-expect-error to exists-->
|
|
131
155
|
<DatePickerContent
|
|
132
156
|
:side-offset="4"
|
|
157
|
+
:avoid-collisions="true"
|
|
158
|
+
:prioritize-position="true"
|
|
159
|
+
side="bottom"
|
|
133
160
|
to="#root"
|
|
134
161
|
class="
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
162
|
+
date-picker--content
|
|
163
|
+
z-100
|
|
164
|
+
mx-2
|
|
165
|
+
rounded-sm
|
|
166
|
+
bg-bg
|
|
167
|
+
dark:bg-neutral-800
|
|
168
|
+
border
|
|
169
|
+
border-neutral-300
|
|
170
|
+
dark:border-neutral-700
|
|
171
|
+
shadow-lg
|
|
172
|
+
will-change-[transform,opacity]
|
|
173
|
+
data-[state=open]:data-[side=top]:animate-slideDownAndFade
|
|
174
|
+
data-[state=open]:data-[side=right]:animate-slideLeftAndFade
|
|
175
|
+
data-[state=open]:data-[side=bottom]:animate-slideUpAndFade
|
|
176
|
+
data-[state=open]:data-[side=left]:animate-slideRightAndFade
|
|
177
|
+
text-fg
|
|
178
|
+
dark:text-neutral-200
|
|
179
|
+
"
|
|
151
180
|
>
|
|
152
|
-
<DatePickerArrow class="fill-neutral-500"/>
|
|
181
|
+
<DatePickerArrow class="date-picker--arrow fill-neutral-500"/>
|
|
153
182
|
<!-- 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
183
|
<DatePickerCalendar
|
|
155
184
|
v-slot="{ weekDays, grid }"
|
|
156
|
-
class="
|
|
185
|
+
class="
|
|
186
|
+
date-picker--calendar
|
|
187
|
+
p-2
|
|
188
|
+
flex
|
|
189
|
+
flex-col
|
|
190
|
+
max-w-[calc(1.2em*4+var(--spacing)*8+14ch)]
|
|
191
|
+
"
|
|
157
192
|
>
|
|
158
|
-
<DatePickerHeader class="
|
|
193
|
+
<DatePickerHeader class="
|
|
194
|
+
date-picker--header
|
|
195
|
+
flex
|
|
196
|
+
items-center
|
|
197
|
+
justify-between
|
|
198
|
+
"
|
|
199
|
+
>
|
|
159
200
|
<DatePickerPrev
|
|
160
201
|
class="
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
202
|
+
date-picker--year-prev
|
|
203
|
+
inline-flex
|
|
204
|
+
items-center
|
|
205
|
+
cursor-pointer
|
|
206
|
+
active:scale-125
|
|
207
|
+
justify-center
|
|
208
|
+
rounded-sm
|
|
209
|
+
outlined
|
|
210
|
+
px-1
|
|
211
|
+
"
|
|
170
212
|
:prev-page="(date: DateValue) => date.subtract({ years: 1 })"
|
|
171
213
|
>
|
|
172
214
|
<Icon class="scale-150">
|
|
@@ -175,15 +217,16 @@ onBeforeUnmount(() => {
|
|
|
175
217
|
</DatePickerPrev>
|
|
176
218
|
<DatePickerPrev
|
|
177
219
|
class="
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
220
|
+
date-picker--prev
|
|
221
|
+
inline-flex
|
|
222
|
+
items-center
|
|
223
|
+
cursor-pointer
|
|
224
|
+
active:scale-125
|
|
225
|
+
justify-center
|
|
226
|
+
rounded-sm
|
|
227
|
+
outlined
|
|
228
|
+
px-1
|
|
229
|
+
"
|
|
187
230
|
>
|
|
188
231
|
<Icon class="scale-150">
|
|
189
232
|
<i-radix-icons-chevron-left/>
|
|
@@ -193,15 +236,16 @@ onBeforeUnmount(() => {
|
|
|
193
236
|
<DatePickerHeading class="min-w-[14ch] text-center"/>
|
|
194
237
|
<DatePickerNext
|
|
195
238
|
class="
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
239
|
+
date-picker--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
|
+
"
|
|
205
249
|
>
|
|
206
250
|
<Icon class="scale-150">
|
|
207
251
|
<i-radix-icons-chevron-right/>
|
|
@@ -209,15 +253,16 @@ onBeforeUnmount(() => {
|
|
|
209
253
|
</DatePickerNext>
|
|
210
254
|
<DatePickerNext
|
|
211
255
|
class="
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
256
|
+
date-picker--year-next
|
|
257
|
+
inline-flex
|
|
258
|
+
items-center
|
|
259
|
+
cursor-pointer
|
|
260
|
+
active:scale-125
|
|
261
|
+
justify-center
|
|
262
|
+
rounded-sm
|
|
263
|
+
outlined
|
|
264
|
+
px-1
|
|
265
|
+
"
|
|
221
266
|
:next-page="(date: DateValue) => date.add({ years: 1 })"
|
|
222
267
|
>
|
|
223
268
|
<Icon class="scale-150">
|
|
@@ -227,25 +272,37 @@ onBeforeUnmount(() => {
|
|
|
227
272
|
</DatePickerHeader>
|
|
228
273
|
<div
|
|
229
274
|
class="
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
275
|
+
date-picker--grid-wrapper
|
|
276
|
+
flex
|
|
277
|
+
flex-col
|
|
278
|
+
pt-4
|
|
279
|
+
"
|
|
234
280
|
>
|
|
235
281
|
<DatePickerGrid
|
|
236
|
-
class="
|
|
282
|
+
class="
|
|
283
|
+
date-picker--grid
|
|
284
|
+
border-collapse
|
|
285
|
+
select-none
|
|
286
|
+
"
|
|
237
287
|
v-for="month in grid"
|
|
238
288
|
:key="month.value.toString()"
|
|
239
289
|
>
|
|
240
|
-
<DatePickerGridHead>
|
|
241
|
-
<DatePickerGridRow class="
|
|
290
|
+
<DatePickerGridHead class="date-picker--grid-head">
|
|
291
|
+
<DatePickerGridRow class="
|
|
292
|
+
date-picker--grid-row
|
|
293
|
+
mb-1
|
|
294
|
+
flex
|
|
295
|
+
justify-between
|
|
296
|
+
"
|
|
297
|
+
>
|
|
242
298
|
<DatePickerHeadCell
|
|
243
299
|
class="
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
300
|
+
date-picker--head-cell
|
|
301
|
+
w-6
|
|
302
|
+
rounded-md
|
|
303
|
+
text-xs
|
|
304
|
+
text-accent-500
|
|
305
|
+
"
|
|
249
306
|
v-for="day in weekDays"
|
|
250
307
|
:key="day"
|
|
251
308
|
>
|
|
@@ -253,14 +310,21 @@ onBeforeUnmount(() => {
|
|
|
253
310
|
</DatePickerHeadCell>
|
|
254
311
|
</DatePickerGridRow>
|
|
255
312
|
</DatePickerGridHead>
|
|
256
|
-
<DatePickerGridBody>
|
|
313
|
+
<DatePickerGridBody class="date-picker--grid-body">
|
|
257
314
|
<DatePickerGridRow
|
|
258
|
-
class="
|
|
315
|
+
class="
|
|
316
|
+
date-picker--grid-row
|
|
317
|
+
flex
|
|
318
|
+
w-full
|
|
319
|
+
justify-between
|
|
320
|
+
my-1
|
|
321
|
+
"
|
|
259
322
|
v-for="(weekDates, index) in month.rows"
|
|
260
323
|
:key="`weekDate-${index}`"
|
|
261
324
|
>
|
|
262
325
|
<DatePickerCell
|
|
263
326
|
:date="weekDate"
|
|
327
|
+
class="date-picker--cell"
|
|
264
328
|
v-for="weekDate in weekDates"
|
|
265
329
|
:key="weekDate.toString()"
|
|
266
330
|
>
|
|
@@ -268,39 +332,43 @@ onBeforeUnmount(() => {
|
|
|
268
332
|
:day="weekDate"
|
|
269
333
|
:month="month.value"
|
|
270
334
|
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
|
-
|
|
335
|
+
date-picker--cell-trigger
|
|
336
|
+
relative
|
|
337
|
+
flex
|
|
338
|
+
items-center
|
|
339
|
+
justify-center
|
|
340
|
+
whitespace-nowrap
|
|
341
|
+
rounded-sm
|
|
342
|
+
border
|
|
343
|
+
border-transparent
|
|
344
|
+
bg-transparent
|
|
345
|
+
text-sm
|
|
346
|
+
w-6
|
|
347
|
+
h-6
|
|
348
|
+
focus:shadow
|
|
349
|
+
focus-outline
|
|
350
|
+
hover:border-accent-500
|
|
351
|
+
data-[selected]:bg-accent-500
|
|
352
|
+
dark:data-[selected]:bg-accent-500/80
|
|
353
|
+
data-[selected]:shadow
|
|
354
|
+
data-[disabled]:text-neutral-500
|
|
355
|
+
data-[selected]:text-white
|
|
356
|
+
data-[unavailable]:pointer-events-none
|
|
357
|
+
data-[unavailable]:text-neutral-500
|
|
358
|
+
data-[unavailable]:line-through
|
|
359
|
+
data-[outside-view]:text-neutral-500
|
|
360
|
+
before:absolute
|
|
361
|
+
before:bottom-[1px]
|
|
362
|
+
before:hidden
|
|
363
|
+
before:rounded-full
|
|
364
|
+
before:w-4
|
|
365
|
+
before:h-[2px]
|
|
366
|
+
before:bg-white
|
|
367
|
+
data-[today]:before:block
|
|
368
|
+
data-[today]:before:bg-accent-700
|
|
369
|
+
dark:data-[today]:before:bg-accent-300
|
|
370
|
+
data-[selected]:before:bg-white
|
|
371
|
+
"
|
|
304
372
|
/>
|
|
305
373
|
</DatePickerCell>
|
|
306
374
|
</DatePickerGridRow>
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { getLocalTimeZone } from "@internationalized/date"
|
|
3
3
|
|
|
4
4
|
import { getTimeZoneList } from "../../helpers/getTimeZoneList.js"
|
|
5
|
-
import
|
|
5
|
+
import LibInputDeprecated from "../LibInputDeprecated/LibInputDeprecated.vue"
|
|
6
6
|
const timeZone = defineModel<string>({ default: getLocalTimeZone() })
|
|
7
7
|
const label = defineModel<string>("label", { default: "Time Zone" })
|
|
8
8
|
</script>
|
|
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,6 @@ const label = defineModel<string>("label", { default: "Time Zone" })
|
|
|
22
22
|
</span>
|
|
23
23
|
</slot>
|
|
24
24
|
</template>
|
|
25
|
-
</
|
|
25
|
+
</LibInputDeprecated>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="debug--wrapper
|
|
3
3
|
text-fg
|
|
4
4
|
dark:text-bg
|
|
5
5
|
flex
|
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
overflow-auto
|
|
12
12
|
"
|
|
13
13
|
>
|
|
14
|
-
<div class="flex justify-between">
|
|
15
|
-
<span class="font-bold">{{ title }}</span>
|
|
16
|
-
<LibButton class="w-min-content" @click="copy()">
|
|
14
|
+
<div class="debug--header flex justify-between">
|
|
15
|
+
<span class="debug--title font-bold">{{ title }}</span>
|
|
16
|
+
<LibButton class="debug--copy-button w-min-content" @click="copy()">
|
|
17
17
|
<icon><i-fa6-regular-copy/></icon>
|
|
18
18
|
</LibButton>
|
|
19
19
|
</div>
|
|
20
20
|
<pre v-if="value"
|
|
21
21
|
:class="`
|
|
22
|
+
debug--value
|
|
22
23
|
[tab-size:${tab}]
|
|
23
24
|
`
|
|
24
25
|
"
|
|
@@ -69,7 +70,16 @@ const findText = (children: any[]): string => {
|
|
|
69
70
|
}
|
|
70
71
|
const copy = (): void => {
|
|
71
72
|
if (navigator.clipboard) {
|
|
72
|
-
const text = props.value
|
|
73
|
+
const text = props.value
|
|
74
|
+
? getStringValue(props.value)
|
|
75
|
+
: $slots.default?.()?.[0]?.children
|
|
76
|
+
? findText([...$slots.default()[0]!.children as any[]])
|
|
77
|
+
: undefined
|
|
78
|
+
if (text === undefined) {
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.warn("Cannot copy text, can't generate string value from `getStringValue` or `the default slot`.")
|
|
81
|
+
return
|
|
82
|
+
}
|
|
73
83
|
navigator.clipboard.writeText(text).catch(() => { })
|
|
74
84
|
}
|
|
75
85
|
}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
<DevOnly>
|
|
3
3
|
<slot v-if="doShow && $attrs?.['as-child'] !== undefined"/>
|
|
4
4
|
<div v-else-if="doShow"
|
|
5
|
-
|
|
6
|
-
|
|
7
5
|
:class="twMerge(`
|
|
6
|
+
dev-only
|
|
8
7
|
border
|
|
9
8
|
border-dashed
|
|
10
9
|
border-red-500
|
|
@@ -40,7 +39,6 @@ const doShow = computed(() => props.show || injectedShow.value)
|
|
|
40
39
|
<script lang="ts">
|
|
41
40
|
interface Props {
|
|
42
41
|
show?: boolean
|
|
43
|
-
asChild?: boolean
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
// Not sure why nuxt's types aren't correctly getting detected
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- todo aria errors -->
|
|
3
|
-
<div :class="twMerge(
|
|
4
|
-
`file-input
|
|
3
|
+
<div :class="twMerge(`file-input
|
|
5
4
|
justify-center
|
|
6
5
|
border-2
|
|
7
6
|
border-dashed
|
|
@@ -9,15 +8,16 @@
|
|
|
9
8
|
focus-outline-within
|
|
10
9
|
transition-[border-color,box-shadow]
|
|
11
10
|
ease-out`,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
compact && `rounded-sm`,
|
|
12
|
+
!compact && `flex w-full flex-col items-center gap-2 rounded-xl p-2 `,
|
|
13
|
+
errors.length > 0 && errorFlashing && `border-danger-400`,
|
|
14
|
+
( $.wrapperAttrs as any ).class
|
|
16
15
|
)"
|
|
17
16
|
v-bind="{...$.wrapperAttrs, class:undefined}"
|
|
18
17
|
>
|
|
19
|
-
<div :class="twMerge(
|
|
20
|
-
|
|
18
|
+
<div :class="twMerge( `
|
|
19
|
+
file-input--wrapper
|
|
20
|
+
relative justify-center`,
|
|
21
21
|
compact && `flex gap-2`,
|
|
22
22
|
!compact && `input-wrapper
|
|
23
23
|
flex flex-col items-center
|
|
@@ -26,9 +26,14 @@
|
|
|
26
26
|
>
|
|
27
27
|
<label
|
|
28
28
|
:for="id ?? fallbackId"
|
|
29
|
-
:class="twMerge(
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
:class="twMerge( `
|
|
30
|
+
file-input--label
|
|
31
|
+
pointer-events-none
|
|
32
|
+
flex
|
|
33
|
+
gap-1
|
|
34
|
+
items-center
|
|
35
|
+
whitespace-nowrap
|
|
36
|
+
`)"
|
|
32
37
|
>
|
|
33
38
|
<slot v-if="compact || multiple || files.length === 0" name="icon">
|
|
34
39
|
<icon><i-fa6-solid-arrow-up-from-bracket/></icon>
|
|
@@ -45,22 +50,29 @@
|
|
|
45
50
|
)
|
|
46
51
|
}}
|
|
47
52
|
</slot>
|
|
48
|
-
<span
|
|
53
|
+
<span
|
|
54
|
+
v-if="compact && multiple"
|
|
55
|
+
class="file-input--label-count"
|
|
56
|
+
>
|
|
57
|
+
{{ ` (${files.length})` }}
|
|
58
|
+
</span>
|
|
49
59
|
</label>
|
|
50
|
-
<label v-if="!compact && formats?.length > 0" class="flex flex-col items-center text-sm">
|
|
60
|
+
<label v-if="!compact && formats?.length > 0" class="file-input--formats-label flex flex-col items-center text-sm">
|
|
51
61
|
<slot name="formats">{{ t("file-input.accepted-formats") }}: </slot>
|
|
52
|
-
<div class="">
|
|
62
|
+
<div class="file-input--formats-list">
|
|
53
63
|
{{ extensions.join(", ") }}
|
|
54
64
|
</div>
|
|
55
65
|
</label>
|
|
56
66
|
<input
|
|
57
67
|
:id="id ?? fallbackId"
|
|
58
|
-
:class="twMerge(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
:class="twMerge(`
|
|
69
|
+
file-input--input
|
|
70
|
+
absolute
|
|
71
|
+
inset-0
|
|
72
|
+
z-0
|
|
73
|
+
cursor-pointer
|
|
74
|
+
text-[0]
|
|
75
|
+
opacity-0
|
|
64
76
|
`,
|
|
65
77
|
($.inputAttrs as any)?.class
|
|
66
78
|
)"
|
|
@@ -75,7 +87,7 @@
|
|
|
75
87
|
<!-- click event allows event to fire even if the user picks the same file -->
|
|
76
88
|
</div>
|
|
77
89
|
<div v-if="!compact && files.length > 0"
|
|
78
|
-
:class="twMerge(`previews
|
|
90
|
+
:class="twMerge(`file-input--previews
|
|
79
91
|
flex items-stretch justify-center gap-2 flex-wrap
|
|
80
92
|
`,
|
|
81
93
|
multiple && `
|
|
@@ -84,8 +96,8 @@
|
|
|
84
96
|
($.previewsAttrs as any)?.class
|
|
85
97
|
)"
|
|
86
98
|
>
|
|
87
|
-
<div class="flex-1"/>
|
|
88
|
-
<div class="preview
|
|
99
|
+
<div class="file-input--preview-spacer flex-1"/>
|
|
100
|
+
<div class="file-input--preview-wrapper
|
|
89
101
|
z-1
|
|
90
102
|
relative
|
|
91
103
|
flex
|
|
@@ -101,7 +113,7 @@
|
|
|
101
113
|
v-for="entry of files"
|
|
102
114
|
:key="entry.file.name"
|
|
103
115
|
>
|
|
104
|
-
<div class="flex flex-initial basis-full justify-start">
|
|
116
|
+
<div class="file-input--remove-button flex flex-initial basis-full justify-start">
|
|
105
117
|
<lib-button
|
|
106
118
|
:border="false"
|
|
107
119
|
:aria-label="`Remove file ${entry.file.name}`"
|
|
@@ -111,9 +123,9 @@
|
|
|
111
123
|
</lib-button>
|
|
112
124
|
</div>
|
|
113
125
|
|
|
114
|
-
<div class="flex flex-initial basis-full justify-center">
|
|
126
|
+
<div class="file-input--preview flex flex-initial basis-full justify-center">
|
|
115
127
|
<div v-if="entry.isImg"
|
|
116
|
-
class="image
|
|
128
|
+
class="file-input--preview-image
|
|
117
129
|
bg-transparency-squares flex
|
|
118
130
|
h-[80px] flex-wrap items-center
|
|
119
131
|
justify-center
|
|
@@ -122,7 +134,7 @@
|
|
|
122
134
|
<img class="max-h-full w-auto" :src="getSrc(entry.file)">
|
|
123
135
|
</div>
|
|
124
136
|
<div v-if="!entry.isImg"
|
|
125
|
-
class="no-image
|
|
137
|
+
class="file-input--preview-no-image
|
|
126
138
|
flex h-[80px]
|
|
127
139
|
flex-1 basis-full flex-wrap items-center justify-center
|
|
128
140
|
"
|
|
@@ -130,7 +142,21 @@
|
|
|
130
142
|
<icon><i-fa6-regular-file class="text-4xl opacity-50"/></icon>
|
|
131
143
|
</div>
|
|
132
144
|
</div>
|
|
133
|
-
<div class="
|
|
145
|
+
<div class="
|
|
146
|
+
file-input--preview-filename
|
|
147
|
+
min-w-0
|
|
148
|
+
flex-1
|
|
149
|
+
basis-0
|
|
150
|
+
truncate
|
|
151
|
+
break-all
|
|
152
|
+
rounded-sm
|
|
153
|
+
p-1
|
|
154
|
+
text-sm
|
|
155
|
+
"
|
|
156
|
+
:title="entry.file.name"
|
|
157
|
+
>
|
|
158
|
+
{{ entry.file.name }}
|
|
159
|
+
</div>
|
|
134
160
|
</div>
|
|
135
161
|
|
|
136
162
|
<div class="flex-1"/>
|