@svelte-atoms/core 1.0.0-alpha.28 → 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.
Files changed (136) hide show
  1. package/README.md +852 -856
  2. package/dist/attachments/clickout.svelte.d.ts +1 -1
  3. package/dist/attachments/clickout.svelte.js +2 -2
  4. package/dist/components/accordion/accordion-root.svelte +61 -61
  5. package/dist/components/accordion/accordion-root.svelte.d.ts +1 -1
  6. package/dist/components/accordion/accordion.stories.svelte +145 -134
  7. package/dist/components/alert/alert-actions.svelte +43 -43
  8. package/dist/components/alert/alert-close-button.svelte +70 -70
  9. package/dist/components/alert/alert-content.svelte +43 -43
  10. package/dist/components/alert/alert-description.svelte +42 -42
  11. package/dist/components/alert/alert-icon.svelte +47 -47
  12. package/dist/components/alert/alert-root.svelte +103 -103
  13. package/dist/components/alert/alert-title.svelte +42 -42
  14. package/dist/components/alert/alert.stories.svelte +10 -11
  15. package/dist/components/atom/html-atom.svelte +75 -19
  16. package/dist/components/atom/html-atom.svelte.d.ts +1 -1
  17. package/dist/components/atom/snippet-renderer.svelte +5 -5
  18. package/dist/components/avatar/avatar.stories.svelte +22 -27
  19. package/dist/components/badge/badge.stories.svelte +12 -17
  20. package/dist/components/badge/badge.svelte +19 -19
  21. package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -21
  22. package/dist/components/button/button.stories.svelte +1 -34
  23. package/dist/components/calendar/calendar-body.svelte +107 -107
  24. package/dist/components/calendar/calendar-day.svelte +96 -97
  25. package/dist/components/calendar/calendar-header.svelte +29 -33
  26. package/dist/components/calendar/calendar-header.svelte.d.ts +0 -1
  27. package/dist/components/calendar/calendar-root.svelte +206 -208
  28. package/dist/components/calendar/calendar-week-day.svelte +34 -34
  29. package/dist/components/calendar/calendar.css +26 -26
  30. package/dist/components/calendar/calendar.stories.svelte +10 -20
  31. package/dist/components/calendar/calendar.stories.svelte.d.ts +24 -4
  32. package/dist/components/card/card-body.svelte +39 -39
  33. package/dist/components/card/card-footer.svelte +41 -41
  34. package/dist/components/card/card-root.svelte +91 -91
  35. package/dist/components/card/card.stories.svelte +133 -145
  36. package/dist/components/checkbox/checkbox.stories.svelte +22 -27
  37. package/dist/components/checkbox/checkbox.svelte +155 -157
  38. package/dist/components/collapsible/collapsible.stories.svelte +172 -173
  39. package/dist/components/combobox/combobox-root.svelte +65 -65
  40. package/dist/components/combobox/compobox.stories.svelte +51 -54
  41. package/dist/components/container/container.stories.svelte +20 -23
  42. package/dist/components/datagrid/datagrid-root.svelte +2 -2
  43. package/dist/components/datagrid/datagrid.css +0 -42
  44. package/dist/components/datagrid/datagrid.stories.svelte +72 -75
  45. package/dist/components/datagrid/types.d.ts +1 -1
  46. package/dist/components/date-picker/atoms.d.ts +0 -4
  47. package/dist/components/date-picker/atoms.js +0 -4
  48. package/dist/components/date-picker/date-picker-calendar.svelte +67 -42
  49. package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +2 -5
  50. package/dist/components/date-picker/date-picker-header.svelte +100 -105
  51. package/dist/components/date-picker/date-picker-header.svelte.d.ts +2 -5
  52. package/dist/components/date-picker/date-picker-months.svelte +142 -150
  53. package/dist/components/date-picker/date-picker-months.svelte.d.ts +2 -5
  54. package/dist/components/date-picker/date-picker-root.svelte +4 -3
  55. package/dist/components/date-picker/date-picker-root.svelte.d.ts +2 -15
  56. package/dist/components/date-picker/date-picker-years.svelte +205 -214
  57. package/dist/components/date-picker/date-picker-years.svelte.d.ts +2 -5
  58. package/dist/components/date-picker/date-picker.stories.svelte +15 -31
  59. package/dist/components/date-picker/types.d.ts +53 -1
  60. package/dist/components/dialog/dialog-content.svelte +1 -1
  61. package/dist/components/dialog/dialog.stories.svelte +64 -67
  62. package/dist/components/drawer/attachments.svelte.js +8 -9
  63. package/dist/components/drawer/drawer-content.svelte +57 -42
  64. package/dist/components/drawer/drawer.stories.svelte +212 -224
  65. package/dist/components/dropdown/dropdown-root.svelte +59 -59
  66. package/dist/components/dropdown/dropdown.stories.svelte +80 -83
  67. package/dist/components/element/html-element.svelte +85 -85
  68. package/dist/components/element/types.d.ts +1 -1
  69. package/dist/components/form/form.stories.svelte +96 -99
  70. package/dist/components/image/image.stories.svelte +20 -23
  71. package/dist/components/index.d.ts +1 -0
  72. package/dist/components/index.js +1 -0
  73. package/dist/components/input/input.stories.svelte +35 -38
  74. package/dist/components/label/label.stories.svelte +15 -26
  75. package/dist/components/label/label.stories.svelte.d.ts +24 -4
  76. package/dist/components/lazy/index.d.ts +1 -0
  77. package/dist/components/lazy/index.js +1 -0
  78. package/dist/components/lazy/lazy.stories.svelte +28 -0
  79. package/dist/components/lazy/lazy.stories.svelte.d.ts +19 -0
  80. package/dist/components/lazy/lazy.svelte +28 -0
  81. package/dist/components/lazy/lazy.svelte.d.ts +5 -0
  82. package/dist/components/lazy/types.d.ts +10 -0
  83. package/dist/components/lazy/types.js +1 -0
  84. package/dist/components/link/link.stories.svelte +15 -26
  85. package/dist/components/link/link.stories.svelte.d.ts +24 -4
  86. package/dist/components/menu/menu-list.svelte +2 -1
  87. package/dist/components/menu/menu-list.svelte.d.ts +1 -0
  88. package/dist/components/menu/menu.stories.svelte +33 -36
  89. package/dist/components/popover/bond.svelte.js +31 -25
  90. package/dist/components/popover/popover-arrow.svelte +111 -111
  91. package/dist/components/popover/popover-content.svelte +2 -5
  92. package/dist/components/popover/popover-indicator.svelte +44 -43
  93. package/dist/components/popover/popover-root.svelte +1 -1
  94. package/dist/components/popover/popover.stories.svelte +18 -21
  95. package/dist/components/qr-code/index.d.ts +1 -0
  96. package/dist/components/qr-code/index.js +1 -0
  97. package/dist/components/qr-code/qr-code.stories.svelte +4 -10
  98. package/dist/components/qr-code/qr-code.svelte +75 -25
  99. package/dist/components/qr-code/qr-code.svelte.d.ts +2 -4
  100. package/dist/components/qr-code/types.d.ts +14 -0
  101. package/dist/components/qr-code/types.js +1 -0
  102. package/dist/components/radio/radio-group.stories.svelte +41 -50
  103. package/dist/components/radio/radio.stories.svelte +17 -26
  104. package/dist/components/radio/radio.svelte +109 -109
  105. package/dist/components/root/root.svelte +121 -121
  106. package/dist/components/root/root.svelte.d.ts +1 -1
  107. package/dist/components/scrollable/scrollable.stories.svelte +116 -126
  108. package/dist/components/sidebar/bond.svelte.d.ts +0 -5
  109. package/dist/components/sidebar/bond.svelte.js +1 -12
  110. package/dist/components/sidebar/sidebar-content.svelte +50 -39
  111. package/dist/components/sidebar/sidebar-content.svelte.d.ts +2 -2
  112. package/dist/components/sidebar/sidebar-root.svelte +39 -68
  113. package/dist/components/sidebar/sidebar-root.svelte.d.ts +2 -2
  114. package/dist/components/sidebar/sidebar.stories.svelte +43 -52
  115. package/dist/components/sidebar/types.d.ts +7 -6
  116. package/dist/components/tabs/tab/bond.svelte.d.ts +4 -1
  117. package/dist/components/tabs/tab/bond.svelte.js +4 -1
  118. package/dist/components/tabs/tabs.stories.svelte +56 -59
  119. package/dist/components/tooltip/tooltip-trigger.svelte +39 -37
  120. package/dist/components/tooltip/tooltip.stories.svelte +32 -35
  121. package/dist/components/tree/tree.stories.svelte +142 -134
  122. package/dist/context/preset.svelte.d.ts +3 -3
  123. package/dist/utils/function.d.ts +2 -0
  124. package/dist/utils/function.js +6 -0
  125. package/llm/variants.md +1259 -1261
  126. package/package.json +7 -9
  127. package/dist/actions/animation.svelte.d.ts +0 -6
  128. package/dist/actions/animation.svelte.js +0 -14
  129. package/dist/actions/clickout.svelte.d.ts +0 -2
  130. package/dist/actions/clickout.svelte.js +0 -15
  131. package/dist/actions/popover.svelte.d.ts +0 -19
  132. package/dist/actions/popover.svelte.js +0 -81
  133. package/dist/actions/portal.svelte.d.ts +0 -8
  134. package/dist/actions/portal.svelte.js +0 -32
  135. package/dist/attachments/gsap.svelte.d.ts +0 -2
  136. package/dist/attachments/gsap.svelte.js +0 -26
