@aphexcms/ui 0.1.7 → 0.2.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/dist/components/sidebar-07/+page.svelte +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog-content.svelte +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-list.svelte +1 -1
- package/dist/components/ui/calendar/calendar-caption.svelte +76 -0
- package/dist/components/ui/calendar/calendar-caption.svelte.d.ts +19 -0
- package/dist/components/ui/calendar/calendar-cell.svelte +19 -0
- package/dist/components/ui/calendar/calendar-cell.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-day.svelte +35 -0
- package/dist/components/ui/calendar/calendar-day.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-grid-body.svelte +12 -0
- package/dist/components/ui/calendar/calendar-grid-body.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-grid-head.svelte +12 -0
- package/dist/components/ui/calendar/calendar-grid-head.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-grid-row.svelte +12 -0
- package/dist/components/ui/calendar/calendar-grid-row.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-grid.svelte +16 -0
- package/dist/components/ui/calendar/calendar-grid.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-head-cell.svelte +19 -0
- package/dist/components/ui/calendar/calendar-head-cell.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-header.svelte +19 -0
- package/dist/components/ui/calendar/calendar-header.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-heading.svelte +16 -0
- package/dist/components/ui/calendar/calendar-heading.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-month-select.svelte +44 -0
- package/dist/components/ui/calendar/calendar-month-select.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar-month.svelte +15 -0
- package/dist/components/ui/calendar/calendar-month.svelte.d.ts +5 -0
- package/dist/components/ui/calendar/calendar-months.svelte +19 -0
- package/dist/components/ui/calendar/calendar-months.svelte.d.ts +5 -0
- package/dist/components/ui/calendar/calendar-nav.svelte +19 -0
- package/dist/components/ui/calendar/calendar-nav.svelte.d.ts +5 -0
- package/dist/components/ui/calendar/calendar-next-button.svelte +31 -0
- package/dist/components/ui/calendar/calendar-next-button.svelte.d.ts +8 -0
- package/dist/components/ui/calendar/calendar-prev-button.svelte +31 -0
- package/dist/components/ui/calendar/calendar-prev-button.svelte.d.ts +8 -0
- package/dist/components/ui/calendar/calendar-year-select.svelte +43 -0
- package/dist/components/ui/calendar/calendar-year-select.svelte.d.ts +4 -0
- package/dist/components/ui/calendar/calendar.svelte +115 -0
- package/dist/components/ui/calendar/calendar.svelte.d.ts +21 -0
- package/dist/components/ui/calendar/index.d.ts +19 -0
- package/dist/components/ui/calendar/index.js +21 -0
- package/dist/components/ui/card/card-footer.svelte +1 -1
- package/dist/components/ui/card/card-header.svelte +1 -1
- package/dist/components/ui/card/card-title.svelte +1 -1
- package/dist/components/ui/checkbox/checkbox.svelte +5 -5
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/components/ui/checkbox/index.d.ts +2 -2
- package/dist/components/ui/checkbox/index.js +2 -2
- package/dist/components/ui/command/command-dialog.svelte +1 -1
- package/dist/components/ui/command/command-input.svelte +2 -2
- package/dist/components/ui/command/command-item.svelte +1 -1
- package/dist/components/ui/command/command-link-item.svelte +1 -1
- package/dist/components/ui/command/command-list.svelte +1 -1
- package/dist/components/ui/dialog/dialog-content.svelte +2 -2
- package/dist/components/ui/dialog/dialog-title.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/input/input.svelte +2 -2
- package/dist/components/ui/label/label.svelte +1 -1
- package/dist/components/ui/popover/popover-content.svelte +1 -1
- package/dist/components/ui/radio-group/index.d.ts +3 -0
- package/dist/components/ui/radio-group/index.js +5 -0
- package/dist/components/ui/radio-group/radio-group-item.svelte +31 -0
- package/dist/components/ui/radio-group/radio-group-item.svelte.d.ts +4 -0
- package/dist/components/ui/radio-group/radio-group.svelte +19 -0
- package/dist/components/ui/radio-group/radio-group.svelte.d.ts +4 -0
- package/dist/components/ui/select/select-content.svelte +2 -2
- package/dist/components/ui/select/select-item.svelte +1 -1
- package/dist/components/ui/select/select-trigger.svelte +1 -1
- package/dist/components/ui/separator/separator.svelte +1 -1
- package/dist/components/ui/sheet/sheet-content.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-inset.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-menu-badge.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte +1 -0
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte.d.ts +1 -0
- package/dist/components/ui/sidebar/sidebar-menu-skeleton.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar-rail.svelte +1 -1
- package/dist/components/ui/sidebar/sidebar.svelte +3 -3
- package/dist/components/ui/sonner/index.d.ts +1 -0
- package/dist/components/ui/sonner/index.js +1 -0
- package/dist/components/ui/sonner/sonner.svelte +34 -0
- package/dist/components/ui/sonner/sonner.svelte.d.ts +4 -0
- package/dist/components/ui/switch/index.d.ts +2 -0
- package/dist/components/ui/switch/index.js +4 -0
- package/dist/components/ui/switch/switch.svelte +29 -0
- package/dist/components/ui/switch/switch.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
- package/dist/components/ui/textarea/textarea.svelte +1 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/package.json +189 -161
- package/LICENSE +0 -21
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<AppSidebar />
|
|
10
10
|
<Sidebar.Inset>
|
|
11
11
|
<header
|
|
12
|
-
class="
|
|
12
|
+
class="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12"
|
|
13
13
|
>
|
|
14
14
|
<div class="flex items-center gap-2 px-4">
|
|
15
15
|
<Sidebar.Trigger class="-ml-1" />
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
bind:ref
|
|
20
20
|
data-slot="alert-dialog-content"
|
|
21
21
|
class={cn(
|
|
22
|
-
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed
|
|
22
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
23
23
|
className
|
|
24
24
|
)}
|
|
25
25
|
{...restProps}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
bind:this={ref}
|
|
15
15
|
data-slot="breadcrumb-list"
|
|
16
16
|
class={cn(
|
|
17
|
-
'text-muted-foreground flex flex-wrap items-center gap-1.5 break-words
|
|
17
|
+
'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
|
|
18
18
|
className
|
|
19
19
|
)}
|
|
20
20
|
{...restProps}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from 'svelte';
|
|
3
|
+
import type Calendar from './calendar.svelte';
|
|
4
|
+
import CalendarMonthSelect from './calendar-month-select.svelte';
|
|
5
|
+
import CalendarYearSelect from './calendar-year-select.svelte';
|
|
6
|
+
import { DateFormatter, getLocalTimeZone, type DateValue } from '@internationalized/date';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
captionLayout,
|
|
10
|
+
months,
|
|
11
|
+
monthFormat,
|
|
12
|
+
years,
|
|
13
|
+
yearFormat,
|
|
14
|
+
month,
|
|
15
|
+
locale,
|
|
16
|
+
placeholder = $bindable(),
|
|
17
|
+
monthIndex = 0
|
|
18
|
+
}: {
|
|
19
|
+
captionLayout: ComponentProps<typeof Calendar>['captionLayout'];
|
|
20
|
+
months: ComponentProps<typeof CalendarMonthSelect>['months'];
|
|
21
|
+
monthFormat: ComponentProps<typeof CalendarMonthSelect>['monthFormat'];
|
|
22
|
+
years: ComponentProps<typeof CalendarYearSelect>['years'];
|
|
23
|
+
yearFormat: ComponentProps<typeof CalendarYearSelect>['yearFormat'];
|
|
24
|
+
month: DateValue;
|
|
25
|
+
placeholder: DateValue | undefined;
|
|
26
|
+
locale: string;
|
|
27
|
+
monthIndex: number;
|
|
28
|
+
} = $props();
|
|
29
|
+
|
|
30
|
+
function formatYear(date: DateValue) {
|
|
31
|
+
const dateObj = date.toDate(getLocalTimeZone());
|
|
32
|
+
if (typeof yearFormat === 'function') return yearFormat(dateObj.getFullYear());
|
|
33
|
+
return new DateFormatter(locale, { year: yearFormat }).format(dateObj);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function formatMonth(date: DateValue) {
|
|
37
|
+
const dateObj = date.toDate(getLocalTimeZone());
|
|
38
|
+
if (typeof monthFormat === 'function') return monthFormat(dateObj.getMonth() + 1);
|
|
39
|
+
return new DateFormatter(locale, { month: monthFormat }).format(dateObj);
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
{#snippet MonthSelect()}
|
|
44
|
+
<CalendarMonthSelect
|
|
45
|
+
{months}
|
|
46
|
+
{monthFormat}
|
|
47
|
+
value={month.month}
|
|
48
|
+
onchange={(e) => {
|
|
49
|
+
if (!placeholder) return;
|
|
50
|
+
const v = Number.parseInt(e.currentTarget.value);
|
|
51
|
+
const newPlaceholder = placeholder.set({ month: v });
|
|
52
|
+
placeholder = newPlaceholder.subtract({ months: monthIndex });
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
{/snippet}
|
|
56
|
+
|
|
57
|
+
{#snippet YearSelect()}
|
|
58
|
+
<CalendarYearSelect {years} {yearFormat} value={month.year} />
|
|
59
|
+
{/snippet}
|
|
60
|
+
|
|
61
|
+
{#if captionLayout === 'dropdown'}
|
|
62
|
+
{@render MonthSelect()}
|
|
63
|
+
{@render YearSelect()}
|
|
64
|
+
{:else if captionLayout === 'dropdown-months'}
|
|
65
|
+
{@render MonthSelect()}
|
|
66
|
+
{#if placeholder}
|
|
67
|
+
{formatYear(placeholder)}
|
|
68
|
+
{/if}
|
|
69
|
+
{:else if captionLayout === 'dropdown-years'}
|
|
70
|
+
{#if placeholder}
|
|
71
|
+
{formatMonth(placeholder)}
|
|
72
|
+
{/if}
|
|
73
|
+
{@render YearSelect()}
|
|
74
|
+
{:else}
|
|
75
|
+
{formatMonth(month)} {formatYear(month)}
|
|
76
|
+
{/if}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import type Calendar from './calendar.svelte';
|
|
3
|
+
import CalendarMonthSelect from './calendar-month-select.svelte';
|
|
4
|
+
import CalendarYearSelect from './calendar-year-select.svelte';
|
|
5
|
+
import { type DateValue } from '@internationalized/date';
|
|
6
|
+
type $$ComponentProps = {
|
|
7
|
+
captionLayout: ComponentProps<typeof Calendar>['captionLayout'];
|
|
8
|
+
months: ComponentProps<typeof CalendarMonthSelect>['months'];
|
|
9
|
+
monthFormat: ComponentProps<typeof CalendarMonthSelect>['monthFormat'];
|
|
10
|
+
years: ComponentProps<typeof CalendarYearSelect>['years'];
|
|
11
|
+
yearFormat: ComponentProps<typeof CalendarYearSelect>['yearFormat'];
|
|
12
|
+
month: DateValue;
|
|
13
|
+
placeholder: DateValue | undefined;
|
|
14
|
+
locale: string;
|
|
15
|
+
monthIndex: number;
|
|
16
|
+
};
|
|
17
|
+
declare const CalendarCaption: import("svelte").Component<$$ComponentProps, {}, "placeholder">;
|
|
18
|
+
type CalendarCaption = ReturnType<typeof CalendarCaption>;
|
|
19
|
+
export default CalendarCaption;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.CellProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.Cell
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
'relative size-(--cell-size) p-0 text-center text-sm focus-within:z-20 [&:first-child[data-selected]_[data-bits-day]]:rounded-l-md [&:last-child[data-selected]_[data-bits-day]]:rounded-r-md',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { buttonVariants } from '../button/index.js';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: CalendarPrimitive.DayProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<CalendarPrimitive.Day
|
|
14
|
+
bind:ref
|
|
15
|
+
class={cn(
|
|
16
|
+
buttonVariants({ variant: 'ghost' }),
|
|
17
|
+
'flex size-(--cell-size) flex-col items-center justify-center gap-1 p-0 leading-none font-normal whitespace-nowrap select-none',
|
|
18
|
+
'[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground [&[data-today][data-disabled]]:text-muted-foreground',
|
|
19
|
+
'data-[selected]:bg-primary dark:data-[selected]:hover:bg-accent/50 data-[selected]:text-primary-foreground',
|
|
20
|
+
// Outside months
|
|
21
|
+
'[&[data-outside-month]:not([data-selected])]:text-muted-foreground [&[data-outside-month]:not([data-selected])]:hover:text-accent-foreground',
|
|
22
|
+
// Disabled
|
|
23
|
+
'data-[disabled]:text-muted-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
24
|
+
// Unavailable
|
|
25
|
+
'data-[unavailable]:text-muted-foreground data-[unavailable]:line-through',
|
|
26
|
+
// hover
|
|
27
|
+
'dark:hover:text-accent-foreground',
|
|
28
|
+
// focus
|
|
29
|
+
'focus:border-ring focus:ring-ring/50 focus:relative',
|
|
30
|
+
// inner spans
|
|
31
|
+
'[&>span]:text-xs [&>span]:opacity-70',
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...restProps}
|
|
35
|
+
/>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.GridBodyProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.GridBody bind:ref class={cn(className)} {...restProps} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.GridHeadProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.GridHead bind:ref class={cn(className)} {...restProps} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.GridRowProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.GridRow bind:ref class={cn('flex', className)} {...restProps} />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.GridProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.Grid
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn('mt-4 flex w-full border-collapse flex-col gap-1', className)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.HeadCellProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.HeadCell
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
'text-muted-foreground w-(--cell-size) rounded-md text-[0.8rem] font-normal',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.HeaderProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.Header
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
...restProps
|
|
9
|
+
}: CalendarPrimitive.HeadingProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.Heading
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn('px-(--cell-size) text-sm font-medium', className)}
|
|
15
|
+
{...restProps}
|
|
16
|
+
/>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
|
|
4
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value,
|
|
10
|
+
onchange,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChildrenOrChild<CalendarPrimitive.MonthSelectProps> = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<span
|
|
16
|
+
class={cn(
|
|
17
|
+
'has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
>
|
|
21
|
+
<CalendarPrimitive.MonthSelect bind:ref class="absolute inset-0 opacity-0" {...restProps}>
|
|
22
|
+
{#snippet child({ props, monthItems, selectedMonthItem })}
|
|
23
|
+
<select {...props} {value} {onchange}>
|
|
24
|
+
{#each monthItems as monthItem (monthItem.value)}
|
|
25
|
+
<option
|
|
26
|
+
value={monthItem.value}
|
|
27
|
+
selected={value !== undefined
|
|
28
|
+
? monthItem.value === value
|
|
29
|
+
: monthItem.value === selectedMonthItem.value}
|
|
30
|
+
>
|
|
31
|
+
{monthItem.label}
|
|
32
|
+
</option>
|
|
33
|
+
{/each}
|
|
34
|
+
</select>
|
|
35
|
+
<span
|
|
36
|
+
class="[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm font-medium select-none [&>svg]:size-3.5"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
>
|
|
39
|
+
{monthItems.find((item) => item.value === value)?.label || selectedMonthItem.label}
|
|
40
|
+
<ChevronDownIcon class="size-4" />
|
|
41
|
+
</span>
|
|
42
|
+
{/snippet}
|
|
43
|
+
</CalendarPrimitive.MonthSelect>
|
|
44
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
2
|
+
declare const CalendarMonthSelect: import("svelte").Component<Omit<Omit<CalendarPrimitive.MonthSelectProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type CalendarMonthSelect = ReturnType<typeof CalendarMonthSelect>;
|
|
4
|
+
export default CalendarMonthSelect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type WithElementRef, cn } from '../../../utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div {...restProps} bind:this={ref} class={cn('flex flex-col', className)}>
|
|
14
|
+
{@render children?.()}
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../utils.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const CalendarMonth: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type CalendarMonth = ReturnType<typeof CalendarMonth>;
|
|
5
|
+
export default CalendarMonth;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '../../../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
class={cn('relative flex flex-col gap-4 md:flex-row', className)}
|
|
16
|
+
{...restProps}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../../../utils.js';
|
|
3
|
+
declare const CalendarMonths: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type CalendarMonths = ReturnType<typeof CalendarMonths>;
|
|
5
|
+
export default CalendarMonths;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<nav
|
|
14
|
+
{...restProps}
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
class={cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', className)}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</nav>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../utils.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const CalendarNav: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLElement>>, {}, "ref">;
|
|
4
|
+
type CalendarNav = ReturnType<typeof CalendarNav>;
|
|
5
|
+
export default CalendarNav;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
|
|
4
|
+
import { buttonVariants, type ButtonVariant } from '../button/index.js';
|
|
5
|
+
import { cn } from '../../../utils.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = 'ghost',
|
|
12
|
+
...restProps
|
|
13
|
+
}: CalendarPrimitive.NextButtonProps & {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#snippet Fallback()}
|
|
19
|
+
<ChevronRightIcon class="size-4" />
|
|
20
|
+
{/snippet}
|
|
21
|
+
|
|
22
|
+
<CalendarPrimitive.NextButton
|
|
23
|
+
bind:ref
|
|
24
|
+
class={cn(
|
|
25
|
+
buttonVariants({ variant }),
|
|
26
|
+
'size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180',
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
children={children || Fallback}
|
|
30
|
+
{...restProps}
|
|
31
|
+
/>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
2
|
+
import { type ButtonVariant } from '../button/index.js';
|
|
3
|
+
type $$ComponentProps = CalendarPrimitive.NextButtonProps & {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
declare const CalendarNextButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
7
|
+
type CalendarNextButton = ReturnType<typeof CalendarNextButton>;
|
|
8
|
+
export default CalendarNextButton;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';
|
|
4
|
+
import { buttonVariants, type ButtonVariant } from '../button/index.js';
|
|
5
|
+
import { cn } from '../../../utils.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
variant = 'ghost',
|
|
12
|
+
...restProps
|
|
13
|
+
}: CalendarPrimitive.PrevButtonProps & {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#snippet Fallback()}
|
|
19
|
+
<ChevronLeftIcon class="size-4" />
|
|
20
|
+
{/snippet}
|
|
21
|
+
|
|
22
|
+
<CalendarPrimitive.PrevButton
|
|
23
|
+
bind:ref
|
|
24
|
+
class={cn(
|
|
25
|
+
buttonVariants({ variant }),
|
|
26
|
+
'size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180',
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
children={children || Fallback}
|
|
30
|
+
{...restProps}
|
|
31
|
+
/>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
2
|
+
import { type ButtonVariant } from '../button/index.js';
|
|
3
|
+
type $$ComponentProps = CalendarPrimitive.PrevButtonProps & {
|
|
4
|
+
variant?: ButtonVariant;
|
|
5
|
+
};
|
|
6
|
+
declare const CalendarPrevButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
7
|
+
type CalendarPrevButton = ReturnType<typeof CalendarPrevButton>;
|
|
8
|
+
export default CalendarPrevButton;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
|
|
4
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
value,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChildrenOrChild<CalendarPrimitive.YearSelectProps> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
class={cn(
|
|
16
|
+
'has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<CalendarPrimitive.YearSelect bind:ref class="absolute inset-0 opacity-0" {...restProps}>
|
|
21
|
+
{#snippet child({ props, yearItems, selectedYearItem })}
|
|
22
|
+
<select {...props} {value}>
|
|
23
|
+
{#each yearItems as yearItem (yearItem.value)}
|
|
24
|
+
<option
|
|
25
|
+
value={yearItem.value}
|
|
26
|
+
selected={value !== undefined
|
|
27
|
+
? yearItem.value === value
|
|
28
|
+
: yearItem.value === selectedYearItem.value}
|
|
29
|
+
>
|
|
30
|
+
{yearItem.label}
|
|
31
|
+
</option>
|
|
32
|
+
{/each}
|
|
33
|
+
</select>
|
|
34
|
+
<span
|
|
35
|
+
class="[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm font-medium select-none [&>svg]:size-3.5"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
>
|
|
38
|
+
{yearItems.find((item) => item.value === value)?.label || selectedYearItem.label}
|
|
39
|
+
<ChevronDownIcon class="size-4" />
|
|
40
|
+
</span>
|
|
41
|
+
{/snippet}
|
|
42
|
+
</CalendarPrimitive.YearSelect>
|
|
43
|
+
</span>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
2
|
+
declare const CalendarYearSelect: import("svelte").Component<Omit<Omit<CalendarPrimitive.YearSelectProps, "child">, "children">, {}, "ref">;
|
|
3
|
+
type CalendarYearSelect = ReturnType<typeof CalendarYearSelect>;
|
|
4
|
+
export default CalendarYearSelect;
|