@scripso-homepad/ui 0.4.30 → 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 +24 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Calendar.tsx +5 -13
- package/src/components/DatePicker.tsx +14 -5
- package/src/theme/calendar.ts +20 -10
package/dist/index.cjs
CHANGED
|
@@ -2292,7 +2292,7 @@ var CALENDAR_NAV_ICON_COLOR = colors.stormGray850;
|
|
|
2292
2292
|
var CALENDAR_FIELD_ICON_SIZE = 20;
|
|
2293
2293
|
var CALENDAR_FIELD_WIDTH = CALENDAR_PANEL_WIDTH;
|
|
2294
2294
|
var CALENDAR_FIELD_HEIGHT = 52;
|
|
2295
|
-
var CALENDAR_FIELD_PADDING =
|
|
2295
|
+
var CALENDAR_FIELD_PADDING = 14;
|
|
2296
2296
|
var CALENDAR_FIELD_GAP = spacing.sm;
|
|
2297
2297
|
var CALENDAR_FIELD_PLACEHOLDER_COLOR = colors.stormGray200;
|
|
2298
2298
|
var CALENDAR_PANEL_TOTAL_HEIGHT = CALENDAR_PANEL_PADDING * 2 + CALENDAR_HEADER_HEIGHT + CALENDAR_PANEL_GAP * 2 + CALENDAR_WEEKDAY_CELL_SIZE + CALENDAR_DAY_GRID_HEIGHT;
|
|
@@ -2420,7 +2420,7 @@ var calendarDropdownMetrics = reactNative.StyleSheet.create({
|
|
|
2420
2420
|
boxSizing: "border-box"
|
|
2421
2421
|
} : null
|
|
2422
2422
|
},
|
|
2423
|
-
|
|
2423
|
+
dayCellDisabled: {
|
|
2424
2424
|
backgroundColor: colors.stormGray50
|
|
2425
2425
|
},
|
|
2426
2426
|
dayCellSelected: {
|
|
@@ -2454,19 +2454,20 @@ var calendarDropdownMetrics = reactNative.StyleSheet.create({
|
|
|
2454
2454
|
color: colors.stormGray300
|
|
2455
2455
|
},
|
|
2456
2456
|
dayLabelDisabled: {
|
|
2457
|
-
color: colors.stormGray300
|
|
2458
|
-
opacity: 0.5
|
|
2457
|
+
color: colors.stormGray300
|
|
2459
2458
|
},
|
|
2460
|
-
|
|
2459
|
+
todayDotWrap: {
|
|
2461
2460
|
position: "absolute",
|
|
2462
|
-
bottom:
|
|
2463
|
-
left:
|
|
2461
|
+
bottom: 4,
|
|
2462
|
+
left: 0,
|
|
2463
|
+
right: 0,
|
|
2464
|
+
alignItems: "center"
|
|
2465
|
+
},
|
|
2466
|
+
todayDot: {
|
|
2464
2467
|
width: CALENDAR_DAY_DOT_SIZE,
|
|
2465
2468
|
height: CALENDAR_DAY_DOT_SIZE,
|
|
2466
|
-
borderRadius:
|
|
2467
|
-
backgroundColor: CALENDAR_TODAY_DOT_COLOR
|
|
2468
|
-
marginLeft: -1.5,
|
|
2469
|
-
zIndex: 1
|
|
2469
|
+
borderRadius: CALENDAR_DAY_DOT_SIZE / 2,
|
|
2470
|
+
backgroundColor: CALENDAR_TODAY_DOT_COLOR
|
|
2470
2471
|
},
|
|
2471
2472
|
pickerBody: {
|
|
2472
2473
|
width: CALENDAR_DAY_GRID_WIDTH,
|
|
@@ -2542,6 +2543,10 @@ function resolveCalendarDropdownLeft(anchor, panelWidth = CALENDAR_PANEL_WIDTH)
|
|
|
2542
2543
|
const maxLeft = Math.max(0, windowWidth - panelWidth);
|
|
2543
2544
|
return Math.max(0, Math.min(anchor.x, maxLeft));
|
|
2544
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
|
+
}
|
|
2545
2550
|
var calendarFieldMetrics = reactNative.StyleSheet.create({
|
|
2546
2551
|
container: {
|
|
2547
2552
|
flexDirection: "row",
|
|
@@ -2567,7 +2572,8 @@ var calendarFieldMetrics = reactNative.StyleSheet.create({
|
|
|
2567
2572
|
paddingVertical: 0,
|
|
2568
2573
|
paddingHorizontal: 0,
|
|
2569
2574
|
margin: 0,
|
|
2570
|
-
|
|
2575
|
+
includeFontPadding: false,
|
|
2576
|
+
...reactNative.Platform.OS === "android" ? { textAlignVertical: "center" } : null,
|
|
2571
2577
|
...reactNative.Platform.OS === "web" ? {
|
|
2572
2578
|
outlineStyle: "none"
|
|
2573
2579
|
} : null
|
|
@@ -2954,21 +2960,15 @@ function useCalendarLocale(locale) {
|
|
|
2954
2960
|
);
|
|
2955
2961
|
}
|
|
2956
2962
|
function resolveDayCellStyle(day) {
|
|
2957
|
-
if (day.isDisabled) {
|
|
2958
|
-
return [calendarDropdownMetrics.dayCell];
|
|
2959
|
-
}
|
|
2960
2963
|
if (day.isSelected) {
|
|
2961
2964
|
return [calendarDropdownMetrics.dayCell, calendarDropdownMetrics.dayCellSelected];
|
|
2962
2965
|
}
|
|
2963
2966
|
return [
|
|
2964
2967
|
calendarDropdownMetrics.dayCell,
|
|
2965
|
-
day.
|
|
2968
|
+
day.isDisabled ? calendarDropdownMetrics.dayCellDisabled : null
|
|
2966
2969
|
];
|
|
2967
2970
|
}
|
|
2968
2971
|
function resolveDayLabelStyle(day) {
|
|
2969
|
-
if (day.isDisabled) {
|
|
2970
|
-
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelDisabled];
|
|
2971
|
-
}
|
|
2972
2972
|
if (day.isSelected) {
|
|
2973
2973
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelSelected];
|
|
2974
2974
|
}
|
|
@@ -2978,7 +2978,7 @@ function resolveDayLabelStyle(day) {
|
|
|
2978
2978
|
if (day.isToday) {
|
|
2979
2979
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelToday];
|
|
2980
2980
|
}
|
|
2981
|
-
if (day.
|
|
2981
|
+
if (day.isDisabled) {
|
|
2982
2982
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelMuted];
|
|
2983
2983
|
}
|
|
2984
2984
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelFuture];
|
|
@@ -3169,7 +3169,7 @@ function Calendar(props) {
|
|
|
3169
3169
|
style: resolveDayCellStyle(day),
|
|
3170
3170
|
children: [
|
|
3171
3171
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: resolveDayLabelStyle(day), children: day.date.getDate() }),
|
|
3172
|
-
day.isToday && day.inCurrentMonth && !day.isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: calendarDropdownMetrics.todayDot }) : null
|
|
3172
|
+
day.isToday && day.inCurrentMonth && !day.isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: calendarDropdownMetrics.todayDotWrap, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: calendarDropdownMetrics.todayDot }) }) : null
|
|
3173
3173
|
]
|
|
3174
3174
|
},
|
|
3175
3175
|
day.date.toISOString()
|
|
@@ -3256,6 +3256,7 @@ function CalendarIcon({
|
|
|
3256
3256
|
}
|
|
3257
3257
|
) });
|
|
3258
3258
|
}
|
|
3259
|
+
var isDesktopCalendar = reactNative.Platform.OS === "web";
|
|
3259
3260
|
function DatePicker(props) {
|
|
3260
3261
|
const {
|
|
3261
3262
|
label,
|
|
@@ -3338,9 +3339,8 @@ function DatePicker(props) {
|
|
|
3338
3339
|
};
|
|
3339
3340
|
const helperMessage = error ?? hint;
|
|
3340
3341
|
const panelWidth = CALENDAR_PANEL_WIDTH;
|
|
3341
|
-
const panelLeft = anchor ? resolveCalendarDropdownLeft(anchor, panelWidth) : 0;
|
|
3342
|
+
const panelLeft = anchor ? isDesktopCalendar ? resolveCalendarDropdownLeft(anchor, panelWidth) : resolveCalendarDropdownLeftCentered(panelWidth) : 0;
|
|
3342
3343
|
const dropdownTop = anchor ? resolveCalendarDropdownTop(anchor) : 0;
|
|
3343
|
-
const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
|
|
3344
3344
|
function closePicker() {
|
|
3345
3345
|
setOpen(false);
|
|
3346
3346
|
setAnchor(null);
|
|
@@ -3354,6 +3354,7 @@ function DatePicker(props) {
|
|
|
3354
3354
|
setOpen(true);
|
|
3355
3355
|
});
|
|
3356
3356
|
}
|
|
3357
|
+
const resolvedDefaultViewDate = defaultViewDate ?? (props.mode === "range" ? props.value?.start : props.value) ?? today;
|
|
3357
3358
|
function handleSingleSelect(date) {
|
|
3358
3359
|
if (props.mode === "range") {
|
|
3359
3360
|
return;
|