sandcms 0.6.2 → 0.6.3
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 +1 -1
- package/dist/admin/Account.svelte +284 -83
- package/dist/admin/ApiKeys.svelte +146 -79
- package/dist/admin/AssetAttachment.svelte +9 -9
- package/dist/admin/BlueprintFields.svelte +20 -2
- package/dist/admin/BlueprintFields.svelte.d.ts +2 -0
- package/dist/admin/Collection.svelte +111 -54
- package/dist/admin/Dashboard.svelte +3 -37
- package/dist/admin/DateField.svelte +75 -0
- package/dist/admin/DateField.svelte.d.ts +11 -0
- package/dist/admin/Editor.svelte +71 -65
- package/dist/admin/Fields.svelte +24 -16
- package/dist/admin/FocusPicker.svelte +1 -2
- package/dist/admin/Gallery.svelte +0 -1
- package/dist/admin/GlobalSearch.svelte +54 -26
- package/dist/admin/HoverHint.svelte +37 -0
- package/dist/admin/HoverHint.svelte.d.ts +8 -0
- package/dist/admin/Inbox.svelte +6 -11
- package/dist/admin/LinkField.svelte +129 -64
- package/dist/admin/Login.svelte +0 -1
- package/dist/admin/MediaLibrary.svelte +61 -50
- package/dist/admin/MediaPicker.svelte +57 -42
- package/dist/admin/NotificationSettings.svelte +35 -27
- package/dist/admin/RichText.svelte +2 -2
- package/dist/admin/RowMenu.svelte +28 -0
- package/dist/admin/RowMenu.svelte.d.ts +10 -0
- package/dist/admin/SearchList.svelte +51 -14
- package/dist/admin/Shell.svelte +64 -29
- package/dist/admin/Users.svelte +106 -50
- package/dist/admin/client.d.ts +2 -0
- package/dist/admin/client.js +18 -0
- package/dist/admin/components/ui/calendar/calendar-caption.svelte +76 -0
- package/dist/admin/components/ui/calendar/calendar-caption.svelte.d.ts +19 -0
- package/dist/admin/components/ui/calendar/calendar-cell.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-cell.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-day.svelte +33 -0
- package/dist/admin/components/ui/calendar/calendar-day.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-body.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-body.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-head.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-head.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid-row.svelte +12 -0
- package/dist/admin/components/ui/calendar/calendar-grid-row.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-grid.svelte +16 -0
- package/dist/admin/components/ui/calendar/calendar-grid.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-head-cell.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-head-cell.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-header.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-header.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-heading.svelte +16 -0
- package/dist/admin/components/ui/calendar/calendar-heading.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-month-select.svelte +48 -0
- package/dist/admin/components/ui/calendar/calendar-month-select.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar-month.svelte +15 -0
- package/dist/admin/components/ui/calendar/calendar-month.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-months.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-months.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-nav.svelte +19 -0
- package/dist/admin/components/ui/calendar/calendar-nav.svelte.d.ts +5 -0
- package/dist/admin/components/ui/calendar/calendar-next-button.svelte +37 -0
- package/dist/admin/components/ui/calendar/calendar-next-button.svelte.d.ts +8 -0
- package/dist/admin/components/ui/calendar/calendar-prev-button.svelte +37 -0
- package/dist/admin/components/ui/calendar/calendar-prev-button.svelte.d.ts +8 -0
- package/dist/admin/components/ui/calendar/calendar-year-select.svelte +47 -0
- package/dist/admin/components/ui/calendar/calendar-year-select.svelte.d.ts +4 -0
- package/dist/admin/components/ui/calendar/calendar.svelte +115 -0
- package/dist/admin/components/ui/calendar/calendar.svelte.d.ts +21 -0
- package/dist/admin/components/ui/calendar/index.d.ts +19 -0
- package/dist/admin/components/ui/calendar/index.js +21 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +16 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +46 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +9 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-content.svelte +31 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts +8 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-portal.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +36 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +23 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +5 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +31 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-sub.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu.svelte +7 -0
- package/dist/admin/components/ui/dropdown-menu/dropdown-menu.svelte.d.ts +3 -0
- package/dist/admin/components/ui/dropdown-menu/index.d.ts +18 -0
- package/dist/admin/components/ui/dropdown-menu/index.js +18 -0
- package/dist/admin/components/ui/input-otp/index.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/index.js +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-group.svelte +23 -0
- package/dist/admin/components/ui/input-otp/input-otp-group.svelte.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-separator.svelte +27 -0
- package/dist/admin/components/ui/input-otp/input-otp-separator.svelte.d.ts +5 -0
- package/dist/admin/components/ui/input-otp/input-otp-slot.svelte +29 -0
- package/dist/admin/components/ui/input-otp/input-otp-slot.svelte.d.ts +4 -0
- package/dist/admin/components/ui/input-otp/input-otp.svelte +24 -0
- package/dist/admin/components/ui/input-otp/input-otp.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/index.d.ts +9 -0
- package/dist/admin/components/ui/popover/index.js +11 -0
- package/dist/admin/components/ui/popover/popover-close.svelte +7 -0
- package/dist/admin/components/ui/popover/popover-close.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/popover-content.svelte +31 -0
- package/dist/admin/components/ui/popover/popover-content.svelte.d.ts +10 -0
- package/dist/admin/components/ui/popover/popover-description.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-description.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-header.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-header.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-portal.svelte +7 -0
- package/dist/admin/components/ui/popover/popover-portal.svelte.d.ts +3 -0
- package/dist/admin/components/ui/popover/popover-title.svelte +20 -0
- package/dist/admin/components/ui/popover/popover-title.svelte.d.ts +5 -0
- package/dist/admin/components/ui/popover/popover-trigger.svelte +17 -0
- package/dist/admin/components/ui/popover/popover-trigger.svelte.d.ts +4 -0
- package/dist/admin/components/ui/popover/popover.svelte +7 -0
- package/dist/admin/components/ui/popover/popover.svelte.d.ts +3 -0
- package/dist/admin/components/ui/switch/switch.svelte +2 -2
- package/dist/admin/components/ui/tooltip/index.d.ts +6 -0
- package/dist/admin/components/ui/tooltip/index.js +8 -0
- package/dist/admin/components/ui/tooltip/tooltip-content.svelte +48 -0
- package/dist/admin/components/ui/tooltip/tooltip-content.svelte.d.ts +11 -0
- package/dist/admin/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-portal.svelte.d.ts +4 -0
- package/dist/admin/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-provider.svelte.d.ts +4 -0
- package/dist/admin/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip-trigger.svelte.d.ts +25 -0
- package/dist/admin/components/ui/tooltip/tooltip.svelte +7 -0
- package/dist/admin/components/ui/tooltip/tooltip.svelte.d.ts +25 -0
- package/dist/admin/generated/admin.css +774 -138
- package/dist/admin/slug.d.ts +1 -0
- package/dist/admin/slug.js +6 -0
- package/dist/cli/index.js +0 -0
- package/dist/server/admin-load.js +2 -2
- package/dist/server/api.js +6 -1
- package/dist/server/auth.d.ts +1 -0
- package/dist/server/auth.js +23 -0
- package/docs/api.md +1 -1
- package/docs/package.md +4 -4
- package/docs/releases.md +10 -0
- package/docs/upgrades.md +9 -0
- package/package.json +5 -3
|
@@ -0,0 +1,33 @@
|
|
|
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.DayProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<CalendarPrimitive.Day
|
|
13
|
+
bind:ref
|
|
14
|
+
class={cn(
|
|
15
|
+
'flex size-(--cell-size) flex-col items-center justify-center gap-1 rounded-(--cell-radius) p-0 leading-none font-normal whitespace-nowrap select-none',
|
|
16
|
+
'[&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)',
|
|
17
|
+
'not-data-selected:hover:bg-accent/50 not-data-selected:hover:text-accent-foreground',
|
|
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 data-[selected]:text-primary-foreground data-[selected]:hover:text-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]:pointer-events-none data-[disabled]:text-muted-foreground data-[disabled]:opacity-50',
|
|
24
|
+
// Unavailable
|
|
25
|
+
'data-[unavailable]:text-muted-foreground data-[unavailable]:line-through',
|
|
26
|
+
// focus
|
|
27
|
+
'focus:relative focus:border-ring focus:ring-ring/50',
|
|
28
|
+
// inner spans
|
|
29
|
+
'[&>span]:text-xs [&>span]:opacity-70',
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...restProps}
|
|
33
|
+
/>
|
|
@@ -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('flex w-full border-collapse flex-col', 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
|
+
'w-(--cell-size) rounded-md text-[0.8rem] font-normal text-muted-foreground',
|
|
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,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
4
|
+
import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
|
|
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
|
+
'relative flex rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
>
|
|
21
|
+
<CalendarPrimitive.MonthSelect
|
|
22
|
+
bind:ref
|
|
23
|
+
class="absolute inset-0 bg-background opacity-0 dark:bg-popover dark:text-popover-foreground"
|
|
24
|
+
{...restProps}
|
|
25
|
+
>
|
|
26
|
+
{#snippet child({ props, monthItems, selectedMonthItem })}
|
|
27
|
+
<select {...props} {value} {onchange}>
|
|
28
|
+
{#each monthItems as monthItem (monthItem.value)}
|
|
29
|
+
<option
|
|
30
|
+
value={monthItem.value}
|
|
31
|
+
selected={value !== undefined
|
|
32
|
+
? monthItem.value === value
|
|
33
|
+
: monthItem.value === selectedMonthItem.value}
|
|
34
|
+
>
|
|
35
|
+
{monthItem.label}
|
|
36
|
+
</option>
|
|
37
|
+
{/each}
|
|
38
|
+
</select>
|
|
39
|
+
<span
|
|
40
|
+
class="flex h-(--cell-size) items-center gap-1 rounded-md ps-2 pe-1 text-sm font-medium select-none [&>svg]:size-3.5 [&>svg]:text-muted-foreground"
|
|
41
|
+
aria-hidden="true"
|
|
42
|
+
>
|
|
43
|
+
{monthItems.find((item) => item.value === value)?.label || selectedMonthItem.label}
|
|
44
|
+
<ChevronDownIcon class={cn('size-4', className)} />
|
|
45
|
+
</span>
|
|
46
|
+
{/snippet}
|
|
47
|
+
</CalendarPrimitive.MonthSelect>
|
|
48
|
+
</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 w-full flex-col gap-4', 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 { 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<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 WithElementRef } from '../../../utils.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
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,37 @@
|
|
|
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={cn('cn-rtl-flip size-4', className)} />
|
|
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',
|
|
27
|
+
'rtl:rotate-180',
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...restProps}
|
|
31
|
+
>
|
|
32
|
+
{#if children}
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
{:else}
|
|
35
|
+
{@render Fallback()}
|
|
36
|
+
{/if}
|
|
37
|
+
</CalendarPrimitive.NextButton>
|
|
@@ -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,37 @@
|
|
|
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={cn('cn-rtl-flip size-4', className)} />
|
|
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',
|
|
27
|
+
'rtl:rotate-180',
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...restProps}
|
|
31
|
+
>
|
|
32
|
+
{#if children}
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
{:else}
|
|
35
|
+
{@render Fallback()}
|
|
36
|
+
{/if}
|
|
37
|
+
</CalendarPrimitive.PrevButton>
|
|
@@ -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,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
4
|
+
import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
|
|
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
|
+
'relative flex rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50',
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<CalendarPrimitive.YearSelect
|
|
21
|
+
bind:ref
|
|
22
|
+
class="absolute inset-0 opacity-0 dark:bg-popover dark:text-popover-foreground"
|
|
23
|
+
{...restProps}
|
|
24
|
+
>
|
|
25
|
+
{#snippet child({ props, yearItems, selectedYearItem })}
|
|
26
|
+
<select {...props} {value}>
|
|
27
|
+
{#each yearItems as yearItem (yearItem.value)}
|
|
28
|
+
<option
|
|
29
|
+
value={yearItem.value}
|
|
30
|
+
selected={value !== undefined
|
|
31
|
+
? yearItem.value === value
|
|
32
|
+
: yearItem.value === selectedYearItem.value}
|
|
33
|
+
>
|
|
34
|
+
{yearItem.label}
|
|
35
|
+
</option>
|
|
36
|
+
{/each}
|
|
37
|
+
</select>
|
|
38
|
+
<span
|
|
39
|
+
class="flex h-(--cell-size) items-center gap-1 rounded-md ps-2 pe-1 text-sm font-medium select-none [&>svg]:size-3.5 [&>svg]:text-muted-foreground"
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
>
|
|
42
|
+
{yearItems.find((item) => item.value === value)?.label || selectedYearItem.label}
|
|
43
|
+
<ChevronDownIcon class={cn('size-4', className)} />
|
|
44
|
+
</span>
|
|
45
|
+
{/snippet}
|
|
46
|
+
</CalendarPrimitive.YearSelect>
|
|
47
|
+
</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;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isEqualMonth, type DateValue } from '@internationalized/date';
|
|
3
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
4
|
+
import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
|
|
5
|
+
import * as Calendar from './index.js';
|
|
6
|
+
import type { ButtonVariant } from '../button/button.svelte';
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
value = $bindable(),
|
|
12
|
+
placeholder = $bindable(),
|
|
13
|
+
class: className,
|
|
14
|
+
weekdayFormat = 'short',
|
|
15
|
+
buttonVariant = 'ghost',
|
|
16
|
+
captionLayout = 'label',
|
|
17
|
+
locale = 'en-US',
|
|
18
|
+
months: monthsProp,
|
|
19
|
+
years,
|
|
20
|
+
monthFormat: monthFormatProp,
|
|
21
|
+
yearFormat = 'numeric',
|
|
22
|
+
day,
|
|
23
|
+
disableDaysOutsideMonth = false,
|
|
24
|
+
...restProps
|
|
25
|
+
}: WithoutChildrenOrChild<CalendarPrimitive.RootProps> & {
|
|
26
|
+
buttonVariant?: ButtonVariant;
|
|
27
|
+
captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
|
|
28
|
+
months?: CalendarPrimitive.MonthSelectProps['months'];
|
|
29
|
+
years?: CalendarPrimitive.YearSelectProps['years'];
|
|
30
|
+
monthFormat?: CalendarPrimitive.MonthSelectProps['monthFormat'];
|
|
31
|
+
yearFormat?: CalendarPrimitive.YearSelectProps['yearFormat'];
|
|
32
|
+
day?: Snippet<[{ day: DateValue; outsideMonth: boolean }]>;
|
|
33
|
+
} = $props();
|
|
34
|
+
|
|
35
|
+
const monthFormat = $derived.by(() => {
|
|
36
|
+
if (monthFormatProp) return monthFormatProp;
|
|
37
|
+
if (captionLayout.startsWith('dropdown')) return 'short';
|
|
38
|
+
return 'long';
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<!--
|
|
43
|
+
Discriminated Unions + Destructing (required for bindable) do not
|
|
44
|
+
get along, so we shut typescript up by casting `value` to `never`.
|
|
45
|
+
-->
|
|
46
|
+
<CalendarPrimitive.Root
|
|
47
|
+
bind:value={value as never}
|
|
48
|
+
bind:ref
|
|
49
|
+
bind:placeholder
|
|
50
|
+
{weekdayFormat}
|
|
51
|
+
{disableDaysOutsideMonth}
|
|
52
|
+
class={cn(
|
|
53
|
+
'p-2 [--cell-size:--spacing(7)] group/calendar bg-background in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
{locale}
|
|
57
|
+
{monthFormat}
|
|
58
|
+
{yearFormat}
|
|
59
|
+
{...restProps}
|
|
60
|
+
>
|
|
61
|
+
{#snippet children({ months, weekdays })}
|
|
62
|
+
<Calendar.Months>
|
|
63
|
+
<Calendar.Nav>
|
|
64
|
+
<Calendar.PrevButton variant={buttonVariant} />
|
|
65
|
+
<Calendar.NextButton variant={buttonVariant} />
|
|
66
|
+
</Calendar.Nav>
|
|
67
|
+
{#each months as month, monthIndex (month)}
|
|
68
|
+
<Calendar.Month>
|
|
69
|
+
<Calendar.Header>
|
|
70
|
+
<Calendar.Caption
|
|
71
|
+
{captionLayout}
|
|
72
|
+
months={monthsProp}
|
|
73
|
+
{monthFormat}
|
|
74
|
+
{years}
|
|
75
|
+
{yearFormat}
|
|
76
|
+
month={month.value}
|
|
77
|
+
bind:placeholder
|
|
78
|
+
{locale}
|
|
79
|
+
{monthIndex}
|
|
80
|
+
/>
|
|
81
|
+
</Calendar.Header>
|
|
82
|
+
<Calendar.Grid>
|
|
83
|
+
<Calendar.GridHead>
|
|
84
|
+
<Calendar.GridRow class="select-none">
|
|
85
|
+
{#each weekdays as weekday, i (i)}
|
|
86
|
+
<Calendar.HeadCell>
|
|
87
|
+
{weekday.slice(0, 2)}
|
|
88
|
+
</Calendar.HeadCell>
|
|
89
|
+
{/each}
|
|
90
|
+
</Calendar.GridRow>
|
|
91
|
+
</Calendar.GridHead>
|
|
92
|
+
<Calendar.GridBody>
|
|
93
|
+
{#each month.weeks as weekDates (weekDates)}
|
|
94
|
+
<Calendar.GridRow class="mt-2 w-full">
|
|
95
|
+
{#each weekDates as date (date)}
|
|
96
|
+
<Calendar.Cell {date} month={month.value}>
|
|
97
|
+
{#if day}
|
|
98
|
+
{@render day({
|
|
99
|
+
day: date,
|
|
100
|
+
outsideMonth: !isEqualMonth(date, month.value)
|
|
101
|
+
})}
|
|
102
|
+
{:else}
|
|
103
|
+
<Calendar.Day />
|
|
104
|
+
{/if}
|
|
105
|
+
</Calendar.Cell>
|
|
106
|
+
{/each}
|
|
107
|
+
</Calendar.GridRow>
|
|
108
|
+
{/each}
|
|
109
|
+
</Calendar.GridBody>
|
|
110
|
+
</Calendar.Grid>
|
|
111
|
+
</Calendar.Month>
|
|
112
|
+
{/each}
|
|
113
|
+
</Calendar.Months>
|
|
114
|
+
{/snippet}
|
|
115
|
+
</CalendarPrimitive.Root>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DateValue } from '@internationalized/date';
|
|
2
|
+
import { Calendar as CalendarPrimitive } from 'bits-ui';
|
|
3
|
+
import { type WithoutChildrenOrChild } from '../../../utils.js';
|
|
4
|
+
import * as Calendar from './index.js';
|
|
5
|
+
import type { ButtonVariant } from '../button/button.svelte';
|
|
6
|
+
import type { Snippet } from 'svelte';
|
|
7
|
+
type $$ComponentProps = WithoutChildrenOrChild<CalendarPrimitive.RootProps> & {
|
|
8
|
+
buttonVariant?: ButtonVariant;
|
|
9
|
+
captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
|
|
10
|
+
months?: CalendarPrimitive.MonthSelectProps['months'];
|
|
11
|
+
years?: CalendarPrimitive.YearSelectProps['years'];
|
|
12
|
+
monthFormat?: CalendarPrimitive.MonthSelectProps['monthFormat'];
|
|
13
|
+
yearFormat?: CalendarPrimitive.YearSelectProps['yearFormat'];
|
|
14
|
+
day?: Snippet<[{
|
|
15
|
+
day: DateValue;
|
|
16
|
+
outsideMonth: boolean;
|
|
17
|
+
}]>;
|
|
18
|
+
};
|
|
19
|
+
declare const Calendar: import("svelte").Component<$$ComponentProps, {}, "ref" | "value" | "placeholder">;
|
|
20
|
+
type Calendar = ReturnType<typeof Calendar>;
|
|
21
|
+
export default Calendar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Caption from './calendar-caption.svelte';
|
|
2
|
+
import Cell from './calendar-cell.svelte';
|
|
3
|
+
import Day from './calendar-day.svelte';
|
|
4
|
+
import GridBody from './calendar-grid-body.svelte';
|
|
5
|
+
import GridHead from './calendar-grid-head.svelte';
|
|
6
|
+
import GridRow from './calendar-grid-row.svelte';
|
|
7
|
+
import Grid from './calendar-grid.svelte';
|
|
8
|
+
import HeadCell from './calendar-head-cell.svelte';
|
|
9
|
+
import Header from './calendar-header.svelte';
|
|
10
|
+
import Heading from './calendar-heading.svelte';
|
|
11
|
+
import MonthSelect from './calendar-month-select.svelte';
|
|
12
|
+
import Month from './calendar-month.svelte';
|
|
13
|
+
import Months from './calendar-months.svelte';
|
|
14
|
+
import Nav from './calendar-nav.svelte';
|
|
15
|
+
import NextButton from './calendar-next-button.svelte';
|
|
16
|
+
import PrevButton from './calendar-prev-button.svelte';
|
|
17
|
+
import YearSelect from './calendar-year-select.svelte';
|
|
18
|
+
import Root from './calendar.svelte';
|
|
19
|
+
export { Day, Cell, Grid, Header, Months, GridRow, Heading, GridBody, GridHead, HeadCell, NextButton, PrevButton, Nav, Month, YearSelect, MonthSelect, Caption, Root as Calendar };
|