@joewinke/jatui 0.1.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.
- package/package.json +46 -0
- package/src/lib/components/AudioWaveform.svelte +694 -0
- package/src/lib/components/AvailabilityModal.svelte +173 -0
- package/src/lib/components/Badge.svelte +38 -0
- package/src/lib/components/BookingForm.svelte +276 -0
- package/src/lib/components/Button.svelte +72 -0
- package/src/lib/components/CalendarPicker.svelte +284 -0
- package/src/lib/components/Card.svelte +67 -0
- package/src/lib/components/CharacterCounter.svelte +82 -0
- package/src/lib/components/ChipInput.svelte +596 -0
- package/src/lib/components/ColorSelector.svelte +163 -0
- package/src/lib/components/ConfirmModal.svelte +75 -0
- package/src/lib/components/CountdownTimer.svelte +94 -0
- package/src/lib/components/DateRangePicker.svelte +192 -0
- package/src/lib/components/Drawer.svelte +110 -0
- package/src/lib/components/FilterDropdown.svelte +202 -0
- package/src/lib/components/ImageUpload.svelte +97 -0
- package/src/lib/components/InlineEdit.svelte +283 -0
- package/src/lib/components/LazyImage.svelte +122 -0
- package/src/lib/components/LoadingSpinner.svelte +102 -0
- package/src/lib/components/Modal.svelte +208 -0
- package/src/lib/components/PhoneInput.svelte +92 -0
- package/src/lib/components/ResizableDivider.svelte +305 -0
- package/src/lib/components/ResizablePanel.svelte +302 -0
- package/src/lib/components/SearchDropdown.svelte +341 -0
- package/src/lib/components/SelectInput.svelte +215 -0
- package/src/lib/components/SignaturePad.svelte +171 -0
- package/src/lib/components/SortDropdown.svelte +148 -0
- package/src/lib/components/Sparkline.svelte +107 -0
- package/src/lib/components/SpeechForm.svelte +114 -0
- package/src/lib/components/StatusBadge.svelte +155 -0
- package/src/lib/components/TextArea.svelte +143 -0
- package/src/lib/components/TextInput.svelte +108 -0
- package/src/lib/components/ThemeSelector.svelte +195 -0
- package/src/lib/components/TimeSlotPicker.svelte +162 -0
- package/src/lib/components/VoicePlayer.svelte +420 -0
- package/src/lib/components/messaging/Avatar.svelte +81 -0
- package/src/lib/components/messaging/ChannelInfoModal.svelte +163 -0
- package/src/lib/components/messaging/ChannelList.svelte +107 -0
- package/src/lib/components/messaging/ChannelMemberAvatarStack.svelte +69 -0
- package/src/lib/components/messaging/ChannelMembersModal.svelte +182 -0
- package/src/lib/components/messaging/CreateChannelModal.svelte +190 -0
- package/src/lib/components/messaging/DirectMessageList.svelte +145 -0
- package/src/lib/components/messaging/EmojiSelector.svelte +260 -0
- package/src/lib/components/messaging/MentionAutocomplete.svelte +193 -0
- package/src/lib/components/messaging/MessageAttachment.svelte +270 -0
- package/src/lib/components/messaging/MessageAttachmentUpload.svelte +243 -0
- package/src/lib/components/messaging/MessageInput.svelte +451 -0
- package/src/lib/components/messaging/MessageItem.svelte +338 -0
- package/src/lib/components/messaging/MessageThread.svelte +306 -0
- package/src/lib/components/messaging/NotificationSettingsModal.svelte +234 -0
- package/src/lib/components/messaging/QuotedMessageDisplay.svelte +118 -0
- package/src/lib/components/messaging/StartDMModal.svelte +100 -0
- package/src/lib/components/messaging/ThreadPanel.svelte +153 -0
- package/src/lib/index.ts +185 -0
- package/src/lib/types/booking.ts +143 -0
- package/src/lib/types/messaging.ts +459 -0
- package/src/lib/utils/currency.ts +20 -0
- package/src/lib/utils/daisyuiColors.ts +243 -0
- package/src/lib/utils/dateFormatters.ts +153 -0
- package/src/lib/utils/mentionParser.ts +188 -0
- package/src/lib/utils/phoneFormat.ts +74 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* AvailabilityModal — Modal for setting date overrides: mark a day as unavailable
|
|
4
|
+
* or set custom hours. Used in scheduling/booking interfaces.
|
|
5
|
+
*/
|
|
6
|
+
import { slide } from 'svelte/transition';
|
|
7
|
+
import type { DateOverride, OverrideType } from '../types/booking';
|
|
8
|
+
|
|
9
|
+
export type { DateOverride, OverrideType };
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
date,
|
|
13
|
+
existingOverride = null,
|
|
14
|
+
hostId = '',
|
|
15
|
+
onSave,
|
|
16
|
+
onClose,
|
|
17
|
+
}: {
|
|
18
|
+
date: Date;
|
|
19
|
+
existingOverride?: DateOverride | null;
|
|
20
|
+
hostId?: string;
|
|
21
|
+
onSave: (override: DateOverride) => void;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
} = $props();
|
|
24
|
+
|
|
25
|
+
const initialType = existingOverride?.override_type || 'unavailable';
|
|
26
|
+
const initialStart = existingOverride?.start_time?.slice(0, 5) || '09:00';
|
|
27
|
+
const initialEnd = existingOverride?.end_time?.slice(0, 5) || '17:00';
|
|
28
|
+
const initialReason = existingOverride?.reason || '';
|
|
29
|
+
|
|
30
|
+
let overrideType = $state<OverrideType>(initialType);
|
|
31
|
+
let startTime = $state(initialStart);
|
|
32
|
+
let endTime = $state(initialEnd);
|
|
33
|
+
let reason = $state(initialReason);
|
|
34
|
+
|
|
35
|
+
const formattedDate = $derived(
|
|
36
|
+
date.toLocaleDateString('en-US', {
|
|
37
|
+
weekday: 'long',
|
|
38
|
+
year: 'numeric',
|
|
39
|
+
month: 'long',
|
|
40
|
+
day: 'numeric'
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
function handleSave() {
|
|
45
|
+
const override: DateOverride = {
|
|
46
|
+
id: existingOverride?.id || `override-${Date.now()}`,
|
|
47
|
+
host_id: hostId,
|
|
48
|
+
override_date: date.toISOString().split('T')[0],
|
|
49
|
+
override_type: overrideType,
|
|
50
|
+
start_time: overrideType === 'custom_hours' ? startTime + ':00' : undefined,
|
|
51
|
+
end_time: overrideType === 'custom_hours' ? endTime + ':00' : undefined,
|
|
52
|
+
reason: reason.trim() || undefined,
|
|
53
|
+
created_at: existingOverride?.created_at || new Date().toISOString()
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
onSave(override);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleBackdropClick(e: MouseEvent) {
|
|
60
|
+
if (e.target === e.currentTarget) {
|
|
61
|
+
onClose();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
67
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
68
|
+
<div
|
|
69
|
+
class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4"
|
|
70
|
+
onclick={handleBackdropClick}
|
|
71
|
+
transition:slide={{ duration: 200 }}
|
|
72
|
+
>
|
|
73
|
+
<div class="bg-base-100 rounded-2xl border border-base-300 shadow-2xl w-full max-w-md" transition:slide={{ duration: 300 }}>
|
|
74
|
+
<!-- Header -->
|
|
75
|
+
<div class="p-6 border-b border-base-300">
|
|
76
|
+
<div class="flex items-center justify-between">
|
|
77
|
+
<h2 class="text-xl font-bold">Set Date Override</h2>
|
|
78
|
+
<button onclick={onClose} class="btn btn-ghost btn-sm btn-circle" aria-label="Close">
|
|
79
|
+
<!-- X icon -->
|
|
80
|
+
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
81
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
82
|
+
</svg>
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
<p class="text-sm text-base-content/60 mt-1">{formattedDate}</p>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<!-- Body -->
|
|
89
|
+
<div class="p-6 space-y-6">
|
|
90
|
+
<fieldset>
|
|
91
|
+
<legend class="text-sm font-medium text-base-content/70 mb-3 block">What would you like to do?</legend>
|
|
92
|
+
<div class="space-y-2">
|
|
93
|
+
<label class="flex items-start gap-3 p-3 rounded-lg bg-base-200/50 cursor-pointer hover:bg-base-200 transition-colors {overrideType === 'unavailable' ? 'ring-2 ring-primary' : ''}">
|
|
94
|
+
<input
|
|
95
|
+
type="radio"
|
|
96
|
+
name="override_type"
|
|
97
|
+
value="unavailable"
|
|
98
|
+
bind:group={overrideType}
|
|
99
|
+
class="radio radio-primary mt-0.5"
|
|
100
|
+
/>
|
|
101
|
+
<div>
|
|
102
|
+
<p class="font-medium">Mark as Unavailable</p>
|
|
103
|
+
<p class="text-sm text-base-content/60">No bookings will be allowed on this day</p>
|
|
104
|
+
</div>
|
|
105
|
+
</label>
|
|
106
|
+
|
|
107
|
+
<label class="flex items-start gap-3 p-3 rounded-lg bg-base-200/50 cursor-pointer hover:bg-base-200 transition-colors {overrideType === 'custom_hours' ? 'ring-2 ring-primary' : ''}">
|
|
108
|
+
<input
|
|
109
|
+
type="radio"
|
|
110
|
+
name="override_type"
|
|
111
|
+
value="custom_hours"
|
|
112
|
+
bind:group={overrideType}
|
|
113
|
+
class="radio radio-primary mt-0.5"
|
|
114
|
+
/>
|
|
115
|
+
<div>
|
|
116
|
+
<p class="font-medium">Set Custom Hours</p>
|
|
117
|
+
<p class="text-sm text-base-content/60">Override your regular hours for this day</p>
|
|
118
|
+
</div>
|
|
119
|
+
</label>
|
|
120
|
+
</div>
|
|
121
|
+
</fieldset>
|
|
122
|
+
|
|
123
|
+
{#if overrideType === 'custom_hours'}
|
|
124
|
+
<div transition:slide={{ duration: 200 }}>
|
|
125
|
+
<p class="text-sm font-medium text-base-content/70 mb-2">Available Hours</p>
|
|
126
|
+
<div class="flex items-center gap-3">
|
|
127
|
+
<label class="sr-only" for="avail-start-time">Start time</label>
|
|
128
|
+
<input
|
|
129
|
+
id="avail-start-time"
|
|
130
|
+
type="time"
|
|
131
|
+
bind:value={startTime}
|
|
132
|
+
class="input input-bordered bg-base-200/50 flex-1"
|
|
133
|
+
/>
|
|
134
|
+
<span class="text-base-content/50">to</span>
|
|
135
|
+
<label class="sr-only" for="avail-end-time">End time</label>
|
|
136
|
+
<input
|
|
137
|
+
id="avail-end-time"
|
|
138
|
+
type="time"
|
|
139
|
+
bind:value={endTime}
|
|
140
|
+
class="input input-bordered bg-base-200/50 flex-1"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
{/if}
|
|
145
|
+
|
|
146
|
+
<div>
|
|
147
|
+
<label for="avail-reason" class="text-sm font-medium text-base-content/70 mb-2 block">
|
|
148
|
+
Reason <span class="text-base-content/50">(optional)</span>
|
|
149
|
+
</label>
|
|
150
|
+
<input
|
|
151
|
+
id="avail-reason"
|
|
152
|
+
type="text"
|
|
153
|
+
bind:value={reason}
|
|
154
|
+
placeholder="e.g., Vacation, Conference, Doctor's appointment"
|
|
155
|
+
class="input input-bordered w-full bg-base-200/50"
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<!-- Footer -->
|
|
161
|
+
<div class="p-6 border-t border-base-300 flex gap-3">
|
|
162
|
+
<button onclick={onClose} class="btn btn-ghost flex-1">
|
|
163
|
+
Cancel
|
|
164
|
+
</button>
|
|
165
|
+
<button
|
|
166
|
+
onclick={handleSave}
|
|
167
|
+
class="btn btn-primary flex-1"
|
|
168
|
+
>
|
|
169
|
+
Save Override
|
|
170
|
+
</button>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Badge Component
|
|
4
|
+
*
|
|
5
|
+
* Simple DaisyUI badge with variant and size options.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
variant?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
class?: string;
|
|
12
|
+
children?: import('svelte').Snippet;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { variant = 'default', size = 'md', class: className = '', children }: Props = $props();
|
|
16
|
+
|
|
17
|
+
const variantClass = $derived(
|
|
18
|
+
{
|
|
19
|
+
default: 'badge-neutral',
|
|
20
|
+
primary: 'badge-primary',
|
|
21
|
+
secondary: 'badge-secondary',
|
|
22
|
+
success: 'badge-success',
|
|
23
|
+
warning: 'badge-warning',
|
|
24
|
+
error: 'badge-error',
|
|
25
|
+
info: 'badge-info',
|
|
26
|
+
neutral: 'badge-neutral'
|
|
27
|
+
}[variant] || 'badge-neutral'
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const sizeClass = $derived({ sm: 'badge-sm', md: '', lg: 'badge-lg' }[size]);
|
|
31
|
+
const badgeClass = $derived(`badge ${variantClass} ${sizeClass} ${className}`.trim());
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<span class={badgeClass}>
|
|
35
|
+
{#if children}
|
|
36
|
+
{@render children()}
|
|
37
|
+
{/if}
|
|
38
|
+
</span>
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* BookingForm — Guest information form for booking a meeting.
|
|
4
|
+
*
|
|
5
|
+
* Collects name, email, optional phone, optional notes, and optional attendees.
|
|
6
|
+
* Configurable via props: required fields, accent color, terms URL, submit label.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface BookingFormData {
|
|
10
|
+
guest_name: string;
|
|
11
|
+
guest_email: string;
|
|
12
|
+
guest_phone?: string;
|
|
13
|
+
guest_notes?: string;
|
|
14
|
+
timezone: string;
|
|
15
|
+
start_time: string;
|
|
16
|
+
attendees?: { name: string; email: string }[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
onSubmit,
|
|
21
|
+
submitting = false,
|
|
22
|
+
initialName = '',
|
|
23
|
+
initialEmail = '',
|
|
24
|
+
requirePhone = false,
|
|
25
|
+
showAttendeeOption = true,
|
|
26
|
+
showNotes = true,
|
|
27
|
+
showTerms = true,
|
|
28
|
+
termsUrl = '/terms',
|
|
29
|
+
privacyUrl = '/privacy',
|
|
30
|
+
submitLabel = 'Confirm and Schedule',
|
|
31
|
+
submittingLabel = 'Scheduling...',
|
|
32
|
+
locationHint = '',
|
|
33
|
+
accentColor = 'primary',
|
|
34
|
+
}: {
|
|
35
|
+
onSubmit: (data: BookingFormData) => void;
|
|
36
|
+
submitting?: boolean;
|
|
37
|
+
initialName?: string;
|
|
38
|
+
initialEmail?: string;
|
|
39
|
+
requirePhone?: boolean;
|
|
40
|
+
showAttendeeOption?: boolean;
|
|
41
|
+
showNotes?: boolean;
|
|
42
|
+
showTerms?: boolean;
|
|
43
|
+
termsUrl?: string;
|
|
44
|
+
privacyUrl?: string;
|
|
45
|
+
submitLabel?: string;
|
|
46
|
+
submittingLabel?: string;
|
|
47
|
+
locationHint?: string;
|
|
48
|
+
accentColor?: string;
|
|
49
|
+
} = $props();
|
|
50
|
+
|
|
51
|
+
let guestName = $state(initialName);
|
|
52
|
+
let guestEmail = $state(initialEmail);
|
|
53
|
+
let guestPhone = $state('');
|
|
54
|
+
let guestNotes = $state('');
|
|
55
|
+
|
|
56
|
+
let attendees = $state<{ name: string; email: string }[]>([]);
|
|
57
|
+
let showAttendees = $state(false);
|
|
58
|
+
|
|
59
|
+
const isValidEmail = (email: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
60
|
+
|
|
61
|
+
const isValid = $derived(
|
|
62
|
+
guestName.trim().length >= 2 &&
|
|
63
|
+
isValidEmail(guestEmail) &&
|
|
64
|
+
(!requirePhone || guestPhone.trim().length >= 7) &&
|
|
65
|
+
attendees.every((a) => a.name.trim().length >= 2 && isValidEmail(a.email))
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
function addAttendee() {
|
|
69
|
+
attendees = [...attendees, { name: '', email: '' }];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function removeAttendee(index: number) {
|
|
73
|
+
attendees = attendees.filter((_, i) => i !== index);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function updateAttendee(index: number, field: 'name' | 'email', value: string) {
|
|
77
|
+
attendees = attendees.map((a, i) => (i === index ? { ...a, [field]: value } : a));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function handleSubmit(e: Event) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
if (!isValid || submitting) return;
|
|
83
|
+
|
|
84
|
+
const data: BookingFormData = {
|
|
85
|
+
guest_name: guestName.trim(),
|
|
86
|
+
guest_email: guestEmail.trim().toLowerCase(),
|
|
87
|
+
guest_phone: guestPhone.trim() || undefined,
|
|
88
|
+
guest_notes: guestNotes.trim() || undefined,
|
|
89
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
90
|
+
start_time: '', // Set by parent
|
|
91
|
+
attendees: attendees.length > 0 ? attendees.map((a) => ({
|
|
92
|
+
name: a.name.trim(),
|
|
93
|
+
email: a.email.trim().toLowerCase()
|
|
94
|
+
})) : undefined
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
onSubmit(data);
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<form onsubmit={handleSubmit} class="space-y-6">
|
|
102
|
+
<!-- Name -->
|
|
103
|
+
<div>
|
|
104
|
+
<label for="booking-name" class="block text-sm font-medium text-base-content/70 mb-2">
|
|
105
|
+
Your Name <span class="text-error">*</span>
|
|
106
|
+
</label>
|
|
107
|
+
<input
|
|
108
|
+
id="booking-name"
|
|
109
|
+
type="text"
|
|
110
|
+
bind:value={guestName}
|
|
111
|
+
placeholder="John Smith"
|
|
112
|
+
required
|
|
113
|
+
disabled={submitting}
|
|
114
|
+
class="input input-bordered w-full bg-base-200/50 focus:border-{accentColor}"
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<!-- Email -->
|
|
119
|
+
<div>
|
|
120
|
+
<label for="booking-email" class="block text-sm font-medium text-base-content/70 mb-2">
|
|
121
|
+
Email Address <span class="text-error">*</span>
|
|
122
|
+
</label>
|
|
123
|
+
<input
|
|
124
|
+
id="booking-email"
|
|
125
|
+
type="email"
|
|
126
|
+
bind:value={guestEmail}
|
|
127
|
+
placeholder="john@example.com"
|
|
128
|
+
required
|
|
129
|
+
disabled={submitting}
|
|
130
|
+
class="input input-bordered w-full bg-base-200/50 focus:border-{accentColor}"
|
|
131
|
+
/>
|
|
132
|
+
<p class="text-xs text-base-content/50 mt-1">
|
|
133
|
+
Confirmation and meeting details will be sent here
|
|
134
|
+
</p>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<!-- Phone -->
|
|
138
|
+
<div>
|
|
139
|
+
<label for="booking-phone" class="block text-sm font-medium text-base-content/70 mb-2">
|
|
140
|
+
Phone Number {#if requirePhone}<span class="text-error">*</span>{:else}<span class="text-base-content/50">(optional)</span>{/if}
|
|
141
|
+
</label>
|
|
142
|
+
<input
|
|
143
|
+
id="booking-phone"
|
|
144
|
+
type="tel"
|
|
145
|
+
bind:value={guestPhone}
|
|
146
|
+
placeholder="+1 (555) 123-4567"
|
|
147
|
+
required={requirePhone}
|
|
148
|
+
disabled={submitting}
|
|
149
|
+
class="input input-bordered w-full bg-base-200/50 focus:border-{accentColor}"
|
|
150
|
+
/>
|
|
151
|
+
{#if locationHint}
|
|
152
|
+
<p class="text-xs text-base-content/50 mt-1">{locationHint}</p>
|
|
153
|
+
{/if}
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<!-- Additional Attendees -->
|
|
157
|
+
{#if showAttendeeOption}
|
|
158
|
+
<div class="border-t border-base-300 pt-6">
|
|
159
|
+
<div class="flex items-center justify-between mb-4">
|
|
160
|
+
<div>
|
|
161
|
+
<h3 class="text-sm font-medium">Additional Attendees</h3>
|
|
162
|
+
<p class="text-xs text-base-content/50">Invite team members to join the meeting</p>
|
|
163
|
+
</div>
|
|
164
|
+
{#if !showAttendees}
|
|
165
|
+
<button
|
|
166
|
+
type="button"
|
|
167
|
+
onclick={() => { showAttendees = true; addAttendee(); }}
|
|
168
|
+
disabled={submitting}
|
|
169
|
+
class="btn btn-sm btn-ghost text-{accentColor}"
|
|
170
|
+
>
|
|
171
|
+
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
172
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
|
173
|
+
</svg>
|
|
174
|
+
Add Attendee
|
|
175
|
+
</button>
|
|
176
|
+
{/if}
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
{#if showAttendees && attendees.length > 0}
|
|
180
|
+
<div class="space-y-4">
|
|
181
|
+
{#each attendees as attendee, index}
|
|
182
|
+
<div class="flex gap-3 items-start">
|
|
183
|
+
<div class="flex-1 grid sm:grid-cols-2 gap-3">
|
|
184
|
+
<input
|
|
185
|
+
type="text"
|
|
186
|
+
value={attendee.name}
|
|
187
|
+
oninput={(e) => updateAttendee(index, 'name', (e.target as HTMLInputElement).value)}
|
|
188
|
+
placeholder="Name"
|
|
189
|
+
disabled={submitting}
|
|
190
|
+
class="input input-bordered input-sm bg-base-200/50 focus:border-{accentColor}"
|
|
191
|
+
/>
|
|
192
|
+
<input
|
|
193
|
+
type="email"
|
|
194
|
+
value={attendee.email}
|
|
195
|
+
oninput={(e) => updateAttendee(index, 'email', (e.target as HTMLInputElement).value)}
|
|
196
|
+
placeholder="Email"
|
|
197
|
+
disabled={submitting}
|
|
198
|
+
class="input input-bordered input-sm bg-base-200/50 focus:border-{accentColor}"
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
<button
|
|
202
|
+
type="button"
|
|
203
|
+
onclick={() => removeAttendee(index)}
|
|
204
|
+
disabled={submitting}
|
|
205
|
+
class="btn btn-sm btn-ghost btn-circle text-error"
|
|
206
|
+
aria-label="Remove attendee"
|
|
207
|
+
>
|
|
208
|
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
209
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
210
|
+
</svg>
|
|
211
|
+
</button>
|
|
212
|
+
</div>
|
|
213
|
+
{/each}
|
|
214
|
+
|
|
215
|
+
<button
|
|
216
|
+
type="button"
|
|
217
|
+
onclick={addAttendee}
|
|
218
|
+
disabled={submitting}
|
|
219
|
+
class="btn btn-sm btn-ghost text-{accentColor}"
|
|
220
|
+
>
|
|
221
|
+
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
222
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
|
223
|
+
</svg>
|
|
224
|
+
Add Another
|
|
225
|
+
</button>
|
|
226
|
+
</div>
|
|
227
|
+
{/if}
|
|
228
|
+
</div>
|
|
229
|
+
{/if}
|
|
230
|
+
|
|
231
|
+
<!-- Notes -->
|
|
232
|
+
{#if showNotes}
|
|
233
|
+
<div>
|
|
234
|
+
<label for="booking-notes" class="block text-sm font-medium text-base-content/70 mb-2">
|
|
235
|
+
Additional Notes <span class="text-base-content/50">(optional)</span>
|
|
236
|
+
</label>
|
|
237
|
+
<textarea
|
|
238
|
+
id="booking-notes"
|
|
239
|
+
bind:value={guestNotes}
|
|
240
|
+
placeholder="Anything you'd like us to know before the meeting..."
|
|
241
|
+
rows={3}
|
|
242
|
+
disabled={submitting}
|
|
243
|
+
class="textarea textarea-bordered w-full bg-base-200/50 focus:border-{accentColor}"
|
|
244
|
+
></textarea>
|
|
245
|
+
</div>
|
|
246
|
+
{/if}
|
|
247
|
+
|
|
248
|
+
<!-- Terms Notice -->
|
|
249
|
+
{#if showTerms}
|
|
250
|
+
<div class="bg-base-200/30 rounded-lg p-4 text-sm text-base-content/60">
|
|
251
|
+
<p>
|
|
252
|
+
By scheduling this meeting, you agree to our
|
|
253
|
+
<a href={termsUrl} class="text-{accentColor} hover:underline">Terms of Service</a>
|
|
254
|
+
and
|
|
255
|
+
<a href={privacyUrl} class="text-{accentColor} hover:underline">Privacy Policy</a>.
|
|
256
|
+
</p>
|
|
257
|
+
</div>
|
|
258
|
+
{/if}
|
|
259
|
+
|
|
260
|
+
<!-- Submit Button -->
|
|
261
|
+
<button
|
|
262
|
+
type="submit"
|
|
263
|
+
disabled={!isValid || submitting}
|
|
264
|
+
class="btn btn-{accentColor} btn-lg w-full disabled:opacity-50 disabled:cursor-not-allowed"
|
|
265
|
+
>
|
|
266
|
+
{#if submitting}
|
|
267
|
+
<span class="loading loading-spinner loading-sm"></span>
|
|
268
|
+
{submittingLabel}
|
|
269
|
+
{:else}
|
|
270
|
+
{submitLabel}
|
|
271
|
+
<svg class="w-5 h-5 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
272
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
|
|
273
|
+
</svg>
|
|
274
|
+
{/if}
|
|
275
|
+
</button>
|
|
276
|
+
</form>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Button Component
|
|
4
|
+
*
|
|
5
|
+
* Generic DaisyUI button with variant, size, loading state, and optional href.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'error' | 'warning' | 'success' | 'info';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
11
|
+
href?: string;
|
|
12
|
+
type?: 'button' | 'submit' | 'reset';
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
class?: string;
|
|
16
|
+
onclick?: (e: MouseEvent) => void;
|
|
17
|
+
children?: import('svelte').Snippet;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
variant = 'primary',
|
|
22
|
+
size = 'md',
|
|
23
|
+
href,
|
|
24
|
+
type = 'button',
|
|
25
|
+
disabled = false,
|
|
26
|
+
loading = false,
|
|
27
|
+
class: className = '',
|
|
28
|
+
onclick,
|
|
29
|
+
children
|
|
30
|
+
}: Props = $props();
|
|
31
|
+
|
|
32
|
+
const variantClass = $derived(
|
|
33
|
+
{
|
|
34
|
+
primary: 'btn-primary',
|
|
35
|
+
secondary: 'btn-secondary',
|
|
36
|
+
outline: 'btn-outline',
|
|
37
|
+
ghost: 'btn-ghost',
|
|
38
|
+
error: 'btn-error',
|
|
39
|
+
warning: 'btn-warning',
|
|
40
|
+
success: 'btn-success',
|
|
41
|
+
info: 'btn-info'
|
|
42
|
+
}[variant] || 'btn-primary'
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const sizeClass = $derived(
|
|
46
|
+
{
|
|
47
|
+
xs: 'btn-xs',
|
|
48
|
+
sm: 'btn-sm',
|
|
49
|
+
md: '',
|
|
50
|
+
lg: 'btn-lg'
|
|
51
|
+
}[size]
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const buttonClass = $derived(`btn ${variantClass} ${sizeClass} ${className}`.trim());
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
{#if href}
|
|
58
|
+
<a {href} class={buttonClass} role="button" tabindex="0">
|
|
59
|
+
{#if children}
|
|
60
|
+
{@render children()}
|
|
61
|
+
{/if}
|
|
62
|
+
</a>
|
|
63
|
+
{:else}
|
|
64
|
+
<button {type} {disabled} class={buttonClass} {onclick}>
|
|
65
|
+
{#if loading}
|
|
66
|
+
<span class="loading loading-spinner loading-xs"></span>
|
|
67
|
+
{/if}
|
|
68
|
+
{#if children}
|
|
69
|
+
{@render children()}
|
|
70
|
+
{/if}
|
|
71
|
+
</button>
|
|
72
|
+
{/if}
|