@nulogy/components 13.1.6 → 13.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.
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import type { ReactDatePicker } from "react-datepicker";
3
+ import { BaseDatePickerProps } from "./shared/types";
4
+ declare const DatePicker: React.ForwardRefExoticComponent<Omit<BaseDatePickerProps, "ref"> & React.RefAttributes<ReactDatePicker<never, undefined>>>;
5
+ export default DatePicker;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import type { ReactDatePicker } from "react-datepicker";
3
+ import { BaseDatePickerProps } from "./shared/types";
4
+ declare const MonthPicker: React.ForwardRefExoticComponent<Omit<BaseDatePickerProps, "ref"> & React.RefAttributes<ReactDatePicker<never, undefined>>>;
5
+ export default MonthPicker;
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { ReactDatePickerCustomHeaderProps } from "react-datepicker";
3
+ type Props = {
4
+ date: Date;
5
+ decreaseMonth: React.MouseEventHandler<HTMLButtonElement>;
6
+ increaseMonth: React.MouseEventHandler<HTMLButtonElement>;
7
+ prevMonthButtonDisabled: boolean;
8
+ nextMonthButtonDisabled: boolean;
9
+ locale?: string;
10
+ };
11
+ export declare function DatePickerHeader({ date, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, locale, }: Props): React.JSX.Element;
12
+ export declare function MonthDatePickerHeader({ date, increaseYear, decreaseYear, prevMonthButtonDisabled, nextMonthButtonDisabled, locale, }: ReactDatePickerCustomHeaderProps & {
13
+ locale?: string;
14
+ }): React.JSX.Element;
15
+ export {};
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { InputFieldProps } from "../Input/InputField";
3
- import { ComponentVariant } from "../NDSProvider/ComponentVariantContext";
2
+ import { InputFieldProps } from "../../Input/InputField";
3
+ import { ComponentVariant } from "../../NDSProvider/ComponentVariantContext";
4
4
  interface InputProps extends InputFieldProps {
5
5
  placeholder?: string;
6
6
  }
@@ -8,9 +8,9 @@ type DatePickerInputProps = React.ComponentPropsWithRef<"input"> & {
8
8
  variant?: ComponentVariant;
9
9
  dateFormat?: string;
10
10
  inputProps?: InputProps;
11
- onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
- onUpKeyPress: (e: React.KeyboardEvent<HTMLInputElement>) => void;
13
- onDownKeyPress: (e: React.KeyboardEvent<HTMLInputElement>) => void;
11
+ onInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
12
+ onUpKeyPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
13
+ onDownKeyPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
14
14
  onEnterKeyPress: (e: React.KeyboardEvent<HTMLInputElement>) => void;
15
15
  };
16
16
  declare const DatePickerInput: React.ForwardRefExoticComponent<Omit<DatePickerInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ReactDatePickerCustomHeaderProps } from "react-datepicker";
