uisv 0.0.20 → 0.0.22

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 (76) hide show
  1. package/dist/components/accordion.svelte +20 -21
  2. package/dist/components/accordion.svelte.d.ts +10 -10
  3. package/dist/components/alert.svelte +22 -28
  4. package/dist/components/alert.svelte.d.ts +5 -5
  5. package/dist/components/app.svelte +57 -0
  6. package/dist/components/app.svelte.d.ts +15 -0
  7. package/dist/components/badge.svelte +33 -38
  8. package/dist/components/badge.svelte.d.ts +3 -3
  9. package/dist/components/banner.svelte +47 -55
  10. package/dist/components/banner.svelte.d.ts +5 -5
  11. package/dist/components/breadcrumb.svelte +6 -6
  12. package/dist/components/breadcrumb.svelte.d.ts +4 -25
  13. package/dist/components/button.svelte +36 -48
  14. package/dist/components/button.svelte.d.ts +12 -12
  15. package/dist/components/calendar.svelte +6 -7
  16. package/dist/components/calendar.svelte.d.ts +3 -3
  17. package/dist/components/card.svelte +14 -15
  18. package/dist/components/card.svelte.d.ts +5 -5
  19. package/dist/components/checkbox-group.svelte +12 -13
  20. package/dist/components/checkbox-group.svelte.d.ts +4 -4
  21. package/dist/components/checkbox.svelte +39 -38
  22. package/dist/components/checkbox.svelte.d.ts +6 -6
  23. package/dist/components/chip.svelte +21 -22
  24. package/dist/components/chip.svelte.d.ts +3 -3
  25. package/dist/components/collapsible.svelte +4 -5
  26. package/dist/components/collapsible.svelte.d.ts +4 -4
  27. package/dist/components/color-picker.svelte +1 -1
  28. package/dist/components/h1.svelte +8 -7
  29. package/dist/components/h2.svelte +12 -11
  30. package/dist/components/h3.svelte +9 -8
  31. package/dist/components/h4.svelte +12 -11
  32. package/dist/components/h5.svelte +12 -11
  33. package/dist/components/h6.svelte +12 -11
  34. package/dist/components/icon.svelte +0 -2
  35. package/dist/components/index.d.ts +6 -0
  36. package/dist/components/index.js +6 -0
  37. package/dist/components/input-number.svelte +5 -7
  38. package/dist/components/input-number.svelte.d.ts +5 -5
  39. package/dist/components/input-time.svelte +11 -12
  40. package/dist/components/input-time.svelte.d.ts +6 -6
  41. package/dist/components/input.svelte +11 -12
  42. package/dist/components/input.svelte.d.ts +6 -6
  43. package/dist/components/kbd.svelte +6 -7
  44. package/dist/components/kbd.svelte.d.ts +2 -2
  45. package/dist/components/modal.svelte +189 -0
  46. package/dist/components/modal.svelte.d.ts +33 -0
  47. package/dist/components/p.svelte +3 -1
  48. package/dist/components/pin-input.svelte +10 -11
  49. package/dist/components/pin-input.svelte.d.ts +3 -3
  50. package/dist/components/placeholder.svelte +4 -4
  51. package/dist/components/popover.svelte +33 -61
  52. package/dist/components/popover.svelte.d.ts +8 -30
  53. package/dist/components/progress.svelte +22 -21
  54. package/dist/components/progress.svelte.d.ts +5 -5
  55. package/dist/components/select.svelte +48 -53
  56. package/dist/components/select.svelte.d.ts +22 -29
  57. package/dist/components/seperator.svelte +6 -7
  58. package/dist/components/seperator.svelte.d.ts +6 -6
  59. package/dist/components/slider.svelte +13 -14
  60. package/dist/components/slider.svelte.d.ts +4 -4
  61. package/dist/components/switch.svelte +17 -22
  62. package/dist/components/switch.svelte.d.ts +6 -6
  63. package/dist/components/tabs.svelte +19 -20
  64. package/dist/components/tabs.svelte.d.ts +7 -7
  65. package/dist/components/tooltip.svelte +94 -0
  66. package/dist/components/tooltip.svelte.d.ts +24 -0
  67. package/dist/contexts.d.ts +47 -0
  68. package/dist/contexts.js +46 -0
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.js +1 -0
  71. package/dist/mode.d.ts +89 -0
  72. package/dist/mode.js +1 -0
  73. package/dist/utilities.svelte.d.ts +1 -1
  74. package/dist/vite.d.ts +2 -1
  75. package/dist/vite.js +32 -37
  76. package/package.json +31 -26
