@svelte-atoms/core 1.0.0-alpha.30 → 1.0.0-alpha.31
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 +853 -852
- package/dist/components/accordion/accordion-root.svelte +7 -3
- package/dist/components/accordion/accordion.stories.svelte +7 -82
- package/dist/components/accordion/item/accordion-item-body.svelte +44 -42
- package/dist/components/accordion/item/accordion-item-header.svelte +51 -50
- package/dist/components/accordion/item/accordion-item-indicator.svelte +51 -50
- package/dist/components/accordion/item/accordion-item-root.svelte +66 -65
- package/dist/components/accordion/item/bond.svelte.d.ts +2 -0
- package/dist/components/accordion/item/index.d.ts +3 -0
- package/dist/components/accordion/item/index.js +3 -0
- package/dist/components/accordion/item/motion.svelte.d.ts +15 -0
- package/dist/components/accordion/item/motion.svelte.js +30 -0
- package/dist/components/accordion/item/types.d.ts +7 -24
- package/dist/components/alert/alert-close-button.svelte +66 -70
- package/dist/components/alert/alert-description.svelte +42 -42
- package/dist/components/alert/alert-description.svelte.d.ts +3 -6
- package/dist/components/alert/alert-root.svelte +68 -103
- package/dist/components/alert/alert-root.svelte.d.ts +2 -2
- package/dist/components/alert/alert.stories.svelte +400 -400
- package/dist/components/alert/bond.svelte.d.ts +0 -13
- package/dist/components/alert/bond.svelte.js +0 -32
- package/dist/components/alert/types.d.ts +8 -32
- package/dist/components/atom/html-atom.svelte +261 -261
- package/dist/components/avatar/avatar.stories.svelte +22 -22
- package/dist/components/badge/badge.stories.svelte +12 -12
- package/dist/components/badge/badge.svelte +19 -19
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +5 -5
- package/dist/components/button/button.stories.svelte +27 -27
- package/dist/components/calendar/calendar-day.svelte +101 -96
- package/dist/components/calendar/calendar.stories.svelte +26 -26
- 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 -133
- package/dist/components/checkbox/checkbox.stories.svelte +22 -22
- package/dist/components/checkbox/checkbox.svelte +6 -2
- package/dist/components/collapsible/collapsible.stories.svelte +172 -172
- package/dist/components/combobox/atoms.d.ts +1 -1
- package/dist/components/combobox/atoms.js +1 -1
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/compobox.stories.svelte +51 -51
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/container/container.stories.svelte +20 -20
- package/dist/components/container/container.svelte.d.ts +1 -1
- package/dist/components/datagrid/datagrid.stories.svelte +72 -72
- package/dist/components/datagrid/tr/bond.svelte.d.ts +4 -2
- package/dist/components/datagrid/tr/bond.svelte.js +9 -7
- package/dist/components/datagrid/tr/datagrid-tr.svelte +90 -88
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -67
- package/dist/components/date-picker/date-picker-root.svelte +95 -95
- package/dist/components/date-picker/date-picker.stories.svelte +35 -35
- package/dist/components/dialog/bond.svelte.d.ts +13 -3
- package/dist/components/dialog/bond.svelte.js +66 -5
- package/dist/components/dialog/dialog-content.svelte +44 -62
- package/dist/components/dialog/dialog-root.svelte +91 -110
- package/dist/components/dialog/dialog.stories.svelte +64 -64
- package/dist/components/dialog/motion.svelte.d.ts +13 -0
- package/dist/components/dialog/motion.svelte.js +44 -0
- package/dist/components/drawer/attachments.svelte.d.ts +1 -1
- package/dist/components/drawer/attachments.svelte.js +1 -3
- package/dist/components/drawer/bond.svelte.d.ts +24 -5
- package/dist/components/drawer/bond.svelte.js +77 -11
- package/dist/components/drawer/drawer-content.svelte +6 -14
- package/dist/components/drawer/drawer.stories.svelte +27 -95
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/drawer/motion.d.ts +15 -0
- package/dist/components/drawer/motion.js +28 -0
- package/dist/components/dropdown/atoms.d.ts +1 -1
- package/dist/components/dropdown/atoms.js +1 -1
- package/dist/components/dropdown/bond.svelte.d.ts +5 -1
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown.stories.svelte +80 -80
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/form/form.stories.svelte +96 -96
- package/dist/components/image/image.stories.svelte +20 -20
- package/dist/components/input/input.stories.svelte +35 -35
- package/dist/components/label/label.stories.svelte +15 -15
- package/dist/components/lazy/lazy.stories.svelte +28 -28
- package/dist/components/link/link.stories.svelte +15 -15
- package/dist/components/list/list-item.svelte +20 -20
- package/dist/components/menu/atoms.d.ts +1 -0
- package/dist/components/menu/atoms.js +1 -0
- package/dist/components/menu/index.d.ts +2 -1
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/menu-item.svelte +69 -51
- package/dist/components/menu/menu-item.svelte.d.ts +1 -0
- package/dist/components/menu/menu.stories.svelte +33 -33
- package/dist/components/popover/bond.svelte.d.ts +20 -7
- package/dist/components/popover/bond.svelte.js +80 -27
- package/dist/components/popover/motion.d.ts +6 -0
- package/dist/components/popover/motion.js +56 -0
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +34 -72
- package/dist/components/popover/popover-indicator.svelte +44 -44
- package/dist/components/popover/popover-root.svelte +48 -48
- package/dist/components/popover/popover.stories.svelte +3 -3
- package/dist/components/popover/types.d.ts +9 -7
- package/dist/components/portal/active-portal.svelte +29 -22
- package/dist/components/portal/active-portal.svelte.d.ts +2 -9
- package/dist/components/portal/portal-root.svelte +76 -83
- package/dist/components/portal/portal-root.svelte.d.ts +4 -6
- package/dist/components/portal/teleport.svelte +49 -50
- package/dist/components/portal/teleport.svelte.d.ts +3 -4
- package/dist/components/qr-code/qr-code.stories.svelte +18 -18
- package/dist/components/radio/radio-group.stories.svelte +41 -41
- package/dist/components/radio/radio.stories.svelte +17 -17
- package/dist/components/radio/radio.svelte +1 -1
- package/dist/components/radio/types.d.ts +98 -0
- package/dist/components/radio/types.js +2 -0
- package/dist/components/root/root.svelte +13 -30
- package/dist/components/root/root.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable-root.svelte.d.ts +2 -2
- package/dist/components/scrollable/scrollable.stories.svelte +116 -116
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/index.js +2 -0
- package/dist/components/sidebar/motion.svelte.d.ts +11 -0
- package/dist/components/sidebar/motion.svelte.js +16 -0
- package/dist/components/sidebar/sidebar-content.svelte +3 -13
- package/dist/components/sidebar/sidebar-root.svelte +39 -39
- package/dist/components/sidebar/sidebar.stories.svelte +43 -43
- package/dist/components/sidebar/types.d.ts +2 -12
- package/dist/components/tabs/tabs.stories.svelte +56 -56
- package/dist/components/textarea/atoms.d.ts +1 -0
- package/dist/components/textarea/atoms.js +1 -0
- package/dist/components/textarea/textarea-input.svelte +9 -6
- package/dist/components/textarea/textarea-root.svelte +9 -9
- package/dist/components/textarea/textarea-root.svelte.d.ts +2 -0
- package/dist/components/tooltip/tooltip-trigger.svelte +2 -2
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +1 -0
- package/dist/components/tooltip/tooltip.stories.svelte +32 -32
- package/dist/components/tree/tree.stories.svelte +142 -142
- package/dist/icons/icon-copy.svelte +6 -0
- package/dist/{components/radio/types.svelte.d.ts → icons/icon-copy.svelte.d.ts} +3 -3
- package/dist/utils/markdown-to-llm.d.ts +28 -0
- package/dist/utils/markdown-to-llm.js +76 -0
- package/package.json +1 -2
- package/dist/components/radio/types.svelte +0 -0
- package/llm/composition.md +0 -395
- package/llm/crafting.md +0 -838
- package/llm/motion.md +0 -970
- package/llm/philosophy.md +0 -23
- package/llm/preset-variant-integration.md +0 -516
- package/llm/preset.md +0 -383
- package/llm/styling.md +0 -216
- package/llm/usage.md +0 -46
- package/llm/variants.md +0 -1259
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Collapsible as ACollapsible } from '.';
|
|
4
|
-
|
|
5
|
-
import { animate as motion } 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/Collapsible',
|
|
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="Collapsible" args={{}}>
|
|
24
|
-
<div class="flex w-full flex-col gap-2">
|
|
25
|
-
<ACollapsible.Root>
|
|
26
|
-
{#snippet children({ collapsible })}
|
|
27
|
-
{@const isOpen = collapsible.state.props.open}
|
|
28
|
-
|
|
29
|
-
<ACollapsible.Header class="">
|
|
30
|
-
<div>Hello Atoms UI 1</div>
|
|
31
|
-
<ACollapsible.Indicator />
|
|
32
|
-
</ACollapsible.Header>
|
|
33
|
-
|
|
34
|
-
<ACollapsible.Body
|
|
35
|
-
class={['pointer-events-none h-0 opacity-0', isOpen && 'pointer-events-auto']}
|
|
36
|
-
enter={(node) => {
|
|
37
|
-
motion(
|
|
38
|
-
node,
|
|
39
|
-
{
|
|
40
|
-
opacity: +isOpen,
|
|
41
|
-
height: isOpen ? 'auto' : 0
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
duration: 0.2,
|
|
45
|
-
ease: 'linear'
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
return { duration: 0.2 };
|
|
49
|
-
}}
|
|
50
|
-
exit={(node) => {
|
|
51
|
-
motion(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: 'linear' });
|
|
52
|
-
return { duration: 0.2 };
|
|
53
|
-
}}
|
|
54
|
-
animate={(node) => {
|
|
55
|
-
motion(
|
|
56
|
-
node,
|
|
57
|
-
{
|
|
58
|
-
opacity: +isOpen,
|
|
59
|
-
height: isOpen ? 'auto' : 0
|
|
60
|
-
},
|
|
61
|
-
{ duration: 0.2, ease: 'linear' }
|
|
62
|
-
);
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
<div class="py-2">
|
|
66
|
-
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
67
|
-
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
68
|
-
dolor diam nascetur.
|
|
69
|
-
</div>
|
|
70
|
-
</ACollapsible.Body>
|
|
71
|
-
{/snippet}
|
|
72
|
-
</ACollapsible.Root>
|
|
73
|
-
|
|
74
|
-
<ACollapsible.Root>
|
|
75
|
-
{#snippet children({ collapsible })}
|
|
76
|
-
{@const isOpen = collapsible.state.isOpen}
|
|
77
|
-
|
|
78
|
-
<ACollapsible.Header class="">
|
|
79
|
-
<div>Hello Atoms UI 2</div>
|
|
80
|
-
<ACollapsible.Indicator />
|
|
81
|
-
</ACollapsible.Header>
|
|
82
|
-
|
|
83
|
-
<ACollapsible.Body
|
|
84
|
-
class={['pointer-events-none h-0 opacity-0', isOpen && 'pointer-events-auto']}
|
|
85
|
-
enter={(node) => {
|
|
86
|
-
motion(
|
|
87
|
-
node,
|
|
88
|
-
{
|
|
89
|
-
opacity: +isOpen,
|
|
90
|
-
height: isOpen ? 'auto' : 0
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
duration: 0.2,
|
|
94
|
-
ease: 'linear'
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
return { duration: 0.2 };
|
|
98
|
-
}}
|
|
99
|
-
exit={(node) => {
|
|
100
|
-
motion(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: 'linear' });
|
|
101
|
-
return { duration: 0.2 };
|
|
102
|
-
}}
|
|
103
|
-
animate={(node) => {
|
|
104
|
-
motion(
|
|
105
|
-
node,
|
|
106
|
-
{
|
|
107
|
-
opacity: +isOpen,
|
|
108
|
-
height: isOpen ? 'auto' : 0
|
|
109
|
-
},
|
|
110
|
-
{ duration: 0.1, ease: 'linear' }
|
|
111
|
-
);
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
<div class="py-2">
|
|
115
|
-
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
116
|
-
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
117
|
-
dolor diam nascetur.
|
|
118
|
-
</div>
|
|
119
|
-
</ACollapsible.Body>
|
|
120
|
-
{/snippet}
|
|
121
|
-
</ACollapsible.Root>
|
|
122
|
-
|
|
123
|
-
<ACollapsible.Root>
|
|
124
|
-
{#snippet children({ collapsible })}
|
|
125
|
-
{@const isOpen = collapsible.state.isOpen}
|
|
126
|
-
|
|
127
|
-
<ACollapsible.Header class="">
|
|
128
|
-
<div>Hello Atoms UI 3</div>
|
|
129
|
-
<ACollapsible.Indicator />
|
|
130
|
-
</ACollapsible.Header>
|
|
131
|
-
|
|
132
|
-
<ACollapsible.Body
|
|
133
|
-
class={['pointer-events-none h-0 opacity-0', isOpen && 'pointer-events-auto']}
|
|
134
|
-
enter={(node) => {
|
|
135
|
-
motion(
|
|
136
|
-
node,
|
|
137
|
-
{
|
|
138
|
-
opacity: +isOpen,
|
|
139
|
-
height: isOpen ? 'auto' : 0
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
duration: 0.2,
|
|
143
|
-
ease: 'linear'
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
return { duration: 0.2 };
|
|
147
|
-
}}
|
|
148
|
-
exit={(node) => {
|
|
149
|
-
motion(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: 'linear' });
|
|
150
|
-
return { duration: 0.2 };
|
|
151
|
-
}}
|
|
152
|
-
animate={(node) => {
|
|
153
|
-
motion(
|
|
154
|
-
node,
|
|
155
|
-
{
|
|
156
|
-
opacity: +isOpen,
|
|
157
|
-
height: isOpen ? 'auto' : 0
|
|
158
|
-
},
|
|
159
|
-
{ duration: 0.1, ease: 'linear' }
|
|
160
|
-
);
|
|
161
|
-
}}
|
|
162
|
-
>
|
|
163
|
-
<div class="py-2">
|
|
164
|
-
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
165
|
-
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
166
|
-
dolor diam nascetur.
|
|
167
|
-
</div>
|
|
168
|
-
</ACollapsible.Body>
|
|
169
|
-
{/snippet}
|
|
170
|
-
</ACollapsible.Root>
|
|
171
|
-
</div>
|
|
172
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Collapsible as ACollapsible } from '.';
|
|
4
|
+
|
|
5
|
+
import { animate as motion } 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/Collapsible',
|
|
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="Collapsible" args={{}}>
|
|
24
|
+
<div class="flex w-full flex-col gap-2">
|
|
25
|
+
<ACollapsible.Root>
|
|
26
|
+
{#snippet children({ collapsible })}
|
|
27
|
+
{@const isOpen = collapsible.state.props.open}
|
|
28
|
+
|
|
29
|
+
<ACollapsible.Header class="">
|
|
30
|
+
<div>Hello Atoms UI 1</div>
|
|
31
|
+
<ACollapsible.Indicator />
|
|
32
|
+
</ACollapsible.Header>
|
|
33
|
+
|
|
34
|
+
<ACollapsible.Body
|
|
35
|
+
class={['pointer-events-none h-0 opacity-0', isOpen && 'pointer-events-auto']}
|
|
36
|
+
enter={(node) => {
|
|
37
|
+
motion(
|
|
38
|
+
node,
|
|
39
|
+
{
|
|
40
|
+
opacity: +isOpen,
|
|
41
|
+
height: isOpen ? 'auto' : 0
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
duration: 0.2,
|
|
45
|
+
ease: 'linear'
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
return { duration: 0.2 };
|
|
49
|
+
}}
|
|
50
|
+
exit={(node) => {
|
|
51
|
+
motion(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: 'linear' });
|
|
52
|
+
return { duration: 0.2 };
|
|
53
|
+
}}
|
|
54
|
+
animate={(node) => {
|
|
55
|
+
motion(
|
|
56
|
+
node,
|
|
57
|
+
{
|
|
58
|
+
opacity: +isOpen,
|
|
59
|
+
height: isOpen ? 'auto' : 0
|
|
60
|
+
},
|
|
61
|
+
{ duration: 0.2, ease: 'linear' }
|
|
62
|
+
);
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<div class="py-2">
|
|
66
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
67
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
68
|
+
dolor diam nascetur.
|
|
69
|
+
</div>
|
|
70
|
+
</ACollapsible.Body>
|
|
71
|
+
{/snippet}
|
|
72
|
+
</ACollapsible.Root>
|
|
73
|
+
|
|
74
|
+
<ACollapsible.Root>
|
|
75
|
+
{#snippet children({ collapsible })}
|
|
76
|
+
{@const isOpen = collapsible.state.isOpen}
|
|
77
|
+
|
|
78
|
+
<ACollapsible.Header class="">
|
|
79
|
+
<div>Hello Atoms UI 2</div>
|
|
80
|
+
<ACollapsible.Indicator />
|
|
81
|
+
</ACollapsible.Header>
|
|
82
|
+
|
|
83
|
+
<ACollapsible.Body
|
|
84
|
+
class={['pointer-events-none h-0 opacity-0', isOpen && 'pointer-events-auto']}
|
|
85
|
+
enter={(node) => {
|
|
86
|
+
motion(
|
|
87
|
+
node,
|
|
88
|
+
{
|
|
89
|
+
opacity: +isOpen,
|
|
90
|
+
height: isOpen ? 'auto' : 0
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
duration: 0.2,
|
|
94
|
+
ease: 'linear'
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
return { duration: 0.2 };
|
|
98
|
+
}}
|
|
99
|
+
exit={(node) => {
|
|
100
|
+
motion(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: 'linear' });
|
|
101
|
+
return { duration: 0.2 };
|
|
102
|
+
}}
|
|
103
|
+
animate={(node) => {
|
|
104
|
+
motion(
|
|
105
|
+
node,
|
|
106
|
+
{
|
|
107
|
+
opacity: +isOpen,
|
|
108
|
+
height: isOpen ? 'auto' : 0
|
|
109
|
+
},
|
|
110
|
+
{ duration: 0.1, ease: 'linear' }
|
|
111
|
+
);
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<div class="py-2">
|
|
115
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
116
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
117
|
+
dolor diam nascetur.
|
|
118
|
+
</div>
|
|
119
|
+
</ACollapsible.Body>
|
|
120
|
+
{/snippet}
|
|
121
|
+
</ACollapsible.Root>
|
|
122
|
+
|
|
123
|
+
<ACollapsible.Root>
|
|
124
|
+
{#snippet children({ collapsible })}
|
|
125
|
+
{@const isOpen = collapsible.state.isOpen}
|
|
126
|
+
|
|
127
|
+
<ACollapsible.Header class="">
|
|
128
|
+
<div>Hello Atoms UI 3</div>
|
|
129
|
+
<ACollapsible.Indicator />
|
|
130
|
+
</ACollapsible.Header>
|
|
131
|
+
|
|
132
|
+
<ACollapsible.Body
|
|
133
|
+
class={['pointer-events-none h-0 opacity-0', isOpen && 'pointer-events-auto']}
|
|
134
|
+
enter={(node) => {
|
|
135
|
+
motion(
|
|
136
|
+
node,
|
|
137
|
+
{
|
|
138
|
+
opacity: +isOpen,
|
|
139
|
+
height: isOpen ? 'auto' : 0
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
duration: 0.2,
|
|
143
|
+
ease: 'linear'
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
return { duration: 0.2 };
|
|
147
|
+
}}
|
|
148
|
+
exit={(node) => {
|
|
149
|
+
motion(node, { opacity: 0, height: 0 }, { duration: 0.2, ease: 'linear' });
|
|
150
|
+
return { duration: 0.2 };
|
|
151
|
+
}}
|
|
152
|
+
animate={(node) => {
|
|
153
|
+
motion(
|
|
154
|
+
node,
|
|
155
|
+
{
|
|
156
|
+
opacity: +isOpen,
|
|
157
|
+
height: isOpen ? 'auto' : 0
|
|
158
|
+
},
|
|
159
|
+
{ duration: 0.1, ease: 'linear' }
|
|
160
|
+
);
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
<div class="py-2">
|
|
164
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
165
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
166
|
+
dolor diam nascetur.
|
|
167
|
+
</div>
|
|
168
|
+
</ACollapsible.Body>
|
|
169
|
+
{/snippet}
|
|
170
|
+
</ACollapsible.Root>
|
|
171
|
+
</div>
|
|
172
|
+
</Story>
|
|
@@ -6,4 +6,4 @@ export { default as Item } from './compobox-item.svelte';
|
|
|
6
6
|
*/
|
|
7
7
|
export { default as Input } from './combobox-control.svelte';
|
|
8
8
|
export { default as Control } from './combobox-control.svelte';
|
|
9
|
-
export { Arrow, Indicator, List } from '../dropdown/atoms';
|
|
9
|
+
export { Arrow, Indicator, List, Group, Divider, Title } from '../dropdown/atoms';
|
|
@@ -6,4 +6,4 @@ export { default as Item } from './compobox-item.svelte';
|
|
|
6
6
|
*/
|
|
7
7
|
export { default as Input } from './combobox-control.svelte';
|
|
8
8
|
export { default as Control } from './combobox-control.svelte';
|
|
9
|
-
export { Arrow, Indicator, List } from '../dropdown/atoms';
|
|
9
|
+
export { Arrow, Indicator, List, Group, Divider, Title } from '../dropdown/atoms';
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
<script lang="ts" generics="D">
|
|
2
|
-
import type { ComboboxRootProps } from './types';
|
|
3
|
-
import { defineProperty, defineState } from '../../utils';
|
|
4
|
-
import { ComboboxBond, ComboboxBondState, type ComboboxBondProps } from './bond.svelte';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
open = $bindable(false),
|
|
8
|
-
value = $bindable(),
|
|
9
|
-
values = $bindable(),
|
|
10
|
-
query = $bindable(),
|
|
11
|
-
text = $bindable(),
|
|
12
|
-
multiple = false,
|
|
13
|
-
disabled = false,
|
|
14
|
-
placements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
15
|
-
placement = 'bottom-start',
|
|
16
|
-
offset = 1,
|
|
17
|
-
factory = _factory,
|
|
18
|
-
children = undefined,
|
|
19
|
-
...restProps
|
|
20
|
-
}: ComboboxRootProps = $props();
|
|
21
|
-
|
|
22
|
-
const bondProps = defineState<ComboboxBondProps>(
|
|
23
|
-
[
|
|
24
|
-
defineProperty(
|
|
25
|
-
'open',
|
|
26
|
-
() => open,
|
|
27
|
-
(v) => {
|
|
28
|
-
open = v;
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
defineProperty(
|
|
32
|
-
'values',
|
|
33
|
-
() => (multiple ? values : [value]),
|
|
34
|
-
(v) => {
|
|
35
|
-
values = v;
|
|
36
|
-
value = v[0];
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
defineProperty(
|
|
40
|
-
'query',
|
|
41
|
-
() => query,
|
|
42
|
-
(v) => (query = v)
|
|
43
|
-
),
|
|
44
|
-
defineProperty(
|
|
45
|
-
'text',
|
|
46
|
-
() => text,
|
|
47
|
-
(v) => (text = v)
|
|
48
|
-
)
|
|
49
|
-
],
|
|
50
|
-
() => ({ disabled, multiple, placements, offset, placement: 'bottom-start', ...restProps })
|
|
51
|
-
);
|
|
52
|
-
const bond = factory(bondProps).share();
|
|
53
|
-
|
|
54
|
-
function _factory(props: typeof bondProps) {
|
|
55
|
-
const bondState = new ComboboxBondState<D>(() => props);
|
|
56
|
-
|
|
57
|
-
return new ComboboxBond(bondState).share();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function getBond() {
|
|
61
|
-
return bond;
|
|
62
|
-
}
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
{@render children?.({ combobox: bond })}
|
|
1
|
+
<script lang="ts" generics="D">
|
|
2
|
+
import type { ComboboxRootProps } from './types';
|
|
3
|
+
import { defineProperty, defineState } from '../../utils';
|
|
4
|
+
import { ComboboxBond, ComboboxBondState, type ComboboxBondProps } from './bond.svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
open = $bindable(false),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
values = $bindable(),
|
|
10
|
+
query = $bindable(),
|
|
11
|
+
text = $bindable(),
|
|
12
|
+
multiple = false,
|
|
13
|
+
disabled = false,
|
|
14
|
+
placements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
15
|
+
placement = 'bottom-start',
|
|
16
|
+
offset = 1,
|
|
17
|
+
factory = _factory,
|
|
18
|
+
children = undefined,
|
|
19
|
+
...restProps
|
|
20
|
+
}: ComboboxRootProps = $props();
|
|
21
|
+
|
|
22
|
+
const bondProps = defineState<ComboboxBondProps>(
|
|
23
|
+
[
|
|
24
|
+
defineProperty(
|
|
25
|
+
'open',
|
|
26
|
+
() => open,
|
|
27
|
+
(v) => {
|
|
28
|
+
open = v;
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
defineProperty(
|
|
32
|
+
'values',
|
|
33
|
+
() => (multiple ? values : [value]),
|
|
34
|
+
(v) => {
|
|
35
|
+
values = v;
|
|
36
|
+
value = v[0];
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
defineProperty(
|
|
40
|
+
'query',
|
|
41
|
+
() => query,
|
|
42
|
+
(v) => (query = v)
|
|
43
|
+
),
|
|
44
|
+
defineProperty(
|
|
45
|
+
'text',
|
|
46
|
+
() => text,
|
|
47
|
+
(v) => (text = v)
|
|
48
|
+
)
|
|
49
|
+
],
|
|
50
|
+
() => ({ disabled, multiple, placements, offset, placement: 'bottom-start', ...restProps })
|
|
51
|
+
);
|
|
52
|
+
const bond = factory(bondProps).share();
|
|
53
|
+
|
|
54
|
+
function _factory(props: typeof bondProps) {
|
|
55
|
+
const bondState = new ComboboxBondState<D>(() => props);
|
|
56
|
+
|
|
57
|
+
return new ComboboxBond(bondState).share();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getBond() {
|
|
61
|
+
return bond;
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{@render children?.({ combobox: bond })}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Combobox as ACombobox } from '.';
|
|
4
|
-
import { Input } from '../input';
|
|
5
|
-
import { Divider } from '../divider';
|
|
6
|
-
|
|
7
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'Atoms/Combobox',
|
|
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
|
-
let open = $state(false);
|
|
22
|
-
let value = $state<string | undefined>('ar');
|
|
23
|
-
let array = $state([
|
|
24
|
-
{ value: 'ar', label: 'Arabic' },
|
|
25
|
-
{ value: 'en', label: 'English' },
|
|
26
|
-
{ value: 'sp', label: 'Spanish' },
|
|
27
|
-
{ value: 'it', label: 'Italian' }
|
|
28
|
-
]);
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<Story name="Combobox" args={{}}>
|
|
32
|
-
<ACombobox.Root bind:open bind:value>
|
|
33
|
-
{#snippet children({ combobox })}
|
|
34
|
-
<ACombobox.Trigger
|
|
35
|
-
base={Input.Root}
|
|
36
|
-
class="h-10 min-w-sm items-center gap-0 rounded-sm p-1 transition-colors duration-200"
|
|
37
|
-
>
|
|
38
|
-
<Input.Icon class="text-foreground/50">$</Input.Icon>
|
|
39
|
-
<Divider class="mx-1" vertical />
|
|
40
|
-
<ACombobox.Input class="px-1" placeholder="Select a language" />
|
|
41
|
-
</ACombobox.Trigger>
|
|
42
|
-
<ACombobox.List>
|
|
43
|
-
{#each array.filter((item) => !combobox.state.query || item.label
|
|
44
|
-
.toLowerCase()
|
|
45
|
-
.includes(combobox.state.query)) as item (item.value)}
|
|
46
|
-
<ACombobox.Item value={item.value}>{item.label}</ACombobox.Item>
|
|
47
|
-
{/each}
|
|
48
|
-
</ACombobox.List>
|
|
49
|
-
{/snippet}
|
|
50
|
-
</ACombobox.Root>
|
|
51
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Combobox as ACombobox } from '.';
|
|
4
|
+
import { Input } from '../input';
|
|
5
|
+
import { Divider } from '../divider';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'Atoms/Combobox',
|
|
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
|
+
let open = $state(false);
|
|
22
|
+
let value = $state<string | undefined>('ar');
|
|
23
|
+
let array = $state([
|
|
24
|
+
{ value: 'ar', label: 'Arabic' },
|
|
25
|
+
{ value: 'en', label: 'English' },
|
|
26
|
+
{ value: 'sp', label: 'Spanish' },
|
|
27
|
+
{ value: 'it', label: 'Italian' }
|
|
28
|
+
]);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Story name="Combobox" args={{}}>
|
|
32
|
+
<ACombobox.Root bind:open bind:value>
|
|
33
|
+
{#snippet children({ combobox })}
|
|
34
|
+
<ACombobox.Trigger
|
|
35
|
+
base={Input.Root}
|
|
36
|
+
class="h-10 min-w-sm items-center gap-0 rounded-sm p-1 transition-colors duration-200"
|
|
37
|
+
>
|
|
38
|
+
<Input.Icon class="text-foreground/50">$</Input.Icon>
|
|
39
|
+
<Divider class="mx-1" vertical />
|
|
40
|
+
<ACombobox.Input class="px-1" placeholder="Select a language" />
|
|
41
|
+
</ACombobox.Trigger>
|
|
42
|
+
<ACombobox.List>
|
|
43
|
+
{#each array.filter((item) => !combobox.state.query || item.label
|
|
44
|
+
.toLowerCase()
|
|
45
|
+
.includes(combobox.state.query)) as item (item.value)}
|
|
46
|
+
<ACombobox.Item value={item.value}>{item.label}</ACombobox.Item>
|
|
47
|
+
{/each}
|
|
48
|
+
</ACombobox.List>
|
|
49
|
+
{/snippet}
|
|
50
|
+
</ACombobox.Root>
|
|
51
|
+
</Story>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import ContainerCmp from './container.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'ATOMS/Container'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<Story name="Container">
|
|
11
|
-
<ContainerCmp class="flex w-full flex-col items-center gap-4">
|
|
12
|
-
<div class="flex w-full gap-4">
|
|
13
|
-
{#each { length: 5 } as _, i (i)}
|
|
14
|
-
<div class="bg-foreground h-80 flex-1 rounded-lg"></div>
|
|
15
|
-
{/each}
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div class="bg-foreground h-80 w-[50cqw] rounded-lg"></div>
|
|
19
|
-
</ContainerCmp>
|
|
20
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ContainerCmp from './container.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Container'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Story name="Container">
|
|
11
|
+
<ContainerCmp class="flex w-full flex-col items-center gap-4">
|
|
12
|
+
<div class="flex w-full gap-4">
|
|
13
|
+
{#each { length: 5 } as _, i (i)}
|
|
14
|
+
<div class="bg-foreground h-80 flex-1 rounded-lg"></div>
|
|
15
|
+
{/each}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="bg-foreground h-80 w-[50cqw] rounded-lg"></div>
|
|
19
|
+
</ContainerCmp>
|
|
20
|
+
</Story>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ContainerProps } from './types';
|
|
2
|
-
declare const Container: import("svelte").Component<ContainerProps, {}, "
|
|
2
|
+
declare const Container: import("svelte").Component<ContainerProps, {}, "clientHeight" | "clientWidth">;
|
|
3
3
|
type Container = ReturnType<typeof Container>;
|
|
4
4
|
export default Container;
|