@svelte-atoms/core 1.0.0-alpha.28 → 1.0.0-alpha.30
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 +852 -856
- package/dist/attachments/clickout.svelte.d.ts +1 -1
- package/dist/attachments/clickout.svelte.js +2 -2
- package/dist/components/accordion/accordion-root.svelte +61 -61
- package/dist/components/accordion/accordion-root.svelte.d.ts +1 -1
- package/dist/components/accordion/accordion.stories.svelte +145 -134
- package/dist/components/alert/alert-actions.svelte +43 -43
- package/dist/components/alert/alert-close-button.svelte +70 -70
- package/dist/components/alert/alert-content.svelte +43 -43
- package/dist/components/alert/alert-description.svelte +42 -42
- package/dist/components/alert/alert-icon.svelte +47 -47
- package/dist/components/alert/alert-root.svelte +103 -103
- package/dist/components/alert/alert-title.svelte +42 -42
- package/dist/components/alert/alert.stories.svelte +10 -11
- package/dist/components/atom/html-atom.svelte +75 -19
- package/dist/components/atom/html-atom.svelte.d.ts +1 -1
- package/dist/components/atom/snippet-renderer.svelte +5 -5
- package/dist/components/avatar/avatar.stories.svelte +22 -27
- package/dist/components/badge/badge.stories.svelte +12 -17
- package/dist/components/badge/badge.svelte +19 -19
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -21
- package/dist/components/button/button.stories.svelte +1 -34
- package/dist/components/calendar/calendar-body.svelte +107 -107
- package/dist/components/calendar/calendar-day.svelte +96 -97
- package/dist/components/calendar/calendar-header.svelte +29 -33
- package/dist/components/calendar/calendar-header.svelte.d.ts +0 -1
- package/dist/components/calendar/calendar-root.svelte +206 -208
- package/dist/components/calendar/calendar-week-day.svelte +34 -34
- package/dist/components/calendar/calendar.css +26 -26
- package/dist/components/calendar/calendar.stories.svelte +10 -20
- package/dist/components/calendar/calendar.stories.svelte.d.ts +24 -4
- package/dist/components/card/card-body.svelte +39 -39
- package/dist/components/card/card-footer.svelte +41 -41
- package/dist/components/card/card-root.svelte +91 -91
- package/dist/components/card/card.stories.svelte +133 -145
- package/dist/components/checkbox/checkbox.stories.svelte +22 -27
- package/dist/components/checkbox/checkbox.svelte +155 -157
- package/dist/components/collapsible/collapsible.stories.svelte +172 -173
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/compobox.stories.svelte +51 -54
- package/dist/components/container/container.stories.svelte +20 -23
- package/dist/components/datagrid/datagrid-root.svelte +2 -2
- package/dist/components/datagrid/datagrid.css +0 -42
- package/dist/components/datagrid/datagrid.stories.svelte +72 -75
- package/dist/components/datagrid/types.d.ts +1 -1
- package/dist/components/date-picker/atoms.d.ts +0 -4
- package/dist/components/date-picker/atoms.js +0 -4
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -42
- package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-header.svelte +100 -105
- package/dist/components/date-picker/date-picker-header.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-months.svelte +142 -150
- package/dist/components/date-picker/date-picker-months.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-root.svelte +4 -3
- package/dist/components/date-picker/date-picker-root.svelte.d.ts +2 -15
- package/dist/components/date-picker/date-picker-years.svelte +205 -214
- package/dist/components/date-picker/date-picker-years.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker.stories.svelte +15 -31
- package/dist/components/date-picker/types.d.ts +53 -1
- package/dist/components/dialog/dialog-content.svelte +1 -1
- package/dist/components/dialog/dialog.stories.svelte +64 -67
- package/dist/components/drawer/attachments.svelte.js +8 -9
- package/dist/components/drawer/drawer-content.svelte +57 -42
- package/dist/components/drawer/drawer.stories.svelte +212 -224
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown.stories.svelte +80 -83
- package/dist/components/element/html-element.svelte +85 -85
- package/dist/components/element/types.d.ts +1 -1
- package/dist/components/form/form.stories.svelte +96 -99
- package/dist/components/image/image.stories.svelte +20 -23
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input/input.stories.svelte +35 -38
- package/dist/components/label/label.stories.svelte +15 -26
- package/dist/components/label/label.stories.svelte.d.ts +24 -4
- package/dist/components/lazy/index.d.ts +1 -0
- package/dist/components/lazy/index.js +1 -0
- package/dist/components/lazy/lazy.stories.svelte +28 -0
- package/dist/components/lazy/lazy.stories.svelte.d.ts +19 -0
- package/dist/components/lazy/lazy.svelte +28 -0
- package/dist/components/lazy/lazy.svelte.d.ts +5 -0
- package/dist/components/lazy/types.d.ts +10 -0
- package/dist/components/lazy/types.js +1 -0
- package/dist/components/link/link.stories.svelte +15 -26
- package/dist/components/link/link.stories.svelte.d.ts +24 -4
- package/dist/components/menu/menu-list.svelte +2 -1
- package/dist/components/menu/menu-list.svelte.d.ts +1 -0
- package/dist/components/menu/menu.stories.svelte +33 -36
- package/dist/components/popover/bond.svelte.js +31 -25
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +2 -5
- package/dist/components/popover/popover-indicator.svelte +44 -43
- package/dist/components/popover/popover-root.svelte +1 -1
- package/dist/components/popover/popover.stories.svelte +18 -21
- package/dist/components/qr-code/index.d.ts +1 -0
- package/dist/components/qr-code/index.js +1 -0
- package/dist/components/qr-code/qr-code.stories.svelte +4 -10
- package/dist/components/qr-code/qr-code.svelte +75 -25
- package/dist/components/qr-code/qr-code.svelte.d.ts +2 -4
- package/dist/components/qr-code/types.d.ts +14 -0
- package/dist/components/qr-code/types.js +1 -0
- package/dist/components/radio/radio-group.stories.svelte +41 -50
- package/dist/components/radio/radio.stories.svelte +17 -26
- package/dist/components/radio/radio.svelte +109 -109
- package/dist/components/root/root.svelte +121 -121
- package/dist/components/root/root.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable.stories.svelte +116 -126
- package/dist/components/sidebar/bond.svelte.d.ts +0 -5
- package/dist/components/sidebar/bond.svelte.js +1 -12
- package/dist/components/sidebar/sidebar-content.svelte +50 -39
- package/dist/components/sidebar/sidebar-content.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar-root.svelte +39 -68
- package/dist/components/sidebar/sidebar-root.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar.stories.svelte +43 -52
- package/dist/components/sidebar/types.d.ts +7 -6
- package/dist/components/tabs/tab/bond.svelte.d.ts +4 -1
- package/dist/components/tabs/tab/bond.svelte.js +4 -1
- package/dist/components/tabs/tabs.stories.svelte +56 -59
- package/dist/components/tooltip/tooltip-trigger.svelte +39 -37
- package/dist/components/tooltip/tooltip.stories.svelte +32 -35
- package/dist/components/tree/tree.stories.svelte +142 -134
- package/dist/context/preset.svelte.d.ts +3 -3
- package/dist/utils/function.d.ts +2 -0
- package/dist/utils/function.js +6 -0
- package/llm/variants.md +1259 -1261
- package/package.json +7 -9
- package/dist/actions/animation.svelte.d.ts +0 -6
- package/dist/actions/animation.svelte.js +0 -14
- package/dist/actions/clickout.svelte.d.ts +0 -2
- package/dist/actions/clickout.svelte.js +0 -15
- package/dist/actions/popover.svelte.d.ts +0 -19
- package/dist/actions/popover.svelte.js +0 -81
- package/dist/actions/portal.svelte.d.ts +0 -8
- package/dist/actions/portal.svelte.js +0 -32
- package/dist/attachments/gsap.svelte.d.ts +0 -2
- package/dist/attachments/gsap.svelte.js +0 -26
|
@@ -1,150 +1,142 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
duration: 100
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
duration: 100
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
datePicker.state.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
duration: 100
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
duration: 100
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{month}
|
|
144
|
-
</button>
|
|
145
|
-
{/each}
|
|
146
|
-
</div>
|
|
147
|
-
{/if}
|
|
148
|
-
</HtmlAtom>
|
|
149
|
-
</HtmlAtom>
|
|
150
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { animate } from 'motion';
|
|
3
|
+
import { getYear, getMonth, setMonth } from 'date-fns';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
import { HtmlAtom } from '../atom';
|
|
6
|
+
import { DatePickerBond } from './bond.svelte';
|
|
7
|
+
import type { DatePickerMonthsProps } from './types';
|
|
8
|
+
|
|
9
|
+
const datePicker = DatePickerBond.get();
|
|
10
|
+
|
|
11
|
+
const pivote = $derived(datePicker?.state.props.pivote ?? new Date());
|
|
12
|
+
|
|
13
|
+
const currentYear = $derived(getYear(pivote));
|
|
14
|
+
const currentMonth = $derived(getMonth(pivote));
|
|
15
|
+
|
|
16
|
+
// Generate array of months
|
|
17
|
+
const monthsGrid = [
|
|
18
|
+
'Jan',
|
|
19
|
+
'Feb',
|
|
20
|
+
'Mar',
|
|
21
|
+
'Apr',
|
|
22
|
+
'May',
|
|
23
|
+
'Jun',
|
|
24
|
+
'Jul',
|
|
25
|
+
'Aug',
|
|
26
|
+
'Sep',
|
|
27
|
+
'Oct',
|
|
28
|
+
'Nov',
|
|
29
|
+
'Dec'
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
let {
|
|
33
|
+
class: klass = '',
|
|
34
|
+
preset = 'datepicker.months',
|
|
35
|
+
children,
|
|
36
|
+
...restProps
|
|
37
|
+
}: DatePickerMonthsProps = $props();
|
|
38
|
+
|
|
39
|
+
function enter(node: HTMLElement) {
|
|
40
|
+
animate(
|
|
41
|
+
node,
|
|
42
|
+
{
|
|
43
|
+
scale: [0.8, 1]
|
|
44
|
+
},
|
|
45
|
+
{ duration: 100 / 1000, ease: 'circOut' }
|
|
46
|
+
);
|
|
47
|
+
return {
|
|
48
|
+
duration: 100
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function exit(node: HTMLElement) {
|
|
53
|
+
animate(
|
|
54
|
+
node,
|
|
55
|
+
{
|
|
56
|
+
scale: 0.8
|
|
57
|
+
},
|
|
58
|
+
{ duration: 100 / 1000, ease: 'circOut' }
|
|
59
|
+
);
|
|
60
|
+
return {
|
|
61
|
+
duration: 100
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function handleMonthSelect(monthIndex: number) {
|
|
66
|
+
if (!datePicker?.state.props.pivote) return;
|
|
67
|
+
const current = datePicker.state.props.pivote;
|
|
68
|
+
datePicker.state.props.pivote = setMonth(current, monthIndex);
|
|
69
|
+
|
|
70
|
+
datePicker.state.closeMonthsPicker();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function handleYearPicker() {
|
|
74
|
+
if (!datePicker) return;
|
|
75
|
+
datePicker.state.openYearsPicker();
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
{#if datePicker.state.isMonthsPickerOpen}
|
|
80
|
+
<HtmlAtom
|
|
81
|
+
class={['absolute inset-0 z-1 flex flex-col gap-2 bg-inherit opacity-0', '$preset', klass]}
|
|
82
|
+
enter={(node) => {
|
|
83
|
+
animate(
|
|
84
|
+
node,
|
|
85
|
+
{
|
|
86
|
+
opacity: [0, 1]
|
|
87
|
+
},
|
|
88
|
+
{ duration: 100 / 1000, ease: 'anticipate' }
|
|
89
|
+
);
|
|
90
|
+
return {
|
|
91
|
+
duration: 100
|
|
92
|
+
};
|
|
93
|
+
}}
|
|
94
|
+
exit={(node) => {
|
|
95
|
+
animate(
|
|
96
|
+
node,
|
|
97
|
+
{
|
|
98
|
+
opacity: 0
|
|
99
|
+
},
|
|
100
|
+
{ duration: 100 / 1000, ease: 'anticipate' }
|
|
101
|
+
);
|
|
102
|
+
return {
|
|
103
|
+
duration: 100
|
|
104
|
+
};
|
|
105
|
+
}}
|
|
106
|
+
{preset}
|
|
107
|
+
{...restProps}
|
|
108
|
+
>
|
|
109
|
+
<HtmlAtom class="flex flex-1 flex-col gap-2" {enter} {exit}>
|
|
110
|
+
<!-- Year Display -->
|
|
111
|
+
<nav
|
|
112
|
+
class="border-border text-foreground flex h-12 items-center justify-center gap-2 border-b px-2 py-2"
|
|
113
|
+
>
|
|
114
|
+
<button
|
|
115
|
+
class="text-foreground cursor-pointer text-center text-sm font-semibold"
|
|
116
|
+
onclick={handleYearPicker}
|
|
117
|
+
>
|
|
118
|
+
{currentYear}
|
|
119
|
+
</button>
|
|
120
|
+
</nav>
|
|
121
|
+
|
|
122
|
+
<!-- Months Grid -->
|
|
123
|
+
<div class="grid flex-1 grid-cols-3 gap-1 px-2 pb-2">
|
|
124
|
+
{#each monthsGrid as month, index}
|
|
125
|
+
{@const isSelected = index === currentMonth}
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
class={cn(
|
|
129
|
+
'hover:bg-foreground/10 active:bg-foreground/20 rounded-md px-3 py-2 text-sm transition-colors',
|
|
130
|
+
isSelected && 'bg-primary text-primary-foreground hover:bg-primary/90'
|
|
131
|
+
)}
|
|
132
|
+
onclick={() => handleMonthSelect(index)}
|
|
133
|
+
aria-label="Select {month}"
|
|
134
|
+
aria-current={isSelected ? 'date' : undefined}
|
|
135
|
+
>
|
|
136
|
+
{month}
|
|
137
|
+
</button>
|
|
138
|
+
{/each}
|
|
139
|
+
</div>
|
|
140
|
+
</HtmlAtom>
|
|
141
|
+
</HtmlAtom>
|
|
142
|
+
{/if}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
preset?: string;
|
|
4
|
-
children: any;
|
|
5
|
-
} & Record<string, any>, {}, "">;
|
|
1
|
+
import type { DatePickerMonthsProps } from './types';
|
|
2
|
+
declare const DatePickerMonths: import("svelte").Component<DatePickerMonthsProps, {}, "">;
|
|
6
3
|
type DatePickerMonths = ReturnType<typeof DatePickerMonths>;
|
|
7
4
|
export default DatePickerMonths;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineProperty, defineState } from '../../utils';
|
|
3
2
|
import { startOfDay } from 'date-fns';
|
|
3
|
+
import { defineProperty, defineState } from '../../utils';
|
|
4
4
|
import { Root } from '../popover/atoms';
|
|
5
5
|
import type { CalendarRange } from '../calendar/types';
|
|
6
6
|
import { DatePickerBond, DatePickerBondState, type DatePickerBondProps } from './bond.svelte';
|
|
7
|
+
import type { DatePickerRootProps } from './types';
|
|
7
8
|
|
|
8
9
|
let {
|
|
9
10
|
open = $bindable(false),
|
|
@@ -15,11 +16,11 @@
|
|
|
15
16
|
min = undefined,
|
|
16
17
|
max = undefined,
|
|
17
18
|
type = 'single',
|
|
18
|
-
offset =
|
|
19
|
+
offset = 1,
|
|
19
20
|
factory = _factory,
|
|
20
21
|
children,
|
|
21
22
|
...restProps
|
|
22
|
-
} = $props();
|
|
23
|
+
}: DatePickerRootProps = $props();
|
|
23
24
|
|
|
24
25
|
const seed = {};
|
|
25
26
|
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const DatePickerRoot: import("svelte").Component<{
|
|
3
|
-
open?: boolean;
|
|
4
|
-
value?: any;
|
|
5
|
-
range?: any[];
|
|
6
|
-
pivote?: any;
|
|
7
|
-
start?: any;
|
|
8
|
-
end?: any;
|
|
9
|
-
min?: any;
|
|
10
|
-
max?: any;
|
|
11
|
-
type?: string;
|
|
12
|
-
offset?: number;
|
|
13
|
-
factory?: () => DatePickerBond<DatePickerBondProps, DatePickerBondState<DatePickerBondProps>>;
|
|
14
|
-
children: any;
|
|
15
|
-
} & Record<string, any>, {}, "value" | "end" | "range" | "open" | "start" | "pivote">;
|
|
1
|
+
import type { DatePickerRootProps } from './types';
|
|
2
|
+
declare const DatePickerRoot: import("svelte").Component<DatePickerRootProps, {}, "value" | "end" | "range" | "open" | "start" | "pivote">;
|
|
16
3
|
type DatePickerRoot = ReturnType<typeof DatePickerRoot>;
|
|
17
4
|
export default DatePickerRoot;
|