@@ -1,8 +1,7 @@
1
1
  <script module lang="ts">
2
2
  import type { PropColor, PropVariant } from '../index.js';
3
3
  import { onMount } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
- import { tv } from 'tailwind-variants';
4
+ import { tv, type ClassValue } from 'tailwind-variants';
6
5
 
7
6
  export type PinInputProps = {
8
7
  value?: number[] | string[];
@@ -19,7 +18,7 @@
19
18
  placeholder?: string;
20
19
  required?: boolean;
21
20
  type?: 'text' | 'number';
22
- ui?: { root?: ClassNameValue; cell?: ClassNameValue };
21
+ ui?: { root?: ClassValue; cell?: ClassValue };
23
22
  };
24
23
  </script>
25
24
 
@@ -59,7 +58,7 @@
59
58
  const internal_id = $props.id();
60
59
  let input_els = $state<HTMLInputElement[]>([]);
61
60
 
62
- const classes = $derived(
61
+ const variants = $derived(
63
62
  tv({
64
63
  slots: { root: 'flex gap-2', cell: 'rounded text-center outline-none transition relative' },
65
64
  variants: {
@@ -80,13 +79,13 @@
80
79
  },
81
80
  variant: {
82
81
  outline: {
83
- cell: 'border border-surface-300 focus:border-2',
82
+ cell: 'border border-surface-accented focus:border-2',
84
83
  },
85
84
  soft: {
86
- cell: 'bg-surface-50 hover:bg-surface-100 focus:bg-surface-100',
85
+ cell: 'bg-surface-muted hover:bg-surface-elevated focus:bg-surface-elevated',
87
86
  },
88
- subtle: { cell: 'border border-surface-300 bg-surface-100 focus:border-2' },
89
- ghost: { cell: 'hover:bg-surface-100 focus:bg-surface-100' },
87
+ subtle: { cell: 'border border-surface-accented bg-surface-elevated focus:border-2' },
88
+ ghost: { cell: 'hover:bg-surface-elevated focus:bg-surface-elevated' },
90
89
  none: { cell: '' },
91
90
  },
92
91
  },
@@ -99,7 +98,7 @@
99
98
  {
100
99
  variant: ['outline', 'subtle'],
101
100
  color: 'surface',
102
- class: { cell: 'focus:border-surface-900' },
101
+ class: { cell: 'focus:border-surface-inverted' },
103
102
  },
104
103
  {
105
104
  variant: ['outline', 'subtle'],
@@ -132,7 +131,7 @@
132
131
  });
133
132
  </script>
134
133
 
135
- <div id={id || internal_id} class={classes.root({ class: ui.root })}>
134
+ <div id={id || internal_id} class={variants.root({ class: ui.root })}>
136
135
  {#each { length }, i (i)}
137
136
  <input
138
137
  bind:this={input_els[i]}
@@ -148,7 +147,7 @@
148
147
  }
149
148
  }
150
149
  }
