@casinogate/ui 1.11.13 → 1.11.14

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.
@@ -124,6 +124,8 @@
124
124
  return value === itemValue;
125
125
  };
126
126
 
127
+ const getItemKey = (item: ComboboxItem) => item.key ?? item.value;
128
+
127
129
  const isPlaceholder = $derived.by(() => {
128
130
  if (Array.isArray(value)) return value.length === 0;
129
131
  return typeof value === 'string' && value.trim() === '';
@@ -426,7 +428,7 @@
426
428
  <CommandPrimitive.GroupHeading>{group?.label ?? groupKey}</CommandPrimitive.GroupHeading>
427
429
 
428
430
  <CommandPrimitive.GroupItems>
429
- {#each groupItems as item (item.value)}
431
+ {#each groupItems as item (getItemKey(item))}
430
432
  {@render renderItem(item)}
431
433
  {/each}
432
434
  </CommandPrimitive.GroupItems>
@@ -437,7 +439,7 @@
437
439
  </CommandPrimitive.Group>
438
440
  {:else}
439
441
  <CommandPrimitive.Group value="__ungrouped__">
440
- {#each groupItems as item (item.value)}
442
+ {#each groupItems as item (getItemKey(item))}
441
443
  {@render renderItem(item)}
442
444
  {/each}
443
445
  </CommandPrimitive.Group>
@@ -118,6 +118,8 @@
118
118
  if (Array.isArray(value)) return value.includes(itemValue);
119
119
  return value === itemValue;
120
120
  }
121
+
122
+ const getItemKey = (item: ComboboxItem) => item.key ?? item.value;
121
123
  </script>
122
124
 
123
125
  {#snippet clearBtn()}
@@ -237,7 +239,7 @@
237
239
  <CommandPrimitive.GroupHeading>{group?.label ?? groupKey}</CommandPrimitive.GroupHeading>
238
240
 
239
241
  <CommandPrimitive.GroupItems>
240
- {#each items as item (item.value)}
242
+ {#each items as item (getItemKey(item))}
241
243
  {@render renderItem(item)}
242
244
  {/each}
243
245
  </CommandPrimitive.GroupItems>
@@ -248,7 +250,7 @@
248
250
  </CommandPrimitive.Group>
249
251
  {:else}
250
252
  <CommandPrimitive.Group value="__ungrouped__">
251
- {#each items as item (item.value)}
253
+ {#each items as item (getItemKey(item))}
252
254
  {@render renderItem(item)}
253
255
  {/each}
254
256
  </CommandPrimitive.Group>
@@ -4,7 +4,9 @@ import type { CommandGroup, CommandItem, CommandProps } from '../command/index.j
4
4
  import type { PrimitivePopoverRootProps } from '../popover/types.js';
5
5
  import type { ComboboxTriggerVariantsProps } from './styles.js';
6
6
  export type ComboboxRootProps = PrimitivePopoverRootProps;
7
- export type ComboboxItem = CommandItem;
7
+ export type ComboboxItem = CommandItem & {
8
+ key?: string | number;
9
+ };
8
10
  /**
9
11
  * Base props shared by both single and multiple selection modes
10
12
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casinogate/ui",
3
- "version": "1.11.13",
3
+ "version": "1.11.14",
4
4
  "svelte": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",