compote-ui 0.31.0 → 0.32.0

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 (93) hide show
  1. package/dist/components/button/button.svelte +2 -1
  2. package/dist/components/button/button.svelte.d.ts +2 -1
  3. package/dist/components/button/link-button.svelte +2 -1
  4. package/dist/components/button/link-button.svelte.d.ts +2 -1
  5. package/dist/components/collapsible/collapsible-content.svelte +2 -1
  6. package/dist/components/collapsible/collapsible-content.svelte.d.ts +2 -1
  7. package/dist/components/collapsible/collapsible-indicator.svelte +2 -1
  8. package/dist/components/collapsible/collapsible-indicator.svelte.d.ts +2 -1
  9. package/dist/components/collapsible/collapsible-root.svelte +2 -1
  10. package/dist/components/collapsible/collapsible-root.svelte.d.ts +2 -1
  11. package/dist/components/collapsible/collapsible-trigger.svelte +2 -1
  12. package/dist/components/collapsible/collapsible-trigger.svelte.d.ts +2 -1
  13. package/dist/components/combobox/combobox.svelte +1 -1
  14. package/dist/components/dialog/alert-dialog.svelte +2 -2
  15. package/dist/components/dialog/dialog-close-trigger.svelte +2 -1
  16. package/dist/components/dialog/dialog-close-trigger.svelte.d.ts +2 -1
  17. package/dist/components/dialog/dialog-description.svelte +2 -1
  18. package/dist/components/dialog/dialog-description.svelte.d.ts +2 -1
  19. package/dist/components/dialog/dialog-footer.svelte +2 -1
  20. package/dist/components/dialog/dialog-footer.svelte.d.ts +2 -1
  21. package/dist/components/dialog/{dialog.svelte → dialog-root.svelte} +33 -33
  22. package/dist/components/dialog/dialog-root.svelte.d.ts +4 -0
  23. package/dist/components/dialog/dialog-title.svelte +2 -1
  24. package/dist/components/dialog/dialog-title.svelte.d.ts +2 -1
  25. package/dist/components/dialog/dialog-trigger.svelte +2 -1
  26. package/dist/components/dialog/dialog-trigger.svelte.d.ts +2 -1
  27. package/dist/components/dialog/dialog.types.d.ts +2 -1
  28. package/dist/components/dialog/index.d.ts +1 -1
  29. package/dist/components/dialog/index.js +1 -1
  30. package/dist/components/drawer/drawer-backdrop.svelte +12 -30
  31. package/dist/components/drawer/drawer-backdrop.svelte.d.ts +2 -1
  32. package/dist/components/drawer/drawer-close-trigger.svelte +2 -2
  33. package/dist/components/drawer/drawer-close-trigger.svelte.d.ts +2 -1
  34. package/dist/components/drawer/drawer-content.svelte +10 -3
  35. package/dist/components/drawer/drawer-content.svelte.d.ts +2 -1
  36. package/dist/components/drawer/drawer-grabber-indicator.svelte +4 -2
  37. package/dist/components/drawer/drawer-grabber-indicator.svelte.d.ts +2 -1
  38. package/dist/components/drawer/drawer-grabber.svelte +7 -3
  39. package/dist/components/drawer/drawer-grabber.svelte.d.ts +2 -1
  40. package/dist/components/drawer/drawer-positioner.svelte +10 -3
  41. package/dist/components/drawer/drawer-positioner.svelte.d.ts +2 -1
  42. package/dist/components/drawer/drawer-root.svelte +2 -6
  43. package/dist/components/drawer/drawer-title.svelte +4 -2
  44. package/dist/components/drawer/drawer-title.svelte.d.ts +2 -1
  45. package/dist/components/drawer/drawer-trigger.svelte +2 -1
  46. package/dist/components/drawer/drawer-trigger.svelte.d.ts +2 -1
  47. package/dist/components/field/field-input.svelte +8 -6
  48. package/dist/components/field/types.d.ts +7 -6
  49. package/dist/components/fieldset/types.d.ts +5 -4
  50. package/dist/components/listbox/listbox-content.svelte +2 -1
  51. package/dist/components/listbox/listbox-content.svelte.d.ts +2 -1
  52. package/dist/components/listbox/listbox-empty.svelte +2 -1
  53. package/dist/components/listbox/listbox-empty.svelte.d.ts +2 -1
  54. package/dist/components/listbox/listbox-input.svelte +2 -1
  55. package/dist/components/listbox/listbox-input.svelte.d.ts +2 -1
  56. package/dist/components/listbox/listbox-item-group-label.svelte +2 -1
  57. package/dist/components/listbox/listbox-item-group-label.svelte.d.ts +2 -1
  58. package/dist/components/listbox/listbox-item-group.svelte +2 -1
  59. package/dist/components/listbox/listbox-item-group.svelte.d.ts +2 -1
  60. package/dist/components/listbox/listbox-item-indicator.svelte +2 -1
  61. package/dist/components/listbox/listbox-item-indicator.svelte.d.ts +2 -1
  62. package/dist/components/listbox/listbox-item-text.svelte +2 -1
  63. package/dist/components/listbox/listbox-item-text.svelte.d.ts +2 -1
  64. package/dist/components/listbox/listbox-item.svelte +2 -1
  65. package/dist/components/listbox/listbox-item.svelte.d.ts +2 -1
  66. package/dist/components/listbox/listbox-label.svelte +2 -1
  67. package/dist/components/listbox/listbox-label.svelte.d.ts +2 -1
  68. package/dist/components/listbox/listbox-root.svelte +2 -1
  69. package/dist/components/listbox/listbox-root.svelte.d.ts +2 -1
  70. package/dist/components/listbox/listbox-value-text.svelte +2 -1
  71. package/dist/components/listbox/listbox-value-text.svelte.d.ts +2 -1
  72. package/dist/components/select/select.svelte +1 -1
  73. package/dist/components/toggle/toggle.svelte +17 -0
  74. package/dist/components/toggle/toggle.svelte.d.ts +4 -0
  75. package/dist/components/toggle/toggle.variants.d.ts +21 -0
  76. package/dist/components/toggle/toggle.variants.js +12 -0
  77. package/dist/components/toggle/types.d.ts +8 -0
  78. package/dist/components/toggle/types.js +1 -0
  79. package/dist/components/toggle-group/toggle-group-context.d.ts +8 -0
  80. package/dist/components/toggle-group/toggle-group-context.js +2 -0
  81. package/dist/components/toggle-group/toggle-group-item.svelte +7 -6
  82. package/dist/components/toggle-group/toggle-group-item.svelte.d.ts +2 -0
  83. package/dist/components/toggle-group/toggle-group.svelte +17 -2
  84. package/dist/components/toggle-group/toggle-group.svelte.d.ts +2 -0
  85. package/dist/components/tooltip/tooltip-content.svelte +2 -2
  86. package/dist/components/tooltip/tooltip-trigger.svelte +2 -4
  87. package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +2 -4
  88. package/dist/components/tree-view/tree-view.svelte +1 -1
  89. package/dist/index.d.ts +2 -0
  90. package/dist/index.js +1 -0
  91. package/dist/theme.css +1 -1
  92. package/package.json +2 -1
  93. package/dist/components/dialog/dialog.svelte.d.ts +0 -5
