@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.js CHANGED
@@ -1476,7 +1476,7 @@ var calendarDropdownMetrics = StyleSheet.create({
1476
1476
  boxSizing: "border-box"
1477
1477
  } : null
1478
1478
  },
1479
- dayCellPast: {
1479
+ dayCellDisabled: {
1480
1480
  backgroundColor: colors.stormGray50
1481
1481
  },
1482
1482
  dayCellSelected: {
@@ -1599,6 +1599,10 @@ function resolveCalendarDropdownLeft(anchor, panelWidth = CALENDAR_PANEL_WIDTH)
1599
1599
  const maxLeft = Math.max(0, windowWidth - panelWidth);
1600
1600
  return Math.max(0, Math.min(anchor.x, maxLeft));
1601
1601
  }
1602
+ function resolveCalendarDropdownLeftCentered(panelWidth = CALENDAR_PANEL_WIDTH) {
1603
+ const windowWidth = Dimensions.get("window").width;
1604
+ return Math.max(0, (windowWidth - panelWidth) / 2);
1605
+ }
1602
1606
  var calendarFieldMetrics = StyleSheet.create({
1603
1607
  container: {
1604
1608
  flexDirection: "row",
@@ -2015,10 +2019,9 @@ function resolveDayCellStyle(day) {
2015
2019
  if (day.isSelected) {
2016
2020
  return [calendarDropdownMetrics.dayCell, calendarDropdownMetrics.dayCellSelected];
2017
2021
  }
2018
- const useMutedBackground = day.inCurrentMonth && !day.isToday && (day.isPast || day.isDisabled);
2019
2022
  return [
2020
2023
  calendarDropdownMetrics.dayCell,
2021
- useMutedBackground ? calendarDropdownMetrics.dayCellPast : null
2024
+ day.isDisabled ? calendarDropdownMetrics.dayCellDisabled : null
2022
2025
  ];
2023
2026
  }
2024
2027
  function resolveDayLabelStyle(day) {
@@ -2031,7 +2034,7 @@ function resolveDayLabelStyle(day) {
2031
2034
  if (day.isToday) {
2032
2035
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelToday];
2033
2036
  }
2034
- if (day.isPast || day.isDisabled) {
2037
+ if (day.isDisabled) {
2035
2038
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelMuted];
2036
2039
  }
2037
2040
  return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelFuture];
@@ -2309,6 +2312,7 @@ function CalendarIcon({
2309
2312
  }
2310
2313
  ) });
2311
2314
  }
2315
+ var isDesktopCalendar = Platform.OS === "web";
2312
2316
  function DatePicker(props) {
2313
2317
  const {
2314
2318
  label,
@@ -2391,9 +2395,8 @@ function DatePicker(props) {
2391
2395
  };
2392
2396
  const helperMessage = error ?? hint;
2393
2397
  const panelWidth = CALENDAR_PANEL_WIDTH;
2394
- const panelLeft = anchor ? resolveCalendarDropdownLeft(anchor, panelWidth) : 0;
2398
+ const panelLeft = anchor ? isDesktopCalendar ? resolveCalendarDropdownLeft(anchor, panelWidth) : resolveCalendarDropdownLeftCentered(panelWidth) : 0;
2395
2399
  const dropdownTop = anchor ? resolveCalendarDropdownTop(anchor) : 0;
2396
- const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
2397
2400
  function closePicker() {
2398
2401
  setOpen(false);
2399
2402
  setAnchor(null);
@@ -2407,6 +2410,7 @@ function DatePicker(props) {
2407
2410
  setOpen(true);
2408
2411
  });
2409
2412
  }
2413
+ const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
2410
2414
  function handleSingleSelect(date) {
2411
2415
  if (props.mode === "range") {
2412
2416
  return;