From 38f4239ff96f5435b8b94d402def45bdcdf9b8fb Mon Sep 17 00:00:00 2001 From: Valentin Hutter Date: Thu, 11 Jan 2024 22:00:11 +0100 Subject: [PATCH 1/4] feat: add style to work with v-calendar time picker (#243) --- .../registry/default/ui/calendar/Calendar.vue | 45 +++++++++++++++++++ .../new-york/ui/calendar/Calendar.vue | 45 +++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue b/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue index 181a43da3..c1e6a85f9 100644 --- a/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue +++ b/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue @@ -236,4 +236,49 @@ onMounted(async () => { -webkit-transform: translateY(calc(-1 * var(--vc-slide-translate))); transform: translateY(calc(-1 * var(--vc-slide-translate))); } +/** + * Timepicker styles + */ +.vc-time-picker { + @apply flex flex-col items-center p-2; +} +.vc-time-picker.vc-invalid { + @apply pointer-events-none opacity-50; +} +.vc-time-picker.vc-attached { + @apply border-t border-solid border-secondary; +} +.vc-time-picker > * + * { + @apply mt-1; +} +.vc-time-header { + @apply flex items-center text-sm font-semibold uppercase mt-1 px-1 leading-6; +} +.vc-time-select-group { + @apply inline-flex items-center px-1 rounded-md bg-primary-foreground border border-solid border-secondary; +} +.vc-time-select-group .vc-base-icon { + @apply mr-1 text-primary stroke-primary; +} +.vc-time-select-group select { + @apply bg-transparent p-1 appearance-none outline-none text-center; +} +.vc-time-weekday { + @apply text-muted-foreground tracking-wide; +} +.vc-time-month { + @apply text-primary ml-2; +} +.vc-time-day { + @apply text-primary ml-1; +} +.vc-time-year { + @apply text-muted-foreground ml-2; +} +.vc-time-colon { + @apply mb-0.5; +} +.vc-time-decimal { + @apply ml-0.5; +} diff --git a/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue b/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue index 580e60977..398f12c28 100644 --- a/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue +++ b/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue @@ -242,4 +242,49 @@ onMounted(async () => { -webkit-transform: translateY(calc(-1 * var(--vc-slide-translate))); transform: translateY(calc(-1 * var(--vc-slide-translate))); } +/** + * Timepicker styles + */ +.vc-time-picker { + @apply flex flex-col items-center p-2; +} +.vc-time-picker.vc-invalid { + @apply pointer-events-none opacity-50; +} +.vc-time-picker.vc-attached { + @apply border-t border-solid border-secondary; +} +.vc-time-picker > * + * { + @apply mt-1; +} +.vc-time-header { + @apply flex items-center text-sm font-semibold uppercase mt-1 px-1 leading-6; +} +.vc-time-select-group { + @apply inline-flex items-center px-1 rounded-md bg-primary-foreground border border-solid border-secondary; +} +.vc-time-select-group .vc-base-icon { + @apply mr-1 text-primary stroke-primary; +} +.vc-time-select-group select { + @apply bg-transparent p-1 appearance-none outline-none text-center; +} +.vc-time-weekday { + @apply text-muted-foreground tracking-wide; +} +.vc-time-month { + @apply text-primary ml-2; +} +.vc-time-day { + @apply text-primary ml-1; +} +.vc-time-year { + @apply text-muted-foreground ml-2; +} +.vc-time-colon { + @apply mb-0.5; +} +.vc-time-decimal { + @apply ml-0.5; +} From c6fe91cd7da7e4c0cafe171b28f9cf947ee68edd Mon Sep 17 00:00:00 2001 From: Valentin Hutter Date: Thu, 11 Jan 2024 22:16:51 +0100 Subject: [PATCH 2/4] docs: add datetime picker to doc + build registery --- apps/www/__registry__/index.ts | 14 ++++++++ .../content/docs/components/date-picker.md | 4 +++ .../default/example/DateTimePickerDemo.vue | 36 +++++++++++++++++++ .../new-york/example/DateTimePickerDemo.vue | 36 +++++++++++++++++++ .../registry/styles/default/calendar.json | 2 +- .../registry/styles/new-york/calendar.json | 2 +- 6 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue create mode 100644 apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue diff --git a/apps/www/__registry__/index.ts b/apps/www/__registry__/index.ts index 9088c48db..404c73f98 100644 --- a/apps/www/__registry__/index.ts +++ b/apps/www/__registry__/index.ts @@ -359,6 +359,13 @@ export const Index = { component: () => import('../src/lib/registry/default/example/DatePickerWithRange.vue').then(m => m.default), files: ['../src/lib/registry/default/example/DatePickerWithRange.vue'], }, + DateTimePickerDemo: { + name: 'DateTimePickerDemo', + type: 'components:example', + registryDependencies: ['utils', 'button', 'calendar', 'popover'], + component: () => import('../src/lib/registry/default/example/DateTimePickerDemo.vue').then(m => m.default), + files: ['../src/lib/registry/default/example/DateTimePickerDemo.vue'], + }, DialogCustomCloseButton: { name: 'DialogCustomCloseButton', type: 'components:example', @@ -1194,6 +1201,13 @@ export const Index = { component: () => import('../src/lib/registry/new-york/example/DatePickerWithRange.vue').then(m => m.default), files: ['../src/lib/registry/new-york/example/DatePickerWithRange.vue'], }, + DateTimePickerDemo: { + name: 'DateTimePickerDemo', + type: 'components:example', + registryDependencies: ['utils', 'button', 'calendar', 'popover'], + component: () => import('../src/lib/registry/new-york/example/DateTimePickerDemo.vue').then(m => m.default), + files: ['../src/lib/registry/new-york/example/DateTimePickerDemo.vue'], + }, DialogCustomCloseButton: { name: 'DialogCustomCloseButton', type: 'components:example', diff --git a/apps/www/src/content/docs/components/date-picker.md b/apps/www/src/content/docs/components/date-picker.md index 43aef1494..d2070ad20 100644 --- a/apps/www/src/content/docs/components/date-picker.md +++ b/apps/www/src/content/docs/components/date-picker.md @@ -64,6 +64,10 @@ const date = ref() +### Date Time Picker + + + ### With Presets diff --git a/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue b/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue new file mode 100644 index 000000000..c1e094538 --- /dev/null +++ b/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue @@ -0,0 +1,36 @@ + + + diff --git a/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue b/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue new file mode 100644 index 000000000..57434c6ee --- /dev/null +++ b/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue @@ -0,0 +1,36 @@ + + + diff --git a/apps/www/src/public/registry/styles/default/calendar.json b/apps/www/src/public/registry/styles/default/calendar.json index 585f8f5ac..4a3376af1 100644 --- a/apps/www/src/public/registry/styles/default/calendar.json +++ b/apps/www/src/public/registry/styles/default/calendar.json @@ -11,7 +11,7 @@ "files": [ { "name": "Calendar.vue", - "content": "\n\n\n\n\n" + "content": "\n\n\n\n\n" }, { "name": "index.ts", diff --git a/apps/www/src/public/registry/styles/new-york/calendar.json b/apps/www/src/public/registry/styles/new-york/calendar.json index b03e1e38c..f5144ae61 100644 --- a/apps/www/src/public/registry/styles/new-york/calendar.json +++ b/apps/www/src/public/registry/styles/new-york/calendar.json @@ -11,7 +11,7 @@ "files": [ { "name": "Calendar.vue", - "content": "\n\n\n\n\n" + "content": "\n\n\n\n\n" }, { "name": "index.ts", From 29b5abf8777ae7567fac7a50f9cc37e6dcfe9545 Mon Sep 17 00:00:00 2001 From: Valentin Hutter Date: Thu, 11 Jan 2024 22:28:43 +0100 Subject: [PATCH 3/4] build: build registery in apps/www --- apps/www/src/public/registry/styles/new-york/calendar.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/src/public/registry/styles/new-york/calendar.json b/apps/www/src/public/registry/styles/new-york/calendar.json index f5144ae61..580a5ae60 100644 --- a/apps/www/src/public/registry/styles/new-york/calendar.json +++ b/apps/www/src/public/registry/styles/new-york/calendar.json @@ -11,7 +11,7 @@ "files": [ { "name": "Calendar.vue", - "content": "\n\n\n\n\n" + "content": "\n\n\n\n\n" }, { "name": "index.ts", From b7bb0d119c37e12599c9a129c0fcf102990703dc Mon Sep 17 00:00:00 2001 From: Sadegh Barati Date: Fri, 12 Jan 2024 01:54:56 +0330 Subject: [PATCH 4/4] chore: tweaks and fix darkmode selectbox bg --- .../src/lib/registry/default/example/DateTimePickerDemo.vue | 2 +- apps/www/src/lib/registry/default/ui/calendar/Calendar.vue | 4 ++-- .../src/lib/registry/new-york/example/DateTimePickerDemo.vue | 2 +- apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue | 4 ++-- apps/www/src/public/registry/styles/default/calendar.json | 2 +- apps/www/src/public/registry/styles/new-york/calendar.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue b/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue index c1e094538..883f7a896 100644 --- a/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue +++ b/apps/www/src/lib/registry/default/example/DateTimePickerDemo.vue @@ -26,7 +26,7 @@ const date = ref() )" > - {{ date ? format(date, "PPP") : "Pick a date" }} + {{ date ? format(date, 'PPP - hh:mm') : "Pick a date" }} diff --git a/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue b/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue index c1e6a85f9..64f8cf3f1 100644 --- a/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue +++ b/apps/www/src/lib/registry/default/ui/calendar/Calendar.vue @@ -246,7 +246,7 @@ onMounted(async () => { @apply pointer-events-none opacity-50; } .vc-time-picker.vc-attached { - @apply border-t border-solid border-secondary; + @apply border-t border-solid border-secondary mt-2; } .vc-time-picker > * + * { @apply mt-1; @@ -261,7 +261,7 @@ onMounted(async () => { @apply mr-1 text-primary stroke-primary; } .vc-time-select-group select { - @apply bg-transparent p-1 appearance-none outline-none text-center; + @apply bg-primary-foreground p-1 appearance-none outline-none text-center; } .vc-time-weekday { @apply text-muted-foreground tracking-wide; diff --git a/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue b/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue index 57434c6ee..401d89a88 100644 --- a/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue +++ b/apps/www/src/lib/registry/new-york/example/DateTimePickerDemo.vue @@ -26,7 +26,7 @@ const date = ref() )" > - {{ date ? format(date, "PPP") : "Pick a date" }} + {{ date ? format(date, 'PPP - hh:mm') : "Pick a date" }} diff --git a/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue b/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue index 398f12c28..409b07f7c 100644 --- a/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue +++ b/apps/www/src/lib/registry/new-york/ui/calendar/Calendar.vue @@ -252,7 +252,7 @@ onMounted(async () => { @apply pointer-events-none opacity-50; } .vc-time-picker.vc-attached { - @apply border-t border-solid border-secondary; + @apply border-t border-solid border-secondary mt-2; } .vc-time-picker > * + * { @apply mt-1; @@ -267,7 +267,7 @@ onMounted(async () => { @apply mr-1 text-primary stroke-primary; } .vc-time-select-group select { - @apply bg-transparent p-1 appearance-none outline-none text-center; + @apply bg-primary-foreground p-1 appearance-none outline-none text-center; } .vc-time-weekday { @apply text-muted-foreground tracking-wide; diff --git a/apps/www/src/public/registry/styles/default/calendar.json b/apps/www/src/public/registry/styles/default/calendar.json index 4a3376af1..e8f631e2a 100644 --- a/apps/www/src/public/registry/styles/default/calendar.json +++ b/apps/www/src/public/registry/styles/default/calendar.json @@ -11,7 +11,7 @@ "files": [ { "name": "Calendar.vue", - "content": "\n\n\n\n\n" + "content": "\n\n\n\n\n" }, { "name": "index.ts", diff --git a/apps/www/src/public/registry/styles/new-york/calendar.json b/apps/www/src/public/registry/styles/new-york/calendar.json index 580a5ae60..b83d724fa 100644 --- a/apps/www/src/public/registry/styles/new-york/calendar.json +++ b/apps/www/src/public/registry/styles/new-york/calendar.json @@ -11,7 +11,7 @@ "files": [ { "name": "Calendar.vue", - "content": "\n\n\n\n\n" + "content": "\n\n\n\n\n" }, { "name": "index.ts",