@joewinke/jatui 0.1.4 → 0.1.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",
@@ -0,0 +1,59 @@
1
+ <!--
2
+ UserAvatar — shows a user's avatar image or initials fallback.
3
+ Generic component with no DB type coupling.
4
+ For use anywhere a user needs to be visually represented.
5
+ -->
6
+ <script lang="ts">
7
+ interface Props {
8
+ name?: string | null
9
+ email?: string | null
10
+ avatarUrl?: string | null
11
+ size?: 'xs' | 'sm' | 'md' | 'lg'
12
+ tooltip?: boolean
13
+ class?: string
14
+ }
15
+
16
+ let {
17
+ name = null,
18
+ email = null,
19
+ avatarUrl = null,
20
+ size = 'sm',
21
+ tooltip = true,
22
+ class: className = '',
23
+ }: Props = $props()
24
+
25
+ const sizeClasses: Record<string, string> = {
26
+ xs: 'w-5 h-5 text-[9px]',
27
+ sm: 'w-7 h-7 text-xs',
28
+ md: 'w-9 h-9 text-sm',
29
+ lg: 'w-12 h-12 text-base',
30
+ }
31
+
32
+ const initials = $derived.by(() => {
33
+ const source = name || email || ''
34
+ if (!source) return '?'
35
+ // For email, use first char before @
36
+ const parts = source.includes('@')
37
+ ? [source.split('@')[0]]
38
+ : source.split(' ').filter(Boolean)
39
+ if (parts.length >= 2) return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase()
40
+ return parts[0]?.charAt(0).toUpperCase() || '?'
41
+ })
42
+
43
+ const label = $derived(name || email || 'Unknown')
44
+ </script>
45
+
46
+ <div
47
+ class="inline-flex shrink-0 {className}"
48
+ title={tooltip ? label : undefined}
49
+ >
50
+ <div class="rounded-full overflow-hidden {sizeClasses[size]}">
51
+ {#if avatarUrl}
52
+ <img src={avatarUrl} alt={label} class="w-full h-full object-cover" />
53
+ {:else}
54
+ <div class="w-full h-full bg-neutral text-neutral-content flex items-center justify-center font-semibold">
55
+ {initials}
56
+ </div>
57
+ {/if}
58
+ </div>
59
+ </div>
@@ -10,8 +10,8 @@
10
10
  PipelineViewMode,
11
11
  StageColors,
12
12
  PipelineTableColumn
13
- } from '$lib/types/pipeline';
14
- import { DEFAULT_PIPELINE_CONFIG } from '$lib/types/pipeline';
13
+ } from '../../types/pipeline';
14
+ import { DEFAULT_PIPELINE_CONFIG } from '../../types/pipeline';
15
15
  import PipelineColumn from './PipelineColumn.svelte';
16
16
 
17
17
  interface Props {
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { PipelineItem, PipelineStage, StageColors } from '$lib/types/pipeline';
2
+ import type { PipelineItem, PipelineStage, StageColors } from '../../types/pipeline';
3
3
 
4
4
  interface Props {
5
5
  item: PipelineItem;
@@ -5,7 +5,7 @@
5
5
  PipelineItem,
6
6
  StageColors,
7
7
  PipelineDragConfig
8
- } from '$lib/types/pipeline';
8
+ } from '../../types/pipeline';
9
9
  import { dndzone } from 'svelte-dnd-action';
10
10
  import { flip } from 'svelte/animate';
11
11
  import PipelineCard from './PipelineCard.svelte';
package/src/lib/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Components — Universal
2
+ export { default as UserAvatar } from './components/UserAvatar.svelte';
3
+
1
4
  // Components — from JAT IDE
2
5
  export { default as SearchDropdown } from './components/SearchDropdown.svelte';
3
6
  export { default as FilterDropdown } from './components/FilterDropdown.svelte';