@r2digisolutions/components 0.19.16 → 0.19.18

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 (26) hide show
  1. package/dist/components/atoms/Slider/Slider.stories.d.ts +8 -1
  2. package/dist/components/atoms/Slider/Slider.stories.js +17 -1
  3. package/dist/components/atoms/Slider/Slider.svelte +89 -64
  4. package/dist/components/atoms/Slider/Slider.svelte.d.ts +3 -1
  5. package/dist/components/atoms/Slider/SliderStory.svelte +4 -2
  6. package/dist/components/atoms/Slider/SliderStory.svelte.d.ts +2 -1
  7. package/dist/components/molecules/BulkActionBar/BulkActionBar.stories.d.ts +1 -1
  8. package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +61 -29
  9. package/dist/components/molecules/ColorPicker/ColorPicker.svelte +5 -1
  10. package/dist/components/molecules/ColorPicker/ColorPicker.svelte.d.ts +1 -1
  11. package/dist/components/molecules/MediaStage/MediaStage.svelte +7 -1
  12. package/dist/components/molecules/NewsletterSignup/NewsletterSignup.stories.d.ts +1 -1
  13. package/dist/components/molecules/PropertyField/PropertyField.svelte +51 -30
  14. package/dist/components/molecules/PropertyField/PropertyField.svelte.d.ts +5 -1
  15. package/dist/components/molecules/PropertyField/PropertyFieldStory.svelte +2 -1
  16. package/dist/components/molecules/Select/Select.svelte +2 -1
  17. package/dist/components/molecules/Select/Select.svelte.d.ts +1 -1
  18. package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +2 -1
  19. package/dist/components/organisms/Menubar/Menubar.svelte +271 -53
  20. package/dist/components/organisms/Menubar/Menubar.svelte.d.ts +4 -0
  21. package/dist/components/organisms/Menubar/MenubarStory.svelte +53 -21
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/utils/canvasDocument.d.ts +11 -1
  25. package/dist/utils/canvasDocument.js +31 -1
  26. package/package.json +1 -1