@@ -1,18 +1,14 @@
1
1
  <script lang="ts">
2
2
  import { Drawer } from '@ark-ui/svelte/drawer';
3
- import type { DrawerRootProps, DrawerOpenChangeDetails } from '@ark-ui/svelte/drawer';
3
+ import type { DrawerRootProps } from '@ark-ui/svelte/drawer';
4
4
 
5
5
  interface Props extends Omit<DrawerRootProps, 'open' | 'onOpenChange'> {
6
6
  open?: boolean;
7
7
  }
8
8
 
9
9
  let { children, open = $bindable(), ...rest }: Props = $props();
10
-
11
- const handleOpenChange = (details: DrawerOpenChangeDetails) => {
12
- open = details.open;
13
- };
14
10
  </script>
15
11
 
16
- <Drawer.Root {open} onOpenChange={handleOpenChange} {...rest}>
12
+ <Drawer.Root bind:open {...rest}>
17
13
  {@render children?.()}
18
14
  </Drawer.Root>
@@ -1,14 +1,16 @@
1
1
  <script lang="ts">
2
2
  import { Drawer } from '@ark-ui/svelte/drawer';
3
3
  import type { DrawerTitleBaseProps } from '@ark-ui/svelte/drawer';
4
+ import type { ClassValue } from 'svelte/elements';
5
+ import { cn } from 'tailwind-variants';
4
6
 
