@aphexcms/ui 0.1.6 → 0.1.8

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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/ui/calendar/calendar-caption.svelte +76 -0
  3. package/dist/components/ui/calendar/calendar-caption.svelte.d.ts +19 -0
  4. package/dist/components/ui/calendar/calendar-cell.svelte +19 -0
  5. package/dist/components/ui/calendar/calendar-cell.svelte.d.ts +4 -0
  6. package/dist/components/ui/calendar/calendar-day.svelte +35 -0
  7. package/dist/components/ui/calendar/calendar-day.svelte.d.ts +4 -0
  8. package/dist/components/ui/calendar/calendar-grid-body.svelte +12 -0
  9. package/dist/components/ui/calendar/calendar-grid-body.svelte.d.ts +4 -0
  10. package/dist/components/ui/calendar/calendar-grid-head.svelte +12 -0
  11. package/dist/components/ui/calendar/calendar-grid-head.svelte.d.ts +4 -0
  12. package/dist/components/ui/calendar/calendar-grid-row.svelte +12 -0
  13. package/dist/components/ui/calendar/calendar-grid-row.svelte.d.ts +4 -0
  14. package/dist/components/ui/calendar/calendar-grid.svelte +16 -0
  15. package/dist/components/ui/calendar/calendar-grid.svelte.d.ts +4 -0
  16. package/dist/components/ui/calendar/calendar-head-cell.svelte +19 -0
  17. package/dist/components/ui/calendar/calendar-head-cell.svelte.d.ts +4 -0
  18. package/dist/components/ui/calendar/calendar-header.svelte +19 -0
  19. package/dist/components/ui/calendar/calendar-header.svelte.d.ts +4 -0
  20. package/dist/components/ui/calendar/calendar-heading.svelte +16 -0
  21. package/dist/components/ui/calendar/calendar-heading.svelte.d.ts +4 -0
  22. package/dist/components/ui/calendar/calendar-month-select.svelte +44 -0
  23. package/dist/components/ui/calendar/calendar-month-select.svelte.d.ts +4 -0
  24. package/dist/components/ui/calendar/calendar-month.svelte +15 -0
  25. package/dist/components/ui/calendar/calendar-month.svelte.d.ts +5 -0
  26. package/dist/components/ui/calendar/calendar-months.svelte +19 -0
  27. package/dist/components/ui/calendar/calendar-months.svelte.d.ts +5 -0
  28. package/dist/components/ui/calendar/calendar-nav.svelte +19 -0
  29. package/dist/components/ui/calendar/calendar-nav.svelte.d.ts +5 -0
  30. package/dist/components/ui/calendar/calendar-next-button.svelte +31 -0
  31. package/dist/components/ui/calendar/calendar-next-button.svelte.d.ts +8 -0
  32. package/dist/components/ui/calendar/calendar-prev-button.svelte +31 -0
  33. package/dist/components/ui/calendar/calendar-prev-button.svelte.d.ts +8 -0
  34. package/dist/components/ui/calendar/calendar-year-select.svelte +43 -0
  35. package/dist/components/ui/calendar/calendar-year-select.svelte.d.ts +4 -0
  36. package/dist/components/ui/calendar/calendar.svelte +115 -0
  37. package/dist/components/ui/calendar/calendar.svelte.d.ts +21 -0
  38. package/dist/components/ui/calendar/index.d.ts +19 -0
  39. package/dist/components/ui/calendar/index.js +21 -0
  40. package/dist/components/ui/checkbox/checkbox.svelte +36 -0
  41. package/dist/components/ui/checkbox/checkbox.svelte.d.ts +4 -0
  42. package/dist/components/ui/checkbox/index.d.ts +2 -0
  43. package/dist/components/ui/checkbox/index.js +4 -0
  44. package/dist/components/ui/radio-group/index.d.ts +3 -0
  45. package/dist/components/ui/radio-group/index.js +5 -0
  46. package/dist/components/ui/radio-group/radio-group-item.svelte +31 -0
  47. package/dist/components/ui/radio-group/radio-group-item.svelte.d.ts +4 -0
  48. package/dist/components/ui/radio-group/radio-group.svelte +19 -0
  49. package/dist/components/ui/radio-group/radio-group.svelte.d.ts +4 -0
  50. package/dist/components/ui/switch/index.d.ts +2 -0
  51. package/dist/components/ui/switch/index.js +4 -0
  52. package/dist/components/ui/switch/switch.svelte +29 -0
  53. package/dist/components/ui/switch/switch.svelte.d.ts +4 -0
  54. package/package.json +176 -156
