@r2digisolutions/components 0.21.7 → 0.21.9
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/dist/components/molecules/Chart/Chart.svelte +63 -21
- package/dist/components/molecules/Chart/Chart.svelte.d.ts +3 -0
- package/dist/components/molecules/FormNumberInput/FormNumberInput.svelte +22 -7
- package/dist/components/molecules/FormSelect/FormSelect.svelte +22 -7
- package/dist/components/molecules/FormTextarea/FormTextarea.svelte +22 -7
- package/dist/components/molecules/SegmentedControl/SegmentedControl.svelte +8 -3
- package/dist/components/organisms/AnalyticsPage/AnalyticsPage.svelte +3 -3
- package/dist/components/organisms/AssetPickerPage/AssetPickerPage.svelte +3 -3
- package/dist/components/organisms/BacklogPage/BacklogPage.svelte +3 -3
- package/dist/components/organisms/DashboardPage/DashboardPage.svelte +3 -3
- package/dist/components/organisms/DataListPage/DataListPage.svelte +3 -3
- package/dist/components/organisms/ExploreFeedPage/ExploreFeedPage.svelte +3 -3
- package/dist/components/organisms/PermissionsMatrix/PermissionsMatrix.svelte +3 -3
- package/dist/components/organisms/ProjectOverviewPage/ProjectOverviewPage.svelte +3 -3
- package/dist/components/organisms/Scheduler/Scheduler.svelte +3 -3
- package/dist/components/organisms/TeamPage/TeamPage.svelte +3 -3
- package/dist/utils/formContext.d.ts +5 -6
- package/dist/utils/formContext.js +13 -7
- package/package.json +1 -1
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
data?: ChartPoint[];
|
|
12
12
|
height?: number;
|
|
13
13
|
showLegend?: boolean;
|
|
14
|
+
/** Max tick labels on the X axis (line/bar). */
|
|
15
|
+
maxLabels?: number;
|
|
16
|
+
emptyLabel?: string;
|
|
14
17
|
class?: string;
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -19,6 +22,8 @@
|
|
|
19
22
|
data = [],
|
|
20
23
|
height = 180,
|
|
21
24
|
showLegend = true,
|
|
25
|
+
maxLabels = 7,
|
|
26
|
+
emptyLabel = 'No data',
|
|
22
27
|
class: className = ''
|
|
23
28
|
}: ChartProps = $props();
|
|
24
29
|
|
|
@@ -32,16 +37,19 @@
|
|
|
32
37
|
];
|
|
33
38
|
|
|
34
39
|
const max = $derived(Math.max(...data.map((d) => d.value), 1));
|
|
35
|
-
const total = $derived(data.reduce((s, d) => s + d.value, 0)
|
|
40
|
+
const total = $derived(data.reduce((s, d) => s + d.value, 0));
|
|
41
|
+
const isEmpty = $derived(data.length === 0 || total === 0);
|
|
42
|
+
|
|
43
|
+
const labelStep = $derived(Math.max(1, Math.ceil(data.length / maxLabels)));
|
|
36
44
|
|
|
37
45
|
const linePoints = $derived.by(() => {
|
|
38
46
|
if (data.length < 2) return '';
|
|
39
47
|
const w = 320;
|
|
40
|
-
const h = height -
|
|
48
|
+
const h = height - 28;
|
|
41
49
|
return data
|
|
42
50
|
.map((d, i) => {
|
|
43
51
|
const x = 16 + (i / (data.length - 1)) * (w - 32);
|
|
44
|
-
const y =
|
|
52
|
+
const y = 12 + (1 - d.value / max) * (h - 16);
|
|
45
53
|
return `${x},${y}`;
|
|
46
54
|
})
|
|
47
55
|
.join(' ');
|
|
@@ -52,8 +60,9 @@
|
|
|
52
60
|
const cy = 90;
|
|
53
61
|
const r = 70;
|
|
54
62
|
let angle = -Math.PI / 2;
|
|
63
|
+
const denom = total || 1;
|
|
55
64
|
return data.map((d, i) => {
|
|
56
|
-
const slice = (d.value /
|
|
65
|
+
const slice = (d.value / denom) * Math.PI * 2;
|
|
57
66
|
const x1 = cx + r * Math.cos(angle);
|
|
58
67
|
const y1 = cy + r * Math.sin(angle);
|
|
59
68
|
angle += slice;
|
|
@@ -68,21 +77,33 @@
|
|
|
68
77
|
};
|
|
69
78
|
});
|
|
70
79
|
});
|
|
80
|
+
|
|
81
|
+
function showLabel(i: number): boolean {
|
|
82
|
+
if (data.length <= maxLabels) return true;
|
|
83
|
+
return i % labelStep === 0 || i === data.length - 1;
|
|
84
|
+
}
|
|
71
85
|
</script>
|
|
72
86
|
|
|
73
|
-
<div class={['w-full space-y-3', className]}>
|
|
74
|
-
{#if type
|
|
87
|
+
<div class={['relative w-full space-y-3', className]}>
|
|
88
|
+
{#if isEmpty && type !== 'donut'}
|
|
89
|
+
<div
|
|
90
|
+
class="border-border bg-surface-overlay/40 text-muted flex items-center justify-center rounded-xl border border-dashed text-sm"
|
|
91
|
+
style:height={`${height}px`}
|
|
92
|
+
>
|
|
93
|
+
{emptyLabel}
|
|
94
|
+
</div>
|
|
95
|
+
{:else if type === 'bar'}
|
|
75
96
|
<svg
|
|
76
97
|
viewBox={`0 0 320 ${height}`}
|
|
77
|
-
preserveAspectRatio="
|
|
98
|
+
preserveAspectRatio="xMidYMid meet"
|
|
78
99
|
class="block w-full"
|
|
79
100
|
style:height={`${height}px`}
|
|
80
101
|
role="img"
|
|
81
102
|
aria-label="Bar chart"
|
|
82
103
|
>
|
|
83
104
|
{#each data as d, i}
|
|
84
|
-
{@const bw = Math.max(
|
|
85
|
-
{@const x = 16 + i * ((320 - 32) / data.length)}
|
|
105
|
+
{@const bw = Math.max(8, (320 - 32) / Math.max(data.length, 1) - 6)}
|
|
106
|
+
{@const x = 16 + i * ((320 - 32) / Math.max(data.length, 1))}
|
|
86
107
|
{@const bh = ((d.value / max) * (height - 36)) || 0}
|
|
87
108
|
{@const y = height - 20 - bh}
|
|
88
109
|
<rect
|
|
@@ -90,37 +111,58 @@
|
|
|
90
111
|
{y}
|
|
91
112
|
width={bw}
|
|
92
113
|
height={bh}
|
|
93
|
-
rx="
|
|
114
|
+
rx="4"
|
|
94
115
|
fill={d.color ?? palette[i % palette.length]}
|
|
95
116
|
opacity="0.9"
|
|
96
117
|
/>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
118
|
+
{#if showLabel(i)}
|
|
119
|
+
<text
|
|
120
|
+
x={x + bw / 2}
|
|
121
|
+
y={height - 6}
|
|
122
|
+
text-anchor="middle"
|
|
123
|
+
class="fill-muted text-[9px]"
|
|
124
|
+
>
|
|
125
|
+
{d.label}
|
|
126
|
+
</text>
|
|
127
|
+
{/if}
|
|
100
128
|
{/each}
|
|
101
129
|
</svg>
|
|
102
130
|
{:else if type === 'line'}
|
|
103
131
|
<svg
|
|
104
132
|
viewBox={`0 0 320 ${height}`}
|
|
105
|
-
preserveAspectRatio="
|
|
133
|
+
preserveAspectRatio="xMidYMid meet"
|
|
106
134
|
class="block w-full"
|
|
107
135
|
style:height={`${height}px`}
|
|
108
136
|
role="img"
|
|
109
137
|
aria-label="Line chart"
|
|
110
138
|
>
|
|
139
|
+
<!-- baseline -->
|
|
140
|
+
<line
|
|
141
|
+
x1="16"
|
|
142
|
+
y1={height - 16}
|
|
143
|
+
x2="304"
|
|
144
|
+
y2={height - 16}
|
|
145
|
+
stroke="currentColor"
|
|
146
|
+
class="text-border"
|
|
147
|
+
stroke-width="1"
|
|
148
|
+
/>
|
|
111
149
|
<polyline
|
|
112
150
|
points={linePoints}
|
|
113
151
|
fill="none"
|
|
114
152
|
stroke={palette[0]}
|
|
115
|
-
stroke-width="2
|
|
153
|
+
stroke-width="2"
|
|
116
154
|
stroke-linecap="round"
|
|
117
155
|
stroke-linejoin="round"
|
|
118
156
|
/>
|
|
119
157
|
{#each data as d, i}
|
|
120
158
|
{@const x = 16 + (i / Math.max(data.length - 1, 1)) * 288}
|
|
121
|
-
{@const y =
|
|
122
|
-
|
|
123
|
-
|
|
159
|
+
{@const y = 12 + (1 - d.value / max) * (height - 44)}
|
|
160
|
+
{#if data.length <= 14}
|
|
161
|
+
<circle cx={x} cy={y} r="2.5" fill={palette[0]} />
|
|
162
|
+
{/if}
|
|
163
|
+
{#if showLabel(i)}
|
|
164
|
+
<text x={x} y={height - 4} text-anchor="middle" class="fill-muted text-[9px]">{d.label}</text>
|
|
165
|
+
{/if}
|
|
124
166
|
{/each}
|
|
125
167
|
</svg>
|
|
126
168
|
{:else}
|
|
@@ -138,17 +180,17 @@
|
|
|
138
180
|
</div>
|
|
139
181
|
{/if}
|
|
140
182
|
|
|
141
|
-
{#if showLegend}
|
|
183
|
+
{#if showLegend && !isEmpty}
|
|
142
184
|
<ul class="flex flex-wrap gap-3">
|
|
143
185
|
{#each data as d, i}
|
|
144
|
-
<li class="inline-flex items-center gap-1.5 text-xs
|
|
186
|
+
<li class="text-secondary inline-flex items-center gap-1.5 text-xs">
|
|
145
187
|
<span
|
|
146
188
|
class="h-2.5 w-2.5 rounded-full"
|
|
147
189
|
style:background={d.color ?? palette[i % palette.length]}
|
|
148
190
|
aria-hidden="true"
|
|
149
191
|
></span>
|
|
150
192
|
{d.label}
|
|
151
|
-
<span class="font-medium
|
|
193
|
+
<span class="text-primary font-medium">{d.value}</span>
|
|
152
194
|
</li>
|
|
153
195
|
{/each}
|
|
154
196
|
</ul>
|
|
@@ -9,6 +9,9 @@ interface ChartProps {
|
|
|
9
9
|
data?: ChartPoint[];
|
|
10
10
|
height?: number;
|
|
11
11
|
showLegend?: boolean;
|
|
12
|
+
/** Max tick labels on the X axis (line/bar). */
|
|
13
|
+
maxLabels?: number;
|
|
14
|
+
emptyLabel?: string;
|
|
12
15
|
class?: string;
|
|
13
16
|
}
|
|
14
17
|
declare const Chart: import("svelte").Component<ChartProps, {}, "">;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import {
|
|
4
4
|
getFormContext,
|
|
5
5
|
resolveFormFieldState,
|
|
6
|
+
resolveRemoteInputProps,
|
|
7
|
+
parseRemoteFieldName,
|
|
6
8
|
applyFormDataSync
|
|
7
9
|
} from '../../../utils/formContext.js';
|
|
8
10
|
|
|
@@ -43,14 +45,27 @@
|
|
|
43
45
|
}: FormNumberInputProps = $props();
|
|
44
46
|
|
|
45
47
|
const form = getFormContext();
|
|
48
|
+
const parsed = $derived(parseRemoteFieldName(name));
|
|
49
|
+
const logicalName = $derived(parsed.logicalName);
|
|
50
|
+
const htmlName = $derived.by(() => {
|
|
51
|
+
if (parsed.isEncoded) return parsed.htmlName;
|
|
52
|
+
return resolveRemoteInputProps(form?.remoteFormId, name, 'number').name;
|
|
53
|
+
});
|
|
46
54
|
const resolved = $derived(
|
|
47
|
-
resolveFormFieldState({
|
|
55
|
+
resolveFormFieldState({
|
|
56
|
+
name: logicalName,
|
|
57
|
+
errorMessage,
|
|
58
|
+
helperText,
|
|
59
|
+
status,
|
|
60
|
+
disabled,
|
|
61
|
+
form
|
|
62
|
+
})
|
|
48
63
|
);
|
|
49
64
|
|
|
50
65
|
$effect(() => {
|
|
51
|
-
if (!bindData || !
|
|
66
|
+
if (!bindData || !logicalName || !form) return;
|
|
52
67
|
applyFormDataSync({
|
|
53
|
-
fromCtx: form.data[
|
|
68
|
+
fromCtx: form.data[logicalName],
|
|
54
69
|
getLocal: () => value,
|
|
55
70
|
setLocal: (v) => {
|
|
56
71
|
value = v;
|
|
@@ -61,9 +76,9 @@
|
|
|
61
76
|
|
|
62
77
|
function handleChange(next: number) {
|
|
63
78
|
value = next;
|
|
64
|
-
if (bindData &&
|
|
65
|
-
form.setData(
|
|
66
|
-
form.clearError(
|
|
79
|
+
if (bindData && logicalName && form) {
|
|
80
|
+
form.setData(logicalName, next);
|
|
81
|
+
form.clearError(logicalName);
|
|
67
82
|
}
|
|
68
83
|
onchange?.(next);
|
|
69
84
|
}
|
|
@@ -71,7 +86,7 @@
|
|
|
71
86
|
|
|
72
87
|
<div class={['w-full', className]}>
|
|
73
88
|
<NumberInput
|
|
74
|
-
{
|
|
89
|
+
name={htmlName}
|
|
75
90
|
{label}
|
|
76
91
|
{min}
|
|
77
92
|
{max}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import {
|
|
6
6
|
getFormContext,
|
|
7
7
|
resolveFormFieldState,
|
|
8
|
+
resolveRemoteInputProps,
|
|
9
|
+
parseRemoteFieldName,
|
|
8
10
|
applyFormDataSync
|
|
9
11
|
} from '../../../utils/formContext.js';
|
|
10
12
|
|
|
@@ -48,14 +50,27 @@
|
|
|
48
50
|
}: FormSelectProps = $props();
|
|
49
51
|
|
|
50
52
|
const form = getFormContext();
|
|
53
|
+
const parsed = $derived(parseRemoteFieldName(name));
|
|
54
|
+
const logicalName = $derived(parsed.logicalName);
|
|
55
|
+
const htmlName = $derived.by(() => {
|
|
56
|
+
if (parsed.isEncoded) return parsed.htmlName;
|
|
57
|
+
return resolveRemoteInputProps(form?.remoteFormId, name, 'text').name;
|
|
58
|
+
});
|
|
51
59
|
const resolved = $derived(
|
|
52
|
-
resolveFormFieldState({
|
|
60
|
+
resolveFormFieldState({
|
|
61
|
+
name: logicalName,
|
|
62
|
+
errorMessage,
|
|
63
|
+
helperText,
|
|
64
|
+
status,
|
|
65
|
+
disabled,
|
|
66
|
+
form
|
|
67
|
+
})
|
|
53
68
|
);
|
|
54
69
|
|
|
55
70
|
$effect(() => {
|
|
56
|
-
if (!bindData || !
|
|
71
|
+
if (!bindData || !logicalName || !form) return;
|
|
57
72
|
applyFormDataSync({
|
|
58
|
-
fromCtx: form.data[
|
|
73
|
+
fromCtx: form.data[logicalName],
|
|
59
74
|
getLocal: () => value,
|
|
60
75
|
setLocal: (v) => {
|
|
61
76
|
value = v;
|
|
@@ -66,9 +81,9 @@
|
|
|
66
81
|
|
|
67
82
|
function handleChange(next: string) {
|
|
68
83
|
value = next;
|
|
69
|
-
if (bindData &&
|
|
70
|
-
form.setData(
|
|
71
|
-
form.clearError(
|
|
84
|
+
if (bindData && logicalName && form) {
|
|
85
|
+
form.setData(logicalName, next);
|
|
86
|
+
form.clearError(logicalName);
|
|
72
87
|
}
|
|
73
88
|
onchange?.(next);
|
|
74
89
|
}
|
|
@@ -77,7 +92,7 @@
|
|
|
77
92
|
<div class={['w-full', className]}>
|
|
78
93
|
<Select
|
|
79
94
|
{id}
|
|
80
|
-
{
|
|
95
|
+
name={htmlName}
|
|
81
96
|
{label}
|
|
82
97
|
{placeholder}
|
|
83
98
|
{options}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import {
|
|
4
4
|
getFormContext,
|
|
5
5
|
resolveFormFieldState,
|
|
6
|
+
resolveRemoteInputProps,
|
|
7
|
+
parseRemoteFieldName,
|
|
6
8
|
applyFormDataSync
|
|
7
9
|
} from '../../../utils/formContext.js';
|
|
8
10
|
|
|
@@ -52,14 +54,27 @@
|
|
|
52
54
|
}: FormTextareaProps = $props();
|
|
53
55
|
|
|
54
56
|
const form = getFormContext();
|
|
57
|
+
const parsed = $derived(parseRemoteFieldName(name));
|
|
58
|
+
const logicalName = $derived(parsed.logicalName);
|
|
59
|
+
const htmlName = $derived.by(() => {
|
|
60
|
+
if (parsed.isEncoded) return parsed.htmlName;
|
|
61
|
+
return resolveRemoteInputProps(form?.remoteFormId, name, 'text').name;
|
|
62
|
+
});
|
|
55
63
|
const resolved = $derived(
|
|
56
|
-
resolveFormFieldState({
|
|
64
|
+
resolveFormFieldState({
|
|
65
|
+
name: logicalName,
|
|
66
|
+
errorMessage,
|
|
67
|
+
helperText,
|
|
68
|
+
status,
|
|
69
|
+
disabled,
|
|
70
|
+
form
|
|
71
|
+
})
|
|
57
72
|
);
|
|
58
73
|
|
|
59
74
|
$effect(() => {
|
|
60
|
-
if (!bindData || !
|
|
75
|
+
if (!bindData || !logicalName || !form) return;
|
|
61
76
|
applyFormDataSync({
|
|
62
|
-
fromCtx: form.data[
|
|
77
|
+
fromCtx: form.data[logicalName],
|
|
63
78
|
getLocal: () => value,
|
|
64
79
|
setLocal: (v) => {
|
|
65
80
|
value = v;
|
|
@@ -69,9 +84,9 @@
|
|
|
69
84
|
});
|
|
70
85
|
|
|
71
86
|
function handleInput(e: Event) {
|
|
72
|
-
if (bindData &&
|
|
73
|
-
form.setData(
|
|
74
|
-
form.clearError(
|
|
87
|
+
if (bindData && logicalName && form) {
|
|
88
|
+
form.setData(logicalName, (e.currentTarget as HTMLTextAreaElement).value);
|
|
89
|
+
form.clearError(logicalName);
|
|
75
90
|
}
|
|
76
91
|
oninput?.(e);
|
|
77
92
|
}
|
|
@@ -80,7 +95,7 @@
|
|
|
80
95
|
<div class={['w-full', className]}>
|
|
81
96
|
<Textarea
|
|
82
97
|
{id}
|
|
83
|
-
{
|
|
98
|
+
name={htmlName}
|
|
84
99
|
{label}
|
|
85
100
|
{placeholder}
|
|
86
101
|
disabled={resolved.disabled}
|
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
onchange
|
|
24
24
|
}: SegmentedControlProps = $props();
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/** Avoid `$derived` here: SSR with async parent snippets has flaked on `$.derived` (undefined). */
|
|
27
|
+
function getActive() {
|
|
28
|
+
const list = Array.isArray(items) ? items : [];
|
|
29
|
+
return value || list.find((i) => !i.disabled)?.id || '';
|
|
30
|
+
}
|
|
27
31
|
|
|
28
32
|
const sizeClasses = {
|
|
29
33
|
sm: 'h-7 px-2.5 text-xs',
|
|
@@ -47,17 +51,18 @@
|
|
|
47
51
|
role="radiogroup"
|
|
48
52
|
>
|
|
49
53
|
{#each items as item (item.id)}
|
|
54
|
+
{@const isActive = getActive() === item.id}
|
|
50
55
|
<button
|
|
51
56
|
type="button"
|
|
52
57
|
role="radio"
|
|
53
|
-
aria-checked={
|
|
58
|
+
aria-checked={isActive}
|
|
54
59
|
disabled={item.disabled}
|
|
55
60
|
onclick={() => select(item.id, item.disabled)}
|
|
56
61
|
class={[
|
|
57
62
|
'rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/30',
|
|
58
63
|
sizeClasses[size],
|
|
59
64
|
fullWidth && 'flex-1',
|
|
60
|
-
|
|
65
|
+
isActive
|
|
61
66
|
? 'bg-brand-500 text-white shadow-sm'
|
|
62
67
|
: 'text-secondary hover:bg-surface-elevated/70 hover:text-primary',
|
|
63
68
|
item.disabled && 'cursor-not-allowed opacity-40'
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
emptyTitle = 'No analytics yet',
|
|
163
163
|
emptyDescription = 'Connect a data source or wait for traffic to populate this page.',
|
|
164
164
|
class: className = '',
|
|
165
|
-
actions,
|
|
165
|
+
actions: actionsProp,
|
|
166
166
|
onperiodchange,
|
|
167
167
|
onexport
|
|
168
168
|
}: AnalyticsPageProps = $props();
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
Export
|
|
205
205
|
</Button>
|
|
206
206
|
{/if}
|
|
207
|
-
{#if
|
|
208
|
-
{@render
|
|
207
|
+
{#if actionsProp}
|
|
208
|
+
{@render actionsProp()}
|
|
209
209
|
{/if}
|
|
210
210
|
</div>
|
|
211
211
|
{/snippet}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
emptyDescription = 'Try another search term or upload new files.',
|
|
68
68
|
showSelectedBar = true,
|
|
69
69
|
class: className = '',
|
|
70
|
-
actions,
|
|
70
|
+
actions: actionsProp,
|
|
71
71
|
emptyAction,
|
|
72
72
|
onconfirm,
|
|
73
73
|
oncancel,
|
|
@@ -151,8 +151,8 @@
|
|
|
151
151
|
<div class={['mx-auto flex w-full max-w-3xl flex-col gap-5', className]}>
|
|
152
152
|
<PageHeader {title} description={subtitle}>
|
|
153
153
|
{#snippet actions()}
|
|
154
|
-
{#if
|
|
155
|
-
{@render
|
|
154
|
+
{#if actionsProp}
|
|
155
|
+
{@render actionsProp()}
|
|
156
156
|
{:else if onupload}
|
|
157
157
|
<Button size="sm" variant="secondary" onclick={() => onupload?.()}>Upload</Button>
|
|
158
158
|
{/if}
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
{ id: 'delete', label: 'Delete', variant: 'destructive', confirm: true }
|
|
120
120
|
],
|
|
121
121
|
class: className = '',
|
|
122
|
-
actions,
|
|
122
|
+
actions: actionsProp,
|
|
123
123
|
toolbar,
|
|
124
124
|
sidebar,
|
|
125
125
|
emptyAction,
|
|
@@ -246,8 +246,8 @@
|
|
|
246
246
|
<div class={['relative mx-auto w-full max-w-6xl space-y-5 pb-16', className]}>
|
|
247
247
|
<PageHeader {title} {description} {breadcrumbs}>
|
|
248
248
|
{#snippet actions()}
|
|
249
|
-
{#if
|
|
250
|
-
{@render
|
|
249
|
+
{#if actionsProp}
|
|
250
|
+
{@render actionsProp()}
|
|
251
251
|
{:else}
|
|
252
252
|
<Button size="sm" variant="secondary" onclick={() => onadd?.()}>{addLabel}</Button>
|
|
253
253
|
{/if}
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
emptyTitle = 'Nothing here yet',
|
|
58
58
|
emptyDescription = 'Connect a data source to populate this dashboard.',
|
|
59
59
|
class: className = '',
|
|
60
|
-
actions,
|
|
60
|
+
actions: actionsProp,
|
|
61
61
|
primary,
|
|
62
62
|
secondary,
|
|
63
63
|
footer,
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
onchange={(id) => onperiodchange?.(id)}
|
|
91
91
|
/>
|
|
92
92
|
{/if}
|
|
93
|
-
{#if
|
|
94
|
-
{@render
|
|
93
|
+
{#if actionsProp}
|
|
94
|
+
{@render actionsProp()}
|
|
95
95
|
{/if}
|
|
96
96
|
</div>
|
|
97
97
|
{/snippet}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
searchPlaceholder = 'Search…',
|
|
60
60
|
framed = true,
|
|
61
61
|
class: className = '',
|
|
62
|
-
actions,
|
|
62
|
+
actions: actionsProp,
|
|
63
63
|
toolbar,
|
|
64
64
|
children,
|
|
65
65
|
emptyAction,
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
<div class={['mx-auto w-full max-w-6xl space-y-6', className]}>
|
|
79
79
|
<PageHeader {title} {description} {breadcrumbs}>
|
|
80
80
|
{#snippet actions()}
|
|
81
|
-
{#if
|
|
82
|
-
{@render
|
|
81
|
+
{#if actionsProp}
|
|
82
|
+
{@render actionsProp()}
|
|
83
83
|
{/if}
|
|
84
84
|
{/snippet}
|
|
85
85
|
</PageHeader>
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
emptyTitle = 'Start exploring',
|
|
109
109
|
emptyDescription = 'Search above or pick a recent query to discover content.',
|
|
110
110
|
class: className = '',
|
|
111
|
-
actions,
|
|
111
|
+
actions: actionsProp,
|
|
112
112
|
emptyAction,
|
|
113
113
|
onsearch,
|
|
114
114
|
onselect,
|
|
@@ -206,8 +206,8 @@
|
|
|
206
206
|
<div class={['mx-auto w-full max-w-5xl space-y-5', className]}>
|
|
207
207
|
<PageHeader {title} {description} {breadcrumbs}>
|
|
208
208
|
{#snippet actions()}
|
|
209
|
-
{#if
|
|
210
|
-
{@render
|
|
209
|
+
{#if actionsProp}
|
|
210
|
+
{@render actionsProp()}
|
|
211
211
|
{/if}
|
|
212
212
|
{/snippet}
|
|
213
213
|
</PageHeader>
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
query = $bindable(''),
|
|
81
81
|
showLegend = true,
|
|
82
82
|
class: className = '',
|
|
83
|
-
actions,
|
|
83
|
+
actions: actionsProp,
|
|
84
84
|
onchange,
|
|
85
85
|
onreset
|
|
86
86
|
}: PermissionsMatrixProps = $props();
|
|
@@ -172,8 +172,8 @@
|
|
|
172
172
|
{#if onreset}
|
|
173
173
|
<Button size="sm" variant="ghost" onclick={() => onreset?.()}>Reset</Button>
|
|
174
174
|
{/if}
|
|
175
|
-
{#if
|
|
176
|
-
{@render
|
|
175
|
+
{#if actionsProp}
|
|
176
|
+
{@render actionsProp()}
|
|
177
177
|
{/if}
|
|
178
178
|
</div>
|
|
179
179
|
{/snippet}
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
emptyTasksTitle = 'No tasks yet',
|
|
132
132
|
emptyTasksDescription = 'Create work items to track progress on this project.',
|
|
133
133
|
class: className = '',
|
|
134
|
-
actions,
|
|
134
|
+
actions: actionsProp,
|
|
135
135
|
sidebar,
|
|
136
136
|
ontoggleTask,
|
|
137
137
|
onclickTask,
|
|
@@ -197,8 +197,8 @@
|
|
|
197
197
|
</div>
|
|
198
198
|
{/snippet}
|
|
199
199
|
{#snippet actions()}
|
|
200
|
-
{#if
|
|
201
|
-
{@render
|
|
200
|
+
{#if actionsProp}
|
|
201
|
+
{@render actionsProp()}
|
|
202
202
|
{:else}
|
|
203
203
|
{#if members.length}
|
|
204
204
|
<AvatarGroup items={avatarItems} max={4} size="sm" />
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
maxDate,
|
|
208
208
|
locale = 'en',
|
|
209
209
|
class: className = '',
|
|
210
|
-
actions,
|
|
210
|
+
actions: actionsProp,
|
|
211
211
|
ondatechange,
|
|
212
212
|
onrangechange,
|
|
213
213
|
ondurationchange,
|
|
@@ -431,8 +431,8 @@
|
|
|
431
431
|
<div class={['mx-auto w-full max-w-6xl space-y-5', className]}>
|
|
432
432
|
<PageHeader {title} {description}>
|
|
433
433
|
{#snippet actions()}
|
|
434
|
-
{#if
|
|
435
|
-
{@render
|
|
434
|
+
{#if actionsProp}
|
|
435
|
+
{@render actionsProp()}
|
|
436
436
|
{/if}
|
|
437
437
|
{/snippet}
|
|
438
438
|
</PageHeader>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
query = $bindable(''),
|
|
41
41
|
empty = false,
|
|
42
42
|
class: className = '',
|
|
43
|
-
actions,
|
|
43
|
+
actions: actionsProp,
|
|
44
44
|
oninvite,
|
|
45
45
|
onmember
|
|
46
46
|
}: TeamPageProps = $props();
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
<div class={['w-full space-y-5', className]}>
|
|
61
61
|
<PageHeader {title} {description} {breadcrumbs}>
|
|
62
62
|
{#snippet actions()}
|
|
63
|
-
{#if
|
|
64
|
-
{@render
|
|
63
|
+
{#if actionsProp}
|
|
64
|
+
{@render actionsProp()}
|
|
65
65
|
{:else}
|
|
66
66
|
<Button size="sm" onclick={() => oninvite?.()}>Invite</Button>
|
|
67
67
|
{/if}
|
|
@@ -60,11 +60,10 @@ export declare function getRemoteFormId(action: string | undefined | null): stri
|
|
|
60
60
|
* Resolve HTML input props for a field inside a Kit remote form.
|
|
61
61
|
* Prefer a precomputed `formId` string so fields never touch Kit proxies.
|
|
62
62
|
*
|
|
63
|
-
* Kit
|
|
64
|
-
*
|
|
65
|
-
* (`email/dp12ax/login_remote`) that break `convert_formdata`.
|
|
63
|
+
* Kit requires names that end with `/${formId}` (from `.as()`), e.g.
|
|
64
|
+
* `email/1p9kxmo/login_user` or `n:age/1p9kxmo/login_user`.
|
|
66
65
|
*/
|
|
67
|
-
export declare function resolveRemoteInputProps(
|
|
66
|
+
export declare function resolveRemoteInputProps(formId: string | null | undefined, logicalName: string | undefined, type?: string): ResolvedRemoteInputProps;
|
|
68
67
|
export type ParsedRemoteFieldName = {
|
|
69
68
|
/** Field path for errors / `form.data` (`email`, `items[0].name`) */
|
|
70
69
|
logicalName: string | undefined;
|
|
@@ -81,8 +80,8 @@ export type ParsedRemoteFieldName = {
|
|
|
81
80
|
* Otherwise treats the first `/` after an optional `n:`/`b:` prefix as the form-id boundary
|
|
82
81
|
* (logical paths use `.` / `[n]`, never `/`).
|
|
83
82
|
*
|
|
84
|
-
* Note:
|
|
85
|
-
*
|
|
83
|
+
* Note: Kit `.as()` emits names ending with `/${formId}` (e.g. `email/hash/login`).
|
|
84
|
+
* `resolveRemoteInputProps` must append the same suffix when given a logical name.
|
|
86
85
|
*/
|
|
87
86
|
export declare function parseRemoteFieldName(name: string | undefined, formId?: string | null): ParsedRemoteFieldName;
|
|
88
87
|
/**
|
|
@@ -21,19 +21,25 @@ export function getRemoteFormId(action) {
|
|
|
21
21
|
* Resolve HTML input props for a field inside a Kit remote form.
|
|
22
22
|
* Prefer a precomputed `formId` string so fields never touch Kit proxies.
|
|
23
23
|
*
|
|
24
|
-
* Kit
|
|
25
|
-
*
|
|
26
|
-
* (`email/dp12ax/login_remote`) that break `convert_formdata`.
|
|
24
|
+
* Kit requires names that end with `/${formId}` (from `.as()`), e.g.
|
|
25
|
+
* `email/1p9kxmo/login_user` or `n:age/1p9kxmo/login_user`.
|
|
27
26
|
*/
|
|
28
|
-
export function resolveRemoteInputProps(
|
|
27
|
+
export function resolveRemoteInputProps(formId, logicalName, type = 'text') {
|
|
29
28
|
if (!logicalName)
|
|
30
29
|
return {};
|
|
30
|
+
// Already Kit-encoded (contains `/formId` or was passed from `.as()`).
|
|
31
|
+
if (logicalName.includes('/')) {
|
|
32
|
+
return { name: logicalName };
|
|
33
|
+
}
|
|
31
34
|
let prefix = '';
|
|
32
35
|
if (type === 'number' || type === 'range')
|
|
33
36
|
prefix = 'n:';
|
|
34
37
|
else if (type === 'checkbox' || type === 'boolean')
|
|
35
38
|
prefix = 'b:';
|
|
36
|
-
|
|
39
|
+
const base = `${prefix}${logicalName}`;
|
|
40
|
+
if (!formId)
|
|
41
|
+
return { name: base };
|
|
42
|
+
return { name: `${base}/${formId}` };
|
|
37
43
|
}
|
|
38
44
|
/**
|
|
39
45
|
* Split a Kit-encoded HTML `name` (`email/1p9kxmo/login_user`, `n:age/...`)
|
|
@@ -43,8 +49,8 @@ export function resolveRemoteInputProps(_formId, logicalName, type = 'text') {
|
|
|
43
49
|
* Otherwise treats the first `/` after an optional `n:`/`b:` prefix as the form-id boundary
|
|
44
50
|
* (logical paths use `.` / `[n]`, never `/`).
|
|
45
51
|
*
|
|
46
|
-
* Note:
|
|
47
|
-
*
|
|
52
|
+
* Note: Kit `.as()` emits names ending with `/${formId}` (e.g. `email/hash/login`).
|
|
53
|
+
* `resolveRemoteInputProps` must append the same suffix when given a logical name.
|
|
48
54
|
*/
|
|
49
55
|
export function parseRemoteFieldName(name, formId) {
|
|
50
56
|
if (!name) {
|