ui-svelte 0.2.12 → 0.2.13

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 (98) hide show
  1. package/README.md +2 -2
  2. package/dist/charts/ArcChart.svelte +0 -1
  3. package/dist/control/Fab.svelte +103 -0
  4. package/dist/control/Fab.svelte.d.ts +25 -0
  5. package/dist/control/Record.svelte +0 -3
  6. package/dist/control/ToggleTheme.svelte +1 -1
  7. package/dist/control/Video.svelte +2 -0
  8. package/dist/control/css/btn.css +17 -17
  9. package/dist/control/css/fab.css +84 -0
  10. package/dist/control/css/media.css +7 -7
  11. package/dist/control/css/toggle-group.css +1 -17
  12. package/dist/css/decorations.css +348 -189
  13. package/dist/css/utilities.css +0 -4
  14. package/dist/display/Accordion.svelte +3 -3
  15. package/dist/display/Accordion.svelte.d.ts +1 -1
  16. package/dist/display/Card.svelte +3 -3
  17. package/dist/display/Card.svelte.d.ts +1 -1
  18. package/dist/display/Code.svelte +1 -1
  19. package/dist/display/Collapsible.svelte +3 -3
  20. package/dist/display/Collapsible.svelte.d.ts +1 -1
  21. package/dist/display/Countdown.svelte +169 -0
  22. package/dist/display/Countdown.svelte.d.ts +21 -0
  23. package/dist/display/Item.svelte +12 -0
  24. package/dist/display/Item.svelte.d.ts +2 -0
  25. package/dist/display/Marquee.svelte +0 -2
  26. package/dist/display/Section.svelte +3 -3
  27. package/dist/display/Section.svelte.d.ts +1 -1
  28. package/dist/display/css/accordion.css +14 -14
  29. package/dist/display/css/alert.css +42 -15
  30. package/dist/display/css/avatar.css +36 -36
  31. package/dist/display/css/card.css +108 -36
  32. package/dist/display/css/chip.css +16 -16
  33. package/dist/display/css/collapsible.css +32 -32
  34. package/dist/display/css/countdown.css +206 -0
  35. package/dist/display/css/item.css +24 -0
  36. package/dist/display/css/marquee.css +0 -3
  37. package/dist/display/css/section.css +88 -109
  38. package/dist/display/css/table.css +1 -16
  39. package/dist/form/ColorField.svelte +60 -2
  40. package/dist/form/DragDrop.svelte +317 -87
  41. package/dist/form/DragDrop.svelte.d.ts +1 -0
  42. package/dist/form/Dropzone.svelte +3 -3
  43. package/dist/form/Dropzone.svelte.d.ts +1 -1
  44. package/dist/form/ImageCropper.svelte +135 -4
  45. package/dist/form/RadioGroup.svelte +6 -2
  46. package/dist/form/RadioGroup.svelte.d.ts +1 -1
  47. package/dist/form/Slider.svelte +6 -2
  48. package/dist/form/Slider.svelte.d.ts +1 -1
  49. package/dist/form/TextField.svelte +13 -4
  50. package/dist/form/TextField.svelte.d.ts +3 -2
  51. package/dist/form/Toggle.svelte +6 -2
  52. package/dist/form/Toggle.svelte.d.ts +1 -1
  53. package/dist/form/css/control.css +14 -14
  54. package/dist/form/css/csv-field.css +8 -13
  55. package/dist/form/css/drag-drop.css +90 -127
  56. package/dist/form/css/dropzone.css +8 -8
  57. package/dist/form/css/editor.css +14 -14
  58. package/dist/form/css/image-cropper.css +28 -7
  59. package/dist/form/css/radio-group.css +25 -0
  60. package/dist/form/css/slider.css +36 -0
  61. package/dist/form/css/textarea.css +14 -14
  62. package/dist/form/css/toggle.css +12 -0
  63. package/dist/hooks/use-chat.svelte.js +1 -1
  64. package/dist/hooks/use-form.svelte.js +3 -3
  65. package/dist/hooks/use-search.svelte.js +0 -3
  66. package/dist/icons/index.d.ts +4 -0
  67. package/dist/icons/index.js +4 -0
  68. package/dist/index.css +28 -48
  69. package/dist/index.d.ts +4 -2
  70. package/dist/index.js +3 -1
  71. package/dist/layout/Provider.svelte +5 -5
  72. package/dist/layout/Sidebar.svelte +17 -8
  73. package/dist/layout/Sidebar.svelte.d.ts +2 -1
  74. package/dist/layout/css/app-bar.css +7 -7
  75. package/dist/layout/css/footer.css +7 -7
  76. package/dist/layout/css/sidebar.css +120 -59
  77. package/dist/navigation/BottomNav.svelte +23 -14
  78. package/dist/navigation/css/bottom-nav.css +74 -34
  79. package/dist/navigation/css/nav-menu.css +14 -15
  80. package/dist/navigation/css/side-nav.css +14 -15
  81. package/dist/overlay/AlertDialog.svelte +58 -0
  82. package/dist/overlay/AlertDialog.svelte.d.ts +14 -25
  83. package/dist/overlay/Command.svelte +177 -170
  84. package/dist/overlay/Command.svelte.d.ts +12 -3
  85. package/dist/overlay/Drawer.svelte +4 -4
  86. package/dist/overlay/Drawer.svelte.d.ts +1 -1
  87. package/dist/overlay/Modal.svelte +4 -4
  88. package/dist/overlay/Modal.svelte.d.ts +1 -1
  89. package/dist/overlay/Tooltip.svelte +0 -5
  90. package/dist/overlay/css/command.css +30 -42
  91. package/dist/overlay/css/drawer.css +10 -10
  92. package/dist/overlay/css/modal.css +70 -18
  93. package/dist/overlay/css/toast.css +42 -14
  94. package/dist/overlay/css/tooltip.css +49 -23
  95. package/dist/stores/theme.svelte.js +19 -12
  96. package/package.json +1 -1
  97. package/dist/utils/charts.d.ts +0 -27
  98. package/dist/utils/charts.js +0 -140
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SappsUI
1
+ # Ui Svelte
2
2
 
