@casinogate/ui 1.11.6 → 1.11.8

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 (56) hide show
  1. package/dist/assets/css/root.css +21 -0
  2. package/dist/components/combobox/presets/async/combobox.async.svelte +8 -7
  3. package/dist/components/combobox/presets/async/combobox.async.svelte.d.ts +24 -2
  4. package/dist/components/combobox/presets/root/combobox.svelte +3 -2
  5. package/dist/components/combobox/types.d.ts +16 -9
  6. package/dist/components/command/types.d.ts +1 -0
  7. package/dist/components/file-upload/components/file-upload.clear-trigger.svelte +30 -0
  8. package/dist/components/file-upload/components/file-upload.clear-trigger.svelte.d.ts +4 -0
  9. package/dist/components/file-upload/components/file-upload.context.svelte +10 -0
  10. package/dist/components/file-upload/components/file-upload.context.svelte.d.ts +4 -0
  11. package/dist/components/file-upload/components/file-upload.dropzone.svelte +72 -0
  12. package/dist/components/file-upload/components/file-upload.dropzone.svelte.d.ts +4 -0
  13. package/dist/components/file-upload/components/file-upload.hidden-input.svelte +35 -0
  14. package/dist/components/file-upload/components/file-upload.hidden-input.svelte.d.ts +4 -0
  15. package/dist/components/file-upload/components/file-upload.item-delete-trigger.svelte +31 -0
  16. package/dist/components/file-upload/components/file-upload.item-delete-trigger.svelte.d.ts +4 -0
  17. package/dist/components/file-upload/components/file-upload.item-group.svelte +21 -0
  18. package/dist/components/file-upload/components/file-upload.item-group.svelte.d.ts +4 -0
  19. package/dist/components/file-upload/components/file-upload.item-name.svelte +28 -0
  20. package/dist/components/file-upload/components/file-upload.item-name.svelte.d.ts +4 -0
  21. package/dist/components/file-upload/components/file-upload.item-preview-image.svelte +33 -0
  22. package/dist/components/file-upload/components/file-upload.item-preview-image.svelte.d.ts +4 -0
  23. package/dist/components/file-upload/components/file-upload.item-preview.svelte +29 -0
  24. package/dist/components/file-upload/components/file-upload.item-preview.svelte.d.ts +4 -0
  25. package/dist/components/file-upload/components/file-upload.item-size-text.svelte +28 -0
  26. package/dist/components/file-upload/components/file-upload.item-size-text.svelte.d.ts +4 -0
  27. package/dist/components/file-upload/components/file-upload.item.svelte +29 -0
  28. package/dist/components/file-upload/components/file-upload.item.svelte.d.ts +4 -0
  29. package/dist/components/file-upload/components/file-upload.root.svelte +47 -0
  30. package/dist/components/file-upload/components/file-upload.root.svelte.d.ts +4 -0
  31. package/dist/components/file-upload/components/file-upload.svelte.d.ts +41 -0
  32. package/dist/components/file-upload/components/file-upload.svelte.js +120 -0
  33. package/dist/components/file-upload/components/file-upload.trigger.svelte +31 -0
  34. package/dist/components/file-upload/components/file-upload.trigger.svelte.d.ts +4 -0
  35. package/dist/components/file-upload/components/index.d.ts +13 -0
  36. package/dist/components/file-upload/components/index.js +13 -0
  37. package/dist/components/file-upload/composed/index.d.ts +1 -0
  38. package/dist/components/file-upload/composed/index.js +1 -0
  39. package/dist/components/file-upload/composed/root/file-upload.root.svelte +36 -0
  40. package/dist/components/file-upload/composed/root/file-upload.root.svelte.d.ts +4 -0
  41. package/dist/components/file-upload/composed/root/index.d.ts +1 -0
  42. package/dist/components/file-upload/composed/root/index.js +1 -0
  43. package/dist/components/file-upload/index.d.ts +3 -0
  44. package/dist/components/file-upload/index.js +3 -0
  45. package/dist/components/file-upload/styles.d.ts +80 -0
  46. package/dist/components/file-upload/styles.js +68 -0
  47. package/dist/components/file-upload/types.d.ts +83 -0
  48. package/dist/components/file-upload/types.js +1 -0
  49. package/dist/components/toast/components/toast.body.svelte +1 -6
  50. package/dist/components/toast/components/toast.close.svelte +1 -5
  51. package/dist/components/toast/components/toast.description.svelte +7 -7
  52. package/dist/components/toast/components/toast.icon.svelte +6 -7
  53. package/dist/components/toast/components/toast.root.svelte +6 -1
  54. package/dist/components/toast/components/toast.title.svelte +1 -6
  55. package/dist/components/toast/types.d.ts +1 -1
  56. package/package.json +1 -1
