@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
@@ -161,6 +161,11 @@
161
161
  { value: 'contain', label: 'Contain' },
162
162
  { value: 'fill', label: 'Fill' }
163
163
  ];
164
+ const imageFilterPresets = [
165
+ { id: 'normal', label: 'Normal', brightness: 100, contrast: 100, saturate: 100 },
166
+ { id: 'bw', label: 'B&W', brightness: 100, contrast: 110, saturate: 0 },
167
+ { id: 'warm', label: 'Warm', brightness: 108, contrast: 105, saturate: 130 }
168
+ ];
164
169
  const weightOptions = [
165
170
  { value: '400', label: 'Regular' },
166
171
  { value: '500', label: 'Medium' },
@@ -168,6 +173,16 @@
168
173
  { value: '700', label: 'Bold' },
169
174
  { value: '800', label: 'Extra bold' }
170
175
  ];
176
+ const fontOptions = [
177
+ { value: 'default', label: 'Default' },
178
+ { value: 'Inter, sans-serif', label: 'Inter' },
179
+ { value: 'Arial, Helvetica, sans-serif', label: 'Arial' },
180
+ { value: 'Georgia, serif', label: 'Georgia' },
181
+ { value: '"Times New Roman", Times, serif', label: 'Times' },
182
+ { value: '"Courier New", Courier, monospace', label: 'Courier' },
183
+ { value: 'Verdana, sans-serif', label: 'Verdana' },
184
+ { value: 'Impact, sans-serif', label: 'Impact' }
185
+ ];
171
186
  const styleOptions = [
172
187
  { value: 'normal', label: 'Normal' },
173
188
  { value: 'italic', label: 'Italic' }
@@ -936,6 +951,88 @@
936
951
  patch({ src: (e.currentTarget as HTMLInputElement).value || undefined })}
937
952
  />
938
953
  </PropertyField>
