From 8d51e2b7c7adea8eda28467c6e6bf855aae782a3 Mon Sep 17 00:00:00 2001 From: feshchenko Date: Thu, 30 Nov 2023 12:43:05 +0200 Subject: [PATCH] perf|docs: change exports, fix broken link in the README --- README.md | 2 +- packages/datepicker/README.md | 2 +- packages/datepicker/package.json | 2 +- packages/datepicker/src/date-picker-provider.tsx | 6 ++---- .../datepicker/src/date-picker-state-provider.tsx | 6 ++---- .../src/utils/get-calendar-month-params.ts | 14 ++++++++------ 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 698467e..92cedfe 100644 --- a/README.md +++ b/README.md @@ -67,4 +67,4 @@ yarn add @rehookify/datepicker pnpm add @rehookify/datepicker ``` -Start with [tutorials](https://rehookify.com/tutorials) +Start with [tutorials](https://rehookify.com/datepicker/tutorials) diff --git a/packages/datepicker/README.md b/packages/datepicker/README.md index b10b326..511ad26 100644 --- a/packages/datepicker/README.md +++ b/packages/datepicker/README.md @@ -53,4 +53,4 @@ yarn add @rehookify/datepicker pnpm add @rehookify/datepicker ``` -Start with [tutorials](https://rehookify.com/tutorials) +Start with [tutorials](https://rehookify.com/datepicker/tutorials) diff --git a/packages/datepicker/package.json b/packages/datepicker/package.json index d42749e..e21e8e9 100644 --- a/packages/datepicker/package.json +++ b/packages/datepicker/package.json @@ -1,6 +1,6 @@ { "name": "@rehookify/datepicker", - "version": "6.4.0", + "version": "6.4.1", "description": "The ultimate tool to create a date, range and time picker in your React applications.", "main": "dist/index.cjs.js", "module": "dist/index.esm.mjs", diff --git a/packages/datepicker/src/date-picker-provider.tsx b/packages/datepicker/src/date-picker-provider.tsx index 73c8cb7..a3fd1ae 100644 --- a/packages/datepicker/src/date-picker-provider.tsx +++ b/packages/datepicker/src/date-picker-provider.tsx @@ -7,9 +7,9 @@ var DatePickerContext = createContext( {} as DatePickerContextValue, ); -var useDatePickerContext = () => useContext(DatePickerContext); +export var useDatePickerContext = () => useContext(DatePickerContext); -function DatePickerProvider({ +export function DatePickerProvider({ children, config, }: DatePickerProviderProps): ReactNode { @@ -19,5 +19,3 @@ function DatePickerProvider({ ); } - -export { DatePickerProvider, useDatePickerContext }; diff --git a/packages/datepicker/src/date-picker-state-provider.tsx b/packages/datepicker/src/date-picker-state-provider.tsx index e9d45cd..ec502ee 100644 --- a/packages/datepicker/src/date-picker-state-provider.tsx +++ b/packages/datepicker/src/date-picker-state-provider.tsx @@ -5,9 +5,9 @@ import { useDatePickerState } from './use-date-picker-state'; var DatePickerStateContext = createContext({} as DPState); -var useDatePickerStateContext = () => useContext(DatePickerStateContext); +export var useDatePickerStateContext = () => useContext(DatePickerStateContext); -function DatePickerStateProvider({ +export function DatePickerStateProvider({ children, config, }: DatePickerProviderProps): ReactNode { @@ -17,5 +17,3 @@ function DatePickerStateProvider({ ); } - -export { DatePickerStateProvider, useDatePickerStateContext }; diff --git a/packages/datepicker/src/utils/get-calendar-month-params.ts b/packages/datepicker/src/utils/get-calendar-month-params.ts index 12ba4ec..5243e7c 100644 --- a/packages/datepicker/src/utils/get-calendar-month-params.ts +++ b/packages/datepicker/src/utils/get-calendar-month-params.ts @@ -1,18 +1,20 @@ import type { DPCalendarConfig } from '../types'; import { daysInMonth, getDay, newDate } from './date'; -const getStartOffset = (d: Date, startDay: number): number => - (getDay(d) + 7 - startDay) % 7; +var NUMBER_OF_STATIC_CALENDAR_DAYS = 42; -export const getCalendarMonthParams = ( +function getStartOffset(d: Date, startDay: number): number { + return (getDay(d) + 7 - startDay) % 7; +} + +export function getCalendarMonthParams( month: number, year: number, { mode, startDay }: DPCalendarConfig, ): { start: number; length: number; -} => { - var NUMBER_OF_STATIC_CALENDAR_DAYS = 42; +} { const firstMonthDay = newDate(year, month, 1); const lastDay = daysInMonth(firstMonthDay); @@ -30,4 +32,4 @@ export const getCalendarMonthParams = ( start: startOffset, length, }; -}; +}