@lazerlen/legend-calendar 1.1.1 → 1.2.0
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/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-test.log +100 -100
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +168 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/CalendarItemDay.tsx +73 -19
- package/src/components/CalendarList.tsx +22 -3
package/dist/index.mjs
CHANGED
|
@@ -530,9 +530,7 @@ var buildBaseStyles = (theme) => {
|
|
|
530
530
|
return {
|
|
531
531
|
active: ({
|
|
532
532
|
isPressed,
|
|
533
|
-
isHovered
|
|
534
|
-
isStartOfRange,
|
|
535
|
-
isEndOfRange
|
|
533
|
+
isHovered
|
|
536
534
|
}) => {
|
|
537
535
|
const baseStyles = isPressed || isHovered ? {
|
|
538
536
|
container: __spreadProps(__spreadValues({}, styles.baseContainer), {
|
|
@@ -549,18 +547,6 @@ var buildBaseStyles = (theme) => {
|
|
|
549
547
|
color: theme.colors.content.inverse.primary
|
|
550
548
|
})
|
|
551
549
|
};
|
|
552
|
-
baseStyles.container.borderRadius = 0;
|
|
553
|
-
if (isStartOfRange) {
|
|
554
|
-
baseStyles.container.borderTopLeftRadius = 16;
|
|
555
|
-
baseStyles.container.borderBottomLeftRadius = 16;
|
|
556
|
-
}
|
|
557
|
-
if (isEndOfRange) {
|
|
558
|
-
baseStyles.container.borderTopRightRadius = 16;
|
|
559
|
-
baseStyles.container.borderBottomRightRadius = 16;
|
|
560
|
-
}
|
|
561
|
-
if (!isStartOfRange && !isEndOfRange) {
|
|
562
|
-
baseStyles.container.borderRadius = 0;
|
|
563
|
-
}
|
|
564
550
|
return baseStyles;
|
|
565
551
|
},
|
|
566
552
|
disabled: () => ({
|
|
@@ -643,7 +629,7 @@ var CalendarItemDay = /* @__PURE__ */ memo(function CalendarItemDay2(t0) {
|
|
|
643
629
|
let t5;
|
|
644
630
|
if ($[5] !== baseStyles || $[6] !== height || $[7] !== metadata || $[8] !== theme) {
|
|
645
631
|
t5 = (t62) => {
|
|
646
|
-
var _a, _b, _c14, _d;
|
|
632
|
+
var _a, _b, _c14, _d, _e;
|
|
647
633
|
const {
|
|
648
634
|
pressed: isPressed,
|
|
649
635
|
hovered: isHovered,
|
|
@@ -659,13 +645,50 @@ var CalendarItemDay = /* @__PURE__ */ memo(function CalendarItemDay2(t0) {
|
|
|
659
645
|
const {
|
|
660
646
|
container
|
|
661
647
|
} = baseStyles[metadata.state](params);
|
|
662
|
-
|
|
663
|
-
height
|
|
664
|
-
}), (_c14 = theme == null ? void 0 : theme.base) == null ? void 0 : _c14.call(theme, __spreadProps(__spreadValues({}, metadata), {
|
|
648
|
+
const baseThemeContainer = (_c14 = theme == null ? void 0 : theme.base) == null ? void 0 : _c14.call(theme, __spreadProps(__spreadValues({}, metadata), {
|
|
665
649
|
isPressed
|
|
666
|
-
})).container
|
|
650
|
+
})).container;
|
|
651
|
+
const stateThemeContainer = (_d = theme == null ? void 0 : theme[metadata.state]) == null ? void 0 : _d.call(theme, __spreadProps(__spreadValues({}, metadata), {
|
|
667
652
|
isPressed
|
|
668
|
-
})).container
|
|
653
|
+
})).container;
|
|
654
|
+
const mergedContainer = __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, container), {
|
|
655
|
+
height
|
|
656
|
+
}), baseThemeContainer), stateThemeContainer);
|
|
657
|
+
if (metadata.state === "active") {
|
|
658
|
+
const hasCustomRadius = (baseThemeContainer == null ? void 0 : baseThemeContainer.borderRadius) !== void 0 || (baseThemeContainer == null ? void 0 : baseThemeContainer.borderTopLeftRadius) !== void 0 || (baseThemeContainer == null ? void 0 : baseThemeContainer.borderBottomLeftRadius) !== void 0 || (baseThemeContainer == null ? void 0 : baseThemeContainer.borderTopRightRadius) !== void 0 || (baseThemeContainer == null ? void 0 : baseThemeContainer.borderBottomRightRadius) !== void 0 || (stateThemeContainer == null ? void 0 : stateThemeContainer.borderRadius) !== void 0 || (stateThemeContainer == null ? void 0 : stateThemeContainer.borderTopLeftRadius) !== void 0 || (stateThemeContainer == null ? void 0 : stateThemeContainer.borderBottomLeftRadius) !== void 0 || (stateThemeContainer == null ? void 0 : stateThemeContainer.borderTopRightRadius) !== void 0 || (stateThemeContainer == null ? void 0 : stateThemeContainer.borderBottomRightRadius) !== void 0;
|
|
659
|
+
if (!hasCustomRadius) {
|
|
660
|
+
const defaultRadius = (_e = styles.baseContainer.borderRadius) != null ? _e : 0;
|
|
661
|
+
mergedContainer.borderRadius = 0;
|
|
662
|
+
if (metadata.isStartOfRange) {
|
|
663
|
+
mergedContainer.borderTopLeftRadius = defaultRadius;
|
|
664
|
+
mergedContainer.borderBottomLeftRadius = defaultRadius;
|
|
665
|
+
}
|
|
666
|
+
if (metadata.isEndOfRange) {
|
|
667
|
+
mergedContainer.borderTopRightRadius = defaultRadius;
|
|
668
|
+
mergedContainer.borderBottomRightRadius = defaultRadius;
|
|
669
|
+
}
|
|
670
|
+
if (!metadata.isStartOfRange && !metadata.isEndOfRange) {
|
|
671
|
+
mergedContainer.borderRadius = 0;
|
|
672
|
+
}
|
|
673
|
+
} else {
|
|
674
|
+
if (mergedContainer.borderRadius !== void 0) {
|
|
675
|
+
const radius = mergedContainer.borderRadius;
|
|
676
|
+
if (metadata.isStartOfRange && mergedContainer.borderTopLeftRadius === void 0) {
|
|
677
|
+
mergedContainer.borderTopLeftRadius = radius;
|
|
678
|
+
}
|
|
679
|
+
if (metadata.isStartOfRange && mergedContainer.borderBottomLeftRadius === void 0) {
|
|
680
|
+
mergedContainer.borderBottomLeftRadius = radius;
|
|
681
|
+
}
|
|
682
|
+
if (metadata.isEndOfRange && mergedContainer.borderTopRightRadius === void 0) {
|
|
683
|
+
mergedContainer.borderTopRightRadius = radius;
|
|
684
|
+
}
|
|
685
|
+
if (metadata.isEndOfRange && mergedContainer.borderBottomRightRadius === void 0) {
|
|
686
|
+
mergedContainer.borderBottomRightRadius = radius;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return mergedContainer;
|
|
669
692
|
};
|
|
670
693
|
$[5] = baseStyles;
|
|
671
694
|
$[6] = height;
|
|
@@ -736,7 +759,7 @@ var CalendarItemDay = /* @__PURE__ */ memo(function CalendarItemDay2(t0) {
|
|
|
736
759
|
return t7;
|
|
737
760
|
});
|
|
738
761
|
var CalendarItemDayContainer = /* @__PURE__ */ memo(function CalendarItemDayContainer2(t0) {
|
|
739
|
-
const $ = _c3(
|
|
762
|
+
const $ = _c3(21);
|
|
740
763
|
const {
|
|
741
764
|
children,
|
|
742
765
|
isStartOfWeek,
|
|
@@ -747,27 +770,44 @@ var CalendarItemDayContainer = /* @__PURE__ */ memo(function CalendarItemDayCont
|
|
|
747
770
|
metadata
|
|
748
771
|
} = t0;
|
|
749
772
|
const baseTheme = useTheme();
|
|
750
|
-
|
|
751
|
-
|
|
773
|
+
let t1;
|
|
774
|
+
if ($[0] !== metadata || $[1] !== theme) {
|
|
775
|
+
t1 = typeof (theme == null ? void 0 : theme.spacer) === "function" && metadata ? theme.spacer(metadata) : theme == null ? void 0 : theme.spacer;
|
|
776
|
+
$[0] = metadata;
|
|
777
|
+
$[1] = theme;
|
|
778
|
+
$[2] = t1;
|
|
779
|
+
} else {
|
|
780
|
+
t1 = $[2];
|
|
781
|
+
}
|
|
782
|
+
const spacerTheme = t1;
|
|
783
|
+
const t2 = isStartOfWeek ? 0 : daySpacing;
|
|
752
784
|
let t3;
|
|
753
|
-
if ($[
|
|
754
|
-
t3 =
|
|
785
|
+
if ($[3] !== spacerTheme) {
|
|
786
|
+
t3 = spacerTheme != null ? spacerTheme : {};
|
|
787
|
+
$[3] = spacerTheme;
|
|
788
|
+
$[4] = t3;
|
|
789
|
+
} else {
|
|
790
|
+
t3 = $[4];
|
|
791
|
+
}
|
|
792
|
+
let t4;
|
|
793
|
+
if ($[5] !== dayHeight || $[6] !== t2 || $[7] !== t3) {
|
|
794
|
+
t4 = __spreadValues({
|
|
755
795
|
position: "relative",
|
|
756
|
-
marginLeft:
|
|
796
|
+
marginLeft: t2,
|
|
757
797
|
flex: 1,
|
|
758
798
|
height: dayHeight
|
|
759
|
-
},
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
$[
|
|
763
|
-
$[
|
|
799
|
+
}, t3);
|
|
800
|
+
$[5] = dayHeight;
|
|
801
|
+
$[6] = t2;
|
|
802
|
+
$[7] = t3;
|
|
803
|
+
$[8] = t4;
|
|
764
804
|
} else {
|
|
765
|
-
|
|
805
|
+
t4 = $[8];
|
|
766
806
|
}
|
|
767
|
-
const spacerStyles =
|
|
768
|
-
let
|
|
769
|
-
if ($[
|
|
770
|
-
|
|
807
|
+
const spacerStyles = t4;
|
|
808
|
+
let t5;
|
|
809
|
+
if ($[9] !== baseTheme || $[10] !== daySpacing || $[11] !== metadata || $[12] !== shouldShowActiveDayFiller || $[13] !== theme) {
|
|
810
|
+
t5 = !shouldShowActiveDayFiller ? null : __spreadValues({
|
|
771
811
|
position: "absolute",
|
|
772
812
|
top: 0,
|
|
773
813
|
bottom: 0,
|
|
@@ -775,40 +815,40 @@ var CalendarItemDayContainer = /* @__PURE__ */ memo(function CalendarItemDayCont
|
|
|
775
815
|
width: daySpacing + 2,
|
|
776
816
|
backgroundColor: baseTheme.colors.background.inverse.primary
|
|
777
817
|
}, typeof (theme == null ? void 0 : theme.activeDayFiller) === "function" && !!metadata ? theme.activeDayFiller(metadata) : theme == null ? void 0 : theme.activeDayFiller);
|
|
778
|
-
$[
|
|
779
|
-
$[
|
|
780
|
-
$[
|
|
781
|
-
$[
|
|
782
|
-
$[
|
|
783
|
-
$[
|
|
818
|
+
$[9] = baseTheme;
|
|
819
|
+
$[10] = daySpacing;
|
|
820
|
+
$[11] = metadata;
|
|
821
|
+
$[12] = shouldShowActiveDayFiller;
|
|
822
|
+
$[13] = theme;
|
|
823
|
+
$[14] = t5;
|
|
784
824
|
} else {
|
|
785
|
-
|
|
825
|
+
t5 = $[14];
|
|
786
826
|
}
|
|
787
|
-
const activeDayFiller =
|
|
788
|
-
let
|
|
789
|
-
if ($[
|
|
790
|
-
|
|
827
|
+
const activeDayFiller = t5;
|
|
828
|
+
let t6;
|
|
829
|
+
if ($[15] !== activeDayFiller) {
|
|
830
|
+
t6 = activeDayFiller ? /* @__PURE__ */ _jsx2(View, {
|
|
791
831
|
style: activeDayFiller
|
|
792
832
|
}) : null;
|
|
793
|
-
$[
|
|
794
|
-
$[
|
|
833
|
+
$[15] = activeDayFiller;
|
|
834
|
+
$[16] = t6;
|
|
795
835
|
} else {
|
|
796
|
-
|
|
836
|
+
t6 = $[16];
|
|
797
837
|
}
|
|
798
|
-
let
|
|
799
|
-
if ($[
|
|
800
|
-
|
|
838
|
+
let t7;
|
|
839
|
+
if ($[17] !== children || $[18] !== spacerStyles || $[19] !== t6) {
|
|
840
|
+
t7 = /* @__PURE__ */ _jsxs(View, {
|
|
801
841
|
style: spacerStyles,
|
|
802
|
-
children: [
|
|
842
|
+
children: [t6, children]
|
|
803
843
|
});
|
|
804
|
-
$[
|
|
805
|
-
$[
|
|
806
|
-
$[
|
|
807
|
-
$[
|
|
844
|
+
$[17] = children;
|
|
845
|
+
$[18] = spacerStyles;
|
|
846
|
+
$[19] = t6;
|
|
847
|
+
$[20] = t7;
|
|
808
848
|
} else {
|
|
809
|
-
|
|
849
|
+
t7 = $[20];
|
|
810
850
|
}
|
|
811
|
-
return
|
|
851
|
+
return t7;
|
|
812
852
|
});
|
|
813
853
|
var CalendarItemDayWithContainer = /* @__PURE__ */ memo(function CalendarItemDayWithContainer2(t0) {
|
|
814
854
|
const $ = _c3(14);
|
|
@@ -1664,7 +1704,7 @@ var Calendar = /* @__PURE__ */ memo6(function Calendar2(props) {
|
|
|
1664
1704
|
// src/components/CalendarList.tsx
|
|
1665
1705
|
import { c as _c12 } from "react/compiler-runtime";
|
|
1666
1706
|
import { LegendList as LegendListBase } from "@legendapp/list/react-native";
|
|
1667
|
-
import {
|
|
1707
|
+
import { useEffect as useEffect2, useImperativeHandle, useRef } from "react";
|
|
1668
1708
|
import { StyleSheet as StyleSheet8, View as View7 } from "react-native";
|
|
1669
1709
|
|
|
1670
1710
|
// src/hooks/useCalendarList.tsx
|
|
@@ -1914,8 +1954,8 @@ var getHeightForMonth = ({
|
|
|
1914
1954
|
import { jsx as _jsx10 } from "react/jsx-runtime";
|
|
1915
1955
|
var LegendList = LegendListBase;
|
|
1916
1956
|
var keyExtractor = (month) => month.id;
|
|
1917
|
-
|
|
1918
|
-
const $ = _c12(
|
|
1957
|
+
function CalendarList(t0) {
|
|
1958
|
+
const $ = _c12(42);
|
|
1919
1959
|
const _a = t0, {
|
|
1920
1960
|
ref
|
|
1921
1961
|
} = _a, props = __objRest(_a, [
|
|
@@ -2111,14 +2151,14 @@ var CalendarList = /* @__PURE__ */ memo7(function CalendarList2(t0) {
|
|
|
2111
2151
|
});
|
|
2112
2152
|
}, 0);
|
|
2113
2153
|
},
|
|
2114
|
-
scrollToDate(date_1, animated_0,
|
|
2154
|
+
scrollToDate(date_1, animated_0, t162) {
|
|
2115
2155
|
var _a2;
|
|
2116
2156
|
const {
|
|
2117
|
-
additionalOffset:
|
|
2118
|
-
} =
|
|
2157
|
+
additionalOffset: t172
|
|
2158
|
+
} = t162 === void 0 ? {
|
|
2119
2159
|
additionalOffset: 0
|
|
2120
|
-
} :
|
|
2121
|
-
const additionalOffset_0 =
|
|
2160
|
+
} : t162;
|
|
2161
|
+
const additionalOffset_0 = t172 === void 0 ? 0 : t172;
|
|
2122
2162
|
const currentMonthOffset = getScrollOffsetForMonth(date_1);
|
|
2123
2163
|
const weekOfMonthIndex = getWeekOfMonth(date_1, calendarFirstDayOfWeek);
|
|
2124
2164
|
const rowHeight = calendarDayHeight + calendarRowVerticalSpacing;
|
|
@@ -2149,54 +2189,91 @@ var CalendarList = /* @__PURE__ */ memo7(function CalendarList2(t0) {
|
|
|
2149
2189
|
useImperativeHandle(ref, t13);
|
|
2150
2190
|
let t14;
|
|
2151
2191
|
if ($[23] !== calendarSpacing) {
|
|
2152
|
-
|
|
2192
|
+
t14 = {
|
|
2153
2193
|
paddingBottom: calendarSpacing
|
|
2154
2194
|
};
|
|
2155
|
-
|
|
2195
|
+
$[23] = calendarSpacing;
|
|
2196
|
+
$[24] = t14;
|
|
2197
|
+
} else {
|
|
2198
|
+
t14 = $[24];
|
|
2199
|
+
}
|
|
2200
|
+
const calendarContainerStyle = t14;
|
|
2201
|
+
let t15;
|
|
2202
|
+
if ($[25] !== calendarAdditionalHeight || $[26] !== calendarDayHeight || $[27] !== calendarMonthHeaderHeight || $[28] !== calendarRowVerticalSpacing || $[29] !== calendarSpacing || $[30] !== calendarWeekHeaderHeight) {
|
|
2203
|
+
t15 = (item) => getHeightForMonth({
|
|
2204
|
+
calendarMonth: item,
|
|
2205
|
+
calendarSpacing,
|
|
2206
|
+
calendarDayHeight,
|
|
2207
|
+
calendarMonthHeaderHeight,
|
|
2208
|
+
calendarRowVerticalSpacing,
|
|
2209
|
+
calendarWeekHeaderHeight,
|
|
2210
|
+
calendarAdditionalHeight
|
|
2211
|
+
});
|
|
2212
|
+
$[25] = calendarAdditionalHeight;
|
|
2213
|
+
$[26] = calendarDayHeight;
|
|
2214
|
+
$[27] = calendarMonthHeaderHeight;
|
|
2215
|
+
$[28] = calendarRowVerticalSpacing;
|
|
2216
|
+
$[29] = calendarSpacing;
|
|
2217
|
+
$[30] = calendarWeekHeaderHeight;
|
|
2218
|
+
$[31] = t15;
|
|
2219
|
+
} else {
|
|
2220
|
+
t15 = $[31];
|
|
2221
|
+
}
|
|
2222
|
+
const getFixedItemSize = t15;
|
|
2223
|
+
let t16;
|
|
2224
|
+
if ($[32] !== calendarContainerStyle) {
|
|
2225
|
+
t16 = (t172) => {
|
|
2156
2226
|
const {
|
|
2157
|
-
item
|
|
2158
|
-
} =
|
|
2227
|
+
item: item_0
|
|
2228
|
+
} = t172;
|
|
2159
2229
|
return /* @__PURE__ */ _jsx10(View7, {
|
|
2160
2230
|
style: calendarContainerStyle,
|
|
2161
2231
|
children: /* @__PURE__ */ _jsx10(Calendar, __spreadValues({
|
|
2162
|
-
calendarMonthId:
|
|
2163
|
-
},
|
|
2232
|
+
calendarMonthId: item_0.id
|
|
2233
|
+
}, item_0.calendarProps))
|
|
2164
2234
|
});
|
|
2165
2235
|
};
|
|
2166
|
-
$[
|
|
2167
|
-
$[
|
|
2236
|
+
$[32] = calendarContainerStyle;
|
|
2237
|
+
$[33] = t16;
|
|
2168
2238
|
} else {
|
|
2169
|
-
|
|
2239
|
+
t16 = $[33];
|
|
2170
2240
|
}
|
|
2171
|
-
const handleRenderItem =
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2241
|
+
const handleRenderItem = t16;
|
|
2242
|
+
const handleViewableItemsChanged = _temp;
|
|
2243
|
+
let t17;
|
|
2244
|
+
if ($[34] !== flatListProps || $[35] !== getFixedItemSize || $[36] !== handleOnEndReached || $[37] !== handleOnStartReached || $[38] !== handleRenderItem || $[39] !== initialMonthIndex || $[40] !== monthListWithCalendarProps) {
|
|
2245
|
+
t17 = /* @__PURE__ */ _jsx10(LegendList, __spreadValues({
|
|
2175
2246
|
data: monthListWithCalendarProps,
|
|
2247
|
+
drawDistance: 560,
|
|
2176
2248
|
estimatedItemSize: 273,
|
|
2249
|
+
getFixedItemSize,
|
|
2177
2250
|
initialScrollIndex: initialMonthIndex,
|
|
2178
2251
|
keyExtractor,
|
|
2179
2252
|
maintainVisibleContentPosition: true,
|
|
2180
2253
|
onEndReached: handleOnEndReached,
|
|
2181
2254
|
onStartReached: handleOnStartReached,
|
|
2255
|
+
onViewableItemsChanged: handleViewableItemsChanged,
|
|
2182
2256
|
recycleItems: true,
|
|
2183
2257
|
ref: legendListRef,
|
|
2184
2258
|
renderItem: handleRenderItem,
|
|
2185
2259
|
showsVerticalScrollIndicator: false,
|
|
2186
2260
|
style: styles8.container
|
|
2187
2261
|
}, flatListProps));
|
|
2188
|
-
$[
|
|
2189
|
-
$[
|
|
2190
|
-
$[
|
|
2191
|
-
$[
|
|
2192
|
-
$[
|
|
2193
|
-
$[
|
|
2194
|
-
$[
|
|
2262
|
+
$[34] = flatListProps;
|
|
2263
|
+
$[35] = getFixedItemSize;
|
|
2264
|
+
$[36] = handleOnEndReached;
|
|
2265
|
+
$[37] = handleOnStartReached;
|
|
2266
|
+
$[38] = handleRenderItem;
|
|
2267
|
+
$[39] = initialMonthIndex;
|
|
2268
|
+
$[40] = monthListWithCalendarProps;
|
|
2269
|
+
$[41] = t17;
|
|
2195
2270
|
} else {
|
|
2196
|
-
|
|
2271
|
+
t17 = $[41];
|
|
2197
2272
|
}
|
|
2198
|
-
return
|
|
2199
|
-
}
|
|
2273
|
+
return t17;
|
|
2274
|
+
}
|
|
2275
|
+
function _temp() {
|
|
2276
|
+
}
|
|
2200
2277
|
var styles8 = StyleSheet8.create({
|
|
2201
2278
|
container: {
|
|
2202
2279
|
flex: 1
|