@lafarmer28/densitycalendarnative 0.1.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/LICENSE +20 -0
- package/README.md +37 -0
- package/lib/module/components/density-calendar/context/ks-density-calendar-context.js +5 -0
- package/lib/module/components/density-calendar/context/ks-density-calendar-context.js.map +1 -0
- package/lib/module/components/density-calendar/context/ks-density-calendar-provider.js +68 -0
- package/lib/module/components/density-calendar/context/ks-density-calendar-provider.js.map +1 -0
- package/lib/module/components/density-calendar/context/use-ks-density-calendar-context.js +12 -0
- package/lib/module/components/density-calendar/context/use-ks-density-calendar-context.js.map +1 -0
- package/lib/module/components/density-calendar/day-view/day-navigation.js +172 -0
- package/lib/module/components/density-calendar/day-view/day-navigation.js.map +1 -0
- package/lib/module/components/density-calendar/day-view/ks-density-calendar-day-view.js +183 -0
- package/lib/module/components/density-calendar/day-view/ks-density-calendar-day-view.js.map +1 -0
- package/lib/module/components/density-calendar/ks-density-calendar-root.js +201 -0
- package/lib/module/components/density-calendar/ks-density-calendar-root.js.map +1 -0
- package/lib/module/components/density-calendar/ks-density-calendar.js +24 -0
- package/lib/module/components/density-calendar/ks-density-calendar.js.map +1 -0
- package/lib/module/components/density-calendar/ks-error-popup/ks-error-tooltip.js +74 -0
- package/lib/module/components/density-calendar/ks-error-popup/ks-error-tooltip.js.map +1 -0
- package/lib/module/components/density-calendar/ks-slider/ks-slider.js +174 -0
- package/lib/module/components/density-calendar/ks-slider/ks-slider.js.map +1 -0
- package/lib/module/components/density-calendar/ks-toggler/ks-toggler.js +72 -0
- package/lib/module/components/density-calendar/ks-toggler/ks-toggler.js.map +1 -0
- package/lib/module/components/density-calendar/month-view/days-of-week.js +51 -0
- package/lib/module/components/density-calendar/month-view/days-of-week.js.map +1 -0
- package/lib/module/components/density-calendar/month-view/ks-density-calendar-month-view.js +212 -0
- package/lib/module/components/density-calendar/month-view/ks-density-calendar-month-view.js.map +1 -0
- package/lib/module/components/density-calendar/month-view/top-navigation.js +118 -0
- package/lib/module/components/density-calendar/month-view/top-navigation.js.map +1 -0
- package/lib/module/components/density-calendar/utility-functions.js +50 -0
- package/lib/module/components/density-calendar/utility-functions.js.map +1 -0
- package/lib/module/components/density-calendar/week-view/ks-density-calendar-week-view.js +152 -0
- package/lib/module/components/density-calendar/week-view/ks-density-calendar-week-view.js.map +1 -0
- package/lib/module/components/density-calendar/week-view/top.js +53 -0
- package/lib/module/components/density-calendar/week-view/top.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-context.d.ts +17 -0
- package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-context.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-provider.d.ts +19 -0
- package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-provider.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/context/use-ks-density-calendar-context.d.ts +2 -0
- package/lib/typescript/src/components/density-calendar/context/use-ks-density-calendar-context.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/day-view/day-navigation.d.ts +17 -0
- package/lib/typescript/src/components/density-calendar/day-view/day-navigation.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/day-view/ks-density-calendar-day-view.d.ts +21 -0
- package/lib/typescript/src/components/density-calendar/day-view/ks-density-calendar-day-view.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/ks-density-calendar-root.d.ts +14 -0
- package/lib/typescript/src/components/density-calendar/ks-density-calendar-root.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/ks-density-calendar.d.ts +43 -0
- package/lib/typescript/src/components/density-calendar/ks-density-calendar.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/ks-error-popup/ks-error-tooltip.d.ts +8 -0
- package/lib/typescript/src/components/density-calendar/ks-error-popup/ks-error-tooltip.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/ks-slider/ks-slider.d.ts +8 -0
- package/lib/typescript/src/components/density-calendar/ks-slider/ks-slider.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/ks-toggler/ks-toggler.d.ts +3 -0
- package/lib/typescript/src/components/density-calendar/ks-toggler/ks-toggler.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/month-view/days-of-week.d.ts +3 -0
- package/lib/typescript/src/components/density-calendar/month-view/days-of-week.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/month-view/ks-density-calendar-month-view.d.ts +17 -0
- package/lib/typescript/src/components/density-calendar/month-view/ks-density-calendar-month-view.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/month-view/top-navigation.d.ts +11 -0
- package/lib/typescript/src/components/density-calendar/month-view/top-navigation.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/utility-functions.d.ts +9 -0
- package/lib/typescript/src/components/density-calendar/utility-functions.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/week-view/ks-density-calendar-week-view.d.ts +12 -0
- package/lib/typescript/src/components/density-calendar/week-view/ks-density-calendar-week-view.d.ts.map +1 -0
- package/lib/typescript/src/components/density-calendar/week-view/top.d.ts +6 -0
- package/lib/typescript/src/components/density-calendar/week-view/top.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +166 -0
- package/src/components/density-calendar/context/ks-density-calendar-context.tsx +23 -0
- package/src/components/density-calendar/context/ks-density-calendar-provider.tsx +96 -0
- package/src/components/density-calendar/context/use-ks-density-calendar-context.tsx +15 -0
- package/src/components/density-calendar/day-view/day-navigation.tsx +199 -0
- package/src/components/density-calendar/day-view/ks-density-calendar-day-view.tsx +245 -0
- package/src/components/density-calendar/ks-density-calendar-root.tsx +215 -0
- package/src/components/density-calendar/ks-density-calendar.tsx +74 -0
- package/src/components/density-calendar/ks-error-popup/ks-error-tooltip.tsx +71 -0
- package/src/components/density-calendar/ks-slider/ks-slider.tsx +185 -0
- package/src/components/density-calendar/ks-toggler/ks-toggler.tsx +69 -0
- package/src/components/density-calendar/month-view/days-of-week.tsx +47 -0
- package/src/components/density-calendar/month-view/ks-density-calendar-month-view.tsx +289 -0
- package/src/components/density-calendar/month-view/top-navigation.tsx +137 -0
- package/src/components/density-calendar/utility-functions.ts +67 -0
- package/src/components/density-calendar/week-view/ks-density-calendar-week-view.tsx +189 -0
- package/src/components/density-calendar/week-view/top.tsx +54 -0
- package/src/index.tsx +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LucasFarmer
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# densitycalendarnative
|
|
2
|
+
|
|
3
|
+
heat calendar with percentages and double range slider for month, week, and day view
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install densitycalendarnative
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { multiply } from 'densitycalendarnative';
|
|
18
|
+
|
|
19
|
+
// ...
|
|
20
|
+
|
|
21
|
+
const result = await multiply(3, 7);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
28
|
+
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
|
|
29
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","KSDensityCalendarContext","undefined"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/density-calendar/context/ks-density-calendar-context.tsx"],"mappings":";;AAAA,SAAyBA,aAAa,QAAQ,OAAO;AAoBrD,OAAO,MAAMC,wBAAwB,gBAAGD,aAAa,CAEnDE,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useReducer, useRef, useEffect } from 'react';
|
|
4
|
+
import { useWindowDimensions } from 'react-native';
|
|
5
|
+
import { KSDensityCalendarContext } from "./ks-density-calendar-context.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const initialState = {
|
|
8
|
+
toggleKSSlider: true,
|
|
9
|
+
minVal: 0,
|
|
10
|
+
maxVal: 100,
|
|
11
|
+
lastFocusedInput: null,
|
|
12
|
+
isSmallScreen: false
|
|
13
|
+
};
|
|
14
|
+
const calendarReducer = (state, action) => {
|
|
15
|
+
switch (action.type) {
|
|
16
|
+
case 'SET_VALUE':
|
|
17
|
+
return {
|
|
18
|
+
...state,
|
|
19
|
+
[action.field]: action.value
|
|
20
|
+
};
|
|
21
|
+
default:
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const KSDensityCalendarProvider = ({
|
|
26
|
+
children
|
|
27
|
+
}) => {
|
|
28
|
+
const [state, dispatch] = useReducer(calendarReducer, initialState);
|
|
29
|
+
const {
|
|
30
|
+
width
|
|
31
|
+
} = useWindowDimensions();
|
|
32
|
+
const minValRef = useRef(null);
|
|
33
|
+
const maxValRef = useRef(null);
|
|
34
|
+
const rangeRef = useRef(null);
|
|
35
|
+
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: 'SET_VALUE',
|
|
39
|
+
field: 'isSmallScreen',
|
|
40
|
+
value: width < 760
|
|
41
|
+
});
|
|
42
|
+
}, [width]);
|
|
43
|
+
const getPercent = useCallback(value => Math.round((value - 0) / (100 - 0) * 100), []);
|
|
44
|
+
const handleToggleSlider = useCallback(() => {
|
|
45
|
+
dispatch({
|
|
46
|
+
type: 'SET_VALUE',
|
|
47
|
+
field: 'toggleKSSlider',
|
|
48
|
+
value: !state.toggleKSSlider
|
|
49
|
+
});
|
|
50
|
+
}, [state.toggleKSSlider]);
|
|
51
|
+
const contextValue = {
|
|
52
|
+
state,
|
|
53
|
+
dispatch,
|
|
54
|
+
minValRef,
|
|
55
|
+
maxValRef,
|
|
56
|
+
rangeRef,
|
|
57
|
+
min: 0,
|
|
58
|
+
max: 100,
|
|
59
|
+
daysOfWeek,
|
|
60
|
+
handleToggleSlider,
|
|
61
|
+
getPercent
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/_jsx(KSDensityCalendarContext.Provider, {
|
|
64
|
+
value: contextValue,
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=ks-density-calendar-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useReducer","useRef","useEffect","useWindowDimensions","KSDensityCalendarContext","jsx","_jsx","initialState","toggleKSSlider","minVal","maxVal","lastFocusedInput","isSmallScreen","calendarReducer","state","action","type","field","value","KSDensityCalendarProvider","children","dispatch","width","minValRef","maxValRef","rangeRef","daysOfWeek","getPercent","Math","round","handleToggleSlider","contextValue","min","max","Provider"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/density-calendar/context/ks-density-calendar-provider.tsx"],"mappings":";;AAAA,SACEA,WAAW,EACXC,UAAU,EACVC,MAAM,EACNC,SAAS,QAEJ,OAAO;AACd,SAA0BC,mBAAmB,QAAQ,cAAc;AACnE,SAASC,wBAAwB,QAAQ,kCAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkBzE,MAAMC,YAA6B,GAAG;EACpCC,cAAc,EAAE,IAAI;EACpBC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,GAAG;EACXC,gBAAgB,EAAE,IAAI;EACtBC,aAAa,EAAE;AACjB,CAAC;AAED,MAAMC,eAAe,GAAGA,CACtBC,KAAsB,EACtBC,MAAwB,KACJ;EACpB,QAAQA,MAAM,CAACC,IAAI;IACjB,KAAK,WAAW;MACd,OAAO;QAAE,GAAGF,KAAK;QAAE,CAACC,MAAM,CAACE,KAAK,GAAGF,MAAM,CAACG;MAAM,CAAC;IACnD;MACE,OAAOJ,KAAK;EAChB;AACF,CAAC;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RP,UAAU;IACVI,kBAAkB;IAClBH;EACF,CAAC;EAED,oBACErB,IAAA,CAACF,wBAAwB,CAAC8B,QAAQ;IAAChB,KAAK,EAAEa,YAAa;IAAAX,QAAA,EACpDA;EAAQ,CACwB,CAAC;AAExC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { use } from 'react';
|
|
4
|
+
import { KSDensityCalendarContext } from "./ks-density-calendar-context.js";
|
|
5
|
+
export const useKSDensityCalendar = () => {
|
|
6
|
+
const context = use(KSDensityCalendarContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error('useKSDensityCalendar must be used within a KSDensityCalendarProvider. ' + 'Check if you wrapped your component tree with <KSDensityCalendarProvider />.');
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=use-ks-density-calendar-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["use","KSDensityCalendarContext","useKSDensityCalendar","context","Error"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/density-calendar/context/use-ks-density-calendar-context.tsx"],"mappings":";;AAAA,SAASA,GAAG,QAAQ,OAAO;AAC3B,SAASC,wBAAwB,QAAQ,kCAA+B;AAExE,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,OAAO,GAAGH,GAAG,CAACC,wBAAwB,CAAC;EAE7C,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CACb,wEAAwE,GACtE,8EACJ,CAAC;EACH;EAEA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, View, Text, Pressable } from 'react-native';
|
|
4
|
+
import { format } from 'date-fns';
|
|
5
|
+
import { MaterialIcons, MaterialCommunityIcons, Ionicons } from '@expo/vector-icons';
|
|
6
|
+
import { useKSDensityCalendar } from "../context/use-ks-density-calendar-context.js";
|
|
7
|
+
import KSToggler from "../ks-toggler/ks-toggler.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const DayNavigation = ({
|
|
10
|
+
handlePreviousDay,
|
|
11
|
+
dateSelected,
|
|
12
|
+
handleNextDay,
|
|
13
|
+
handleToday,
|
|
14
|
+
previousCalendarDisplay,
|
|
15
|
+
toMonthHandler,
|
|
16
|
+
toWeekHandler,
|
|
17
|
+
svgIconColor,
|
|
18
|
+
svgIconSize,
|
|
19
|
+
svgIconUnactiveColor
|
|
20
|
+
}) => {
|
|
21
|
+
const {
|
|
22
|
+
state
|
|
23
|
+
} = useKSDensityCalendar();
|
|
24
|
+
const {
|
|
25
|
+
isSmallScreen
|
|
26
|
+
} = state;
|
|
27
|
+
const backHandler = previousCalendarDisplay === 'Month' ? toMonthHandler : toWeekHandler;
|
|
28
|
+
|
|
29
|
+
// Helper for consistent Pressable styling
|
|
30
|
+
const pressableStyle = ({
|
|
31
|
+
pressed
|
|
32
|
+
}) => [styles.iconPressable, {
|
|
33
|
+
opacity: pressed ? 0.5 : 1
|
|
34
|
+
}];
|
|
35
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
36
|
+
style: styles.container,
|
|
37
|
+
children: [!isSmallScreen && /*#__PURE__*/_jsx(View, {
|
|
38
|
+
style: styles.sideSection,
|
|
39
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
40
|
+
onPress: backHandler,
|
|
41
|
+
style: pressableStyle,
|
|
42
|
+
children: /*#__PURE__*/_jsx(Ionicons, {
|
|
43
|
+
name: "arrow-back",
|
|
44
|
+
size: svgIconSize,
|
|
45
|
+
color: svgIconColor
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
49
|
+
style: [styles.centerSection, isSmallScreen && styles.fullWidth],
|
|
50
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
51
|
+
onPress: handlePreviousDay,
|
|
52
|
+
style: pressableStyle,
|
|
53
|
+
children: /*#__PURE__*/_jsx(MaterialIcons, {
|
|
54
|
+
name: "chevron-left",
|
|
55
|
+
size: svgIconSize + 8,
|
|
56
|
+
color: svgIconColor
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
59
|
+
style: styles.dateText,
|
|
60
|
+
children: format(dateSelected, previousCalendarDisplay === 'Week' ? 'EEEE' : 'eeee MMMM do yyyy')
|
|
61
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
62
|
+
onPress: handleNextDay,
|
|
63
|
+
style: pressableStyle,
|
|
64
|
+
children: /*#__PURE__*/_jsx(MaterialIcons, {
|
|
65
|
+
name: "chevron-right",
|
|
66
|
+
size: svgIconSize + 8,
|
|
67
|
+
color: svgIconColor
|
|
68
|
+
})
|
|
69
|
+
})]
|
|
70
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
71
|
+
style: [styles.controlsSection, isSmallScreen && styles.fullWidthCenter],
|
|
72
|
+
children: [isSmallScreen && /*#__PURE__*/_jsx(View, {
|
|
73
|
+
style: styles.controlItem,
|
|
74
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
75
|
+
onPress: backHandler,
|
|
76
|
+
style: pressableStyle,
|
|
77
|
+
children: /*#__PURE__*/_jsx(Ionicons, {
|
|
78
|
+
name: "arrow-back",
|
|
79
|
+
size: svgIconSize,
|
|
80
|
+
color: svgIconColor
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
84
|
+
style: styles.controlItem,
|
|
85
|
+
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
86
|
+
name: "minus",
|
|
87
|
+
size: svgIconSize,
|
|
88
|
+
color: svgIconUnactiveColor || svgIconColor
|
|
89
|
+
})
|
|
90
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
91
|
+
style: styles.togglerWrapper,
|
|
92
|
+
children: /*#__PURE__*/_jsx(KSToggler, {})
|
|
93
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
94
|
+
style: styles.controlItem,
|
|
95
|
+
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
96
|
+
name: "plus",
|
|
97
|
+
size: svgIconSize,
|
|
98
|
+
color: svgIconUnactiveColor || svgIconColor
|
|
99
|
+
})
|
|
100
|
+
}), previousCalendarDisplay === 'Month' && /*#__PURE__*/_jsx(View, {
|
|
101
|
+
style: styles.controlItem,
|
|
102
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
103
|
+
onPress: handleToday,
|
|
104
|
+
style: pressableStyle,
|
|
105
|
+
children: /*#__PURE__*/_jsx(MaterialCommunityIcons, {
|
|
106
|
+
name: "calendar-today",
|
|
107
|
+
size: svgIconSize,
|
|
108
|
+
color: svgIconColor
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
const styles = StyleSheet.create({
|
|
116
|
+
container: {
|
|
117
|
+
width: '100%',
|
|
118
|
+
flexDirection: 'row',
|
|
119
|
+
flexWrap: 'wrap',
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
paddingVertical: 10
|
|
122
|
+
},
|
|
123
|
+
sideSection: {
|
|
124
|
+
width: '25%',
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
justifyContent: 'flex-start',
|
|
127
|
+
paddingLeft: 8
|
|
128
|
+
},
|
|
129
|
+
centerSection: {
|
|
130
|
+
width: '50%',
|
|
131
|
+
flexDirection: 'row',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
alignItems: 'center'
|
|
134
|
+
},
|
|
135
|
+
fullWidth: {
|
|
136
|
+
width: '100%'
|
|
137
|
+
},
|
|
138
|
+
fullWidthCenter: {
|
|
139
|
+
width: '100%',
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
marginTop: 15
|
|
142
|
+
},
|
|
143
|
+
dateText: {
|
|
144
|
+
fontSize: 18,
|
|
145
|
+
fontWeight: '600',
|
|
146
|
+
textAlign: 'center',
|
|
147
|
+
paddingHorizontal: 4,
|
|
148
|
+
flexShrink: 1
|
|
149
|
+
},
|
|
150
|
+
iconPressable: {
|
|
151
|
+
padding: 8,
|
|
152
|
+
borderRadius: 20,
|
|
153
|
+
// Optional: gives a nice hit area
|
|
154
|
+
justifyContent: 'center',
|
|
155
|
+
alignItems: 'center'
|
|
156
|
+
},
|
|
157
|
+
controlsSection: {
|
|
158
|
+
width: '25%',
|
|
159
|
+
flexDirection: 'row',
|
|
160
|
+
justifyContent: 'flex-end',
|
|
161
|
+
alignItems: 'center',
|
|
162
|
+
paddingRight: 8
|
|
163
|
+
},
|
|
164
|
+
controlItem: {
|
|
165
|
+
paddingHorizontal: 4
|
|
166
|
+
},
|
|
167
|
+
togglerWrapper: {
|
|
168
|
+
marginHorizontal: 4
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
export default DayNavigation;
|
|
172
|
+
//# sourceMappingURL=day-navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","View","Text","Pressable","format","MaterialIcons","MaterialCommunityIcons","Ionicons","useKSDensityCalendar","KSToggler","jsx","_jsx","jsxs","_jsxs","DayNavigation","handlePreviousDay","dateSelected","handleNextDay","handleToday","previousCalendarDisplay","toMonthHandler","toWeekHandler","svgIconColor","svgIconSize","svgIconUnactiveColor","state","isSmallScreen","backHandler","pressableStyle","pressed","styles","iconPressable","opacity","style","container","children","sideSection","onPress","name","size","color","centerSection","fullWidth","dateText","controlsSection","fullWidthCenter","controlItem","togglerWrapper","create","width","flexDirection","flexWrap","alignItems","paddingVertical","justifyContent","paddingLeft","marginTop","fontSize","fontWeight","textAlign","paddingHorizontal","flexShrink","padding","borderRadius","paddingRight","marginHorizontal"],"sourceRoot":"..\\..\\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;EACnB,CAAC;EACDjB,WAAW,EAAE;IACXa,KAAK,EAAE,KAAK;IACZC,aAAa,EAAE,KAAK;IACpBI,cAAc,EAAE,YAAY;IAC5BC,WAAW,EAAE;EACf,CAAC;EACDd,aAAa,EAAE;IACbQ,KAAK,EAAE,KAAK;IACZC,aAAa,EAAE,KAAK;IACpBI,cAAc,EAAE,QAAQ;IACxBF,UAAU,EAAE;EACd,CAAC;EACDV,SAAS,EAAE;IACTO,KAAK,EAAE;EACT,CAAC;EACDJ,eAAe,EAAE;IACfI,KAAK,EAAE,MAAM;IACbK,cAAc,EAAE,QAAQ;IACxBE,SAAS,EAAE;EACb,CAAC;EACDb,QAAQ,EAAE;IACRc,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE,QAAQ;IACnBC,iBAAiB,EAAE,CAAC;IACpBC,UAAU,EAAE;EACd,CAAC;EACD9B,aAAa,EAAE;IACb+B,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE,EAAE;IAAE;IAClBT,cAAc,EAAE,QAAQ;IACxBF,UAAU,EAAE;EACd,CAAC;EACDR,eAAe,EAAE;IACfK,KAAK,EAAE,KAAK;IACZC,aAAa,EAAE,KAAK;IACpBI,cAAc,EAAE,UAAU;IAC1BF,UAAU,EAAE,QAAQ;IACpBY,YAAY,EAAE;EAChB,CAAC;EACDlB,WAAW,EAAE;IACXc,iBAAiB,EAAE;EACrB,CAAC;EACDb,cAAc,EAAE;IACdkB,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,eAAenD,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { StyleSheet, View, Text, ScrollView } from 'react-native';
|
|
5
|
+
import { startOfDay, endOfDay, eachHourOfInterval } from 'date-fns';
|
|
6
|
+
import { useKSDensityCalendar } from "../context/use-ks-density-calendar-context.js";
|
|
7
|
+
import { getColorForPercentage } from "../utility-functions.js";
|
|
8
|
+
import DayNavigation from "./day-navigation.js";
|
|
9
|
+
import KSSlider from "../ks-slider/ks-slider.js";
|
|
10
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export const getHoursOfDayWithinIntersection = (dateSelected, start, end) => {
|
|
12
|
+
const startingHour = startOfDay(dateSelected);
|
|
13
|
+
const endingHour = endOfDay(dateSelected);
|
|
14
|
+
const effectiveStart = start < startingHour ? startingHour : start;
|
|
15
|
+
const effectiveEnd = end > endingHour ? endingHour : end;
|
|
16
|
+
const hoursWithinInterval = eachHourOfInterval({
|
|
17
|
+
start: effectiveStart,
|
|
18
|
+
end: effectiveEnd
|
|
19
|
+
});
|
|
20
|
+
return hoursWithinInterval.map(ht => ht.getHours());
|
|
21
|
+
};
|
|
22
|
+
export const calcHourPercents = (dateSelected, data) => {
|
|
23
|
+
const ret = Array(24).fill(0);
|
|
24
|
+
const usedNames = {};
|
|
25
|
+
const startDay = startOfDay(dateSelected);
|
|
26
|
+
const endDay = endOfDay(dateSelected);
|
|
27
|
+
for (const item of data) {
|
|
28
|
+
// Basic null check for the item itself
|
|
29
|
+
if (!item || item.start > endDay || item.end < startDay) continue;
|
|
30
|
+
const hours = getHoursOfDayWithinIntersection(dateSelected, item.start, item.end);
|
|
31
|
+
hours.forEach(hour => {
|
|
32
|
+
if (!usedNames[item.name]) {
|
|
33
|
+
usedNames[item.name] = Array(24).fill(0);
|
|
34
|
+
}
|
|
35
|
+
const nameData = usedNames[item.name];
|
|
36
|
+
if (nameData && nameData[hour] === 0) {
|
|
37
|
+
nameData[hour] = 1;
|
|
38
|
+
ret[hour] += 1;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const totalNames = Object.keys(usedNames).length;
|
|
43
|
+
if (totalNames > 0) {
|
|
44
|
+
for (let j = 0; j < ret.length; j++) {
|
|
45
|
+
ret[j] = Math.round(ret[j] / totalNames * 100);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return ret;
|
|
49
|
+
};
|
|
50
|
+
const KSDensityCalendarDayView = ({
|
|
51
|
+
dateSelected,
|
|
52
|
+
calendarDisplay,
|
|
53
|
+
multScheduleData,
|
|
54
|
+
toWeekHandler,
|
|
55
|
+
toMonthHandler,
|
|
56
|
+
previousCalendarDisplay,
|
|
57
|
+
handleToday,
|
|
58
|
+
handleNextDay,
|
|
59
|
+
handlePreviousDay,
|
|
60
|
+
themeKeys,
|
|
61
|
+
svgIconColor,
|
|
62
|
+
svgIconSize,
|
|
63
|
+
svgIconUnactiveColor
|
|
64
|
+
}) => {
|
|
65
|
+
const {
|
|
66
|
+
state
|
|
67
|
+
} = useKSDensityCalendar();
|
|
68
|
+
const {
|
|
69
|
+
toggleKSSlider,
|
|
70
|
+
minVal,
|
|
71
|
+
maxVal
|
|
72
|
+
} = state;
|
|
73
|
+
const percentsForHourOfDay = useMemo(() => calcHourPercents(dateSelected, multScheduleData), [dateSelected, multScheduleData]);
|
|
74
|
+
const renderHourRow = (percentValue, index) => {
|
|
75
|
+
const isVisible = percentValue >= minVal && percentValue <= maxVal;
|
|
76
|
+
const barWidth = isVisible ? `${percentValue}%` : '0%';
|
|
77
|
+
const color = getColorForPercentage(percentValue);
|
|
78
|
+
const hourLabel = index === 0 ? '12am' : index === 12 ? '12pm' : index < 12 ? `${index}am` : `${index - 12}pm`;
|
|
79
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
80
|
+
style: [styles.row, {
|
|
81
|
+
borderColor: themeKeys.secondaryColor
|
|
82
|
+
}, index === 23 && styles.lastRow],
|
|
83
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
84
|
+
style: styles.labelContainer,
|
|
85
|
+
children: /*#__PURE__*/_jsxs(Text, {
|
|
86
|
+
style: styles.labelText,
|
|
87
|
+
children: [hourLabel, ":"]
|
|
88
|
+
})
|
|
89
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
90
|
+
style: styles.barTrack,
|
|
91
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
92
|
+
style: [styles.barFill, {
|
|
93
|
+
// Force cast the string to DimensionValue
|
|
94
|
+
width: isVisible ? `${percentValue}%` : '0%',
|
|
95
|
+
backgroundColor: isVisible ? color : 'transparent'
|
|
96
|
+
}]
|
|
97
|
+
})
|
|
98
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
99
|
+
style: styles.percentText,
|
|
100
|
+
children: isVisible && percentValue > 0 ? `${percentValue}%` : ''
|
|
101
|
+
})]
|
|
102
|
+
}, index);
|
|
103
|
+
};
|
|
104
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
105
|
+
style: [styles.container, !toggleKSSlider && styles.paddingBottom],
|
|
106
|
+
children: [/*#__PURE__*/_jsx(DayNavigation, {
|
|
107
|
+
dateSelected: dateSelected,
|
|
108
|
+
handleNextDay: handleNextDay,
|
|
109
|
+
handlePreviousDay: handlePreviousDay,
|
|
110
|
+
previousCalendarDisplay: previousCalendarDisplay,
|
|
111
|
+
toWeekHandler: toWeekHandler,
|
|
112
|
+
toMonthHandler: toMonthHandler,
|
|
113
|
+
handleToday: handleToday,
|
|
114
|
+
themeKeys: themeKeys,
|
|
115
|
+
svgIconColor: svgIconColor,
|
|
116
|
+
svgIconSize: svgIconSize,
|
|
117
|
+
svgIconUnactiveColor: svgIconUnactiveColor
|
|
118
|
+
}), /*#__PURE__*/_jsx(ScrollView, {
|
|
119
|
+
style: styles.scrollArea,
|
|
120
|
+
contentContainerStyle: styles.scrollContent,
|
|
121
|
+
persistentScrollbar: true,
|
|
122
|
+
indicatorStyle: "default",
|
|
123
|
+
children: percentsForHourOfDay.map(renderHourRow)
|
|
124
|
+
}), toggleKSSlider && /*#__PURE__*/_jsx(KSSlider, {
|
|
125
|
+
calendarDisplay: calendarDisplay,
|
|
126
|
+
themeKeys: themeKeys
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const styles = StyleSheet.create({
|
|
131
|
+
container: {
|
|
132
|
+
flex: 1,
|
|
133
|
+
width: '100%',
|
|
134
|
+
paddingHorizontal: 8
|
|
135
|
+
},
|
|
136
|
+
paddingBottom: {
|
|
137
|
+
paddingBottom: 8
|
|
138
|
+
},
|
|
139
|
+
scrollArea: {
|
|
140
|
+
flex: 1,
|
|
141
|
+
width: '100%'
|
|
142
|
+
},
|
|
143
|
+
scrollContent: {
|
|
144
|
+
paddingVertical: 4
|
|
145
|
+
},
|
|
146
|
+
row: {
|
|
147
|
+
flexDirection: 'row',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
paddingLeft: 4,
|
|
150
|
+
height: 40,
|
|
151
|
+
borderTopWidth: 2,
|
|
152
|
+
borderLeftWidth: 2,
|
|
153
|
+
borderRightWidth: 2
|
|
154
|
+
},
|
|
155
|
+
lastRow: {
|
|
156
|
+
borderBottomWidth: 2
|
|
157
|
+
},
|
|
158
|
+
labelContainer: {
|
|
159
|
+
width: 60
|
|
160
|
+
},
|
|
161
|
+
labelText: {
|
|
162
|
+
fontSize: 14,
|
|
163
|
+
fontWeight: '500'
|
|
164
|
+
},
|
|
165
|
+
barTrack: {
|
|
166
|
+
flex: 1,
|
|
167
|
+
height: '60%',
|
|
168
|
+
marginHorizontal: 8,
|
|
169
|
+
justifyContent: 'center'
|
|
170
|
+
},
|
|
171
|
+
barFill: {
|
|
172
|
+
height: '100%',
|
|
173
|
+
borderRadius: 2
|
|
174
|
+
},
|
|
175
|
+
percentText: {
|
|
176
|
+
width: 45,
|
|
177
|
+
fontSize: 12,
|
|
178
|
+
textAlign: 'right',
|
|
179
|
+
paddingRight: 4
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
export default KSDensityCalendarDayView;
|
|
183
|
+
//# sourceMappingURL=ks-density-calendar-day-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","StyleSheet","View","Text","ScrollView","startOfDay","endOfDay","eachHourOfInterval","useKSDensityCalendar","getColorForPercentage","DayNavigation","KSSlider","jsxs","_jsxs","jsx","_jsx","getHoursOfDayWithinIntersection","dateSelected","start","end","startingHour","endingHour","effectiveStart","effectiveEnd","hoursWithinInterval","map","ht","getHours","calcHourPercents","data","ret","Array","fill","usedNames","startDay","endDay","item","hours","forEach","hour","name","nameData","totalNames","Object","keys","length","j","Math","round","KSDensityCalendarDayView","calendarDisplay","multScheduleData","toWeekHandler","toMonthHandler","previousCalendarDisplay","handleToday","handleNextDay","handlePreviousDay","themeKeys","svgIconColor","svgIconSize","svgIconUnactiveColor","state","toggleKSSlider","minVal","maxVal","percentsForHourOfDay","renderHourRow","percentValue","index","isVisible","barWidth","color","hourLabel","style","styles","row","borderColor","secondaryColor","lastRow","children","labelContainer","labelText","barTrack","barFill","width","backgroundColor","percentText","container","paddingBottom","scrollArea","contentContainerStyle","scrollContent","persistentScrollbar","indicatorStyle","create","flex","paddingHorizontal","paddingVertical","flexDirection","alignItems","paddingLeft","height","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","fontSize","fontWeight","marginHorizontal","justifyContent","borderRadius","textAlign","paddingRight"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/density-calendar/day-view/ks-density-calendar-day-view.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,EAAEC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAwB,cAAc;AACjF,SAASC,UAAU,EAAEC,QAAQ,EAAEC,kBAAkB,QAAQ,UAAU;AACnE,SAASC,oBAAoB,QAAQ,+CAA4C;AACjF,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,OAAOC,aAAa,MAAM,qBAAkB;AAC5C,OAAOC,QAAQ,MAAM,2BAAwB;AAAC,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA;AAsB9C,OAAO,MAAMC,+BAA+B,GAAGA,CAC7CC,YAAkB,EAClBC,KAAW,EACXC,GAAS,KACN;EACH,MAA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