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.
Files changed (66) hide show
  1. package/dist/components/Accordion/Accordion.svelte +3 -3
  2. package/dist/components/Accordion/AccordionContent.svelte +3 -3
  3. package/dist/components/Accordion/main.svelte.d.ts +5 -9
  4. package/dist/components/Accordion/main.svelte.js +6 -0
  5. package/dist/components/Accordion/types.d.ts +24 -3
  6. package/dist/components/Checkbox/types.d.ts +5 -2
  7. package/dist/components/Collapsible/Collapsible.svelte +31 -0
  8. package/dist/components/Collapsible/Collapsible.svelte.d.ts +4 -0
  9. package/dist/components/Collapsible/CollapsibleButton.svelte +22 -0
  10. package/dist/components/Collapsible/CollapsibleButton.svelte.d.ts +4 -0
  11. package/dist/components/Collapsible/CollapsibleContent.svelte +34 -0
  12. package/dist/components/Collapsible/CollapsibleContent.svelte.d.ts +4 -0
  13. package/dist/components/Collapsible/index.d.ts +3 -0
  14. package/dist/components/Collapsible/index.js +3 -0
  15. package/dist/components/Collapsible/main.svelte.d.ts +46 -0
  16. package/dist/components/Collapsible/main.svelte.js +74 -0
  17. package/dist/components/Collapsible/types.d.ts +36 -0
  18. package/dist/components/Collapsible/types.js +1 -0
  19. package/dist/components/Combobox/ComboboxContent.svelte +1 -0
  20. package/dist/components/Combobox/main.svelte.d.ts +5 -14
  21. package/dist/components/Combobox/types.d.ts +27 -4
  22. package/dist/components/Hovercard/HovercardContent.svelte +6 -6
  23. package/dist/components/Hovercard/main.svelte.d.ts +4 -9
  24. package/dist/components/Hovercard/types.d.ts +5 -2
  25. package/dist/components/Menu/MenuContent.svelte +1 -0
  26. package/dist/components/Menu/main.svelte.d.ts +5 -13
  27. package/dist/components/Menu/types.d.ts +36 -4
  28. package/dist/components/Modal/main.svelte.d.ts +4 -8
  29. package/dist/components/Modal/main.svelte.js +0 -4
  30. package/dist/components/Pagination/Pagination.svelte +0 -0
  31. package/dist/components/Pagination/Pagination.svelte.d.ts +26 -0
  32. package/dist/components/Pagination/PaginationPrevButton.svelte +8 -0
  33. package/dist/components/Pagination/PaginationPrevButton.svelte.d.ts +4 -0
  34. package/dist/components/Pagination/main.svelte.d.ts +30 -0
  35. package/dist/components/Pagination/main.svelte.js +47 -0
  36. package/dist/components/Pagination/types.d.ts +29 -0
  37. package/dist/components/Pagination/types.js +1 -0
  38. package/dist/components/Pin/main.svelte.d.ts +17 -22
  39. package/dist/components/Pin/types.d.ts +10 -3
  40. package/dist/components/Popover/main.svelte.d.ts +5 -9
  41. package/dist/components/Popover/main.svelte.js +3 -0
  42. package/dist/components/Popover/types.d.ts +5 -2
  43. package/dist/components/RadioGroup/RadioGroup.svelte +6 -3
  44. package/dist/components/RadioGroup/main.svelte.d.ts +7 -6
  45. package/dist/components/RadioGroup/main.svelte.js +3 -0
  46. package/dist/components/RadioGroup/types.d.ts +13 -2
  47. package/dist/components/Select/main.svelte.d.ts +13 -23
  48. package/dist/components/Select/main.svelte.js +3 -0
  49. package/dist/components/Select/types.d.ts +16 -5
  50. package/dist/components/Slider/main.svelte.d.ts +34 -46
  51. package/dist/components/Slider/main.svelte.js +1 -1
  52. package/dist/components/Slider/types.d.ts +5 -2
  53. package/dist/components/Switch/types.d.ts +5 -2
  54. package/dist/components/Tabs/TabsList.svelte +2 -2
  55. package/dist/components/Tabs/main.svelte.d.ts +21 -26
  56. package/dist/components/Tabs/main.svelte.js +3 -0
  57. package/dist/components/Tabs/types.d.ts +18 -3
  58. package/dist/components/Tags/Tags.svelte +2 -2
  59. package/dist/components/Tags/main.svelte.d.ts +5 -7
  60. package/dist/components/Tags/main.svelte.js +4 -0
  61. package/dist/components/Tags/types.d.ts +19 -4
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.js +1 -0
  64. package/dist/internal/components/FloatingArrow.svelte +2 -2
  65. package/dist/internal/components/FloatingArrow.svelte.d.ts +1 -1
  66. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { useActions, classProp, stateValue } from '../../internal/index.js';