954
+ <PropertyField label="Look">
955
+ <div class="gap-1 flex flex-wrap">
956
+ {#each imageFilterPresets as preset (preset.id)}
957
+ <button
958
+ type="button"
959
+ class={[
960
+ 'rounded-md px-2 py-1 text-xs font-medium',
961
+ layer.brightness === preset.brightness &&
962
+ layer.contrast === preset.contrast &&
963
+ layer.saturate === preset.saturate
964
+ ? 'bg-brand-500/15 text-brand-700'
965
+ : 'bg-surface-overlay text-secondary'
966
+ ]}
967
+ onclick={() =>
968
+ patch({
969
+ brightness: preset.brightness,
970
+ contrast: preset.contrast,
971
+ saturate: preset.saturate
972
+ })}
973
+ >
974
+ {preset.label}
975
+ </button>
976
+ {/each}
977
+ </div>
978
+ </PropertyField>
979
+ <PropertyField
980
+ label="Brightness"
981
+ modified={fieldModified('brightness')}
982
+ onreset={() => resetField('brightness')}
983
+ >
984
+ <Slider
985
+ size="sm"
986
+ variant="inset"
987
+ min={0}
988
+ max={200}
989
+ step={1}
990
+ value={layer.brightness ?? 100}
991
+ showValue
992
+ valuePosition="inline"
993
+ unit="%"
994
+ form=""
995
+ oninput={(v) => patch({ brightness: v })}
996
+ />
997
+ </PropertyField>
998
+ <PropertyField
999
+ label="Contrast"
1000
+ modified={fieldModified('contrast')}
1001
+ onreset={() => resetField('contrast')}
1002
+ >
1003
+ <Slider
1004
+ size="sm"
1005
+ variant="inset"
1006
+ min={0}
1007
+ max={200}
1008
+ step={1}
1009
+ value={layer.contrast ?? 100}
1010
+ showValue
1011
+ valuePosition="inline"
1012
+ unit="%"
1013
+ form=""
1014
+ oninput={(v) => patch({ contrast: v })}
1015
+ />
1016
+ </PropertyField>
1017
+ <PropertyField
1018
+ label="Saturation"
1019
+ modified={fieldModified('saturate')}
1020
+ onreset={() => resetField('saturate')}
1021
+ >
1022
+ <Slider
1023
+ size="sm"
1024
+ variant="inset"
1025
+ min={0}
1026
+ max={200}
1027
+ step={1}
1028
+ value={layer.saturate ?? 100}
1029
+ showValue
1030
+ valuePosition="inline"
1031
+ unit="%"
1032
+ form=""
1033
+ oninput={(v) => patch({ saturate: v })}
1034
+ />
1035
+ </PropertyField>
939
1036
  <PropertyField
940
1037
  label="Fit"
941
1038
  modified={fieldModified('objectFit')}
@@ -945,7 +1042,69 @@
945
1042
  size="xs"
946
1043
  options={fitOptions}
947
1044
  value={layer.objectFit ?? 'cover'}
948
- onchange={(v) => patch({ objectFit: v as CanvasLayer['objectFit'] })}
1045
+ onchange={(v) =>
1046
+ patch({
1047
+ objectFit: v as CanvasLayer['objectFit'],
1048
+ mediaScale: 1,
1049
+ mediaX: 0.5,
1050
+ mediaY: 0.5
1051
+ })}
1052
+ />
1053
+ </PropertyField>
1054
+ <PropertyField
1055
+ label="Zoom"
1056
+ modified={fieldModified('mediaScale')}
1057
+ onreset={() => resetField('mediaScale')}
1058
+ >
1059
+ <Slider
1060
+ size="sm"
1061
+ variant="inset"
1062
+ min={layer.objectFit === 'cover' || layer.objectFit == null ? 1 : 0.25}
1063
+ max={6}
1064
+ step={0.05}
1065
+ value={layer.mediaScale ?? 1}
1066
+ showValue
1067
+ valuePosition="inline"
1068
+ form=""
1069
+ oninput={(v) => patch({ mediaScale: v })}
1070
+ />
1071
+ </PropertyField>
1072
+ <PropertyField
1073
+ label="Position X"
1074
+ modified={fieldModified('mediaX')}
1075
+ onreset={() => resetField('mediaX')}
1076
+ >
1077
+ <Slider
1078
+ size="sm"
1079
+ variant="inset"
1080
+ min={0}
1081
+ max={100}
1082
+ step={1}
1083
+ value={Math.round((layer.mediaX ?? 0.5) * 100)}
1084
+ showValue
1085
+ valuePosition="inline"
1086
+ unit="%"
1087
+ form=""
1088
+ oninput={(v) => patch({ mediaX: v / 100 })}
1089
+ />
1090
+ </PropertyField>
1091
+ <PropertyField
1092
+ label="Position Y"
1093
+ modified={fieldModified('mediaY')}
1094
+ onreset={() => resetField('mediaY')}
1095
+ >
1096
+ <Slider
1097
+ size="sm"
1098
+ variant="inset"
1099
+ min={0}
1100
+ max={100}
1101
+ step={1}
1102
+ value={Math.round((layer.mediaY ?? 0.5) * 100)}
1103
+ showValue
1104
+ valuePosition="inline"
1105
+ unit="%"
1106
+ form=""
1107
+ oninput={(v) => patch({ mediaY: v / 100 })}
949
1108
  />
950
1109
  </PropertyField>
951
1110
  <PropertyField
@@ -980,15 +1139,15 @@
980
1139
  modified={fieldModified('text')}
981
1140
  onreset={() => resetField('text')}
982
1141
  >
983
- <div class="relative min-w-0 w-full">
1142
+ <div class="min-w-0 relative w-full">
984
1143
  <Textarea
985
1144
  rows={2}
986
1145
  placeholder="Write the text…"
987
- class="[&_textarea]:min-h-9 [&_textarea]:resize-none [&_textarea]:py-1.5 [&_textarea]:pr-8 [&_textarea]:text-xs"
1146
+ class="[&_textarea]:min-h-9 [&_textarea]:py-1.5 [&_textarea]:pr-8 [&_textarea]:text-xs [&_textarea]:resize-none"
988
1147
  value={layer.text ?? ''}
989
1148
  oninput={(e) => patch({ text: (e.currentTarget as HTMLTextAreaElement).value })}
990
1149
  />
991
- <div class="absolute top-0.5 right-0.5">
1150
+ <div class="top-0.5 right-0.5 absolute">
992
1151
  <Tooltip content="Open large editor" side="left">
993
1152
  <IconButton
994
1153
  label="Edit content"
@@ -1014,6 +1173,18 @@
1014
1173
  size="sm"
1015
1174
  />
1016
1175
  </PropertyField>
1176
+ <PropertyField
1177
+ label="Font"
1178
+ modified={fieldModified('fontFamily')}
1179
+ onreset={() => resetField('fontFamily')}
1180
+ >
1181
+ <Select
1182
+ size="xs"
1183
+ options={fontOptions}
1184
+ value={layer.fontFamily ?? 'default'}
1185
+ onchange={(v) => patch({ fontFamily: v === 'default' ? undefined : v })}
1186
+ />
1187
+ </PropertyField>
1017
1188
  <PropertyField
1018
1189
  label="Size"
1019
1190
  exposed={exposedFlag('fontSize')}
@@ -1139,7 +1310,7 @@
1139
1310
  type="number"
1140
1311
  size="sm"
1141
1312
  step={0.05}
1142
- value={String(layer.lineHeight ?? 1.15)}
1313
+ value={String(layer.lineHeight ?? 1.25)}
1143
1314
  oninput={(e) =>
1144
1315
  patch({ lineHeight: Number((e.currentTarget as HTMLInputElement).value) })}
1145
1316
  />
@@ -12,7 +12,7 @@
12
12
  }
