@r2digisolutions/components 0.23.0 → 0.24.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 (50) hide show
  1. package/dist/components/atoms/Avatar/Avatar.stories.js +1 -1
  2. package/dist/components/atoms/BrandMark/BrandMark.svelte +47 -7
  3. package/dist/components/atoms/BrandMark/BrandMark.svelte.d.ts +4 -0
  4. package/dist/components/atoms/Input/Input.svelte +5 -4
  5. package/dist/components/atoms/Slider/Slider.svelte +19 -15
  6. package/dist/components/atoms/Slider/Slider.svelte.d.ts +2 -0
  7. package/dist/components/molecules/AuthCard/AuthCard.svelte +19 -4
  8. package/dist/components/molecules/AuthCard/AuthCard.svelte.d.ts +4 -0
  9. package/dist/components/molecules/CanvasElementsPanel/CanvasElementsPanel.svelte +90 -26
  10. package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +176 -5
  11. package/dist/components/molecules/ChipBar/ChipBar.svelte +18 -5
  12. package/dist/components/molecules/ChipBar/ChipBar.svelte.d.ts +1 -1
  13. package/dist/components/molecules/Combobox/Combobox.svelte +2 -2
  14. package/dist/components/molecules/DateTimePicker/DateTimePicker.svelte +121 -33
  15. package/dist/components/molecules/FormSection/FormSection.svelte +25 -28
  16. package/dist/components/molecules/ImageEditor/ImageEditor.svelte +183 -0
  17. package/dist/components/molecules/ImageEditor/ImageEditor.svelte.d.ts +19 -0
  18. package/dist/components/molecules/KnowledgeCard/KnowledgeCard.svelte +5 -5
  19. package/dist/components/molecules/LocaleSwitcher/LocaleSwitcher.svelte +58 -35
  20. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte +293 -39
  21. package/dist/components/molecules/MediaLayerItem/MediaLayerItem.svelte.d.ts +6 -1
  22. package/dist/components/molecules/MediaStage/MediaStage.svelte +302 -245
  23. package/dist/components/molecules/MentionInput/MentionInput.svelte +332 -120
  24. package/dist/components/molecules/MentionInput/MentionInput.svelte.d.ts +13 -2
  25. package/dist/components/molecules/SearchBar/SearchBar.svelte +7 -1
  26. package/dist/components/molecules/SearchInput/SearchInput.svelte +77 -18
  27. package/dist/components/molecules/SearchInput/SearchInput.svelte.d.ts +4 -0
  28. package/dist/components/molecules/SearchInput/SearchInputStory.svelte +1 -0
  29. package/dist/components/molecules/Select/Select.svelte +14 -1
  30. package/dist/components/molecules/Select/Select.svelte.d.ts +3 -0
  31. package/dist/components/molecules/UserMenu/UserMenu.svelte +30 -27
  32. package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte +200 -17
  33. package/dist/components/molecules/WidgetFrame/WidgetFrame.svelte.d.ts +14 -0
  34. package/dist/components/organisms/AppShell/AppShell.svelte +7 -1
  35. package/dist/components/organisms/AppShell/AppShell.svelte.d.ts +2 -0
  36. package/dist/components/organisms/AuthShell/AuthShell.svelte +61 -29
  37. package/dist/components/organisms/AuthShell/AuthShell.svelte.d.ts +4 -0
  38. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +156 -7
  39. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte.d.ts +5 -0
  40. package/dist/components/organisms/Navbar/Navbar.svelte +2 -2
  41. package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte +314 -141
  42. package/dist/components/organisms/ProfileHeaderUploader/ProfileHeaderUploader.svelte.d.ts +20 -1
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.js +2 -1
  45. package/dist/styles.css +17 -0
  46. package/dist/utils/canvasDocument.d.ts +56 -4
  47. package/dist/utils/canvasDocument.js +91 -2
  48. package/dist/utils/canvasExport.d.ts +1 -1
  49. package/dist/utils/canvasExport.js +15 -25
  50. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import IconButton from '../../atoms/IconButton/IconButton.svelte';
2
3
  import Input from '../../atoms/Input/Input.svelte';
3
4
 
4
5
  interface SearchInputProps {
@@ -8,6 +9,10 @@
8
9
  disabled?: boolean;
9
10
  size?: 'sm' | 'md' | 'lg';
10
11
  class?: string;
12
+ /** Accessible label for the submit control. */
13
+ submitLabel?: string;
14
+ /** Show the trailing submit button. Default true. */
15
+ showSubmit?: boolean;
11
16
  oninput?: (e: Event) => void;
12
17
  onsubmit?: (value: string) => void;
13
18
  onchange?: (e: Event) => void;
@@ -20,32 +25,86 @@
20
25
  disabled = false,
21
26
  size = 'md',
22
27
  class: className = '',
28
+ submitLabel = 'Search',
29
+ showSubmit = true,
23
30
  oninput,
24
31
  onsubmit,
25
32
  onchange
26
33
  }: SearchInputProps = $props();
