@scripso-homepad/ui 0.4.31 → 0.4.33

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/index.cjs CHANGED
@@ -2420,7 +2420,7 @@ var calendarDropdownMetrics = reactNative.StyleSheet.create({
2420
2420
  boxSizing: "border-box"
2421
2421
  } : null
2422
2422
  },
2423
- dayCellPast: {
2423
+ dayCellDisabled: {
2424
2424
  backgroundColor: colors.stormGray50
2425
2425
  },
2426
2426
  dayCellSelected: {
@@ -2543,6 +2543,10 @@ function resolveCalendarDropdownLeft(anchor, panelWidth = CALENDAR_PANEL_WIDTH)
2543
2543
  const maxLeft = Math.max(0, windowWidth - panelWidth);
2544
2544
  return Math.max(0, Math.min(anchor.x, maxLeft));
2545
2545
  }
2546
+ function resolveCalendarDropdownLeftCentered(panelWidth = CALENDAR_PANEL_WIDTH) {
2547
+ const windowWidth = reactNative.Dimensions.get("window").width;
2548
+ return Math.max(0, (windowWidth - panelWidth) / 2);
2549
+ }
2546
2550
  var calendarFieldMetrics = reactNative.StyleSheet.create({
2547
2551
  container: {
2548
2552
  flexDirection: "row",
@@ -2959,10 +2963,9 @@ function resolveDayCellStyle(day) {
2959
2963
  if (day.isSelected) {
2960
2964
  return [calendarDropdownMetrics.dayCell, calendarDropdownMetrics.dayCellSelected];
2961
2965
  }
2962
- const useMutedBackground = day.inCurrentMonth && !day.isToday && (day.isPast || day.isDisabled);
2963
2966
  return [
2964
2967
  calendarDropdownMetrics.dayCell,
2965
- useMutedBackground ? calendarDropdownMetrics.dayCellPast : null
2968
+ day.isDisabled ? calendarDropdownMetrics.dayCellDisabled : null
2966
2969
  ];
2967
2970
  }
2968
2971
  function resolveDayLabelStyle(day) {
@@ -2975,7 +2978,7 @@ function resolveDayLabelStyle(day) {
2975
2978
  if (day.isToday) {
2976
2979
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelToday];
2977
2980
  }
2978
- if (day.isPast || day.isDisabled) {
2981
+ if (day.isDisabled) {
2979
2982
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelMuted];
2980
2983
  }
2981
2984
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelFuture];
@@ -3253,6 +3256,7 @@ function CalendarIcon({
3253
3256
  }
3254
3257
  ) });
3255
3258
  }
3259
+ var isDesktopCalendar = reactNative.Platform.OS === "web";
3256
3260
  function DatePicker(props) {
3257
3261
  const {
3258
3262
  label,
@@ -3335,9 +3339,8 @@ function DatePicker(props) {
3335
3339
  };
3336
3340
  const helperMessage = error ?? hint;
3337
3341
  const panelWidth = CALENDAR_PANEL_WIDTH;
3338
- const panelLeft = anchor ? resolveCalendarDropdownLeft(anchor, panelWidth) : 0;
3342
+ const panelLeft = anchor ? isDesktopCalendar ? resolveCalendarDropdownLeft(anchor, panelWidth) : resolveCalendarDropdownLeftCentered(panelWidth) : 0;
3339
3343
  const dropdownTop = anchor ? resolveCalendarDropdownTop(anchor) : 0;
3340
- const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
3341
3344
  function closePicker() {
3342
3345
  setOpen(false);
3343
3346
  setAnchor(null);
@@ -3351,6 +3354,7 @@ function DatePicker(props) {
3351
3354
  setOpen(true);
3352
3355
  });
3353
3356
  }
3357
+ const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
3354
3358
  function handleSingleSelect(date) {
3355
3359
  if (props.mode === "range") {
3356
3360
  return;