@webamoki/web-svelte 0.7.4 → 1.0.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 (120) hide show
  1. package/README.md +83 -3
  2. package/dist/components/form/Button.svelte +24 -23
  3. package/dist/components/form/Button.svelte.d.ts +2 -2
  4. package/dist/components/form/Errors.svelte +13 -13
  5. package/dist/components/form/FieldWrapper.svelte +57 -55
  6. package/dist/components/form/FieldWrapper.svelte.d.ts +4 -4
  7. package/dist/components/form/Form.svelte +18 -14
  8. package/dist/components/form/Form.svelte.d.ts +31 -22
  9. package/dist/components/form/IconInputWrapper.svelte +30 -29
  10. package/dist/components/form/IconInputWrapper.svelte.d.ts +7 -7
  11. package/dist/components/form/fields/ChoiceField.svelte +45 -43
  12. package/dist/components/form/fields/ChoiceField.svelte.d.ts +28 -23
  13. package/dist/components/form/fields/ChoiceMultiField.svelte +44 -42
  14. package/dist/components/form/fields/ChoiceMultiField.svelte.d.ts +28 -23
  15. package/dist/components/form/fields/DateField.svelte +42 -40
  16. package/dist/components/form/fields/DateField.svelte.d.ts +29 -22
  17. package/dist/components/form/fields/HexColorField.svelte +21 -19
  18. package/dist/components/form/fields/HexColorField.svelte.d.ts +24 -19
  19. package/dist/components/form/fields/MessageField.svelte +39 -60
  20. package/dist/components/form/fields/MessageField.svelte.d.ts +33 -24
  21. package/dist/components/form/fields/NumberField.svelte +38 -36
  22. package/dist/components/form/fields/NumberField.svelte.d.ts +32 -23
  23. package/dist/components/form/fields/PasswordField.svelte +45 -39
  24. package/dist/components/form/fields/PasswordField.svelte.d.ts +28 -21
  25. package/dist/components/form/fields/SelectField.svelte +84 -79
  26. package/dist/components/form/fields/SelectField.svelte.d.ts +39 -26
  27. package/dist/components/form/fields/SelectMultiField.svelte +90 -85
  28. package/dist/components/form/fields/SelectMultiField.svelte.d.ts +38 -25
  29. package/dist/components/form/fields/TextField.svelte +31 -29
  30. package/dist/components/form/fields/TextField.svelte.d.ts +32 -23
  31. package/dist/components/form/fields/TextFieldNullable.svelte +49 -47
  32. package/dist/components/form/fields/TextFieldNullable.svelte.d.ts +32 -23
  33. package/dist/components/form/fields/TimeField.svelte +66 -64
  34. package/dist/components/form/fields/TimeField.svelte.d.ts +33 -24
  35. package/dist/components/form/fields/WeekdayChoiceField.svelte +37 -35
  36. package/dist/components/form/fields/WeekdayChoiceField.svelte.d.ts +27 -22
  37. package/dist/components/form/fields/WeekdayChoiceMultiField.svelte +37 -35
  38. package/dist/components/form/fields/WeekdayChoiceMultiField.svelte.d.ts +27 -22
  39. package/dist/components/showcase/CodeBlock.svelte +41 -41
  40. package/dist/components/showcase/Container.svelte +7 -7
  41. package/dist/components/showcase/Preview.svelte +4 -4
  42. package/dist/components/showcase/Sidebar.svelte +4 -4
  43. package/dist/components/showcase/SidebarLink.svelte +3 -3
  44. package/dist/components/ui/choice/Choice.svelte +25 -22
  45. package/dist/components/ui/choice/Choice.svelte.d.ts +7 -7
  46. package/dist/components/ui/choice/ChoiceInternal.svelte +73 -69
  47. package/dist/components/ui/choice/ChoiceInternal.svelte.d.ts +9 -9
  48. package/dist/components/ui/choice/ChoiceMulti.svelte +59 -53
  49. package/dist/components/ui/choice/ChoiceMulti.svelte.d.ts +7 -7
  50. package/dist/components/ui/choice/WeekdayChoice.svelte +22 -21
  51. package/dist/components/ui/choice/WeekdayChoice.svelte.d.ts +6 -6
  52. package/dist/components/ui/choice/WeekdayChoiceMulti.svelte +24 -22
  53. package/dist/components/ui/choice/WeekdayChoiceMulti.svelte.d.ts +6 -6
  54. package/dist/components/ui/context-menu/ContextMenu.svelte +51 -50
  55. package/dist/components/ui/context-menu/ContextMenu.svelte.d.ts +1 -1
  56. package/dist/components/ui/context-menu/ContextMenuContent.svelte +92 -91
  57. package/dist/components/ui/context-menu/ContextMenuItem.svelte +26 -25
  58. package/dist/components/ui/context-menu/ContextMenuItem.svelte.d.ts +1 -1
  59. package/dist/components/ui/context-menu/ContextMenuTrigger.svelte +16 -15
  60. package/dist/components/ui/context-menu/context-menu-state.svelte.d.ts +3 -3
  61. package/dist/components/ui/context-menu/context-menu-state.svelte.js +15 -15
  62. package/dist/components/ui/drag-drop/Draggable.svelte +73 -72
  63. package/dist/components/ui/drag-drop/Draggable.svelte.d.ts +2 -2
  64. package/dist/components/ui/drag-drop/Dropzone.svelte +56 -54
  65. package/dist/components/ui/drag-drop/Dropzone.svelte.d.ts +3 -3
  66. package/dist/components/ui/drag-drop/drag-manager.d.ts +2 -2
  67. package/dist/components/ui/drag-drop/drag-manager.js +9 -9
  68. package/dist/components/ui/index.d.ts +2 -2
  69. package/dist/components/ui/index.js +5 -5
  70. package/dist/components/ui/search/SearchBar.svelte +18 -18
  71. package/dist/components/ui/search/SearchBar.svelte.d.ts +2 -2
  72. package/dist/highlight.js +2 -2
  73. package/dist/server/form-handler.d.ts +12 -12
  74. package/dist/server/form-handler.js +17 -17
  75. package/dist/server/form-processor.d.ts +1 -1
  76. package/dist/server/form-processor.js +0 -1
  77. package/dist/shadcn/components/ui/button/button.svelte +72 -71
  78. package/dist/shadcn/components/ui/button/button.svelte.d.ts +23 -23
  79. package/dist/shadcn/components/ui/button/index.d.ts +1 -1
  80. package/dist/shadcn/components/ui/button/index.js +2 -2
  81. package/dist/shadcn/components/ui/input/index.d.ts +1 -1
  82. package/dist/shadcn/components/ui/input/index.js +2 -2
  83. package/dist/shadcn/components/ui/input/input.svelte +35 -32
  84. package/dist/shadcn/components/ui/input/input.svelte.d.ts +2 -2
  85. package/dist/shadcn/components/ui/select/index.d.ts +6 -6
  86. package/dist/shadcn/components/ui/select/index.js +7 -7
  87. package/dist/shadcn/components/ui/select/select-content.svelte +35 -34
  88. package/dist/shadcn/components/ui/select/select-content.svelte.d.ts +1 -1
  89. package/dist/shadcn/components/ui/select/select-group-heading.svelte +15 -14
  90. package/dist/shadcn/components/ui/select/select-group.svelte +2 -2
  91. package/dist/shadcn/components/ui/select/select-item.svelte +31 -31
  92. package/dist/shadcn/components/ui/select/select-label.svelte +14 -13
  93. package/dist/shadcn/components/ui/select/select-label.svelte.d.ts +1 -1
  94. package/dist/shadcn/components/ui/select/select-scroll-down-button.svelte +13 -13
  95. package/dist/shadcn/components/ui/select/select-scroll-up-button.svelte +13 -13
  96. package/dist/shadcn/components/ui/select/select-separator.svelte +13 -12
  97. package/dist/shadcn/components/ui/select/select-trigger.svelte +26 -26
  98. package/dist/shadcn/components/ui/select/select-trigger.svelte.d.ts +2 -2
  99. package/dist/shadcn/components/ui/separator/separator.svelte +14 -14
  100. package/dist/shadcn/components/ui/textarea/textarea.svelte +22 -21
  101. package/dist/shadcn/components/ui/textarea/textarea.svelte.d.ts +1 -1
  102. package/dist/shadcn/utils.d.ts +4 -4
  103. package/dist/utils/datetime/index.d.ts +68 -68
  104. package/dist/utils/datetime/index.js +124 -124
  105. package/dist/utils/email/README.md +60 -60
  106. package/dist/utils/email/aws-signer.d.ts +1 -1
  107. package/dist/utils/email/aws-signer.js +39 -39
  108. package/dist/utils/email/ses.d.ts +8 -10
  109. package/dist/utils/email/ses.js +15 -23
  110. package/dist/utils/form/index.d.ts +11 -11
  111. package/dist/utils/form/index.js +23 -24
  112. package/dist/utils/form/virtual-form.d.ts +5 -5
  113. package/dist/utils/form/virtual-form.js +58 -58
  114. package/dist/utils/search.d.ts +1 -1
  115. package/dist/utils/search.js +22 -22
  116. package/dist/utils/types/arktype.d.ts +2 -2
  117. package/dist/utils/types/arktype.js +3 -3
  118. package/dist/utils/types/db.d.ts +2 -1
  119. package/dist/utils/types/db.js +7 -7
  120. package/package.json +69 -54
