@skeletonlabs/skeleton-svelte 1.5.0 → 1.5.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.
@@ -26,9 +26,10 @@
26
26
  positionerBase = '',
27
27
  positionerClasses = '',
28
28
  // Content
29
- contentBase = 'card p-2',
29
+ contentBase = 'card p-2 overflow-y-auto',
30
30
  contentBackground = 'preset-outlined-surface-200-800 bg-surface-50-950',
31
31
  contentSpaceY = 'space-y-1',
32
+ contentMaxHeight = 'max-h-80',
32
33
  contentClasses = '',
33
34
  // Option
34
35
  optionBase = 'btn justify-start w-full',
@@ -45,7 +46,8 @@
45
46
  }: ComboboxProps<T> = $props();
46
47
 
47
48
  // Zag
48
- let options = $state.raw(data);
49
+ let options = $derived(data);
50
+
49
51
  const collection = $derived(
50
52
  combobox.collection({
51
53
  items: options,
@@ -58,18 +60,27 @@
58
60
  const id = $props.id();
59
61
  const service = useMachine(combobox.machine, () => ({
60
62
  id: id,
61
- collection: collection,
63
+ get collection() {
64
+ return collection;
65
+ },
62
66
  ...zagProps,
63
- onOpenChange(event) {
67
+ async onOpenChange(event) {
68
+ if (zagProps.onOpenChange) {
69
+ zagProps.onOpenChange(event);
70
+ return;
71
+ }
64
72
  options = data;
65
- zagProps.onOpenChange?.(event);
66
73
  },
67
- onInputValueChange(event) {
74
+ async onInputValueChange(event) {
75
+ if (zagProps.onInputValueChange) {
76
+ zagProps.onInputValueChange(event);
77
+ return;
78
+ }
68
79
  const filtered = data.filter((item) => item.label.toLowerCase().includes(event.inputValue.toLowerCase()));
69
80
  options = filtered;
70
- zagProps.onInputValueChange?.(event);
71
81
  }
72
82
  }));
83
+
73
84
  const api = $derived(combobox.connect(service, normalizeProps));
74
85
  const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onclick }));
75
86
  </script>
@@ -113,7 +124,7 @@
113
124
  <!-- Content (list) -->
114
125
  <nav
115
126
  {...api.getContentProps()}
116
- class="{contentBase} {contentBackground} {contentSpaceY} {contentClasses}"
127
+ class="{contentBase} {contentBackground} {contentSpaceY} {contentClasses} {contentMaxHeight}"
117
128
  style="z-index: {zIndex}"
118
129
  >
119
130
  {#each options as option (option.label)}
@@ -39,6 +39,8 @@ export interface ComboboxProps<T extends ComboboxItem> extends Omit<combobox.Pro
39
39
  contentBackground?: string;
40
40
  /** Set space-y classes for the content. */
41
41
  contentSpaceY?: string;
42
+ /** Set max-h classes for the content. */
43
+ contentMaxHeight?: string;
42
44
  /** Provide arbitrary classes for the content. */
43
45
  contentClasses?: string;
44
46
  /** Set base classes for the option. */
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton-svelte",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "The Svelte package for Skeleton.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/skeletonlabs/skeleton",
9
+ "directory": "packages/skeleton-svelte"
10
+ },
6
11
  "types": "./dist/index.d.ts",
7
12
  "exports": {
8
13
  ".": {
@@ -60,7 +65,7 @@
60
65
  "typescript": "^5.8.3",
61
66
  "vite": "^7.0.4",
62
67
  "vitest": "3.2.4",
63
- "@skeletonlabs/skeleton": "3.2.0"
68
+ "@skeletonlabs/skeleton": "3.2.2"
64
69
  },
65
70
  "type": "module",
66
71
  "scripts": {