uisv 0.0.21 → 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 (74) 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 +18 -23
  8. package/dist/components/badge.svelte.d.ts +3 -3
  9. package/dist/components/banner.svelte +18 -24
  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 -44
  14. package/dist/components/button.svelte.d.ts +12 -11
  15. package/dist/components/calendar.svelte +6 -7
  16. package/dist/components/calendar.svelte.d.ts +3 -3
  17. package/dist/components/card.svelte +11 -12
  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 +7 -8
  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/index.d.ts +6 -0
  35. package/dist/components/index.js +6 -0
  36. package/dist/components/input-number.svelte +5 -7
  37. package/dist/components/input-number.svelte.d.ts +5 -5
  38. package/dist/components/input-time.svelte +11 -12
  39. package/dist/components/input-time.svelte.d.ts +6 -6
  40. package/dist/components/input.svelte +11 -12
  41. package/dist/components/input.svelte.d.ts +6 -6
  42. package/dist/components/kbd.svelte +6 -7
  43. package/dist/components/kbd.svelte.d.ts +2 -2
  44. package/dist/components/modal.svelte +189 -0
  45. package/dist/components/modal.svelte.d.ts +33 -0
  46. package/dist/components/p.svelte +3 -1
  47. package/dist/components/pin-input.svelte +10 -11
  48. package/dist/components/pin-input.svelte.d.ts +3 -3
  49. package/dist/components/placeholder.svelte +4 -4
  50. package/dist/components/popover.svelte +33 -61
  51. package/dist/components/popover.svelte.d.ts +8 -30
  52. package/dist/components/progress.svelte +22 -21
  53. package/dist/components/progress.svelte.d.ts +5 -5
  54. package/dist/components/select.svelte +48 -53
  55. package/dist/components/select.svelte.d.ts +22 -29
  56. package/dist/components/seperator.svelte +6 -7
  57. package/dist/components/seperator.svelte.d.ts +6 -6
  58. package/dist/components/slider.svelte +13 -14
  59. package/dist/components/slider.svelte.d.ts +4 -4
  60. package/dist/components/switch.svelte +17 -22
  61. package/dist/components/switch.svelte.d.ts +6 -6
  62. package/dist/components/tabs.svelte +19 -20
  63. package/dist/components/tabs.svelte.d.ts +7 -7
  64. package/dist/components/tooltip.svelte +94 -0
  65. package/dist/components/tooltip.svelte.d.ts +24 -0
  66. package/dist/contexts.d.ts +47 -0
  67. package/dist/contexts.js +46 -0
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +1 -0
  70. package/dist/mode.d.ts +89 -0
  71. package/dist/mode.js +1 -0
  72. package/dist/utilities.svelte.d.ts +1 -1
  73. package/dist/vite.js +30 -35
  74. package/package.json +31 -26
@@ -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}
@@ -1,10 +1,11 @@
1
1
  import type { PropColor, PropVariant } from '../index.js';
2
2
  import { Select } from 'bits-ui';
3
3
  import type { Component, Snippet } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
4
+ import { type ClassValue } from 'tailwind-variants';
5
5
  export type SelectItem<T> = T | {
6
6
  icon?: string | Component;
7
- label: string | Component;
7
+ iconposition?: 'leading' | 'trailing';
8
+ label: string | Component | Snippet;
8
9
  value: T;
9
10
  };
