@svelte-atoms/core 1.0.0-alpha.29 → 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 -852
- 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.stories.svelte +400 -401
- package/dist/components/atom/html-atom.svelte +71 -17
- 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 +27 -60
- package/dist/components/calendar/calendar-day.svelte +96 -96
- package/dist/components/calendar/calendar-header.svelte +29 -29
- package/dist/components/calendar/calendar-root.svelte +206 -206
- package/dist/components/calendar/calendar.stories.svelte +10 -15
- 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 +59 -59
- package/dist/components/datagrid/datagrid.css +5 -5
- package/dist/components/datagrid/datagrid.stories.svelte +72 -75
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -67
- package/dist/components/date-picker/date-picker-header.svelte +100 -100
- package/dist/components/date-picker/date-picker-months.svelte +142 -142
- package/dist/components/date-picker/date-picker-root.svelte +1 -1
- package/dist/components/date-picker/date-picker-years.svelte +205 -205
- package/dist/components/date-picker/date-picker.stories.svelte +11 -18
- package/dist/components/dialog/dialog-content.svelte +62 -62
- 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/form/form.stories.svelte +96 -99
- package/dist/components/image/image.stories.svelte +20 -23
- 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/lazy.stories.svelte +9 -16
- package/dist/components/lazy/lazy.svelte +28 -28
- 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 +40 -40
- 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 +175 -178
- package/dist/components/popover/popover-indicator.svelte +44 -43
- package/dist/components/popover/popover-root.svelte +48 -48
- package/dist/components/popover/popover.stories.svelte +49 -52
- package/dist/components/qr-code/qr-code.stories.svelte +4 -13
- package/dist/components/qr-code/qr-code.svelte +75 -75
- 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/sidebar-content.svelte +13 -2
- package/dist/components/sidebar/sidebar-root.svelte +10 -12
- package/dist/components/sidebar/sidebar.stories.svelte +8 -19
- package/dist/components/sidebar/types.d.ts +1 -0
- 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/package.json +6 -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 +1 @@
|
|
|
1
|
-
export declare function clickout<T extends Element>(onclick?: (ev: PointerEvent, node?: T) => void): (node: T) => () => void;
|
|
1
|
+
export declare function clickout<T extends Element>(onclick?: (ev: PointerEvent, node?: T) => void, options?: AddEventListenerOptions | undefined): (node: T) => () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { on } from 'svelte/events';
|
|
2
|
-
export function clickout(onclick) {
|
|
2
|
+
export function clickout(onclick, options) {
|
|
3
3
|
return (node) => {
|
|
4
4
|
const handler = (ev) => {
|
|
5
5
|
const target = ev.target;
|
|
@@ -7,7 +7,7 @@ export function clickout(onclick) {
|
|
|
7
7
|
onclick?.(ev, node);
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
-
const cleanup = on(window, 'click', handler);
|
|
10
|
+
const cleanup = on(window, 'click', handler, options);
|
|
11
11
|
return () => {
|
|
12
12
|
cleanup();
|
|
13
13
|
};
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type { AccordionRootProps } from './types';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
value = $bindable(undefined),
|
|
9
|
-
values = $bindable([]),
|
|
10
|
-
data = $bindable([]),
|
|
11
|
-
class: klass = '',
|
|
12
|
-
multiple = false,
|
|
13
|
-
collapsible = false,
|
|
14
|
-
disabled = false,
|
|
15
|
-
children = undefined,
|
|
16
|
-
factory = _factory,
|
|
17
|
-
onmount = undefined,
|
|
18
|
-
ondestroy = undefined,
|
|
19
|
-
animate = undefined,
|
|
20
|
-
enter = undefined,
|
|
21
|
-
exit = undefined,
|
|
22
|
-
initial = undefined,
|
|
23
|
-
...restProps
|
|
24
|
-
}: AccordionRootProps<E, B> = $props();
|
|
25
|
-
|
|
26
|
-
const bondProps = defineState<AccordionStateProps>([
|
|
27
|
-
defineProperty(
|
|
28
|
-
'values',
|
|
29
|
-
() => (multiple ? values : ([value].filter(Boolean) as string[])),
|
|
30
|
-
(v) => {
|
|
31
|
-
values = v;
|
|
32
|
-
value = values[0];
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
]);
|
|
36
|
-
const bond = factory(bondProps).share();
|
|
37
|
-
|
|
38
|
-
const rootProps = $derived({
|
|
39
|
-
...bond.root(),
|
|
40
|
-
...restProps
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
function _factory(props: typeof bondProps = bondProps) {
|
|
44
|
-
const bondState = new AccordionState(() => props);
|
|
45
|
-
|
|
46
|
-
return new AccordionBond(bondState);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function getBond() {
|
|
50
|
-
return bond;
|
|
51
|
-
}
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<HtmlAtom
|
|
55
|
-
preset="accordion"
|
|
56
|
-
class={['bg-card border-border flex list-none flex-col', '$preset', klass]}
|
|
57
|
-
{bond}
|
|
58
|
-
{...rootProps}
|
|
59
|
-
>
|
|
60
|
-
{@render children?.({ accordion: bond })}
|
|
61
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { defineProperty, defineState } from '../../utils';
|
|
3
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
4
|
+
import { AccordionBond, AccordionState, type AccordionStateProps } from './bond.svelte';
|
|
5
|
+
import type { AccordionRootProps } from './types';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
value = $bindable(undefined),
|
|
9
|
+
values = $bindable([]),
|
|
10
|
+
data = $bindable([]),
|
|
11
|
+
class: klass = '',
|
|
12
|
+
multiple = false,
|
|
13
|
+
collapsible = false,
|
|
14
|
+
disabled = false,
|
|
15
|
+
children = undefined,
|
|
16
|
+
factory = _factory,
|
|
17
|
+
onmount = undefined,
|
|
18
|
+
ondestroy = undefined,
|
|
19
|
+
animate = undefined,
|
|
20
|
+
enter = undefined,
|
|
21
|
+
exit = undefined,
|
|
22
|
+
initial = undefined,
|
|
23
|
+
...restProps
|
|
24
|
+
}: AccordionRootProps<E, B> = $props();
|
|
25
|
+
|
|
26
|
+
const bondProps = defineState<AccordionStateProps>([
|
|
27
|
+
defineProperty(
|
|
28
|
+
'values',
|
|
29
|
+
() => (multiple ? values : ([value].filter(Boolean) as string[])),
|
|
30
|
+
(v) => {
|
|
31
|
+
values = v;
|
|
32
|
+
value = values[0];
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
]);
|
|
36
|
+
const bond = factory(bondProps).share();
|
|
37
|
+
|
|
38
|
+
const rootProps = $derived({
|
|
39
|
+
...bond.root(),
|
|
40
|
+
...restProps
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function _factory(props: typeof bondProps = bondProps) {
|
|
44
|
+
const bondState = new AccordionState(() => props);
|
|
45
|
+
|
|
46
|
+
return new AccordionBond(bondState);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getBond() {
|
|
50
|
+
return bond;
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<HtmlAtom
|
|
55
|
+
preset="accordion"
|
|
56
|
+
class={['bg-card border-border flex list-none flex-col', '$preset', klass]}
|
|
57
|
+
{bond}
|
|
58
|
+
{...rootProps}
|
|
59
|
+
>
|
|
60
|
+
{@render children?.({ accordion: bond })}
|
|
61
|
+
</HtmlAtom>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AccordionBond } from './bond.svelte';
|
|
2
1
|
import { type Base } from '../atom';
|
|
2
|
+
import { AccordionBond } from './bond.svelte';
|
|
3
3
|
import type { AccordionRootProps } from './types';
|
|
4
4
|
declare function $$render<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(): {
|
|
5
5
|
props: AccordionRootProps<E, B>;
|
|
@@ -1,134 +1,145 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Accordion as AAccordion, AccordionItem } from '.';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Accordion as AAccordion, AccordionItem } from '.';
|
|
4
|
+
import { linear } from 'svelte/easing';
|
|
5
|
+
import { animate } from 'motion';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'Atoms/Accordion',
|
|
10
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
|
+
|
|
12
|
+
parameters: {
|
|
13
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: 'fullscreen'
|
|
15
|
+
},
|
|
16
|
+
args: {}
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<Story name="Accordion" args={{ collapsible: false, multiple: false, disabled: false }}>
|
|
24
|
+
{#snippet children(args)}
|
|
25
|
+
<AAccordion class="backdrop-blur-sm" {...args}>
|
|
26
|
+
<AccordionItem.Root>
|
|
27
|
+
<AccordionItem.Header>
|
|
28
|
+
<div>Hello Atomic UI 1</div>
|
|
29
|
+
<AccordionItem.Indicator />
|
|
30
|
+
</AccordionItem.Header>
|
|
31
|
+
|
|
32
|
+
<AccordionItem.Body
|
|
33
|
+
initial={(node) => {
|
|
34
|
+
Object.assign(node.style, { opacity: 0, height: 0 });
|
|
35
|
+
}}
|
|
36
|
+
enter={function (node) {
|
|
37
|
+
const d = 0.2;
|
|
38
|
+
animate(
|
|
39
|
+
node,
|
|
40
|
+
{
|
|
41
|
+
opacity: 1,
|
|
42
|
+
height: 'auto'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
duration: d
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return { duration: d * 1000 };
|
|
50
|
+
}}
|
|
51
|
+
exit={(node) => {
|
|
52
|
+
const d = 0.2;
|
|
53
|
+
animate(node, { opacity: 0, height: 0 }, { duration: d });
|
|
54
|
+
|
|
55
|
+
return { duration: d * 1000 };
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<div class="p-2">
|
|
59
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
60
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
61
|
+
dolor diam nascetur.
|
|
62
|
+
</div>
|
|
63
|
+
</AccordionItem.Body>
|
|
64
|
+
</AccordionItem.Root>
|
|
65
|
+
|
|
66
|
+
<AccordionItem.Root>
|
|
67
|
+
<AccordionItem.Header>
|
|
68
|
+
<div>Hello Atomic UI 2</div>
|
|
69
|
+
<AccordionItem.Indicator />
|
|
70
|
+
</AccordionItem.Header>
|
|
71
|
+
|
|
72
|
+
<AccordionItem.Body
|
|
73
|
+
initial={(node) => {
|
|
74
|
+
Object.assign(node.style, { opacity: 0, height: 0 });
|
|
75
|
+
}}
|
|
76
|
+
enter={(node) => {
|
|
77
|
+
animate(
|
|
78
|
+
node,
|
|
79
|
+
{
|
|
80
|
+
opacity: 1,
|
|
81
|
+
height: 'auto'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
duration: 0.2,
|
|
85
|
+
ease: linear
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return { duration: 0.2 };
|
|
90
|
+
}}
|
|
91
|
+
exit={(node) => {
|
|
92
|
+
animate(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: linear });
|
|
93
|
+
|
|
94
|
+
return { duration: 0.2 };
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<div class="p-2">
|
|
98
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
99
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
100
|
+
dolor diam nascetur.
|
|
101
|
+
</div>
|
|
102
|
+
</AccordionItem.Body>
|
|
103
|
+
</AccordionItem.Root>
|
|
104
|
+
|
|
105
|
+
<AccordionItem.Root>
|
|
106
|
+
<AccordionItem.Header>
|
|
107
|
+
<div>Hello Atomic UI 3</div>
|
|
108
|
+
<AccordionItem.Indicator />
|
|
109
|
+
</AccordionItem.Header>
|
|
110
|
+
|
|
111
|
+
<AccordionItem.Body
|
|
112
|
+
initial={(node) => {
|
|
113
|
+
Object.assign(node.style, { opacity: 0, height: 0 });
|
|
114
|
+
}}
|
|
115
|
+
enter={(node) => {
|
|
116
|
+
animate(
|
|
117
|
+
node,
|
|
118
|
+
{
|
|
119
|
+
opacity: 1,
|
|
120
|
+
height: 'auto'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
duration: 0.2,
|
|
124
|
+
ease: linear
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
return { duration: 0.2 };
|
|
129
|
+
}}
|
|
130
|
+
exit={(node) => {
|
|
131
|
+
animate(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: linear });
|
|
132
|
+
|
|
133
|
+
return { duration: 0.2 };
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<div class="p-2">
|
|
137
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
138
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
139
|
+
dolor diam nascetur.
|
|
140
|
+
</div>
|
|
141
|
+
</AccordionItem.Body>
|
|
142
|
+
</AccordionItem.Root>
|
|
143
|
+
</AAccordion>
|
|
144
|
+
{/snippet}
|
|
145
|
+
</Story>
|