@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,96 +1,96 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import AForm from './form-root.svelte';
|
|
4
|
-
import { Field } from './field';
|
|
5
|
-
import { Input } from '../input';
|
|
6
|
-
import { Checkbox } from '../checkbox';
|
|
7
|
-
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'ATOMS/Form'
|
|
10
|
-
});
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import { z } from 'zod';
|
|
15
|
-
import { ZodAdapter } from './field/validation-adapters';
|
|
16
|
-
import { Radio, RadioGroup } from '../radio';
|
|
17
|
-
|
|
18
|
-
const nameSchema = z.string().min(2).max(100);
|
|
19
|
-
|
|
20
|
-
const personSchema = z.object({
|
|
21
|
-
firstName: nameSchema,
|
|
22
|
-
lastName: nameSchema,
|
|
23
|
-
isAdmin: z.boolean()
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
type PersonSchema = z.infer<typeof personSchema>;
|
|
27
|
-
|
|
28
|
-
const validator = new ZodAdapter();
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<Story name="Form">
|
|
32
|
-
{#snippet children({ args })}
|
|
33
|
-
<AForm class="flex flex-col gap-2" {validator}>
|
|
34
|
-
<div class="mb-4 flex flex-col">
|
|
35
|
-
<h2 class="text-3xl font-semibold">Form Title</h2>
|
|
36
|
-
<p class="text-sm text-gray-500">Form description goes here.</p>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div class="flex gap-2">
|
|
40
|
-
<Field.Root name="first name" schema={personSchema.shape.firstName}>
|
|
41
|
-
{#snippet children({ field })}
|
|
42
|
-
<Field.Label>First Name</Field.Label>
|
|
43
|
-
<Input.Root>
|
|
44
|
-
<Field.Control
|
|
45
|
-
base={Input.Control}
|
|
46
|
-
placeholder="Enter your first name"
|
|
47
|
-
onblur={() => {
|
|
48
|
-
const results = field?.state.validate();
|
|
49
|
-
console.log(results);
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
</Input.Root>
|
|
53
|
-
{#if field?.state?.errors?.length > 0}
|
|
54
|
-
<div class="text-xs text-red-600">
|
|
55
|
-
{#each field.state.errors as error}
|
|
56
|
-
<div>{error.message}</div>
|
|
57
|
-
{/each}
|
|
58
|
-
</div>
|
|
59
|
-
{/if}
|
|
60
|
-
{/snippet}
|
|
61
|
-
</Field.Root>
|
|
62
|
-
|
|
63
|
-
<Field.Root name="last name" schema={personSchema.shape.lastName}>
|
|
64
|
-
<Field.Label>Last Name</Field.Label>
|
|
65
|
-
<Input.Root>
|
|
66
|
-
<Field.Control base={Input.Control} placeholder="Enter your last name" />
|
|
67
|
-
</Input.Root>
|
|
68
|
-
</Field.Root>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div class="flex flex-col">
|
|
72
|
-
<Field.Root name="is admin" schema={personSchema.shape.isAdmin}>
|
|
73
|
-
<Field.Label>Is Admin?</Field.Label>
|
|
74
|
-
<Field.Control base={Checkbox} />
|
|
75
|
-
</Field.Root>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<div class="flex flex-col">
|
|
79
|
-
<Field.Root name="color" schema={personSchema.shape.color}>
|
|
80
|
-
<Field.Label>Is current scheme black?</Field.Label>
|
|
81
|
-
<Field.Control class="flex flex-col items-start text-sm" base={RadioGroup}>
|
|
82
|
-
<div class="flex items-center gap-2">
|
|
83
|
-
<Radio value="yes" />
|
|
84
|
-
<div>Yes</div>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<div class="flex items-center gap-2">
|
|
88
|
-
<Radio value="no" />
|
|
89
|
-
<div>No</div>
|
|
90
|
-
</div>
|
|
91
|
-
</Field.Control>
|
|
92
|
-
</Field.Root>
|
|
93
|
-
</div>
|
|
94
|
-
</AForm>
|
|
95
|
-
{/snippet}
|
|
96
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import AForm from './form-root.svelte';
|
|
4
|
+
import { Field } from './field';
|
|
5
|
+
import { Input } from '../input';
|
|
6
|
+
import { Checkbox } from '../checkbox';
|
|
7
|
+
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'ATOMS/Form'
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { ZodAdapter } from './field/validation-adapters';
|
|
16
|
+
import { Radio, RadioGroup } from '../radio';
|
|
17
|
+
|
|
18
|
+
const nameSchema = z.string().min(2).max(100);
|
|
19
|
+
|
|
20
|
+
const personSchema = z.object({
|
|
21
|
+
firstName: nameSchema,
|
|
22
|
+
lastName: nameSchema,
|
|
23
|
+
isAdmin: z.boolean()
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
type PersonSchema = z.infer<typeof personSchema>;
|
|
27
|
+
|
|
28
|
+
const validator = new ZodAdapter();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Story name="Form">
|
|
32
|
+
{#snippet children({ args })}
|
|
33
|
+
<AForm class="flex flex-col gap-2" {validator}>
|
|
34
|
+
<div class="mb-4 flex flex-col">
|
|
35
|
+
<h2 class="text-3xl font-semibold">Form Title</h2>
|
|
36
|
+
<p class="text-sm text-gray-500">Form description goes here.</p>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div class="flex gap-2">
|
|
40
|
+
<Field.Root name="first name" schema={personSchema.shape.firstName}>
|
|
41
|
+
{#snippet children({ field })}
|
|
42
|
+
<Field.Label>First Name</Field.Label>
|
|
43
|
+
<Input.Root>
|
|
44
|
+
<Field.Control
|
|
45
|
+
base={Input.Control}
|
|
46
|
+
placeholder="Enter your first name"
|
|
47
|
+
onblur={() => {
|
|
48
|
+
const results = field?.state.validate();
|
|
49
|
+
console.log(results);
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
</Input.Root>
|
|
53
|
+
{#if field?.state?.errors?.length > 0}
|
|
54
|
+
<div class="text-xs text-red-600">
|
|
55
|
+
{#each field.state.errors as error}
|
|
56
|
+
<div>{error.message}</div>
|
|
57
|
+
{/each}
|
|
58
|
+
</div>
|
|
59
|
+
{/if}
|
|
60
|
+
{/snippet}
|
|
61
|
+
</Field.Root>
|
|
62
|
+
|
|
63
|
+
<Field.Root name="last name" schema={personSchema.shape.lastName}>
|
|
64
|
+
<Field.Label>Last Name</Field.Label>
|
|
65
|
+
<Input.Root>
|
|
66
|
+
<Field.Control base={Input.Control} placeholder="Enter your last name" />
|
|
67
|
+
</Input.Root>
|
|
68
|
+
</Field.Root>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="flex flex-col">
|
|
72
|
+
<Field.Root name="is admin" schema={personSchema.shape.isAdmin}>
|
|
73
|
+
<Field.Label>Is Admin?</Field.Label>
|
|
74
|
+
<Field.Control base={Checkbox} />
|
|
75
|
+
</Field.Root>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div class="flex flex-col">
|
|
79
|
+
<Field.Root name="color" schema={personSchema.shape.color}>
|
|
80
|
+
<Field.Label>Is current scheme black?</Field.Label>
|
|
81
|
+
<Field.Control class="flex flex-col items-start text-sm" base={RadioGroup}>
|
|
82
|
+
<div class="flex items-center gap-2">
|
|
83
|
+
<Radio value="yes" />
|
|
84
|
+
<div>Yes</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div class="flex items-center gap-2">
|
|
88
|
+
<Radio value="no" />
|
|
89
|
+
<div>No</div>
|
|
90
|
+
</div>
|
|
91
|
+
</Field.Control>
|
|
92
|
+
</Field.Root>
|
|
93
|
+
</div>
|
|
94
|
+
</AForm>
|
|
95
|
+
{/snippet}
|
|
96
|
+
</Story>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import ImageCmp from './image.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'ATOMS/Image'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<Story name="Image">
|
|
11
|
-
{#snippet children({ args })}
|
|
12
|
-
<ImageCmp
|
|
13
|
-
class="h-[400px] w-[600px]"
|
|
14
|
-
src="https://placehold.co/600x400/t"
|
|
15
|
-
alt="Placeholder image"
|
|
16
|
-
>
|
|
17
|
-
<p>Failed Loading...</p>
|
|
18
|
-
</ImageCmp>
|
|
19
|
-
{/snippet}
|
|
20
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import ImageCmp from './image.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Image'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<Story name="Image">
|
|
11
|
+
{#snippet children({ args })}
|
|
12
|
+
<ImageCmp
|
|
13
|
+
class="h-[400px] w-[600px]"
|
|
14
|
+
src="https://placehold.co/600x400/t"
|
|
15
|
+
alt="Placeholder image"
|
|
16
|
+
>
|
|
17
|
+
<p>Failed Loading...</p>
|
|
18
|
+
</ImageCmp>
|
|
19
|
+
{/snippet}
|
|
20
|
+
</Story>
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Input as AInput } from '.';
|
|
4
|
-
import { Label } from '../label';
|
|
5
|
-
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'Atoms/Input',
|
|
9
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
10
|
-
|
|
11
|
-
parameters: {
|
|
12
|
-
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
-
layout: 'fullscreen'
|
|
14
|
-
},
|
|
15
|
-
args: {}
|
|
16
|
-
});
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<script lang="ts">
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Story name="Input" args={{}}>
|
|
23
|
-
<div class="flex flex-col">
|
|
24
|
-
<Label for="price-input">Price</Label>
|
|
25
|
-
<AInput.Root>
|
|
26
|
-
<AInput.Icon class="text-foreground box-content px-0">$</AInput.Icon>
|
|
27
|
-
<AInput.Control id="price-input" class="border-border box-content border-x px-2 py-2">
|
|
28
|
-
<!-- -->
|
|
29
|
-
</AInput.Control>
|
|
30
|
-
<AInput.Icon class="text-foreground box-content px-2">.00</AInput.Icon>
|
|
31
|
-
|
|
32
|
-
<AInput.Placeholder class="text-foreground/20 pl-2">Hello World</AInput.Placeholder>
|
|
33
|
-
</AInput.Root>
|
|
34
|
-
</div>
|
|
35
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Input as AInput } from '.';
|
|
4
|
+
import { Label } from '../label';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Atoms/Input',
|
|
9
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
10
|
+
|
|
11
|
+
parameters: {
|
|
12
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
+
layout: 'fullscreen'
|
|
14
|
+
},
|
|
15
|
+
args: {}
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Story name="Input" args={{}}>
|
|
23
|
+
<div class="flex flex-col">
|
|
24
|
+
<Label for="price-input">Price</Label>
|
|
25
|
+
<AInput.Root>
|
|
26
|
+
<AInput.Icon class="text-foreground box-content px-0">$</AInput.Icon>
|
|
27
|
+
<AInput.Control id="price-input" class="border-border box-content border-x px-2 py-2">
|
|
28
|
+
<!-- -->
|
|
29
|
+
</AInput.Control>
|
|
30
|
+
<AInput.Icon class="text-foreground box-content px-2">.00</AInput.Icon>
|
|
31
|
+
|
|
32
|
+
<AInput.Placeholder class="text-foreground/20 pl-2">Hello World</AInput.Placeholder>
|
|
33
|
+
</AInput.Root>
|
|
34
|
+
</div>
|
|
35
|
+
</Story>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { default as LabelCmp } from './label.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'ATOMS/Label'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story name="Label">
|
|
14
|
-
<LabelCmp>Hello World</LabelCmp>
|
|
15
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { default as LabelCmp } from './label.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Label'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Label">
|
|
14
|
+
<LabelCmp>Hello World</LabelCmp>
|
|
15
|
+
</Story>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
|
|
4
|
-
const { Story } = defineMeta({
|
|
5
|
-
title: 'Atoms/Lazy'
|
|
6
|
-
});
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script lang="ts">
|
|
10
|
-
import Lazy from './lazy.svelte';
|
|
11
|
-
import { delay } from 'es-toolkit';
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<Story name="Lazy">
|
|
15
|
-
<Lazy
|
|
16
|
-
promise={import('../button/button.svelte').then(async res=> {
|
|
17
|
-
await delay(1000 * 2);
|
|
18
|
-
|
|
19
|
-
return res.default;
|
|
20
|
-
})}
|
|
21
|
-
>
|
|
22
|
-
Hello World
|
|
23
|
-
|
|
24
|
-
{#snippet loading()}
|
|
25
|
-
<span>Loading...</span>
|
|
26
|
-
{/snippet}
|
|
27
|
-
</Lazy>
|
|
28
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
|
|
4
|
+
const { Story } = defineMeta({
|
|
5
|
+
title: 'Atoms/Lazy'
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import Lazy from './lazy.svelte';
|
|
11
|
+
import { delay } from 'es-toolkit';
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Lazy">
|
|
15
|
+
<Lazy
|
|
16
|
+
promise={import('../button/button.svelte').then(async res=> {
|
|
17
|
+
await delay(1000 * 2);
|
|
18
|
+
|
|
19
|
+
return res.default;
|
|
20
|
+
})}
|
|
21
|
+
>
|
|
22
|
+
Hello World
|
|
23
|
+
|
|
24
|
+
{#snippet loading()}
|
|
25
|
+
<span>Loading...</span>
|
|
26
|
+
{/snippet}
|
|
27
|
+
</Lazy>
|
|
28
|
+
</Story>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import LinkComponent from './link.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'ATOMS/Link'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story name="Link">
|
|
14
|
-
<LinkComponent>Hello World</LinkComponent>
|
|
15
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import LinkComponent from './link.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Link'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Link">
|
|
14
|
+
<LinkComponent>Hello World</LinkComponent>
|
|
15
|
+
</Story>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap = 'li', B extends Base = Base">
|
|
2
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
-
|
|
4
|
-
let {
|
|
5
|
-
class: klass = '',
|
|
6
|
-
as = 'li' as T,
|
|
7
|
-
preset
|
|
8
|
-
children = undefined,
|
|
9
|
-
...restProps
|
|
10
|
-
} = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<HtmlAtom
|
|
14
|
-
{as}
|
|
15
|
-
preset
|
|
16
|
-
class={['border-border flex w-full gap-2 px-4 py-1', '$preset', klass]}
|
|
17
|
-
{...restProps}
|
|
18
|
-
>
|
|
19
|
-
{@render children?.()}
|
|
20
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap = 'li', B extends Base = Base">
|
|
2
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
class: klass = '',
|
|
6
|
+
as = 'li' as T,
|
|
7
|
+
preset = 'list.item',
|
|
8
|
+
children = undefined,
|
|
9
|
+
...restProps
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<HtmlAtom
|
|
14
|
+
{as}
|
|
15
|
+
{preset}
|
|
16
|
+
class={['border-border flex w-full gap-2 px-4 py-1', '$preset', klass]}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</HtmlAtom>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * as Menu from './atoms';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export { PopoverBond, type PopoverDomElements, type PopoverParams, PopoverState, type PopoverStateProps, type TriggerParams } from '../popover
|
|
3
|
+
export { PopoverBond, type PopoverDomElements, type PopoverParams, PopoverState, type PopoverStateProps, type TriggerParams } from '../popover';
|
|
4
|
+
export type { AnimatePopoverContentParams as AnimateMenuContentParams, animatePopoverContent as animateMenuContent } from '../popover/motion';
|
|
@@ -1,51 +1,69 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { PopoverBond } from '../popover/bond.svelte';
|
|
3
|
-
import type { Base } from '../atom';
|
|
4
|
-
import { List } from '../list';
|
|
5
|
-
|
|
6
|
-
const bond = PopoverBond.get();
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
class: klass = '',
|
|
10
|
-
preset: presetKey = 'menu.item',
|
|
11
|
-
children = undefined,
|
|
12
|
-
onclick = undefined,
|
|
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
|
-
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { PopoverBond } from '../popover/bond.svelte';
|
|
3
|
+
import type { Base } from '../atom';
|
|
4
|
+
import { List } from '../list';
|
|
5
|
+
|
|
6
|
+
const bond = PopoverBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
preset: presetKey = 'menu.item',
|
|
11
|
+
children = undefined,
|
|
12
|
+
onclick = undefined,
|
|
13
|
+
disabled = undefined,
|
|
14
|
+
onmount = undefined,
|
|
15
|
+
ondestroy = undefined,
|
|
16
|
+
animate = undefined,
|
|
17
|
+
enter = undefined,
|
|
18
|
+
exit = undefined,
|
|
19
|
+
initial = undefined,
|
|
20
|
+
...restProps
|
|
21
|
+
} = $props();
|
|
22
|
+
|
|
23
|
+
function _onclick(ev: MouseEvent) {
|
|
24
|
+
onclick?.(ev);
|
|
25
|
+
|
|
26
|
+
if (ev.defaultPrevented) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
bond?.state.close();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _onkeydown(ev: KeyboardEvent) {
|
|
34
|
+
if (disabled) return;
|
|
35
|
+
|
|
36
|
+
// Activate on Enter or Space
|
|
37
|
+
if (ev.key === 'Enter' || ev.key === ' ') {
|
|
38
|
+
ev.preventDefault();
|
|
39
|
+
// Call the click handler if provided
|
|
40
|
+
// cast to any to avoid strict event-type mismatch when forwarding
|
|
41
|
+
onclick?.(ev as unknown as MouseEvent);
|
|
42
|
+
bond?.state.close();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<List.Item
|
|
48
|
+
{bond}
|
|
49
|
+
preset={presetKey}
|
|
50
|
+
class={[
|
|
51
|
+
'border-border last:border-b-none hover:bg-foreground/5 active:bg-foreground/10 cursor-pointer border-b',
|
|
52
|
+
'$preset',
|
|
53
|
+
klass
|
|
54
|
+
]}
|
|
55
|
+
onmount={onmount?.bind(bond.state)}
|
|
56
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
57
|
+
enter={enter?.bind(bond.state)}
|
|
58
|
+
exit={exit?.bind(bond.state)}
|
|
59
|
+
initial={initial?.bind(bond.state)}
|
|
60
|
+
animate={animate?.bind(bond.state)}
|
|
61
|
+
role="menuitem"
|
|
62
|
+
aria-disabled={disabled ? true : undefined}
|
|
63
|
+
tabIndex={disabled ? -1 : 0}
|
|
64
|
+
onkeydown={_onkeydown}
|
|
65
|
+
onclick={_onclick}
|
|
66
|
+
{...restProps}
|
|
67
|
+
>
|
|
68
|
+
{@render children?.({ menu: bond })}
|
|
69
|
+
</List.Item>
|