3
- import type { AccordionProps } from './types.js';
4
3
  import { createAccordionRootContext } from './main.svelte.js';
4
+ import type { AccordionProps } from './types.js';
5
5
 
6
6
  let {
7
7
  children,
@@ -26,6 +26,6 @@
26
26
  });
27
27
  </script>
28
28
 
29
- <div bind:this={self} use:useActions={use} class={classProp(klass)} {...ctx.attrs} {...props}>
30
- {@render children?.({})}
29
+ <div bind:this={self} use:useActions={use} class={classProp(klass, ctx.state)} {...ctx.attrs} {...props}>
30
+ {@render children?.(ctx.state)}
31
31
  </div>
@@ -10,7 +10,7 @@
10
10
  const { inTransition, outTransition } = getTransition(transition);
11
11
  const attrs = $derived({
12
12
  ...ctx.attrs,
13
- class: classProp(klass)
13
+ class: classProp(klass, ctx.state)
14
14
  } as const);
15
15
  </script>
16
16
 
@@ -18,10 +18,10 @@
18
18
  {@const { config: inConf, transition: inFn } = inTransition}
19
19
  {@const { config: outConf, transition: outFn } = outTransition}
20
20
  <div bind:this={self} use:useActions={use} in:inFn={inConf} out:outFn={outConf} {...attrs} {...props}>
21
- {@render children?.({})}
21
+ {@render children?.(ctx.state)}
22
22
  </div>
23
23
  {:else if ctx.item.Active}
24
24
  <div bind:this={self} use:useActions={use} {...attrs} {...props}>
25
- {@render children?.({})}
25
+ {@render children?.(ctx.state)}
26
26
  </div>
27
27
  {/if}
@@ -1,5 +1,5 @@
1
1
  import { type StateValues } from '../../internal/index.js';
2
- import type { AccordionButtonEvents } from './types.js';
2
+ import type { AccordionButtonEvents, AccordionButtonState, AccordionContentState, AccordionItemState, AccordionState } from './types.js';
3
3
  interface Item {
4
4
  id: string;
5
5
  disabled: boolean;
@@ -21,6 +21,7 @@ declare class AccordionRoot {
21
21
  readonly 'data-value': string[] | undefined;
22
22
  readonly 'data-accordion': "";
23
23
  };
24
+ state: AccordionState;
24
25
  }
25
26
  type AccordionItemProps = StateValues<{
26
27
  disabled: boolean;
@@ -40,10 +41,7 @@ declare class AccordionItem {
40
41
  readonly 'data-state': "opened" | "closed";
41
42
  readonly 'data-value': string | undefined;
42
43
  };
43
- state: {
44
- active: boolean;
45
- disabled: boolean;
46
- };
44
+ state: AccordionItemState;
47
45
  }
48
46
  interface AccordionHeadingProps {
49
47
  level: 1 | 2 | 3 | 4 | 5 | 6;
@@ -72,10 +70,7 @@ declare class AccordionButton {
72
70
  readonly 'data-active': true | undefined;
73
71
  readonly onclick: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
74
72
  };
75
- state: {
76
- active: boolean;
77
- disabled: boolean;
78
- };
73
+ state: AccordionButtonState;
79
74
  }
