@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/lib/typescript/src/components/density-calendar/context/ks-density-calendar-context.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type TextInput, type View } from 'react-native';
|
|
3
|
+
import { type KSCalendarState, type KSCalendarAction } from './ks-density-calendar-provider';
|
|
4
|
+
export interface KSDensityCalendarContextProps {
|
|
5
|
+
state: KSCalendarState;
|
|
6
|
+
dispatch: React.Dispatch<KSCalendarAction>;
|
|
7
|
+
minValRef: RefObject<TextInput | null>;
|
|
8
|
+
maxValRef: RefObject<TextInput | null>;
|
|
9
|
+
rangeRef: RefObject<View | null>;
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
daysOfWeek: string[];
|
|
13
|
+
handleToggleSlider: () => void;
|
|
14
|
+
getPercent: (value: number) => number;
|
|
15
|
+
}
|
|
16
|
+
export declare const KSDensityCalendarContext: import("react").Context<KSDensityCalendarContextProps | undefined>;
|
|
17
|
+
//# sourceMappingURL=ks-density-calendar-context.d.ts.map
|
package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-context.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar-context.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/context/ks-density-calendar-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC3C,SAAS,EAAE,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACvC,SAAS,EAAE,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACvC,QAAQ,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACvC;AAED,eAAO,MAAM,wBAAwB,oEAEzB,CAAC"}
|
package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-provider.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type KSCalendarState = {
|
|
3
|
+
toggleKSSlider: boolean;
|
|
4
|
+
minVal: number;
|
|
5
|
+
maxVal: number;
|
|
6
|
+
lastFocusedInput: 'min' | 'max' | null;
|
|
7
|
+
isSmallScreen: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type KSCalendarAction = {
|
|
10
|
+
[K in keyof KSCalendarState]: {
|
|
11
|
+
type: 'SET_VALUE';
|
|
12
|
+
field: K;
|
|
13
|
+
value: KSCalendarState[K];
|
|
14
|
+
};
|
|
15
|
+
}[keyof KSCalendarState];
|
|
16
|
+
export declare const KSDensityCalendarProvider: ({ children, }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=ks-density-calendar-provider.d.ts.map
|
package/lib/typescript/src/components/density-calendar/context/ks-density-calendar-provider.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/context/ks-density-calendar-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;IACvC,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;KAC5B,CAAC,IAAI,MAAM,eAAe,GAAG;QAC5B,IAAI,EAAE,WAAW,CAAC;QAClB,KAAK,EAAE,CAAC,CAAC;QACT,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;KAC3B;CACF,CAAC,MAAM,eAAe,CAAC,CAAC;AAsBzB,eAAO,MAAM,yBAAyB,GAAI,eAEvC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,4CA6CA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ks-density-calendar-context.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/context/use-ks-density-calendar-context.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,6EAWhC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
type DayNavigationProps = {
|
|
3
|
+
handlePreviousDay: () => void;
|
|
4
|
+
dateSelected: Date;
|
|
5
|
+
handleNextDay: () => void;
|
|
6
|
+
handleToday: () => void;
|
|
7
|
+
previousCalendarDisplay: string;
|
|
8
|
+
toWeekHandler: () => void;
|
|
9
|
+
toMonthHandler: () => void;
|
|
10
|
+
themeKeys: ThemeKeyProps['themeKeys'];
|
|
11
|
+
svgIconColor: string;
|
|
12
|
+
svgIconSize: number;
|
|
13
|
+
svgIconUnactiveColor?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const DayNavigation: ({ handlePreviousDay, dateSelected, handleNextDay, handleToday, previousCalendarDisplay, toMonthHandler, toWeekHandler, svgIconColor, svgIconSize, svgIconUnactiveColor, }: DayNavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default DayNavigation;
|
|
17
|
+
//# sourceMappingURL=day-navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"day-navigation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/day-view/day-navigation.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,KAAK,kBAAkB,GAAG;IACxB,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,YAAY,EAAE,IAAI,CAAC;IACnB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,2KAWpB,kBAAkB,4CAwGpB,CAAC;AA0DF,eAAe,aAAa,CAAC"}
|
package/lib/typescript/src/components/density-calendar/day-view/ks-density-calendar-day-view.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type KSDensityCalendarEventType, type ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
type KSDensityCalendarDayProps = {
|
|
3
|
+
dateSelected: Date;
|
|
4
|
+
multScheduleData: KSDensityCalendarEventType[];
|
|
5
|
+
toWeekHandler: () => void;
|
|
6
|
+
toMonthHandler: () => void;
|
|
7
|
+
previousCalendarDisplay: string;
|
|
8
|
+
handlePreviousDay: () => void;
|
|
9
|
+
handleNextDay: () => void;
|
|
10
|
+
handleToday: () => void;
|
|
11
|
+
calendarDisplay: string;
|
|
12
|
+
themeKeys: ThemeKeyProps['themeKeys'];
|
|
13
|
+
svgIconColor: string;
|
|
14
|
+
svgIconSize: number;
|
|
15
|
+
svgIconUnactiveColor?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const getHoursOfDayWithinIntersection: (dateSelected: Date, start: Date, end: Date) => number[];
|
|
18
|
+
export declare const calcHourPercents: (dateSelected: Date, data: KSDensityCalendarEventType[]) => any[];
|
|
19
|
+
declare const KSDensityCalendarDayView: ({ dateSelected, calendarDisplay, multScheduleData, toWeekHandler, toMonthHandler, previousCalendarDisplay, handleToday, handleNextDay, handlePreviousDay, themeKeys, svgIconColor, svgIconSize, svgIconUnactiveColor, }: KSDensityCalendarDayProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default KSDensityCalendarDayView;
|
|
21
|
+
//# sourceMappingURL=ks-density-calendar-day-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar-day-view.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/day-view/ks-density-calendar-day-view.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAEhC,KAAK,yBAAyB,GAAG;IAC/B,YAAY,EAAE,IAAI,CAAC;IACnB,gBAAgB,EAAE,0BAA0B,EAAE,CAAC;IAC/C,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,cAAc,IAAI,EAClB,OAAO,IAAI,EACX,KAAK,IAAI,aAYV,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,cAAc,IAAI,EAClB,MAAM,0BAA0B,EAAE,UAsCnC,CAAC;AAEF,QAAA,MAAM,wBAAwB,GAAI,yNAc/B,yBAAyB,4CAwF3B,CAAC;AAuDF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ThemeKeyProps } from './ks-density-calendar';
|
|
2
|
+
export type KSDensityCalendarProps = {
|
|
3
|
+
displayDate: Date;
|
|
4
|
+
initialDisplayMode: 'Month' | 'Week' | 'Day';
|
|
5
|
+
multScheduleData: any[];
|
|
6
|
+
};
|
|
7
|
+
export type SVGProps = {
|
|
8
|
+
svgIconColor: string;
|
|
9
|
+
svgIconSize: number;
|
|
10
|
+
svgIconUnactiveColor?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const KSDensityCalendarRoot: ({ displayDate, initialDisplayMode, multScheduleData, themeKeys, }: KSDensityCalendarProps & ThemeKeyProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default KSDensityCalendarRoot;
|
|
14
|
+
//# sourceMappingURL=ks-density-calendar-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar-root.d.ts","sourceRoot":"","sources":["../../../../../src/components/density-calendar/ks-density-calendar-root.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,IAAI,CAAC;IAClB,kBAAkB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;IAC7C,gBAAgB,EAAE,GAAG,EAAE,CAAC;CACzB,CAAC;AAeF,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAoBF,QAAA,MAAM,qBAAqB,GAAI,mEAK5B,sBAAsB,GAAG,aAAa,4CAqJxC,CAAC;AAQF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type KSDensityCalendarEventType = {
|
|
2
|
+
name: string;
|
|
3
|
+
start: Date;
|
|
4
|
+
end: Date;
|
|
5
|
+
};
|
|
6
|
+
export type KSOptionalProps = {
|
|
7
|
+
handleErrorPopup?: () => void;
|
|
8
|
+
handleCloseErrorPopup?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export type ThemeKeyProps = {
|
|
11
|
+
themeKeys: {
|
|
12
|
+
togglerHandle?: string;
|
|
13
|
+
primaryColor: string;
|
|
14
|
+
primaryColorPnt6: string;
|
|
15
|
+
secondaryColor: string;
|
|
16
|
+
secondaryColorPnt1: string;
|
|
17
|
+
secondaryColorPnt15: string;
|
|
18
|
+
secondaryColorPnt2: string;
|
|
19
|
+
secondaryColorPnt3: string;
|
|
20
|
+
secondaryColorPnt4: string;
|
|
21
|
+
secondaryColorPnt5: string;
|
|
22
|
+
secondaryColorPnt6: string;
|
|
23
|
+
secondaryColorPnt8: string;
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
glowFilter: string;
|
|
26
|
+
checkboxBGC: string;
|
|
27
|
+
checkboxAfterColor: string;
|
|
28
|
+
backgroundImage: string;
|
|
29
|
+
trackBoxShadow: string;
|
|
30
|
+
carouselColor1: string;
|
|
31
|
+
carouselGradient1: string;
|
|
32
|
+
carouselGradient2: string;
|
|
33
|
+
buttonGradient: string;
|
|
34
|
+
listBGC: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type KSDensityCalendarProps = {
|
|
38
|
+
displayDate: Date;
|
|
39
|
+
initialDisplayMode: string;
|
|
40
|
+
multScheduleData: KSDensityCalendarEventType[];
|
|
41
|
+
} & KSOptionalProps & ThemeKeyProps;
|
|
42
|
+
export declare const KSDensityCalendar: ({ displayDate, initialDisplayMode, multScheduleData, themeKeys, }: KSDensityCalendarProps) => boolean | import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=ks-density-calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar.d.ts","sourceRoot":"","sources":["../../../../../src/components/density-calendar/ks-density-calendar.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE;QACT,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,mBAAmB,EAAE,MAAM,CAAC;QAC5B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,IAAI,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,0BAA0B,EAAE,CAAC;CAChD,GAAG,eAAe,GACjB,aAAa,CAAC;AAEhB,eAAO,MAAM,iBAAiB,GAAI,mEAK/B,sBAAsB,sDAmBxB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
tooltip?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const KSErrorTooltip: ({ children, tooltip }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default KSErrorTooltip;
|
|
8
|
+
//# sourceMappingURL=ks-error-tooltip.d.ts.map
|
package/lib/typescript/src/components/density-calendar/ks-error-popup/ks-error-tooltip.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-error-tooltip.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/ks-error-popup/ks-error-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,cAAc,GAAI,uBAAuB,KAAK,4CAkCnD,CAAC;AA4BF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
type KSSliderProps = {
|
|
3
|
+
calendarDisplay: string;
|
|
4
|
+
themeKeys: ThemeKeyProps['themeKeys'];
|
|
5
|
+
};
|
|
6
|
+
declare const KSSlider: ({ themeKeys }: KSSliderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default KSSlider;
|
|
8
|
+
//# sourceMappingURL=ks-slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-slider.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/ks-slider/ks-slider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,KAAK,aAAa,GAAG;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACvC,CAAC;AAEF,QAAA,MAAM,QAAQ,GAAI,eAAe,aAAa,4CAyH7C,CAAC;AAqDF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-toggler.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/ks-toggler/ks-toggler.tsx"],"names":[],"mappings":"AAIA,QAAA,MAAM,SAAS,+CA0Cd,CAAC;AAsBF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"days-of-week.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/month-view/days-of-week.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,UAAU,+CAmBf,CAAC;AAwBF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type KSDensityCalendarEventType, type ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
import { type SVGProps } from '../ks-density-calendar-root';
|
|
3
|
+
type KSDensityCalendarMonthProps = {
|
|
4
|
+
displayDate: Date;
|
|
5
|
+
toDayHandler: (dt: Date) => void;
|
|
6
|
+
multScheduleData: KSDensityCalendarEventType[];
|
|
7
|
+
handlePrevious: () => void;
|
|
8
|
+
handleNext: () => void;
|
|
9
|
+
handleToday: () => void;
|
|
10
|
+
calendarDisplay: string;
|
|
11
|
+
themeKeys: ThemeKeyProps['themeKeys'];
|
|
12
|
+
} & SVGProps;
|
|
13
|
+
export declare const GetDaysOfMonthWithinIntersection: (displayDateStart: Date, displayDateEnd: Date, start: Date, end: Date) => number[];
|
|
14
|
+
export declare const CalcDayPercents: (dt: Date, data: KSDensityCalendarEventType[]) => any[];
|
|
15
|
+
declare const KSDensityCalendarMonthView: ({ displayDate, toDayHandler, multScheduleData, handlePrevious, handleNext, handleToday, calendarDisplay, themeKeys, svgIconColor, svgIconSize, svgIconUnactiveColor, }: KSDensityCalendarMonthProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default KSDensityCalendarMonthView;
|
|
17
|
+
//# sourceMappingURL=ks-density-calendar-month-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar-month-view.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/month-view/ks-density-calendar-month-view.tsx"],"names":[],"mappings":"AAwBA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,KAAK,2BAA2B,GAAG;IACjC,WAAW,EAAE,IAAI,CAAC;IAClB,YAAY,EAAE,CAAC,EAAE,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,gBAAgB,EAAE,0BAA0B,EAAE,CAAC;IAC/C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACvC,GAAG,QAAQ,CAAC;AAEb,eAAO,MAAM,gCAAgC,GAC3C,kBAAkB,IAAI,EACtB,gBAAgB,IAAI,EACpB,OAAO,IAAI,EACX,KAAK,IAAI,aAUV,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,IAAI,IAAI,EACR,MAAM,0BAA0B,EAAE,UAuCnC,CAAC;AAEF,QAAA,MAAM,0BAA0B,GAAI,wKAYjC,2BAA2B,4CAsH7B,CAAC;AAuDF,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
import { type SVGProps } from '../ks-density-calendar-root';
|
|
3
|
+
type TopNavigationProps = {
|
|
4
|
+
handlePrevious: () => void;
|
|
5
|
+
displayDate: Date;
|
|
6
|
+
handleNext: () => void;
|
|
7
|
+
handleToday: () => void;
|
|
8
|
+
} & ThemeKeyProps & SVGProps;
|
|
9
|
+
declare const TopNavigation: ({ handlePrevious, displayDate, handleNext, handleToday, svgIconColor, svgIconSize, svgIconUnactiveColor, }: TopNavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default TopNavigation;
|
|
11
|
+
//# sourceMappingURL=top-navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-navigation.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/month-view/top-navigation.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,KAAK,kBAAkB,GAAG;IACxB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,EAAE,IAAI,CAAC;IAClB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,GAAG,aAAa,GACf,QAAQ,CAAC;AAEX,QAAA,MAAM,aAAa,GAAI,4GAQpB,kBAAkB,4CAoEpB,CAAC;AA6CF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KSDensityCalendarEventType } from './ks-density-calendar';
|
|
2
|
+
export interface UsedNames {
|
|
3
|
+
[name: string]: number[];
|
|
4
|
+
}
|
|
5
|
+
export declare const firstDateOfWeek: Date;
|
|
6
|
+
export declare const getColorForPercentage: (percentage: number) => string;
|
|
7
|
+
export declare const getDaysOfWeekWithinIntersection: (start: Date, end: Date) => number[];
|
|
8
|
+
export declare const calcWeekPercents: (data: KSDensityCalendarEventType[]) => number[];
|
|
9
|
+
//# sourceMappingURL=utility-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-functions.d.ts","sourceRoot":"","sources":["../../../../../src/components/density-calendar/utility-functions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,MAAM,WAAW,SAAS;IACxB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,EAAE,IAA2B,CAAC;AAS1D,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,KAAG,MAI1D,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,OAAO,IAAI,EACX,KAAK,IAAI,KACR,MAAM,EAGR,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,MAAM,0BAA0B,EAAE,KACjC,MAAM,EAkCR,CAAC"}
|
package/lib/typescript/src/components/density-calendar/week-view/ks-density-calendar-week-view.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type KSDensityCalendarEventType, type ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
import { type KSOptionalProps } from '../ks-density-calendar';
|
|
3
|
+
import { type SVGProps } from '../ks-density-calendar-root';
|
|
4
|
+
type KSDensityCalendarWeekProps = {
|
|
5
|
+
displayDate: Date;
|
|
6
|
+
toDayHandler: (dt: Date) => void;
|
|
7
|
+
multScheduleData: KSDensityCalendarEventType[];
|
|
8
|
+
calendarDisplay: string;
|
|
9
|
+
} & KSOptionalProps & ThemeKeyProps & SVGProps;
|
|
10
|
+
declare const KSDensityCalendarWeekView: ({ toDayHandler, multScheduleData, calendarDisplay, themeKeys, svgIconColor, svgIconSize, svgIconUnactiveColor, }: KSDensityCalendarWeekProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default KSDensityCalendarWeekView;
|
|
12
|
+
//# sourceMappingURL=ks-density-calendar-week-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ks-density-calendar-week-view.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/week-view/ks-density-calendar-week-view.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAU5D,KAAK,0BAA0B,GAAG;IAChC,WAAW,EAAE,IAAI,CAAC;IAClB,YAAY,EAAE,CAAC,EAAE,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,gBAAgB,EAAE,0BAA0B,EAAE,CAAC;IAC/C,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,eAAe,GACjB,aAAa,GACb,QAAQ,CAAC;AAEX,QAAA,MAAM,yBAAyB,GAAI,kHAQhC,0BAA0B,4CAsF5B,CAAC;AA8DF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ThemeKeyProps } from '../ks-density-calendar';
|
|
2
|
+
import { type SVGProps } from '../ks-density-calendar-root';
|
|
3
|
+
type TopProps = ThemeKeyProps & SVGProps;
|
|
4
|
+
declare const Top: ({ svgIconColor, svgIconSize, svgIconUnactiveColor }: TopProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default Top;
|
|
6
|
+
//# sourceMappingURL=top.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top.d.ts","sourceRoot":"","sources":["../../../../../../src/components/density-calendar/week-view/top.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,KAAK,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEzC,QAAA,MAAM,GAAG,GAAI,qDAAqD,QAAQ,4CAwBzE,CAAC;AAqBF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lafarmer28/densitycalendarnative",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "heat calendar with percentages and double range slider for month, week, and day view",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace densitycalendarnative-example",
|
|
36
|
+
"clean": "del-cli lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"release": "release-it --only-version"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/LAFarmer28/ks-density-calendar-native.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "LucasFarmer <lukefarmer25@gmail.com> (https://github.com/LAFarmer28)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/LAFarmer28/ks-density-calendar-native/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/LAFarmer28/ks-density-calendar-native#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/",
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
64
|
+
"@eslint/compat": "^1.3.2",
|
|
65
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
66
|
+
"@eslint/js": "^9.35.0",
|
|
67
|
+
"@expo/vector-icons": "^15.0.3",
|
|
68
|
+
"@react-native/babel-preset": "0.83.0",
|
|
69
|
+
"@react-native/eslint-config": "0.83.0",
|
|
70
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
71
|
+
"@types/jest": "^29.5.14",
|
|
72
|
+
"@types/react": "^19.1.12",
|
|
73
|
+
"commitlint": "^19.8.1",
|
|
74
|
+
"date-fns": "^4.1.0",
|
|
75
|
+
"del-cli": "^6.0.0",
|
|
76
|
+
"eslint": "^9.35.0",
|
|
77
|
+
"eslint-config-prettier": "^10.1.8",
|
|
78
|
+
"eslint-plugin-ft-flow": "^3.0.11",
|
|
79
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
80
|
+
"eslint-plugin-react-native": "^5.0.0",
|
|
81
|
+
"jest": "^29.7.0",
|
|
82
|
+
"lefthook": "^2.0.3",
|
|
83
|
+
"prettier": "^3.8.0",
|
|
84
|
+
"react": "19.1.0",
|
|
85
|
+
"react-native": "0.81.5",
|
|
86
|
+
"react-native-builder-bob": "^0.40.17",
|
|
87
|
+
"release-it": "^19.0.4",
|
|
88
|
+
"typescript": "^5.9.2"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"date-fns": "^4.1.0",
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*"
|
|
94
|
+
},
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"example"
|
|
97
|
+
],
|
|
98
|
+
"packageManager": "yarn@4.11.0",
|
|
99
|
+
"react-native-builder-bob": {
|
|
100
|
+
"source": "src",
|
|
101
|
+
"output": "lib",
|
|
102
|
+
"targets": [
|
|
103
|
+
[
|
|
104
|
+
"module",
|
|
105
|
+
{
|
|
106
|
+
"esm": true
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
"typescript",
|
|
111
|
+
{
|
|
112
|
+
"project": "tsconfig.build.json"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"prettier": {
|
|
118
|
+
"quoteProps": "consistent",
|
|
119
|
+
"singleQuote": true,
|
|
120
|
+
"tabWidth": 2,
|
|
121
|
+
"trailingComma": "es5",
|
|
122
|
+
"useTabs": false
|
|
123
|
+
},
|
|
124
|
+
"jest": {
|
|
125
|
+
"preset": "react-native",
|
|
126
|
+
"modulePathIgnorePatterns": [
|
|
127
|
+
"<rootDir>/example/node_modules",
|
|
128
|
+
"<rootDir>/lib/"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"commitlint": {
|
|
132
|
+
"extends": [
|
|
133
|
+
"@commitlint/config-conventional"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"release-it": {
|
|
137
|
+
"git": {
|
|
138
|
+
"commitMessage": "chore: release ${version}",
|
|
139
|
+
"tagName": "v${version}"
|
|
140
|
+
},
|
|
141
|
+
"npm": {
|
|
142
|
+
"publish": true
|
|
143
|
+
},
|
|
144
|
+
"github": {
|
|
145
|
+
"release": true
|
|
146
|
+
},
|
|
147
|
+
"plugins": {
|
|
148
|
+
"@release-it/conventional-changelog": {
|
|
149
|
+
"preset": {
|
|
150
|
+
"name": "angular"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"create-react-native-library": {
|
|
156
|
+
"type": "library",
|
|
157
|
+
"languages": "js",
|
|
158
|
+
"tools": [
|
|
159
|
+
"eslint",
|
|
160
|
+
"jest",
|
|
161
|
+
"lefthook",
|
|
162
|
+
"release-it"
|
|
163
|
+
],
|
|
164
|
+
"version": "0.56.1"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type RefObject, createContext } from 'react';
|
|
2
|
+
import { type TextInput, type View } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
type KSCalendarState,
|
|
5
|
+
type KSCalendarAction,
|
|
6
|
+
} from './ks-density-calendar-provider';
|
|
7
|
+
|
|
8
|
+
export interface KSDensityCalendarContextProps {
|
|
9
|
+
state: KSCalendarState;
|
|
10
|
+
dispatch: React.Dispatch<KSCalendarAction>;
|
|
11
|
+
minValRef: RefObject<TextInput | null>;
|
|
12
|
+
maxValRef: RefObject<TextInput | null>;
|
|
13
|
+
rangeRef: RefObject<View | null>;
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
daysOfWeek: string[];
|
|
17
|
+
handleToggleSlider: () => void;
|
|
18
|
+
getPercent: (value: number) => number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const KSDensityCalendarContext = createContext<
|
|
22
|
+
KSDensityCalendarContextProps | undefined
|
|
23
|
+
>(undefined);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useReducer,
|
|
4
|
+
useRef,
|
|
5
|
+
useEffect,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { TextInput, View, useWindowDimensions } from 'react-native';
|
|
9
|
+
import { KSDensityCalendarContext } from './ks-density-calendar-context';
|
|
10
|
+
|
|
11
|
+
export type KSCalendarState = {
|
|
12
|
+
toggleKSSlider: boolean;
|
|
13
|
+
minVal: number;
|
|
14
|
+
maxVal: number;
|
|
15
|
+
lastFocusedInput: 'min' | 'max' | null;
|
|
16
|
+
isSmallScreen: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type KSCalendarAction = {
|
|
20
|
+
[K in keyof KSCalendarState]: {
|
|
21
|
+
type: 'SET_VALUE';
|
|
22
|
+
field: K;
|
|
23
|
+
value: KSCalendarState[K];
|
|
24
|
+
};
|
|
25
|
+
}[keyof KSCalendarState];
|
|
26
|
+
|
|
27
|
+
const initialState: KSCalendarState = {
|
|
28
|
+
toggleKSSlider: true,
|
|
29
|
+
minVal: 0,
|
|
30
|
+
maxVal: 100,
|
|
31
|
+
lastFocusedInput: null,
|
|
32
|
+
isSmallScreen: false,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const calendarReducer = (
|
|
36
|
+
state: KSCalendarState,
|
|
37
|
+
action: KSCalendarAction
|
|
38
|
+
): KSCalendarState => {
|
|
39
|
+
switch (action.type) {
|
|
40
|
+
case 'SET_VALUE':
|
|
41
|
+
return { ...state, [action.field]: action.value };
|
|
42
|
+
default:
|
|
43
|
+
return state;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const KSDensityCalendarProvider = ({
|
|
48
|
+
children,
|
|
49
|
+
}: {
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
}) => {
|
|
52
|
+
const [state, dispatch] = useReducer(calendarReducer, initialState);
|
|
53
|
+
const { width } = useWindowDimensions();
|
|
54
|
+
|
|
55
|
+
const minValRef = useRef<TextInput>(null);
|
|
56
|
+
const maxValRef = useRef<TextInput>(null);
|
|
57
|
+
const rangeRef = useRef<View>(null);
|
|
58
|
+
|
|
59
|
+
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
dispatch({ type: 'SET_VALUE', field: 'isSmallScreen', value: width < 760 });
|
|
63
|
+
}, [width]);
|
|
64
|
+
|
|
65
|
+
const getPercent = useCallback(
|
|
66
|
+
(value: number) => Math.round(((value - 0) / (100 - 0)) * 100),
|
|
67
|
+
[]
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const handleToggleSlider = useCallback(() => {
|
|
71
|
+
dispatch({
|
|
72
|
+
type: 'SET_VALUE',
|
|
73
|
+
field: 'toggleKSSlider',
|
|
74
|
+
value: !state.toggleKSSlider,
|
|
75
|
+
});
|
|
76
|
+
}, [state.toggleKSSlider]);
|
|
77
|
+
|
|
78
|
+
const contextValue = {
|
|
79
|
+
state,
|
|
80
|
+
dispatch,
|
|
81
|
+
minValRef,
|
|
82
|
+
maxValRef,
|
|
83
|
+
rangeRef,
|
|
84
|
+
min: 0,
|
|
85
|
+
max: 100,
|
|
86
|
+
daysOfWeek,
|
|
87
|
+
handleToggleSlider,
|
|
88
|
+
getPercent,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<KSDensityCalendarContext.Provider value={contextValue}>
|
|
93
|
+
{children}
|
|
94
|
+
</KSDensityCalendarContext.Provider>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { use } from 'react';
|
|
2
|
+
import { KSDensityCalendarContext } from './ks-density-calendar-context';
|
|
3
|
+
|
|
4
|
+
export const useKSDensityCalendar = () => {
|
|
5
|
+
const context = use(KSDensityCalendarContext);
|
|
6
|
+
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
'useKSDensityCalendar must be used within a KSDensityCalendarProvider. ' +
|
|
10
|
+
'Check if you wrapped your component tree with <KSDensityCalendarProvider />.'
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return context;
|
|
15
|
+
};
|