@svelte-atoms/core 1.0.0-alpha.32 → 1.0.0-alpha.34
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/dist/components/atom/html-atom.svelte +95 -93
- package/dist/components/atom/html-atom.svelte.d.ts +1 -1
- package/dist/components/button/button.svelte +31 -31
- package/dist/components/chip/chip.svelte +41 -0
- package/dist/components/chip/chip.svelte.d.ts +6 -0
- package/dist/components/chip/index.d.ts +1 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/chip/types.d.ts +11 -0
- package/dist/components/chip/types.js +1 -0
- package/dist/components/combobox/atoms.d.ts +2 -1
- package/dist/components/combobox/atoms.js +2 -1
- package/dist/components/combobox/bond.svelte.d.ts +16 -13
- package/dist/components/combobox/bond.svelte.js +57 -13
- package/dist/components/combobox/combobox-control.svelte +27 -13
- package/dist/components/combobox/combobox-control.svelte.d.ts +2 -10
- package/dist/components/combobox/combobox-item.svelte +3 -3
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/combobox-root.svelte.d.ts +4 -4
- package/dist/components/combobox/combobox-selections.svelte +17 -0
- package/dist/components/combobox/combobox-selections.svelte.d.ts +4 -0
- package/dist/components/combobox/combobox.stories.svelte +25 -12
- package/dist/components/combobox/types.d.ts +17 -3
- package/dist/components/date-picker/bond.svelte.js +2 -1
- package/dist/components/date-picker/date-picker-calendar.svelte +60 -67
- package/dist/components/dropdown/atoms.d.ts +2 -3
- package/dist/components/dropdown/atoms.js +3 -3
- package/dist/components/dropdown/bond.svelte.d.ts +4 -4
- package/dist/components/dropdown/bond.svelte.js +10 -11
- package/dist/components/dropdown/dropdown-query.svelte +43 -54
- package/dist/components/dropdown/dropdown-query.svelte.d.ts +3 -34
- package/dist/components/dropdown/dropdown-root.svelte +15 -2
- package/dist/components/dropdown/dropdown-root.svelte.d.ts +4 -16
- package/dist/components/dropdown/dropdown-selection.svelte +55 -0
- package/dist/components/dropdown/{dropdown-value.svelte.d.ts → dropdown-selection.svelte.d.ts} +5 -15
- package/dist/components/dropdown/dropdown-selections.svelte +62 -0
- package/dist/components/dropdown/dropdown-selections.svelte.d.ts +5 -0
- package/dist/components/dropdown/dropdown.stories.svelte +93 -49
- package/dist/components/dropdown/index.d.ts +5 -1
- package/dist/components/dropdown/index.js +5 -1
- package/dist/components/dropdown/item/controller.svelte.d.ts +1 -1
- package/dist/components/dropdown/item/controller.svelte.js +2 -2
- package/dist/components/dropdown/item/dropdown-item.svelte +0 -2
- package/dist/components/dropdown/runes.svelte.d.ts +6 -2
- package/dist/components/dropdown/runes.svelte.js +1 -1
- package/dist/components/dropdown/types.d.ts +34 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/menu/bond.svelte.js +4 -2
- package/dist/components/menu/item/controller.svelte.d.ts +1 -0
- package/dist/components/menu/item/controller.svelte.js +5 -0
- package/dist/components/popover/bond.svelte.js +1 -2
- package/dist/components/root/root.css +119 -119
- package/dist/components/stepper/README.md +38 -0
- package/dist/components/stepper/atoms.d.ts +5 -0
- package/dist/components/stepper/atoms.js +5 -0
- package/dist/components/stepper/attachments.svelte.d.ts +2 -0
- package/dist/components/stepper/attachments.svelte.js +5 -0
- package/dist/components/stepper/bond.svelte.d.ts +56 -0
- package/dist/components/stepper/bond.svelte.js +99 -0
- package/dist/components/stepper/index.d.ts +3 -0
- package/dist/components/stepper/index.js +3 -0
- package/dist/components/stepper/step/README.md +97 -0
- package/dist/components/stepper/step/atoms.d.ts +7 -0
- package/dist/components/stepper/step/atoms.js +7 -0
- package/dist/components/stepper/step/attachments.svelte.d.ts +2 -0
- package/dist/components/stepper/step/attachments.svelte.js +5 -0
- package/dist/components/stepper/step/bond.svelte.d.ts +99 -0
- package/dist/components/stepper/step/bond.svelte.js +153 -0
- package/dist/components/stepper/step/index.d.ts +3 -0
- package/dist/components/stepper/step/index.js +2 -0
- package/dist/components/stepper/step/step-body.svelte +39 -0
- package/dist/components/stepper/step/step-body.svelte.d.ts +26 -0
- package/dist/components/stepper/step/step-description.svelte +33 -0
- package/dist/components/stepper/step/step-description.svelte.d.ts +26 -0
- package/dist/components/stepper/step/step-header.svelte +34 -0
- package/dist/components/stepper/step/step-header.svelte.d.ts +26 -0
- package/dist/components/stepper/step/step-indicator.svelte +63 -0
- package/dist/components/stepper/step/step-indicator.svelte.d.ts +26 -0
- package/dist/components/stepper/step/step-root.svelte +42 -0
- package/dist/components/stepper/step/step-root.svelte.d.ts +31 -0
- package/dist/components/stepper/step/step-separator.svelte +48 -0
- package/dist/components/stepper/step/step-separator.svelte.d.ts +26 -0
- package/dist/components/stepper/step/step-title.svelte +33 -0
- package/dist/components/stepper/step/step-title.svelte.d.ts +26 -0
- package/dist/components/stepper/step/types.d.ts +91 -0
- package/dist/components/stepper/step/types.js +1 -0
- package/dist/components/stepper/stepper-body.svelte +43 -0
- package/dist/components/stepper/stepper-body.svelte.d.ts +26 -0
- package/dist/components/stepper/stepper-content.svelte +45 -0
- package/dist/components/stepper/stepper-content.svelte.d.ts +26 -0
- package/dist/components/stepper/stepper-footer.svelte +31 -0
- package/dist/components/stepper/stepper-footer.svelte.d.ts +26 -0
- package/dist/components/stepper/stepper-header.svelte +39 -0
- package/dist/components/stepper/stepper-header.svelte.d.ts +26 -0
- package/dist/components/stepper/stepper-root.svelte +60 -0
- package/dist/components/stepper/stepper-root.svelte.d.ts +31 -0
- package/dist/components/stepper/stepper.stories.svelte +264 -0
- package/dist/components/stepper/stepper.stories.svelte.d.ts +4 -0
- package/dist/components/stepper/types.d.ts +63 -0
- package/dist/components/stepper/types.js +1 -0
- package/dist/components/tabs/atoms.d.ts +1 -0
- package/dist/components/tabs/atoms.js +1 -0
- package/dist/components/tabs/bond.svelte.d.ts +18 -5
- package/dist/components/tabs/bond.svelte.js +13 -0
- package/dist/components/tabs/tab/bond.svelte.d.ts +7 -7
- package/dist/components/tabs/tab/bond.svelte.js +9 -15
- package/dist/components/tabs/tab/tab-body.svelte +43 -52
- package/dist/components/tabs/tab/tab-description.svelte +33 -41
- package/dist/components/tabs/tab/tab-header.svelte +61 -71
- package/dist/components/tabs/tab/tab-header.svelte.d.ts +1 -1
- package/dist/components/tabs/tab/tab-root.svelte +51 -86
- package/dist/components/tabs/tab/tab-root.svelte.d.ts +1 -7
- package/dist/components/tabs/tabs-body.svelte +35 -41
- package/dist/components/tabs/tabs-body.svelte.d.ts +2 -11
- package/dist/components/tabs/tabs-content.svelte +51 -0
- package/dist/components/tabs/tabs-content.svelte.d.ts +26 -0
- package/dist/components/tabs/tabs-header.svelte +32 -40
- package/dist/components/tabs/tabs-header.svelte.d.ts +2 -10
- package/dist/components/tabs/tabs-root.svelte +55 -66
- package/dist/components/tabs/tabs-root.svelte.d.ts +5 -16
- package/dist/components/tabs/tabs.stories.svelte +70 -56
- package/dist/components/tabs/types.d.ts +24 -29
- package/dist/context/preset.svelte.d.ts +1 -1
- package/package.json +33 -6
- package/dist/components/dropdown/dropdown-value.svelte +0 -60
- package/dist/components/dropdown/dropdown-values.svelte +0 -17
- package/dist/components/dropdown/dropdown-values.svelte.d.ts +0 -5
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'p', B extends Base = Base">
|
|
2
|
-
import type { TabDescriptionProps } from '../types';
|
|
3
|
-
import { HtmlAtom, type Base } from '../../atom';
|
|
4
|
-
import { TabBond } from './bond.svelte';
|
|
5
|
-
|
|
6
|
-
const bond = TabBond.get();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
preset
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
exit={exit?.bind(bond.state)}
|
|
35
|
-
initial={initial?.bind(bond.state)}
|
|
36
|
-
animate={animate?.bind(bond.state)}
|
|
37
|
-
{as}
|
|
38
|
-
{...descriptionProps}
|
|
39
|
-
>
|
|
40
|
-
{@render children?.({ tab: bond })}
|
|
41
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'p', B extends Base = Base">
|
|
2
|
+
import type { TabDescriptionProps } from '../types';
|
|
3
|
+
import { HtmlAtom as Atom, type Base } from '../../atom';
|
|
4
|
+
import { TabBond } from './bond.svelte';
|
|
5
|
+
|
|
6
|
+
const bond = TabBond.get();
|
|
7
|
+
|
|
8
|
+
if(!bond) {
|
|
9
|
+
throw new Error('TabDescription must be used within a Tab component.');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: klass = '',
|
|
14
|
+
as = 'p' as E,
|
|
15
|
+
children,
|
|
16
|
+
...restProps
|
|
17
|
+
}: TabDescriptionProps<E, B> = $props();
|
|
18
|
+
|
|
19
|
+
const descriptionProps = $derived({
|
|
20
|
+
...bond?.description(),
|
|
21
|
+
...restProps
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<Atom
|
|
26
|
+
{bond}
|
|
27
|
+
{as}
|
|
28
|
+
preset="tab.description"
|
|
29
|
+
class={['border-border', '$preset', klass]}
|
|
30
|
+
{...descriptionProps}
|
|
31
|
+
>
|
|
32
|
+
{@render children?.({ tab: bond })}
|
|
33
|
+
</Atom>
|
|
@@ -1,71 +1,61 @@
|
|
|
1
|
-
<script
|
|
2
|
-
lang="ts"
|
|
3
|
-
generics="E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base"
|
|
4
|
-
>
|
|
5
|
-
import type { TabHeaderProps } from '../types';
|
|
6
|
-
import { TabBond } from './bond.svelte';
|
|
7
|
-
import { HtmlAtom, type Base } from '../../atom';
|
|
8
|
-
|
|
9
|
-
const bond = TabBond.get();
|
|
10
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
animate={animate?.bind(bond.state)}
|
|
63
|
-
type="button"
|
|
64
|
-
disabled={isDisabled}
|
|
65
|
-
onpointerdown={handlePointerDown}
|
|
66
|
-
{...headerProps}
|
|
67
|
-
>
|
|
68
|
-
{@render children?.({
|
|
69
|
-
tab: bond
|
|
70
|
-
})}
|
|
71
|
-
</HtmlAtom>
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base"
|
|
4
|
+
>
|
|
5
|
+
import type { TabHeaderProps } from '../types';
|
|
6
|
+
import { TabBond } from './bond.svelte';
|
|
7
|
+
import { HtmlAtom as Atom, type Base } from '../../atom';
|
|
8
|
+
|
|
9
|
+
const bond = TabBond.get();
|
|
10
|
+
|
|
11
|
+
if(!bond) {
|
|
12
|
+
throw new Error('TabHeader must be used within a Tab component.');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const isActive = $derived(bond?.state.isActive);
|
|
16
|
+
const isDisabled = $derived(bond?.state.props.disabled);
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
class: klass = '',
|
|
20
|
+
as = 'button' as E,
|
|
21
|
+
children,
|
|
22
|
+
onpointerdown,
|
|
23
|
+
...restProps
|
|
24
|
+
}: TabHeaderProps<E, B> = $props();
|
|
25
|
+
|
|
26
|
+
const headerProps = $derived({
|
|
27
|
+
...bond?.header(),
|
|
28
|
+
...restProps
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function handlePointerDown(ev: PointerEvent) {
|
|
32
|
+
if (isDisabled) return;
|
|
33
|
+
|
|
34
|
+
onpointerdown?.(ev, { tab: bond });
|
|
35
|
+
|
|
36
|
+
if (ev.defaultPrevented) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
bond?.state.select();
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<Atom
|
|
45
|
+
{bond}
|
|
46
|
+
preset="tab.header"
|
|
47
|
+
as="button"
|
|
48
|
+
class={[
|
|
49
|
+
'border-border text-foreground/50 bg-foreground/0 hover:bg-foreground/5 active:bg-foreground/10 flex cursor-pointer items-center px-2 py-2 text-sm font-medium transition-colors duration-100',
|
|
50
|
+
isActive && 'text-primary bg-primary/5 hover:bg-primary/10 active:bg-primary/15',
|
|
51
|
+
isDisabled && 'opacity-50',
|
|
52
|
+
'$preset',
|
|
53
|
+
klass
|
|
54
|
+
]}
|
|
55
|
+
type="button"
|
|
56
|
+
disabled={isDisabled}
|
|
57
|
+
onpointerdown={handlePointerDown}
|
|
58
|
+
{...headerProps}
|
|
59
|
+
>
|
|
60
|
+
{@render children?.({ tab: bond })}
|
|
61
|
+
</Atom>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TabHeaderProps } from '../types';
|
|
2
2
|
import { type Base } from '../../atom';
|
|
3
3
|
declare function $$render<E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base>(): {
|
|
4
|
-
props: TabHeaderProps
|
|
4
|
+
props: TabHeaderProps<E, B>;
|
|
5
5
|
exports: {};
|
|
6
6
|
bindings: "";
|
|
7
7
|
slots: {};
|
|
@@ -1,86 +1,51 @@
|
|
|
1
|
-
<script
|
|
2
|
-
lang="ts"
|
|
3
|
-
generics="D, E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base"
|
|
4
|
-
>
|
|
5
|
-
import { nanoid } from 'nanoid';
|
|
6
|
-
import { animate as motion } from 'motion';
|
|
7
|
-
import { defineProperty, defineState } from '../../../utils';
|
|
8
|
-
import { TabBond, TabBondState, type TabBondProps } from './bond.svelte';
|
|
9
|
-
import { TabsBond } from '../bond.svelte';
|
|
10
|
-
import { type Base } from '../../atom';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const tabsBond = TabsBond.get();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const bondState = new TabBondState(() => props);
|
|
53
|
-
|
|
54
|
-
return new TabBond(bondState);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _animate(node: HTMLElement) {
|
|
58
|
-
motion(node, { opacity: +isActive }, { duration: 0 });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function getBond() {
|
|
62
|
-
return bond;
|
|
63
|
-
}
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
{#if headerElement && children}
|
|
67
|
-
<Stack.Item
|
|
68
|
-
{bond}
|
|
69
|
-
preset="tab"
|
|
70
|
-
class={[
|
|
71
|
-
'border-border tab-root flex flex-col',
|
|
72
|
-
!isActive && 'pointer-events-none',
|
|
73
|
-
'$preset',
|
|
74
|
-
klass
|
|
75
|
-
]}
|
|
76
|
-
onmount={onmount?.bind(bond.state)}
|
|
77
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
78
|
-
enter={enter?.bind(bond.state)}
|
|
79
|
-
exit={exit?.bind(bond.state)}
|
|
80
|
-
initial={initial?.bind(bond.state)}
|
|
81
|
-
animate={animate?.bind(bond.state)}
|
|
82
|
-
{...rootProps}
|
|
83
|
-
>
|
|
84
|
-
{@render children?.({ tab: bond })}
|
|
85
|
-
</Stack.Item>
|
|
86
|
-
{/if}
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="D, E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base"
|
|
4
|
+
>
|
|
5
|
+
import { nanoid } from 'nanoid';
|
|
6
|
+
import { animate as motion } from 'motion';
|
|
7
|
+
import { defineProperty, defineState } from '../../../utils';
|
|
8
|
+
import { TabBond, TabBondState, type TabBondProps } from './bond.svelte';
|
|
9
|
+
import { TabsBond } from '../bond.svelte';
|
|
10
|
+
import { type Base } from '../../atom';
|
|
11
|
+
import { HtmlAtom } from '../../atom';
|
|
12
|
+
|
|
13
|
+
const tabsBond = TabsBond.get();
|
|
14
|
+
|
|
15
|
+
if(!tabsBond) {
|
|
16
|
+
throw new Error('TabRoot must be used within a Tabs component.');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
class: klass = '',
|
|
22
|
+
value = nanoid(),
|
|
23
|
+
disabled = false,
|
|
24
|
+
data = undefined,
|
|
25
|
+
factory = _factory,
|
|
26
|
+
children,
|
|
27
|
+
} = $props();
|
|
28
|
+
|
|
29
|
+
const bondProps = defineState<TabBondProps<D>>([
|
|
30
|
+
defineProperty('value', () => value),
|
|
31
|
+
defineProperty('disabled', () => disabled),
|
|
32
|
+
defineProperty('data', () => data)
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const bond = factory(bondProps).share();
|
|
36
|
+
|
|
37
|
+
const unmount = bond.mount();
|
|
38
|
+
$effect(() => unmount);
|
|
39
|
+
|
|
40
|
+
function _factory(props: typeof bondProps) {
|
|
41
|
+
const bondState = new TabBondState(() => props);
|
|
42
|
+
|
|
43
|
+
return new TabBond(bondState);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getBond() {
|
|
47
|
+
return bond;
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{@render children?.({ tab: bond })}
|
|
@@ -8,13 +8,7 @@ declare function $$render<D, E extends keyof HTMLElementTagNameMap = 'div', B ex
|
|
|
8
8
|
data?: any;
|
|
9
9
|
factory?: (props: TabBondProps<D>) => TabBond<D>;
|
|
10
10
|
children: any;
|
|
11
|
-
|
|
12
|
-
ondestroy?: any;
|
|
13
|
-
animate?: (node: HTMLElement) => void;
|
|
14
|
-
enter?: any;
|
|
15
|
-
exit?: any;
|
|
16
|
-
initial?: any;
|
|
17
|
-
} & Record<string, any>;
|
|
11
|
+
};
|
|
18
12
|
exports: {
|
|
19
13
|
getBond: () => TabBond<D>;
|
|
20
14
|
};
|
|
@@ -1,41 +1,35 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import type { Base } from '../atom';
|
|
3
|
-
import { TabsBond } from './bond.svelte';
|
|
4
|
-
import { Stack } from '../stack';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...restProps
|
|
19
|
-
} = $props();
|
|
20
|
-
|
|
21
|
-
const bodyProps = $derived({
|
|
22
|
-
...bond?.body(),
|
|
23
|
-
...restProps
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<Stack.Root
|
|
28
|
-
{bond}
|
|
29
|
-
preset
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
animate={animate?.bind(bond.state)}
|
|
37
|
-
{as}
|
|
38
|
-
{...bodyProps}
|
|
39
|
-
>
|
|
40
|
-
{@render children?.({ tabs: bond })}
|
|
41
|
-
</Stack.Root>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import type { Base } from '../atom';
|
|
3
|
+
import { TabsBond } from './bond.svelte';
|
|
4
|
+
import { Stack } from '../stack';
|
|
5
|
+
import type { TabsBodyProps } from './types';
|
|
6
|
+
|
|
7
|
+
const bond = TabsBond.get();
|
|
8
|
+
|
|
9
|
+
if (!bond) {
|
|
10
|
+
throw new Error('Tabs.Body must be used within a Tabs.Root component.');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
class: klass = '',
|
|
15
|
+
as = 'div' as E,
|
|
16
|
+
children,
|
|
17
|
+
preset = 'tabs.body' as const,
|
|
18
|
+
...restProps
|
|
19
|
+
}: TabsBodyProps<E, B> = $props();
|
|
20
|
+
|
|
21
|
+
const bodyProps = $derived({
|
|
22
|
+
...bond?.body(),
|
|
23
|
+
...restProps
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Stack.Root
|
|
28
|
+
{bond}
|
|
29
|
+
{preset}
|
|
30
|
+
{as}
|
|
31
|
+
class={['tabs-body border-border relative flex-1', '$preset', klass]}
|
|
32
|
+
{...bodyProps}
|
|
33
|
+
>
|
|
34
|
+
{@render children?.({ tabs: bond })}
|
|
35
|
+
</Stack.Root>
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import type { Base } from '../atom';
|
|
2
|
+
import type { TabsBodyProps } from './types';
|
|
2
3
|
declare function $$render<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(): {
|
|
3
|
-
props:
|
|
4
|
-
class?: string;
|
|
5
|
-
as?: E;
|
|
6
|
-
children: any;
|
|
7
|
-
onmount?: any;
|
|
8
|
-
ondestroy?: any;
|
|
9
|
-
animate?: any;
|
|
10
|
-
enter?: any;
|
|
11
|
-
exit?: any;
|
|
12
|
-
initial?: any;
|
|
13
|
-
} & Record<string, any>;
|
|
4
|
+
props: TabsBodyProps<E, B>;
|
|
14
5
|
exports: {};
|
|
15
6
|
bindings: "";
|
|
16
7
|
slots: {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
+
import { TabsBond } from './bond.svelte';
|
|
4
|
+
import type { TabsContentProps } from './types';
|
|
5
|
+
|
|
6
|
+
const bond = TabsBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
children = undefined,
|
|
11
|
+
preset = 'tabs.content' as const,
|
|
12
|
+
...restProps
|
|
13
|
+
}: TabsContentProps<E, B> = $props();
|
|
14
|
+
|
|
15
|
+
const activeTab = $derived(bond?.state?.selectedItem);
|
|
16
|
+
const activeTabContent = $derived(bond?.state?.activeTabContent);
|
|
17
|
+
|
|
18
|
+
const contentKlass = $derived(activeTabContent?.props.class);
|
|
19
|
+
|
|
20
|
+
const allProps = $derived.by(() => {
|
|
21
|
+
if (!activeTabContent?.props) return restProps;
|
|
22
|
+
const { class: _, ...propsWithoutClass } = activeTabContent.props;
|
|
23
|
+
return {
|
|
24
|
+
...propsWithoutClass,
|
|
25
|
+
...restProps
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
{#if activeTabContent && bond}
|
|
32
|
+
{#key activeTabContent}
|
|
33
|
+
<HtmlAtom
|
|
34
|
+
{preset}
|
|
35
|
+
{bond}
|
|
36
|
+
class={[
|
|
37
|
+
'tab-body border-border pointer-events-auto flex h-auto w-full min-w-full flex-1 flex-col',
|
|
38
|
+
'$preset',
|
|
39
|
+
contentKlass,
|
|
40
|
+
klass
|
|
41
|
+
]}
|
|
42
|
+
{...allProps}
|
|
43
|
+
>
|
|
44
|
+
<!-- Render teleported tab content -->
|
|
45
|
+
{@render activeTabContent.children({ tab: activeTab })}
|
|
46
|
+
|
|
47
|
+
<!-- Optional custom content wrapper -->
|
|
48
|
+
<!-- {@render children?.({ tabs: bond })} -->
|
|
49
|
+
</HtmlAtom>
|
|
50
|
+
{/key}
|
|
51
|
+
{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Base } from '../atom';
|
|
2
|
+
import type { TabsContentProps } from './types';
|
|
3
|
+
declare function $$render<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(): {
|
|
4
|
+
props: TabsContentProps<E, B>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base> {
|
|
11
|
+
props(): ReturnType<typeof $$render<E, B>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<E, B>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<E, B>>['slots'];
|
|
14
|
+
bindings(): "";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<E, B>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<E, B>['props']>, ReturnType<__sveltets_Render<E, B>['events']>, ReturnType<__sveltets_Render<E, B>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<E, B>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<E, B>['exports']>;
|
|
21
|
+
<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(internal: unknown, props: ReturnType<__sveltets_Render<E, B>['props']> & {}): ReturnType<__sveltets_Render<E, B>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const TabsContent: $$IsomorphicComponent;
|
|
25
|
+
type TabsContent<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base> = InstanceType<typeof TabsContent<E, B>>;
|
|
26
|
+
export default TabsContent;
|
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { HtmlAtom, type Base } from '../atom';
|
|
3
|
-
import { TabsBond } from './bond.svelte';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
...restProps
|
|
17
|
-
} = $props();
|
|
18
|
-
|
|
19
|
-
const headerProps = $derived({
|
|
20
|
-
...bond?.header(),
|
|
21
|
-
...restProps
|
|
22
|
-
});
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
{bond}
|
|
27
|
-
preset
|
|
28
|
-
class={['
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
initial={initial?.bind(bond.state)}
|
|
34
|
-
animate={animate?.bind(bond.state)}
|
|
35
|
-
{...headerProps}
|
|
36
|
-
>
|
|
37
|
-
{#if children}
|
|
38
|
-
{@render children({ tabs: bond })}
|
|
39
|
-
{/if}
|
|
40
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { HtmlAtom as Atom, type Base } from '../atom';
|
|
3
|
+
import { TabsBond } from './bond.svelte';
|
|
4
|
+
import type { TabsHeaderProps } from './types';
|
|
5
|
+
|
|
6
|
+
const bond = TabsBond.get();
|
|
7
|
+
|
|
8
|
+
if(!bond) {
|
|
9
|
+
throw new Error('TabsHeader must be used within a Tabs component');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: klass = '',
|
|
14
|
+
children,
|
|
15
|
+
preset = 'tabs.header' as const,
|
|
16
|
+
...restProps
|
|
17
|
+
}: TabsHeaderProps<E, B> = $props();
|
|
18
|
+
|
|
19
|
+
const headerProps = $derived({
|
|
20
|
+
...bond?.header(),
|
|
21
|
+
...restProps
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<Atom
|
|
26
|
+
{bond}
|
|
27
|
+
{preset}
|
|
28
|
+
class={['relative flex min-w-full border-border', '$preset', klass]}
|
|
29
|
+
{...headerProps}
|
|
30
|
+
>
|
|
31
|
+
{@render children?.({ tabs: bond })}
|
|
32
|
+
</Atom>
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { type Base } from '../atom';
|
|
2
|
+
import type { TabsHeaderProps } from './types';
|
|
2
3
|
declare function $$render<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base>(): {
|
|
3
|
-
props:
|
|
4
|
-
class?: string;
|
|
5
|
-
children: any;
|
|
6
|
-
onmount?: any;
|
|
7
|
-
ondestroy?: any;
|
|
8
|
-
animate?: any;
|
|
9
|
-
enter?: any;
|
|
10
|
-
exit?: any;
|
|
11
|
-
initial?: any;
|
|
12
|
-
} & Record<string, any>;
|
|
4
|
+
props: TabsHeaderProps<E, B>;
|
|
13
5
|
exports: {};
|
|
14
6
|
bindings: "";
|
|
15
7
|
slots: {};
|