10
11
  export type SelectProps<T> = {
@@ -19,34 +20,26 @@ export type SelectProps<T> = {
19
20
  highlight?: boolean;
20
21
  placeholder?: string;
21
22
  ui?: {
22
- base?: ClassNameValue;
23
- leading?: ClassNameValue;
24
- leadingIcon?: ClassNameValue;
25
- leadingAvatar?: ClassNameValue;
26
- leadingAvatarSize?: ClassNameValue;
27
- trailing?: ClassNameValue;
28
- trailingIcon?: ClassNameValue;
29
- value?: ClassNameValue;
30
- placeholder?: ClassNameValue;
31
- arrow?: ClassNameValue;
32
- content?: ClassNameValue;
33
- viewport?: ClassNameValue;
34
- group?: ClassNameValue;
35
- empty?: ClassNameValue;
36
- label?: ClassNameValue;
37
- separator?: ClassNameValue;
38
- item?: ClassNameValue;
39
- itemLeadingIcon?: ClassNameValue;
40
- itemLeadingAvatar?: ClassNameValue;
41
- itemLeadingAvatarSize?: ClassNameValue;
42
- itemLeadingChip?: ClassNameValue;
43
- itemLeadingChipSize?: ClassNameValue;
44
- itemTrailing?: ClassNameValue;
45
- itemTrailingIcon?: ClassNameValue;
46
- itemWrapper?: ClassNameValue;
47
- itemLabel?: ClassNameValue;
48
- itemDescription?: ClassNameValue;
23
+ base?: ClassValue;
24
+ leading?: ClassValue;
25
+ icon?: ClassValue;
26
+ leadingAvatar?: ClassValue;
27
+ leadingAvatarSize?: ClassValue;
28
+ trailing?: ClassValue;
29
+ value?: ClassValue;
30
+ placeholder?: ClassValue;
31
+ arrow?: ClassValue;
32
+ content?: ClassValue;
33
+ viewport?: ClassValue;
34
+ group?: ClassValue;
35
+ empty?: ClassValue;
36
+ label?: ClassValue;
37
+ separator?: ClassValue;
38
+ item?: ClassValue;
39
+ itemicon?: ClassValue;
40
+ dropdownicon?: ClassValue;
49
41
  };
42
+ dropdownicon?: string | Component;
50
43
  } & ({
51
44
  value?: T;
52
45
  type?: 'single';
@@ -1,12 +1,11 @@
1
1
  <script module lang="ts">
2
2
  import { Icon, type PropColor, isComponent, isSnippet } from '../index.js';
3
3
  import type { Snippet } 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
  import type { Component } from 'svelte';
7
6
 
8
7
  export type SeperatorProps = {
9
- label?: string | Snippet<[ClassNameValue]> | Component;
8
+ label?: string | Snippet<[ClassValue]> | Component;
10
9
  icon?: string | Component;
11
10
  color?: PropColor;
12
11
  type?: 'dashed' | 'solid' | 'dotted';
@@ -14,10 +13,10 @@
14
13
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
15
14
  orientation?: 'horizontal' | 'vertical';
16
15
  ui?: {
17
- root?: ClassNameValue;
18
- border?: ClassNameValue;
19
- icon?: ClassNameValue;
20
- label?: ClassNameValue;
16
+ root?: ClassValue;
17
+ border?: ClassValue;
18
+ icon?: ClassValue;
19
+ label?: ClassValue;
21
20
  };
22
21
  };
23
22
  </script>
@@ -1,9 +1,9 @@
1
1
  import { type PropColor } from '../index.js';
2
2
  import type { Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
3
+ import { type ClassValue } from 'tailwind-variants';
4
4
  import type { Component } from 'svelte';
5
5
  export type SeperatorProps = {
6
- label?: string | Snippet<[ClassNameValue]> | Component;
6
+ label?: string | Snippet<[ClassValue]> | Component;
7
7
  icon?: string | Component;
8
8
  color?: PropColor;
9
9
  type?: 'dashed' | 'solid' | 'dotted';
@@ -11,10 +11,10 @@ export type SeperatorProps = {
11
11
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
12
  orientation?: 'horizontal' | 'vertical';
13
13
  ui?: {
14
- root?: ClassNameValue;
15
- border?: ClassNameValue;
16
- icon?: ClassNameValue;
17
- label?: ClassNameValue;
14
+ root?: ClassValue;
15
+ border?: ClassValue;
16
+ icon?: ClassValue;
17
+ label?: ClassValue;
18
18
  };
19
19
  };
20
20
  declare const Seperator: Component<SeperatorProps, {}, "">;
@@ -1,8 +1,7 @@
1
1
  <script module lang="ts">
2
2
  import { Slider } from 'bits-ui';
3
3
  import type { PropColor } from '../index.js';
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 SliderProps<T> = {
8
7
  value?: T;
@@ -16,9 +15,9 @@
16
15
  min?: number;
17
16
  max?: number;
18
17
  ui?: {
19
- root?: ClassNameValue;
20
- range?: ClassNameValue;
21
- thumb?: ClassNameValue;
18
+ root?: ClassValue;
19
+ range?: ClassValue;
20
+ thumb?: ClassValue;
22
21
  };
23
22
  };
24
23
  </script>
@@ -54,15 +53,15 @@
54
53
  },
55
54
  });
56
55
  const thumbs = $derived(slider_value.get()?.length ?? 1);
57
- const classes = $derived.by(() =>
56
+ const variants = $derived.by(() =>
58
57
  tv({
59
58
  slots: {
60
59
  root: [
61
- 'relative w-full flex rounded-full bg-neutral-300',
60
+ 'relative w-full flex rounded-full bg-label-dimmed',
62
61
  orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1',
63
62
  ],
64
63
  range: [
65
- 'rounded-full bg-neutral-200 p-0.5 relative transition',
64
+ 'rounded-full bg-surface-accented p-0.5 relative transition',
66
65
  orientation === 'horizontal' ? 'h-full' : 'w-full',
67
66
  ],
68
67
  thumb: 'bg-white rounded-full border-2 outline-none transition',
@@ -76,8 +75,8 @@
76
75
  thumb: 'border-primary-500',
77
76
  },
78
77
  surface: {
79
- range: ['bg-neutral-900'],
80
- thumb: 'border-neutral-900',
78
+ range: ['bg-surface-inverted'],
79
+ thumb: 'border-surface-inverted',
81
80
  },
82
81
  info: {
83
82
  range: ['bg-info-500'],
@@ -149,18 +148,18 @@
149
148
  {step}
150
149
  {orientation}
151
150
  {disabled}
152
- class={classes.root({ class: [disabled ? 'opacity-75 cursor-not-allowed' : '', ui.root] })}
151
+ class={variants.root({ class: [disabled ? 'opacity-75 cursor-not-allowed' : '', ui.root] })}
153
152
  >
154
- <Slider.Range class={classes.range({ class: [ui.range] })} />
153
+ <Slider.Range class={variants.range({ class: [ui.range] })} />
155
154
 
156
155
  {#each { length: thumbs }, index (index)}
157
- <Slider.Thumb {index} class={classes.thumb({ class: ['group', ui.thumb] })}>
156
+ <Slider.Thumb {index} class={variants.thumb({ class: ['group', ui.thumb] })}>
158
157
  {#if thumblabel}
159
158
  <Slider.ThumbLabel
160
159
  {index}
161
160
  position="bottom"
162
161
  class={[
163
- 'opacity-0 transition pointer-events-none text-sm shadow-md px-2 h-6 flex items-center rounded-md mt-1 border border-surface-200',
162
+ 'opacity-0 transition pointer-events-none text-sm shadow-md px-2 h-6 flex items-center rounded-md mt-1 border border-surface-accented',
164
163
  'data-[active=""]:opacity-100 group-hover:opacity-100',
165
164
  ]}
166
165
  >
@@ -1,6 +1,6 @@
1
1
  import { Slider } from 'bits-ui';
2
2
  import type { PropColor } from '../index.js';
3
- import type { ClassNameValue } from 'tailwind-merge';
3
+ import { type ClassValue } from 'tailwind-variants';
4
4
  export type SliderProps<T> = {
5
5
  value?: T;
6
6
  default?: number | number[];
@@ -13,9 +13,9 @@ export type SliderProps<T> = {
13
13
  min?: number;
14
14
  max?: number;
15
15
  ui?: {
16
- root?: ClassNameValue;
17
- range?: ClassNameValue;
18
- thumb?: ClassNameValue;
16
+ root?: ClassValue;
17
+ range?: ClassValue;
18
+ thumb?: ClassValue;
19
19
  };
20
20
  };
21
21
  declare function $$render<T extends number | number[]>(): {