compote-ui 0.60.0 → 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.
@@ -19,7 +19,10 @@
19
19
 
20
20
  <Listbox.Content
21
21
  {...restProps}
22
- class={cn('flex min-h-0 w-full flex-1 flex-col overflow-y-auto outline-none', className)}
22
+ class={cn(
23
+ 'flex min-h-0 w-full flex-1 flex-col overflow-y-auto outline-none bg-surface-document rounded p-1 border scrollbar-thin',
24
+ className
25
+ )}
23
26
  >
24
27
  {@render items?.({ items: ctx.collection.items, group: ctx.collection.group() })}
25
28
  </Listbox.Content>
@@ -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";
@@ -1,7 +1,7 @@
1
1
  import type { SelectRootBaseProps } from '@ark-ui/svelte/select';
2
2
  import type { ListItem } from '../../utils/collections';
3
3
  export interface SelectProps<T extends ListItem> extends Omit<SelectRootBaseProps<T>, 'value' | 'collection'> {
4
- value?: number | string | null;
4
+ value?: T['value'] | null;
5
5
  items: T[];
6
6
  label?: string;
7
7
  placeholder?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.60.0",
3
+ "version": "0.60.3",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev --open",