@@ -248,6 +248,9 @@
248
248
  .cgui\:\!m-0 {
249
249
  margin: calc(var(--cgui-spacing) * 0) !important;
250
250
  }
251
+ .cgui\:m-0 {
252
+ margin: calc(var(--cgui-spacing) * 0);
253
+ }
251
254
  .cgui\:mx-1 {
252
255
  margin-inline: calc(var(--cgui-spacing) * 1);
253
256
  }
@@ -454,6 +457,9 @@
454
457
  .cgui\:h-34 {
455
458
  height: calc(var(--cgui-spacing) * 34);
456
459
  }
460
+ .cgui\:h-40 {
461
+ height: calc(var(--cgui-spacing) * 40);
462
+ }
457
463
  .cgui\:h-100 {
458
464
  height: calc(var(--cgui-spacing) * 100);
459
465
  }
@@ -712,6 +718,9 @@
712
718
  .cgui\:scroll-py-1 {
713
719
  scroll-padding-block: calc(var(--cgui-spacing) * 1);
714
720
  }
721
+ .cgui\:list-none {
722
+ list-style-type: none;
723
+ }
715
724
  .cgui\:flex-col {
716
725
  flex-direction: column;
717
726
  }
@@ -1020,6 +1029,12 @@
1020
1029
  .cgui\:bg-surface-primary-light-active {
1021
1030
  background-color: var(--cg-ui-color-surface-primary-light-active);
1022
1031
  }
1032
+ .cgui\:bg-surface-primary\/5 {
1033
+ background-color: var(--cg-ui-color-surface-primary);
1034
+ @supports (color: color-mix(in lab, red, red)) {
1035
+ background-color: color-mix(in oklab, var(--cg-ui-color-surface-primary) 5%, transparent);
1036
+ }
1037
+ }
1023
1038
  .cgui\:bg-surface-regular {
1024
1039
  background-color: var(--cg-ui-color-surface-regular);
1025
1040
  }
@@ -1053,6 +1068,12 @@
1053
1068
  .cgui\:bg-clip-padding {
1054
1069
  background-clip: padding-box;
1055
1070
  }
1071
+ .cgui\:object-contain {
1072
+ object-fit: contain;
1073
+ }
1074
+ .cgui\:object-cover {
1075
+ object-fit: cover;
1076
+ }
1056
1077
  .cgui\:p-0 {
1057
1078
  padding: calc(var(--cgui-spacing) * 0);
1058
1079
  }
@@ -1,4 +1,4 @@
1
- <script lang="ts">
1
+ <script lang="ts" generics="TItem extends CommandItem">
2
2
  import type { CommandCollection, CommandItem } from '../../../command/index.js';
3
3
  import type { ComboboxAsyncProps } from '../../types.js';
4
4
 
@@ -35,6 +35,7 @@
35
35
  portalDisabled = false,
36
36
  allowDeselect = true,
37
37
  triggerClass,
38
+ contentClass,
38
39
  size = 'default',
39
40
  variant = 'default',
40
41
  rounded = 'default',
@@ -56,7 +57,7 @@
56
57
  onSelect = noop,
57
58
 
58
59
  ...restProps
59
- }: ComboboxAsyncProps = $props();
60
+ }: ComboboxAsyncProps<TItem> = $props();
60
61
 
61
62
  const isMultiple = type === 'multiple';
62
63
 
@@ -267,7 +268,7 @@
267
268
  behavior: 'smooth',
