@svelte-atoms/core 1.0.0-alpha.30 → 1.0.0-alpha.31
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/README.md +853 -852
- package/dist/components/accordion/accordion-root.svelte +7 -3
- package/dist/components/accordion/accordion.stories.svelte +7 -82
- package/dist/components/accordion/item/accordion-item-body.svelte +44 -42
- package/dist/components/accordion/item/accordion-item-header.svelte +51 -50
- package/dist/components/accordion/item/accordion-item-indicator.svelte +51 -50
- package/dist/components/accordion/item/accordion-item-root.svelte +66 -65
- 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 +66 -70
- package/dist/components/alert/alert-description.svelte +42 -42
- package/dist/components/alert/alert-description.svelte.d.ts +3 -6
- package/dist/components/alert/alert-root.svelte +68 -103
- 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 +261 -261
- 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.stories.svelte +5 -5
- package/dist/components/button/button.stories.svelte +27 -27
- package/dist/components/calendar/calendar-day.svelte +101 -96
- 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 +6 -2
- package/dist/components/collapsible/collapsible.stories.svelte +172 -172
- package/dist/components/combobox/atoms.d.ts +1 -1
- package/dist/components/combobox/atoms.js +1 -1
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/compobox.stories.svelte +51 -51
- 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 +90 -88
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -67
- 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 +66 -5
- package/dist/components/dialog/dialog-content.svelte +44 -62
- package/dist/components/dialog/dialog-root.svelte +91 -110
- 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 +24 -5
- package/dist/components/drawer/bond.svelte.js +77 -11
- package/dist/components/drawer/drawer-content.svelte +6 -14
- package/dist/components/drawer/drawer.stories.svelte +27 -95
- 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 +5 -1
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown.stories.svelte +80 -80
- package/dist/components/dropdown/index.d.ts +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 +20 -20
- package/dist/components/menu/atoms.d.ts +1 -0
- package/dist/components/menu/atoms.js +1 -0
- package/dist/components/menu/index.d.ts +2 -1
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/menu-item.svelte +69 -51
- package/dist/components/menu/menu-item.svelte.d.ts +1 -0
- package/dist/components/menu/menu.stories.svelte +33 -33
- package/dist/components/popover/bond.svelte.d.ts +20 -7
- package/dist/components/popover/bond.svelte.js +80 -27
- 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 +34 -72
- 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 +3 -3
- package/dist/components/popover/types.d.ts +9 -7
- package/dist/components/portal/active-portal.svelte +29 -22
- package/dist/components/portal/active-portal.svelte.d.ts +2 -9
- package/dist/components/portal/portal-root.svelte +76 -83
- package/dist/components/portal/portal-root.svelte.d.ts +4 -6
- package/dist/components/portal/teleport.svelte +49 -50
- 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 +1 -1
- package/dist/components/radio/types.d.ts +98 -0
- package/dist/components/radio/types.js +2 -0
- package/dist/components/root/root.svelte +13 -30
- package/dist/components/root/root.svelte.d.ts +1 -1
- 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 +3 -13
- 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 +9 -6
- package/dist/components/textarea/textarea-root.svelte +9 -9
- package/dist/components/textarea/textarea-root.svelte.d.ts +2 -0
- package/dist/components/tooltip/tooltip-trigger.svelte +2 -2
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +1 -0
- package/dist/components/tooltip/tooltip.stories.svelte +32 -32
- package/dist/components/tree/tree.stories.svelte +142 -142
- package/dist/icons/icon-copy.svelte +6 -0
- package/dist/{components/radio/types.svelte.d.ts → icons/icon-copy.svelte.d.ts} +3 -3
- package/dist/utils/markdown-to-llm.d.ts +28 -0
- package/dist/utils/markdown-to-llm.js +76 -0
- package/package.json +1 -2
- package/dist/components/radio/types.svelte +0 -0
- package/llm/composition.md +0 -395
- package/llm/crafting.md +0 -838
- package/llm/motion.md +0 -970
- package/llm/philosophy.md +0 -23
- package/llm/preset-variant-integration.md +0 -516
- package/llm/preset.md +0 -383
- package/llm/styling.md +0 -216
- package/llm/usage.md +0 -46
- package/llm/variants.md +0 -1259
|
@@ -1,50 +1,49 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
export type { TeleportProps } from './types';
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<script lang="ts" generics="E extends HtmlElementTagName = 'div', B extends Base = Base">
|
|
6
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
7
|
-
import type { TeleportProps } from './types';
|
|
8
|
-
import { HtmlAtom, type
|
|
9
|
-
import type { HtmlElementTagName, HtmlElementType } from '../element';
|
|
10
|
-
import { PortalsBond } from './portals';
|
|
11
|
-
import { RootBond } from '../root/bond.svelte';
|
|
12
|
-
import { port } from './utils';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
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
|
-
{/if}
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export type { TeleportProps } from './types';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" generics="E extends HtmlElementTagName = 'div', B extends Base = Base">
|
|
6
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
7
|
+
import type { TeleportProps } from './types';
|
|
8
|
+
import { HtmlAtom, type Base } from '../atom';
|
|
9
|
+
import type { HtmlElementTagName, HtmlElementType } from '../element';
|
|
10
|
+
import { PortalsBond } from './portals';
|
|
11
|
+
import { RootBond } from '../root/bond.svelte';
|
|
12
|
+
import { port } from './utils';
|
|
13
|
+
|
|
14
|
+
type Element = HtmlElementType<E>;
|
|
15
|
+
|
|
16
|
+
let { portal, as, base, children, ...restProps }: TeleportProps<E, B> & HTMLAttributes<Element> =
|
|
17
|
+
$props();
|
|
18
|
+
|
|
19
|
+
const portalsBond = PortalsBond.get();
|
|
20
|
+
const rootBond = RootBond.get();
|
|
21
|
+
|
|
22
|
+
const portalBond = $derived.by(() => {
|
|
23
|
+
if (typeof portal === 'string') {
|
|
24
|
+
return portalsBond?.state?.get(portal!) ?? rootBond?.state?.getPortal(portal!);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return portal;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const targetElement = $derived(portalBond?.targetElement);
|
|
31
|
+
|
|
32
|
+
function _port(node: HTMLElement) {
|
|
33
|
+
const hidden = node.hidden;
|
|
34
|
+
|
|
35
|
+
node.hidden = true;
|
|
36
|
+
|
|
37
|
+
const unport = port(node, targetElement);
|
|
38
|
+
|
|
39
|
+
node.hidden = hidden;
|
|
40
|
+
|
|
41
|
+
return unport;
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
{#if targetElement && portal}
|
|
46
|
+
<HtmlAtom {@attach _port} as={as as E} {base} {...restProps}>
|
|
47
|
+
{@render children?.({ portal: portalBond })}
|
|
48
|
+
</HtmlAtom>
|
|
49
|
+
{/if}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export type { TeleportProps } from './types';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { type
|
|
3
|
+
import { type Base } from '../atom';
|
|
4
4
|
import type { HtmlElementTagName, HtmlElementType } from '../element';
|
|
5
|
-
import type { PortalBond } from '.';
|
|
6
5
|
declare function $$render<E extends HtmlElementTagName = 'div', B extends Base = Base>(): {
|
|
7
|
-
props: HtmlAtomProps<E, B> & import("./types").TeleportExtendProps & {
|
|
8
|
-
portal?: string | PortalBond;
|
|
6
|
+
props: import("../atom").HtmlAtomProps<E, B> & import("./types").TeleportExtendProps & {
|
|
7
|
+
portal?: string | import("./bond.svelte").PortalBond;
|
|
9
8
|
} & HTMLAttributes<HtmlElementType<E>>;
|
|
10
9
|
exports: {};
|
|
11
10
|
bindings: "";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import QrCodeComponent from './qr-code.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'Atoms/QR Code'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story name="QR Code">
|
|
14
|
-
<QrCodeComponent
|
|
15
|
-
class="text-primary-foreground bg-primary size-64 rounded-2xl p-1"
|
|
16
|
-
value="Hello World 123"
|
|
17
|
-
/>
|
|
18
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import QrCodeComponent from './qr-code.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Atoms/QR Code'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="QR Code">
|
|
14
|
+
<QrCodeComponent
|
|
15
|
+
class="text-primary-foreground bg-primary size-64 rounded-2xl p-1"
|
|
16
|
+
value="Hello World 123"
|
|
17
|
+
/>
|
|
18
|
+
</Story>
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { default as RadioComponent } from './radio.svelte';
|
|
4
|
-
import { default as RadioGroupComponent } from './radio-group.svelte';
|
|
5
|
-
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: 'ATOMS/Radio'
|
|
8
|
-
});
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
let value = $state('t1');
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<Story name="Group">
|
|
16
|
-
<RadioGroupComponent class="gap-4" name="choice" bind:value>
|
|
17
|
-
<label class="flex items-center gap-2">
|
|
18
|
-
<RadioComponent class="size-8" value="t1" />
|
|
19
|
-
<div>Test 1</div>
|
|
20
|
-
</label>
|
|
21
|
-
|
|
22
|
-
<label class="flex items-center gap-2">
|
|
23
|
-
<RadioComponent class="size-8" value="t2" />
|
|
24
|
-
<div>Test 2</div>
|
|
25
|
-
</label>
|
|
26
|
-
|
|
27
|
-
<label class="flex items-center gap-2">
|
|
28
|
-
<RadioComponent class="size-8" value="t3" />
|
|
29
|
-
<div>Test 3</div>
|
|
30
|
-
</label>
|
|
31
|
-
|
|
32
|
-
<label class="flex items-center gap-2">
|
|
33
|
-
<RadioComponent class="size-8" value="t4" />
|
|
34
|
-
<div>Test 4</div>
|
|
35
|
-
</label>
|
|
36
|
-
</RadioGroupComponent>
|
|
37
|
-
|
|
38
|
-
<div class="mt-8">
|
|
39
|
-
Selected value: <strong>{value}</strong>
|
|
40
|
-
</div>
|
|
41
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { default as RadioComponent } from './radio.svelte';
|
|
4
|
+
import { default as RadioGroupComponent } from './radio-group.svelte';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'ATOMS/Radio'
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
let value = $state('t1');
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Story name="Group">
|
|
16
|
+
<RadioGroupComponent class="gap-4" name="choice" bind:value>
|
|
17
|
+
<label class="flex items-center gap-2">
|
|
18
|
+
<RadioComponent class="size-8" value="t1" />
|
|
19
|
+
<div>Test 1</div>
|
|
20
|
+
</label>
|
|
21
|
+
|
|
22
|
+
<label class="flex items-center gap-2">
|
|
23
|
+
<RadioComponent class="size-8" value="t2" />
|
|
24
|
+
<div>Test 2</div>
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<label class="flex items-center gap-2">
|
|
28
|
+
<RadioComponent class="size-8" value="t3" />
|
|
29
|
+
<div>Test 3</div>
|
|
30
|
+
</label>
|
|
31
|
+
|
|
32
|
+
<label class="flex items-center gap-2">
|
|
33
|
+
<RadioComponent class="size-8" value="t4" />
|
|
34
|
+
<div>Test 4</div>
|
|
35
|
+
</label>
|
|
36
|
+
</RadioGroupComponent>
|
|
37
|
+
|
|
38
|
+
<div class="mt-8">
|
|
39
|
+
Selected value: <strong>{value}</strong>
|
|
40
|
+
</div>
|
|
41
|
+
</Story>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { default as RadioModule } from './radio.svelte';
|
|
4
|
-
|
|
5
|
-
const { Story } = defineMeta({
|
|
6
|
-
title: 'ATOMS/Radio'
|
|
7
|
-
});
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
let value = $state(undefined);
|
|
12
|
-
let checked = $state(false);
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<Story name="Radio">
|
|
16
|
-
<RadioModule class="size-5" />
|
|
17
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { default as RadioModule } from './radio.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'ATOMS/Radio'
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
let value = $state(undefined);
|
|
12
|
+
let checked = $state(false);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Story name="Radio">
|
|
16
|
+
<RadioModule class="size-5" />
|
|
17
|
+
</Story>
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
<Stack.Root
|
|
73
73
|
preset="radio"
|
|
74
74
|
class={[
|
|
75
|
-
'text-foreground bg-input box-border inline-flex aspect-square size-4 max-h-fit cursor-pointer place-items-center rounded-full border p-0',
|
|
75
|
+
'text-foreground bg-input box-border inline-flex aspect-square size-4 max-h-fit max-w-fit cursor-pointer place-items-center rounded-full border p-0',
|
|
76
76
|
isDisabled && 'pointer-events-none opacity-50',
|
|
77
77
|
'$preset',
|
|
78
78
|
toClassValue.apply(null, [klass, {}])
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type Component, type Snippet } from 'svelte';
|
|
2
|
+
import { type HtmlAtomProps } from '../atom';
|
|
3
|
+
/**
|
|
4
|
+
* Extend this interface to add custom radio properties in your application.
|
|
5
|
+
*/
|
|
6
|
+
export interface RadioExtendProps {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Extend this interface to add custom radio group properties in your application.
|
|
10
|
+
*/
|
|
11
|
+
export interface RadioGroupExtendProps {
|
|
12
|
+
}
|
|
13
|
+
export interface RadioProps<T = string> extends HtmlAtomProps<'label'>, RadioExtendProps {
|
|
14
|
+
/**
|
|
15
|
+
* The value of the radio button
|
|
16
|
+
*/
|
|
17
|
+
value?: T;
|
|
18
|
+
/**
|
|
19
|
+
* The currently selected value (for standalone radios)
|
|
20
|
+
*/
|
|
21
|
+
group?: T;
|
|
22
|
+
/**
|
|
23
|
+
* The id attribute of the radio input
|
|
24
|
+
*/
|
|
25
|
+
id?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The name attribute of the radio input
|
|
28
|
+
*/
|
|
29
|
+
name?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the radio button is disabled
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the radio button is required
|
|
36
|
+
*/
|
|
37
|
+
required?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the radio button is readonly
|
|
40
|
+
*/
|
|
41
|
+
readonly?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Custom content to display when the radio is checked
|
|
44
|
+
*/
|
|
45
|
+
checkedContent?: Component | Snippet;
|
|
46
|
+
/**
|
|
47
|
+
* Child content (label text)
|
|
48
|
+
*/
|
|
49
|
+
children?: Snippet<[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Change event handler
|
|
52
|
+
*/
|
|
53
|
+
onchange?: (ev: Event, options?: {
|
|
54
|
+
checked: boolean;
|
|
55
|
+
value: boolean;
|
|
56
|
+
type: 'boolean';
|
|
57
|
+
}) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Input event handler
|
|
60
|
+
*/
|
|
61
|
+
oninput?: (ev: Event, options?: {
|
|
62
|
+
checked: boolean;
|
|
63
|
+
value: boolean;
|
|
64
|
+
type: 'boolean';
|
|
65
|
+
}) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface RadioGroupProps<T = string> extends HtmlAtomProps<'div'>, RadioGroupExtendProps {
|
|
68
|
+
/**
|
|
69
|
+
* The currently selected value
|
|
70
|
+
*/
|
|
71
|
+
value?: T;
|
|
72
|
+
/**
|
|
73
|
+
* Whether all radio buttons in the group are disabled
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether all radio buttons in the group are required
|
|
78
|
+
*/
|
|
79
|
+
required?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether all radio buttons in the group are readonly
|
|
82
|
+
*/
|
|
83
|
+
readonly?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The name attribute shared by all radio buttons in the group
|
|
86
|
+
*/
|
|
87
|
+
name?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Child content (radio buttons)
|
|
90
|
+
*/
|
|
91
|
+
children?: Snippet<[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Input event handler triggered when the selected value changes
|
|
94
|
+
*/
|
|
95
|
+
oninput?: (ev: CustomEvent, options?: {
|
|
96
|
+
value: T;
|
|
97
|
+
}) => void;
|
|
98
|
+
}
|
|
@@ -4,23 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import { cn, defineState, defineProperty } from '../../utils';
|
|
7
|
-
import { RootBond, RootBondState, type RootStateProps } from './bond.svelte';
|
|
8
7
|
import { Portal, ActivePortal, Portals } from '../portal';
|
|
9
|
-
import {
|
|
10
|
-
import { HtmlAtom } from '../atom';
|
|
8
|
+
import { HtmlAtom as Atom } from '../atom';
|
|
11
9
|
import { HtmlElement, MathmlElement, SvgElement } from '../element';
|
|
10
|
+
import { RootBond, RootBondState, type RootStateProps } from './bond.svelte';
|
|
12
11
|
|
|
13
12
|
let {
|
|
14
13
|
class: klass = '',
|
|
15
|
-
base,
|
|
14
|
+
base = undefined,
|
|
16
15
|
children = undefined,
|
|
17
16
|
portals = undefined,
|
|
18
17
|
...restProps
|
|
19
18
|
} = $props();
|
|
20
19
|
|
|
21
|
-
let html: typeof HtmlElement | undefined = HtmlElement;
|
|
22
|
-
let svg: typeof SvgElement | undefined = undefined;
|
|
23
|
-
let mathml: typeof MathmlElement | undefined = undefined;
|
|
20
|
+
let html: typeof HtmlElement | undefined = $state(HtmlElement);
|
|
21
|
+
let svg: typeof SvgElement | undefined = $state(undefined);
|
|
22
|
+
let mathml: typeof MathmlElement | undefined = $state(undefined);
|
|
24
23
|
|
|
25
24
|
type Renderers = {
|
|
26
25
|
html?: typeof HtmlElement;
|
|
@@ -65,14 +64,14 @@
|
|
|
65
64
|
</script>
|
|
66
65
|
|
|
67
66
|
<Portals id="root">
|
|
68
|
-
<
|
|
67
|
+
<Atom
|
|
69
68
|
{@attach (node) => {
|
|
70
69
|
bond.rootElement = node;
|
|
71
70
|
}}
|
|
72
71
|
{base}
|
|
73
72
|
preset="root"
|
|
74
73
|
class={cn(
|
|
75
|
-
'atom-root bg-background text-foreground relative flex w-full flex-1 flex-col items-start justify-stretch font-sans',
|
|
74
|
+
'atom-root bg-background text-foreground relative flex h-full w-full flex-1 flex-col items-start justify-stretch font-sans',
|
|
76
75
|
'$preset',
|
|
77
76
|
klass
|
|
78
77
|
)}
|
|
@@ -81,35 +80,19 @@
|
|
|
81
80
|
{#if portals}
|
|
82
81
|
{@render portals?.()}
|
|
83
82
|
{:else}
|
|
84
|
-
<Portal.Outer
|
|
85
|
-
base={Stack.Item}
|
|
86
|
-
id="root.l0"
|
|
87
|
-
class="pointer-events-none absolute inset-0 z-10 overflow-hidden"
|
|
88
|
-
>
|
|
83
|
+
<Portal.Outer id="root.l0" class="pointer-events-none absolute inset-0 z-10 overflow-hidden">
|
|
89
84
|
<Portal.Inner />
|
|
90
85
|
</Portal.Outer>
|
|
91
86
|
|
|
92
|
-
<Portal.Outer
|
|
93
|
-
base={Stack.Item}
|
|
94
|
-
id="root.l1"
|
|
95
|
-
class="pointer-events-none absolute inset-0 z-10 overflow-hidden"
|
|
96
|
-
>
|
|
87
|
+
<Portal.Outer id="root.l1" class="pointer-events-none absolute inset-0 z-10 overflow-hidden">
|
|
97
88
|
<Portal.Inner />
|
|
98
89
|
</Portal.Outer>
|
|
99
90
|
|
|
100
|
-
<Portal.Outer
|
|
101
|
-
base={Stack.Item}
|
|
102
|
-
id="root.l2"
|
|
103
|
-
class="pointer-events-none absolute inset-0 z-10 overflow-hidden"
|
|
104
|
-
>
|
|
91
|
+
<Portal.Outer id="root.l2" class="pointer-events-none absolute inset-0 z-10 overflow-hidden">
|
|
105
92
|
<Portal.Inner />
|
|
106
93
|
</Portal.Outer>
|
|
107
94
|
|
|
108
|
-
<Portal.Outer
|
|
109
|
-
base={Stack.Item}
|
|
110
|
-
id="root.l3"
|
|
111
|
-
class="pointer-events-none absolute inset-0 z-10 overflow-hidden"
|
|
112
|
-
>
|
|
95
|
+
<Portal.Outer id="root.l3" class="pointer-events-none absolute inset-0 z-10 overflow-hidden">
|
|
113
96
|
<Portal.Inner />
|
|
114
97
|
</Portal.Outer>
|
|
115
98
|
{/if}
|
|
@@ -117,5 +100,5 @@
|
|
|
117
100
|
<ActivePortal portal="root.l0">
|
|
118
101
|
{@render children?.()}
|
|
119
102
|
</ActivePortal>
|
|
120
|
-
</
|
|
103
|
+
</Atom>
|
|
121
104
|
</Portals>
|
|
@@ -5,7 +5,7 @@ declare function $$render<T extends keyof HTMLElementTagNameMap>(): {
|
|
|
5
5
|
exports: {
|
|
6
6
|
getBond: () => ScrollableBond;
|
|
7
7
|
};
|
|
8
|
-
bindings: "
|
|
8
|
+
bindings: "clientHeight" | "clientWidth" | "scrollHeight" | "scrollWidth" | "scrollX" | "scrollY";
|
|
9
9
|
slots: {};
|
|
10
10
|
events: {};
|
|
11
11
|
};
|
|
@@ -13,7 +13,7 @@ declare class __sveltets_Render<T extends keyof HTMLElementTagNameMap> {
|
|
|
13
13
|
props(): ReturnType<typeof $$render<T>>['props'];
|
|
14
14
|
events(): ReturnType<typeof $$render<T>>['events'];
|
|
15
15
|
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
16
|
-
bindings(): "
|
|
16
|
+
bindings(): "clientHeight" | "clientWidth" | "scrollHeight" | "scrollWidth" | "scrollX" | "scrollY";
|
|
17
17
|
exports(): {
|
|
18
18
|
getBond: () => ScrollableBond;
|
|
19
19
|
};
|