lithesome 0.15.2 → 0.16.1
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 +3 -3
- package/dist/components/Accordion/AccordionContent.svelte +3 -3
- package/dist/components/Accordion/main.svelte.d.ts +5 -9
- package/dist/components/Accordion/main.svelte.js +6 -0
- package/dist/components/Accordion/types.d.ts +24 -3
- package/dist/components/Checkbox/types.d.ts +5 -2
- package/dist/components/Collapsible/Collapsible.svelte +31 -0
- package/dist/components/Collapsible/Collapsible.svelte.d.ts +4 -0
- package/dist/components/Collapsible/CollapsibleButton.svelte +22 -0
- package/dist/components/Collapsible/CollapsibleButton.svelte.d.ts +4 -0
- package/dist/components/Collapsible/CollapsibleContent.svelte +34 -0
- package/dist/components/Collapsible/CollapsibleContent.svelte.d.ts +4 -0
- package/dist/components/Collapsible/index.d.ts +3 -0
- package/dist/components/Collapsible/index.js +3 -0
- package/dist/components/Collapsible/main.svelte.d.ts +46 -0
- package/dist/components/Collapsible/main.svelte.js +74 -0
- package/dist/components/Collapsible/types.d.ts +36 -0
- package/dist/components/Collapsible/types.js +1 -0
- package/dist/components/Combobox/ComboboxContent.svelte +1 -0
- package/dist/components/Combobox/main.svelte.d.ts +5 -14
- package/dist/components/Combobox/types.d.ts +27 -4
- package/dist/components/Hovercard/HovercardContent.svelte +6 -6
- package/dist/components/Hovercard/main.svelte.d.ts +4 -9
- package/dist/components/Hovercard/types.d.ts +5 -2
- package/dist/components/Menu/MenuContent.svelte +1 -0
- package/dist/components/Menu/main.svelte.d.ts +5 -13
- package/dist/components/Menu/types.d.ts +36 -4
- package/dist/components/Modal/main.svelte.d.ts +4 -8
- package/dist/components/Modal/main.svelte.js +0 -4
- package/dist/components/Pagination/Pagination.svelte +0 -0
- package/dist/components/Pagination/Pagination.svelte.d.ts +26 -0
- package/dist/components/Pagination/PaginationPrevButton.svelte +8 -0
- package/dist/components/Pagination/PaginationPrevButton.svelte.d.ts +4 -0
- package/dist/components/Pagination/main.svelte.d.ts +30 -0
- package/dist/components/Pagination/main.svelte.js +47 -0
- package/dist/components/Pagination/types.d.ts +29 -0
- package/dist/components/Pagination/types.js +1 -0
- package/dist/components/Pin/main.svelte.d.ts +17 -22
- package/dist/components/Pin/types.d.ts +10 -3
- package/dist/components/Popover/main.svelte.d.ts +5 -9
- package/dist/components/Popover/main.svelte.js +3 -0
- package/dist/components/Popover/types.d.ts +5 -2
- package/dist/components/RadioGroup/RadioGroup.svelte +6 -3
- package/dist/components/RadioGroup/main.svelte.d.ts +7 -6
- package/dist/components/RadioGroup/main.svelte.js +3 -0
- package/dist/components/RadioGroup/types.d.ts +13 -2
- package/dist/components/Select/main.svelte.d.ts +13 -23
- package/dist/components/Select/main.svelte.js +3 -0
- package/dist/components/Select/types.d.ts +16 -5
- package/dist/components/Slider/main.svelte.d.ts +34 -46
- package/dist/components/Slider/main.svelte.js +1 -1
- package/dist/components/Slider/types.d.ts +5 -2
- package/dist/components/Switch/types.d.ts +5 -2
- package/dist/components/Tabs/TabsList.svelte +2 -2
- package/dist/components/Tabs/main.svelte.d.ts +21 -26
- package/dist/components/Tabs/main.svelte.js +3 -0
- package/dist/components/Tabs/types.d.ts +18 -3
- package/dist/components/Tags/Tags.svelte +2 -2
- package/dist/components/Tags/main.svelte.d.ts +5 -7
- package/dist/components/Tags/main.svelte.js +4 -0
- package/dist/components/Tags/types.d.ts +19 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/components/FloatingArrow.svelte +2 -2
- package/dist/internal/components/FloatingArrow.svelte.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Floating, type CalcIndexAction, type Handler, type StateValues } from '../../internal/index.js';
|
|
2
|
-
import type { MenuItemEvents } from './types.js';
|
|
2
|
+
import type { MenuContentState, MenuItemEvents, MenuItemState, MenuState, MenuTriggerState } from './types.js';
|
|
3
3
|
type MenuRootProps = StateValues<{
|
|
4
4
|
visible: boolean;
|
|
5
5
|
}>;
|
|
@@ -22,9 +22,7 @@ declare class MenuRoot extends Floating {
|
|
|
22
22
|
readonly 'data-menu': "";
|
|
23
23
|
readonly 'data-state': "opened" | "closed";
|
|
24
24
|
};
|
|
25
|
-
state:
|
|
26
|
-
visible: boolean;
|
|
27
|
-
};
|
|
25
|
+
state: MenuState;
|
|
28
26
|
}
|
|
29
27
|
declare class MenuTrigger {
|
|
30
28
|
#private;
|
|
@@ -34,9 +32,7 @@ declare class MenuTrigger {
|
|
|
34
32
|
attrs: {
|
|
35
33
|
'data-menutrigger': string;
|
|
36
34
|
};
|
|
37
|
-
state:
|
|
38
|
-
visible: boolean;
|
|
39
|
-
};
|
|
35
|
+
state: MenuTriggerState;
|
|
40
36
|
}
|
|
41
37
|
declare class MenuArrow {
|
|
42
38
|
root: MenuRoot;
|
|
@@ -48,9 +44,7 @@ declare class MenuArrow {
|
|
|
48
44
|
declare class MenuContent {
|
|
49
45
|
root: MenuRoot;
|
|
50
46
|
constructor(root: MenuRoot);
|
|
51
|
-
state:
|
|
52
|
-
visible: boolean;
|
|
53
|
-
};
|
|
47
|
+
state: MenuContentState;
|
|
54
48
|
}
|
|
55
49
|
type MenuItemProps = StateValues<{
|
|
56
50
|
disabled: boolean;
|
|
@@ -72,9 +66,7 @@ declare class MenuItem {
|
|
|
72
66
|
readonly onmouseover: Handler<MouseEvent, HTMLButtonElement | HTMLAnchorElement> | undefined;
|
|
73
67
|
readonly onclick: Handler<MouseEvent, HTMLButtonElement | HTMLAnchorElement> | undefined;
|
|
74
68
|
};
|
|
75
|
-
state:
|
|
76
|
-
hovered: boolean;
|
|
77
|
-
};
|
|
69
|
+
state: MenuItemState;
|
|
78
70
|
}
|
|
79
71
|
export declare const createRootContext: (props: MenuRootProps) => MenuRoot;
|
|
80
72
|
export declare const useMenuTrigger: () => MenuTrigger;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Props, PropsNoChildren, ContentProps, Handler } from '../../internal/index.js';
|
|
2
2
|
type MenuItemElement = HTMLButtonElement | HTMLAnchorElement;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The state that is exposed from the `Menu` component.\
|
|
5
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
6
|
+
*/
|
|
7
|
+
export interface MenuState {
|
|
4
8
|
/** Whether or not the content is opened or not. */
|
|
5
9
|
visible: boolean;
|
|
6
10
|
}
|
|
@@ -14,11 +18,31 @@ export interface MenuProps extends Props<HTMLDivElement, MenuState> {
|
|
|
14
18
|
*/
|
|
15
19
|
delay?: number | [number, number];
|
|
16
20
|
}
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The state that is exposed from the `MenuArrow` component.\
|
|
23
|
+
* Which can be used via the `class` prop.
|
|
24
|
+
*/
|
|
25
|
+
export interface MenuArrowState {
|
|
26
|
+
/** Whether or not the content is opened or not. */
|
|
27
|
+
visible: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface MenuArrowProps extends PropsNoChildren<HTMLDivElement, MenuArrowState> {
|
|
18
30
|
}
|
|
19
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The state that is exposed from the `MenuContent` component.\
|
|
33
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
34
|
+
*/
|
|
35
|
+
export interface MenuContentState {
|
|
36
|
+
/** Whether or not the content is opened or not. */
|
|
37
|
+
visible: boolean;
|
|
20
38
|
}
|
|
21
|
-
interface
|
|
39
|
+
export interface MenuContentProps extends Props<HTMLDivElement, MenuContentState>, ContentProps {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The state that is exposed from the `MenuItem` component.\
|
|
43
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
44
|
+
*/
|
|
45
|
+
export interface MenuItemState {
|
|
22
46
|
/** True if the option is hovered, via mouse or keyboard navigation. */
|
|
23
47
|
hovered: boolean;
|
|
24
48
|
}
|
|
@@ -44,6 +68,14 @@ export interface MenuItemProps extends Props<MenuItemElement, MenuItemState>, Me
|
|
|
44
68
|
/** Disables the item, disallowing the clicking and keyboard navigation. */
|
|
45
69
|
disabled?: boolean;
|
|
46
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* The state that is exposed from the `MenuTrigger` component.\
|
|
73
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
74
|
+
*/
|
|
75
|
+
export interface MenuTriggerState {
|
|
76
|
+
/** Whether or not the content is opened or not. */
|
|
77
|
+
visible: boolean;
|
|
78
|
+
}
|
|
47
79
|
export interface MenuTriggerProps extends Props<HTMLDivElement, MenuState> {
|
|
48
80
|
}
|
|
49
81
|
export {};
|
|
@@ -9,10 +9,6 @@ declare class ModalRoot {
|
|
|
9
9
|
$visible: ModalRootProps['visible'];
|
|
10
10
|
$portalTarget: ModalRootProps['portalTarget'];
|
|
11
11
|
constructor(props: ModalRootProps);
|
|
12
|
-
attrs: {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly 'data-modal': "";
|
|
15
|
-
};
|
|
16
12
|
}
|
|
17
13
|
declare class ModalOverlay {
|
|
18
14
|
root: ModalRoot;
|
|
@@ -42,16 +38,16 @@ declare class ModalTitle {
|
|
|
42
38
|
root: ModalRoot;
|
|
43
39
|
constructor(root: ModalRoot);
|
|
44
40
|
attrs: {
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
id: string;
|
|
42
|
+
'data-modaltitle': string;
|
|
47
43
|
};
|
|
48
44
|
}
|
|
49
45
|
declare class ModalDescription {
|
|
50
46
|
root: ModalRoot;
|
|
51
47
|
constructor(root: ModalRoot);
|
|
52
48
|
attrs: {
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
id: string;
|
|
50
|
+
'data-modaldescription': string;
|
|
55
51
|
};
|
|
56
52
|
}
|
|
57
53
|
export declare const createRootContext: (props: ModalRootProps) => ModalRoot;
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Pagination;
|
|
2
|
+
type Pagination = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Pagination: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { usePaginationPrev } from './main.svelte.js';
|
|
3
|
+
import type { PaginationPrevButtonProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let { children, class: klass, self = $bindable(), use = [], onClick }: PaginationPrevButtonProps = $props();
|
|
6
|
+
|
|
7
|
+
const ctx = usePaginationPrev({ onClick });
|
|
8
|
+
</script>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PaginationPrevButtonProps } from './types.js';
|
|
2
|
+
declare const PaginationPrevButton: import("svelte").Component<PaginationPrevButtonProps, {}, "self">;
|
|
3
|
+
type PaginationPrevButton = ReturnType<typeof PaginationPrevButton>;
|
|
4
|
+
export default PaginationPrevButton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type StateValues } from '../../internal/index.js';
|
|
2
|
+
import type { PaginationPrevButtonEvents } from './types.js';
|
|
3
|
+
type PaginationRootProps = StateValues<{
|
|
4
|
+
itemsCount: number;
|
|
5
|
+
itemsPerPage: number;
|
|
6
|
+
siblingCount: number;
|
|
7
|
+
currentPage: number;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
declare class PaginationRoot {
|
|
11
|
+
uid: (component?: string) => string;
|
|
12
|
+
$itemsCount: PaginationRootProps['itemsCount'];
|
|
13
|
+
$itemsPerPage: PaginationRootProps['itemsPerPage'];
|
|
14
|
+
$siblingCount: PaginationRootProps['siblingCount'];
|
|
15
|
+
$currentPage: PaginationRootProps['currentPage'];
|
|
16
|
+
$disabled: PaginationRootProps['disabled'];
|
|
17
|
+
constructor(props: PaginationRootProps);
|
|
18
|
+
}
|
|
19
|
+
declare class PaginationPrevPage {
|
|
20
|
+
#private;
|
|
21
|
+
root: PaginationRoot;
|
|
22
|
+
constructor(root: PaginationRoot, events: PaginationPrevButtonEvents);
|
|
23
|
+
attrs: {
|
|
24
|
+
'data-paginationprevbutton': string;
|
|
25
|
+
onclick: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const createPaginationContext: (props: PaginationRootProps) => PaginationRoot;
|
|
29
|
+
export declare const usePaginationPrev: (events: PaginationPrevButtonEvents) => PaginationPrevPage;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { buildContext, createUID } from '../../internal/index.js';
|
|
2
|
+
class PaginationRoot {
|
|
3
|
+
uid = createUID('pagination');
|
|
4
|
+
$itemsCount;
|
|
5
|
+
$itemsPerPage;
|
|
6
|
+
$siblingCount;
|
|
7
|
+
$currentPage;
|
|
8
|
+
$disabled;
|
|
9
|
+
constructor(props) {
|
|
10
|
+
this.$itemsCount = props.itemsCount;
|
|
11
|
+
this.$itemsPerPage = props.itemsPerPage;
|
|
12
|
+
this.$siblingCount = props.siblingCount;
|
|
13
|
+
this.$currentPage = props.currentPage;
|
|
14
|
+
this.$disabled = props.disabled;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//
|
|
18
|
+
// Prev page
|
|
19
|
+
//
|
|
20
|
+
class PaginationPrevPage {
|
|
21
|
+
root;
|
|
22
|
+
#events;
|
|
23
|
+
constructor(root, events) {
|
|
24
|
+
this.root = root;
|
|
25
|
+
this.#events = events;
|
|
26
|
+
}
|
|
27
|
+
#handleClick = (e) => {
|
|
28
|
+
if (this.root.$disabled.val)
|
|
29
|
+
return;
|
|
30
|
+
this.#events.onClick?.(e);
|
|
31
|
+
this.root.$currentPage.val -= 1;
|
|
32
|
+
};
|
|
33
|
+
attrs = $derived.by(() => ({
|
|
34
|
+
'data-paginationprevbutton': '',
|
|
35
|
+
onclick: this.#handleClick
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
//
|
|
39
|
+
// Builders
|
|
40
|
+
//
|
|
41
|
+
const rootContext = buildContext(PaginationRoot);
|
|
42
|
+
export const createPaginationContext = (props) => {
|
|
43
|
+
return rootContext.createContext(props);
|
|
44
|
+
};
|
|
45
|
+
export const usePaginationPrev = (events) => {
|
|
46
|
+
return rootContext.register(PaginationPrevPage, events);
|
|
47
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Handler, Props } from '../../internal/index.js';
|
|
2
|
+
export type PaginationProps = Props<HTMLElement> & {
|
|
3
|
+
itemsCount: number;
|
|
4
|
+
itemsPerPage?: number;
|
|
5
|
+
siblingCount?: number;
|
|
6
|
+
currentPage?: number;
|
|
7
|
+
onPageChange?: (pageNumber: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export type PaginationPageButton = Props<HTMLButtonElement>;
|
|
10
|
+
export type PaginationPrevButtonEvents = {
|
|
11
|
+
/**
|
|
12
|
+
* Add your own custom logic to the click event.\
|
|
13
|
+
* Using the regular `onclick` event will overwrite the event used and cause the component to fail.
|
|
14
|
+
*
|
|
15
|
+
* Event will **NOT** be fired if the component is disabled.
|
|
16
|
+
*/
|
|
17
|
+
onClick?: Handler<MouseEvent, HTMLButtonElement>;
|
|
18
|
+
};
|
|
19
|
+
export type PaginationPrevButtonProps = Props<HTMLButtonElement> & PaginationPrevButtonEvents;
|
|
20
|
+
export type PaginationNextButtonEvents = {
|
|
21
|
+
/**
|
|
22
|
+
* Add your own custom logic to the click event.\
|
|
23
|
+
* Using the regular `onclick` event will overwrite the event used and cause the component to fail.
|
|
24
|
+
*
|
|
25
|
+
* Event will **NOT** be fired if the component is disabled.
|
|
26
|
+
*/
|
|
27
|
+
onClick?: Handler<MouseEvent, HTMLButtonElement>;
|
|
28
|
+
};
|
|
29
|
+
export type PaginationNextButtonProps = Props<HTMLButtonElement> & PaginationNextButtonEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StateValues, type Handler } from '../../internal/index.js';
|
|
2
|
-
import type { PinInputEvents, PinType } from './types.js';
|
|
2
|
+
import type { PinInputEvents, PinInputState, PinState, PinType } from './types.js';
|
|
3
3
|
type PinRootProps = StateValues<{
|
|
4
4
|
value: string[];
|
|
5
5
|
disabled: boolean;
|
|
@@ -18,15 +18,13 @@ declare class PinRoot {
|
|
|
18
18
|
constructor(props: PinRootProps);
|
|
19
19
|
setValue(index: number, value: string): void;
|
|
20
20
|
attrs: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
state: {
|
|
28
|
-
filled: boolean;
|
|
21
|
+
id: string;
|
|
22
|
+
'aria-disabled': true | undefined;
|
|
23
|
+
'data-pin': string;
|
|
24
|
+
'data-filled': boolean;
|
|
25
|
+
'data-disabled': true | undefined;
|
|
29
26
|
};
|
|
27
|
+
state: PinState;
|
|
30
28
|
}
|
|
31
29
|
declare class PinInput {
|
|
32
30
|
#private;
|
|
@@ -37,21 +35,18 @@ declare class PinInput {
|
|
|
37
35
|
value: string;
|
|
38
36
|
constructor(root: PinRoot, events: PinInputEvents);
|
|
39
37
|
attrs: {
|
|
40
|
-
|
|
41
|
-
readonly disabled: boolean;
|
|
42
|
-
readonly placeholder: string;
|
|
43
|
-
readonly 'data-pininput': "";
|
|
44
|
-
readonly 'data-filled': boolean;
|
|
45
|
-
readonly oninput: Handler<Event, HTMLInputElement> | undefined;
|
|
46
|
-
readonly onkeydown: Handler<KeyboardEvent, HTMLInputElement> | undefined;
|
|
47
|
-
readonly onfocus: Handler<FocusEvent, HTMLInputElement> | undefined;
|
|
48
|
-
readonly onblur: Handler<FocusEvent, HTMLInputElement> | undefined;
|
|
49
|
-
readonly onpaste: Handler<ClipboardEvent, HTMLInputElement> | undefined;
|
|
50
|
-
};
|
|
51
|
-
state: {
|
|
52
|
-
filled: boolean;
|
|
38
|
+
id: string;
|
|
53
39
|
disabled: boolean;
|
|
40
|
+
placeholder: string;
|
|
41
|
+
'data-pininput': string;
|
|
42
|
+
'data-filled': boolean;
|
|
43
|
+
oninput: Handler<Event, HTMLInputElement> | undefined;
|
|
44
|
+
onkeydown: Handler<KeyboardEvent, HTMLInputElement> | undefined;
|
|
45
|
+
onfocus: Handler<FocusEvent, HTMLInputElement> | undefined;
|
|
46
|
+
onblur: Handler<FocusEvent, HTMLInputElement> | undefined;
|
|
47
|
+
onpaste: Handler<ClipboardEvent, HTMLInputElement> | undefined;
|
|
54
48
|
};
|
|
49
|
+
state: PinInputState;
|
|
55
50
|
}
|
|
56
51
|
declare class PinValue {
|
|
57
52
|
root: PinRoot;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Props, PropsNoChildren, Handler } from '../../internal/index.js';
|
|
2
2
|
export type PinType = 'text' | 'password';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The state that is exposed from the `Pin` component.\
|
|
5
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
6
|
+
*/
|
|
7
|
+
export interface PinState {
|
|
4
8
|
/** True if all inputs are filled out. */
|
|
5
9
|
filled: boolean;
|
|
6
10
|
}
|
|
@@ -20,7 +24,11 @@ export interface PinProps extends Props<HTMLDivElement, PinState> {
|
|
|
20
24
|
onChange?: (value: string) => void;
|
|
21
25
|
onFilled?: (value: string) => void;
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The state that is exposed from the `PinInput` component.\
|
|
29
|
+
* Which can be used via the `class` prop function.
|
|
30
|
+
*/
|
|
31
|
+
export interface PinInputState extends PinState {
|
|
24
32
|
/** If the input is disabled by the `Pin` parent component. */
|
|
25
33
|
disabled: boolean;
|
|
26
34
|
}
|
|
@@ -71,4 +79,3 @@ export interface PinValueProps extends PropsNoChildren<HTMLInputElement> {
|
|
|
71
79
|
*/
|
|
72
80
|
name?: string;
|
|
73
81
|
}
|
|
74
|
-
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Floating, type StateValues } from '../../internal/index.js';
|
|
2
|
+
import type { PopoverState } from './types.js';
|
|
2
3
|
type PopoverRootProps = StateValues<{
|
|
3
4
|
visible: boolean;
|
|
4
5
|
}>;
|
|
@@ -14,9 +15,7 @@ declare class PopoverRoot extends Floating {
|
|
|
14
15
|
readonly 'data-popover': "";
|
|
15
16
|
readonly 'data-state': "opened" | "closed";
|
|
16
17
|
};
|
|
17
|
-
state:
|
|
18
|
-
visible: boolean;
|
|
19
|
-
};
|
|
18
|
+
state: PopoverState;
|
|
20
19
|
}
|
|
21
20
|
declare class PopoverTrigger {
|
|
22
21
|
#private;
|
|
@@ -26,9 +25,7 @@ declare class PopoverTrigger {
|
|
|
26
25
|
attrs: {
|
|
27
26
|
'data-popovertrigger': string;
|
|
28
27
|
};
|
|
29
|
-
state:
|
|
30
|
-
visible: boolean;
|
|
31
|
-
};
|
|
28
|
+
state: PopoverState;
|
|
32
29
|
}
|
|
33
30
|
declare class PopoverArrow {
|
|
34
31
|
root: PopoverRoot;
|
|
@@ -36,13 +33,12 @@ declare class PopoverArrow {
|
|
|
36
33
|
attrs: {
|
|
37
34
|
id: string;
|
|
38
35
|
};
|
|
36
|
+
state: PopoverState;
|
|
39
37
|
}
|
|
40
38
|
declare class PopoverContent {
|
|
41
39
|
root: PopoverRoot;
|
|
42
40
|
constructor(root: PopoverRoot);
|
|
43
|
-
state:
|
|
44
|
-
visible: boolean;
|
|
45
|
-
};
|
|
41
|
+
state: PopoverState;
|
|
46
42
|
}
|
|
47
43
|
export declare const createRootContext: (props: PopoverRootProps) => PopoverRoot;
|
|
48
44
|
export declare const usePopoverTrigger: () => PopoverTrigger;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Props, PropsNoChildren, ContentProps } from '../../internal/index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The state that is exposed from the `Popover` components.\
|
|
4
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
5
|
+
*/
|
|
6
|
+
export interface PopoverState {
|
|
3
7
|
/** Whether or not the content is opened or not. */
|
|
4
8
|
visible: boolean;
|
|
5
9
|
}
|
|
@@ -13,4 +17,3 @@ export interface PopoverContentProps extends Props<HTMLDivElement, PopoverState>
|
|
|
13
17
|
}
|
|
14
18
|
export interface PopoverTriggerProps extends Props<HTMLDivElement, PopoverState> {
|
|
15
19
|
}
|
|
16
|
-
export {};
|
|
@@ -17,12 +17,15 @@
|
|
|
17
17
|
const ctx = createRootContext({
|
|
18
18
|
value: stateValue(
|
|
19
19
|
() => value,
|
|
20
|
-
(v) =>
|
|
20
|
+
(v) => {
|
|
21
|
+
value = v;
|
|
22
|
+
onChange?.(v);
|
|
23
|
+
}
|
|
21
24
|
),
|
|
22
25
|
required: stateValue(() => required)
|
|
23
26
|
});
|
|
24
27
|
</script>
|
|
25
28
|
|
|
26
|
-
<div bind:this={self} use:useActions={use} class={classProp(klass)} {...ctx.attrs} {...props}>
|
|
27
|
-
{@render children?.(
|
|
29
|
+
<div bind:this={self} use:useActions={use} class={classProp(klass, ctx.state)} {...ctx.attrs} {...props}>
|
|
30
|
+
{@render children?.(ctx.state)}
|
|
28
31
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CalcIndexAction, type StateValues, type UID } from '../../internal/index.js';
|
|
2
|
-
import type { RadioGroupItemEvents } from './types.js';
|
|
2
|
+
import type { RadioGroupItemEvents, RadioGroupState } from './types.js';
|
|
3
3
|
interface Item {
|
|
4
4
|
id: string;
|
|
5
5
|
value: string;
|
|
@@ -21,12 +21,13 @@ declare class RadioGroupRoot {
|
|
|
21
21
|
navigate: (action: CalcIndexAction) => void;
|
|
22
22
|
setSelected: (item: Item) => void;
|
|
23
23
|
attrs: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
id: string;
|
|
25
|
+
role: string;
|
|
26
|
+
'aria-required': boolean;
|
|
27
|
+
'data-radiogroup': string;
|
|
28
|
+
'data-value': string;
|
|
29
29
|
};
|
|
30
|
+
state: RadioGroupState;
|
|
30
31
|
}
|
|
31
32
|
type RadioGroupItemProps = StateValues<{
|
|
32
33
|
value: string;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { Handler, Props } from '../../internal/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The state that is exposed from the `RadioGroup` component.\
|
|
4
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
5
|
+
*/
|
|
6
|
+
export interface RadioGroupState {
|
|
7
|
+
/** The current selected value. */
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
2
10
|
export interface RadioGroupProps extends Props<HTMLDivElement> {
|
|
3
11
|
/** The value of the radiogroup. */
|
|
4
12
|
value?: string;
|
|
@@ -6,7 +14,11 @@ export interface RadioGroupProps extends Props<HTMLDivElement> {
|
|
|
6
14
|
required?: boolean;
|
|
7
15
|
onChange?: (value: string) => void;
|
|
8
16
|
}
|
|
9
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The state that is exposed from the `RadioGroupItem` component.\
|
|
19
|
+
* Which can be used via the `class` prop function or `children` snippet block.
|
|
20
|
+
*/
|
|
21
|
+
export interface RadioGroupItemState {
|
|
10
22
|
/** True if the item is selected. */
|
|
11
23
|
checked: boolean;
|
|
12
24
|
}
|
|
@@ -32,4 +44,3 @@ export interface RadioGroupItemProps extends Props<HTMLButtonElement, RadioGroup
|
|
|
32
44
|
/** Disable the item, disallowing clicking and keyboard navigation. */
|
|
33
45
|
disabled?: boolean;
|
|
34
46
|
}
|
|
35
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Floating, type CalcIndexAction, type JsonValue, type StateValues } from '../../internal/index.js';
|
|
2
|
-
import type { SelectOptionEvents } from './types.js';
|
|
2
|
+
import type { SelectOptionEvents, SelectOptionState, SelectState, SelectValueState } from './types.js';
|
|
3
3
|
type SelectRootProps = StateValues<{
|
|
4
4
|
multiple: boolean;
|
|
5
5
|
visible: boolean;
|
|
@@ -28,13 +28,11 @@ declare class SelectRoot extends Floating {
|
|
|
28
28
|
setSelected: () => void;
|
|
29
29
|
setInitialSelected: (value: JsonValue) => void;
|
|
30
30
|
attrs: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
state: {
|
|
36
|
-
visible: boolean;
|
|
31
|
+
id: string;
|
|
32
|
+
'data-select': string;
|
|
33
|
+
'data-state': string;
|
|
37
34
|
};
|
|
35
|
+
state: SelectState;
|
|
38
36
|
}
|
|
39
37
|
declare class SelectTrigger {
|
|
40
38
|
#private;
|
|
@@ -44,9 +42,7 @@ declare class SelectTrigger {
|
|
|
44
42
|
attrs: {
|
|
45
43
|
'data-selecttrigger': string;
|
|
46
44
|
};
|
|
47
|
-
state:
|
|
48
|
-
visible: boolean;
|
|
49
|
-
};
|
|
45
|
+
state: SelectState;
|
|
50
46
|
}
|
|
51
47
|
declare class SelectArrow {
|
|
52
48
|
root: SelectRoot;
|
|
@@ -54,6 +50,7 @@ declare class SelectArrow {
|
|
|
54
50
|
attrs: {
|
|
55
51
|
id: string;
|
|
56
52
|
};
|
|
53
|
+
state: SelectState;
|
|
57
54
|
}
|
|
58
55
|
declare class SelectContent {
|
|
59
56
|
root: SelectRoot;
|
|
@@ -61,9 +58,7 @@ declare class SelectContent {
|
|
|
61
58
|
attrs: {
|
|
62
59
|
hidden: true | undefined;
|
|
63
60
|
};
|
|
64
|
-
state:
|
|
65
|
-
visible: boolean;
|
|
66
|
-
};
|
|
61
|
+
state: SelectState;
|
|
67
62
|
}
|
|
68
63
|
type SelectOptionProps = StateValues<{
|
|
69
64
|
value: JsonValue;
|
|
@@ -95,10 +90,7 @@ declare class SelectOption {
|
|
|
95
90
|
readonly onmouseover: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
|
|
96
91
|
readonly onclick: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
|
|
97
92
|
};
|
|
98
|
-
state:
|
|
99
|
-
hovered: boolean;
|
|
100
|
-
selected: boolean;
|
|
101
|
-
};
|
|
93
|
+
state: SelectOptionState;
|
|
102
94
|
}
|
|
103
95
|
type SelectValueProps = StateValues<{
|
|
104
96
|
placeholder: string;
|
|
@@ -110,13 +102,11 @@ declare class SelectValue {
|
|
|
110
102
|
constructor(root: SelectRoot, props: SelectValueProps);
|
|
111
103
|
label: string;
|
|
112
104
|
attrs: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
117
|
-
state: {
|
|
118
|
-
placeholderVisible: boolean;
|
|
105
|
+
id: string;
|
|
106
|
+
'data-selectvalue': string;
|
|
107
|
+
'data-placeholder': true | undefined;
|
|
119
108
|
};
|
|
109
|
+
state: SelectValueState;
|
|
120
110
|
}
|
|
121
111
|
export declare const createRootContext: (props: SelectRootProps) => SelectRoot;
|
|
122
112
|
export declare const useSelectTrigger: () => SelectTrigger;
|