13
13
 
14
14
  export type ChipBarSize = 'sm' | 'md';
15
- export type ChipBarVariant = 'soft' | 'solid' | 'outline';
15
+ export type ChipBarVariant = 'soft' | 'solid' | 'outline' | 'underline';
16
16
 
17
17
  interface ChipBarProps {
18
18
  items?: ChipBarItem[];
@@ -94,12 +94,22 @@
94
94
  md: 'gap-1.5 px-3 py-1.5 text-sm'
95
95
  };
96
96
 
97
+ const underlineSizes: Record<ChipBarSize, string> = {
98
+ sm: 'gap-1.5 px-1 pb-2.5 text-xs',
99
+ md: 'gap-1.5 px-1.5 pb-3 text-sm'
100
+ };
101
+
97
102
  const iconSizes: Record<ChipBarSize, string> = {
98
103
  sm: 'h-3.5 w-3.5',
99
104
  md: 'h-4 w-4'
100
105
  };
101
106
 
102
107
  function chipClass(isActive: boolean) {
108
+ if (variant === 'underline') {
109
+ return isActive
110
+ ? 'rounded-none border-0 border-b-2 border-brand-500 bg-transparent text-primary'
111
+ : 'rounded-none border-0 border-b-2 border-transparent bg-transparent text-secondary hover:text-primary';
112
+ }
103
113
  if (variant === 'solid') {
104
114
  return isActive
105
115
  ? 'border-brand-500 bg-brand-500 text-white shadow-sm'
@@ -132,7 +142,10 @@
132
142
 
133
143
  <div
134
144
  bind:this={scroller}
135
- class="flex gap-2 overflow-x-auto py-0.5 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
145
+ class={[
146
+ 'flex overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
147
+ variant === 'underline' ? 'gap-5 border-b border-border' : 'gap-2 py-0.5'
148
+ ]}
136
149
  role="listbox"
137
150
  aria-label={ariaLabel}
138
151
  aria-multiselectable={multi}
@@ -146,8 +159,8 @@
146
159
  aria-selected={isActive}
147
160
  disabled={item.disabled}
148
161
  class={[
149
- 'inline-flex shrink-0 items-center rounded-full border font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40',
150
- sizes[size],
162
+ 'inline-flex shrink-0 items-center font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40',
163
+ variant === 'underline' ? underlineSizes[size] : ['rounded-full border', sizes[size]],
151
164
  chipClass(isActive)
152
165
  ]}
153
166
  onclick={() => select(item.id, item.disabled)}
@@ -157,7 +170,7 @@
157
170
  <Icon class={iconSizes[size]} aria-hidden="true" />
158
171
  {/if}
159
172
  <span>{item.label}</span>
160
- {#if item.count !== undefined}
173
+ {#if item.count !== undefined && variant !== 'underline'}
161
174
  <span
162
175
  class={[
163
176
  'rounded-full px-1.5 py-px text-[10px] font-semibold tabular-nums',
@@ -8,7 +8,7 @@ export interface ChipBarItem {
8
8
  icon?: Component;
9
9
  }
10
10
  export type ChipBarSize = 'sm' | 'md';
11
- export type ChipBarVariant = 'soft' | 'solid' | 'outline';
11
+ export type ChipBarVariant = 'soft' | 'solid' | 'outline' | 'underline';
12
12
  interface ChipBarProps {
13
13
  items?: ChipBarItem[];
14
14
  value?: string;
@@ -371,7 +371,7 @@
371
371
  setComboboxContext(ctx);
372
372
  </script>
373
373
 
374
- <div class={['max-w-sm w-full', className]} bind:this={rootEl}>
374
+ <div class={['w-full min-w-0', className]} bind:this={rootEl}>
375
375
  {#if label}
376
376
  <span class="mb-1.5 text-sm font-medium text-primary block">{label}</span>
377
377
  {/if}
@@ -379,7 +379,7 @@
379
379
  <div
380
380
  bind:this={triggerEl}
381
381
  class={[
382
- 'h-10 gap-2 rounded-xl border-border bg-surface-elevated px-3 flex items-center border transition-colors',
382
+ 'flex h-10 w-full items-center gap-2 rounded-xl border border-border bg-surface-elevated px-3 transition-colors',
383
383
  open && 'border-brand-500 ring-brand-500/20 ring-2',
384
384
  disabled && 'cursor-not-allowed opacity-60'
385
385
  ]}
@@ -83,6 +83,70 @@
83
83
  )
84
84
  );
85
85
 
86
+ function boundOf(value: string | undefined) {
87
+ if (!value) return { date: '', time: '' };
88
+ const [datePart, timePart = ''] = value.split('T');
89
+ return { date: datePart.slice(0, 10), time: timePart.slice(0, 5) };
90
+ }
91
+
92
+ const minBound = $derived(boundOf(min));
93
+ const maxBound = $derived(boundOf(max));
94
+
95
+ function asMinutes(h: number, m: number) {
96
+ return h * 60 + m;
97
+ }
98
+
99
+ /** Same calendar day stays open. A time on that day must fall strictly after `min` and before `max`. */
100
+ function slotBlocked(day: string, h: number, m: number) {
101
+ if (!day) return false;
102
+ const at = asMinutes(h, m);
103
+ if (minBound.time && day === minBound.date) {
104
+ const start = parseTime(minBound.time);
105
+ if (start && at <= asMinutes(start.h, start.m)) return true;
106
+ }
107
+ if (maxBound.time && day === maxBound.date) {
108
+ const end = parseTime(maxBound.time);
109
+ if (end && at >= asMinutes(end.h, end.m)) return true;
110
+ }
111
+ return false;
112
+ }
113
+
114
+ function firstOpen(day: string, fromH = 0, fromM = 0) {
115
+ if (!day) return '';
116
+ if ((fromH !== 0 || fromM !== 0) && !slotBlocked(day, fromH, fromM))
117
+ return toTime(fromH, fromM);
118
+ for (const h of hours24) {
119
+ for (const m of minutes) {
120
+ if (h < fromH || (h === fromH && m < fromM)) continue;
121
+ if (!slotBlocked(day, h, m)) return toTime(h, m);
122
+ }
123
+ }
124
+ return '';
125
+ }
126
+
127
+ function hourBlocked(h: number) {
128
+ if (!panelDate) return false;
129
+ return minutes.every((m) => slotBlocked(panelDate, h, m));
130
+ }
131
+
132
+ function minuteBlocked(m: number) {
133
+ if (!panelDate || selectedH == null) return false;
134
+ return slotBlocked(panelDate, selectedH, m);
135
+ }
136
+
137
+ const calendarDisabled = $derived.by(() => {
138
+ const extra: string[] = [];
139
+ if (minBound.date && minBound.time && !firstOpen(minBound.date)) extra.push(minBound.date);
140
+ if (maxBound.date && maxBound.time && !firstOpen(maxBound.date)) extra.push(maxBound.date);
141
+ return [...disabledDates, ...extra];
142
+ });
143
+
144
+ const panelTimeBlocked = $derived.by(() => {
145
+ const parsed = parseTime(panelTime);
146
+ if (!panelDate || !parsed) return false;
147
+ return slotBlocked(panelDate, parsed.h, parsed.m);
148
+ });
149
+
86
150
  function pad(n: number) {
87
151
  return String(n).padStart(2, '0');
88
152
  }
@@ -155,7 +219,8 @@
155
219
 
156
220
  function beginDraft() {
157
221
  draftDate = date;
158
- draftTime = time || '09:00';
222
+ const base = parseTime(time || '09:00') ?? { h: 9, m: 0 };
223
+ draftTime = (date && (firstOpen(date, base.h, base.m) || firstOpen(date))) || time || '09:00';
159
224
  }
160
225
 
161
226
  function setPanelDate(next: string) {
@@ -206,7 +271,8 @@
206
271
 
207
272
  const spaceBelow = viewTop + viewH - trigger.bottom - gap - pad;
208
273
  const spaceAbove = trigger.top - viewTop - gap - pad;
209
- const side: 'top' | 'bottom' = spaceBelow < panelH && spaceAbove > spaceBelow ? 'top' : 'bottom';
274
+ const side: 'top' | 'bottom' =
275
+ spaceBelow < panelH && spaceAbove > spaceBelow ? 'top' : 'bottom';
210
276
 
211
277
  let top = side === 'bottom' ? trigger.bottom + gap : trigger.top - panelH - gap;
212
278
  let left = trigger.left;
@@ -293,8 +359,9 @@
293
359
 
294
360
  function handleDateChange(detail: { value: string }) {
295
361
  setPanelDate(detail.value);
296
- const currentTime = confirmMode ? draftTime : time;
297
- if (!currentTime) setPanelTime('09:00');
362
+ const current = parseTime(confirmMode ? draftTime : time) ?? { h: 9, m: 0 };
363
+ const next = firstOpen(detail.value, current.h, current.m) || firstOpen(detail.value);
364
+ if (next) setPanelTime(next);
298
365
  if (!confirmMode) {
299
366
  emit();
300
367
  if (closeOnSelect && date && time) setOpen(false);
@@ -302,12 +369,18 @@
302
369
  }
303
370
 
304
371
  function pickHour(h: number) {
305
- const m = selectedM ?? 0;
306
- setPanelTime(toTime(h, m));
372
+ if (hourBlocked(h) || !panelDate) return;
373
+ const preferred = selectedM ?? 0;
374
+ const minute = slotBlocked(panelDate, h, preferred)
375
+ ? minutes.find((m) => !slotBlocked(panelDate, h, m))
376
+ : preferred;
377
+ if (minute == null) return;
378
+ setPanelTime(toTime(h, minute));
307
379
  if (!confirmMode) emit();
308
380
  }
309
381
 
310
382
  function pickMinute(m: number) {
383
+ if (minuteBlocked(m)) return;
311
384
  const h = selectedH ?? 9;
312
385
  setPanelTime(toTime(h, m));
313
386
  if (!confirmMode) {
@@ -342,16 +415,16 @@
342
415
  });
343
416
  </script>
344
417
 
345
- <div class={['w-full min-w-[20rem] max-w-[22rem]', className]}>
418
+ <div class={['min-w-0 w-full', className]}>
346
419
  {#if label}
347
- <span class="mb-1.5 block text-sm font-medium text-primary">{label}</span>
420
+ <span class="mb-1.5 text-sm font-medium text-primary block">{label}</span>
348
421
  {/if}
349
422
 
350
423
  <div
351
424
  bind:this={triggerEl}
352
425
  class={[
353
- 'flex h-10 w-full items-center overflow-hidden rounded-xl border border-border bg-surface-elevated transition-colors',
354
- open && 'border-brand-500 ring-2 ring-brand-500/20',
426
+ 'h-10 rounded-xl border-border bg-surface-elevated flex w-full items-center overflow-hidden border transition-colors',
427
+ open && 'border-brand-500 ring-brand-500/20 ring-2',
355
428
  disabled && 'opacity-60'
356
429
  ]}
357
430
  >
@@ -365,13 +438,13 @@
365
438
  aria-haspopup="dialog"
366
439
  aria-controls={panelId}
367
440
  class={[
368
- 'flex h-full min-w-0 flex-1 items-center gap-2 px-3.5 text-left text-sm',
441
+ 'min-w-0 gap-2 px-3.5 text-sm flex h-full flex-1 items-center text-left',
369
442
  'hover:bg-surface-overlay focus-visible:outline-none',
370
443
  disabled && 'cursor-not-allowed'
371
444
  ]}
372
445
  >
373
446
  <svg
374
- class="h-4 w-4 shrink-0 text-muted"
447
+ class="h-4 w-4 text-muted shrink-0"
375
448
  viewBox="0 0 24 24"
376
449
  fill="none"
377
450
  stroke="currentColor"
@@ -392,10 +465,16 @@
392
465
  <button
393
466
  type="button"
394
467
  onclick={clear}
395
- class="h-full px-3 text-muted hover:bg-surface-overlay hover:text-primary"
468
+ class="px-3 text-muted hover:bg-surface-overlay hover:text-primary h-full"
396
469
  aria-label="Clear"
397
470
  >
398
- <svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
471
+ <svg
472
+ class="h-3.5 w-3.5"
473
+ viewBox="0 0 24 24"
474
+ fill="none"
475
+ stroke="currentColor"
476
+ stroke-width="2"
477
+ >
399
478
  <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
400
479
  </svg>
401
480
  </button>
@@ -411,17 +490,17 @@
411
490
  onbeforetoggle={handleBeforeToggle}
412
491
  ontoggle={handleToggle}
413
492
  data-placed={placed ? true : undefined}
414
- class="datetime-picker-popover m-0 flex w-max max-w-[min(100vw-1rem,42rem)] flex-col overflow-hidden rounded-2xl border border-border bg-surface-elevated shadow-xl outline-none"
493
+ class="datetime-picker-popover m-0 rounded-2xl border-border bg-surface-elevated shadow-xl flex w-max max-w-[min(100vw-1rem,42rem)] flex-col overflow-hidden border outline-none"
415
494
  >
416
495
  {#key open}
417
- <div class="flex flex-col sm:flex-row sm:items-stretch">
418
- <div class="w-[22rem] shrink-0 p-1.5">
496
+ <div class="sm:flex-row sm:items-stretch flex flex-col">
497
+ <div class="p-1.5 w-[22rem] shrink-0">
419
498
  <Calendar
420
499
  mode="single"
421
500
  value={panelDate}
422
- {min}
423
- {max}
424
- {disabledDates}
501
+ min={minBound.date || undefined}
502
+ max={maxBound.date || undefined}
503
+ disabledDates={calendarDisabled}
425
504
  {dots}
426
505
  framed={false}
427
506
  class="w-full"
@@ -429,17 +508,17 @@
429
508
  />
430
509
  </div>
431
510
  <div
432
- class="flex w-full shrink-0 flex-col border-t border-border sm:w-40 sm:border-l sm:border-t-0"
511
+ class="border-border sm:w-40 sm:border-l sm:border-t-0 flex w-full shrink-0 flex-col border-t"
433
512
  >
434
513
  <span
435
- class="shrink-0 border-b border-border px-3 py-2.5 text-center text-[11px] font-medium uppercase tracking-wide text-muted"
514
+ class="border-border px-3 py-2.5 font-medium tracking-wide text-muted shrink-0 border-b text-center text-[11px] uppercase"
436
515
  >
437
516
  Time
438
517
  </span>
439
- <div class="grid min-h-0 flex-1 grid-cols-2 divide-x divide-border">
518
+ <div class="min-h-0 divide-border grid flex-1 grid-cols-2 divide-x">
440
519
  <div
441
520
  bind:this={hourListEl}
442
- class="h-[18.5rem] overflow-y-auto p-1.5"
521
+ class="p-1.5 h-[18.5rem] overflow-y-auto"
443
522
  role="listbox"
444
523
  aria-label="Hours"
445
524
  >
@@ -447,14 +526,16 @@
447
526
  <button
448
527
  type="button"
449
528
  role="option"
450
- aria-pressed={selectedH === h}
451
529
  aria-selected={selectedH === h}
530
+ aria-disabled={hourBlocked(h)}
531
+ disabled={hourBlocked(h)}
452
532
  onclick={() => pickHour(h)}
453
533
  class={[
454
- 'w-full rounded-lg px-2 py-1.5 text-sm transition-colors',
534
+ 'rounded-lg px-2 py-1.5 text-sm w-full transition-colors',
535
+ hourBlocked(h) && 'cursor-not-allowed opacity-30',
455
536
  selectedH === h
456
537
  ? 'bg-brand-500 font-semibold text-white'
457
- : 'text-primary hover:bg-surface-overlay'
538
+ : 'text-primary hover:bg-surface-overlay disabled:hover:bg-transparent'
458
539
  ]}
459
540
  >
460
541
  {hourLabel(h)}
@@ -463,7 +544,7 @@
463
544
  </div>
464
545
  <div
465
546
  bind:this={minuteListEl}
466
- class="h-[18.5rem] overflow-y-auto p-1.5"
547
+ class="p-1.5 h-[18.5rem] overflow-y-auto"
467
548
  role="listbox"
468
549
  aria-label="Minutes"
469
550
  >
@@ -471,14 +552,16 @@
471
552
  <button
472
553
  type="button"
473
554
  role="option"
474
- aria-pressed={selectedM === m}
475
555
  aria-selected={selectedM === m}
556
+ aria-disabled={minuteBlocked(m)}
557
+ disabled={minuteBlocked(m)}
476
558
  onclick={() => pickMinute(m)}
477
559
  class={[
478
- 'w-full rounded-lg px-2 py-1.5 text-sm transition-colors',
560
+ 'rounded-lg px-2 py-1.5 text-sm w-full transition-colors',
561
+ minuteBlocked(m) && 'cursor-not-allowed opacity-30',
479
562
  selectedM === m
480
563
  ? 'bg-brand-500 font-semibold text-white'
481
- : 'text-primary hover:bg-surface-overlay'
564
+ : 'text-primary hover:bg-surface-overlay disabled:hover:bg-transparent'
482
565
  ]}
483
566
  >
484
567
  {pad(m)}
@@ -489,11 +572,16 @@
489
572
  </div>
490
573
  </div>
491
574
  {#if confirmMode}
492
- <div class="flex items-center justify-end gap-2 border-t border-border px-3 py-2.5">
575
+ <div class="gap-2 border-border px-3 py-2.5 flex items-center justify-end border-t">
493
576
  <Button type="button" variant="ghost" size="sm" onclick={cancelDraft}>
494
577
  {resolvedCancelLabel}
495
578
  </Button>
496
- <Button type="button" size="sm" disabled={!draftDate} onclick={commitDraft}>
579
+ <Button
580
+ type="button"
581
+ size="sm"
582
+ disabled={!draftDate || panelTimeBlocked}
583
+ onclick={commitDraft}
584
+ >
497
585
  {resolvedSaveLabel}
498
586
  </Button>
499
587
  </div>