80
75
  declare class AccordionContent {
81
76
  item: AccordionItem;
@@ -90,6 +85,7 @@ declare class AccordionContent {
90
85
  'data-accordioncontent'?: undefined;
91
86
  'data-active'?: undefined;
92
87
  };
88
+ state: AccordionContentState;
93
89
  }
94
90
  export declare const createAccordionRootContext: (props: AccordionRootProps) => AccordionRoot;
95
91
  export declare const createAccordionItemContext: (props: AccordionItemProps) => AccordionItem;
@@ -33,6 +33,9 @@ class AccordionRoot {
33
33
  'data-value': this.$value.val.length > 0 ? this.$value.val : undefined,
34
34
  'data-accordion': ''
35
35
  }));
36
+ state = $derived.by(() => ({
37
+ value: this.$value.val
38
+ }));
36
39
  }
37
40
  class AccordionItem {
38
41
  uid = createUID('item');
@@ -119,6 +122,9 @@ class AccordionContent {
119
122
  'data-active': this.item.Active
120
123
  }
121
124
  : {});
125
+ state = $derived.by(() => ({
126
+ active: this.item.Active
127
+ }));
122
128
  }
123
129
  //
124
130
  // Builders
@@ -1,4 +1,11 @@
1
1
  import type { Props, Handler, Transition } from '../../internal/index.js';
2
+ /**
3
+ * The state that is exposed from the `Accordion` component.\
4
+ * Which can be used via the `class` prop function or `children` snippet block.
5
+ */
6
+ export interface AccordionState {
7
+ value: string[];
8
+ }
2
9
  export interface AccordionProps extends Props<HTMLDivElement> {
3
10
  /**
4
11
  * The value of the active item.\
@@ -14,6 +21,13 @@ export interface AccordionProps extends Props<HTMLDivElement> {
14
21
  */
15
22
  onChange?: (values: string[]) => void;
16
23
  }
24
+ /**
25
+ * The state that is exposed from the `AccordionContent` component.\
26
+ * Which can be used via the `class` prop function or `children` snippet block.
27
+ */
28
+ export interface AccordionContentState {
29
+ active: boolean;
30
+ }
17
31
  export interface AccordionContentProps extends Props<HTMLDivElement> {
18
32
  /**
19
33
  * The `svelte/transtion` you wish to use.
@@ -26,7 +40,11 @@ export interface AccordionHeadingProps extends Props<HTMLDivElement> {
26
40
  /** The `aria-level` to be set. */
27
41
  level?: 1 | 2 | 3 | 4 | 5 | 6;
28
42
  }