3
+ export declare function MonthDatePickerHeader({ date, increaseYear, decreaseYear, prevMonthButtonDisabled, nextMonthButtonDisabled, locale, }: ReactDatePickerCustomHeaderProps & {
4
+ locale?: string;
5
+ }): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default as DatePicker } from "./DatePicker";
2
+ export { default as MonthPicker } from "./MonthPicker";
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import ReactDatePicker, { ReactDatePickerCustomHeaderProps } from "react-datepicker";
3
+ import { BaseDatePickerProps } from "./types";
4
+ interface BasePickerProps extends BaseDatePickerProps {
5
+ defaultFormat: string;
6
+ disabledKeyboardNavigation?: boolean;
7
+ defaultPlaceholder: string;
8
+ showMonthYearPicker?: boolean;
9
+ renderHeader: (props: ReactDatePickerCustomHeaderProps) => JSX.Element;
10
+ onUpKeyPress?: () => void;
11
+ onDownKeyPress?: () => void;
12
+ onEnterKeyPress?: () => void;
13
+ }
14
+ export declare const BasePicker: React.ForwardRefExoticComponent<Omit<BasePickerProps, "ref"> & React.RefAttributes<ReactDatePicker<never, undefined>>>;
15
+ export {};
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { InputFieldProps } from "../../Input/InputField";
3
+ import { ReactDatePickerProps } from "react-datepicker";
4
+ import { FieldProps } from "../../Form/Field";
5
+ type OmittedFieldProps = "onChange" | "onBlur" | "onFocus";
6
+ export interface BaseDatePickerProps extends Omit<FieldProps, OmittedFieldProps> {
7
+ className?: string;
8
+ dateFormat?: string;
9
+ disableFlipping?: boolean;
10
+ errorList?: string[];
11
+ errorMessage?: string;
12
+ highlightDates?: ReactDatePickerProps["highlightDates"];
13
+ inputProps?: InputFieldProps;
14
+ locale?: string;
15
+ maxDate?: Date;
16
+ minDate?: Date;
17
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
18
+ onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
19
+ onChange?: (date: Date) => void;
20
+ onInputChange?: (value: string) => void;
21
+ selected?: Date;
22
+ }
23
+ export {};
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const Default: {
7
+ (): React.JSX.Element;
8
+ story: {
9
+ name: string;
10
+ };
11
+ };
12
+ export declare const WithPlaceholder: {
13
+ (): React.JSX.Element;
14
+ story: {
15
+ name: string;
16
+ };
17
+ };
18
+ export declare const Disabled: {
19
+ (): React.JSX.Element;
20
+ story: {
21
+ name: string;
22
+ };
23
+ };
24
+ export declare const WithDefaultValue: {
25
+ (): React.JSX.Element;
26
+ story: {
27
+ name: string;
28
+ };
29
+ };
30
+ export declare const WithMinMaxDate: {
31
+ (): React.JSX.Element;
32
+ story: {
33
+ name: string;
34
+ };
35
+ };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const highlightDates: (startDate: any, endDate: any) => ({
2
+ export declare const highlightDates: (startDate: Date, endDate: Date) => ({
3
3
  "nds-datepicker-day--start-date": Date[];
4
4
  "nds-datepicker-day--end-date"?: undefined;
5
5
  "nds-datepicker-day--in-range"?: undefined;
@@ -1,2 +1,11 @@
1
1
  import React from "react";
2
- export declare const LocaleContext: React.Context<any>;
2
+ export declare const LocaleContext: React.Context<{
3
+ locale: string;
4
+ }>;
5
+ export declare const useLocale: () => {
6
+ locale: string;
7
+ };
8
+ export declare const LocaleContextProvider: ({ locale, children }: {
9
+ locale: string;
10
+ children: React.ReactNode;
11
+ }) => React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { ComponentVariant } from "../NDSProvider/ComponentVariantContext";
3
- export type TabsProps = {
3
+ export type TabsProps = React.PropsWithChildren<{
4
4
  className?: string;
5
5
  selectedIndex?: number;
6
6
  variant?: ComponentVariant;
@@ -8,7 +8,7 @@ export type TabsProps = {
8
8
  renderTabContentOnlyWhenSelected?: boolean;
9
9
  fitted?: boolean;
10
10
  onTabClick?: (...args: any[]) => any;
11
- };
11
+ }>;
12
12
  export type TabsState = {
13
13
  selectedIndex: any;
14
14
  };
@@ -13,7 +13,7 @@ export { Button, ControlIcon, DangerButton, IconicButton, PrimaryButton, QuietBu
13
13
  export { ButtonGroup } from "./ButtonGroup";
14
14
  export { Card, CardSet } from "./Card";
15
15
  export { Checkbox, CheckboxGroup } from "./Checkbox";
16
- export { DatePicker } from "./DatePicker";
16
+ export { DatePicker, MonthPicker } from "./DatePickers";
17
17
  export { DateRange } from "./DateRange";
18
18
  export { DescriptionDetails, DescriptionList, DescriptionTerm } from "./DescriptionList";
19
19
  export { Divider } from "./Divider";
@@ -1 +1 @@
1
- export declare function localizedFormat(date: number, dateFormat: string, ndsLocale: string): string;
1
+ export declare function localizedFormat(date: Date, dateFormat: string, ndsLocale: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "13.1.6",
3
+ "version": "13.2.0",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -55,8 +55,8 @@
55
55
  ],
56
56
  "peerDependencies": {
57
57
  "@nulogy/icons": "4",
58
- "react": ">=16.10.2",
59
- "react-dom": ">=16.10.2",
58
+ "react": ">=16.10.2 <19.0.0",
59
+ "react-dom": ">=16.10.2 <19.0.0",
60
60
  "styled-components": "^6.0.0",
61
61
  "typescript": "4.9.5"
62
62
  },
@@ -95,7 +95,7 @@
95
95
  "@types/jest": "^29.5.1",
96
96
  "@types/node": "^14.0.14",
97
97
  "@types/react": "^17.0.39",
98
- "@types/react-datepicker": "^4.1.0",
98
+ "@types/react-datepicker": "^4.19.6",
99
99
  "@types/react-dom": "^17.0.20",
100
100
  "@types/react-router-dom": "5.3.0",
101
101
  "@typescript-eslint/eslint-plugin": "^4.0.0",
@@ -158,7 +158,6 @@
158
158
  "@styled-system/theme-get": "^5.1.2",
159
159
  "@types/react-window": "^1.8.8",
160
160
  "@types/styled-system": "5.1.22",
161
- "body-scroll-lock": "^3.1.5",
162
161
  "core-js": "3",
163
162
  "date-fns": "2.23.0",
164
163
  "debounce": "^1.2.0",
@@ -166,7 +165,7 @@
166
165
  "framer-motion": "^3.1.3",
167
166
  "i18next": "^19.3.1",
168
167
  "polished": "3.4.4",
169
- "react-datepicker": "^4.1.0",
168
+ "react-datepicker": "^4.25.0",
170
169
  "react-fast-compare": "^3.2.0",
171
170
  "react-hot-toast": "^2.4.1",
172
171
  "react-i18next": "^12.3.1",
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- import type { ReactDatePickerProps } from "react-datepicker";
3
- import { ComponentVariant } from "../NDSProvider/ComponentVariantContext";
4
- import { InputFieldProps } from "../Input/InputField";
5
- import { FieldProps } from "../Form/Field";
6
- type OmittedFieldProps = "onChange" | "onBlur" | "onFocus";
7
- interface DatePickerProps extends Omit<FieldProps, OmittedFieldProps> {
8
- variant?: ComponentVariant;
9
- onChange?: (date: Date) => void;
10
- onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
11
- onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
12
- dateFormat?: string;
13
- onInputChange?: (value: string) => void;
14
- inputProps?: InputFieldProps;
15
- errorMessage?: string;
16
- errorList?: string[];
17
- minDate?: Date;
18
- maxDate?: Date;
19
- highlightDates?: ReactDatePickerProps["highlightDates"];
20
- disableFlipping?: boolean;
21
- selected?: Date | null;
22
- }
23
- declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & React.RefAttributes<unknown>>;
24
- export default DatePicker;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- type Props = {
3
- date: number;
4
- decreaseMonth: React.MouseEventHandler<HTMLButtonElement>;
5
- increaseMonth: React.MouseEventHandler<HTMLButtonElement>;
6
- prevMonthButtonDisabled: boolean;
7
- nextMonthButtonDisabled: boolean;
8
- locale?: string;
9
- };
10
- export default function DatePickerHeader({ date, decreaseMonth, increaseMonth, prevMonthButtonDisabled, nextMonthButtonDisabled, locale, }: Props): React.JSX.Element;
11
- export {};
@@ -1 +0,0 @@
1
- export { default as DatePicker } from "./DatePicker";