5
7
  interface Props extends DrawerTitleBaseProps {
6
- class?: string;
8
+ class?: ClassValue;
7
9
  }
8
10
 
9
11
  let { class: className, children, ...rest }: Props = $props();
10
12
  </script>
11
13
 
12
- <Drawer.Title {...rest} class={className ?? 'mb-2 text-lg leading-7 font-medium text-ink'}>
14
+ <Drawer.Title {...rest} class={cn('mb-2 text-lg leading-7 font-medium text-ink', className)}>
13
15
  {@render children?.()}
14
16
  </Drawer.Title>
@@ -1,6 +1,7 @@
1
1
  import type { DrawerTitleBaseProps } from '@ark-ui/svelte/drawer';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  interface Props extends DrawerTitleBaseProps {
3
- class?: string;
4
+ class?: ClassValue;
4
5
  }
5
6
  declare const DrawerTitle: import("svelte").Component<Props, {}, "">;
6
7
  type DrawerTitle = ReturnType<typeof DrawerTitle>;
@@ -1,9 +1,10 @@
1
1
  <script lang="ts">
2
2
  import { Drawer } from '@ark-ui/svelte/drawer';
3
3
  import type { DrawerTriggerBaseProps } from '@ark-ui/svelte/drawer';
4
+ import type { ClassValue } from 'svelte/elements';
4
5
 
5
6
  interface Props extends DrawerTriggerBaseProps {
6
- class?: string;
7
+ class?: ClassValue;
7
8
  }
8
9
 
9
10
  let { class: className, children, ...rest }: Props = $props();
@@ -1,6 +1,7 @@
1
1
  import type { DrawerTriggerBaseProps } from '@ark-ui/svelte/drawer';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  interface Props extends DrawerTriggerBaseProps {
3
- class?: string;
4
+ class?: ClassValue;
4
5
  }
5
6
  declare const DrawerTrigger: import("svelte").Component<Props, {}, "">;
6
7
  type DrawerTrigger = ReturnType<typeof DrawerTrigger>;
@@ -14,10 +14,10 @@
14
14
 
15
15
  <div class="relative w-full">
16
16
  {#if startIcon}
17
- <div
18
- class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2.5 text-ink-dim"
19
- >
20
- {@render startIcon()}
17
+ <div class="pointer-events-none absolute inset-y-0 left-0 flex items-center p-0.5 text-ink-dim">
18
+ <div class="flex h-full min-w-8 items-center justify-center">
19
+ {@render startIcon()}
20
+ </div>
21
21
  </div>
22
22
  {/if}
23
23
  <Field.Input
@@ -31,8 +31,10 @@
31
31
  )}
32
32
  />