268
269
  });
269
270
  };
270
- function onSelectItem(item: Omit<CommandItem, 'onSelect'>) {
271
+ function onSelectItem(item: CommandItem) {
271
272
  if (Array.isArray(value)) {
272
273
  let result = value;
273
274
  if (value.includes(item.value)) {
@@ -275,7 +276,7 @@
275
276
  } else {
276
277
  result = [...value, item.value];
277
278
  }
278
- onSelect(result, item);
279
+ onSelect(result, item as TItem);
279
280
  value = result;
280
281
  } else {
281
282
  let result = value;
@@ -284,7 +285,7 @@
284
285
  } else {
285
286
  result = item.value;
286
287
  }
287
- onSelect(result, item);
288
+ onSelect(result, item as TItem);
288
289
  value = result;
289
290
  }
290
291
 
@@ -359,7 +360,7 @@
359
360
  {#if itemSnippet}
360
361
  <CommandPrimitive.Item {...itemAttrs} data-selected={boolAttr(isSelected(itemValue))}>
361
362
  {#snippet child({ props })}
362
- {@render itemSnippet?.({ item, props })}
363
+ {@render itemSnippet?.({ item: item as TItem, props })}
363
364
  {/snippet}
364
365
  </CommandPrimitive.Item>
365
366
  {:else}
@@ -412,7 +413,7 @@
412
413
  {@render renderTrigger()}
413
414
 
414
415
  <PopoverPrimitive.Portal disabled={portalDisabled}>
415
- <PopoverPrimitive.Content class="cgui:overflow-hidden cgui:rounded-md">
416
+ <PopoverPrimitive.Content class={cn('cgui:overflow-hidden cgui:rounded-md', contentClass)}>
416
417
  <CommandPrimitive.Root shouldFilter={false} class="cgui:max-h-80">
417
418
  <CommandPrimitive.Input bind:value={searchValue} placeholder={searchPlaceholder} />
418
419
 
@@ -1,4 +1,26 @@
1
+ import type { CommandItem } from '../../../command/index.js';
1
2
  import type { ComboboxAsyncProps } from '../../types.js';
2
- declare const Combobox: import("svelte").Component<ComboboxAsyncProps, {}, "value" | "open" | "items" | "searchValue">;
3
- type Combobox = ReturnType<typeof Combobox>;
3
+ declare function $$render<TItem extends CommandItem>(): {
4
+ props: ComboboxAsyncProps<TItem>;
5
+ exports: {};
6
+ bindings: "value" | "open" | "items" | "searchValue";
7
+ slots: {};
8
+ events: {};
9
+ };
10
+ declare class __sveltets_Render<TItem extends CommandItem> {
11
+ props(): ReturnType<typeof $$render<TItem>>['props'];
12
+ events(): ReturnType<typeof $$render<TItem>>['events'];
13
+ slots(): ReturnType<typeof $$render<TItem>>['slots'];
14
+ bindings(): "value" | "open" | "items" | "searchValue";
15
+ exports(): {};
16
+ }
17
+ interface $$IsomorphicComponent {
18
+ new <TItem extends CommandItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TItem>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TItem>['props']>, ReturnType<__sveltets_Render<TItem>['events']>, ReturnType<__sveltets_Render<TItem>['slots']>> & {
19
+ $$bindings?: ReturnType<__sveltets_Render<TItem>['bindings']>;
20
+ } & ReturnType<__sveltets_Render<TItem>['exports']>;
21
+ <TItem extends CommandItem>(internal: unknown, props: ReturnType<__sveltets_Render<TItem>['props']> & {}): ReturnType<__sveltets_Render<TItem>['exports']>;
22
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
23
+ }
24
+ declare const Combobox: $$IsomorphicComponent;
25
+ type Combobox<TItem extends CommandItem> = InstanceType<typeof Combobox<TItem>>;
4
26
  export default Combobox;
@@ -38,6 +38,7 @@
38
38
  fullWidth = true,
39
39
  closeOnSelect,
40
40
  maxContentHeight,
41
+ contentClass,
41
42
  onSelect = noop,
42
43
  ...restProps
43
44
  }: ComboboxProps = $props();
@@ -83,7 +84,7 @@
83
84
  return typeof value === 'string' && value.trim() !== '';
84
85
  });