@@ -9,7 +9,8 @@ declare const meta: {
9
9
  value?: number;
10
10
  disabled?: boolean;
11
11
  showValue?: boolean;
12
- valuePosition?: "header" | "tooltip";
12
+ valuePosition?: "header" | "tooltip" | "inline";
13
+ variant?: "default" | "inset";
13
14
  showMarks?: boolean;
14
15
  unit?: string;
15
16
  size?: "sm" | "md" | "lg";
@@ -41,6 +42,10 @@ declare const meta: {
41
42
  control: "select";
42
43
  options: string[];
43
44
  };
45
+ variant: {
46
+ control: "select";
47
+ options: string[];
48
+ };
44
49
  showMarks: {
45
50
  control: "boolean";
46
51
  };
@@ -61,6 +66,7 @@ declare const meta: {
61
66
  disabled: false;
62
67
  showValue: true;
63
68
  valuePosition: "tooltip";
69
+ variant: "default";
64
70
  showMarks: true;
65
71
  unit: string;
66
72
  size: "md";
@@ -70,4 +76,5 @@ export default meta;
70
76
  type Story = StoryObj<typeof meta>;
71
77
  export declare const FloatingTooltip: Story;
72
78
  export declare const HeaderValue: Story;
79
+ export declare const InsetPanel: Story;
73
80
  export declare const LargeSize: Story;
@@ -11,7 +11,8 @@ const meta = {
11
11
  value: { control: 'number' },
12
12
  disabled: { control: 'boolean' },
13
13
  showValue: { control: 'boolean' },
14
- valuePosition: { control: 'select', options: ['tooltip', 'header'] },
14
+ valuePosition: { control: 'select', options: ['tooltip', 'header', 'inline'] },
15
+ variant: { control: 'select', options: ['default', 'inset'] },
15
16
  showMarks: { control: 'boolean' },
16
17
  unit: { control: 'text' },
17
18
  size: { control: 'select', options: ['sm', 'md', 'lg'] }
@@ -25,6 +26,7 @@ const meta = {
25
26
  disabled: false,
26
27
  showValue: true,
27
28
  valuePosition: 'tooltip',
29
+ variant: 'default',
28
30
  showMarks: true,
29
31
  unit: '%',
30
32
  size: 'md'
@@ -37,6 +39,20 @@ export const FloatingTooltip = {
37
39
  export const HeaderValue = {
38
40
  args: { label: 'Budget Limit', valuePosition: 'header', min: 100, max: 2000, step: 50, value: 850, unit: '€', showMarks: true }
39
41
  };
42
+ export const InsetPanel = {
43
+ args: {
44
+ label: undefined,
45
+ variant: 'inset',
46
+ valuePosition: 'inline',
47
+ size: 'sm',
48
+ value: 0.65,
49
+ min: 0,
50
+ max: 1,
51
+ step: 0.01,
52
+ showMarks: false,
53
+ unit: ''
54
+ }
55
+ };
40
56
  export const LargeSize = {
41
57
  args: { label: 'Zoom Level', size: 'lg', value: 120, min: 50, max: 200, unit: '%', showMarks: true }
42
58
  };
@@ -9,7 +9,9 @@
9
9
  value?: number;
10
10
  disabled?: boolean;
11
11
  showValue?: boolean;
12
- valuePosition?: 'header' | 'tooltip';
12
+ valuePosition?: 'header' | 'tooltip' | 'inline';
13
+ /** Bordered inset control — for UE-style details / inspector panels. */
14
+ variant?: 'default' | 'inset';
13
15
  showMarks?: boolean;
14
16
  unit?: string;
15
17
  size?: 'sm' | 'md' | 'lg';
@@ -29,6 +31,7 @@
29
31
  disabled = false,
30
32
  showValue = true,
31
33
  valuePosition = 'tooltip',
34
+ variant = 'default',
32
35
  showMarks = false,
33
36
  unit = '',
34
37
  size = 'md',
@@ -42,19 +45,27 @@
42
45
 
43
46
  const sliderId = $derived(id ?? `slider-${Math.random().toString(36).slice(2, 9)}`);
44
47
  const percentage = $derived(Math.min(100, Math.max(0, ((value - min) / (max - min)) * 100)));
48
+ const inset = $derived(variant === 'inset');
49
+ const inlineValue = $derived(showValue && (valuePosition === 'inline' || inset));
45
50
 
46
51
  const trackHeightClasses = {
47
- sm: 'h-1.5',
48
- md: 'h-2',
49
- lg: 'h-3'
52
+ sm: 'h-1',
53
+ md: 'h-1.5',
54
+ lg: 'h-2'
50
55
  };
51
56
 
52
57
  const thumbSizeClasses = {
53
- sm: 'h-4 w-4 -ml-2',
54
- md: 'h-5 w-5 -ml-2.5',
55
- lg: 'h-6 w-6 -ml-3'
58
+ sm: 'h-3 w-3 -ml-1.5',
59
+ md: 'h-3.5 w-3.5 -ml-[7px]',
60
+ lg: 'h-4 w-4 -ml-2'
56
61
  };
57
62
 
63
+ function formatValue(v: number): string {
64
+ if (Number.isInteger(step) && Number.isInteger(v)) return String(v);
65
+ const decimals = String(step).includes('.') ? String(step).split('.')[1]?.length ?? 2 : 2;
66
+ return v.toFixed(Math.min(decimals, 2));
67
+ }
68
+
58
69
  function handleInput(e: Event) {
59
70
  const target = e.target as HTMLInputElement;
60
71
  value = parseFloat(target.value);
@@ -68,17 +79,17 @@
68
79
  }
69
80
  </script>
70
81
 
71
- <div class={['flex flex-col gap-2 w-full select-none', className]}>
72
- {#if label || (showValue && valuePosition === 'header')}
82
+ <div class={['flex w-full select-none flex-col gap-1.5', className]}>
83
+ {#if label || (showValue && valuePosition === 'header' && !inset)}
73
84
  <div class="flex items-center justify-between text-sm font-medium">
74
85
  {#if label}
75
86
  <label for={sliderId} class="text-primary">{label}</label>
76
87
  {:else}
77
88
  <span></span>
78
89
  {/if}
79
- {#if showValue && valuePosition === 'header'}
80
- <span class="text-xs font-semibold font-mono text-brand-600 dark:text-brand-400">
81
- {value}{unit}
90
+ {#if showValue && valuePosition === 'header' && !inset}
91
+ <span class="font-mono text-xs font-semibold text-brand-600 dark:text-brand-400">
92
+ {formatValue(value)}{unit}
82
93
  </span>
83
94
  {/if}
84
95
  </div>
@@ -86,69 +97,83 @@
86
97
 
87
98
  <!-- svelte-ignore a11y_no_static_element_interactions -->
88
99
  <div
89
- class="relative flex items-center w-full py-2 cursor-pointer touch-none"
100
+ class={[
101
+ 'relative flex w-full items-center gap-2',
102
+ inset &&
103
+ 'h-7 rounded-md border border-border bg-surface-overlay/80 px-2 shadow-sm dark:bg-surface-overlay/50',
104
+ !inset && 'py-1.5'
105
+ ]}
90
106
  onmouseenter={() => (isHovered = true)}
91
107
  onmouseleave={() => (isHovered = false)}
92
108
  >
93
- <!-- Track background -->
94
- <div
95
- class={[
96
- 'w-full rounded-full bg-border-strong dark:bg-surface-overlay relative overflow-hidden',
97
- trackHeightClasses[size]
98
- ]}
99
- >
100
- <!-- Fill bar -->
101
- <div class="h-full bg-brand-500 rounded-full" style="width: {percentage}%"></div>
102
- </div>
109
+ <div class="relative flex min-w-0 flex-1 cursor-pointer touch-none items-center py-1">
110
+ <!-- Track background -->
111
+ <div
112
+ class={[
113
+ 'relative w-full overflow-hidden rounded-full',
114
+ inset ? 'bg-border dark:bg-surface-elevated' : 'bg-border-strong dark:bg-surface-overlay',
115
+ trackHeightClasses[size]
116
+ ]}
117
+ >
118
+ <!-- Fill bar -->
119
+ <div class="h-full rounded-full bg-brand-500" style="width: {percentage}%"></div>
120
+ </div>
103
121
 
104
- <!-- Custom Floating Thumb / Handle -->
105
- <div
106
- class={[
107
- 'absolute top-1/2 -translate-y-1/2 rounded-full bg-white dark:bg-slate-900 border-2 border-brand-500 shadow-md pointer-events-none flex items-center justify-center',
108
- 'transition-[transform,box-shadow] duration-100',
109
- thumbSizeClasses[size],
110
- (isFocused || isHovered) && 'scale-110 ring-4 ring-brand-500/20',
111
- disabled && 'opacity-50 border-gray-400'
112
- ]}
113
- style="left: {percentage}%"
114
- >
115
- <!-- Inner brand dot -->
116
- <span class="h-1.5 w-1.5 rounded-full bg-brand-500"></span>
122
+ <!-- Custom Floating Thumb / Handle -->
123
+ <div
124
+ class={[
125
+ 'pointer-events-none absolute top-1/2 flex -translate-y-1/2 items-center justify-center rounded-full border-2 border-brand-500 bg-white shadow-md dark:bg-slate-900',
126
+ 'transition-[transform,box-shadow] duration-100',
127
+ thumbSizeClasses[size],
128
+ (isFocused || isHovered) && 'scale-110 ring-2 ring-brand-500/25',
129
+ disabled && 'border-gray-400 opacity-50'
130
+ ]}
131
+ style="left: {percentage}%"
132
+ >
133
+ <span class="h-1 w-1 rounded-full bg-brand-500"></span>
117
134
 
118
- <!-- Floating Tooltip directly above thumb -->
119
- {#if showValue && valuePosition === 'tooltip' && (isHovered || isFocused)}
120
- <div
121
- class="absolute -top-9 left-1/2 -translate-x-1/2 px-2 py-0.5 rounded-md bg-slate-900 dark:bg-slate-100 text-white dark:text-slate-900 text-[11px] font-bold font-mono shadow-lg whitespace-nowrap pointer-events-none animate-in fade-in zoom-in-95 duration-150"
122
- >
123
- {value}{unit}
124
- <!-- Tooltip arrow -->
135
+ {#if showValue && valuePosition === 'tooltip' && !inset && (isHovered || isFocused)}
125
136
  <div
126
- class="absolute -bottom-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-slate-900 dark:bg-slate-100 rotate-45"
127
- ></div>
128
- </div>
129
- {/if}
137
+ class="pointer-events-none absolute -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-slate-900 px-1.5 py-0.5 font-mono text-[10px] font-bold text-white shadow-lg animate-in fade-in zoom-in-95 duration-150 dark:bg-slate-100 dark:text-slate-900"
138
+ >
139
+ {formatValue(value)}{unit}
140
+ <div
141
+ class="absolute -bottom-1 left-1/2 h-1.5 w-1.5 -translate-x-1/2 rotate-45 bg-slate-900 dark:bg-slate-100"
142
+ ></div>
143
+ </div>
144
+ {/if}
145
+ </div>
146
+
147
+ <!-- Transparent native input for accessibility and drag interaction -->
148
+ <input
149
+ id={sliderId}
150
+ type="range"
151
+ {name}
152
+ {min}
153
+ {max}
154
+ {step}
155
+ {disabled}
156
+ bind:value
157
+ class="absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
158
+ oninput={handleInput}
159
+ onchange={handleChange}
160
+ onfocus={() => (isFocused = true)}
161
+ onblur={() => (isFocused = false)}
162
+ />
130
163
  </div>
131
164
 
132
- <!-- Transparent native input for accessibility and drag interaction -->
133
- <input
134
- id={sliderId}
135
- type="range"
136
- {name}
137
- {min}
138
- {max}
139
- {step}
140
- {disabled}
141
- bind:value
142
- class="absolute inset-0 w-full opacity-0 cursor-pointer disabled:cursor-not-allowed h-full z-10"
143
- oninput={handleInput}
144
- onchange={handleChange}
145
- onfocus={() => (isFocused = true)}
146
- onblur={() => (isFocused = false)}
147
- />
165
+ {#if inlineValue}
166
+ <span
167
+ class="w-9 shrink-0 text-right font-mono text-[10px] font-semibold tabular-nums text-secondary"
168
+ aria-hidden="true"
169
+ >
170
+ {formatValue(value)}{unit}
171
+ </span>
172
+ {/if}
148
173
  </div>
149
174
 
150
175
  {#if showMarks}
151
- <div class="flex items-center justify-between text-[11px] font-mono text-muted -mt-1 px-0.5">
176
+ <div class="-mt-0.5 flex items-center justify-between px-0.5 font-mono text-[10px] text-muted">
152
177
  <span>{min}{unit}</span>
153
178
  <span>{max}{unit}</span>
154
179
  </div>
@@ -8,7 +8,9 @@ interface SliderProps {
8
8
  value?: number;
9
9
  disabled?: boolean;
10
10
  showValue?: boolean;
11
- valuePosition?: 'header' | 'tooltip';
11
+ valuePosition?: 'header' | 'tooltip' | 'inline';
12
+ /** Bordered inset control — for UE-style details / inspector panels. */
13
+ variant?: 'default' | 'inset';
12
14
  showMarks?: boolean;
13
15
  unit?: string;
14
16
  size?: 'sm' | 'md' | 'lg';
@@ -9,7 +9,8 @@
9
9
  value?: number;
10
10
  disabled?: boolean;
11
11
  showValue?: boolean;
12
- valuePosition?: 'header' | 'tooltip';
12
+ valuePosition?: 'header' | 'tooltip' | 'inline';
13
+ variant?: 'default' | 'inset';
13
14
  showMarks?: boolean;
14
15
  unit?: string;
15
16
  size?: 'sm' | 'md' | 'lg';
@@ -18,13 +19,14 @@
18
19
 
19
20
  <div class="w-80 max-w-full p-4">
20
21
  <Slider
21
- label={props.label ?? 'Volume'}
22
+ label={props.label}
22
23
  min={props.min ?? 0}
23
24
  max={props.max ?? 100}
24
25
  step={props.step ?? 1}
25
26
  disabled={props.disabled ?? false}
26
27
  showValue={props.showValue ?? true}
27
28
  valuePosition={props.valuePosition ?? 'tooltip'}
29
+ variant={props.variant ?? 'default'}
28
30
  showMarks={props.showMarks ?? true}
29
31
  unit={props.unit ?? '%'}
30
32
  size={props.size ?? 'md'}
@@ -6,7 +6,8 @@ type $$ComponentProps = {
6
6
  value?: number;
7
7
  disabled?: boolean;
8
8
  showValue?: boolean;
9
- valuePosition?: 'header' | 'tooltip';
9
+ valuePosition?: 'header' | 'tooltip' | 'inline';
10
+ variant?: 'default' | 'inset';
10
11
  showMarks?: boolean;
11
12
  unit?: string;
12
13
  size?: 'sm' | 'md' | 'lg';
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/svelte';
2
2
  declare const meta: {
3
3
  title: string;
4
4
  component: import("svelte").Component<{
5
- example?: "loading" | "default" | "neutral" | "compact" | "inline" | "icons";
5
+ example?: "loading" | "default" | "inline" | "neutral" | "compact" | "icons";
6
6
  size?: import("./BulkActionBar.svelte.ts").BulkActionBarSize;
7
7
  placement?: import("./BulkActionBar.svelte.ts").BulkActionBarPlacement;
8
8
  tone?: import("./BulkActionBar.svelte.ts").BulkActionBarTone;