@@ -1,2 +1,2 @@
1
1
  import Root from './input.svelte';
2
- export { Root, Root as Input };
2
+ export { Root as Input, Root };
@@ -1,4 +1,4 @@
1
1
  import Root from './input.svelte';
2
- export { Root,
2
+ export {
3
3
  //
4
- Root as Input };
4
+ Root as Input, Root };
@@ -1,41 +1,44 @@
1
1
  <script lang="ts">
2
- import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
3
- import { cn, type WithElementRef } from '../../../utils.js';
4
- type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
2
+ import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
5
3
 
6
- type Props = WithElementRef<
7
- Omit<HTMLInputAttributes, 'type'> &
8
- ({ type: 'file'; files?: FileList } | { type?: InputType; files?: undefined })
9
- >;
4
+ import { cn, type WithElementRef } from '../../../utils.js';
5
+ type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
10
6
 
11
- let {
12
- ref = $bindable(null),
13
- value = $bindable(),
14
- type,
15
- files = $bindable(),
16
- class: className,
17
- ...restProps
18
- }: Props = $props();
7
+ type Props = WithElementRef<
8
+ Omit<HTMLInputAttributes, 'type'> &
9
+ ({ files?: FileList; type: 'file' } | { files?: undefined; type?: InputType })
10
+ >;
19
11
 
