compote-ui 0.60.2 → 0.60.3

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.
@@ -9,12 +9,13 @@
9
9
  import { setListboxContext } from './listbox-context';
10
10
  import type { ClassValue } from 'svelte/elements';
11
11
 
12
- type Props = Omit<ListboxRootBaseProps<ListItem<T>>, 'collection' | 'value'> & {
12
+ type Props = Omit<ListboxRootBaseProps<ListItem<T>>, 'collection' | 'value' | 'onValueChange'> & {
13
13
  items: ListItem<T>[];
14
14
  value?: T[];
15
15
  name?: string;
16
16
  class?: ClassValue;
17
17
  children?: Snippet;
18
+ onValueChange?: (details: { value: T[]; items: ListItem<T>[] }) => void;
18
19
  };
19
20
 
20
21
  let {
@@ -64,8 +65,9 @@
64
65
  {collection}
65
66
  value={stringValue}
66
67
  onValueChange={(details) => {
67
- value = details.value as unknown as T[];
68
- onValueChange?.(details);
68
+ const converted = details.value.map((v) => items.find((item) => item.value.toString() === v)?.value as T);
69
+ value = converted;
70
+ onValueChange?.({ value: converted, items: details.items as ListItem<T>[] });
69
71
  }}
70
72
  {...restProps}
71
73
  class={cn('flex h-full w-full flex-col gap-1.5 overflow-hidden', className)}
@@ -3,12 +3,16 @@ import type { Snippet } from 'svelte';
3
3
  import type { ListItem } from '../../utils/collections';
4
4
  import type { ClassValue } from 'svelte/elements';
5
5
  declare function $$render<T extends string | number = string>(): {
6
- props: Omit<Listbox.RootBaseProps<ListItem<T>>, "value" | "collection"> & {
6
+ props: Omit<Listbox.RootBaseProps<ListItem<T>>, "value" | "onValueChange" | "collection"> & {
7
7
  items: ListItem<T>[];
8
8
  value?: T[];
9
9
  name?: string;
10
10
  class?: ClassValue;
11
11
  children?: Snippet;
12
+ onValueChange?: (details: {
13
+ value: T[];
14
+ items: ListItem<T>[];
15
+ }) => void;
12
16
  };
13
17
  exports: {};
14
18
  bindings: "value";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.60.2",
3
+ "version": "0.60.3",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev --open",