3
3
  **A modern, accessible UI component library built for Svelte 5**
4
4
 
@@ -89,7 +89,7 @@ bun add ui-svelte
89
89
 
90
90
  ## 📖 Documentation
91
91
 
92
- For detailed documentation, examples, and interactive component previews, visit our [official documentation](https://ui.sappsdev.com).
92
+ For detailed documentation, examples, and interactive component previews, visit our [official documentation](https://ui-svelte.sappsdev.com).
93
93
 
94
94
  ---
95
95
 
@@ -412,7 +412,6 @@
412
412
  {@const isHovered = hoveredIndex === i}
413
413
  {@const isDisabled = arc.disabled}
414
414
 
415
- <!-- Background arc -->
416
415
  <circle
417
416
  cx={center}
418
417
  cy={center}
@@ -0,0 +1,103 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { IconData } from '../display/Icon.svelte';
4
+ import { IconButton } from '../index.js';
5
+ import { cn } from '../utils/class-names.js';
6
+ import { Add24RegularIcon } from '../icons/index.js';
7
+ import { slide } from 'svelte/transition';
8
+
9
+ export type FabAction = {
10
+ icon: IconData;
11
+ label?: string;
12
+ color?: 'primary' | 'secondary' | 'muted' | 'success' | 'info' | 'danger' | 'warning';
13
+ onclick?: () => void;
14
+ };
15
+
16
+ type Props = {
17
+ class?: string;
18
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
19
+ icon?: IconData;
20
+ color?: 'primary' | 'secondary' | 'muted' | 'success' | 'info' | 'danger' | 'warning';
21
+ variant?: 'solid' | 'soft';
22
+ size?: 'sm' | 'md' | 'lg' | 'xl';
23
+ actions?: FabAction[];
24
+ isBlock?: boolean;
25
+ offsetX?: string;
26
+ offsetY?: string;
27
+ onclick?: () => void;
28
+ children?: Snippet;
29
+ };
30
+
31
+ const {
32
+ class: className,
33
+ position = 'bottom-right',
34
+ icon = Add24RegularIcon,
35
+ color = 'primary',
36
+ variant = 'solid',
37
+ size = 'lg',
38
+ actions = [],
39
+ isBlock = false,
40
+ offsetX,
41
+ offsetY,
42
+ onclick,
43
+ children
44
+ }: Props = $props();
45
+
46
+ let isOpen = $state(false);
47
+
48
+ const positionClasses = {
49
+ 'top-left': 'is-top-left',
50
+ 'top-right': 'is-top-right',
51
+ 'bottom-left': 'is-bottom-left',
52
+ 'bottom-right': 'is-bottom-right'
53
+ };
54
+
55
+ function handleTriggerClick() {
56
+ if (actions.length > 0) {
57
+ isOpen = !isOpen;
58
+ }
59
+ onclick?.();
60
+ }
61
+
62
+ function handleActionClick(action: FabAction) {
63
+ action.onclick?.();
64
+ isOpen = false;
65
+ }
66
+ </script>
67
+
68
+ <div
69
+ class={cn('fab-container', positionClasses[position], !isBlock && 'is-fixed', className)}
70
+ style:--fab-offset-x={offsetX}
71
+ style:--fab-offset-y={offsetY}
72
+ >
73
+ {#if isOpen && actions.length > 0}
74
+ <div class="fab-actions" transition:slide={{ duration: 200 }}>
75
+ {#each actions as action, index}
76
+ <div
77
+ class="fab-action"
78
+ style="--fab-action-index: {index}; --fab-action-delay: {index * 50}ms"
79
+ transition:slide={{ duration: 150, delay: index * 50 }}
80
+ >
81
+ {#if action.label}
82
+ <span class="fab-action-label">{action.label}</span>
83
+ {/if}
84
+ <IconButton
85
+ icon={action.icon}
86
+ color={action.color ?? 'muted'}
87
+ {variant}
88
+ size="md"
89
+ onclick={() => handleActionClick(action)}
90
+ />
91
+ </div>
92
+ {/each}
93
+ </div>
94
+ {/if}
95
+
96
+ <div class="fab-trigger" class:is-open={isOpen}>
97
+ {#if children}
98
+ {@render children()}
99
+ {:else}
100
+ <IconButton {icon} {color} {variant} {size} onclick={handleTriggerClick} />
101
+ {/if}
102
+ </div>
103
+ </div>
@@ -0,0 +1,25 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { IconData } from '../display/Icon.svelte';
3
+ export type FabAction = {
4
+ icon: IconData;
5
+ label?: string;
6
+ color?: 'primary' | 'secondary' | 'muted' | 'success' | 'info' | 'danger' | 'warning';
7
+ onclick?: () => void;
8
+ };
9
+ type Props = {
10
+ class?: string;
11
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
12
+ icon?: IconData;
13
+ color?: 'primary' | 'secondary' | 'muted' | 'success' | 'info' | 'danger' | 'warning';
14
+ variant?: 'solid' | 'soft';
15
+ size?: 'sm' | 'md' | 'lg' | 'xl';
16
+ actions?: FabAction[];
17
+ isBlock?: boolean;
18
+ offsetX?: string;
19
+ offsetY?: string;
20
+ onclick?: () => void;
21
+ children?: Snippet;
22
+ };
23
+ declare const Fab: import("svelte").Component<Props, {}, "">;
24
+ type Fab = ReturnType<typeof Fab>;
25
+ export default Fab;
@@ -351,7 +351,6 @@
351
351
 
352
352
  <div class={baseClasses}>
353
353
  {#if isReviewing}
354
- <!-- REVIEW STATE: Play/Pause preview, waveform, time, confirm/discard -->
355
354
  <IconButton
356
355
  onclick={togglePlayback}
357
356
  icon={isPlaying ? PauseFilledIcon : PlayFilledIcon}
@@ -394,7 +393,6 @@
394
393
  />
395
394
  </div>
396
395
  {:else if !isRecording}
397
- <!-- IDLE STATE: Start recording button -->
398
396
  <IconButton
399
397
  onclick={startRecording}
400
398
  icon={Microphone2LinearIcon}
@@ -416,7 +414,6 @@
416
414
  </div>
417
415
  </div>
418
416
  {:else}
419
- <!-- RECORDING STATE: Pause/Resume, waveform, time, discard, stop -->
420
417
  {#if isPaused}
421
418
  <IconButton
422
419
  onclick={resumeRecording}
@@ -10,7 +10,7 @@
10
10
  class?: string;
11
11
  };
12
12
 
13
- let { color = 'muted', variant = 'ghost', size = 'md', class: className }: Props = $props();
13
+ let { color = 'primary', variant = 'ghost', size = 'md', class: className }: Props = $props();
14
14
  </script>
15
15
 
16
16
  <IconButton
@@ -204,6 +204,7 @@
204
204
  min={0}
205
205
  max={1}
206
206
  step={0.1}
207
+ {color}
207
208
  size="sm"
208
209
  name="video-volume"
209
210
  hideLabel
@@ -241,6 +242,7 @@
241
242
  max={videoParams.duration}
242
243
  bind:value={videoParams.time}
243
244
  name="video-time"
245
+ {color}
244
246
  hideLabel
245
247
  />
246
248
  </div>
@@ -126,25 +126,25 @@
126
126
 
127
127
  .btn.is-soft {
128
128
  &.is-primary {
129
- @apply bg-on-primary text-primary hover:bg-on-primary/80;
129
+ @apply bg-soft-primary text-primary hover:bg-soft-primary/60;
130
130
  }
131
131
  &.is-secondary {
132
- @apply bg-on-secondary text-secondary hover:bg-on-secondary/80;
132
+ @apply bg-soft-secondary text-secondary hover:bg-soft-secondary/60;
133
133
  }
134
134
  &.is-muted {
135
- @apply bg-muted text-on-muted hover:bg-muted/80;
135
+ @apply bg-soft-muted text-on-muted hover:bg-soft-muted/60;
136
136
  }
137
137
  &.is-success {
138
- @apply bg-on-success text-success hover:bg-on-success/80;
138
+ @apply bg-soft-success text-success hover:bg-soft-success/60;
139
139
  }
140
140
  &.is-info {
141
- @apply bg-on-info text-info hover:bg-on-info/80;
141
+ @apply bg-soft-info text-info hover:bg-soft-info/60;
142
142
  }
143
143
  &.is-warning {
144
- @apply bg-on-warning text-warning hover:bg-on-warning/80;
144
+ @apply bg-soft-warning text-warning hover:bg-soft-warning/60;
145
145
  }
146
146
  &.is-danger {
147
- @apply bg-on-danger text-danger hover:bg-on-danger/80;
147
+ @apply bg-soft-danger text-danger hover:bg-soft-danger/60;
148
148
  }
149
149
  }
150
150
 
@@ -156,7 +156,7 @@
156
156
  @apply bg-secondary text-on-secondary hover:bg-secondary/80;
157
157
  }
158
158
  &.is-muted {
159
- @apply bg-on-muted text-muted hover:bg-on-muted/80;
159
+ @apply bg-muted text-on-muted hover:bg-muted/80;
160
160
  }
161
161
  &.is-success {
162
162
  @apply bg-success text-on-success hover:bg-success/80;
@@ -180,7 +180,7 @@
180
180
  @apply inset-ring-2 inset-ring-secondary text-secondary hover:bg-secondary hover:text-on-secondary;
181
181
  }
182
182
  &.is-muted {
183
- @apply inset-ring-2 inset-ring-on-muted text-on-muted hover:bg-on-muted hover:text-muted;
183
+ @apply inset-ring-2 inset-ring-muted text-on-muted hover:bg-muted hover:text-on-muted;
184
184
  }
185
185
  &.is-success {
186
186
  @apply inset-ring-2 inset-ring-success text-success hover:bg-success hover:text-on-success;
@@ -204,7 +204,7 @@
204
204
  @apply text-secondary hover:bg-secondary hover:text-on-secondary;
205
205
  }
206
206
  &.is-muted {
207
- @apply text-on-muted hover:bg-on-muted hover:text-muted;
207
+ @apply text-on-muted hover:bg-muted hover:text-on-muted;
208
208
  }
209
209
  &.is-success {
210
210
  @apply text-success hover:bg-success hover:text-on-success;
@@ -222,25 +222,25 @@
222
222
 
223
223
  .btn.is-overlay {
224
224
  &.is-primary {
225
- @apply bg-on-primary/60 text-primary hover:bg-on-primary/80;
225
+ @apply bg-overlay text-on-overlay hover:bg-primary hover:text-on-primary;
226
226
  }
227
227
  &.is-secondary {
228
- @apply bg-on-secondary/60 text-secondary hover:bg-on-secondary/80;
228
+ @apply bg-overlay text-on-overlay hover:bg-secondary hover:text-on-secondary;
229
229
  }
230
230
  &.is-muted {
231
- @apply bg-muted/60 text-on-muted hover:bg-muted/80;
231
+ @apply bg-overlay text-on-overlay hover:bg-muted hover:text-on-muted;
232
232
  }
233
233
  &.is-success {
234
- @apply bg-on-success/60 text-success hover:bg-on-success/80;
234
+ @apply bg-overlay text-on-overlay hover:bg-success hover:text-on-success;
235
235
  }
236
236
  &.is-info {
237
- @apply bg-on-info/60 text-info hover:bg-on-info/80;
237
+ @apply bg-overlay text-on-overlay hover:bg-info hover:text-on-info;
238
238
  }
239
239
  &.is-warning {
240
- @apply bg-on-warning/60 text-warning hover:bg-on-warning/80;
240
+ @apply bg-overlay text-on-overlay hover:bg-warning hover:text-on-warning;
241
241
  }
242
242
  &.is-danger {
243
- @apply bg-on-danger/60 text-danger hover:bg-on-danger/80;
243
+ @apply bg-overlay text-on-overlay hover:bg-danger hover:text-on-danger;
244
244
  }
245
245
  }
246
246
 
@@ -0,0 +1,84 @@
1
+ @layer components {
2
+ .fab-container {
3
+ --fab-offset-x: 1rem;
4
+ --fab-offset-y: 1rem;
5
+
6
+ @apply absolute z-50 flex flex-col items-center;
7
+
8
+ &.is-fixed {
9
+ @apply fixed;
10
+ }
11
+
12
+ &.is-top-left {
13
+ top: var(--fab-offset-y);
14
+ left: var(--fab-offset-x);
15
+ @apply flex-col-reverse;
16
+ .fab-actions {
17
+ @apply flex-col-reverse mt-3;
18
+ }
19
+ .fab-action {
20
+ @apply flex-row-reverse;
21
+ .fab-action-label {
22
+ @apply ml-0 mr-3;
23
+ }
24
+ }
25
+ }
26
+
27
+ &.is-top-right {
28
+ top: var(--fab-offset-y);
29
+ right: var(--fab-offset-x);
30
+ @apply flex-col-reverse;
31
+ .fab-actions {
32
+ @apply flex-col-reverse mt-3;
33
+ }
34
+ }
35
+
36
+ &.is-bottom-left {
37
+ bottom: var(--fab-offset-y);
38
+ left: var(--fab-offset-x);
39
+ .fab-action {
40
+ @apply flex-row-reverse;
41
+ .fab-action-label {
42
+ @apply ml-0 mr-3;
43
+ }
44
+ }
45
+ }
46
+
47
+ &.is-bottom-right {
48
+ bottom: var(--fab-offset-y);
49
+ right: var(--fab-offset-x);
50
+ }
51
+ }
52
+
53
+ .fab-trigger {
54
+ @apply transition-transform duration-300;
55
+
56
+ &.is-open {
57
+ @apply rotate-45;
58
+ }
59
+ }
60
+
61
+ .fab-actions {
62
+ @apply flex flex-col gap-3 mb-3;
63
+ }
64
+
65
+ .fab-action {
66
+ @apply flex items-center justify-end;
67
+ animation: fab-action-appear 0.2s ease-out forwards;
68
+ animation-delay: var(--fab-action-delay, 0ms);
69
+ opacity: 0;
70
+ transform: scale(0.8) translateY(10px);
71
+ }
72
+
73
+ @keyframes fab-action-appear {
74
+ to {
75
+ opacity: 1;
76
+ transform: scale(1) translateY(0);
77
+ }
78
+ }
79
+
80
+ .fab-action-label {
81
+ @apply ml-3 px-3 py-1.5 text-sm font-medium whitespace-nowrap;
82
+ @apply bg-surface text-on-surface rounded-ui shadow-md;
83
+ }
84
+ }
@@ -6,25 +6,25 @@
6
6
 
7
7
  &.is-soft {
8
8
  &.is-primary {
9
- @apply bg-on-primary text-primary;
9
+ @apply bg-soft-primary text-primary;
10
10
  }
11
11
  &.is-secondary {
12
- @apply bg-on-secondary text-secondary;
12
+ @apply bg-soft-secondary text-secondary;
13
13
  }
14
14
  &.is-muted {
15
- @apply bg-muted text-on-muted;
15
+ @apply bg-soft-muted text-on-muted;
16
16
  }
17
17
  &.is-success {
18
- @apply bg-on-success text-success;
18
+ @apply bg-soft-success text-success;
19
19
  }
20
20
  &.is-info {
21
- @apply bg-on-info text-info;
21
+ @apply bg-soft-info text-info;
22
22
  }
23
23
  &.is-warning {
24
- @apply bg-on-warning text-warning;
24
+ @apply bg-soft-warning text-warning;
25
25
  }
26
26
  &.is-danger {
27
- @apply bg-on-danger text-danger;
27
+ @apply bg-soft-danger text-danger;
28
28
  }
29
29
  }
30
30
 
@@ -56,12 +56,8 @@
56
56
  @apply flex-1;
57
57
  }
58
58
 
59
- /* ===================== */
60
- /* Soft Variant (default) */
61
- /* ===================== */
62
-
63
59
  .toggle-group.is-soft {
64
- @apply bg-muted;
60
+ @apply bg-soft-muted;
65
61
  }
66
62
 
67
63
  .toggle-group.is-soft .toggle-group-item:not(.is-active) {
@@ -100,10 +96,6 @@
100
96
  @apply bg-danger text-on-danger;
101
97
  }
102
98
 
103
- /* ===================== */
104
- /* Solid Variant */
105
- /* ===================== */
106
-
107
99
  .toggle-group.is-solid.is-primary {
108
100
  @apply bg-on-primary;
109
101
  }
@@ -188,10 +180,6 @@
188
180
  @apply bg-danger text-on-danger;
189
181
  }
190
182
 
191
- /* ===================== */
192
- /* Outlined Variant */
193
- /* ===================== */
194
-
195
183
  .toggle-group.is-outlined {
196
184
  @apply bg-transparent inset-ring inset-ring-muted;
197
185
  }
@@ -228,10 +216,6 @@
228
216
  @apply bg-danger text-on-danger;
229
217
  }
230
218
 
231
- /* ===================== */
232
- /* Ghost Variant */
233
- /* ===================== */
234
-
235
219
  .toggle-group.is-ghost {
236
220
  @apply bg-transparent p-0;
237
221
  }