85
86
 
86
- function onSelectItem(item: Omit<CommandItem, 'onSelect'>) {
87
+ function onSelectItem(item: CommandItem) {
87
88
  if (Array.isArray(value)) {
88
89
  let result = value;
89
90
  if (value.includes(item.value)) {
@@ -208,7 +209,7 @@
208
209
  {@render renderTrigger()}
209
210
 
210
211
  <PopoverPrimitive.Portal disabled={portalDisabled}>
211
- <PopoverPrimitive.Content class="cgui:overflow-hidden cgui:rounded-md">
212
+ <PopoverPrimitive.Content class={cn('cgui:overflow-hidden cgui:rounded-md', contentClass)}>
212
213
  <CommandPrimitive.Root>
213
214
  <CommandPrimitive.Input bind:value={searchValue} placeholder={searchPlaceholder} />
214
215
 
@@ -16,6 +16,7 @@ type ComboboxBaseProps = PrimitivePopoverRootProps & ComboboxTriggerVariantsProp
16
16
  portalDisabled?: boolean;
17
17
  allowDeselect?: boolean;
18
18
  triggerClass?: string;
19
+ contentClass?: string;
19
20
  closeOnSelect?: boolean;
20
21
  maxContentHeight?: string;
21
22
  clearable?: boolean;
@@ -50,13 +51,19 @@ export type ComboboxAsyncCallbackParams = {
50
51
  pageSize: number;
51
52
  search: string;
52
53
  };
53
- export type ComboboxAsyncCallbackResult = {
54
- items: CommandItem[];
54
+ export type ComboboxAsyncCallbackResult<TItem extends CommandItem> = {
55
+ items: TItem[];
55
56
  hasMore: boolean;
56
57
  };
57
- export type ComboboxAsyncCallback = (params: ComboboxAsyncCallbackParams) => Promise<ComboboxAsyncCallbackResult>;
58
- type ComboboxAsyncBaseProps = Omit<ComboboxBaseProps, 'collection'> & {
59
- items?: CommandItem[];
58
+ export type ComboboxAsyncCallback<TItem extends CommandItem = CommandItem> = (params: ComboboxAsyncCallbackParams) => Promise<ComboboxAsyncCallbackResult<TItem>>;
59
+ type ComboboxAsyncBaseProps<TItem extends CommandItem> = Omit<ComboboxBaseProps, 'collection' | 'item' | 'onSelect'> & {
60
+ items?: TItem[];
61
+ item?: Snippet<[{
62
+ item: TItem;
63
+ props: Record<string, unknown>;
64
+ }]>;
65
+ /** Callback when selection changes */
66
+ onSelect?: (value: string | string[], item: TItem | null) => void;
60
67
  /** Loading state renderer */
61
68
  loading?: Snippet;
62
69
  /** Current page (default: 1) */
@@ -64,7 +71,7 @@ type ComboboxAsyncBaseProps = Omit<ComboboxBaseProps, 'collection'> & {
64
71
  /** Page size for pagination (default: 20) */
65
72
  pageSize?: number;
66
73
  /** Async data callback */
67
- callback: ComboboxAsyncCallback;
74
+ callback: ComboboxAsyncCallback<TItem>;
68
75
  /** Load immediate data when combobox is mounted (default: true) */
69
76
  loadImmediate?: boolean;
70
77
  /** Group definitions (for labels/ordering) */
@@ -82,15 +89,15 @@ type ComboboxAsyncBaseProps = Omit<ComboboxBaseProps, 'collection'> & {
82
89
  */
83
90
  clearOnDependencyChange?: boolean;
84
91
  };
85
- type ComboboxAsyncSingleProps = ComboboxAsyncBaseProps & {
92
+ type ComboboxAsyncSingleProps<TItem extends CommandItem> = ComboboxAsyncBaseProps<TItem> & {
86
93
  /** Selection mode (default: 'single') */
87
94
  type?: 'single';
88
95
  value?: string;
89
96
  };
90
- type ComboboxAsyncMultipleProps = ComboboxAsyncBaseProps & {
97
+ type ComboboxAsyncMultipleProps<TItem extends CommandItem> = ComboboxAsyncBaseProps<TItem> & {
91
98
  /** Selection mode */
92
99
  type: 'multiple';
93
100
  value?: string[];
94
101
  };
95
- export type ComboboxAsyncProps = ComboboxAsyncSingleProps | ComboboxAsyncMultipleProps;
102
+ export type ComboboxAsyncProps<TItem extends CommandItem> = ComboboxAsyncSingleProps<TItem> | ComboboxAsyncMultipleProps<TItem>;
96
103
  export {};
@@ -32,6 +32,7 @@ export type CommandItem = {
32
32
  /** Group key for grouping */
33
33
  group?: string;
34
34
  onSelect?: () => void;
35
+ [key: string]: unknown;
35
36
  };
36
37
  export type CommandGroup = {
37
38
  value: string;
@@ -0,0 +1,30 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveClearTriggerStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveClearTriggerProps } from '../types.js';
5
+ import { FileUploadRootContext } from './file-upload.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ children,
10
+ class: className,
11
+ ...restProps
12
+ }: FileUploadPrimitiveClearTriggerProps = $props();
13
+
14
+ const rootState = FileUploadRootContext.get();
15
+
16
+ function handleClick() {
17
+ rootState.clearFiles();
18
+ }
19
+ </script>
20
+
21
+ <button
22
+ bind:this={ref}
23
+ type="button"
24
+ class={cn(fileUploadPrimitiveClearTriggerStyles(), className)}
25
+ data-slot="file-upload-clear-trigger"
26
+ onclick={handleClick}
27
+ {...restProps}
28
+ >
29
+ {@render children?.()}
30
+ </button>
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveClearTriggerProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveClearTriggerProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import type { FileUploadPrimitiveContextProps } from '../types.js';
3
+ import { FileUploadRootContext } from './file-upload.svelte.js';
4
+
5
+ const { children }: FileUploadPrimitiveContextProps = $props();
6
+
7
+ const context = FileUploadRootContext.get();
8
+ </script>
9
+
10
+ {@render children?.(context)}
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveContextProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveContextProps, {}, "">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveDropzoneStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveDropzoneProps } from '../types.js';
5
+ import { FileUploadRootContext } from './file-upload.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ disableClick = false,
10
+ children,
11
+ class: className,
12
+ ...restProps
13
+ }: FileUploadPrimitiveDropzoneProps = $props();
14
+
15
+ const rootState = FileUploadRootContext.get();
16
+
17
+ function handleDragEnter(e: DragEvent) {
18
+ e.preventDefault();
19
+ e.stopPropagation();
20
+ rootState.dragging = true;
21
+ }
22
+
23
+ function handleDragLeave(e: DragEvent) {
24
+ e.preventDefault();
25
+ e.stopPropagation();
26
+ rootState.dragging = false;
27
+ }
28
+
29
+ function handleDragOver(e: DragEvent) {
30
+ e.preventDefault();
31
+ e.stopPropagation();
32
+ }
33
+
34
+ function handleDrop(e: DragEvent) {
35
+ e.preventDefault();
36
+ e.stopPropagation();
37
+ rootState.dragging = false;
38
+
39
+ if (e.dataTransfer?.files) {
40
+ rootState.addFiles(e.dataTransfer.files);
41
+ }
42
+ }
43
+
44
+ function handleClick() {
45
+ if (!disableClick) {
46
+ rootState.openFilePicker();
47
+ }
48
+ }
49
+ </script>
50
+
51
+ <div
52
+ bind:this={ref}
53
+ role="presentation"
54
+ class={cn(
55
+ fileUploadPrimitiveDropzoneStyles({
56
+ dragging: rootState.dragging,
57
+ invalid: rootState.opts.invalid.current,
58
+ disabled: rootState.opts.disabled.current,
59
+ }),
60
+ className,
61
+ )}
62
+ data-slot="file-upload-dropzone"
63
+ data-dragging={rootState.dragging || undefined}
64
+ ondragenter={handleDragEnter}
65
+ ondragleave={handleDragLeave}
66
+ ondragover={handleDragOver}
67
+ ondrop={handleDrop}
68
+ onclick={handleClick}
69
+ {...restProps}
70
+ >
71
+ {@render children?.()}
72
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveDropzoneProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveDropzoneProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,35 @@
1
+ <script lang="ts">
2
+ import type { FileUploadPrimitiveHiddenInputProps } from '../types.js';
3
+ import { FileUploadRootContext } from './file-upload.svelte.js';
4
+
5
+ let { ref = $bindable(null), ...restProps }: FileUploadPrimitiveHiddenInputProps = $props();
6
+
7
+ const rootState = FileUploadRootContext.get();
8
+
9
+ let inputEl = $state<HTMLInputElement | null>(null);
10
+
11
+ $effect(() => {
12
+ rootState.setHiddenInput(inputEl);
13
+ });
14
+
15
+ function handleChange(e: Event) {
16
+ const input = e.target as HTMLInputElement;
17
+ if (input.files) {
18
+ rootState.addFiles(input.files);
19
+ input.value = '';
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <input
25
+ bind:this={inputEl}
26
+ type="file"
27
+ tabindex={-1}
28
+ style="position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;"
29
+ data-slot="file-upload-hidden-input"
30
+ accept={rootState.opts.accept.current}
31
+ multiple={rootState.opts.maxFiles.current > 1}
32
+ disabled={rootState.opts.disabled.current}
33
+ onchange={handleChange}
34
+ {...restProps}
35
+ />
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveHiddenInputProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveHiddenInputProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveItemDeleteTriggerStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveItemDeleteTriggerProps } from '../types.js';
5
+ import { FileUploadItemContext, FileUploadRootContext } from './file-upload.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ children,
10
+ class: className,
11
+ ...restProps
12
+ }: FileUploadPrimitiveItemDeleteTriggerProps = $props();
13
+
14
+ const rootState = FileUploadRootContext.get();
15
+ const itemState = FileUploadItemContext.get();
16
+
17
+ function handleClick() {
18
+ rootState.removeFile(itemState.opts.file.current);
19
+ }
20
+ </script>
21
+
22
+ <button
23
+ bind:this={ref}
24
+ type="button"
25
+ class={cn(fileUploadPrimitiveItemDeleteTriggerStyles(), className)}
26
+ data-slot="file-upload-item-delete-trigger"
27
+ onclick={handleClick}
28
+ {...restProps}
29
+ >
30
+ {@render children?.()}
31
+ </button>
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveItemDeleteTriggerProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveItemDeleteTriggerProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveItemGroupStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveItemGroupProps } from '../types.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ children,
9
+ class: className,
10
+ ...restProps
11
+ }: FileUploadPrimitiveItemGroupProps = $props();
12
+ </script>
13
+
14
+ <ul
15
+ bind:this={ref}
16
+ class={cn(fileUploadPrimitiveItemGroupStyles(), className)}
17
+ data-slot="file-upload-item-group"
18
+ {...restProps}
19
+ >
20
+ {@render children?.()}
21
+ </ul>
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveItemGroupProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveItemGroupProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveItemNameStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveItemNameProps } from '../types.js';
5
+ import { FileUploadItemContext } from './file-upload.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ children,
10
+ class: className,
11
+ ...restProps
12
+ }: FileUploadPrimitiveItemNameProps = $props();
13
+
14
+ const itemState = FileUploadItemContext.get();
15
+ </script>
16
+
17
+ <div
18
+ bind:this={ref}
19
+ class={cn(fileUploadPrimitiveItemNameStyles(), className)}
20
+ data-slot="file-upload-item-name"
21
+ {...restProps}
22
+ >
23
+ {#if children}
24
+ {@render children()}
25
+ {:else}
26
+ {itemState.opts.file.current.name}
27
+ {/if}
28
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveItemNameProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveItemNameProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveItemPreviewImageStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveItemPreviewImageProps } from '../types.js';
5
+ import { FileUploadItemContext } from './file-upload.svelte.js';
6
+
7
+ let { ref = $bindable(null), class: className, ...restProps }: FileUploadPrimitiveItemPreviewImageProps = $props();
8
+
9
+ const itemState = FileUploadItemContext.get();
10
+
11
+ let url = $state<string | undefined>(undefined);
12
+
13
+ $effect(() => {
14
+ const file = itemState.opts.file.current;
15
+ const objectUrl = URL.createObjectURL(file);
16
+ url = objectUrl;
17
+
18
+ return () => {
19
+ URL.revokeObjectURL(objectUrl);
20
+ };
21
+ });
22
+ </script>
23
+
24
+ {#if url}
25
+ <img
26
+ bind:this={ref}
27
+ src={url}
28
+ alt={itemState.opts.file.current.name}
29
+ class={cn(fileUploadPrimitiveItemPreviewImageStyles(), className)}
30
+ data-slot="file-upload-item-preview-image"
31
+ {...restProps}
32
+ />
33
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveItemPreviewImageProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveItemPreviewImageProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveItemPreviewStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveItemPreviewProps } from '../types.js';
5
+ import { FileUploadItemContext } from './file-upload.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ type = '.*',
10
+ children,
11
+ class: className,
12
+ ...restProps
13
+ }: FileUploadPrimitiveItemPreviewProps = $props();
14
+
15
+ const itemState = FileUploadItemContext.get();
16
+
17
+ const isMatch = $derived(Boolean(itemState.opts.file.current.type.match(type)));
18
+ </script>
19
+
20
+ {#if isMatch}
21
+ <div
22
+ bind:this={ref}
23
+ class={cn(fileUploadPrimitiveItemPreviewStyles(), className)}
24
+ data-slot="file-upload-item-preview"
25
+ {...restProps}
26
+ >
27
+ {@render children?.()}
28
+ </div>
29
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveItemPreviewProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveItemPreviewProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { fileUploadPrimitiveItemSizeTextStyles } from '../styles.js';
4
+ import type { FileUploadPrimitiveItemSizeTextProps } from '../types.js';
5
+ import { FileUploadItemContext, formatFileSize } from './file-upload.svelte.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ children,
10
+ class: className,
11
+ ...restProps
12
+ }: FileUploadPrimitiveItemSizeTextProps = $props();
13
+
14
+ const itemState = FileUploadItemContext.get();
15
+ </script>
16
+
17
+ <div
18
+ bind:this={ref}
19
+ class={cn(fileUploadPrimitiveItemSizeTextStyles(), className)}
20
+ data-slot="file-upload-item-size-text"
21
+ {...restProps}
22
+ >
23
+ {#if children}
24
+ {@render children()}
25
+ {:else}
26
+ {formatFileSize(itemState.opts.file.current.size)}
27
+ {/if}
28
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { FileUploadPrimitiveItemSizeTextProps } from '../types.js';
2
+ declare const FileUpload: import("svelte").Component<FileUploadPrimitiveItemSizeTextProps, {}, "ref">;
3
+ type FileUpload = ReturnType<typeof FileUpload>;
4
+ export default FileUpload;
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { box } from 'svelte-toolbelt';
4
+ import { fileUploadPrimitiveItemStyles } from '../styles.js';
5
+ import type { FileUploadPrimitiveItemProps } from '../types.js';
6
+ import { FileUploadItemState } from './file-upload.svelte.js';
7
+
8
+ let {
9
+ ref = $bindable(null),
10
+ file,
11
+ children,
12
+ class: className,
13
+ variant = 'default',
14
+ ...restProps
15
+ }: FileUploadPrimitiveItemProps = $props();
16
+
17
+ FileUploadItemState.create({
18
+ file: box.with(() => file),
19
+ });
20
+ </script>
21
+
22
+ <li
23
+ bind:this={ref}
24
+ class={cn(fileUploadPrimitiveItemStyles({ variant }), className)}
25
+ data-slot="file-upload-item"
26
+ {...restProps}
27
+ >
28
+ {@render children?.()}
29
+ </li>