@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Easing } from 'motion';
|
|
2
|
+
type AnimateSidebarContentParams = {
|
|
3
|
+
duration?: number;
|
|
4
|
+
delay?: number;
|
|
5
|
+
ease?: Easing | Easing[];
|
|
6
|
+
axis?: 'x' | 'y';
|
|
7
|
+
0?: number | string;
|
|
8
|
+
1?: number | string;
|
|
9
|
+
};
|
|
10
|
+
export declare function animateSidebarContent(params: AnimateSidebarContentParams): (node: HTMLElement) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { animate } from 'motion';
|
|
2
|
+
import { DURATION } from '../../shared';
|
|
3
|
+
import { SidebarBond } from '.';
|
|
4
|
+
export function animateSidebarContent(params) {
|
|
5
|
+
const { duration = DURATION.fast / 1000, delay = 0, ease = 'easeInOut', axis = 'x', '0': collapsedSize = '96px', '1': expandedSize = 'auto' } = params;
|
|
6
|
+
const bond = SidebarBond.get();
|
|
7
|
+
return (node) => {
|
|
8
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
9
|
+
const collapsedProp = axis === 'x' ? 'min-width' : 'min-height';
|
|
10
|
+
const prop = axis === 'x' ? 'width' : 'height';
|
|
11
|
+
animate(node, {
|
|
12
|
+
[prop]: isOpen ? expandedSize : collapsedSize,
|
|
13
|
+
[collapsedProp]: collapsedSize
|
|
14
|
+
}, { duration, ease, delay });
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1,50 +1,40 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
-
import { SidebarBond } from './bond.svelte';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const bond = SidebarBond.get();
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
class: klass = '',
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
enter={enter?.bind(bond.state)}
|
|
42
|
-
exit={exit?.bind(bond.state)}
|
|
43
|
-
initial={initial?.bind(bond.state)}
|
|
44
|
-
animate={animate?.bind(bond.state)}
|
|
45
|
-
onmount={onmount?.bind(bond.state)}
|
|
46
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
47
|
-
{...contentProps}
|
|
48
|
-
>
|
|
49
|
-
{@render children?.({ sidebar: bond })}
|
|
50
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
+
import { SidebarBond } from './bond.svelte';
|
|
4
|
+
import { animateSidebarContent } from './motion.svelte';
|
|
5
|
+
import type { SidebarRootProps } from './types';
|
|
6
|
+
|
|
7
|
+
const bond = SidebarBond.get();
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: klass = '',
|
|
11
|
+
children = undefined,
|
|
12
|
+
onmount = undefined,
|
|
13
|
+
ondestroy = undefined,
|
|
14
|
+
animate = animateSidebarContent({ '0': '0px', '1': 'auto' }),
|
|
15
|
+
enter = undefined,
|
|
16
|
+
exit = undefined,
|
|
17
|
+
initial = animateSidebarContent({ '0': '0px', '1': 'auto', duration: 0 }),
|
|
18
|
+
...restProps
|
|
19
|
+
}: SidebarRootProps<E, B> = $props();
|
|
20
|
+
|
|
21
|
+
const contentProps = $derived({
|
|
22
|
+
...bond?.content(),
|
|
23
|
+
...restProps
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<HtmlAtom
|
|
28
|
+
{bond}
|
|
29
|
+
preset="sidebar.content"
|
|
30
|
+
class={['bg-card border-border', '$preset', klass]}
|
|
31
|
+
enter={enter?.bind(bond.state)}
|
|
32
|
+
exit={exit?.bind(bond.state)}
|
|
33
|
+
initial={initial?.bind(bond.state)}
|
|
34
|
+
animate={animate?.bind(bond.state)}
|
|
35
|
+
onmount={onmount?.bind(bond.state)}
|
|
36
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
37
|
+
{...contentProps}
|
|
38
|
+
>
|
|
39
|
+
{@render children?.({ sidebar: bond })}
|
|
40
|
+
</HtmlAtom>
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { defineProperty, defineState } from '../../utils';
|
|
3
|
-
import { type Base } from '../atom';
|
|
4
|
-
import { SidebarBond, SidebarBondState, type SidebarBondProps } from './bond.svelte';
|
|
5
|
-
import type { SidebarRootProps } from './types';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
open = $bindable(false),
|
|
9
|
-
disabled = false,
|
|
10
|
-
factory = _factory,
|
|
11
|
-
children = undefined
|
|
12
|
-
}: SidebarRootProps<E, B> = $props();
|
|
13
|
-
|
|
14
|
-
const bondProps = defineState<SidebarBondProps>([
|
|
15
|
-
defineProperty(
|
|
16
|
-
'open',
|
|
17
|
-
() => open,
|
|
18
|
-
(v) => {
|
|
19
|
-
open = v;
|
|
20
|
-
}
|
|
21
|
-
),
|
|
22
|
-
defineProperty('disabled', () => disabled)
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
const bond = factory(bondProps).share();
|
|
26
|
-
|
|
27
|
-
function _factory(props: typeof bondProps) {
|
|
28
|
-
const bondState = new SidebarBondState(() => props);
|
|
29
|
-
const bond = new SidebarBond(bondState);
|
|
30
|
-
|
|
31
|
-
return bond;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getBond() {
|
|
35
|
-
return bond;
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
{@render children?.({ sidebar: bond })}
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { defineProperty, defineState } from '../../utils';
|
|
3
|
+
import { type Base } from '../atom';
|
|
4
|
+
import { SidebarBond, SidebarBondState, type SidebarBondProps } from './bond.svelte';
|
|
5
|
+
import type { SidebarRootProps } from './types';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
open = $bindable(false),
|
|
9
|
+
disabled = false,
|
|
10
|
+
factory = _factory,
|
|
11
|
+
children = undefined
|
|
12
|
+
}: SidebarRootProps<E, B> = $props();
|
|
13
|
+
|
|
14
|
+
const bondProps = defineState<SidebarBondProps>([
|
|
15
|
+
defineProperty(
|
|
16
|
+
'open',
|
|
17
|
+
() => open,
|
|
18
|
+
(v) => {
|
|
19
|
+
open = v;
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
defineProperty('disabled', () => disabled)
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
const bond = factory(bondProps).share();
|
|
26
|
+
|
|
27
|
+
function _factory(props: typeof bondProps) {
|
|
28
|
+
const bondState = new SidebarBondState(() => props);
|
|
29
|
+
const bond = new SidebarBond(bondState);
|
|
30
|
+
|
|
31
|
+
return bond;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getBond() {
|
|
35
|
+
return bond;
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
{@render children?.({ sidebar: bond })}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Sidebar as Sidebar_ } from '.';
|
|
4
|
-
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: 'Atoms/Sidebar',
|
|
8
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
9
|
-
|
|
10
|
-
parameters: {
|
|
11
|
-
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
-
layout: 'fullscreen'
|
|
13
|
-
},
|
|
14
|
-
args: {}
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
let isOpen = $state(false);
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Story name="Sidebar" args={{}}>
|
|
23
|
-
<Sidebar_.Root class="" bind:open={isOpen}>
|
|
24
|
-
{#snippet children({ sidebar })}
|
|
25
|
-
<div class="flex size-full">
|
|
26
|
-
<Sidebar_.Content
|
|
27
|
-
class="flex min-w-32 flex-col border-r px-6 py-10 whitespace-nowrap"
|
|
28
|
-
width="300px"
|
|
29
|
-
>
|
|
30
|
-
<div>
|
|
31
|
-
<button
|
|
32
|
-
onclick={() => {
|
|
33
|
-
sidebar?.state.toggle?.();
|
|
34
|
-
}}>Open</button
|
|
35
|
-
>
|
|
36
|
-
</div>
|
|
37
|
-
</Sidebar_.Content>
|
|
38
|
-
|
|
39
|
-
<main class="bg-foreground/2 flex-1 p-8">Hello World!</main>
|
|
40
|
-
</div>
|
|
41
|
-
{/snippet}
|
|
42
|
-
</Sidebar_.Root>
|
|
43
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Sidebar as Sidebar_ } from '.';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Atoms/Sidebar',
|
|
8
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
9
|
+
|
|
10
|
+
parameters: {
|
|
11
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
+
layout: 'fullscreen'
|
|
13
|
+
},
|
|
14
|
+
args: {}
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
let isOpen = $state(false);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Story name="Sidebar" args={{}}>
|
|
23
|
+
<Sidebar_.Root class="" bind:open={isOpen}>
|
|
24
|
+
{#snippet children({ sidebar })}
|
|
25
|
+
<div class="flex size-full">
|
|
26
|
+
<Sidebar_.Content
|
|
27
|
+
class="flex min-w-32 flex-col border-r px-6 py-10 whitespace-nowrap"
|
|
28
|
+
width="300px"
|
|
29
|
+
>
|
|
30
|
+
<div>
|
|
31
|
+
<button
|
|
32
|
+
onclick={() => {
|
|
33
|
+
sidebar?.state.toggle?.();
|
|
34
|
+
}}>Open</button
|
|
35
|
+
>
|
|
36
|
+
</div>
|
|
37
|
+
</Sidebar_.Content>
|
|
38
|
+
|
|
39
|
+
<main class="bg-foreground/2 flex-1 p-8">Hello World!</main>
|
|
40
|
+
</div>
|
|
41
|
+
{/snippet}
|
|
42
|
+
</Sidebar_.Root>
|
|
43
|
+
</Story>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { Override } from '../../types';
|
|
3
1
|
import type { Factory } from '../../types';
|
|
4
2
|
import type { SidebarBond } from './bond.svelte';
|
|
5
3
|
import type { Base, HtmlAtomProps } from '../atom';
|
|
@@ -13,19 +11,11 @@ export interface SidebarRootExtendProps {
|
|
|
13
11
|
*/
|
|
14
12
|
export interface SidebarContentExtendProps {
|
|
15
13
|
}
|
|
16
|
-
export interface SidebarRootProps<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base> extends
|
|
17
|
-
children?: Snippet<[{
|
|
18
|
-
sidebar?: SidebarBond;
|
|
19
|
-
}]>;
|
|
20
|
-
}>, SidebarRootExtendProps {
|
|
14
|
+
export interface SidebarRootProps<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base> extends HtmlAtomProps<E, B>, SidebarRootExtendProps {
|
|
21
15
|
open?: boolean;
|
|
22
16
|
disabled?: boolean;
|
|
23
17
|
width?: string | number;
|
|
24
18
|
factory?: Factory<SidebarBond>;
|
|
25
19
|
}
|
|
26
|
-
export interface SidebarContentProps<E extends keyof HTMLElementTagNameMap, B extends Base = Base> extends
|
|
27
|
-
children?: Snippet<[{
|
|
28
|
-
sidebar?: SidebarBond<any>;
|
|
29
|
-
}]>;
|
|
30
|
-
}>, SidebarContentExtendProps {
|
|
20
|
+
export interface SidebarContentProps<E extends keyof HTMLElementTagNameMap, B extends Base = Base> extends HtmlAtomProps<E, B>, SidebarContentExtendProps {
|
|
31
21
|
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Tabs as Tabs_, Tab } from '.';
|
|
4
|
-
import { Root as TabsRoot } from './atoms';
|
|
5
|
-
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'Atoms/Tabs',
|
|
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
|
-
let value = $state('ar');
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<Story name="Tabs" args={{}}>
|
|
24
|
-
<Tabs_.Root bind:value>
|
|
25
|
-
<Tabs_.Header class="border-b" />
|
|
26
|
-
<Tabs_.Body>
|
|
27
|
-
<Tab.Root value="en">
|
|
28
|
-
<Tab.Header>English</Tab.Header>
|
|
29
|
-
<Tab.Body class="">
|
|
30
|
-
<div>
|
|
31
|
-
Ligula ex tincidunt efficitur netus consequat aenean finibus. Dictum ex pretium torquent
|
|
32
|
-
vel scelerisque quisque class nisl penatibus blandit risus. Pretium praesent egestas
|
|
33
|
-
ante placerat lacus pede risus pulvinar facilisi.
|
|
34
|
-
</div>
|
|
35
|
-
</Tab.Body>
|
|
36
|
-
</Tab.Root>
|
|
37
|
-
|
|
38
|
-
<Tab.Root value="ar">
|
|
39
|
-
<Tab.Header>Arabic</Tab.Header>
|
|
40
|
-
<Tab.Body class="h-[1440px]">
|
|
41
|
-
<div>
|
|
42
|
-
Interdum turpis taciti mauris orci condimentum vitae malesuada ornare ridiculus ultrices
|
|
43
|
-
quisque feugiat pretium facilisis justo ligula pede volutpat nisi viverra adipiscing
|
|
44
|
-
donec torquent ac sapien aliquet parturient posuere leo litora vivamus luctus vestibulum
|
|
45
|
-
aptent faucibus platea libero dolor purus integer fusce nam senectus nibh nostra diam
|
|
46
|
-
tortor dictumst praesent tellus montes ad iaculis sociosqu mollis sodales consectetuer
|
|
47
|
-
hac accumsan dictum blandit conubia velit elit efficitur duis nascetur erat mattis
|
|
48
|
-
semper et aliquam magna lorem bibendum ante id cursus nulla eget ut pellentesque
|
|
49
|
-
himenaeos consectetur potenti si maximus ullamcorper etiam nec magnis ipsum mus porta
|
|
50
|
-
lobortis natoque rhoncus fringilla
|
|
51
|
-
</div>
|
|
52
|
-
</Tab.Body>
|
|
53
|
-
</Tab.Root>
|
|
54
|
-
</Tabs_.Body>
|
|
55
|
-
</Tabs_.Root>
|
|
56
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Tabs as Tabs_, Tab } from '.';
|
|
4
|
+
import { Root as TabsRoot } from './atoms';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Atoms/Tabs',
|
|
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
|
+
let value = $state('ar');
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<Story name="Tabs" args={{}}>
|
|
24
|
+
<Tabs_.Root bind:value>
|
|
25
|
+
<Tabs_.Header class="border-b" />
|
|
26
|
+
<Tabs_.Body>
|
|
27
|
+
<Tab.Root value="en">
|
|
28
|
+
<Tab.Header>English</Tab.Header>
|
|
29
|
+
<Tab.Body class="">
|
|
30
|
+
<div>
|
|
31
|
+
Ligula ex tincidunt efficitur netus consequat aenean finibus. Dictum ex pretium torquent
|
|
32
|
+
vel scelerisque quisque class nisl penatibus blandit risus. Pretium praesent egestas
|
|
33
|
+
ante placerat lacus pede risus pulvinar facilisi.
|
|
34
|
+
</div>
|
|
35
|
+
</Tab.Body>
|
|
36
|
+
</Tab.Root>
|
|
37
|
+
|
|
38
|
+
<Tab.Root value="ar">
|
|
39
|
+
<Tab.Header>Arabic</Tab.Header>
|
|
40
|
+
<Tab.Body class="h-[1440px]">
|
|
41
|
+
<div>
|
|
42
|
+
Interdum turpis taciti mauris orci condimentum vitae malesuada ornare ridiculus ultrices
|
|
43
|
+
quisque feugiat pretium facilisis justo ligula pede volutpat nisi viverra adipiscing
|
|
44
|
+
donec torquent ac sapien aliquet parturient posuere leo litora vivamus luctus vestibulum
|
|
45
|
+
aptent faucibus platea libero dolor purus integer fusce nam senectus nibh nostra diam
|
|
46
|
+
tortor dictumst praesent tellus montes ad iaculis sociosqu mollis sodales consectetuer
|
|
47
|
+
hac accumsan dictum blandit conubia velit elit efficitur duis nascetur erat mattis
|
|
48
|
+
semper et aliquam magna lorem bibendum ante id cursus nulla eget ut pellentesque
|
|
49
|
+
himenaeos consectetur potenti si maximus ullamcorper etiam nec magnis ipsum mus porta
|
|
50
|
+
lobortis natoque rhoncus fringilla
|
|
51
|
+
</div>
|
|
52
|
+
</Tab.Body>
|
|
53
|
+
</Tab.Root>
|
|
54
|
+
</Tabs_.Body>
|
|
55
|
+
</Tabs_.Root>
|
|
56
|
+
</Story>
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
let { class: klass = '', value = $bindable(), ...restProps } = $props();
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
|
-
<textarea
|
|
5
|
+
<textarea
|
|
6
|
+
class={['border-border w-full p-2 outline-none', '$preset', klass]}
|
|
7
|
+
bind:value
|
|
8
|
+
{...restProps}
|
|
6
9
|
></textarea>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { Input } from '../input';
|
|
3
3
|
|
|
4
|
-
let { children, ...restProps } = $props();
|
|
4
|
+
let { class: klass = '', children, ...restProps } = $props();
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<Input.Root preset="textarea" {...restProps}>
|
|
7
|
+
<Input.Root preset="textarea" class={['h-auto', klass]} {...restProps}>
|
|
8
8
|
{@render children?.()}
|
|
9
9
|
</Input.Root>
|
|
@@ -4,8 +4,10 @@ type TextareaRoot = {
|
|
|
4
4
|
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
5
|
};
|
|
6
6
|
declare const TextareaRoot: import("svelte").Component<{
|
|
7
|
+
class?: string;
|
|
7
8
|
children: any;
|
|
8
9
|
} & Record<string, any>, {}, "">;
|
|
9
10
|
type $$ComponentProps = {
|
|
11
|
+
class?: string;
|
|
10
12
|
children: any;
|
|
11
13
|
} & Record<string, any>;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { PopoverBond } from '../popover/bond.svelte';
|
|
3
|
-
import { Trigger } from '../popover/atoms';
|
|
4
|
-
|
|
5
|
-
const popoverBond = PopoverBond.get();
|
|
6
|
-
|
|
7
|
-
let { onmount, children, ...restProps } = $props();
|
|
8
|
-
|
|
9
|
-
function tooltip(node: HTMLElement) {
|
|
10
|
-
const onpointerenter = async () => {
|
|
11
|
-
requestAnimationFrame(() => {
|
|
12
|
-
popoverBond?.state.open();
|
|
13
|
-
});
|
|
14
|
-
node.addEventListener('pointerleave', onpointerleave);
|
|
15
|
-
};
|
|
16
|
-
const onpointerleave = () => {
|
|
17
|
-
popoverBond?.state.close();
|
|
18
|
-
node.removeEventListener('pointerleave', onpointerleave);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
node.addEventListener('pointerenter', onpointerenter, { passive: true });
|
|
22
|
-
|
|
23
|
-
const cleanup = () => {
|
|
24
|
-
node.removeEventListener('pointerenter', onpointerenter);
|
|
25
|
-
node.removeEventListener('pointerleave', onpointerleave);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const unmount = onmount?.(node);
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
cleanup?.();
|
|
32
|
-
unmount?.();
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<Trigger preset="tooltip.trigger" onmount={tooltip} {...restProps}>
|
|
38
|
-
{@render children?.()}
|
|
39
|
-
</Trigger>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PopoverBond } from '../popover/bond.svelte';
|
|
3
|
+
import { Trigger } from '../popover/atoms';
|
|
4
|
+
|
|
5
|
+
const popoverBond = PopoverBond.get();
|
|
6
|
+
|
|
7
|
+
let { onmount, children, onclick = undefined, ...restProps } = $props();
|
|
8
|
+
|
|
9
|
+
function tooltip(node: HTMLElement) {
|
|
10
|
+
const onpointerenter = async () => {
|
|
11
|
+
requestAnimationFrame(() => {
|
|
12
|
+
popoverBond?.state.open();
|
|
13
|
+
});
|
|
14
|
+
node.addEventListener('pointerleave', onpointerleave);
|
|
15
|
+
};
|
|
16
|
+
const onpointerleave = () => {
|
|
17
|
+
popoverBond?.state.close();
|
|
18
|
+
node.removeEventListener('pointerleave', onpointerleave);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
node.addEventListener('pointerenter', onpointerenter, { passive: true });
|
|
22
|
+
|
|
23
|
+
const cleanup = () => {
|
|
24
|
+
node.removeEventListener('pointerenter', onpointerenter);
|
|
25
|
+
node.removeEventListener('pointerleave', onpointerleave);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const unmount = onmount?.(node);
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
cleanup?.();
|
|
32
|
+
unmount?.();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<Trigger preset="tooltip.trigger" onmount={tooltip} {onclick} {...restProps}>
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</Trigger>
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Tooltip as Tooltip_ } from '.';
|
|
4
|
-
import { Root as TooltipRoot } from './atoms';
|
|
5
|
-
import { Button } from '../button';
|
|
6
|
-
|
|
7
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'Atoms/Tooltip',
|
|
10
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
|
-
|
|
12
|
-
parameters: {
|
|
13
|
-
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
-
layout: 'fullscreen'
|
|
15
|
-
},
|
|
16
|
-
args: {}
|
|
17
|
-
});
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<script lang="ts">
|
|
21
|
-
let open = $state(false);
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<Story name="Tooltip" args={{}}>
|
|
25
|
-
<Tooltip_.Root bind:open offset={0}>
|
|
26
|
-
<Tooltip_.Trigger base={Button}>Open Popover</Tooltip_.Trigger>
|
|
27
|
-
<Tooltip_.Content>
|
|
28
|
-
<div>Hello World !</div>
|
|
29
|
-
<Tooltip_.Arrow />
|
|
30
|
-
</Tooltip_.Content>
|
|
31
|
-
</Tooltip_.Root>
|
|
32
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Tooltip as Tooltip_ } from '.';
|
|
4
|
+
import { Root as TooltipRoot } from './atoms';
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'Atoms/Tooltip',
|
|
10
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
11
|
+
|
|
12
|
+
parameters: {
|
|
13
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: 'fullscreen'
|
|
15
|
+
},
|
|
16
|
+
args: {}
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
let open = $state(false);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Story name="Tooltip" args={{}}>
|
|
25
|
+
<Tooltip_.Root bind:open offset={0}>
|
|
26
|
+
<Tooltip_.Trigger base={Button}>Open Popover</Tooltip_.Trigger>
|
|
27
|
+
<Tooltip_.Content>
|
|
28
|
+
<div>Hello World !</div>
|
|
29
|
+
<Tooltip_.Arrow />
|
|
30
|
+
</Tooltip_.Content>
|
|
31
|
+
</Tooltip_.Root>
|
|
32
|
+
</Story>
|