@svelte-atoms/core 1.0.0-alpha.30 → 1.0.0-alpha.32
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/LICENSE +21 -0
- package/README.md +176 -739
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.js +1 -0
- package/dist/components/accordion/accordion-root.svelte +65 -61
- package/dist/components/accordion/accordion.stories.svelte +70 -145
- package/dist/components/accordion/item/accordion-item-body.svelte +6 -4
- package/dist/components/accordion/item/accordion-item-header.svelte +2 -1
- package/dist/components/accordion/item/accordion-item-indicator.svelte +2 -1
- package/dist/components/accordion/item/accordion-item-root.svelte +2 -1
- 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 +32 -36
- package/dist/components/alert/alert-description.svelte +1 -1
- package/dist/components/alert/alert-description.svelte.d.ts +3 -6
- package/dist/components/alert/alert-root.svelte +3 -38
- 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 +93 -261
- package/dist/components/atom/types.d.ts +3 -2
- package/dist/components/atom/utils.d.ts +37 -0
- package/dist/components/atom/utils.js +208 -0
- 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-item.svelte +1 -1
- package/dist/components/breadcrumb/breadcrumb-separator.svelte +5 -1
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -16
- package/dist/components/button/button.stories.svelte +27 -27
- package/dist/components/calendar/calendar-day.svelte +9 -4
- 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 +159 -155
- package/dist/components/collapsible/bond.svelte.js +2 -1
- package/dist/components/collapsible/collapsible-body.svelte +3 -2
- package/dist/components/collapsible/collapsible.stories.svelte +172 -172
- package/dist/components/collapsible/motion.svelte.d.ts +6 -0
- package/dist/components/collapsible/motion.svelte.js +15 -0
- package/dist/components/combobox/atoms.d.ts +3 -3
- package/dist/components/combobox/atoms.js +3 -3
- package/dist/components/combobox/bond.svelte.d.ts +6 -6
- package/dist/components/combobox/bond.svelte.js +3 -26
- package/dist/components/combobox/combobox-control.svelte +52 -52
- package/dist/components/combobox/{compobox-item.svelte → combobox-item.svelte} +62 -68
- package/dist/components/combobox/combobox-item.svelte.d.ts +12 -0
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/combobox.stories.svelte +50 -0
- package/dist/components/combobox/combobox.stories.svelte.d.ts +3 -0
- 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 +9 -7
- package/dist/components/date-picker/bond.svelte.d.ts +15 -5
- package/dist/components/date-picker/bond.svelte.js +5 -11
- package/dist/components/date-picker/date-picker-calendar.svelte +2 -2
- 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 +52 -6
- package/dist/components/dialog/dialog-content.svelte +2 -20
- package/dist/components/dialog/dialog-root.svelte +3 -22
- 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 +30 -9
- package/dist/components/drawer/bond.svelte.js +80 -24
- package/dist/components/drawer/drawer-content.svelte +49 -57
- package/dist/components/drawer/drawer-root.svelte +5 -4
- package/dist/components/drawer/drawer.stories.svelte +141 -212
- 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 +22 -19
- package/dist/components/dropdown/bond.svelte.js +29 -53
- package/dist/components/dropdown/dropdown-root.svelte +7 -1
- package/dist/components/dropdown/dropdown-values.svelte +17 -17
- package/dist/components/dropdown/dropdown-values.svelte.d.ts +1 -2
- package/dist/components/dropdown/dropdown.stories.svelte +13 -10
- package/dist/components/dropdown/index.d.ts +2 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/dropdown/item/attachments.svelte.d.ts +2 -2
- package/dist/components/dropdown/item/attachments.svelte.js +2 -2
- package/dist/components/dropdown/item/controller.svelte.d.ts +34 -0
- package/dist/components/dropdown/item/controller.svelte.js +82 -0
- package/dist/components/dropdown/item/dropdown-item.svelte +109 -102
- package/dist/components/dropdown/item/dropdown-item.svelte.d.ts +13 -28
- package/dist/components/dropdown/item/index.d.ts +3 -0
- package/dist/components/dropdown/item/index.js +3 -0
- package/dist/components/dropdown/item/types.d.ts +29 -0
- package/dist/components/dropdown/item/types.js +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 +2 -2
- package/dist/components/menu/atoms.d.ts +9 -3
- package/dist/components/menu/atoms.js +9 -3
- package/dist/components/menu/bond.svelte.d.ts +54 -0
- package/dist/components/menu/bond.svelte.js +132 -0
- package/dist/components/menu/index.d.ts +3 -1
- package/dist/components/menu/index.js +2 -1
- package/dist/components/menu/item/controller.svelte.d.ts +26 -0
- package/dist/components/menu/item/controller.svelte.js +69 -0
- package/dist/components/menu/item/index.d.ts +2 -0
- package/dist/components/menu/item/index.js +2 -0
- package/dist/components/menu/item/menu-item.svelte +103 -0
- package/dist/components/menu/item/menu-item.svelte.d.ts +31 -0
- package/dist/components/menu/item/types.d.ts +62 -0
- package/dist/components/menu/item/types.js +1 -0
- package/dist/components/menu/{menu-list.svelte → menu-content.svelte} +40 -40
- package/dist/components/menu/{menu-list.svelte.d.ts → menu-content.svelte.d.ts} +3 -3
- package/dist/components/menu/menu-root.svelte +15 -0
- package/dist/components/menu/menu-root.svelte.d.ts +8 -0
- package/dist/components/menu/menu.stories.svelte +5 -5
- package/dist/components/menu/types.d.ts +0 -7
- package/dist/components/popover/bond.svelte.d.ts +18 -8
- package/dist/components/popover/bond.svelte.js +76 -40
- 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 +137 -175
- 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 +37 -49
- package/dist/components/popover/types.d.ts +9 -7
- package/dist/components/portal/active-portal.svelte +12 -5
- package/dist/components/portal/active-portal.svelte.d.ts +2 -9
- package/dist/components/portal/portal-root.svelte +1 -8
- package/dist/components/portal/portal-root.svelte.d.ts +4 -6
- package/dist/components/portal/teleport.svelte +1 -2
- 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 +109 -109
- package/dist/components/radio/types.d.ts +98 -0
- package/dist/components/radio/types.js +2 -0
- package/dist/components/root/index.d.ts +1 -0
- package/dist/components/root/index.js +1 -0
- package/dist/components/root/l0-portal.svelte +8 -0
- package/dist/components/{radio/types.svelte.d.ts → root/l0-portal.svelte.d.ts} +3 -3
- package/dist/components/root/l1-portal.svelte +7 -0
- package/dist/components/root/l1-portal.svelte.d.ts +26 -0
- package/dist/components/root/root.css +119 -119
- package/dist/components/root/root.svelte +26 -44
- package/dist/components/root/root.svelte.d.ts +2 -6
- package/dist/components/root/toasts-portal.svelte +7 -0
- package/dist/components/root/toasts-portal.svelte.d.ts +26 -0
- package/dist/components/root/types.d.ts +17 -0
- 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 +40 -50
- 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 +4 -1
- package/dist/components/textarea/textarea-root.svelte +2 -2
- package/dist/components/textarea/textarea-root.svelte.d.ts +2 -0
- package/dist/components/tooltip/tooltip-trigger.svelte +39 -39
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +1 -0
- package/dist/components/tooltip/tooltip.stories.svelte +32 -32
- package/dist/components/tree/index.d.ts +1 -0
- package/dist/components/tree/index.js +1 -0
- package/dist/components/tree/motion.svelte.d.ts +6 -0
- package/dist/components/tree/motion.svelte.js +14 -0
- package/dist/components/tree/tree-body.svelte +4 -3
- package/dist/components/tree/tree.stories.svelte +142 -142
- package/dist/context/preset.svelte.d.ts +3 -1
- package/dist/icons/icon-copy.svelte +6 -0
- package/dist/icons/icon-copy.svelte.d.ts +26 -0
- package/dist/utils/dom.svelte.d.ts +2 -0
- package/dist/utils/dom.svelte.js +21 -0
- package/dist/utils/function.d.ts +1 -1
- package/dist/utils/promise.svelte.d.ts +5 -0
- package/dist/utils/promise.svelte.js +20 -0
- package/package.json +4 -3
- package/dist/components/combobox/compobox-item.svelte.d.ts +0 -34
- package/dist/components/combobox/compobox.stories.svelte +0 -51
- package/dist/components/combobox/compobox.stories.svelte.d.ts +0 -3
- package/dist/components/dropdown/item/bond.svelte.d.ts +0 -42
- package/dist/components/dropdown/item/bond.svelte.js +0 -99
- package/dist/components/menu/menu-item.svelte +0 -51
- package/dist/components/menu/menu-item.svelte.d.ts +0 -36
- 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,41 +1,41 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
-
import { CardBond } from './bond.svelte';
|
|
4
|
-
export type { CardFooterProps } from './types';
|
|
5
|
-
|
|
6
|
-
const bond = CardBond.get();
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
class: klass = '',
|
|
10
|
-
as = 'div' as E,
|
|
11
|
-
children = undefined,
|
|
12
|
-
onmount = undefined,
|
|
13
|
-
ondestroy = undefined,
|
|
14
|
-
animate = undefined,
|
|
15
|
-
enter = undefined,
|
|
16
|
-
exit = undefined,
|
|
17
|
-
initial = undefined,
|
|
18
|
-
...restProps
|
|
19
|
-
}: CardFooterProps<E, B> = $props();
|
|
20
|
-
|
|
21
|
-
const footerProps = $derived({
|
|
22
|
-
...bond?.footer(),
|
|
23
|
-
...restProps
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<HtmlAtom
|
|
28
|
-
{as}
|
|
29
|
-
{bond}
|
|
30
|
-
preset="card.footer"
|
|
31
|
-
class={['card-footer border-border flex items-center gap-2 px-4 pb-4', '$preset', klass]}
|
|
32
|
-
enter={enter?.bind(bond.state)}
|
|
33
|
-
exit={exit?.bind(bond.state)}
|
|
34
|
-
initial={initial?.bind(bond.state)}
|
|
35
|
-
animate={animate?.bind(bond.state)}
|
|
36
|
-
onmount={onmount?.bind(bond.state)}
|
|
37
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
38
|
-
{...footerProps}
|
|
39
|
-
>
|
|
40
|
-
{@render children?.()}
|
|
41
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
+
import { CardBond } from './bond.svelte';
|
|
4
|
+
export type { CardFooterProps } from './types';
|
|
5
|
+
|
|
6
|
+
const bond = CardBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
as = 'div' as E,
|
|
11
|
+
children = undefined,
|
|
12
|
+
onmount = undefined,
|
|
13
|
+
ondestroy = undefined,
|
|
14
|
+
animate = undefined,
|
|
15
|
+
enter = undefined,
|
|
16
|
+
exit = undefined,
|
|
17
|
+
initial = undefined,
|
|
18
|
+
...restProps
|
|
19
|
+
}: CardFooterProps<E, B> = $props();
|
|
20
|
+
|
|
21
|
+
const footerProps = $derived({
|
|
22
|
+
...bond?.footer(),
|
|
23
|
+
...restProps
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<HtmlAtom
|
|
28
|
+
{as}
|
|
29
|
+
{bond}
|
|
30
|
+
preset="card.footer"
|
|
31
|
+
class={['card-footer border-border flex items-center gap-2 px-4 pb-4', '$preset', klass]}
|
|
32
|
+
enter={enter?.bind(bond.state)}
|
|
33
|
+
exit={exit?.bind(bond.state)}
|
|
34
|
+
initial={initial?.bind(bond.state)}
|
|
35
|
+
animate={animate?.bind(bond.state)}
|
|
36
|
+
onmount={onmount?.bind(bond.state)}
|
|
37
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
38
|
+
{...footerProps}
|
|
39
|
+
>
|
|
40
|
+
{@render children?.()}
|
|
41
|
+
</HtmlAtom>
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { defineState } from '../../utils';
|
|
3
|
-
import { defineProperty } from '../../utils/state';
|
|
4
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
5
|
-
import { CardBond, CardBondState, type CardBondProps } from './bond.svelte';
|
|
6
|
-
import type { CardRootProps } from './types';
|
|
7
|
-
import './card.css';
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
class: klass = '',
|
|
11
|
-
disabled = false,
|
|
12
|
-
factory = _factory,
|
|
13
|
-
children = undefined,
|
|
14
|
-
onclick = undefined,
|
|
15
|
-
onkeydown = undefined,
|
|
16
|
-
onmount = undefined,
|
|
17
|
-
ondestroy = undefined,
|
|
18
|
-
animate = undefined,
|
|
19
|
-
enter = undefined,
|
|
20
|
-
exit = undefined,
|
|
21
|
-
initial = undefined,
|
|
22
|
-
...restProps
|
|
23
|
-
}: CardRootProps<E, B> = $props();
|
|
24
|
-
|
|
25
|
-
const bondProps = defineState<CardBondProps>(
|
|
26
|
-
[
|
|
27
|
-
defineProperty(
|
|
28
|
-
'disabled',
|
|
29
|
-
() => disabled,
|
|
30
|
-
(v) => {
|
|
31
|
-
disabled = v;
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
],
|
|
35
|
-
() => ({})
|
|
36
|
-
);
|
|
37
|
-
const bond = _factory(bondProps).share();
|
|
38
|
-
|
|
39
|
-
// Disabled styles
|
|
40
|
-
const disabledStyles = disabled ? 'opacity-50 cursor-not-allowed' : '';
|
|
41
|
-
|
|
42
|
-
const rootProps = $derived({
|
|
43
|
-
...bond?.root(),
|
|
44
|
-
...restProps
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
function _factory(props: typeof bondProps) {
|
|
48
|
-
const bondState = new CardBondState(() => props);
|
|
49
|
-
return new CardBond(bondState);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function handleClick(event: MouseEvent) {
|
|
53
|
-
if (disabled) return;
|
|
54
|
-
onclick?.(event);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function handleKeydown(event: KeyboardEvent) {
|
|
58
|
-
if (disabled) return;
|
|
59
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
onclick?.(event as unknown as MouseEvent);
|
|
62
|
-
}
|
|
63
|
-
onkeydown?.(event);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function getBond() {
|
|
67
|
-
return bond;
|
|
68
|
-
}
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<HtmlAtom
|
|
72
|
-
preset="card"
|
|
73
|
-
class={[
|
|
74
|
-
'card bg-card border-border flex flex-col overflow-clip rounded-lg border shadow-sm',
|
|
75
|
-
disabledStyles,
|
|
76
|
-
'$preset',
|
|
77
|
-
klass
|
|
78
|
-
]}
|
|
79
|
-
{bond}
|
|
80
|
-
enter={enter?.bind(bond.state)}
|
|
81
|
-
exit={exit?.bind(bond.state)}
|
|
82
|
-
initial={initial?.bind(bond.state)}
|
|
83
|
-
animate={animate?.bind(bond.state)}
|
|
84
|
-
onmount={onmount?.bind(bond.state)}
|
|
85
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
86
|
-
onclick={handleClick}
|
|
87
|
-
onkeydown={handleKeydown}
|
|
88
|
-
{...rootProps}
|
|
89
|
-
>
|
|
90
|
-
{@render children?.({ card: bond })}
|
|
91
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { defineState } from '../../utils';
|
|
3
|
+
import { defineProperty } from '../../utils/state';
|
|
4
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
5
|
+
import { CardBond, CardBondState, type CardBondProps } from './bond.svelte';
|
|
6
|
+
import type { CardRootProps } from './types';
|
|
7
|
+
import './card.css';
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: klass = '',
|
|
11
|
+
disabled = false,
|
|
12
|
+
factory = _factory,
|
|
13
|
+
children = undefined,
|
|
14
|
+
onclick = undefined,
|
|
15
|
+
onkeydown = undefined,
|
|
16
|
+
onmount = undefined,
|
|
17
|
+
ondestroy = undefined,
|
|
18
|
+
animate = undefined,
|
|
19
|
+
enter = undefined,
|
|
20
|
+
exit = undefined,
|
|
21
|
+
initial = undefined,
|
|
22
|
+
...restProps
|
|
23
|
+
}: CardRootProps<E, B> = $props();
|
|
24
|
+
|
|
25
|
+
const bondProps = defineState<CardBondProps>(
|
|
26
|
+
[
|
|
27
|
+
defineProperty(
|
|
28
|
+
'disabled',
|
|
29
|
+
() => disabled,
|
|
30
|
+
(v) => {
|
|
31
|
+
disabled = v;
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
],
|
|
35
|
+
() => ({})
|
|
36
|
+
);
|
|
37
|
+
const bond = _factory(bondProps).share();
|
|
38
|
+
|
|
39
|
+
// Disabled styles
|
|
40
|
+
const disabledStyles = disabled ? 'opacity-50 cursor-not-allowed' : '';
|
|
41
|
+
|
|
42
|
+
const rootProps = $derived({
|
|
43
|
+
...bond?.root(),
|
|
44
|
+
...restProps
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function _factory(props: typeof bondProps) {
|
|
48
|
+
const bondState = new CardBondState(() => props);
|
|
49
|
+
return new CardBond(bondState);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function handleClick(event: MouseEvent) {
|
|
53
|
+
if (disabled) return;
|
|
54
|
+
onclick?.(event);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
58
|
+
if (disabled) return;
|
|
59
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
onclick?.(event as unknown as MouseEvent);
|
|
62
|
+
}
|
|
63
|
+
onkeydown?.(event);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function getBond() {
|
|
67
|
+
return bond;
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<HtmlAtom
|
|
72
|
+
preset="card"
|
|
73
|
+
class={[
|
|
74
|
+
'card bg-card border-border flex flex-col overflow-clip rounded-lg border shadow-sm',
|
|
75
|
+
disabledStyles,
|
|
76
|
+
'$preset',
|
|
77
|
+
klass
|
|
78
|
+
]}
|
|
79
|
+
{bond}
|
|
80
|
+
enter={enter?.bind(bond.state)}
|
|
81
|
+
exit={exit?.bind(bond.state)}
|
|
82
|
+
initial={initial?.bind(bond.state)}
|
|
83
|
+
animate={animate?.bind(bond.state)}
|
|
84
|
+
onmount={onmount?.bind(bond.state)}
|
|
85
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
86
|
+
onclick={handleClick}
|
|
87
|
+
onkeydown={handleKeydown}
|
|
88
|
+
{...rootProps}
|
|
89
|
+
>
|
|
90
|
+
{@render children?.({ card: bond })}
|
|
91
|
+
</HtmlAtom>
|
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
|
|
4
|
-
const { Story } = defineMeta({
|
|
5
|
-
title: 'Atoms/Card',
|
|
6
|
-
args: {}
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script lang="ts">
|
|
11
|
-
import { Card } from '.';
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<!-- Default Card -->
|
|
15
|
-
<Story name="Default">
|
|
16
|
-
<Card.Root class="max-w-sm">
|
|
17
|
-
<Card.Header>
|
|
18
|
-
<Card.Title>Card Title</Card.Title>
|
|
19
|
-
<Card.Description
|
|
20
|
-
>This is a card description that provides additional context.</Card.Description
|
|
21
|
-
>
|
|
22
|
-
</Card.Header>
|
|
23
|
-
<Card.Body>
|
|
24
|
-
<p>
|
|
25
|
-
This is the main content area of the card. You can put any content here including text,
|
|
26
|
-
images, or other components.
|
|
27
|
-
</p>
|
|
28
|
-
</Card.Body>
|
|
29
|
-
<Card.Footer>
|
|
30
|
-
<button
|
|
31
|
-
class="rounded bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 active:bg-blue-700"
|
|
32
|
-
>Action</button
|
|
33
|
-
>
|
|
34
|
-
<button
|
|
35
|
-
class="border-border hover:bg-foreground/5 active:bg-foreground/10 rounded border px-3 py-1 text-sm"
|
|
36
|
-
>Cancel</button
|
|
37
|
-
>
|
|
38
|
-
</Card.Footer>
|
|
39
|
-
</Card.Root>
|
|
40
|
-
</Story>
|
|
41
|
-
|
|
42
|
-
<!-- Card with Media -->
|
|
43
|
-
<Story name="With Media">
|
|
44
|
-
<Card.Root class="max-w-sm">
|
|
45
|
-
<Card.Media>
|
|
46
|
-
<img
|
|
47
|
-
src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop"
|
|
48
|
-
alt="Beautiful landscape"
|
|
49
|
-
class="h-48 w-full object-cover"
|
|
50
|
-
/>
|
|
51
|
-
</Card.Media>
|
|
52
|
-
<Card.Header>
|
|
53
|
-
<Card.Title>Beautiful Landscape</Card.Title>
|
|
54
|
-
<Card.Subtitle>Photography</Card.Subtitle>
|
|
55
|
-
</Card.Header>
|
|
56
|
-
<Card.Body>
|
|
57
|
-
<p>A stunning landscape photograph capturing the beauty of nature.</p>
|
|
58
|
-
</Card.Body>
|
|
59
|
-
<Card.Footer>
|
|
60
|
-
<span class="text-sm text-gray-500">Posted 2 hours ago</span>
|
|
61
|
-
</Card.Footer>
|
|
62
|
-
</Card.Root>
|
|
63
|
-
</Story>
|
|
64
|
-
|
|
65
|
-
<!-- Clickable Card -->
|
|
66
|
-
<Story name="Clickable">
|
|
67
|
-
<Card.Root
|
|
68
|
-
class="hover:bg-card/90 active:bg-card/80 max-w-sm cursor-pointer pb-4"
|
|
69
|
-
onclick={() => alert('Card clicked!')}
|
|
70
|
-
>
|
|
71
|
-
<Card.Header>
|
|
72
|
-
<Card.Title>Clickable Card</Card.Title>
|
|
73
|
-
<Card.Description
|
|
74
|
-
>This card is clickable and will show an alert when clicked.</Card.Description
|
|
75
|
-
>
|
|
76
|
-
</Card.Header>
|
|
77
|
-
<Card.Body>
|
|
78
|
-
<p>Click anywhere on this card to trigger the action.</p>
|
|
79
|
-
</Card.Body>
|
|
80
|
-
</Card.Root>
|
|
81
|
-
</Story>
|
|
82
|
-
|
|
83
|
-
<!-- Card Variants -->
|
|
84
|
-
<Story name="Variants">
|
|
85
|
-
<div class="grid grid-cols-2 gap-4">
|
|
86
|
-
<Card.Root>
|
|
87
|
-
<Card.Header>
|
|
88
|
-
<Card.Title>Default Card</Card.Title>
|
|
89
|
-
<Card.Description>Default variant with border and shadow.</Card.Description>
|
|
90
|
-
</Card.Header>
|
|
91
|
-
</Card.Root>
|
|
92
|
-
|
|
93
|
-
<Card.Root class="bg-transparent shadow-none">
|
|
94
|
-
<Card.Header>
|
|
95
|
-
<Card.Title>Outlined Card</Card.Title>
|
|
96
|
-
<Card.Description>Outlined variant with border only.</Card.Description>
|
|
97
|
-
</Card.Header>
|
|
98
|
-
</Card.Root>
|
|
99
|
-
|
|
100
|
-
<Card.Root class="shadow-lg">
|
|
101
|
-
<Card.Header>
|
|
102
|
-
<Card.Title>Elevated Card</Card.Title>
|
|
103
|
-
<Card.Description>Elevated variant with enhanced shadow.</Card.Description>
|
|
104
|
-
</Card.Header>
|
|
105
|
-
</Card.Root>
|
|
106
|
-
|
|
107
|
-
<Card.Root class="bg-background border-none">
|
|
108
|
-
<Card.Header>
|
|
109
|
-
<Card.Title>Filled Card</Card.Title>
|
|
110
|
-
<Card.Description>Filled variant with background color.</Card.Description>
|
|
111
|
-
</Card.Header>
|
|
112
|
-
</Card.Root>
|
|
113
|
-
</div>
|
|
114
|
-
</Story>
|
|
115
|
-
|
|
116
|
-
<!-- Disabled Card -->
|
|
117
|
-
<Story
|
|
118
|
-
name="Disabled"
|
|
119
|
-
args={{
|
|
120
|
-
clickable: true,
|
|
121
|
-
disabled: true
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
124
|
-
<Card.Root class="max-w-sm pb-4 opacity-50">
|
|
125
|
-
<Card.Header>
|
|
126
|
-
<Card.Title>Disabled Card</Card.Title>
|
|
127
|
-
<Card.Description>This card is disabled and cannot be interacted with.</Card.Description>
|
|
128
|
-
</Card.Header>
|
|
129
|
-
<Card.Body>
|
|
130
|
-
<p>The card appears dimmed and is not clickable.</p>
|
|
131
|
-
</Card.Body>
|
|
132
|
-
</Card.Root>
|
|
133
|
-
</Story>
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
|
|
4
|
+
const { Story } = defineMeta({
|
|
5
|
+
title: 'Atoms/Card',
|
|
6
|
+
args: {}
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { Card } from '.';
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<!-- Default Card -->
|
|
15
|
+
<Story name="Default">
|
|
16
|
+
<Card.Root class="max-w-sm">
|
|
17
|
+
<Card.Header>
|
|
18
|
+
<Card.Title>Card Title</Card.Title>
|
|
19
|
+
<Card.Description
|
|
20
|
+
>This is a card description that provides additional context.</Card.Description
|
|
21
|
+
>
|
|
22
|
+
</Card.Header>
|
|
23
|
+
<Card.Body>
|
|
24
|
+
<p>
|
|
25
|
+
This is the main content area of the card. You can put any content here including text,
|
|
26
|
+
images, or other components.
|
|
27
|
+
</p>
|
|
28
|
+
</Card.Body>
|
|
29
|
+
<Card.Footer>
|
|
30
|
+
<button
|
|
31
|
+
class="rounded bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 active:bg-blue-700"
|
|
32
|
+
>Action</button
|
|
33
|
+
>
|
|
34
|
+
<button
|
|
35
|
+
class="border-border hover:bg-foreground/5 active:bg-foreground/10 rounded border px-3 py-1 text-sm"
|
|
36
|
+
>Cancel</button
|
|
37
|
+
>
|
|
38
|
+
</Card.Footer>
|
|
39
|
+
</Card.Root>
|
|
40
|
+
</Story>
|
|
41
|
+
|
|
42
|
+
<!-- Card with Media -->
|
|
43
|
+
<Story name="With Media">
|
|
44
|
+
<Card.Root class="max-w-sm">
|
|
45
|
+
<Card.Media>
|
|
46
|
+
<img
|
|
47
|
+
src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop"
|
|
48
|
+
alt="Beautiful landscape"
|
|
49
|
+
class="h-48 w-full object-cover"
|
|
50
|
+
/>
|
|
51
|
+
</Card.Media>
|
|
52
|
+
<Card.Header>
|
|
53
|
+
<Card.Title>Beautiful Landscape</Card.Title>
|
|
54
|
+
<Card.Subtitle>Photography</Card.Subtitle>
|
|
55
|
+
</Card.Header>
|
|
56
|
+
<Card.Body>
|
|
57
|
+
<p>A stunning landscape photograph capturing the beauty of nature.</p>
|
|
58
|
+
</Card.Body>
|
|
59
|
+
<Card.Footer>
|
|
60
|
+
<span class="text-sm text-gray-500">Posted 2 hours ago</span>
|
|
61
|
+
</Card.Footer>
|
|
62
|
+
</Card.Root>
|
|
63
|
+
</Story>
|
|
64
|
+
|
|
65
|
+
<!-- Clickable Card -->
|
|
66
|
+
<Story name="Clickable">
|
|
67
|
+
<Card.Root
|
|
68
|
+
class="hover:bg-card/90 active:bg-card/80 max-w-sm cursor-pointer pb-4"
|
|
69
|
+
onclick={() => alert('Card clicked!')}
|
|
70
|
+
>
|
|
71
|
+
<Card.Header>
|
|
72
|
+
<Card.Title>Clickable Card</Card.Title>
|
|
73
|
+
<Card.Description
|
|
74
|
+
>This card is clickable and will show an alert when clicked.</Card.Description
|
|
75
|
+
>
|
|
76
|
+
</Card.Header>
|
|
77
|
+
<Card.Body>
|
|
78
|
+
<p>Click anywhere on this card to trigger the action.</p>
|
|
79
|
+
</Card.Body>
|
|
80
|
+
</Card.Root>
|
|
81
|
+
</Story>
|
|
82
|
+
|
|
83
|
+
<!-- Card Variants -->
|
|
84
|
+
<Story name="Variants">
|
|
85
|
+
<div class="grid grid-cols-2 gap-4">
|
|
86
|
+
<Card.Root>
|
|
87
|
+
<Card.Header>
|
|
88
|
+
<Card.Title>Default Card</Card.Title>
|
|
89
|
+
<Card.Description>Default variant with border and shadow.</Card.Description>
|
|
90
|
+
</Card.Header>
|
|
91
|
+
</Card.Root>
|
|
92
|
+
|
|
93
|
+
<Card.Root class="bg-transparent shadow-none">
|
|
94
|
+
<Card.Header>
|
|
95
|
+
<Card.Title>Outlined Card</Card.Title>
|
|
96
|
+
<Card.Description>Outlined variant with border only.</Card.Description>
|
|
97
|
+
</Card.Header>
|
|
98
|
+
</Card.Root>
|
|
99
|
+
|
|
100
|
+
<Card.Root class="shadow-lg">
|
|
101
|
+
<Card.Header>
|
|
102
|
+
<Card.Title>Elevated Card</Card.Title>
|
|
103
|
+
<Card.Description>Elevated variant with enhanced shadow.</Card.Description>
|
|
104
|
+
</Card.Header>
|
|
105
|
+
</Card.Root>
|
|
106
|
+
|
|
107
|
+
<Card.Root class="bg-background border-none">
|
|
108
|
+
<Card.Header>
|
|
109
|
+
<Card.Title>Filled Card</Card.Title>
|
|
110
|
+
<Card.Description>Filled variant with background color.</Card.Description>
|
|
111
|
+
</Card.Header>
|
|
112
|
+
</Card.Root>
|
|
113
|
+
</div>
|
|
114
|
+
</Story>
|
|
115
|
+
|
|
116
|
+
<!-- Disabled Card -->
|
|
117
|
+
<Story
|
|
118
|
+
name="Disabled"
|
|
119
|
+
args={{
|
|
120
|
+
clickable: true,
|
|
121
|
+
disabled: true
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<Card.Root class="max-w-sm pb-4 opacity-50">
|
|
125
|
+
<Card.Header>
|
|
126
|
+
<Card.Title>Disabled Card</Card.Title>
|
|
127
|
+
<Card.Description>This card is disabled and cannot be interacted with.</Card.Description>
|
|
128
|
+
</Card.Header>
|
|
129
|
+
<Card.Body>
|
|
130
|
+
<p>The card appears dimmed and is not clickable.</p>
|
|
131
|
+
</Card.Body>
|
|
132
|
+
</Card.Root>
|
|
133
|
+
</Story>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { default as CheckboxCmp } from './checkbox.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'ATOMS/Checkbox'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
let checked = $state(false);
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<Story name="Checkbox">
|
|
15
|
-
{#snippet children({ args })}
|
|
16
|
-
<div class="flex gap-2">
|
|
17
|
-
<CheckboxCmp bind:checked />
|
|
18
|
-
|
|
19
|
-
<CheckboxCmp indeterminate />
|
|
20
|
-
</div>
|
|
21
|
-
{/snippet}
|
|
22
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { default as CheckboxCmp } from './checkbox.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Checkbox'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
let checked = $state(false);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Checkbox">
|
|
15
|
+
{#snippet children({ args })}
|
|
16
|
+
<div class="flex gap-2">
|
|
17
|
+
<CheckboxCmp bind:checked />
|
|
18
|
+
|
|
19
|
+
<CheckboxCmp indeterminate />
|
|
20
|
+
</div>
|
|
21
|
+
{/snippet}
|
|
22
|
+
</Story>
|