lithesome 0.14.0 → 0.14.2
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/Accordion/Accordion.svelte +20 -16
- package/dist/components/Accordion/AccordionButton.svelte +11 -5
- package/dist/components/Accordion/AccordionContent.svelte +16 -11
- package/dist/components/Accordion/AccordionHeading.svelte +9 -5
- package/dist/components/Accordion/AccordionItem.svelte +19 -14
- package/dist/components/Accordion/main.svelte.d.ts +5 -4
- package/dist/components/Accordion/main.svelte.js +9 -6
- package/dist/components/Accordion/types.d.ts +11 -2
- package/dist/components/Checkbox/Checkbox.svelte +22 -17
- package/dist/components/Checkbox/types.d.ts +8 -2
- package/dist/components/Combobox/Combobox.svelte +48 -43
- package/dist/components/Combobox/ComboboxArrow.svelte +8 -4
- package/dist/components/Combobox/ComboboxContent.svelte +20 -16
- package/dist/components/Combobox/ComboboxInput.svelte +20 -7
- package/dist/components/Combobox/ComboboxOption.svelte +31 -22
- package/dist/components/Combobox/main.svelte.d.ts +12 -8
- package/dist/components/Combobox/main.svelte.js +36 -25
- package/dist/components/Combobox/types.d.ts +37 -3
- package/dist/components/Hovercard/Hovercard.svelte +25 -20
- package/dist/components/Hovercard/HovercardArrow.svelte +8 -4
- package/dist/components/Hovercard/HovercardContent.svelte +19 -15
- package/dist/components/Hovercard/HovercardTrigger.svelte +12 -7
- package/dist/components/Hovercard/main.svelte.js +7 -4
- package/dist/components/Menu/Menu.svelte +20 -16
- package/dist/components/Menu/MenuArrow.svelte +8 -4
- package/dist/components/Menu/MenuContent.svelte +19 -15
- package/dist/components/Menu/MenuItem.svelte +26 -17
- package/dist/components/Menu/MenuTrigger.svelte +12 -7
- package/dist/components/Menu/main.svelte.d.ts +6 -5
- package/dist/components/Menu/main.svelte.js +11 -7
- package/dist/components/Menu/types.d.ts +17 -4
- package/dist/components/Modal/Modal.svelte +15 -11
- package/dist/components/Modal/ModalContent.svelte +12 -8
- package/dist/components/Modal/ModalDescription.svelte +9 -5
- package/dist/components/Modal/ModalOverlay.svelte +10 -6
- package/dist/components/Modal/ModalTitle.svelte +9 -5
- package/dist/components/Modal/main.svelte.js +1 -1
- package/dist/components/Pin/Pin.svelte +29 -24
- package/dist/components/Pin/PinInput.svelte +24 -14
- package/dist/components/Pin/PinValue.svelte +8 -4
- package/dist/components/Pin/main.svelte.d.ts +8 -8
- package/dist/components/Pin/main.svelte.js +14 -7
- package/dist/components/Pin/types.d.ts +39 -2
- package/dist/components/Popover/Popover.svelte +20 -16
- package/dist/components/Popover/PopoverArrow.svelte +8 -4
- package/dist/components/Popover/PopoverContent.svelte +20 -16
- package/dist/components/Popover/PopoverTrigger.svelte +12 -7
- package/dist/components/Popover/main.svelte.js +1 -1
- package/dist/components/Portal/Portal.svelte +14 -11
- package/dist/components/RadioGroup/RadioGroup.svelte +24 -20
- package/dist/components/RadioGroup/RadioGroupItem.svelte +27 -17
- package/dist/components/RadioGroup/main.svelte.d.ts +6 -5
- package/dist/components/RadioGroup/main.svelte.js +12 -6
- package/dist/components/RadioGroup/types.d.ts +18 -2
- package/dist/components/Select/Select.svelte +32 -28
- package/dist/components/Select/SelectArrow.svelte +8 -4
- package/dist/components/Select/SelectContent.svelte +19 -15
- package/dist/components/Select/SelectOption.svelte +30 -21
- package/dist/components/Select/SelectTrigger.svelte +13 -8
- package/dist/components/Select/SelectValue.svelte +14 -10
- package/dist/components/Select/main.svelte.d.ts +5 -4
- package/dist/components/Select/main.svelte.js +11 -7
- package/dist/components/Select/types.d.ts +17 -4
- package/dist/components/Slider/Slider.svelte +45 -35
- package/dist/components/Slider/SliderRange.svelte +9 -4
- package/dist/components/Slider/SliderThumb.svelte +12 -4
- package/dist/components/Slider/SliderValue.svelte +9 -4
- package/dist/components/Slider/main.svelte.d.ts +9 -8
- package/dist/components/Slider/main.svelte.js +16 -8
- package/dist/components/Slider/types.d.ts +35 -3
- package/dist/components/Switch/Switch.svelte +22 -17
- package/dist/components/Switch/types.d.ts +8 -2
- package/dist/components/Tabs/Tabs.svelte +20 -16
- package/dist/components/Tabs/TabsButton.svelte +28 -16
- package/dist/components/Tabs/TabsContent.svelte +11 -7
- package/dist/components/Tabs/TabsList.svelte +9 -5
- package/dist/components/Tabs/main.svelte.d.ts +5 -4
- package/dist/components/Tabs/main.svelte.js +9 -5
- package/dist/components/Tabs/types.d.ts +18 -2
- package/dist/components/Toast/Toast.svelte +9 -5
- package/dist/components/Toast/ToastMessage.svelte +9 -5
- package/dist/components/Toast/ToastTitle.svelte +9 -5
- package/dist/components/Toast/Toaster.svelte +15 -12
- package/dist/components/Toast/main.svelte.js +2 -2
- package/dist/internal/components/FloatingArrow.svelte +23 -12
- package/dist/internal/components/FloatingContent.svelte +46 -34
- package/dist/internal/helpers/context.svelte.js +1 -1
- package/dist/internal/helpers/utils.svelte.d.ts +1 -3
- package/dist/internal/helpers/utils.svelte.js +3 -5
- package/dist/internal/types.d.ts +1 -1
- package/package.json +77 -77
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useActions, classProp, stateValue } from '../../internal/index.js';
|
|
3
|
+
import type { AccordionProps } from './types.js';
|
|
4
|
+
import { createAccordionRootContext } from './main.svelte.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
use = [],
|
|
9
|
+
class: klass,
|
|
10
|
+
value = $bindable(),
|
|
11
|
+
self = $bindable(),
|
|
12
|
+
single = $bindable(false),
|
|
13
|
+
...props
|
|
14
|
+
}: AccordionProps = $props();
|
|
15
|
+
|
|
16
|
+
const ctx = createAccordionRootContext({
|
|
17
|
+
single: stateValue(() => single),
|
|
18
|
+
value: stateValue(() => value)
|
|
19
|
+
});
|
|
16
20
|
</script>
|
|
17
21
|
|
|
18
22
|
<div bind:this={self} use:useActions={use} class={classProp(klass)} {...ctx.attrs} {...props}>
|
|
19
|
-
{@render children({})}
|
|
23
|
+
{@render children?.({})}
|
|
20
24
|
</div>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useAccordionButton } from './main.svelte.js';
|
|
3
|
+
import { useActions, classProp } from '../../internal/index.js';
|
|
4
|
+
import type { AccordionButtonProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let { children, class: klass, use = [], self = $bindable(), onClick, ...props }: AccordionButtonProps = $props();
|
|
7
|
+
|
|
8
|
+
const ctx = useAccordionButton({
|
|
9
|
+
onClick
|
|
10
|
+
});
|
|
5
11
|
</script>
|
|
6
12
|
|
|
7
13
|
<button
|
|
@@ -12,5 +18,5 @@ const ctx = useAccordionButton();
|
|
|
12
18
|
{...ctx.attrs}
|
|
13
19
|
{...props}
|
|
14
20
|
>
|
|
15
|
-
{@render children(ctx.state)}
|
|
21
|
+
{@render children?.(ctx.state)}
|
|
16
22
|
</button>
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useAccordionContent } from './main.svelte.js';
|
|
3
|
+
import { useActions, getTransition, classProp } from '../../internal/index.js';
|
|
4
|
+
import type { AccordionContentProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let { children, class: klass, use = [], self = $bindable(), transition, ...props }: AccordionContentProps = $props();
|
|
7
|
+
|
|
8
|
+
const ctx = useAccordionContent();
|
|
9
|
+
|
|
10
|
+
const { inTransition, outTransition } = getTransition(transition);
|
|
11
|
+
const attrs = $derived({
|
|
12
|
+
...ctx.attrs,
|
|
13
|
+
class: classProp(klass)
|
|
14
|
+
} as const);
|
|
10
15
|
</script>
|
|
11
16
|
|
|
12
17
|
{#if inTransition && outTransition && ctx.item.Active}
|
|
13
18
|
{@const { config: inConf, transition: inFn } = inTransition}
|
|
14
19
|
{@const { config: outConf, transition: outFn } = outTransition}
|
|
15
20
|
<div bind:this={self} use:useActions={use} in:inFn={inConf} out:outFn={outConf} {...attrs} {...props}>
|
|
16
|
-
{@render children({})}
|
|
21
|
+
{@render children?.({})}
|
|
17
22
|
</div>
|
|
18
23
|
{:else if ctx.item.Active}
|
|
19
24
|
<div bind:this={self} use:useActions={use} {...attrs} {...props}>
|
|
20
|
-
{@render children({})}
|
|
25
|
+
{@render children?.({})}
|
|
21
26
|
</div>
|
|
22
27
|
{/if}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useAccordionHeading } from './main.svelte.js';
|
|
3
|
+
import { useActions, classProp } from '../../internal/index.js';
|
|
4
|
+
import type { AccordionHeadingProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let { children, class: klass, use = [], level = 3, self = $bindable(), ...props }: AccordionHeadingProps = $props();
|
|
7
|
+
|
|
8
|
+
const ctx = useAccordionHeading({ level });
|
|
5
9
|
</script>
|
|
6
10
|
|
|
7
11
|
<div bind:this={self} use:useActions={use} class={classProp(klass)} {...ctx.attrs} {...props}>
|
|
8
|
-
{@render children({})}
|
|
12
|
+
{@render children?.({})}
|
|
9
13
|
</div>
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createAccordionItemContext } from './main.svelte.js';
|
|
3
|
+
import { useActions, classProp, stateValue } from '../../internal/index.js';
|
|
4
|
+
|
|
5
|
+
import type { AccordionItemProps } from './types.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
class: klass,
|
|
10
|
+
use = [],
|
|
11
|
+
self = $bindable(),
|
|
12
|
+
disabled = $bindable(false),
|
|
13
|
+
...props
|
|
14
|
+
}: AccordionItemProps = $props();
|
|
15
|
+
|
|
16
|
+
const ctx = createAccordionItemContext({
|
|
17
|
+
disabled: stateValue(() => disabled)
|
|
18
|
+
});
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
<div bind:this={self} use:useActions={use} {...ctx.attrs} class={classProp(klass, ctx.state)} {...props}>
|
|
17
|
-
{@render children(ctx.state)}
|
|
22
|
+
{@render children?.(ctx.state)}
|
|
18
23
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type StateValues } from '../../internal/index.js';
|
|
1
|
+
import { type Handler, type StateValues } from '../../internal/index.js';
|
|
2
|
+
import type { AccordionButtonEvents } from './types.js';
|
|
2
3
|
interface Item {
|
|
3
4
|
id: string;
|
|
4
5
|
disabled: boolean;
|
|
@@ -56,7 +57,7 @@ declare class AccordionButton {
|
|
|
56
57
|
#private;
|
|
57
58
|
root: AccordionRoot;
|
|
58
59
|
item: AccordionItem;
|
|
59
|
-
constructor(item: AccordionItem, root: AccordionRoot);
|
|
60
|
+
constructor(item: AccordionItem, root: AccordionRoot, events: AccordionButtonEvents);
|
|
60
61
|
attrs: {
|
|
61
62
|
readonly 'aria-expanded': boolean;
|
|
62
63
|
readonly 'aria-disabled': boolean;
|
|
@@ -64,7 +65,7 @@ declare class AccordionButton {
|
|
|
64
65
|
readonly tabindex: 0 | -1;
|
|
65
66
|
readonly 'data-accordionbutton': "";
|
|
66
67
|
readonly 'data-active': true | undefined;
|
|
67
|
-
readonly onclick:
|
|
68
|
+
readonly onclick: Handler<MouseEvent, HTMLButtonElement> | undefined;
|
|
68
69
|
};
|
|
69
70
|
state: {
|
|
70
71
|
active: boolean;
|
|
@@ -88,6 +89,6 @@ declare class AccordionContent {
|
|
|
88
89
|
export declare const createAccordionRootContext: (props: AccordionRootProps) => AccordionRoot;
|
|
89
90
|
export declare const createAccordionItemContext: (props: AccordionItemProps) => AccordionItem;
|
|
90
91
|
export declare const useAccordionHeading: (props: AccordionHeadingProps) => AccordionHeading;
|
|
91
|
-
export declare const useAccordionButton: () => AccordionButton;
|
|
92
|
+
export declare const useAccordionButton: (events: AccordionButtonEvents) => AccordionButton;
|
|
92
93
|
export declare const useAccordionContent: () => AccordionContent;
|
|
93
94
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildContext, createUID } from '../../internal/index.js';
|
|
2
2
|
class AccordionRoot {
|
|
3
|
-
uid = createUID('accordion')
|
|
3
|
+
uid = createUID('accordion');
|
|
4
4
|
$value;
|
|
5
5
|
$single;
|
|
6
6
|
items = $state([]);
|
|
@@ -26,7 +26,7 @@ class AccordionRoot {
|
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
28
|
class AccordionItem {
|
|
29
|
-
uid = createUID('item')
|
|
29
|
+
uid = createUID('item');
|
|
30
30
|
root;
|
|
31
31
|
$disabled;
|
|
32
32
|
Active = $derived.by(() => this.root.activeItems.includes(this.uid()) || false);
|
|
@@ -63,13 +63,16 @@ class AccordionHeading {
|
|
|
63
63
|
class AccordionButton {
|
|
64
64
|
root;
|
|
65
65
|
item;
|
|
66
|
-
|
|
66
|
+
#events;
|
|
67
|
+
constructor(item, root, events) {
|
|
67
68
|
this.root = root;
|
|
68
69
|
this.item = item;
|
|
70
|
+
this.#events = events;
|
|
69
71
|
}
|
|
70
|
-
#handleClick = () => {
|
|
72
|
+
#handleClick = (e) => {
|
|
71
73
|
if (this.item.$disabled.val)
|
|
72
74
|
return;
|
|
75
|
+
this.#events.onClick?.(e);
|
|
73
76
|
this.root.toggleActiveItem(this.item.uid());
|
|
74
77
|
};
|
|
75
78
|
attrs = $derived.by(() => ({
|
|
@@ -118,8 +121,8 @@ export const createAccordionItemContext = (props) => {
|
|
|
118
121
|
export const useAccordionHeading = (props) => {
|
|
119
122
|
return rootContext.register(AccordionHeading, props);
|
|
120
123
|
};
|
|
121
|
-
export const useAccordionButton = () => {
|
|
122
|
-
return itemContext.register(AccordionButton, rootContext.getContext());
|
|
124
|
+
export const useAccordionButton = (events) => {
|
|
125
|
+
return itemContext.register(AccordionButton, rootContext.getContext(), events);
|
|
123
126
|
};
|
|
124
127
|
export const useAccordionContent = () => {
|
|
125
128
|
return itemContext.register(AccordionContent, rootContext.getContext());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Props, Transition } from '../../internal/index.js';
|
|
1
|
+
import type { Props, Handler, Transition } from '../../internal/index.js';
|
|
2
2
|
export interface AccordionProps extends Props<HTMLDivElement> {
|
|
3
3
|
/** The value of the active item. */
|
|
4
4
|
value?: string;
|
|
@@ -23,7 +23,16 @@ interface AccordionButtonState {
|
|
|
23
23
|
/** True if the item is disabled. */
|
|
24
24
|
disabled: boolean;
|
|
25
25
|
}
|
|
26
|
-
export interface
|
|
26
|
+
export interface AccordionButtonEvents {
|
|
27
|
+
/**
|
|
28
|
+
* Add your own custom logic to the click event.\
|
|
29
|
+
* Using the regular `onclick` event will overwrite the event used and cause the component to fail.
|
|
30
|
+
*
|
|
31
|
+
* Event will **NOT** be fired if the component is disabled.
|
|
32
|
+
*/
|
|
33
|
+
onClick?: Handler<MouseEvent, HTMLButtonElement>;
|
|
34
|
+
}
|
|
35
|
+
export interface AccordionButtonProps extends Props<HTMLButtonElement, AccordionButtonState>, AccordionButtonEvents {
|
|
27
36
|
}
|
|
28
37
|
interface AccordionItemState {
|
|
29
38
|
/** True if the item is opened. */
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useActions, classProp } from '../../internal/index.js';
|
|
3
|
+
import type { CheckboxProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
class: klass,
|
|
8
|
+
use = [],
|
|
9
|
+
self = $bindable(),
|
|
10
|
+
checked = $bindable(false),
|
|
11
|
+
required = false,
|
|
12
|
+
disabled = $bindable(false),
|
|
13
|
+
onClick,
|
|
14
|
+
...props
|
|
15
|
+
}: CheckboxProps = $props();
|
|
16
|
+
|
|
17
|
+
const handleClick: typeof onClick = (e) => {
|
|
18
|
+
if (disabled) return;
|
|
19
|
+
onClick?.(e);
|
|
20
|
+
|
|
21
|
+
checked = checked === 'mixed' ? true : !checked;
|
|
22
|
+
};
|
|
18
23
|
</script>
|
|
19
24
|
|
|
20
25
|
<button
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import type { Handler,
|
|
1
|
+
import type { Handler, Props } from '../../internal/index.js';
|
|
2
2
|
export type Checked = boolean | 'mixed';
|
|
3
3
|
interface CheckboxState {
|
|
4
4
|
/** If the checkbox is checked or not. */
|
|
5
5
|
checked: Checked;
|
|
6
6
|
}
|
|
7
|
-
export interface CheckboxProps extends
|
|
7
|
+
export interface CheckboxProps extends Props<HTMLButtonElement, CheckboxState> {
|
|
8
8
|
/** If the checkbox is checked or not. */
|
|
9
9
|
checked?: Checked;
|
|
10
10
|
/** Adds aria attributes. */
|
|
11
11
|
required?: boolean;
|
|
12
12
|
/** Disabled the checkbox, disallowing the internal events. */
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Add your own custom logic to the click event.\
|
|
16
|
+
* Using the regular `onclick` event will overwrite the event used and cause the component to fail.
|
|
17
|
+
*
|
|
18
|
+
* Event will **NOT** be fired if the component is disabled.
|
|
19
|
+
*/
|
|
14
20
|
onClick?: Handler<MouseEvent, HTMLButtonElement>;
|
|
15
21
|
}
|
|
16
22
|
export {};
|
|
@@ -1,47 +1,52 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useActions, classProp, stateValue } from '../../internal/index.js';
|
|
3
|
+
import { createRootContext } from './main.svelte.js';
|
|
4
|
+
import type { ComboboxProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
use = [],
|
|
9
|
+
class: klass,
|
|
10
|
+
value = $bindable(),
|
|
11
|
+
label = $bindable(),
|
|
12
|
+
touched = $bindable(false),
|
|
13
|
+
disabled = $bindable(false),
|
|
14
|
+
visible = $bindable(true),
|
|
15
|
+
controlled,
|
|
16
|
+
self = $bindable(),
|
|
17
|
+
onChange,
|
|
18
|
+
...props
|
|
19
|
+
}: ComboboxProps = $props();
|
|
20
|
+
|
|
21
|
+
const ctx = createRootContext({
|
|
22
|
+
value: stateValue(
|
|
23
|
+
() => value,
|
|
24
|
+
(v) => {
|
|
25
|
+
value = v;
|
|
26
|
+
onChange?.({ value: v });
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
disabled: stateValue(() => disabled),
|
|
30
|
+
label: stateValue(
|
|
31
|
+
() => label || self?.textContent?.trim() || '',
|
|
32
|
+
(v) => {
|
|
33
|
+
label = v;
|
|
34
|
+
onChange?.({ label: v });
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
multiple: stateValue(() => Array.isArray(value)),
|
|
38
|
+
touched: stateValue(
|
|
39
|
+
() => touched,
|
|
40
|
+
(v) => (touched = v)
|
|
41
|
+
),
|
|
42
|
+
visible: stateValue(
|
|
43
|
+
() => visible,
|
|
44
|
+
(v) => (visible = v)
|
|
45
|
+
),
|
|
46
|
+
controlled: stateValue(() => controlled)
|
|
47
|
+
});
|
|
43
48
|
</script>
|
|
44
49
|
|
|
45
50
|
<div bind:this={self} use:useActions={use} class={classProp(klass, ctx.state)} {...ctx.attrs} {...props}>
|
|
46
|
-
{@render children(ctx.state)}
|
|
51
|
+
{@render children?.(ctx.state)}
|
|
47
52
|
</div>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { FloatingArrow } from '../../internal/index.js';
|
|
3
|
+
import { useComboboxArrow } from './main.svelte.js';
|
|
4
|
+
import type { ComboboxArrowProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let { class: klass, use = [], self = $bindable(), ...props }: ComboboxArrowProps = $props();
|
|
7
|
+
|
|
8
|
+
const ctx = useComboboxArrow();
|
|
5
9
|
</script>
|
|
6
10
|
|
|
7
11
|
<FloatingArrow {ctx} component="Combobox" class={klass} {...props} />
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { FloatingContent } from '../../internal/index.js';
|
|
3
|
+
import { useComboboxContent } from './main.svelte.js';
|
|
4
|
+
import type { ComboboxContentProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
transition,
|
|
9
|
+
use = [],
|
|
10
|
+
portalTarget = 'body',
|
|
11
|
+
sameWidth = false,
|
|
12
|
+
class: klass,
|
|
13
|
+
self = $bindable(),
|
|
14
|
+
placement = 'bottom',
|
|
15
|
+
constrainViewport = false,
|
|
16
|
+
...props
|
|
17
|
+
}: ComboboxContentProps = $props();
|
|
18
|
+
|
|
19
|
+
const ctx = useComboboxContent();
|
|
16
20
|
</script>
|
|
17
21
|
|
|
18
22
|
<FloatingContent
|
|
19
23
|
{children}
|
|
20
24
|
componentName="Combobox"
|
|
21
|
-
visible={ctx.root
|
|
25
|
+
visible={ctx.root.SuperVisible}
|
|
22
26
|
{ctx}
|
|
23
27
|
{transition}
|
|
24
28
|
{use}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useActions, classProp } from '../../internal/index.js';
|
|
3
|
+
import { useComboboxInput } from './main.svelte.js';
|
|
4
|
+
import type { ComboboxInputProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
class: klass,
|
|
8
|
+
use = [],
|
|
9
|
+
value = $bindable(),
|
|
10
|
+
self = $bindable(),
|
|
11
|
+
onClick,
|
|
12
|
+
onKeydown,
|
|
13
|
+
...props
|
|
14
|
+
}: ComboboxInputProps = $props();
|
|
15
|
+
|
|
16
|
+
const ctx = useComboboxInput({ onClick, onKeydown });
|
|
17
|
+
|
|
18
|
+
$effect(() => {
|
|
19
|
+
if (self) ctx.registerTrigger(self);
|
|
20
|
+
});
|
|
8
21
|
</script>
|
|
9
22
|
|
|
10
23
|
<input bind:this={self} use:useActions={use} class={classProp(klass, ctx.state)} bind:value {...ctx.attrs} {...props} />
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useActions, classProp, stateValue } from '../../internal/index.js';
|
|
3
|
+
import { useComboboxOption } from './main.svelte.js';
|
|
4
|
+
import type { ComboboxElement, ComboboxOptionProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
class: klass,
|
|
9
|
+
use = [],
|
|
10
|
+
value,
|
|
11
|
+
label,
|
|
12
|
+
self = $bindable(),
|
|
13
|
+
disabled = $bindable(false),
|
|
14
|
+
onClick,
|
|
15
|
+
onMouseover,
|
|
16
|
+
...props
|
|
17
|
+
}: ComboboxOptionProps = $props();
|
|
18
|
+
let optionEl: ComboboxElement;
|
|
19
|
+
|
|
20
|
+
const ctx = useComboboxOption(
|
|
21
|
+
{
|
|
22
|
+
disabled: stateValue(() => disabled),
|
|
23
|
+
value: stateValue(() => value),
|
|
24
|
+
label: stateValue(() => label || self?.textContent?.trim() || '')
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
onClick,
|
|
28
|
+
onMouseover
|
|
29
|
+
}
|
|
30
|
+
);
|
|
22
31
|
</script>
|
|
23
32
|
|
|
24
33
|
<button
|
|
@@ -29,5 +38,5 @@ const ctx = useComboboxOption({
|
|
|
29
38
|
{...ctx.attrs}
|
|
30
39
|
{...props}
|
|
31
40
|
>
|
|
32
|
-
{@render children(ctx.state)}
|
|
41
|
+
{@render children?.(ctx.state)}
|
|
33
42
|
</button>
|