@compsych/mobile-ui 1.0.29 → 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.29",
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,21 +112,23 @@ export function DateTimePicker({
110
112
  return cells;
111
113
  }, [viewYear, viewMonth]);
112
114
 
113
- const isDisabled = useCallback(
114
- (day: number) => {
115
- const d = new Date(viewYear, viewMonth, day);
116
- d.setHours(0, 0, 0, 0);
117
- return d < today || d > maxDate;
118
- },
119
- [viewYear, viewMonth, today, maxDate],
115
+ const availableDatesSet = useMemo(
116
+ () => (availableDates ? new Set(availableDates) : null),
117
+ [availableDates],
120
118
  );
121
119
 
122
- const isToday = useCallback(
120
+ const isDisabled = useCallback(
123
121
  (day: number) => {
124
122
  const d = new Date(viewYear, viewMonth, day);
125
- return toLocalDateString(d) === toLocalDateString(today);
123
+ d.setHours(0, 0, 0, 0);
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;
126
130
  },
127
- [viewYear, viewMonth, today],
131
+ [viewYear, viewMonth, today, maxDate, availableDatesSet],
128
132
  );
129
133
 
130
134
  const isSelected = useCallback(
@@ -148,7 +152,8 @@ export function DateTimePicker({
148
152
  const sysOutline = cr.outline.sysOutline;
149
153
  const sysOnSurface = cr.surface.surface.sysOnSurface;
150
154
  const sysOnSurfaceVariant = cr.surface.surface.sysOnSurfaceVariant;
151
- const sysSurface = cr.surface.surface.sysSurface;
155
+ const sysSurfaceContainerHighest =
156
+ cr.surface.surfaceContainer.sysSurfaceContainerHighest;
152
157
 
153
158
  const prevChevron = I18nManager.isRTL ? '>' : '<';
154
159
  const nextChevron = I18nManager.isRTL ? '<' : '>';
@@ -163,7 +168,7 @@ export function DateTimePicker({
163
168
  testID="calendar-picker"
164
169
  style={[
165
170
  styles.card,
166
- { borderColor: sysOutline, backgroundColor: sysSurface },
171
+ { borderColor: sysOutline, backgroundColor: '#FFFFFF' },
167
172
  ]}
168
173
  >
169
174
  {/* Calendar section */}
@@ -237,24 +242,16 @@ export function DateTimePicker({
237
242
  }
238
243
  const disabled = isDisabled(day);
239
244
  const selected = isSelected(day);
240
- const todayDay = isToday(day);
241
245
 
242
246
  const cellStyle = [
243
247
  styles.dayCellInner,
248
+ !disabled &&
249
+ !selected && { backgroundColor: sysSurfaceContainerHighest },
244
250
  selected && {
251
+ backgroundColor: '#FFFFFF',
245
252
  borderColor: sysPrimary,
246
253
  borderWidth: 2,
247
- shadowColor: sysPrimary,
248
- shadowOffset: { width: 1, height: 2 },
249
- shadowOpacity: 1,
250
- shadowRadius: 0,
251
- elevation: 2,
252
254
  },
253
- !selected &&
254
- todayDay && {
255
- borderColor: sysPrimary,
256
- borderWidth: 1.5,
257
- },
258
255
  disabled && styles.dayCellDisabled,
259
256
  ];
260
257
 
@@ -316,7 +313,7 @@ export function DateTimePicker({
316
313
  {
317
314
  borderColor: slotSelected ? sysPrimary : sysOutline,
318
315
  borderWidth: slotSelected ? 2 : 1.5,
319
- backgroundColor: sysSurface,
316
+ backgroundColor: '#FFFFFF',
320
317
  },
321
318
  slotSelected && {
322
319
  shadowColor: sysPrimary,