27
34
 
35
+ const submitButtonSize = $derived(size === 'sm' ? 'xs' : 'sm');
36
+
37
+ function submit() {
38
+ onsubmit?.(value);
39
+ }
40
+
28
41
  function handleKeydown(e: KeyboardEvent) {
29
- if (e.key === 'Enter') onsubmit?.(value);
42
+ if (e.key !== 'Enter') return;
43
+ e.preventDefault();
44
+ submit();
30
45
  }
31
46
  </script>
32
47
 
33
- <div class={className} onkeydown={handleKeydown}>
34
- <Input
35
- {label}
36
- {placeholder}
48
+ {#snippet leadIcon()}
49
+ <svg
50
+ class="h-4 w-4"
51
+ viewBox="0 0 24 24"
52
+ fill="none"
53
+ stroke="currentColor"
54
+ stroke-width="2"
55
+ aria-hidden="true"
56
+ >
57
+ <path
58
+ stroke-linecap="round"
59
+ stroke-linejoin="round"
60
+ d="M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z"
61
+ />
62
+ </svg>
63
+ {/snippet}
64
+
65
+ {#snippet trailIcon()}
66
+ <IconButton
67
+ type="button"
68
+ variant="ghost"
69
+ size={submitButtonSize}
70
+ label={submitLabel}
37
71
  {disabled}
38
- {size}
39
- type="search"
40
- clearable
41
- bind:value
42
- {oninput}
43
- {onchange}
72
+ class="-me-1.5"
73
+ onclick={(e) => {
74
+ e.preventDefault();
75
+ e.stopPropagation();
76
+ submit();
77
+ }}
44
78
  >
45
- {#snippet leadIcon()}
46
- <svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
47
- <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z" />
48
- </svg>
49
- {/snippet}
50
- </Input>
51
- </div>
79
+ <svg
80
+ class="h-full w-full"
81
+ viewBox="0 0 24 24"
82
+ fill="none"
83
+ stroke="currentColor"
84
+ stroke-width="2"
85
+ aria-hidden="true"
86
+ >
87
+ <path
88
+ stroke-linecap="round"
89
+ stroke-linejoin="round"
90
+ d="M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z"
91
+ />
92
+ </svg>
93
+ </IconButton>
94
+ {/snippet}
95
+
96
+ <Input
97
+ {label}
98
+ {placeholder}
99
+ {disabled}
100
+ {size}
101
+ type="search"
102
+ clearable
103
+ class={className}
104
+ bind:value
105
+ {oninput}
106
+ {onchange}
107
+ onkeydown={handleKeydown}
108
+ {leadIcon}
109
+ trailIcon={showSubmit ? trailIcon : undefined}
110
+ />
@@ -5,6 +5,10 @@ interface SearchInputProps {
5
5
  disabled?: boolean;
6
6
  size?: 'sm' | 'md' | 'lg';
7
7
  class?: string;
8
+ /** Accessible label for the submit control. */
9
+ submitLabel?: string;
10
+ /** Show the trailing submit button. Default true. */
11
+ showSubmit?: boolean;
8
12
  oninput?: (e: Event) => void;
9
13
  onsubmit?: (value: string) => void;
10
14
  onchange?: (e: Event) => void;
@@ -17,6 +17,7 @@
17
17
  placeholder={props.placeholder ?? 'Search projects…'}
18
18
  size={props.size ?? 'md'}
19
19
  disabled={props.disabled ?? false}
20
+ submitLabel="Search"
20
21
  onsubmit={(v) => (lastSubmit = v)}
21
22
  />
22
23
  {#if lastSubmit}
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import type { Snippet } from 'svelte';
2
3
  import { on } from 'svelte/events';
3
4
  import { createId } from '../../../utils/id.js';
4
5
  import { popoverInvokerToggle } from '../../../utils/popoverInvoker.js';
@@ -37,6 +38,8 @@
37
38
  listboxMinWidth?: number;
38
39
  class?: string;
39
40
  onchange?: (value: string) => void;
41
+ /** Extra row at the bottom of the list (for example, create). */
42
+ footer?: Snippet;
40
43
  }
41
44
 
42
45
  let {
@@ -55,7 +58,8 @@
55
58
  size = 'md',
56
59
  listboxMinWidth,
57
60
  class: className = '',
58
- onchange
61
+ onchange,
62
+ footer
59
63
  }: SelectProps = $props();
60
64
 
61
65
  let isOpen = $state(false);
@@ -739,6 +743,15 @@
739
743
  {/each}
740
744
  {/if}
741
745
  </div>
746
+ {#if footer}
747
+ <div
748
+ class="border-border p-1.5 shrink-0 border-t"
749
+ role="presentation"
750
+ onclick={() => closeListbox()}
751
+ >
752
+ {@render footer()}
753
+ </div>
754
+ {/if}
742
755
  </div>
743
756
  </div>
744
757
 
@@ -1,3 +1,4 @@
1
+ import type { Snippet } from 'svelte';
1
2
  export interface SelectOption {
2
3
  value: string;
3
4
  label: string;
@@ -31,6 +32,8 @@ interface SelectProps {
31
32
  listboxMinWidth?: number;
32
33
  class?: string;
33
34
  onchange?: (value: string) => void;
35
+ /** Extra row at the bottom of the list (for example, create). */
36
+ footer?: Snippet;
34
37
  }
35
38
  declare const Select: import("svelte").Component<SelectProps, {}, "value">;
36
39
  type Select = ReturnType<typeof Select>;
@@ -101,7 +101,8 @@
101
101
  };
102
102
  });
103
103
 
104
- const avatarSize = $derived(size === 'sm' ? 'sm' : size === 'lg' ? 'lg' : 'md');
104
+ const compact = $derived(size === 'sm' && !showSubtitle);
105
+ const avatarSize = $derived(compact ? 'xs' : size === 'lg' ? 'lg' : size === 'sm' ? 'sm' : 'md');
105
106
  const statusLabel = $derived(
106
107
  status === 'online'
107
108
  ? 'Online'
@@ -221,34 +222,36 @@
221
222
  });
222
223
  </script>
223
224
 
224
- <div class={['relative flex w-full min-w-0', className]}>
225
+ <div class={['min-w-0 relative flex w-full', className]}>
225
226
  <button
226
227
  bind:this={triggerEl}
227
228
  type="button"
228
229
  class={[
229
- 'inline-flex w-full min-w-0 max-w-full items-center text-left transition-colors',
230
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40',
230
+ 'min-w-0 inline-flex w-full max-w-full items-center text-left transition-colors',
231
+ 'focus-visible:ring-brand-500/40 focus-visible:ring-2 focus-visible:outline-none',
231
232
  variant === 'outline' &&
232
- 'gap-2.5 rounded-xl border border-border bg-surface-elevated hover:bg-surface-overlay',
233
- variant === 'ghost' && 'gap-2 rounded-lg border border-transparent hover:bg-surface-overlay',
234
- size === 'sm' && (variant === 'ghost' ? 'px-1.5 py-1' : 'px-2 py-1.5'),
233
+ 'gap-2.5 rounded-xl border-border bg-surface-elevated hover:bg-surface-overlay border',
234
+ variant === 'ghost' && 'gap-2 rounded-lg hover:bg-surface-overlay border border-transparent',
235
+ compact && 'h-8 gap-2 py-0',
236
+ compact && (variant === 'ghost' ? 'px-1' : 'px-2'),
237
+ !compact && size === 'sm' && (variant === 'ghost' ? 'px-1.5 py-1' : 'px-2.5 py-1'),
235
238
  size === 'md' && (variant === 'ghost' ? 'px-2 py-1.5' : 'px-2.5 py-2'),
236
239
  size === 'lg' && (variant === 'ghost' ? 'px-2.5 py-2' : 'px-3 py-2.5'),
237
- open && (variant === 'ghost' ? 'bg-surface-overlay' : 'ring-2 ring-brand-500/30')
240
+ open && (variant === 'ghost' ? 'bg-surface-overlay' : 'ring-brand-500/30 ring-2')
238
241
  ]}
239
242
  aria-haspopup="menu"
240
243
  aria-expanded={open}
241
244
  aria-controls={menuId || undefined}
242
245
  {@attach popoverInvokerToggle(() => menuEl)}
243
246
  >
244
- <span class="shrink-0">
247
+ <span class="flex shrink-0 items-center">
245
248
  <Avatar {src} {name} size={avatarSize} {status} />
246
249
  </span>
247
250
  {#if showMeta}
248
- <span class="hidden min-w-0 flex-1 overflow-hidden sm:block">
249
- <span class="block truncate text-sm font-medium text-primary">{name}</span>
251
+ <span class="min-w-0 sm:block hidden flex-1 overflow-hidden">
252
+ <span class="text-sm font-medium text-primary block truncate">{name}</span>
250
253
  {#if showSubtitle && (email || role)}
251
- <span class="block truncate text-xs text-muted">
254
+ <span class="text-xs text-muted block truncate">
252
255
  {role ? `${role}` : ''}{role && email ? ' · ' : ''}{email ?? ''}
253
256
  </span>
254
257
  {/if}
@@ -256,7 +259,7 @@
256
259
  {/if}
257
260
  {#if showChevron}
258
261
  <svg
259
- class={['h-4 w-4 shrink-0 text-muted transition-transform', open && 'rotate-180']}
262
+ class={['h-4 w-4 text-muted shrink-0 transition-transform', open && 'rotate-180']}
260
263
  viewBox="0 0 24 24"
261
264
  fill="none"
262
265
  stroke="currentColor"
@@ -278,26 +281,26 @@
278
281
  style={menuStyle}
279
282
  ontoggle={handleToggle}
280
283
  onbeforetoggle={handleBeforeToggle}
281
- class="user-menu m-0 overflow-hidden rounded-2xl border border-border bg-surface-elevated shadow-xl inset-auto outline-none"
284
+ class="user-menu m-0 rounded-2xl border-border bg-surface-elevated shadow-xl inset-auto overflow-hidden border outline-none"
282
285
  >
283
286
  {#if header}
284
287
  {@render header()}
285
288
  {:else}
286
- <div class="border-b border-border bg-surface-overlay/50 px-3.5 py-3">
287
- <div class="flex items-start gap-3">
289
+ <div class="border-border bg-surface-overlay/50 px-3.5 py-3 border-b">
290
+ <div class="gap-3 flex items-start">
288
291
  <Avatar {src} {name} size="lg" {status} />
289
- <div class="min-w-0 flex-1 pt-0.5">
290
- <p class="truncate text-sm font-semibold text-primary">{name}</p>
292
+ <div class="min-w-0 pt-0.5 flex-1">
293
+ <p class="text-sm font-semibold text-primary truncate">{name}</p>
291
294
  {#if email}
292
- <p class="truncate text-xs text-muted">{email}</p>
295
+ <p class="text-xs text-muted truncate">{email}</p>
293
296
  {/if}
294
- <div class="mt-2 flex flex-wrap items-center gap-2">
297
+ <div class="mt-2 gap-2 flex flex-wrap items-center">
295
298
  {#if status && statusLabel}
296
299
  <StatusDot {status} size="sm" showLabel label={statusLabel} />
297
300
  {/if}
298
301
  {#if role}
299
302
  <span
300
- class="rounded-md bg-surface-elevated px-1.5 py-0.5 text-[10px] font-medium text-secondary ring-1 ring-border"
303
+ class="rounded-md bg-surface-elevated px-1.5 py-0.5 font-medium text-secondary ring-border text-[10px] ring-1"
301
304
  >
302
305
  {role}
303
306
  </span>
@@ -314,7 +317,7 @@
314
317
  <div class="p-1.5">
315
318
  {#each items as item (item.id)}
316
319
  {#if item.separator}
317
- <div class="my-1.5 border-t border-border" role="separator"></div>
320
+ <div class="my-1.5 border-border border-t" role="separator"></div>
318
321
  {:else}
319
322
  <button
320
323
  type="button"
@@ -322,8 +325,8 @@
322
325
  disabled={item.disabled}
323
326
  onclick={() => select(item)}
324
327
  class={[
325
- 'flex w-full items-start gap-2 rounded-xl px-2.5 py-2 text-left transition-colors',
326
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/30',
328
+ 'gap-2 rounded-xl px-2.5 py-2 flex w-full items-start text-left transition-colors',
329
+ 'focus-visible:ring-brand-500/30 focus-visible:ring-2 focus-visible:outline-none',
327
330
  item.destructive
328
331
  ? 'text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40'
329
332
  : 'text-primary hover:bg-surface-overlay',
@@ -331,13 +334,13 @@
331
334
  ]}
332
335
  >
333
336
  <span class="min-w-0 flex-1">
334
- <span class="block text-sm font-medium">{item.label}</span>
337
+ <span class="text-sm font-medium block">{item.label}</span>
335
338
  {#if item.description}
336
- <span class="block text-xs text-muted">{item.description}</span>
339
+ <span class="text-xs text-muted block">{item.description}</span>
337
340
  {/if}
338
341
  </span>
339
342
  {#if item.shortcut}
340
- <span class="mt-0.5 shrink-0 font-mono text-[10px] text-muted">{item.shortcut}</span>
343
+ <span class="mt-0.5 font-mono text-muted shrink-0 text-[10px]">{item.shortcut}</span>
341
344
  {/if}
342
345
  </button>
343
346
  {/if}