151
- class={classes.cell({ class: ui.cell })}
150
+ class={variants.cell({ class: ui.cell })}
152
151
  onkeydown={(e) => {
153
152
  if (KEYS_TO_IGNORE.includes(e.key)) e.preventDefault();
154
153
  if (type === 'number' && isNaN(parseInt(e.key))) e.preventDefault();
@@ -1,5 +1,5 @@
1
1
  import type { PropColor, PropVariant } from '../index.js';
2
- import type { ClassNameValue } from 'tailwind-merge';
2
+ import { type ClassValue } from 'tailwind-variants';
3
3
  export type PinInputProps = {
4
4
  value?: number[] | string[];
5
5
  color?: PropColor;
@@ -16,8 +16,8 @@ export type PinInputProps = {
16
16
  required?: boolean;
17
17
  type?: 'text' | 'number';
18
18
  ui?: {
19
- root?: ClassNameValue;
20
- cell?: ClassNameValue;
19
+ root?: ClassValue;
20
+ cell?: ClassValue;
21
21
  };
22
22
  };
23
23
  declare const PinInput: import("svelte").Component<PinInputProps, {}, "value">;
@@ -1,15 +1,15 @@
1
1
  <script lang="ts">
2
2
  import type { SvelteHTMLElements } from 'svelte/elements';
3
- import { cx } from 'tailwind-variants';
3
+ import { cn } from 'tailwind-variants';
4
4
 
5
- let { class: klass, ...rest }: SvelteHTMLElements['svg'] = $props();
5
+ let { class: classes, ...rest }: SvelteHTMLElements['svg'] = $props();
6
6
  </script>
7
7
 
8
8
  <svg
9
9
  {...rest}
10
- class={cx(
10
+ class={cn(
11
11
  'inset-0 w-full stroke-surface-elevated border border-dashed border-surface-accented rounded-md',
12
- klass,
12
+ classes,
13
13
  )}
14
14
  fill="none"
15
15
  >
@@ -1,10 +1,8 @@
1
1
  <script module lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import { Popover, type PopoverContentProps } from 'bits-ui';
5
- import { cn, tv } from 'tailwind-variants';
6
- import { type ButtonProps,Button } from '../index.js';
7
- import type { PropColor } from '../index.js';
3
+ import { Popover, type PopoverArrowProps, type PopoverContentProps } from 'bits-ui';
4
+ import { tv, type ClassValue } from 'tailwind-variants';
5
+ import { type ButtonBaseProps, Button } from '../index.js';
8
6
 
9
7
  export type PopoverContentSnippet = {
10
8
  props: Record<string, unknown>;
@@ -12,7 +10,7 @@
12
10
  wrapperProps: Record<string, unknown>;
13
11
  };
14
12
 
15
- export type PopoverProps = {
13
+ export type PopoverProps = ButtonBaseProps & {
16
14
  /**
17
15
  * The display mode of the popover.
18
16
  */
@@ -21,20 +19,15 @@
21
19
  * The props for the content of popover.
22
20
  */
23
21
  contentprops?: PopoverContentProps;
24
- content?: Snippet<[PopoverContentSnippet]>;
25
22
  children?: Snippet<[]>;
26
- /**
27
- * Snippet if you want to implement your own trigger button
28
- */
29
- trigger?: Snippet<[Record<string, unknown>]>;
30
23
  /**
31
24
  * Display an arrow alongside the popover.
32
25
  */
33
- arrow?: boolean;
26
+ arrow?: boolean | PopoverArrowProps;
34
27
  /**
35
28
  * Render the popover in a portal.
36
29
  */
37
- portal?: string | false | true | HTMLElement;
30
+ // portal?: string | false | true | HTMLElement;
38
31
  /**
39
32
  * The reference (or anchor) element that is being referred to for positioning. If not provided will use the current component as anchor.
40
33
  */
@@ -49,10 +42,6 @@
49
42
  * When `false`, the popover will not close when clicking outside or pressing escape.
50
43
  */
51
44
  dismissible?: boolean;
52
- /**
53
- * The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
54
- */
55
- defaultopen?: boolean;
56
45
  /**
57
46
  * The controlled open state of the popover.
58
47
  */
@@ -73,21 +62,10 @@
73
62
  *
74
63
  */
75
64
  ui?: {
76
- content?: ClassNameValue;
77
- arrow?: ClassNameValue;
65
+ content?: ClassValue;
66
+ arrow?: ClassValue;
67
+ trigger?: ClassValue;
78
68
  };
79
- /**
80
- * @default `outline`
81
- */
82
- variant?: ButtonProps['variant'];
83
- /**
84
- * @default primary
85
- */
86
- color?: PropColor;
87
- /**
88
- *
89
- */
90
- class?: ClassNameValue;
91
69
  };
92
70
  </script>
93
71
 
@@ -95,57 +73,51 @@
95
73
  let {
96
74
  mode = 'click',
97
75
  contentprops = { side: 'bottom', sideOffset: 8, collisionPadding: 8 },
98
- content,
99
76
  children,
100
- trigger,
101
- arrow = true,
102
- portal = true,
103
- reference,
77
+ arrow = false,
104
78
  dismissible = true,
105
- defaultopen,
106
79
  open = $bindable(false),
107
- modal = false,
108
80
  opendelay = 0,
109
81
  closedelay = 0,
110
82
  ui = {},
111
- variant = 'outline',
112
- color = 'primary',
113
- class: klass,
83
+ ...rest
114
84
  }: PopoverProps = $props();
115
85
 
116
- const classes = $derived(
86
+ const variants = $derived(
117
87
  tv({
118
88
  slots: {
119
- content:
120
- 'bg-default shadow-lg rounded-md ring ring-default data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto',
121
- arrow: 'fill-default',
89
+ content: [
90
+ 'bg-surface-base z-30 w-full shadow-lg rounded-md border border-surface-accented p-4',
91
+ 'origin-(--bits-popover-content-transform-origin)',
92
+ '',
93
+ ],
94
+ arrow: 'text-surface-accented',
122
95
  },
123
96
  })({}),
124
97
  );
125
98
  </script>
126
99
 
127
100
  <Popover.Root bind:open>
128
- <Popover.Trigger>
101
+ <Popover.Trigger openOnHover={mode === 'hover'} openDelay={opendelay} closeDelay={closedelay}>
129
102
  {#snippet child({ props })}
130
- {#if trigger}
131
- {@render trigger(props)}
132
- {:else}
133
- <Button {...props} {variant} {color} ui={{ base: klass }} />
134
- {/if}
103
+ <Button {...rest} {...props} ui={{ base: ui.trigger }} />
135
104
  {/snippet}
136
105
  </Popover.Trigger>
106
+
137
107
  <Popover.Portal>
138
- <Popover.Overlay />
139
- <Popover.Content {...contentprops} class={classes.content({ class: ui.content })}>
140
- {#snippet child(props)}
141
- {#if content}
142
- {@render content(props)}
143
- {:else}
144
- {@render children?.()}
145
- {/if}
146
- {/snippet}
108
+ <Popover.Content
109
+ {...contentprops}
110
+ class={variants.content({ class: ui.content })}
111
+ interactOutsideBehavior={dismissible ? 'close' : 'ignore'}
112
+ >
113
+ {@render children?.()}
147
114
 
148
- <Popover.Arrow />
115
+ {#if arrow}
116
+ <Popover.Arrow
117
+ {...typeof arrow === 'object' ? arrow : {}}
118
+ class={variants.arrow({ class: ui.arrow })}
119
+ />
120
+ {/if}
149
121
  </Popover.Content>
150
122
  </Popover.Portal>
151
123
  </Popover.Root>
@@ -1,14 +1,13 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { ClassNameValue } from 'tailwind-merge';
3
- import { Popover, type PopoverContentProps } from 'bits-ui';
4
- import { type ButtonProps } from '../index.js';
5
- import type { PropColor } from '../index.js';
2
+ import { Popover, type PopoverArrowProps, type PopoverContentProps } from 'bits-ui';
3
+ import { type ClassValue } from 'tailwind-variants';
4
+ import { type ButtonBaseProps } from '../index.js';
6
5
  export type PopoverContentSnippet = {
7
6
  props: Record<string, unknown>;
8
7
  open: boolean;
9
8
  wrapperProps: Record<string, unknown>;
10
9
  };
11
- export type PopoverProps = {
10
+ export type PopoverProps = ButtonBaseProps & {
12
11
  /**
13
12
  * The display mode of the popover.
14
13
  */
@@ -17,20 +16,14 @@ export type PopoverProps = {
17
16
  * The props for the content of popover.
18
17
  */
19
18
  contentprops?: PopoverContentProps;
20
- content?: Snippet<[PopoverContentSnippet]>;
21
19
  children?: Snippet<[]>;
22
- /**
23
- * Snippet if you want to implement your own trigger button
24
- */
25
- trigger?: Snippet<[Record<string, unknown>]>;
26
20
  /**
27
21
  * Display an arrow alongside the popover.
28
22
  */
29
- arrow?: boolean;
23
+ arrow?: boolean | PopoverArrowProps;
30
24
  /**
31
25
  * Render the popover in a portal.
32
26
  */
33
- portal?: string | false | true | HTMLElement;
34
27
  /**
35
28
  * The reference (or anchor) element that is being referred to for positioning. If not provided will use the current component as anchor.
36
29
  */
@@ -43,10 +36,6 @@ export type PopoverProps = {
43
36
  * When `false`, the popover will not close when clicking outside or pressing escape.
44
37
  */
45
38
  dismissible?: boolean;
46
- /**
47
- * The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
48
- */
49
- defaultopen?: boolean;
50
39
  /**
51
40
  * The controlled open state of the popover.
52
41
  */
@@ -67,21 +56,10 @@ export type PopoverProps = {
67
56
  *
68
57
  */
69
58
  ui?: {
70
- content?: ClassNameValue;
71
- arrow?: ClassNameValue;
59
+ content?: ClassValue;
60
+ arrow?: ClassValue;
61
+ trigger?: ClassValue;
72
62
  };
73
- /**
74
- * @default `outline`
75
- */
76
- variant?: ButtonProps['variant'];
77
- /**
78
- * @default primary
79
- */
80
- color?: PropColor;
81
- /**
82
- *
83
- */
84
- class?: ClassNameValue;
85
63
  };
86
64
  declare const Popover: import("svelte").Component<PopoverProps, {}, "open">;
87
65
  type Popover = ReturnType<typeof Popover>;
@@ -1,7 +1,6 @@
1
1
  <script module lang="ts">
2
2
  import type { PropColor } from '../index.js';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import { tv } from 'tailwind-variants';
3
+ import { tv, type ClassValue } from 'tailwind-variants';
5
4
 
6
5
  export type ProgressProps = {
7
6
  value?: number;
@@ -13,10 +12,10 @@
13
12
  inverted?: boolean;
14
13
  status?: boolean;
15
14
  ui?: {
16
- base?: ClassNameValue;
17
- header?: ClassNameValue;
18
- content?: ClassNameValue;
19
- footer?: ClassNameValue;
15
+ base?: ClassValue;
16
+ header?: ClassValue;
17
+ content?: ClassValue;
18
+ footer?: ClassValue;
20
19
  };
21
20
  };
22
21
  </script>
@@ -47,10 +46,10 @@
47
46
 
48
47
  return false;
49
48
  });
50
- const classes = $derived.by(() =>
49
+ const variants = $derived.by(() =>
51
50
  tv({
52
51
  slots: {
53
- root: 'relative w-full rounded-full overflow-hidden bg-surface-300',
52
+ root: 'relative w-full rounded-full overflow-hidden bg-surface-accented',
54
53
  status: '',
55
54
  indicator: 'absolute transition-all rounded-full',
56
55
  steps: '',
@@ -61,7 +60,7 @@
61
60
  indicator: 'bg-primary-500',
62
61
  },
63
62
  surface: {
64
- indicator: 'bg-surface-500',
63
+ indicator: 'bg-label-muted',
65
64
  },
66
65
  info: {
67
66
  indicator: 'bg-info-500',
@@ -92,8 +91,8 @@
92
91
  </script>
93
92
 
94
93
  <div data-state-indeterminate={indeterminate}>
95
- <div class={classes.root({ class: [ui.base] })} style:height={`${height}px`}>
96
- <span class={classes.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
94
+ <div class={variants.root({ class: [ui.base] })} style:height={`${height}px`}>
95
+ <span class={variants.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
97
96
  </span>
98
97
  </div>
99
98
 
@@ -101,7 +100,7 @@
101
100
  <p
102
101
  class={[
103
102
  'text-right transition',
104
- value && value > 0 && max[value] ? 'text-primary-500' : 'text-surface-500',
103
+ value && value > 0 && max[value] ? 'text-primary-500' : 'text-label-muted',
105
104
  ]}
106
105
  >
107
106
  {(value && max[value]) || max[0]}
@@ -110,15 +109,17 @@
110
109
  </div>
111
110
 
112
111
  <style>
113
- @keyframe swing {
114
- 0% {
115
- width: 0%;
116
- }
117
- 50% {
118
- width: 100%;
119
- }
120
- 100% {
121
- width: 0%;
112
+ :global {
113
+ @keyframes swing {
114
+ 0% {
115
+ width: 0%;
116
+ }
117
+ 50% {
118
+ width: 100%;
119
+ }
120
+ 100% {
121
+ width: 0%;
122
+ }
122
123
  }
123
124
  }
124
125
  </style>
@@ -1,5 +1,5 @@
1
1
  import type { PropColor } from '../index.js';
2
- import type { ClassNameValue } from 'tailwind-merge';
2
+ import { type ClassValue } from 'tailwind-variants';
3
3
  export type ProgressProps = {
4
4
  value?: number;
5
5
  max?: number | string[];
@@ -10,10 +10,10 @@ export type ProgressProps = {
10
10
  inverted?: boolean;
11
11
  status?: boolean;
12
12
  ui?: {
13
- base?: ClassNameValue;
14
- header?: ClassNameValue;
15
- content?: ClassNameValue;
16
- footer?: ClassNameValue;
13
+ base?: ClassValue;
14
+ header?: ClassValue;
15
+ content?: ClassValue;
16
+ footer?: ClassValue;
17
17
  };
18
18
  };
19
19
  declare const Progress: import("svelte").Component<ProgressProps, {}, "">;
@@ -2,14 +2,15 @@
2
2
  import type { PropColor, PropVariant } from '../index.js';
3
3
  import { Select } from 'bits-ui';
4
4
  import type { Component, Snippet } from 'svelte';
5
- import type { ClassNameValue } from 'tailwind-merge';
6
- import { tv } from 'tailwind-variants';
5
+ import { tv, type ClassValue } from 'tailwind-variants';
6
+ import Icon from './icon.svelte';
7
7
 
8
8
  export type SelectItem<T> =
9
9
  | T
10
10
  | {
11
11
  icon?: string | Component;
12
- label: string | Component;
12
+ iconposition?: 'leading' | 'trailing';
13
+ label: string | Component | Snippet;
13
14
  value: T;
14
15
  };
15
16
 
@@ -23,34 +24,26 @@
23
24
  highlight?: boolean;
24
25
  placeholder?: string;
25
26
  ui?: {
26
- base?: ClassNameValue;
27
- leading?: ClassNameValue;
28
- leadingIcon?: ClassNameValue;
29
- leadingAvatar?: ClassNameValue;
30
- leadingAvatarSize?: ClassNameValue;
31
- trailing?: ClassNameValue;
32
- trailingIcon?: ClassNameValue;
33
- value?: ClassNameValue;
34
- placeholder?: ClassNameValue;
35
- arrow?: ClassNameValue;
36
- content?: ClassNameValue;
37
- viewport?: ClassNameValue;
38
- group?: ClassNameValue;
39
- empty?: ClassNameValue;
40
- label?: ClassNameValue;
41
- separator?: ClassNameValue;
42
- item?: ClassNameValue;
43
- itemLeadingIcon?: ClassNameValue;
44
- itemLeadingAvatar?: ClassNameValue;
45
- itemLeadingAvatarSize?: ClassNameValue;
46
- itemLeadingChip?: ClassNameValue;
47
- itemLeadingChipSize?: ClassNameValue;
48
- itemTrailing?: ClassNameValue;
49
- itemTrailingIcon?: ClassNameValue;
50
- itemWrapper?: ClassNameValue;
51
- itemLabel?: ClassNameValue;
52
- itemDescription?: ClassNameValue;
27
+ base?: ClassValue;
28
+ leading?: ClassValue;
29
+ icon?: ClassValue;
30
+ leadingAvatar?: ClassValue;
31
+ leadingAvatarSize?: ClassValue;
32
+ trailing?: ClassValue;
33
+ value?: ClassValue;
34
+ placeholder?: ClassValue;
35
+ arrow?: ClassValue;
36
+ content?: ClassValue;
37
+ viewport?: ClassValue;
38
+ group?: ClassValue;
39
+ empty?: ClassValue;
40
+ label?: ClassValue;
41
+ separator?: ClassValue;
42
+ item?: ClassValue;
43
+ itemicon?: ClassValue;
44
+ dropdownicon?: ClassValue;
53
45
  };
46
+ dropdownicon?: string | Component;
54
47
  } & (
55
48
  | {
56
49
  value?: T;
@@ -76,37 +69,39 @@
76
69
  highlight,
77
70
  placeholder,
78
71
  ui = {},
72
+ dropdownicon = 'i-lucide:chevron-down',
79
73
  }: SelectProps<T> = $props();
80
74
 
81
- const classes = $derived(
75
+ const variants = $derived(
82
76
  tv({
83
77
  slots: {
84
78
  base: [
85
- 'relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75',
79
+ 'relative group rounded-md inline-flex items-center justify-between focus:outline-none disabled:cursor-not-allowed disabled:opacity-75',
86
80
  'transition-colors',
87
81
  ],
88
82
  leading: 'absolute inset-y-0 start-0 flex items-center',
89
- leadingIcon: 'shrink-0 text-dimmed',
83
+ leadingIcon: 'shrink-0 text-label-dimmed',
90
84
  leadingAvatar: 'shrink-0',
91
85
  leadingAvatarSize: '',
92
86
  trailing: 'absolute inset-y-0 end-0 flex items-center',
93
- trailingIcon: 'shrink-0 text-dimmed',
87
+ trailingIcon: 'shrink-0 text-label-dimmed',
94
88
  value: 'truncate pointer-events-none',
95
- placeholder: 'truncate text-dimmed',
89
+ placeholder: 'truncate text-label-dimmed',
96
90
  arrow: 'fill-bg stroke-default',
97
91
  content:
98
- 'max-h-60 w-(--bits-select-anchor-width) bg-inverted shadow-lg rounded-md ring ring-surface-accented overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--bits-select-content-transform-origin) pointer-events-auto flex flex-col',
92
+ 'max-h-60 w-(--bits-select-anchor-width) bg-label-inverted shadow-lg rounded-md ring p-1 ring-surface-accented overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--bits-select-content-transform-origin) pointer-events-auto flex flex-col',
99
93
  viewport: 'relative divide-y divide-base scroll-py-1 overflow-y-auto flex-1',
100
94
  group: 'p-1 isolate',
101
- empty: 'text-center text-muted',
102
- label: 'font-semibold text-highlighted',
95
+ empty: 'text-center text-label-muted',
96
+ label: 'font-semibold text-label-highlighted',
103
97
  separator: '-mx-1 my-1 h-px bg-border',
104
98
  item: [
105
- 'group relative w-full flex items-start select-none outline-none before:absolute before:content-[""] before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75 text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-[data-disabled]:before:bg-surface-elevated/50',
106
- 'transition-colors before:transition-colors',
99
+ 'group relative w-full flex items-start select-none outline-none whitespace-nowrap text-default rounded transition',
100
+ 'data-disabled:cursor-not-allowed data-disabled:opacity-75',
101
+ 'not-[data-disabled]:hover:text-label-highlighted not-[data-disabled]:hover:bg-surface-elevated/50',
107
102
  ],
108
103
  itemLeadingIcon: [
109
- 'shrink-0 text-dimmed group-data-highlighted:not-group-data-disabled:text-default',
104
+ 'shrink-0 text-label-dimmed group-data-highlighted:not-group-data-disabled:text-default',
110
105
  'transition-colors',
111
106
  ],
112
107
  itemLeadingAvatar: 'shrink-0',
@@ -117,7 +112,7 @@
117
112
  itemTrailingIcon: 'shrink-0',
118
113
  itemWrapper: 'flex-1 flex flex-col min-w-0',
119
114
  itemLabel: 'truncate',
120
- itemDescription: 'truncate text-muted',
115
+ itemDescription: 'truncate text-label-muted',
121
116
  },
122
117
  variants: {
123
118
  fieldGroup: {
@@ -210,13 +205,13 @@
210
205
  },
211
206
  variant: {
212
207
  outline:
213
- 'text-highlighted bg-default ring ring-inset ring-surface-accented hover:bg-surface-elevated disabled:bg-surface-default',
214
- soft: 'text-highlighted bg-surface-elevated/50 hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-surface-elevated/50',
208
+ 'text-label-highlighted bg-default ring ring-inset ring-surface-accented hover:bg-surface-elevated disabled:bg-surface-default',
209
+ soft: 'text-label-highlighted bg-surface-elevated/50 hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-surface-elevated/50',
215
210
  subtle:
216
- 'text-highlighted bg-surface-elevated ring ring-inset ring-accented hover:bg-surface-accented/75 disabled:bg-surface-elevated',
211
+ 'text-label-highlighted bg-surface-elevated ring ring-inset ring-accented hover:bg-surface-accented/75 disabled:bg-surface-elevated',
217
212
  ghost:
218
- 'text-highlighted bg-transparent hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-transparent dark:disabled:bg-transparent',
219
- none: 'text-highlighted bg-transparent',
213
+ 'text-label-highlighted bg-transparent hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-transparent dark:disabled:bg-transparent',
214
+ none: 'text-label-highlighted bg-transparent',
220
215
  },
221
216
  color: {
222
217
  primary: '',
@@ -242,7 +237,7 @@
242
237
  false: '',
243
238
  },
244
239
  type: {
245
- file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
240
+ file: 'file:me-1.5 file:font-medium file:text-label-muted file:outline-none',
246
241
  },
247
242
  },
248
243
  compoundVariants: [
@@ -407,13 +402,13 @@
407
402
  (v) => (value = v as T | T[] | undefined)
408
403
  }
409
404
  >
410
- <Select.Trigger class={classes.base({ class: ui.base })}>
405
+ <Select.Trigger class={variants.base({ class: ui.base })}>
411
406
  {value || placeholder}
412
- <div class="i-lucide-chevron-down size-4"></div>
407
+ <Icon name={dropdownicon} class="size-4" />
413
408
  </Select.Trigger>
414
409
  <Select.Portal>
415
410
  <Select.Content
416
- class={classes.content({ class: ui.content })}
411
+ class={variants.content({ class: ui.content })}
417
412
  preventScroll={true}
418
413
  sideOffset={8}
419
414
  >
@@ -425,13 +420,13 @@
425
420
  <Select.GroupHeading />
426
421
 
427
422
  {#each item as group_item, gidx (gidx)}
428
- <Select.Item class={classes.item({ class: ui.item })} value=""></Select.Item>
423
+ <Select.Item class={variants.item({ class: ui.item })} value=""></Select.Item>
429
424
  {/each}
430
425
  </Select.Group>
431
426
  {:else}
432
427
  {@const is_object = typeof item === 'object' && item !== null && 'value' in item}
433
428
  <Select.Item
434
- class={classes.item({ class: ui.item })}
429
+ class={variants.item({ class: ui.item })}
435
430
  value={(is_object ? item.value : item) as string}
436
431
  >
437
432
  {item}