29
- interface AccordionButtonState {
43
+ /**
44
+ * The state that is exposed from the `AccordionButton` component.\
45
+ * Which can be used via the `class` prop function or `children` snippet block.
46
+ */
47
+ export interface AccordionButtonState {
30
48
  /** True if the item is opened. */
31
49
  active: boolean;
32
50
  /** True if the item is disabled. */
@@ -43,7 +61,11 @@ export interface AccordionButtonEvents {
43
61
  }
44
62
  export interface AccordionButtonProps extends Props<HTMLButtonElement, AccordionButtonState>, AccordionButtonEvents {
45
63
  }
46
- interface AccordionItemState {
64
+ /**
65
+ * The state that is exposed from the `AccordionItem` component.\
66
+ * Which can be used via the `class` prop function or `children` snippet block.
67
+ */
68
+ export interface AccordionItemState {
47
69
  /** True if the item is opened. */
48
70
  active: boolean;
49
71
  /** True if the item is disabled. */
@@ -59,4 +81,3 @@ export interface AccordionItemProps extends Props<HTMLDivElement, AccordionItemS
59
81
  /** Disables the items, disallowing clicking and keyboard navigation. */
60
82
  disabled?: boolean;
61
83
  }
62
- export {};
@@ -1,6 +1,10 @@
1
1
  import type { Handler, Props } from '../../internal/index.js';
2
2
  export type Checked = boolean | 'mixed';
3
- interface CheckboxState {
3
+ /**
4
+ * The state that is exposed from the `CheckboxState` component.\
5
+ * Which can be used via the `class` prop function or `children` snippet block.
6
+ */
7
+ export interface CheckboxState {
4
8
  /** If the checkbox is checked or not. */
5
9
  checked: Checked;
6
10
  }
@@ -19,4 +23,3 @@ export interface CheckboxProps extends Props<HTMLButtonElement, CheckboxState> {
19
23
  */
20
24
  onClick?: Handler<MouseEvent, HTMLButtonElement>;
21
25
  }
22
- export {};
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { useActions, classProp, stateValue } from '../../internal/index.js';
3
+ import { createCollapsibleRootContext } from './main.svelte.js';
4
+ import type { CollapsibleProps } from './types.js';
5
+
6
+ let {
7
+ children,
8
+ use = [],
9
+ class: klass,
10
+ visible = $bindable(false),
11
+ self = $bindable(),
12
+ disabled = $bindable(false),
13
+ onChange,
14
+ ...props
15
+ }: CollapsibleProps = $props();
16
+
17
+ const ctx = createCollapsibleRootContext({
18
+ visible: stateValue(
19
+ () => visible,
20
+ (v) => {
21
+ visible = v;
22
+ onChange?.(v);
23
+ }
24
+ ),
25
+ disabled: stateValue(() => disabled)
26
+ });
27
+ </script>
28
+
29
+ <div bind:this={self} use:useActions={use} class={classProp(klass, ctx.state)} {...ctx.attrs} {...props}>
30
+ {@render children?.(ctx.state)}
31
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { CollapsibleProps } from './types.js';
2
+ declare const Collapsible: import("svelte").Component<CollapsibleProps, {}, "self" | "disabled" | "visible">;
3
+ type Collapsible = ReturnType<typeof Collapsible>;
4
+ export default Collapsible;
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import { useCollapsibleButton } from './main.svelte.js';
3
+ import { useActions, classProp } from '../../internal/index.js';
4
+ import type { CollapsibleButtonProps } from './types.js';
5
+
6
+ let { children, class: klass, use = [], self = $bindable(), onClick, ...props }: CollapsibleButtonProps = $props();
7
+
8
+ const ctx = useCollapsibleButton({
9
+ onClick
10
+ });
11
+ </script>
12
+
13
+ <button
14
+ type="button"
15
+ bind:this={self}
16
+ use:useActions={use}
17
+ class={classProp(klass, ctx.state)}
18
+ {...ctx.attrs}
19
+ {...props}
20
+ >
21
+ {@render children?.(ctx.state)}
22
+ </button>
@@ -0,0 +1,4 @@
1
+ import type { CollapsibleButtonProps } from './types.js';
2
+ declare const CollapsibleButton: import("svelte").Component<CollapsibleButtonProps, {}, "self">;
3
+ type CollapsibleButton = ReturnType<typeof CollapsibleButton>;
4
+ export default CollapsibleButton;
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { useCollapsibleContent } from './main.svelte.js';
3
+ import { useActions, getTransition, classProp } from '../../internal/index.js';
4
+ import type { CollapsibleContentProps } from './types.js';
5
+
6
+ let {
7
+ children,
8
+ class: klass,
9
+ use = [],
10
+ self = $bindable(),
11
+ transition,
12
+ ...props
13
+ }: CollapsibleContentProps = $props();
14
+
15
+ const ctx = useCollapsibleContent();
16
+
17
+ const { inTransition, outTransition } = getTransition(transition);
18
+ const attrs = $derived({
19
+ ...ctx.attrs,
20
+ class: classProp(klass, ctx.state)
21
+ } as const);
22
+ </script>
23
+
24
+ {#if inTransition && outTransition && ctx.root.$visible.val}
25
+ {@const { config: inConf, transition: inFn } = inTransition}
26
+ {@const { config: outConf, transition: outFn } = outTransition}
27
+ <div bind:this={self} use:useActions={use} in:inFn={inConf} out:outFn={outConf} {...attrs} {...props}>
28
+ {@render children?.(ctx.state)}
29
+ </div>
30
+ {:else if ctx.root.$visible.val}
31
+ <div bind:this={self} use:useActions={use} {...attrs} {...props}>
32
+ {@render children?.(ctx.state)}
33
+ </div>
34
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { CollapsibleContentProps } from './types.js';
2
+ declare const CollapsibleContent: import("svelte").Component<CollapsibleContentProps, {}, "self">;
3
+ type CollapsibleContent = ReturnType<typeof CollapsibleContent>;
4
+ export default CollapsibleContent;
@@ -0,0 +1,3 @@
1
+ export { default as Collapsible } from './Collapsible.svelte';
2
+ export { default as CollapsibleButton } from './CollapsibleButton.svelte';
3
+ export { default as CollapsibleContent } from './CollapsibleContent.svelte';
@@ -0,0 +1,3 @@
1
+ export { default as Collapsible } from './Collapsible.svelte';
2
+ export { default as CollapsibleButton } from './CollapsibleButton.svelte';
3
+ export { default as CollapsibleContent } from './CollapsibleContent.svelte';
@@ -0,0 +1,46 @@
1
+ import { type StateValues } from '../../internal/index.js';
2
+ import type { CollapsibleButtonEvents, CollapsibleState } from './types.js';
3
+ type CollapsibleRootProps = StateValues<{
4
+ visible: boolean;
5
+ disabled: boolean;
6
+ }>;
7
+ declare class CollapsibleRoot {
8
+ uid: (component?: string) => string;
9
+ $visible: CollapsibleRootProps['visible'];
10
+ $disabled: CollapsibleRootProps['disabled'];
11
+ constructor(props: CollapsibleRootProps);
12
+ attrs: {
13
+ id: string;
14
+ 'data-collapsible': string;
15
+ 'data-disabled': true | undefined;
16
+ 'data-state': string;
17
+ };
18
+ state: CollapsibleState;
19
+ }
20
+ declare class CollapsibleButton {
21
+ #private;
22
+ root: CollapsibleRoot;
23
+ constructor(root: CollapsibleRoot, events: CollapsibleButtonEvents);
24
+ attrs: {
25
+ id: string;
26
+ 'aria-expanded': boolean;
27
+ 'data-collapsiblebutton': string;
28
+ 'data-disabled': boolean;
29
+ 'data-state': string;
30
+ onclick: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
31
+ };
32
+ state: CollapsibleState;
33
+ }
34
+ declare class CollapsibleContent {
35
+ root: CollapsibleRoot;
36
+ constructor(root: CollapsibleRoot);
37
+ attrs: {
38
+ id: string;
39
+ 'data-collapsiblecontent': string;
40
+ };
41
+ state: CollapsibleState;
42
+ }
43
+ export declare const createCollapsibleRootContext: (props: CollapsibleRootProps) => CollapsibleRoot;
44
+ export declare const useCollapsibleButton: (events: CollapsibleButtonEvents) => CollapsibleButton;
45
+ export declare const useCollapsibleContent: () => CollapsibleContent;
46
+ export {};
@@ -0,0 +1,74 @@
1
+ import { buildContext, createUID } from '../../internal/index.js';
2
+ class CollapsibleRoot {
3
+ uid = createUID('collapsible');
4
+ $visible;
5
+ $disabled;
6
+ constructor(props) {
7
+ this.$visible = props.visible;
8
+ this.$disabled = props.disabled;
9
+ }
10
+ attrs = $derived.by(() => ({
11
+ id: this.uid(),
12
+ 'data-collapsible': '',
13
+ 'data-disabled': this.$disabled.val || undefined,
14
+ 'data-state': this.$visible.val ? 'opened' : 'closed'
15
+ }));
16
+ state = $derived.by(() => ({
17
+ visible: this.$visible.val
18
+ }));
19
+ }
20
+ //
21
+ // Button
22
+ //
23
+ class CollapsibleButton {
24
+ root;
25
+ #events;
26
+ constructor(root, events) {
27
+ this.root = root;
28
+ this.#events = events;
29
+ }
30
+ #handleClick = (e) => {
31
+ if (this.root.$disabled.val)
32
+ return;
33
+ this.#events.onClick?.(e);
34
+ this.root.$visible.val = !this.root.$visible.val;
35
+ };
36
+ attrs = $derived.by(() => ({
37
+ id: this.root.uid('button'),
38
+ 'aria-expanded': this.root.$visible.val,
39
+ 'data-collapsiblebutton': '',
40
+ 'data-disabled': this.root.$disabled.val,
41
+ 'data-state': this.root.$visible.val ? 'opened' : 'closed',
42
+ onclick: this.#handleClick
43
+ }));
44
+ state = $derived.by(() => ({
45
+ visible: this.root.$visible.val
46
+ }));
47
+ }
48
+ //
49
+ // Content
50
+ //
51
+ class CollapsibleContent {
52
+ root;
53
+ constructor(root) {
54
+ this.root = root;
55
+ }
56
+ attrs = $derived.by(() => ({
57
+ id: this.root.uid('content'),
58
+ 'data-collapsiblecontent': ''
59
+ }));
60
+ state = $derived.by(() => ({
61
+ visible: this.root.$visible.val
62
+ }));
63
+ }
64
+ // Builders
65
+ const rootContext = buildContext(CollapsibleRoot);
66
+ export const createCollapsibleRootContext = (props) => {
67
+ return rootContext.createContext(props);
68
+ };
69
+ export const useCollapsibleButton = (events) => {
70
+ return rootContext.register(CollapsibleButton, events);
71
+ };
72
+ export const useCollapsibleContent = () => {
73
+ return rootContext.register(CollapsibleContent);
74
+ };
@@ -0,0 +1,36 @@
1
+ import type { Handler, Props, Transition } from '../../internal/index.js';
2
+ /**
3
+ * The state that is exposed from the `Collapsible` components.\
4
+ * Which can be used via the `class` prop function or `children` snippet block.
5
+ */
6
+ export interface CollapsibleState {
7
+ /** Whether or not the collapsible content is visible. */
8
+ visible: boolean;
9
+ }
10
+ export interface CollapsibleProps extends Props<HTMLElement, CollapsibleState> {
11
+ /** Whether or not the collapsible content is visible. */
12
+ visible?: boolean;
13
+ /** Disables the entire collapsible component tree. */
14
+ disabled?: boolean;
15
+ /** An event that fires when the `visible` prop changes. */
16
+ onChange?: (value: boolean) => void;
17
+ }
18
+ export interface CollapsibleButtonEvents {
19
+ /**
20
+ * Add your own custom logic to the click event.\
21
+ * Using the regular `onclick` event will overwrite the event used and cause the component to fail.
22
+ *
23
+ * Event will **NOT** be fired if the component is disabled.
24
+ */
25
+ onClick?: Handler<MouseEvent, HTMLButtonElement>;
26
+ }
27
+ export interface CollapsibleButtonProps extends Props<HTMLButtonElement, CollapsibleState> {
28
+ }
29
+ export interface CollapsibleContentProps extends Props<HTMLElement> {
30
+ /**
31
+ * The `svelte/transtion` you wish to use.
32
+ *
33
+ * @see https://lithesome.dev/docs/api#transition-prop
34
+ */
35
+ transition?: Transition;
36
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -23,6 +23,7 @@
23
23
  {children}
24
24
  componentName="Combobox"
25
25
  visible={ctx.root.SuperVisible}
26
+ bind:self
26
27
  {ctx}
27
28
  {transition}
28
29
  {use}
@@ -1,5 +1,5 @@
1
1
  import { Floating, type CalcIndexAction, type JsonValue, type StateValues } from '../../internal/index.js';
2
- import type { ComboboxInputEvents, ComboboxOptionEvents } from './types.js';
2
+ import type { ComboboxContentState, ComboboxInputEvents, ComboboxInputState, ComboboxOptionEvents, ComboboxOptionState, ComboboxState } from './types.js';
3
3
  type ComboboxRootProps = StateValues<{
4
4
  visible: boolean;
5
5
  value: JsonValue;
@@ -38,9 +38,7 @@ declare class ComboboxRoot extends Floating {
38
38
  readonly 'data-combobox': "";
39
39
  readonly 'data-state': "opened" | "closed";
40
40
  };
41
- state: {
42
- visible: boolean;
43
- };
41
+ state: ComboboxState;
44
42
  }
45
43
  declare class ComboboxInput {
46
44
  #private;
@@ -60,9 +58,7 @@ declare class ComboboxInput {
60
58
  readonly onclick: import("../../internal/index.js").Handler<MouseEvent, HTMLInputElement> | undefined;
61
59
  readonly onkeydown: import("../../internal/index.js").Handler<KeyboardEvent, HTMLInputElement> | undefined;
62
60
  };
63
- state: {
64
- visible: boolean;
65
- };
61
+ state: ComboboxInputState;
66
62
  }
67
63
  declare class ComboboxArrow {
68
64
  root: ComboboxRoot;
@@ -77,9 +73,7 @@ declare class ComboboxContent {
77
73
  attrs: {
78
74
  hidden: true | undefined;
79
75
  };
80
- state: {
81
- visible: boolean;
82
- };
76
+ state: ComboboxContentState;
83
77
  }
84
78
  type ComboboxOptionProps = StateValues<{
85
79
  value: JsonValue;
@@ -111,10 +105,7 @@ declare class ComboboxOption {
111
105
  readonly onmouseover: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
112
106
  readonly onclick: import("../../internal/index.js").Handler<MouseEvent, HTMLButtonElement> | undefined;
113
107
  };
114
- state: {
115
- hovered: boolean;
116
- selected: boolean;
117
- };
108
+ state: ComboboxOptionState;
118
109
  }
119
110
  export declare const createRootContext: (props: ComboboxRootProps) => ComboboxRoot;
120
111
  export declare const useComboboxInput: (events: ComboboxInputEvents) => ComboboxInput;
@@ -1,6 +1,10 @@
1
1
  import type { Props, PropsNoChildren, ContentProps, Handler, JsonValue } from '../../internal/index.js';
2
2
  export type ComboboxElement = HTMLAnchorElement | HTMLButtonElement;
3
- interface ComboboxState {
3
+ /**
4
+ * The state that is exposed from the `Combobox` component.\
5
+ * Which can be used via the `class` prop function or `children` snippet block.
6
+ */
7
+ export interface ComboboxState {
4
8
  /** Whether or not the content is opened or not. */
5
9
  visible: boolean;
6
10
  }
@@ -24,8 +28,24 @@ export interface ComboboxProps extends Props<HTMLDivElement, ComboboxState> {
24
28
  }
25
29
  export interface ComboboxArrowProps extends PropsNoChildren<HTMLDivElement, ComboboxState> {
26
30
  }
31
+ /**
32
+ * The state that is exposed from the `ComboboxContent` component.\
33
+ * Which can be used via the `class` prop function or `children` snippet block.
34
+ */
35
+ export interface ComboboxContentState {
36
+ /** Whether or not the content is opened or not. */
37
+ visible: boolean;
38
+ }
27
39
  export interface ComboboxContentProps extends Props<HTMLDivElement, ComboboxState>, ContentProps {
28
40
  }
41
+ /**
42
+ * The state that is exposed from the `ComboboxInput` component.\
43
+ * Which can be used via the `class` prop function or `children` snippet block.
44
+ */
45
+ export interface ComboboxInputState {
46
+ /** Whether or not the content is opened or not. */
47
+ visible: boolean;
48
+ }
29
49
  export interface ComboboxInputEvents {
30
50
  /**
31
51
  * Add your own custom logic to the click event.\
@@ -42,11 +62,15 @@ export interface ComboboxInputEvents {
42
62
  */
43
63
  onKeydown?: Handler<KeyboardEvent, HTMLInputElement>;
44
64
  }
45
- export interface ComboboxInputProps extends PropsNoChildren<HTMLInputElement, ComboboxState>, ComboboxInputEvents {
65
+ export interface ComboboxInputProps extends PropsNoChildren<HTMLInputElement, ComboboxInputState>, ComboboxInputEvents {
46
66
  /** Bind the value of the input value. */
47
67
  value: string;
48
68
  }
49
- interface ComboboxOptionState {
69
+ /**
70
+ * The state that is exposed from the `ComboboxOption` component.\
71
+ * Which can be used via the `class` prop function or `children` snippet block.
72
+ */
73
+ export interface ComboboxOptionState {
50
74
  /** If the option is hovered, either via mouse or keyboard. */
51
75
  hovered: boolean;
52
76
  /** If the option is selected. */
@@ -80,4 +104,3 @@ export interface ComboboxOptionProps extends Props<ComboboxElement, ComboboxOpti
80
104
  */
81
105
  label?: string;
82
106
  }
83
- export {};
@@ -24,15 +24,15 @@
24
24
  componentName="Hovercard"
25
25
  visible={ctx.root.$visible.val}
26
26
  bind:self
27
- bind:sameWidth
28
- bind:transition
29
- bind:constrainViewport
30
- bind:placement
31
- bind:portalTarget
27
+ {sameWidth}
28
+ {transition}
29
+ {constrainViewport}
30
+ {placement}
31
+ {portalTarget}
32
32
  {ctx}
33
33
  {use}
34
34
  outsideCallback={() => ctx.root.forceClose()}
35
35
  role="listbox"
36
- class={classProp(klass, ctx.state)}
36
+ class={klass}
37
37
  {...props}
38
38
  />
@@ -1,4 +1,5 @@
1
1
  import { Floating, type StateValues } from '../../internal/index.js';
2
+ import type { HovercardState } from './types.js';
2
3
  type HovercardRootProps = StateValues<{
3
4
  visible: boolean;
4
5
  delays: {
@@ -21,9 +22,7 @@ declare class HovercardRoot extends Floating {
21
22
  readonly 'data-hovercard': "";
22
23
  readonly 'data-state': "opened" | "closed";
23
24
  };
24
- state: {
25
- visible: boolean;
26
- };
25
+ state: HovercardState;
27
26
  }
28
27
  declare class HovercardTrigger {
29
28
  #private;
@@ -33,9 +32,7 @@ declare class HovercardTrigger {
33
32
  attrs: {
34
33
  'data-hovercardtrigger': string;
35
34
  };
36
- state: {
37
- visible: boolean;
38
- };
35
+ state: HovercardState;
39
36
  }
40
37
  declare class HovercardArrow {
41
38
  root: HovercardRoot;
@@ -52,9 +49,7 @@ declare class HovercardContent {
52
49
  onmouseenter: () => void;
53
50
  onmouseleave: () => void;
54
51
  };
55
- state: {
56
- visible: boolean;
57
- };
52
+ state: HovercardState;
58
53
  }
59
54
  export declare const createRootContext: (props: HovercardRootProps) => HovercardRoot;
60
55
  export declare const useHovercardTrigger: () => HovercardTrigger;
@@ -1,5 +1,9 @@
1
1
  import type { Props, PropsNoChildren, ContentProps } from '../../internal/index.js';
2
- interface HovercardState {
2
+ /**
3
+ * The state that is exposed from the `Hovercard` components.\
4
+ * Which can be used via the `class` prop function or `children` snippet block.
5
+ */
6
+ export interface HovercardState {
3
7
  /** Whether or not the content is opened or not. */
4
8
  visible: boolean;
5
9
  }
@@ -19,4 +23,3 @@ export interface HovercardContentProps extends Props<HTMLDivElement, HovercardSt
19
23
  }
20
24
  export interface HovercardTriggerProps extends Props<HTMLDivElement, HovercardState> {
21
25
  }
22
- export {};
@@ -23,6 +23,7 @@
23
23
  {children}
24
24
  componentName="Menu"
25
25
  visible={ctx.root.$visible.val}
26
+ bind:self
26
27
  {ctx}
27
28
  {transition}
28
29
  {use}