@@ -1,39 +1,39 @@
1
- <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
- import { HtmlAtom, type Base } from '../atom';
3
- export type { CardContentProps } from './types';
4
- import { CardBond } from './bond.svelte';
5
-
6
- const bond = CardBond.get();
7
-
8
- let {
9
- class: klass = '',
10
- children = undefined,
11
- onmount = undefined,
12
- ondestroy = undefined,
13
- animate = undefined,
14
- enter = undefined,
15
- exit = undefined,
16
- initial = undefined,
17
- ...restProps
18
- }: CardContentProps<E, B> = $props();
19
-
20
- const contentProps = $derived({
21
- ...bond?.content(),
22
- ...restProps
23
- });
24
- </script>
25
-
26
- <HtmlAtom
27
- {bond}
28
- preset="card.content"
29
- class={['card-content border-border px-4', '$preset', klass]}
30
- enter={enter?.bind(bond.state)}
31
- exit={exit?.bind(bond.state)}
32
- initial={initial?.bind(bond.state)}
33
- animate={animate?.bind(bond.state)}
34
- onmount={onmount?.bind(bond.state)}
35
- ondestroy={ondestroy?.bind(bond.state)}
36
- {...contentProps}
37
- >
38
- {@render children?.()}
39
- </HtmlAtom>
1
+ <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
+ import { HtmlAtom, type Base } from '../atom';
3
+ export type { CardContentProps } from './types';
4
+ import { CardBond } from './bond.svelte';
5
+
6
+ const bond = CardBond.get();
7
+
8
+ let {
9
+ class: klass = '',
10
+ children = undefined,
11
+ onmount = undefined,
12
+ ondestroy = undefined,
13
+ animate = undefined,
14
+ enter = undefined,
15
+ exit = undefined,
16
+ initial = undefined,
17
+ ...restProps
18
+ }: CardContentProps<E, B> = $props();
19
+
20
+ const contentProps = $derived({
21
+ ...bond?.content(),
22
+ ...restProps
23
+ });
24
+ </script>
25
+
26
+ <HtmlAtom
27
+ {bond}
28
+ preset="card.content"
29
+ class={['card-content border-border px-4 pb-4', '$preset', klass]}
30
+ enter={enter?.bind(bond.state)}
31
+ exit={exit?.bind(bond.state)}
32
+ initial={initial?.bind(bond.state)}
33
+ animate={animate?.bind(bond.state)}
34
+ onmount={onmount?.bind(bond.state)}
35
+ ondestroy={ondestroy?.bind(bond.state)}
36
+ {...contentProps}
37
+ >
38
+ {@render children?.()}
39
+ </HtmlAtom>
@@ -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 py-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 gap-2 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,145 +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
- import { Root } from '../root';
13
- import gsap from 'gsap';
14
- </script>
15
-
16
- <!-- Default Card -->
17
- <Story name="Default">
18
- <Root>
19
- <Card.Root class="max-w-sm">
20
- <Card.Header>
21
- <Card.Title>Card Title</Card.Title>
22
- <Card.Description
23
- >This is a card description that provides additional context.</Card.Description
24
- >
25
- </Card.Header>
26
- <Card.Body>
27
- <p>
28
- This is the main content area of the card. You can put any content here including text,
29
- images, or other components.
30
- </p>
31
- </Card.Body>
32
- <Card.Footer>
33
- <button
34
- class="rounded bg-blue-500 px-3 py-1 text-sm text-white hover:bg-blue-600 active:bg-blue-700"
35
- >Action</button
36
- >
37
- <button
38
- class="border-border hover:bg-foreground/5 active:bg-foreground/10 rounded border px-3 py-1 text-sm"
39
- >Cancel</button
40
- >
41
- </Card.Footer>
42
- </Card.Root>
43
- </Root>
44
- </Story>
45
-
46
- <!-- Card with Media -->
47
- <Story name="With Media">
48
- <Root>
49
- <Card.Root class="max-w-sm">
50
- <Card.Media>
51
- <img
52
- src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop"
53
- alt="Beautiful landscape"
54
- class="h-48 w-full object-cover"
55
- />
56
- </Card.Media>
57
- <Card.Header>
58
- <Card.Title>Beautiful Landscape</Card.Title>
59
- <Card.Subtitle>Photography</Card.Subtitle>
60
- </Card.Header>
61
- <Card.Body>
62
- <p>A stunning landscape photograph capturing the beauty of nature.</p>
63
- </Card.Body>
64
- <Card.Footer>
65
- <span class="text-sm text-gray-500">Posted 2 hours ago</span>
66
- </Card.Footer>
67
- </Card.Root>
68
- </Root>
69
- </Story>
70
-
71
- <!-- Clickable Card -->
72
- <Story name="Clickable">
73
- <Root>
74
- <Card.Root
75
- class="hover:bg-card/90 active:bg-card/80 max-w-sm cursor-pointer pb-4"
76
- onclick={() => alert('Card clicked!')}
77
- >
78
- <Card.Header>
79
- <Card.Title>Clickable Card</Card.Title>
80
- <Card.Description
81
- >This card is clickable and will show an alert when clicked.</Card.Description
82
- >
83
- </Card.Header>
84
- <Card.Body>
85
- <p>Click anywhere on this card to trigger the action.</p>
86
- </Card.Body>
87
- </Card.Root>
88
- </Root>
89
- </Story>
90
-
91
- <!-- Card Variants -->
92
- <Story name="Variants">
93
- <Root>
94
- <div class="grid grid-cols-2 gap-4">
95
- <Card.Root>
96
- <Card.Header>
97
- <Card.Title>Default Card</Card.Title>
98
- <Card.Description>Default variant with border and shadow.</Card.Description>
99
- </Card.Header>
100
- </Card.Root>
101
-
102
- <Card.Root class="bg-transparent shadow-none">
103
- <Card.Header>
104
- <Card.Title>Outlined Card</Card.Title>
105
- <Card.Description>Outlined variant with border only.</Card.Description>
106
- </Card.Header>
107
- </Card.Root>
108
-
109
- <Card.Root class="shadow-lg">
110
- <Card.Header>
111
- <Card.Title>Elevated Card</Card.Title>
112
- <Card.Description>Elevated variant with enhanced shadow.</Card.Description>
113
- </Card.Header>
114
- </Card.Root>
115
-
116
- <Card.Root class="bg-background border-none">
117
- <Card.Header>
118
- <Card.Title>Filled Card</Card.Title>
119
- <Card.Description>Filled variant with background color.</Card.Description>
120
- </Card.Header>
121
- </Card.Root>
122
- </div>
123
- </Root>
124
- </Story>
125
-
126
- <!-- Disabled Card -->
127
- <Story
128
- name="Disabled"
129
- args={{
130
- clickable: true,
131
- disabled: true
132
- }}
133
- >
134
- <Root>
135
- <Card.Root class="max-w-sm pb-4 opacity-50">
136
- <Card.Header>
137
- <Card.Title>Disabled Card</Card.Title>
138
- <Card.Description>This card is disabled and cannot be interacted with.</Card.Description>
139
- </Card.Header>
140
- <Card.Body>
141
- <p>The card appears dimmed and is not clickable.</p>
142
- </Card.Body>
143
- </Card.Root>
144
- </Root>
145
- </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>