@@ -0,0 +1,115 @@
1
+ <script lang="ts">
2
+ import { Calendar as CalendarPrimitive } from 'bits-ui';
3
+ import * as Calendar from './index.js';
4
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
5
+ import type { ButtonVariant } from '../button/button.svelte';
6
+ import { isEqualMonth, type DateValue } from '@internationalized/date';
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
+ 'bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[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 (weekday)}
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 { Calendar as CalendarPrimitive } from 'bits-ui';
2
+ import * as Calendar from './index.js';
3
+ import { type WithoutChildrenOrChild } from '../../../utils.js';
4
+ import type { ButtonVariant } from '../button/button.svelte';
5
+ import { type DateValue } from '@internationalized/date';
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, {}, "placeholder" | "ref" | "value">;
20
+ type Calendar = ReturnType<typeof Calendar>;
21
+ export default Calendar;
@@ -0,0 +1,19 @@
1
+ import Root from './calendar.svelte';
2
+ import Cell from './calendar-cell.svelte';
3
+ import Day from './calendar-day.svelte';
4
+ import Grid from './calendar-grid.svelte';
5
+ import Header from './calendar-header.svelte';
6
+ import Months from './calendar-months.svelte';
7
+ import GridRow from './calendar-grid-row.svelte';
8
+ import Heading from './calendar-heading.svelte';
9
+ import GridBody from './calendar-grid-body.svelte';
10
+ import GridHead from './calendar-grid-head.svelte';
11
+ import HeadCell from './calendar-head-cell.svelte';
12
+ import NextButton from './calendar-next-button.svelte';
13
+ import PrevButton from './calendar-prev-button.svelte';
14
+ import MonthSelect from './calendar-month-select.svelte';
15
+ import YearSelect from './calendar-year-select.svelte';
16
+ import Month from './calendar-month.svelte';
17
+ import Nav from './calendar-nav.svelte';
18
+ import Caption from './calendar-caption.svelte';
19
+ export { Day, Cell, Grid, Header, Months, GridRow, Heading, GridBody, GridHead, HeadCell, NextButton, PrevButton, Nav, Month, YearSelect, MonthSelect, Caption, Root as Calendar };
@@ -0,0 +1,21 @@
1
+ import Root from './calendar.svelte';
2
+ import Cell from './calendar-cell.svelte';
3
+ import Day from './calendar-day.svelte';
4
+ import Grid from './calendar-grid.svelte';
5
+ import Header from './calendar-header.svelte';
6
+ import Months from './calendar-months.svelte';
7
+ import GridRow from './calendar-grid-row.svelte';
8
+ import Heading from './calendar-heading.svelte';
9
+ import GridBody from './calendar-grid-body.svelte';
10
+ import GridHead from './calendar-grid-head.svelte';
11
+ import HeadCell from './calendar-head-cell.svelte';
12
+ import NextButton from './calendar-next-button.svelte';
13
+ import PrevButton from './calendar-prev-button.svelte';
14
+ import MonthSelect from './calendar-month-select.svelte';
15
+ import YearSelect from './calendar-year-select.svelte';
16
+ import Month from './calendar-month.svelte';
17
+ import Nav from './calendar-nav.svelte';
18
+ import Caption from './calendar-caption.svelte';
19
+ export { Day, Cell, Grid, Header, Months, GridRow, Heading, GridBody, GridHead, HeadCell, NextButton, PrevButton, Nav, Month, YearSelect, MonthSelect, Caption,
20
+ //
21
+ Root as Calendar };
@@ -0,0 +1,36 @@
1
+ <script lang="ts">
2
+ import { Checkbox as CheckboxPrimitive } from 'bits-ui';
3
+ import CheckIcon from '@lucide/svelte/icons/check';
4
+ import MinusIcon from '@lucide/svelte/icons/minus';
5
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ checked = $bindable(false),
10
+ indeterminate = $bindable(false),
11
+ class: className,
12
+ ...restProps
13
+ }: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
14
+ </script>
15
+
16
+ <CheckboxPrimitive.Root
17
+ bind:ref
18
+ data-slot="checkbox"
19
+ class={cn(
20
+ 'border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive shadow-xs peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border outline-none transition-shadow focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
21
+ className
22
+ )}
23
+ bind:checked
24
+ bind:indeterminate
25
+ {...restProps}
26
+ >
27
+ {#snippet children({ checked, indeterminate })}
28
+ <div data-slot="checkbox-indicator" class="text-current transition-none">
29
+ {#if checked}
30
+ <CheckIcon class="size-3.5" />
31
+ {:else if indeterminate}
32
+ <MinusIcon class="size-3.5" />
33
+ {/if}
34
+ </div>
35
+ {/snippet}
36
+ </CheckboxPrimitive.Root>
@@ -0,0 +1,4 @@
1
+ import { Checkbox as CheckboxPrimitive } from 'bits-ui';
2
+ declare const Checkbox: import("svelte").Component<Omit<Omit<CheckboxPrimitive.RootProps, "child">, "children">, {}, "ref" | "checked" | "indeterminate">;
3
+ type Checkbox = ReturnType<typeof Checkbox>;
4
+ export default Checkbox;
@@ -0,0 +1,2 @@
1
+ import Root from './checkbox.svelte';
2
+ export { Root, Root as Checkbox };
@@ -0,0 +1,4 @@
1
+ import Root from './checkbox.svelte';
2
+ export { Root,
3
+ //
4
+ Root as Checkbox };
@@ -0,0 +1,3 @@
1
+ import Root from './radio-group.svelte';
2
+ import Item from './radio-group-item.svelte';
3
+ export { Root, Item, Root as RadioGroup, Item as RadioGroupItem };
@@ -0,0 +1,5 @@
1
+ import Root from './radio-group.svelte';
2
+ import Item from './radio-group-item.svelte';
3
+ export { Root, Item,
4
+ //
5
+ Root as RadioGroup, Item as RadioGroupItem };
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
3
+ import CircleIcon from '@lucide/svelte/icons/circle';
4
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ ...restProps
10
+ }: WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> = $props();
11
+ </script>
12
+
13
+ <RadioGroupPrimitive.Item
14
+ bind:ref
15
+ data-slot="radio-group-item"
16
+ class={cn(
17
+ 'border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 shadow-xs aspect-square size-4 shrink-0 rounded-full border outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {#snippet children({ checked })}
23
+ <div data-slot="radio-group-indicator" class="relative flex items-center justify-center">
24
+ {#if checked}
25
+ <CircleIcon
26
+ class="fill-primary absolute left-1/2 top-1/2 size-2 -translate-x-1/2 -translate-y-1/2"
27
+ />
28
+ {/if}
29
+ </div>
30
+ {/snippet}
31
+ </RadioGroupPrimitive.Item>
@@ -0,0 +1,4 @@
1
+ import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
2
+ declare const RadioGroupItem: import("svelte").Component<Omit<Omit<RadioGroupPrimitive.ItemProps, "child">, "children">, {}, "ref">;
3
+ type RadioGroupItem = ReturnType<typeof RadioGroupItem>;
4
+ export default RadioGroupItem;
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
3
+ import { cn } from '../../../utils.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ value = $bindable(''),
9
+ ...restProps
10
+ }: RadioGroupPrimitive.RootProps = $props();
11
+ </script>
12
+
13
+ <RadioGroupPrimitive.Root
14
+ bind:ref
15
+ bind:value
16
+ data-slot="radio-group"
17
+ class={cn('grid gap-3', className)}
18
+ {...restProps}
19
+ />
@@ -0,0 +1,4 @@
1
+ import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
2
+ declare const RadioGroup: import("svelte").Component<RadioGroupPrimitive.RootProps, {}, "ref" | "value">;
3
+ type RadioGroup = ReturnType<typeof RadioGroup>;
4
+ export default RadioGroup;
@@ -0,0 +1,2 @@
1
+ import Root from './switch.svelte';
2
+ export { Root, Root as Switch };
@@ -0,0 +1,4 @@
1
+ import Root from './switch.svelte';
2
+ export { Root,
3
+ //
4
+ Root as Switch };
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { Switch as SwitchPrimitive } from 'bits-ui';
3
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ checked = $bindable(false),
9
+ ...restProps
10
+ }: WithoutChildrenOrChild<SwitchPrimitive.RootProps> = $props();
11
+ </script>
12
+
13
+ <SwitchPrimitive.Root
14
+ bind:ref
15
+ bind:checked
16
+ data-slot="switch"
17
+ class={cn(
18
+ 'data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 shadow-xs peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent outline-none transition-all focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
19
+ className
20
+ )}
21
+ {...restProps}
22
+ >
23
+ <SwitchPrimitive.Thumb
24
+ data-slot="switch-thumb"
25
+ class={cn(
26
+ 'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0'
27
+ )}
28
+ />
29
+ </SwitchPrimitive.Root>
@@ -0,0 +1,4 @@
1
+ import { Switch as SwitchPrimitive } from 'bits-ui';
2
+ declare const Switch: import("svelte").Component<Omit<Omit<SwitchPrimitive.RootProps, "child">, "children">, {}, "ref" | "checked">;
3
+ type Switch = ReturnType<typeof Switch>;
4
+ export default Switch;