@svelte-atoms/core 1.0.0-alpha.28 → 1.0.0-alpha.29
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 -5
- 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 +401 -401
- package/dist/components/atom/html-atom.svelte +6 -4
- package/dist/components/atom/html-atom.svelte.d.ts +1 -1
- package/dist/components/atom/snippet-renderer.svelte +5 -5
- package/dist/components/button/button.stories.svelte +60 -60
- package/dist/components/calendar/calendar-body.svelte +107 -107
- package/dist/components/calendar/calendar-day.svelte +0 -1
- package/dist/components/calendar/calendar-header.svelte +2 -6
- package/dist/components/calendar/calendar-header.svelte.d.ts +0 -1
- package/dist/components/calendar/calendar-root.svelte +0 -2
- 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 +0 -5
- package/dist/components/calendar/calendar.stories.svelte.d.ts +24 -4
- package/dist/components/datagrid/datagrid-root.svelte +59 -59
- package/dist/components/datagrid/datagrid.css +5 -47
- 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 +34 -9
- package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-header.svelte +59 -64
- package/dist/components/date-picker/date-picker-header.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-months.svelte +36 -44
- package/dist/components/date-picker/date-picker-months.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-root.svelte +3 -2
- package/dist/components/date-picker/date-picker-root.svelte.d.ts +2 -15
- package/dist/components/date-picker/date-picker-years.svelte +88 -97
- package/dist/components/date-picker/date-picker-years.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker.stories.svelte +6 -15
- package/dist/components/date-picker/types.d.ts +53 -1
- package/dist/components/dialog/dialog-content.svelte +62 -62
- package/dist/components/element/html-element.svelte +85 -85
- package/dist/components/element/types.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/lazy/index.d.ts +1 -0
- package/dist/components/lazy/index.js +1 -0
- package/dist/components/lazy/lazy.stories.svelte +35 -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/menu/menu-list.svelte +40 -39
- package/dist/components/menu/menu-list.svelte.d.ts +1 -0
- package/dist/components/popover/popover-content.svelte +178 -178
- package/dist/components/popover/popover-root.svelte +48 -48
- package/dist/components/popover/popover.stories.svelte +52 -52
- 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 -1
- package/dist/components/qr-code/qr-code.svelte +65 -15
- 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/sidebar/bond.svelte.d.ts +0 -5
- package/dist/components/sidebar/bond.svelte.js +1 -12
- package/dist/components/sidebar/sidebar-content.svelte +39 -39
- package/dist/components/sidebar/sidebar-content.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar-root.svelte +41 -68
- package/dist/components/sidebar/sidebar-root.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar.stories.svelte +54 -52
- package/dist/components/sidebar/types.d.ts +6 -6
- package/llm/variants.md +1259 -1261
- package/package.json +2 -1
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
preset: presetKey = undefined,
|
|
22
22
|
bond = undefined,
|
|
23
23
|
variants = undefined,
|
|
24
|
-
children = undefined,
|
|
24
|
+
children: childrenProp = undefined,
|
|
25
25
|
...restProps
|
|
26
|
-
}: HtmlAtomProps<E, B> & HTMLAttributes<Element> = $props();
|
|
26
|
+
}: HtmlAtomProps<E, B> & Omit<HTMLAttributes<Element>, 'children'> = $props();
|
|
27
27
|
|
|
28
28
|
const preset = $derived(
|
|
29
29
|
presetKey ? getPreset(presetKey as PresetModuleName)?.apply?.(bond, [bond]) : undefined
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
if (isSnippet)
|
|
123
123
|
return {
|
|
124
124
|
component: SnippetRenderer,
|
|
125
|
-
props: { snippet: snippet, class: _klass, as: _as, children, ..._restProps }
|
|
125
|
+
props: { snippet: snippet, class: _klass, as: _as, children: childrenProp, ..._restProps }
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
return {
|
|
@@ -201,5 +201,7 @@
|
|
|
201
201
|
</script>
|
|
202
202
|
|
|
203
203
|
<renderer.component {...renderer.props}>
|
|
204
|
-
{
|
|
204
|
+
{#snippet children(args)}
|
|
205
|
+
{@render childrenProp?.(args)}
|
|
206
|
+
{/snippet}
|
|
205
207
|
</renderer.component>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import type { Base, HtmlAtomProps } from './types';
|
|
3
3
|
declare function $$render<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(): {
|
|
4
|
-
props: HtmlAtomProps<E, B> & HTMLAttributes<HTMLElementTagNameMap[E]>;
|
|
4
|
+
props: HtmlAtomProps<E, B> & Omit<HTMLAttributes<HTMLElementTagNameMap[E]>, "children">;
|
|
5
5
|
exports: {};
|
|
6
6
|
bindings: "";
|
|
7
7
|
slots: {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let { snippet, ...restProps } = $props();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
{@render snippet?.({ ...restProps })}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { snippet, ...restProps } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
{@render snippet?.({ ...restProps })}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Root from '../root/root.svelte';
|
|
4
|
-
import ButtonCmp from './button.svelte';
|
|
5
|
-
import { defineVariants } from '../../utils/variant';
|
|
6
|
-
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'ATOMS/Button',
|
|
9
|
-
argTypes: {
|
|
10
|
-
variant: {
|
|
11
|
-
control: 'select',
|
|
12
|
-
options: ['primary', 'secondary', 'destructive', 'outline', 'ghost'],
|
|
13
|
-
description: 'Button variant style',
|
|
14
|
-
table: {
|
|
15
|
-
defaultValue: { summary: 'primary' }
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<script lang="ts">
|
|
23
|
-
const variants = defineVariants((bond) => ({
|
|
24
|
-
variants: {
|
|
25
|
-
variant: {
|
|
26
|
-
primary: {
|
|
27
|
-
class: 'bg-primary text-primary-foreground hover:bg-primary/80 active:bg-primary/90'
|
|
28
|
-
},
|
|
29
|
-
secondary: {
|
|
30
|
-
class:
|
|
31
|
-
'bg-secondary text-secondary-foreground hover:bg-secondary/80 active:bg-secondary/90'
|
|
32
|
-
},
|
|
33
|
-
destructive: {
|
|
34
|
-
class:
|
|
35
|
-
'bg-destructive text-destructive-foreground hover:bg-destructive/80 active:bg-destructive/90'
|
|
36
|
-
},
|
|
37
|
-
outline: {
|
|
38
|
-
class:
|
|
39
|
-
'bg-transparent hover:bg-foreground/5 active:bg-foreground/10 border border-border text-foreground'
|
|
40
|
-
},
|
|
41
|
-
ghost: {
|
|
42
|
-
class:
|
|
43
|
-
'bg-transparent text-foreground hover:bg-foreground/5 active:bg-foreground/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2'
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
compounds: [],
|
|
48
|
-
defaults: {
|
|
49
|
-
variant: 'destructive'
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<Story name="Button">
|
|
55
|
-
{#snippet template(args)}
|
|
56
|
-
<Root class="p-4">
|
|
57
|
-
<ButtonCmp {variants} {...args}>Clicke me</ButtonCmp>
|
|
58
|
-
</Root>
|
|
59
|
-
{/snippet}
|
|
60
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Root from '../root/root.svelte';
|
|
4
|
+
import ButtonCmp from './button.svelte';
|
|
5
|
+
import { defineVariants } from '../../utils/variant';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'ATOMS/Button',
|
|
9
|
+
argTypes: {
|
|
10
|
+
variant: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: ['primary', 'secondary', 'destructive', 'outline', 'ghost'],
|
|
13
|
+
description: 'Button variant style',
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: { summary: 'primary' }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
const variants = defineVariants((bond) => ({
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
primary: {
|
|
27
|
+
class: 'bg-primary text-primary-foreground hover:bg-primary/80 active:bg-primary/90'
|
|
28
|
+
},
|
|
29
|
+
secondary: {
|
|
30
|
+
class:
|
|
31
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80 active:bg-secondary/90'
|
|
32
|
+
},
|
|
33
|
+
destructive: {
|
|
34
|
+
class:
|
|
35
|
+
'bg-destructive text-destructive-foreground hover:bg-destructive/80 active:bg-destructive/90'
|
|
36
|
+
},
|
|
37
|
+
outline: {
|
|
38
|
+
class:
|
|
39
|
+
'bg-transparent hover:bg-foreground/5 active:bg-foreground/10 border border-border text-foreground'
|
|
40
|
+
},
|
|
41
|
+
ghost: {
|
|
42
|
+
class:
|
|
43
|
+
'bg-transparent text-foreground hover:bg-foreground/5 active:bg-foreground/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
compounds: [],
|
|
48
|
+
defaults: {
|
|
49
|
+
variant: 'destructive'
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<Story name="Button">
|
|
55
|
+
{#snippet template(args)}
|
|
56
|
+
<Root class="p-4">
|
|
57
|
+
<ButtonCmp {variants} {...args}>Clicke me</ButtonCmp>
|
|
58
|
+
</Root>
|
|
59
|
+
{/snippet}
|
|
60
|
+
</Story>
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { backInOut } from 'svelte/easing';
|
|
3
|
-
import CalendarDay from './calendar-day.svelte';
|
|
4
|
-
import { CalendarBond } from './bond.svelte';
|
|
5
|
-
import { cn } from '../../utils';
|
|
6
|
-
import { HtmlAtom } from '../atom';
|
|
7
|
-
|
|
8
|
-
const calendarBond = CalendarBond.get();
|
|
9
|
-
|
|
10
|
-
const currentMonth = $derived(calendarBond?.state.props.currentMonth);
|
|
11
|
-
|
|
12
|
-
let {
|
|
13
|
-
class: klass = '',
|
|
14
|
-
weekday,
|
|
15
|
-
preset = 'calendar.body',
|
|
16
|
-
children = undefined,
|
|
17
|
-
...restProps
|
|
18
|
-
} = $props();
|
|
19
|
-
|
|
20
|
-
const bodyProps = $derived({
|
|
21
|
-
...calendarBond?.body(),
|
|
22
|
-
...restProps
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// const generator = function (pivot: Date, start: Date, end?: Date) {
|
|
26
|
-
// const firstDay = new Date(pivot.getFullYear(), pivot.getMonth(), 1).getDay();
|
|
27
|
-
// const lastMonthDaysCount = monthDays(pivot.getMonth() - 1, pivot.getFullYear());
|
|
28
|
-
// const sample = new Date(
|
|
29
|
-
// pivot.getFullYear(),
|
|
30
|
-
// pivot.getMonth() - 1,
|
|
31
|
-
// lastMonthDaysCount - firstDay
|
|
32
|
-
// );
|
|
33
|
-
|
|
34
|
-
// const array = [];
|
|
35
|
-
// let next = false,
|
|
36
|
-
// prec = false;
|
|
37
|
-
|
|
38
|
-
// for (let index = 0; index < 42; index++) {
|
|
39
|
-
// sample.setDate(sample.getDate() + 1);
|
|
40
|
-
|
|
41
|
-
// prec = pivot.getMonth() > sample.getMonth() || pivot.getFullYear() > sample.getFullYear();
|
|
42
|
-
// next =
|
|
43
|
-
// (pivot.getMonth() < sample.getMonth() && pivot.getFullYear() === sample.getFullYear()) ||
|
|
44
|
-
// (pivot.getMonth() > sample.getMonth() && pivot.getFullYear() < sample.getFullYear());
|
|
45
|
-
|
|
46
|
-
// array.push({
|
|
47
|
-
// id: sample.getTime(),
|
|
48
|
-
// date: sample.getDate(),
|
|
49
|
-
// offmonth: next || prec,
|
|
50
|
-
// next,
|
|
51
|
-
// prec,
|
|
52
|
-
// today: isToday(sample),
|
|
53
|
-
// week: Math.floor(index / 7),
|
|
54
|
-
// month: sample.getMonth(),
|
|
55
|
-
// disabled: false,
|
|
56
|
-
// weekend: sample.getDay() == 0,
|
|
57
|
-
// name: format(sample, 'iiiii'),
|
|
58
|
-
// selected: start?.getTime() === sample.getTime()
|
|
59
|
-
// });
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// return array;
|
|
63
|
-
// };
|
|
64
|
-
|
|
65
|
-
// const days = $derived(
|
|
66
|
-
// generator(
|
|
67
|
-
// context_calendar.derived.data.pivote,
|
|
68
|
-
// context_calendar.derived.data.start ?? new Date(),
|
|
69
|
-
// context_calendar.derived.data.end
|
|
70
|
-
// )
|
|
71
|
-
// );
|
|
72
|
-
|
|
73
|
-
function monthDays(month: number, year = 2020) {
|
|
74
|
-
return new Date(year, month + 1, 0).getDate();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function scle(node: HTMLElement, { delay = 0, duration = 400, easing = backInOut }) {
|
|
78
|
-
return {
|
|
79
|
-
delay,
|
|
80
|
-
duration,
|
|
81
|
-
easing,
|
|
82
|
-
css: (_, u) => {
|
|
83
|
-
return `transform: scale(${u})`;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
</script>
|
|
88
|
-
|
|
89
|
-
<HtmlAtom
|
|
90
|
-
class={cn('col-span-full grid h-full w-full grid-cols-subgrid', klass)}
|
|
91
|
-
{preset}
|
|
92
|
-
{...bodyProps}
|
|
93
|
-
>
|
|
94
|
-
{#each currentMonth?.days ?? [] as day (day.id)}
|
|
95
|
-
{#if children}
|
|
96
|
-
{@render children?.({ day })}
|
|
97
|
-
{:else}
|
|
98
|
-
<CalendarDay
|
|
99
|
-
{day}
|
|
100
|
-
onclick={() => {
|
|
101
|
-
console.log('day clicked', day.date);
|
|
102
|
-
calendarBond?.state.selectStart(new Date(day.date));
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
{/if}
|
|
106
|
-
{/each}
|
|
107
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { backInOut } from 'svelte/easing';
|
|
3
|
+
import CalendarDay from './calendar-day.svelte';
|
|
4
|
+
import { CalendarBond } from './bond.svelte';
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
import { HtmlAtom } from '../atom';
|
|
7
|
+
|
|
8
|
+
const calendarBond = CalendarBond.get();
|
|
9
|
+
|
|
10
|
+
const currentMonth = $derived(calendarBond?.state.props.currentMonth);
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: klass = '',
|
|
14
|
+
weekday,
|
|
15
|
+
preset = 'calendar.body',
|
|
16
|
+
children = undefined,
|
|
17
|
+
...restProps
|
|
18
|
+
} = $props();
|
|
19
|
+
|
|
20
|
+
const bodyProps = $derived({
|
|
21
|
+
...calendarBond?.body(),
|
|
22
|
+
...restProps
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// const generator = function (pivot: Date, start: Date, end?: Date) {
|
|
26
|
+
// const firstDay = new Date(pivot.getFullYear(), pivot.getMonth(), 1).getDay();
|
|
27
|
+
// const lastMonthDaysCount = monthDays(pivot.getMonth() - 1, pivot.getFullYear());
|
|
28
|
+
// const sample = new Date(
|
|
29
|
+
// pivot.getFullYear(),
|
|
30
|
+
// pivot.getMonth() - 1,
|
|
31
|
+
// lastMonthDaysCount - firstDay
|
|
32
|
+
// );
|
|
33
|
+
|
|
34
|
+
// const array = [];
|
|
35
|
+
// let next = false,
|
|
36
|
+
// prec = false;
|
|
37
|
+
|
|
38
|
+
// for (let index = 0; index < 42; index++) {
|
|
39
|
+
// sample.setDate(sample.getDate() + 1);
|
|
40
|
+
|
|
41
|
+
// prec = pivot.getMonth() > sample.getMonth() || pivot.getFullYear() > sample.getFullYear();
|
|
42
|
+
// next =
|
|
43
|
+
// (pivot.getMonth() < sample.getMonth() && pivot.getFullYear() === sample.getFullYear()) ||
|
|
44
|
+
// (pivot.getMonth() > sample.getMonth() && pivot.getFullYear() < sample.getFullYear());
|
|
45
|
+
|
|
46
|
+
// array.push({
|
|
47
|
+
// id: sample.getTime(),
|
|
48
|
+
// date: sample.getDate(),
|
|
49
|
+
// offmonth: next || prec,
|
|
50
|
+
// next,
|
|
51
|
+
// prec,
|
|
52
|
+
// today: isToday(sample),
|
|
53
|
+
// week: Math.floor(index / 7),
|
|
54
|
+
// month: sample.getMonth(),
|
|
55
|
+
// disabled: false,
|
|
56
|
+
// weekend: sample.getDay() == 0,
|
|
57
|
+
// name: format(sample, 'iiiii'),
|
|
58
|
+
// selected: start?.getTime() === sample.getTime()
|
|
59
|
+
// });
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
// return array;
|
|
63
|
+
// };
|
|
64
|
+
|
|
65
|
+
// const days = $derived(
|
|
66
|
+
// generator(
|
|
67
|
+
// context_calendar.derived.data.pivote,
|
|
68
|
+
// context_calendar.derived.data.start ?? new Date(),
|
|
69
|
+
// context_calendar.derived.data.end
|
|
70
|
+
// )
|
|
71
|
+
// );
|
|
72
|
+
|
|
73
|
+
function monthDays(month: number, year = 2020) {
|
|
74
|
+
return new Date(year, month + 1, 0).getDate();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function scle(node: HTMLElement, { delay = 0, duration = 400, easing = backInOut }) {
|
|
78
|
+
return {
|
|
79
|
+
delay,
|
|
80
|
+
duration,
|
|
81
|
+
easing,
|
|
82
|
+
css: (_, u) => {
|
|
83
|
+
return `transform: scale(${u})`;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<HtmlAtom
|
|
90
|
+
class={cn('col-span-full grid h-full w-full grid-cols-subgrid', klass)}
|
|
91
|
+
{preset}
|
|
92
|
+
{...bodyProps}
|
|
93
|
+
>
|
|
94
|
+
{#each currentMonth?.days ?? [] as day (day.id)}
|
|
95
|
+
{#if children}
|
|
96
|
+
{@render children?.({ day })}
|
|
97
|
+
{:else}
|
|
98
|
+
<CalendarDay
|
|
99
|
+
{day}
|
|
100
|
+
onclick={() => {
|
|
101
|
+
console.log('day clicked', day.date);
|
|
102
|
+
calendarBond?.state.selectStart(new Date(day.date));
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
{/if}
|
|
106
|
+
{/each}
|
|
107
|
+
</HtmlAtom>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const calendarBond = CalendarBond.get();
|
|
8
8
|
const currentMonth = $derived(calendarBond?.state.props.currentMonth);
|
|
9
9
|
|
|
10
|
-
let { class: klass = '', preset = 'calendar.header',
|
|
10
|
+
let { class: klass = '', preset = 'calendar.header', ...restProps } = $props();
|
|
11
11
|
|
|
12
12
|
const headerProps = $derived({
|
|
13
13
|
...calendarBond?.header(),
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
{...headerProps}
|
|
25
25
|
>
|
|
26
26
|
{#each (currentMonth?.days ?? []).filter((d) => d.week == 1) as day}
|
|
27
|
-
{
|
|
28
|
-
{@render children?.(day)}
|
|
29
|
-
{:else}
|
|
30
|
-
<CalendarWeekDay isWeekend={day.weekend}>{day.name}</CalendarWeekDay>
|
|
31
|
-
{/if}
|
|
27
|
+
<CalendarWeekDay isWeekend={day.weekend}>{day.name}</CalendarWeekDay>
|
|
32
28
|
{/each}
|
|
33
29
|
</HtmlAtom>
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../utils';
|
|
3
|
-
import { HtmlAtom } from '../atom';
|
|
4
|
-
import { CalendarBond } from './bond.svelte';
|
|
5
|
-
|
|
6
|
-
const calendarBond = CalendarBond.get();
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
class: klass = '',
|
|
10
|
-
preset = 'calendar.weekday',
|
|
11
|
-
isWeekend,
|
|
12
|
-
element = $bindable(undefined),
|
|
13
|
-
children = undefined,
|
|
14
|
-
...restProps
|
|
15
|
-
} = $props();
|
|
16
|
-
|
|
17
|
-
const weekDayProps = $derived({
|
|
18
|
-
...calendarBond?.weekDay(),
|
|
19
|
-
...restProps
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<HtmlAtom
|
|
24
|
-
{preset}
|
|
25
|
-
class={cn(
|
|
26
|
-
'calendar-week-day h-fit px-2 py-2 text-center text-sm font-medium',
|
|
27
|
-
isWeekend ? 'text-primary' : '',
|
|
28
|
-
klass
|
|
29
|
-
)}
|
|
30
|
-
data-weekend={isWeekend}
|
|
31
|
-
{...weekDayProps}
|
|
32
|
-
>
|
|
33
|
-
{@render children?.()}
|
|
34
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import { HtmlAtom } from '../atom';
|
|
4
|
+
import { CalendarBond } from './bond.svelte';
|
|
5
|
+
|
|
6
|
+
const calendarBond = CalendarBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
preset = 'calendar.weekday',
|
|
11
|
+
isWeekend,
|
|
12
|
+
element = $bindable(undefined),
|
|
13
|
+
children = undefined,
|
|
14
|
+
...restProps
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const weekDayProps = $derived({
|
|
18
|
+
...calendarBond?.weekDay(),
|
|
19
|
+
...restProps
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<HtmlAtom
|
|
24
|
+
{preset}
|
|
25
|
+
class={cn(
|
|
26
|
+
'calendar-week-day h-fit px-2 py-2 text-center text-sm font-medium',
|
|
27
|
+
isWeekend ? 'text-primary' : '',
|
|
28
|
+
klass
|
|
29
|
+
)}
|
|
30
|
+
data-weekend={isWeekend}
|
|
31
|
+
{...weekDayProps}
|
|
32
|
+
>
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
</HtmlAtom>
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
[data-atom='calendar-root'] {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: repeat(7, 1fr);
|
|
4
|
-
grid-template-rows: auto 1fr;
|
|
5
|
-
/*
|
|
6
|
-
--icare-root-background-color: color-mix(in srgb, black 5%, white 100%);
|
|
7
|
-
--icare-root-background-color-hover: color-mix(in srgb, black 5%, white 100%);
|
|
8
|
-
--icare-root-background-color-active: color-mix(in srgb, black 5%, white 100%);
|
|
9
|
-
|
|
10
|
-
--icare-root-text-color: black;
|
|
11
|
-
|
|
12
|
-
--icare-disabled-background-color: black;
|
|
13
|
-
--icare-disabled-text-color: black;
|
|
14
|
-
|
|
15
|
-
--icare-selected-background-color: black;
|
|
16
|
-
--icare-selected-text-color: white;
|
|
17
|
-
|
|
18
|
-
--icare-today-background-color: black;
|
|
19
|
-
--icare-today-text-color: black;
|
|
20
|
-
|
|
21
|
-
--icare-weekend-background-color: black;
|
|
22
|
-
--icare-weekend-text-color: black;
|
|
23
|
-
|
|
24
|
-
--icare-offmonth-background-color: black;
|
|
25
|
-
--icare-offmonth-text-color: black; */
|
|
26
|
-
}
|
|
1
|
+
[data-atom='calendar-root'] {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(7, 1fr);
|
|
4
|
+
grid-template-rows: auto 1fr;
|
|
5
|
+
/*
|
|
6
|
+
--icare-root-background-color: color-mix(in srgb, black 5%, white 100%);
|
|
7
|
+
--icare-root-background-color-hover: color-mix(in srgb, black 5%, white 100%);
|
|
8
|
+
--icare-root-background-color-active: color-mix(in srgb, black 5%, white 100%);
|
|
9
|
+
|
|
10
|
+
--icare-root-text-color: black;
|
|
11
|
+
|
|
12
|
+
--icare-disabled-background-color: black;
|
|
13
|
+
--icare-disabled-text-color: black;
|
|
14
|
+
|
|
15
|
+
--icare-selected-background-color: black;
|
|
16
|
+
--icare-selected-text-color: white;
|
|
17
|
+
|
|
18
|
+
--icare-today-background-color: black;
|
|
19
|
+
--icare-today-text-color: black;
|
|
20
|
+
|
|
21
|
+
--icare-weekend-background-color: black;
|
|
22
|
+
--icare-weekend-text-color: black;
|
|
23
|
+
|
|
24
|
+
--icare-offmonth-background-color: black;
|
|
25
|
+
--icare-offmonth-text-color: black; */
|
|
26
|
+
}
|
|
@@ -8,12 +8,7 @@
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
-
import CalendarHeader from './calendar-header.svelte';
|
|
12
11
|
import { Root } from '../root';
|
|
13
|
-
import { Card } from '../card';
|
|
14
|
-
|
|
15
|
-
let value = $state(undefined);
|
|
16
|
-
let checked = $state(false);
|
|
17
12
|
</script>
|
|
18
13
|
|
|
19
14
|
<Story name="Calendar">
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
export default Calendar;
|
|
2
|
-
type Calendar = {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type Calendar = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string;
|
|
5
8
|
};
|
|
6
|
-
declare const Calendar:
|
|
9
|
+
declare const Calendar: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|