@svelte-atoms/core 1.0.0-alpha.29 → 1.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +852 -852
  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.stories.svelte +400 -401
  8. package/dist/components/atom/html-atom.svelte +71 -17
  9. package/dist/components/avatar/avatar.stories.svelte +22 -27
  10. package/dist/components/badge/badge.stories.svelte +12 -17
  11. package/dist/components/badge/badge.svelte +19 -19
  12. package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -21
  13. package/dist/components/button/button.stories.svelte +27 -60
  14. package/dist/components/calendar/calendar-day.svelte +96 -96
  15. package/dist/components/calendar/calendar-header.svelte +29 -29
  16. package/dist/components/calendar/calendar-root.svelte +206 -206
  17. package/dist/components/calendar/calendar.stories.svelte +10 -15
  18. package/dist/components/card/card-body.svelte +39 -39
  19. package/dist/components/card/card-footer.svelte +41 -41
  20. package/dist/components/card/card-root.svelte +91 -91
  21. package/dist/components/card/card.stories.svelte +133 -145
  22. package/dist/components/checkbox/checkbox.stories.svelte +22 -27
  23. package/dist/components/checkbox/checkbox.svelte +155 -157
  24. package/dist/components/collapsible/collapsible.stories.svelte +172 -173
  25. package/dist/components/combobox/combobox-root.svelte +65 -65
  26. package/dist/components/combobox/compobox.stories.svelte +51 -54
  27. package/dist/components/container/container.stories.svelte +20 -23
  28. package/dist/components/datagrid/datagrid-root.svelte +59 -59
  29. package/dist/components/datagrid/datagrid.css +5 -5
  30. package/dist/components/datagrid/datagrid.stories.svelte +72 -75
  31. package/dist/components/date-picker/date-picker-calendar.svelte +67 -67
  32. package/dist/components/date-picker/date-picker-header.svelte +100 -100
  33. package/dist/components/date-picker/date-picker-months.svelte +142 -142
  34. package/dist/components/date-picker/date-picker-root.svelte +1 -1
  35. package/dist/components/date-picker/date-picker-years.svelte +205 -205
  36. package/dist/components/date-picker/date-picker.stories.svelte +11 -18
  37. package/dist/components/dialog/dialog-content.svelte +62 -62
  38. package/dist/components/dialog/dialog.stories.svelte +64 -67
  39. package/dist/components/drawer/attachments.svelte.js +8 -9
  40. package/dist/components/drawer/drawer-content.svelte +57 -42
  41. package/dist/components/drawer/drawer.stories.svelte +212 -224
  42. package/dist/components/dropdown/dropdown-root.svelte +59 -59
  43. package/dist/components/dropdown/dropdown.stories.svelte +80 -83
  44. package/dist/components/form/form.stories.svelte +96 -99
  45. package/dist/components/image/image.stories.svelte +20 -23
  46. package/dist/components/input/input.stories.svelte +35 -38
  47. package/dist/components/label/label.stories.svelte +15 -26
  48. package/dist/components/label/label.stories.svelte.d.ts +24 -4
  49. package/dist/components/lazy/lazy.stories.svelte +9 -16
  50. package/dist/components/lazy/lazy.svelte +28 -28
  51. package/dist/components/link/link.stories.svelte +15 -26
  52. package/dist/components/link/link.stories.svelte.d.ts +24 -4
  53. package/dist/components/menu/menu-list.svelte +40 -40
  54. package/dist/components/menu/menu.stories.svelte +33 -36
  55. package/dist/components/popover/bond.svelte.js +31 -25
  56. package/dist/components/popover/popover-arrow.svelte +111 -111
  57. package/dist/components/popover/popover-content.svelte +175 -178
  58. package/dist/components/popover/popover-indicator.svelte +44 -43
  59. package/dist/components/popover/popover-root.svelte +48 -48
  60. package/dist/components/popover/popover.stories.svelte +49 -52
  61. package/dist/components/qr-code/qr-code.stories.svelte +4 -13
  62. package/dist/components/qr-code/qr-code.svelte +75 -75
  63. package/dist/components/radio/radio-group.stories.svelte +41 -50
  64. package/dist/components/radio/radio.stories.svelte +17 -26
  65. package/dist/components/radio/radio.svelte +109 -109
  66. package/dist/components/root/root.svelte +121 -121
  67. package/dist/components/root/root.svelte.d.ts +1 -1
  68. package/dist/components/scrollable/scrollable.stories.svelte +116 -126
  69. package/dist/components/sidebar/sidebar-content.svelte +13 -2
  70. package/dist/components/sidebar/sidebar-root.svelte +10 -12
  71. package/dist/components/sidebar/sidebar.stories.svelte +8 -19
  72. package/dist/components/sidebar/types.d.ts +1 -0
  73. package/dist/components/tabs/tab/bond.svelte.d.ts +4 -1
  74. package/dist/components/tabs/tab/bond.svelte.js +4 -1
  75. package/dist/components/tabs/tabs.stories.svelte +56 -59
  76. package/dist/components/tooltip/tooltip-trigger.svelte +39 -37
  77. package/dist/components/tooltip/tooltip.stories.svelte +32 -35
  78. package/dist/components/tree/tree.stories.svelte +142 -134
  79. package/dist/context/preset.svelte.d.ts +3 -3
  80. package/dist/utils/function.d.ts +2 -0
  81. package/dist/utils/function.js +6 -0
  82. package/package.json +6 -9
  83. package/dist/actions/animation.svelte.d.ts +0 -6
  84. package/dist/actions/animation.svelte.js +0 -14
  85. package/dist/actions/clickout.svelte.d.ts +0 -2
  86. package/dist/actions/clickout.svelte.js +0 -15
  87. package/dist/actions/popover.svelte.d.ts +0 -19
  88. package/dist/actions/popover.svelte.js +0 -81
  89. package/dist/actions/portal.svelte.d.ts +0 -8
  90. package/dist/actions/portal.svelte.js +0 -32
  91. package/dist/attachments/gsap.svelte.d.ts +0 -2
  92. package/dist/attachments/gsap.svelte.js +0 -26
@@ -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>
@@ -1,27 +1,22 @@
1
- <script module>
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import { default as CheckboxCmp } from './checkbox.svelte';
4
- import Root from '../root/root.svelte';
5
-
6
- const { Story } = defineMeta({
7
- title: 'ATOMS/Checkbox'
8
- });
9
- </script>
10
-
11
- <script>
12
- let checked = $state(false);
13
- </script>
14
-
15
- <Story name="Checkbox">
16
- {#snippet children({ args })}
17
- <Root class="p-4">
18
- {#snippet children({})}
19
- <div class="flex gap-2">
20
- <CheckboxCmp bind:checked />
21
-
22
- <CheckboxCmp indeterminate />
23
- </div>
24
- {/snippet}
25
- </Root>
26
- {/snippet}
27
- </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>