33
33
  {#if endIcon}
34
- <div class="absolute inset-y-0 right-0 flex items-center pr-2.5">
35
- {@render endIcon()}
34
+ <div class="absolute inset-y-0 right-0 flex items-center justify-end p-0.5">
35
+ <div class="flex h-full min-w-8 items-center justify-center">
36
+ {@render endIcon()}
37
+ </div>
36
38
  </div>
37
39
  {/if}
38
40
  </div>
@@ -1,30 +1,31 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { FieldRootBaseProps, FieldLabelBaseProps, FieldInputProps as ArkFieldInputProps, FieldTextareaProps as ArkFieldTextareaProps, FieldHelperTextBaseProps, FieldErrorTextBaseProps } from '@ark-ui/svelte/field';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  export interface FormAdapter {
4
5
  invalid(field: string): boolean;
5
6
  isRequired(field: string): boolean;
6
7
  errors: Record<string, string[]>;
7
8
  }
8
9
  export interface FieldRootProps extends FieldRootBaseProps {
9
- class?: string;
10
+ class?: ClassValue;
10
11
  form?: FormAdapter;
11
12
  field?: string;
12
13
  helperText?: string;
13
14
  }
14
15
  export interface FieldLabelProps extends FieldLabelBaseProps {
15
- class?: string;
16
+ class?: ClassValue;
16
17
  }
17
18
  export interface FieldInputProps extends ArkFieldInputProps {
18
- class?: string;
19
+ class?: ClassValue;
19
20
  startIcon?: Snippet;
20
21
  endIcon?: Snippet;
21
22
  }
22
23
  export interface FieldTextareaProps extends ArkFieldTextareaProps {
23
- class?: string;
24
+ class?: ClassValue;
24
25
  }
25
26
  export interface FieldHelperTextProps extends FieldHelperTextBaseProps {
26
- class?: string;
27
+ class?: ClassValue;
27
28
  }
28
29
  export interface FieldErrorTextProps extends FieldErrorTextBaseProps {
29
- class?: string;
30
+ class?: ClassValue;
30
31
  }
@@ -1,13 +1,14 @@
1
1
  import type { FieldsetRootBaseProps, FieldsetLegendBaseProps, FieldsetHelperTextBaseProps, FieldsetErrorTextBaseProps } from '@ark-ui/svelte/fieldset';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  export interface FieldsetRootProps extends FieldsetRootBaseProps {
3
- class?: string;
4
+ class?: ClassValue;
4
5
  }
5
6
  export interface FieldsetLegendProps extends FieldsetLegendBaseProps {
6
- class?: string;
7
+ class?: ClassValue;
7
8
  }
8
9
  export interface FieldsetHelperTextProps extends FieldsetHelperTextBaseProps {
9
- class?: string;
10
+ class?: ClassValue;
10
11
  }
11
12
  export interface FieldsetErrorTextProps extends FieldsetErrorTextBaseProps {
12
- class?: string;
13
+ class?: ClassValue;
13
14
  }
@@ -5,9 +5,10 @@
5
5
  import type { ListItem } from '../../utils/collections';
6
6
  import { cn } from 'tailwind-variants';
7
7
  import { getListboxContext } from './listbox-context';
8
+ import type { ClassValue } from 'svelte/elements';
8
9
 
9
10
  type Props = ListboxContentBaseProps & {
10
- class?: string;
11
+ class?: ClassValue;
11
12
  items?: Snippet<[{ items: ListItem[]; group: [string, ListItem[]][] }]>;
12
13
  };
13
14
 
@@ -1,8 +1,9 @@
1
1
  import type { ListboxContentBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { ListItem } from '../../utils/collections';
4
+ import type { ClassValue } from 'svelte/elements';
4
5
  type Props = ListboxContentBaseProps & {
5
- class?: string;
6
+ class?: ClassValue;
6
7
  items?: Snippet<[{
7
8
  items: ListItem[];
8
9
  group: [string, ListItem[]][];
@@ -2,10 +2,11 @@
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxEmptyBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import type { Snippet } from 'svelte';
5
+ import type { ClassValue } from 'svelte/elements';
5
6
  import { cn } from 'tailwind-variants';
6
7
 
7
8
  type Props = ListboxEmptyBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  children?: Snippet;
10
11
  };
11
12
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxEmptyBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxEmptyBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxEmpty: import("svelte").Component<Props, {}, "">;
@@ -3,9 +3,10 @@
3
3
  import type { ListboxInputBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import { cn } from 'tailwind-variants';
5
5
  import { getListboxContext } from './listbox-context';
6
+ import type { ClassValue } from 'svelte/elements';
6
7
 
7
8
  type Props = ListboxInputBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  placeholder?: string;
10
11
  oninput?: (event: Event & { currentTarget: HTMLInputElement }) => void;
11
12
  };
@@ -1,6 +1,7 @@
1
1
  import type { ListboxInputBaseProps } from '@ark-ui/svelte/listbox';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  type Props = ListboxInputBaseProps & {
3
- class?: string;
4
+ class?: ClassValue;
4
5
  placeholder?: string;
5
6
  oninput?: (event: Event & {
6
7
  currentTarget: HTMLInputElement;
@@ -2,10 +2,11 @@
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxItemGroupLabelBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import type { Snippet } from 'svelte';
5
+ import type { ClassValue } from 'svelte/elements';
5
6
  import { cn } from 'tailwind-variants';
6
7
 
7
8
  type Props = ListboxItemGroupLabelBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  children?: Snippet;
10
11
  };
11
12
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxItemGroupLabelBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxItemGroupLabelBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxItemGroupLabel: import("svelte").Component<Props, {}, "">;
@@ -2,10 +2,11 @@
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxItemGroupBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import type { Snippet } from 'svelte';
5
+ import type { ClassValue } from 'svelte/elements';
5
6
  import { cn } from 'tailwind-variants';
6
7
 
7
8
  type Props = ListboxItemGroupBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  children?: Snippet;
10
11
  };
11
12
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxItemGroupBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxItemGroupBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxItemGroup: import("svelte").Component<Props, {}, "">;
@@ -4,9 +4,10 @@
4
4
  import type { Snippet } from 'svelte';
5
5
  import { cn } from 'tailwind-variants';
6
6
  import { PhCheck } from '../../icons';
7
+ import type { ClassValue } from 'svelte/elements';
7
8
 
8
9
  type Props = ListboxItemIndicatorBaseProps & {
9
- class?: string;
10
+ class?: ClassValue;
10
11
  children?: Snippet;
11
12
  };
12
13
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxItemIndicatorBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxItemIndicatorBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxItemIndicator: import("svelte").Component<Props, {}, "">;
@@ -2,10 +2,11 @@
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxItemTextBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import type { Snippet } from 'svelte';
5
+ import type { ClassValue } from 'svelte/elements';
5
6
  import { cn } from 'tailwind-variants';
6
7
 
7
8
  type Props = ListboxItemTextBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  children?: Snippet;
10
11
  };
11
12
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxItemTextBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxItemTextBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxItemText: import("svelte").Component<Props, {}, "">;
@@ -2,10 +2,11 @@
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxItemBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import type { Snippet } from 'svelte';
5
+ import type { ClassValue } from 'svelte/elements';
5
6
  import { cn } from 'tailwind-variants';
6
7
 
7
8
  type Props = ListboxItemBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  children?: Snippet;
10
11
  };
11
12
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxItemBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxItemBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxItem: import("svelte").Component<Props, {}, "">;
@@ -2,10 +2,11 @@
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxLabelBaseProps } from '@ark-ui/svelte/listbox';
4
4
  import type { Snippet } from 'svelte';
5
+ import type { ClassValue } from 'svelte/elements';
5
6
  import { cn } from 'tailwind-variants';
6
7
 
7
8
  type Props = ListboxLabelBaseProps & {
8
- class?: string;
9
+ class?: ClassValue;
9
10
  children?: Snippet;
10
11
  };
11
12
 
@@ -1,7 +1,8 @@
1
1
  import type { ListboxLabelBaseProps } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
3
4
  type Props = ListboxLabelBaseProps & {
4
- class?: string;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  };
7
8
  declare const ListboxLabel: import("svelte").Component<Props, {}, "">;
@@ -7,12 +7,13 @@
7
7
  import type { ListItem } from '../../utils/collections';
8
8
  import { cn } from 'tailwind-variants';
9
9
  import { setListboxContext } from './listbox-context';
10
+ import type { ClassValue } from 'svelte/elements';
10
11
 
11
12
  type Props = Omit<ListboxRootBaseProps<ListItem<T>>, 'collection' | 'value'> & {
12
13
  items: ListItem<T>[];
13
14
  value?: T[];
14
15
  name?: string;
15
- class?: string;
16
+ class?: ClassValue;
16
17
  children?: Snippet;
17
18
  };
18
19
 
@@ -1,12 +1,13 @@
1
1
  import { Listbox } from '@ark-ui/svelte/listbox';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { ListItem } from '../../utils/collections';
4
+ import type { ClassValue } from 'svelte/elements';
4
5
  declare function $$render<T extends string | number = string>(): {
5
6
  props: Omit<Listbox.RootBaseProps<ListItem<T>>, "value" | "collection"> & {
6
7
  items: ListItem<T>[];
7
8
  value?: T[];
8
9
  name?: string;
9
- class?: string;
10
+ class?: ClassValue;
10
11
  children?: Snippet;
11
12
  };
12
13
  exports: {};
@@ -1,10 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { Listbox } from '@ark-ui/svelte/listbox';
3
3
  import type { ListboxValueTextBaseProps } from '@ark-ui/svelte/listbox';
4
+ import type { ClassValue } from 'svelte/elements';
4
5
  import { cn } from 'tailwind-variants';
5
6
 
6
7
  type Props = ListboxValueTextBaseProps & {
7
- class?: string;
8
+ class?: ClassValue;
8
9
  };
9
10
 
10
11
  let { class: className, ...restProps }: Props = $props();
@@ -1,6 +1,7 @@
1
1
  import type { ListboxValueTextBaseProps } from '@ark-ui/svelte/listbox';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  type Props = ListboxValueTextBaseProps & {
3
- class?: string;
4
+ class?: ClassValue;
4
5
  };
5
6
  declare const ListboxValueText: import("svelte").Component<Props, {}, "">;
6
7
  type ListboxValueText = ReturnType<typeof ListboxValueText>;
@@ -65,7 +65,7 @@
65
65
  <Portal>
66
66
  <Select.Positioner>
67
67
  <Select.Content
68
- class="data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 z-50 max-h-60 min-w-(--reference-width) overflow-auto rounded-md border bg-surface-document p-1 text-ink shadow-md"
68
+ class="z-50 max-h-60 min-w-(--reference-width) overflow-auto rounded-md border bg-surface-document p-1 text-ink shadow-md data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95"
69
69
  >
70
70
  <Select.ItemGroup>
71
71
  {#each items as item (item.value)}
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import { Toggle as ArkToggle } from '@ark-ui/svelte/toggle';
3
+ import type { ToggleProps } from './types';
4
+ import { toggle } from './toggle.variants';
5
+
6
+ let {
7
+ class: className,
8
+ children,
9
+ pressed = $bindable(),
10
+ size,
11
+ ...rootProps
12
+ }: ToggleProps = $props();
13
+ </script>
14
+
15
+ <ArkToggle.Root {...rootProps} bind:pressed class={toggle({ size, class: className as never })}>
16
+ {@render children?.()}
17
+ </ArkToggle.Root>
@@ -0,0 +1,4 @@
1
+ import type { ToggleProps } from './types';
2
+ declare const Toggle: import("svelte").Component<ToggleProps, {}, "pressed">;
3
+ type Toggle = ReturnType<typeof Toggle>;
4
+ export default Toggle;
@@ -0,0 +1,21 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ export declare const toggle: import("tailwind-variants").TVReturnType<{
3
+ size: {
4
+ sm: string;
5
+ md: string;
6
+ lg: string;
7
+ };
8
+ }, undefined, "inline-flex cursor-pointer items-center justify-center rounded-md font-medium text-ink-dim transition-colors select-none hover:bg-surface-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-surface-2 data-pressed:text-ink data-pressed:shadow-sm data-[state=on]:bg-surface-2 data-[state=on]:text-ink data-[state=on]:shadow-sm [&_svg]:shrink-0", {
9
+ size: {
10
+ sm: string;
11
+ md: string;
12
+ lg: string;
13
+ };
14
+ }, undefined, import("tailwind-variants").TVReturnType<{
15
+ size: {
16
+ sm: string;
17
+ md: string;
18
+ lg: string;
19
+ };
20
+ }, undefined, "inline-flex cursor-pointer items-center justify-center rounded-md font-medium text-ink-dim transition-colors select-none hover:bg-surface-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-surface-2 data-pressed:text-ink data-pressed:shadow-sm data-[state=on]:bg-surface-2 data-[state=on]:text-ink data-[state=on]:shadow-sm [&_svg]:shrink-0", unknown, unknown, undefined>>;
21
+ export type ToggleSize = NonNullable<VariantProps<typeof toggle>['size']>;
@@ -0,0 +1,12 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const toggle = tv({
3
+ base: 'inline-flex cursor-pointer items-center justify-center rounded-md font-medium text-ink-dim transition-colors select-none hover:bg-surface-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:bg-surface-2 data-pressed:text-ink data-pressed:shadow-sm data-[state=on]:bg-surface-2 data-[state=on]:text-ink data-[state=on]:shadow-sm [&_svg]:shrink-0',
4
+ variants: {
5
+ size: {
6
+ sm: 'h-7 min-w-7 gap-1 px-1.5 text-xs [&_svg]:size-3.5',
7
+ md: 'h-8 min-w-8 gap-1.5 px-2 text-sm [&_svg]:size-4',
8
+ lg: 'h-10 min-w-10 gap-2 px-2.5 text-sm [&_svg]:size-5'
9
+ }
10
+ },
11
+ defaultVariants: { size: 'md' }
12
+ });
@@ -0,0 +1,8 @@
1
+ import type { ToggleRootProps } from '@ark-ui/svelte/toggle';
2
+ import type { ClassValue } from 'svelte/elements';
3
+ import type { ToggleSize } from './toggle.variants';
4
+ export interface ToggleProps extends ToggleRootProps {
5
+ class?: ClassValue | null;
6
+ size?: ToggleSize;
7
+ }
8
+ export type { ToggleSize };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { ToggleSize } from '../toggle/toggle.variants';
2
+ export declare const getToggleGroupContext: () => {
3
+ readonly size: ToggleSize;
4
+ }, setToggleGroupContext: (context: {
5
+ readonly size: ToggleSize;
6
+ }) => {
7
+ readonly size: ToggleSize;
8
+ };
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'svelte';
2
+ export const [getToggleGroupContext, setToggleGroupContext] = createContext();
@@ -1,22 +1,23 @@
1
1
  <script lang="ts">
2
2
  import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
3
3
  import type { ToggleGroupItemBaseProps } from '@ark-ui/svelte/toggle-group';
4
- import { cn } from 'tailwind-variants';
5
4
  import type { ClassValue } from 'svelte/elements';
5
+ import { toggle, type ToggleSize } from '../toggle/toggle.variants';
6
+ import { getToggleGroupContext } from './toggle-group-context';
6
7
 
7
8
  interface Props extends ToggleGroupItemBaseProps {
8
9
  class?: ClassValue | null;
10
+ size?: ToggleSize;
9
11
  }
10
12
 
11
- let { class: className, children, ...rest }: Props = $props();
13
+ let { class: className, children, size, ...rest }: Props = $props();
14
+ const groupContext = getToggleGroupContext();
15
+ const itemSize = $derived(size ?? groupContext.size);
12
16
  </script>
13
17
 
14
18
  <ToggleGroup.Item
15
19
  {...rest}
16
- class={cn(
17
- 'inline-flex h-8 min-w-8 items-center justify-center rounded-md text-sm text-ink-dim transition-colors select-none hover:bg-surface-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[state=on]:bg-surface-2 data-[state=on]:text-ink data-[state=on]:shadow-sm',
18
- className as never
19
- )}
20
+ class={toggle({ size: itemSize, class: ['rounded-none', className] as never })}
20
21
  >
21
22
  {@render children?.()}
22
23
  </ToggleGroup.Item>
@@ -1,7 +1,9 @@
1
1
  import type { ToggleGroupItemBaseProps } from '@ark-ui/svelte/toggle-group';
2
2
  import type { ClassValue } from 'svelte/elements';
3
+ import { type ToggleSize } from '../toggle/toggle.variants';
3
4
  interface Props extends ToggleGroupItemBaseProps {
4
5
  class?: ClassValue | null;
6
+ size?: ToggleSize;
5
7
  }
6
8
  declare const ToggleGroupItem: import("svelte").Component<Props, {}, "">;
7
9
  type ToggleGroupItem = ReturnType<typeof ToggleGroupItem>;
@@ -2,19 +2,34 @@
2
2
  import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
3
3
  import type { ToggleGroupRootBaseProps } from '@ark-ui/svelte/toggle-group';
4
4
  import { cn } from 'tailwind-variants';
5
+ import type { ToggleSize } from '../toggle/toggle.variants';
6
+ import { setToggleGroupContext } from './toggle-group-context';
5
7
 
6
8
  interface Props extends ToggleGroupRootBaseProps {
7
9
  class?: string;
10
+ size?: ToggleSize;
8
11
  }
9
12
 
10
- let { class: className, children, value = $bindable(), ...rootProps }: Props = $props();
13
+ let {
14
+ class: className,
15
+ children,
16
+ value = $bindable(),
17
+ size = 'md',
18
+ ...rootProps
19
+ }: Props = $props();
20
+
21
+ setToggleGroupContext({
22
+ get size() {
23
+ return size;
24
+ }
25
+ });
11
26
  </script>
12
27
 
13
28
  <ToggleGroup.Root
14
29
  {...rootProps}
15
30
  bind:value
16
31
  class={cn(
17
- 'inline-flex gap-px rounded-lg border border-border p-0.5 data-[orientation=vertical]:flex-col',
32
+ 'inline-flex w-fit rounded border border-border data-[orientation=vertical]:flex-col [&>:not([hidden])~:not([hidden])]:border-border data-[orientation=horizontal]:[&>:not([hidden])~:not([hidden])]:border-s data-[orientation=horizontal]:[&>:not([hidden])~:not([hidden])]:border-e-0 data-[orientation=vertical]:[&>:not([hidden])~:not([hidden])]:border-t data-[orientation=vertical]:[&>:not([hidden])~:not([hidden])]:border-b-0',
18
33
  className
19
34
  )}
20
35
  >
@@ -1,7 +1,9 @@
1
1
  import { ToggleGroup } from '@ark-ui/svelte/toggle-group';
2
2
  import type { ToggleGroupRootBaseProps } from '@ark-ui/svelte/toggle-group';
3
+ import type { ToggleSize } from '../toggle/toggle.variants';
3
4
  interface Props extends ToggleGroupRootBaseProps {
4
5
  class?: string;
6
+ size?: ToggleSize;
5
7
  }
6
8
  declare const ToggleGroup: import("svelte").Component<Props, {}, "value">;
7
9
  type ToggleGroup = ReturnType<typeof ToggleGroup>;