20
- const inputClasses = cn(
21
- 'w-full rounded-lg border border-gray-300 px-4 py-3 transition-all outline-none',
22
- 'focus:border-transparent focus:ring-2 focus:ring-primary',
23
- 'disabled:cursor-not-allowed disabled:opacity-50',
24
- 'aria-invalid:border-red-500 aria-invalid:focus:ring-red-300',
25
- className
26
- );
12
+ let {
13
+ class: className,
14
+ files = $bindable(),
15
+ ref = $bindable(null),
16
+ type,
17
+ value = $bindable(),
18
+ ...restProps
19
+ }: Props = $props();
20
+
21
+ let inputClasses = $derived(
22
+ cn(
23
+ 'w-full rounded-lg border border-gray-300 px-4 py-3 transition-all outline-none',
24
+ 'focus:border-transparent focus:ring-2 focus:ring-primary',
25
+ 'disabled:cursor-not-allowed disabled:opacity-50',
26
+ 'aria-invalid:border-red-500 aria-invalid:focus:ring-red-300',
27
+ className
28
+ )
29
+ );
27
30
  </script>
28
31
 
29
32
  {#if type === 'file'}
30
- <input
31
- bind:this={ref}
32
- data-slot="input"
33
- class={inputClasses}
34
- type="file"
35
- bind:files
36
- bind:value
37
- {...restProps}
38
- />
33
+ <input
34
+ bind:this={ref}
35
+ class={inputClasses}
36
+ data-slot="input"
37
+ type="file"
38
+ bind:files
39
+ bind:value
40
+ {...restProps}
41
+ />
39
42
  {:else}
40
- <input bind:this={ref} data-slot="input" class={inputClasses} {type} bind:value {...restProps} />
43
+ <input bind:this={ref} class={inputClasses} data-slot="input" {type} bind:value {...restProps} />
41
44
  {/if}
@@ -2,11 +2,11 @@ import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/element
2
2
  import { type WithElementRef } from '../../../utils.js';
3
3
  type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
4
4
  type Props = WithElementRef<Omit<HTMLInputAttributes, 'type'> & ({
5
- type: 'file';
6
5
  files?: FileList;
6
+ type: 'file';
7
7
  } | {
8
- type?: InputType;
9
8
  files?: undefined;
9
+ type?: InputType;
10
10
  })>;
11
11
  declare const Input: import("svelte").Component<Props, {}, "ref" | "value" | "files">;
12
12
  type Input = ReturnType<typeof Input>;
@@ -1,11 +1,11 @@
1
+ import Content from './select-content.svelte';
2
+ import GroupHeading from './select-group-heading.svelte';
1
3
  import Group from './select-group.svelte';
2
- import Label from './select-label.svelte';
3
4
  import Item from './select-item.svelte';
4
- import Content from './select-content.svelte';
5
- import Trigger from './select-trigger.svelte';
6
- import Separator from './select-separator.svelte';
5
+ import Label from './select-label.svelte';
7
6
  import ScrollDownButton from './select-scroll-down-button.svelte';
8
7
  import ScrollUpButton from './select-scroll-up-button.svelte';
9
- import GroupHeading from './select-group-heading.svelte';
8
+ import Separator from './select-separator.svelte';
9
+ import Trigger from './select-trigger.svelte';
10
10
  declare const Root: import("svelte").Component<import("bits-ui").SelectRootPropsWithoutHTML, {}, "value" | "open">;
11
- export { Root, Group, Label, Item, Content, Trigger, Separator, ScrollDownButton, ScrollUpButton, GroupHeading, Root as Select, Group as SelectGroup, Label as SelectLabel, Item as SelectItem, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, GroupHeading as SelectGroupHeading };
11
+ export { Content, Group, GroupHeading, Item, Label, Root, ScrollDownButton, ScrollUpButton, Root as Select, Content as SelectContent, Group as SelectGroup, GroupHeading as SelectGroupHeading, Item as SelectItem, Label as SelectLabel, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, Separator as SelectSeparator, Trigger as SelectTrigger, Separator, Trigger };
@@ -1,14 +1,14 @@
1
1
  import { Select as SelectPrimitive } from 'bits-ui';
2
+ import Content from './select-content.svelte';
3
+ import GroupHeading from './select-group-heading.svelte';
2
4
  import Group from './select-group.svelte';
3
- import Label from './select-label.svelte';
4
5
  import Item from './select-item.svelte';
5
- import Content from './select-content.svelte';
6
- import Trigger from './select-trigger.svelte';
7
- import Separator from './select-separator.svelte';
6
+ import Label from './select-label.svelte';
8
7
  import ScrollDownButton from './select-scroll-down-button.svelte';
9
8
  import ScrollUpButton from './select-scroll-up-button.svelte';
10
- import GroupHeading from './select-group-heading.svelte';
9
+ import Separator from './select-separator.svelte';
10
+ import Trigger from './select-trigger.svelte';
11
11
  const Root = SelectPrimitive.Root;
12
- export { Root, Group, Label, Item, Content, Trigger, Separator, ScrollDownButton, ScrollUpButton, GroupHeading,
12
+ export { Content, Group, GroupHeading, Item, Label, Root, ScrollDownButton, ScrollUpButton,
13
13
  //
14
- Root as Select, Group as SelectGroup, Label as SelectLabel, Item as SelectItem, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, GroupHeading as SelectGroupHeading };
14
+ Root as Select, Content as SelectContent, Group as SelectGroup, GroupHeading as SelectGroupHeading, Item as SelectItem, Label as SelectLabel, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, Separator as SelectSeparator, Trigger as SelectTrigger, Separator, Trigger };
@@ -1,40 +1,41 @@
1
1
  <script lang="ts">
2
- import { Select as SelectPrimitive } from 'bits-ui';
3
- import SelectScrollUpButton from './select-scroll-up-button.svelte';
4
- import SelectScrollDownButton from './select-scroll-down-button.svelte';
5
- import { cn, type WithoutChild } from '../../../utils.js';
2
+ import { cn, type WithoutChild } from '../../../utils.js';
3
+ import { Select as SelectPrimitive } from 'bits-ui';
6
4
 
7
- let {
8
- ref = $bindable(null),
9
- class: className,
10
- sideOffset = 4,
11
- portalProps,
12
- children,
13
- ...restProps
14
- }: WithoutChild<SelectPrimitive.ContentProps> & {
15
- portalProps?: SelectPrimitive.PortalProps;
16
- } = $props();
5
+ import SelectScrollDownButton from './select-scroll-down-button.svelte';
6
+ import SelectScrollUpButton from './select-scroll-up-button.svelte';
7
+
8
+ let {
9
+ children,
10
+ class: className,
11
+ portalProps,
12
+ ref = $bindable(null),
13
+ sideOffset = 4,
14
+ ...restProps
15
+ }: WithoutChild<SelectPrimitive.ContentProps> & {
16
+ portalProps?: SelectPrimitive.PortalProps;
17
+ } = $props();
17
18
  </script>
18
19
 
19
20
  <SelectPrimitive.Portal {...portalProps}>
20
- <SelectPrimitive.Content
21
- bind:ref
22
- {sideOffset}
23
- data-slot="select-content"
24
- class={cn(
25
- 'relative z-50 max-h-(--bits-select-content-available-height) min-w-[8rem] origin-(--bits-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:translate-y-1 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:-translate-x-1 data-[side=left]:slide-in-from-right-2 data-[side=right]:translate-x-1 data-[side=right]:slide-in-from-left-2 data-[side=top]:-translate-y-1 data-[side=top]:slide-in-from-bottom-2 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',
26
- className
27
- )}
28
- {...restProps}
29
- >
30
- <SelectScrollUpButton />
31
- <SelectPrimitive.Viewport
32
- class={cn(
33
- 'h-(--bits-select-anchor-height) w-full min-w-(--bits-select-anchor-width) scroll-my-1 p-1'
34
- )}
35
- >
36
- {@render children?.()}
37
- </SelectPrimitive.Viewport>
38
- <SelectScrollDownButton />
39
- </SelectPrimitive.Content>
21
+ <SelectPrimitive.Content
22
+ class={cn(
23
+ 'relative z-50 max-h-(--bits-select-content-available-height) min-w-[8rem] origin-(--bits-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:translate-y-1 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:-translate-x-1 data-[side=left]:slide-in-from-right-2 data-[side=right]:translate-x-1 data-[side=right]:slide-in-from-left-2 data-[side=top]:-translate-y-1 data-[side=top]:slide-in-from-bottom-2 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',
24
+ className
25
+ )}
26
+ data-slot="select-content"
27
+ {sideOffset}
28
+ bind:ref
29
+ {...restProps}
30
+ >
31
+ <SelectScrollUpButton />
32
+ <SelectPrimitive.Viewport
33
+ class={cn(
34
+ 'h-(--bits-select-anchor-height) w-full min-w-(--bits-select-anchor-width) scroll-my-1 p-1'
35
+ )}
36
+ >
37
+ {@render children?.()}
38
+ </SelectPrimitive.Viewport>
39
+ <SelectScrollDownButton />
40
+ </SelectPrimitive.Content>
40
41
  </SelectPrimitive.Portal>
@@ -1,5 +1,5 @@
1
- import { Select as SelectPrimitive } from 'bits-ui';
2
1
  import { type WithoutChild } from '../../../utils.js';
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
3
  type $$ComponentProps = WithoutChild<SelectPrimitive.ContentProps> & {
4
4
  portalProps?: SelectPrimitive.PortalProps;
5
5
  };
@@ -1,21 +1,22 @@
1
1
  <script lang="ts">
2
- import { Select as SelectPrimitive } from 'bits-ui';
3
- import { cn } from '../../../utils.js';
4
- import type { ComponentProps } from 'svelte';
2
+ import type { ComponentProps } from 'svelte';
5
3
 
6
- let {
7
- ref = $bindable(null),
8
- class: className,
9
- children,
10
- ...restProps
11
- }: ComponentProps<typeof SelectPrimitive.GroupHeading> = $props();
4
+ import { cn } from '../../../utils.js';
5
+ import { Select as SelectPrimitive } from 'bits-ui';
6
+
7
+ let {
8
+ children,
9
+ class: className,
10
+ ref = $bindable(null),
11
+ ...restProps
12
+ }: ComponentProps<typeof SelectPrimitive.GroupHeading> = $props();
12
13
  </script>
13
14
 
14
15
  <SelectPrimitive.GroupHeading
15
- bind:ref
16
- data-slot="select-group-heading"
17
- class={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}
18
- {...restProps}
16
+ class={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}
17
+ data-slot="select-group-heading"
18
+ bind:ref
19
+ {...restProps}
19
20
  >
20
- {@render children?.()}
21
+ {@render children?.()}
21
22
  </SelectPrimitive.GroupHeading>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { Select as SelectPrimitive } from 'bits-ui';
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
3
 
4
- let { ref = $bindable(null), ...restProps }: SelectPrimitive.GroupProps = $props();
4
+ let { ref = $bindable(null), ...restProps }: SelectPrimitive.GroupProps = $props();
5
5
  </script>
6
6
 
7
7
  <SelectPrimitive.Group data-slot="select-group" {...restProps} />
@@ -1,38 +1,38 @@
1
1
  <script lang="ts">
2
- import CheckIcon from '@lucide/svelte/icons/check';
3
- import { Select as SelectPrimitive } from 'bits-ui';
4
- import { cn, type WithoutChild } from '../../../utils.js';
2
+ import { cn, type WithoutChild } from '../../../utils.js';
3
+ import CheckIcon from '@lucide/svelte/icons/check';
4
+ import { Select as SelectPrimitive } from 'bits-ui';
5
5
 
6
- let {
7
- ref = $bindable(null),
8
- class: className,
9
- value,
10
- label,
11
- children: childrenProp,
12
- ...restProps
13
- }: WithoutChild<SelectPrimitive.ItemProps> = $props();
6
+ let {
7
+ children: childrenProp,
8
+ class: className,
9
+ label,
10
+ ref = $bindable(null),
11
+ value,
12
+ ...restProps
13
+ }: WithoutChild<SelectPrimitive.ItemProps> = $props();
14
14
  </script>
15
15
 
16
16
  <SelectPrimitive.Item
17
- bind:ref
18
- {value}
19
- data-slot="select-item"
20
- class={cn(
21
- "relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
22
- className
23
- )}
24
- {...restProps}
17
+ class={cn(
18
+ "relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
19
+ className
20
+ )}
21
+ data-slot="select-item"
22
+ {value}
23
+ bind:ref
24
+ {...restProps}
25
25
  >
26
- {#snippet children({ selected, highlighted })}
27
- <span class="absolute right-2 flex size-3.5 items-center justify-center">
28
- {#if selected}
29
- <CheckIcon class="size-4" />
30
- {/if}
31
- </span>
32
- {#if childrenProp}
33
- {@render childrenProp({ selected, highlighted })}
34
- {:else}
35
- {label || value}
36
- {/if}
37
- {/snippet}
26
+ {#snippet children({ highlighted, selected })}
27
+ <span class="absolute right-2 flex size-3.5 items-center justify-center">
28
+ {#if selected}
29
+ <CheckIcon class="size-4" />
30
+ {/if}
31
+ </span>
32
+ {#if childrenProp}
33
+ {@render childrenProp({ highlighted, selected })}
34
+ {:else}
35
+ {label || value}
36
+ {/if}
37
+ {/snippet}
38
38
  </SelectPrimitive.Item>
@@ -1,20 +1,21 @@
1
1
  <script lang="ts">
2
- import { cn, type WithElementRef } from '../../../utils.js';
3
- import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { HTMLAttributes } from 'svelte/elements';
4
3
 
5
- let {
6
- ref = $bindable(null),
7
- class: className,
8
- children,
9
- ...restProps
10
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {} = $props();
4
+ import { cn, type WithElementRef } from '../../../utils.js';
5
+
6
+ let {
7
+ children,
8
+ class: className,
9
+ ref = $bindable(null),
10
+ ...restProps
11
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {} = $props();
11
12
  </script>
12
13
 
13
14
  <div
14
- bind:this={ref}
15
- data-slot="select-label"
16
- class={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}
17
- {...restProps}
15
+ bind:this={ref}
16
+ class={cn('px-2 py-1.5 text-xs text-muted-foreground', className)}
17
+ data-slot="select-label"
18
+ {...restProps}
18
19
  >
19
- {@render children?.()}
20
+ {@render children?.()}
20
21
  </div>
@@ -1,5 +1,5 @@
1
- import { type WithElementRef } from '../../../utils.js';
2
1
  import type { HTMLAttributes } from 'svelte/elements';
2
+ import { type WithElementRef } from '../../../utils.js';
3
3
  type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {};
4
4
  declare const SelectLabel: import("svelte").Component<$$ComponentProps, {}, "ref">;
5
5
  type SelectLabel = ReturnType<typeof SelectLabel>;
@@ -1,20 +1,20 @@
1
1
  <script lang="ts">
2
- import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
3
- import { Select as SelectPrimitive } from 'bits-ui';
4
- import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
2
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
3
+ import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
4
+ import { Select as SelectPrimitive } from 'bits-ui';
5
5
 
6
- let {
7
- ref = $bindable(null),
8
- class: className,
9
- ...restProps
10
- }: WithoutChildrenOrChild<SelectPrimitive.ScrollDownButtonProps> = $props();
6
+ let {
7
+ class: className,
8
+ ref = $bindable(null),
9
+ ...restProps
10
+ }: WithoutChildrenOrChild<SelectPrimitive.ScrollDownButtonProps> = $props();
11
11
  </script>
12
12
 
13
13
  <SelectPrimitive.ScrollDownButton
14
- bind:ref
15
- data-slot="select-scroll-down-button"
16
- class={cn('flex cursor-default items-center justify-center py-1', className)}
17
- {...restProps}
14
+ class={cn('flex cursor-default items-center justify-center py-1', className)}
15
+ data-slot="select-scroll-down-button"
16
+ bind:ref
17
+ {...restProps}
18
18
  >
19
- <ChevronDownIcon class="size-4" />
19
+ <ChevronDownIcon class="size-4" />
20
20
  </SelectPrimitive.ScrollDownButton>
@@ -1,20 +1,20 @@
1
1
  <script lang="ts">
2
- import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
3
- import { Select as SelectPrimitive } from 'bits-ui';
4
- import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
2
+ import { cn, type WithoutChildrenOrChild } from '../../../utils.js';
3
+ import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
4
+ import { Select as SelectPrimitive } from 'bits-ui';
5
5
 
6
- let {
7
- ref = $bindable(null),
8
- class: className,
9
- ...restProps
10
- }: WithoutChildrenOrChild<SelectPrimitive.ScrollUpButtonProps> = $props();
6
+ let {
7
+ class: className,
8
+ ref = $bindable(null),
9
+ ...restProps
10
+ }: WithoutChildrenOrChild<SelectPrimitive.ScrollUpButtonProps> = $props();
11
11
  </script>
12
12
 
13
13
  <SelectPrimitive.ScrollUpButton
14
- bind:ref
15
- data-slot="select-scroll-up-button"
16
- class={cn('flex cursor-default items-center justify-center py-1', className)}
17
- {...restProps}
14
+ class={cn('flex cursor-default items-center justify-center py-1', className)}
15
+ data-slot="select-scroll-up-button"
16
+ bind:ref
17
+ {...restProps}
18
18
  >
19
- <ChevronUpIcon class="size-4" />
19
+ <ChevronUpIcon class="size-4" />
20
20
  </SelectPrimitive.ScrollUpButton>
@@ -1,18 +1,19 @@
1
1
  <script lang="ts">
2
- import type { Separator as SeparatorPrimitive } from 'bits-ui';
3
- import { Separator } from '../separator/index.js';
4
- import { cn } from '../../../utils.js';
2
+ import type { Separator as SeparatorPrimitive } from 'bits-ui';
5
3
 
6
- let {
7
- ref = $bindable(null),
8
- class: className,
9
- ...restProps
10
- }: SeparatorPrimitive.RootProps = $props();
4
+ import { Separator } from '../separator/index.js';
5
+ import { cn } from '../../../utils.js';
6
+
7
+ let {
8
+ class: className,
9
+ ref = $bindable(null),
10
+ ...restProps
11
+ }: SeparatorPrimitive.RootProps = $props();
11
12
  </script>
12
13
 
13
14
  <Separator
14
- bind:ref
15
- data-slot="select-separator"
16
- class={cn('pointer-events-none -mx-1 my-1 h-px bg-border', className)}
17
- {...restProps}
15
+ class={cn('pointer-events-none -mx-1 my-1 h-px bg-border', className)}
16
+ data-slot="select-separator"
17
+ bind:ref
18
+ {...restProps}
18
19
  />
@@ -1,33 +1,33 @@
1
1
  <script lang="ts">
2
- import { Select as SelectPrimitive } from 'bits-ui';
3
- import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
4
- import { cn, type WithoutChild } from '../../../utils.js';
2
+ import { cn, type WithoutChild } from '../../../utils.js';
3
+ import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
4
+ import { Select as SelectPrimitive } from 'bits-ui';
5
5
 
6
- let {
7
- ref = $bindable(null),
8
- class: className,
9
- children,
10
- size = 'default',
11
- ...restProps
12
- }: WithoutChild<SelectPrimitive.TriggerProps> & {
13
- size?: 'sm' | 'default';
14
- } = $props();
6
+ let {
7
+ children,
8
+ class: className,
9
+ ref = $bindable(null),
10
+ size = 'default',
11
+ ...restProps
12
+ }: WithoutChild<SelectPrimitive.TriggerProps> & {
13
+ size?: 'default' | 'sm';
14
+ } = $props();
15
15
  </script>
16
16
 
17
17
  <SelectPrimitive.Trigger
18
- bind:ref
19
- data-slot="select-trigger"
20
- data-size={size}
21
- class={cn(
22
- 'flex w-full items-center justify-between gap-2 rounded-lg border border-gray-300 px-4 py-3 transition-all outline-none select-none',
23
- 'focus:border-transparent focus:ring-2 focus:ring-primary',
24
- 'disabled:opacity-50',
25
- 'aria-invalid:border-red-500 aria-invalid:focus:ring-red-300',
26
- "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
27
- className
28
- )}
29
- {...restProps}
18
+ class={cn(
19
+ 'flex w-full items-center justify-between gap-2 rounded-lg border border-gray-300 px-4 py-3 transition-all outline-none select-none',
20
+ 'focus:border-transparent focus:ring-2 focus:ring-primary',
21
+ 'disabled:opacity-50',
22
+ 'aria-invalid:border-red-500 aria-invalid:focus:ring-red-300',
23
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
24
+ className
25
+ )}
26
+ data-size={size}
27
+ data-slot="select-trigger"
28
+ bind:ref
29
+ {...restProps}
30
30
  >
31
- {@render children?.()}
32
- <ChevronDownIcon class="size-4 opacity-50" />
31
+ {@render children?.()}
32
+ <ChevronDownIcon class="size-4 opacity-50" />
33
33
  </SelectPrimitive.Trigger>
@@ -1,7 +1,7 @@
1
- import { Select as SelectPrimitive } from 'bits-ui';
2
1
  import { type WithoutChild } from '../../../utils.js';
2
+ import { Select as SelectPrimitive } from 'bits-ui';
3
3
  type $$ComponentProps = WithoutChild<SelectPrimitive.TriggerProps> & {
4
- size?: 'sm' | 'default';
4
+ size?: 'default' | 'sm';
5
5
  };
6
6
  declare const SelectTrigger: import("svelte").Component<$$ComponentProps, {}, "ref">;
7
7
  type SelectTrigger = ReturnType<typeof SelectTrigger>;
@@ -1,20 +1,20 @@
1
1
  <script lang="ts">
2
- import { Separator as SeparatorPrimitive } from 'bits-ui';
3
- import { cn } from '../../../utils.js';
2
+ import { cn } from '../../../utils.js';
3
+ import { Separator as SeparatorPrimitive } from 'bits-ui';
4
4
 
5
- let {
6
- ref = $bindable(null),
7
- class: className,
8
- ...restProps
9
- }: SeparatorPrimitive.RootProps = $props();
5
+ let {
6
+ class: className,
7
+ ref = $bindable(null),
8
+ ...restProps
9
+ }: SeparatorPrimitive.RootProps = $props();
10
10
  </script>
11
11
 
12
12
  <SeparatorPrimitive.Root
13
- bind:ref
14
- data-slot="separator"
15
- class={cn(
16
- 'shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
17
- className
18
- )}
19
- {...restProps}
13
+ class={cn(
14
+ 'shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
15
+ className
16
+ )}
17
+ data-slot="separator"
18
+ bind:ref
19
+ {...restProps}
20
20
  />