@compsych/mobile-ui 1.0.30 → 1.0.31

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compsych/mobile-ui",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "ComPsych React Native Design System — 19 mobile UI components with self-contained design tokens",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -18,6 +18,7 @@ export interface DateTimePickerProps {
18
18
  onSelectTime: (time: string) => void;
19
19
  availableTimes: string[];
20
20
  availableTimeLabel: string;
21
+ availableDates?: string[];
21
22
  maxMonthsAhead?: number;
22
23
  }
23
24
 
@@ -42,6 +43,7 @@ export function DateTimePicker({
42
43
  onSelectTime,
43
44
  availableTimes,
44
45
  availableTimeLabel,
46
+ availableDates,
45
47
  maxMonthsAhead = 1,
46
48
  }: DateTimePickerProps) {
47
49
  const { colorRoles: cr } = useTheme();
@@ -110,13 +112,23 @@ export function DateTimePicker({
110
112
  return cells;
111
113
  }, [viewYear, viewMonth]);
112
114
 
115
+ const availableDatesSet = useMemo(
116
+ () => (availableDates ? new Set(availableDates) : null),
117
+ [availableDates],
118
+ );
119
+
113
120
  const isDisabled = useCallback(
114
121
  (day: number) => {
115
122
  const d = new Date(viewYear, viewMonth, day);
116
123
  d.setHours(0, 0, 0, 0);
117
- return d < today || d > maxDate;
124
+ if (d < today || d > maxDate) return true;
125
+ if (availableDatesSet) {
126
+ const dateStr = toLocalDateString(d);
127
+ return !availableDatesSet.has(dateStr);
128
+ }
129
+ return false;
118
130
  },
119
- [viewYear, viewMonth, today, maxDate],
131
+ [viewYear, viewMonth, today, maxDate, availableDatesSet],
120
132
  );
121
133
 
122
134
  const isSelected = useCallback(