@paygreen/pgui 2.7.0 → 2.8.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.
@@ -6,8 +6,11 @@ export type InputDayPickerProps = {
6
6
  onChange: Dispatch<SetStateAction<string | undefined | null>>;
7
7
  value?: string | Date;
8
8
  locale?: string;
9
- variant?: string;
9
+ variant?: 'unstyled' | 'filled' | 'outlined';
10
10
  format?: string;
11
11
  withTime?: boolean;
12
+ minDate?: Date | null | undefined;
13
+ maxDate?: Date | null | undefined;
14
+ calendarFunc: (date: any) => 'after-max-date' | 'before-min-date' | undefined;
12
15
  } & InputProps;
13
- export declare const InputDayPicker: ({ name, placeholder, value, onChange, locale, variant, format, withTime, ...inputProps }: InputDayPickerProps) => JSX.Element;
16
+ export declare const InputDayPicker: ({ name, placeholder, value, onChange, locale, variant, format, withTime, minDate, maxDate, calendarFunc, ...inputProps }: InputDayPickerProps) => JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ export interface ValueProps {
3
+ from: Date | null | undefined;
4
+ to: Date | null | undefined;
5
+ }
6
+ export type InputRangePickerProps = {
7
+ fromLabel: string;
8
+ toLabel: string;
9
+ onChange: Dispatch<SetStateAction<ValueProps | undefined>>;
10
+ minDate?: Date | null;
11
+ maxDate?: Date | null;
12
+ format?: string;
13
+ value?: ValueProps;
14
+ withTime?: boolean;
15
+ variant?: 'unstyled' | 'filled' | 'outlined';
16
+ };
17
+ export declare const InputRangePicker: ({ fromLabel, toLabel, value, onChange, minDate, maxDate, withTime, format, variant, ...props }: InputRangePickerProps) => JSX.Element;
@@ -4,9 +4,11 @@ import 'dayjs/locale/fr';
4
4
  export type NewDayPickerProps = {
5
5
  defaultValue?: string | Date;
6
6
  onChange: (e: string | undefined) => void;
7
- format: string;
8
7
  locale?: string;
9
8
  customFormat?: string;
10
9
  withTime?: boolean;
10
+ minDate?: Date | null;
11
+ maxDate?: Date | null;
12
+ calendarFunc: (date: any) => 'after-max-date' | 'before-min-date' | undefined;
11
13
  };
12
- export declare const NewDayPicker: ({ defaultValue, onChange, locale, customFormat, withTime, ...props }: NewDayPickerProps) => JSX.Element;
14
+ export declare const NewDayPicker: ({ defaultValue, onChange, locale, customFormat, withTime, minDate, maxDate, calendarFunc, ...props }: NewDayPickerProps) => JSX.Element;
@@ -6,6 +6,7 @@ export * from './DayPicker';
6
6
  export * from './FormGroup';
7
7
  export * from './InputDayPicker';
8
8
  export * from './InputPhone';
9
+ export * from './InputRangePicker';
9
10
  export * from './ModalResponsive';
10
11
  export * from './Pagination';
11
12
  export * from './SearchInput';
package/dist/index.d.ts CHANGED
@@ -88,11 +88,14 @@ type InputDayPickerProps = {
88
88
  onChange: Dispatch<SetStateAction<string | undefined | null>>;
89
89
  value?: string | Date;
90
90
  locale?: string;
91
- variant?: string;
91
+ variant?: 'unstyled' | 'filled' | 'outlined';
92
92
  format?: string;
93
93
  withTime?: boolean;
94
+ minDate?: Date | null | undefined;
95
+ maxDate?: Date | null | undefined;
96
+ calendarFunc: (date: any) => 'after-max-date' | 'before-min-date' | undefined;
94
97
  } & InputProps;
95
- declare const InputDayPicker: ({ name, placeholder, value, onChange, locale, variant, format, withTime, ...inputProps }: InputDayPickerProps) => JSX.Element;
98
+ declare const InputDayPicker: ({ name, placeholder, value, onChange, locale, variant, format, withTime, minDate, maxDate, calendarFunc, ...inputProps }: InputDayPickerProps) => JSX.Element;
96
99
 
97
100
  var css_248z = "/* CSS variables. */\r\n:root {\r\n\t--PhoneInput-color--focus: #03b2cb;\r\n\t--PhoneInputInternationalIconPhone-opacity: 0.8;\r\n\t--PhoneInputInternationalIconGlobe-opacity: 0.65;\r\n\t--PhoneInputCountrySelect-marginRight: 0.35em;\r\n\t--PhoneInputCountrySelectArrow-width: 0.3em;\r\n\t--PhoneInputCountrySelectArrow-marginLeft: var(--PhoneInputCountrySelect-marginRight);\r\n\t--PhoneInputCountrySelectArrow-borderWidth: 1px;\r\n\t--PhoneInputCountrySelectArrow-opacity: 0.45;\r\n\t--PhoneInputCountrySelectArrow-color: currentColor;\r\n\t--PhoneInputCountrySelectArrow-color--focus: var(--PhoneInput-color--focus);\r\n\t--PhoneInputCountrySelectArrow-transform: rotate(45deg);\r\n\t--PhoneInputCountryFlag-aspectRatio: 1.5;\r\n\t--PhoneInputCountryFlag-height: 1em;\r\n\t--PhoneInputCountryFlag-borderWidth: 1px;\r\n\t--PhoneInputCountryFlag-borderColor: rgba(0,0,0,0.5);\r\n\t--PhoneInputCountryFlag-borderColor--focus: var(--PhoneInput-color--focus);\r\n\t--PhoneInputCountryFlag-backgroundColor--loading: rgba(0,0,0,0.1);\r\n}\r\n\r\n.PhoneInput {\r\n\t/* This is done to stretch the contents of this component. */\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n}\r\n\r\n.PhoneInputInput {\r\n\t/* The phone number input stretches to fill all empty space */\r\n\tflex: 1;\r\n\t/* The phone number input should shrink\r\n\t to make room for the extension input */\r\n\tmin-width: 0;\r\n}\r\n\r\n.PhoneInputCountryIcon {\r\n\twidth: calc(var(--PhoneInputCountryFlag-height) * var(--PhoneInputCountryFlag-aspectRatio));\r\n\theight: var(--PhoneInputCountryFlag-height);\r\n}\r\n\r\n.PhoneInputCountryIcon--square {\r\n\twidth: var(--PhoneInputCountryFlag-height);\r\n}\r\n\r\n.PhoneInputCountryIcon--border {\r\n\t/* Removed `background-color` because when an `<img/>` was still loading\r\n\t it would show a dark gray rectangle. */\r\n\t/* For some reason the `<img/>` is not stretched to 100% width and height\r\n\t and sometime there can be seen white pixels of the background at top and bottom. */\r\n\tbackground-color: var(--PhoneInputCountryFlag-backgroundColor--loading);\r\n\t/* Border is added via `box-shadow` because `border` interferes with `width`/`height`. */\r\n\t/* For some reason the `<img/>` is not stretched to 100% width and height\r\n\t and sometime there can be seen white pixels of the background at top and bottom,\r\n\t so an additional \"inset\" border is added. */\r\n\tbox-shadow: 0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor),\r\n\t\tinset 0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor);\r\n}\r\n\r\n.PhoneInputCountryIconImg {\r\n\t/* Fixes weird vertical space above the flag icon. */\r\n\t/* https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/7#note_348586559 */\r\n\tdisplay: block;\r\n\t/* 3rd party <SVG/> flag icons won't stretch if they have `width` and `height`.\r\n\t Also, if an <SVG/> icon's aspect ratio was different, it wouldn't fit too. */\r\n\twidth: 100%;\r\n\theight: 100%;\r\n}\r\n\r\n.PhoneInputInternationalIconPhone {\r\n\topacity: var(--PhoneInputInternationalIconPhone-opacity);\r\n}\r\n\r\n.PhoneInputInternationalIconGlobe {\r\n\topacity: var(--PhoneInputInternationalIconGlobe-opacity);\r\n}\r\n\r\n/* Styling native country `<select/>`. */\r\n\r\n.PhoneInputCountry {\r\n\tposition: relative;\r\n\talign-self: stretch;\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tmargin-right: var(--PhoneInputCountrySelect-marginRight);\r\n}\r\n\r\n.PhoneInputCountrySelect {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\theight: 100%;\r\n\twidth: 100%;\r\n\tz-index: 1;\r\n\tborder: 0;\r\n\topacity: 0;\r\n\tcursor: pointer;\r\n}\r\n\r\n.PhoneInputCountrySelect[disabled],\r\n.PhoneInputCountrySelect[readonly] {\r\n\tcursor: default;\r\n}\r\n\r\n.PhoneInputCountrySelectArrow {\r\n\tdisplay: block;\r\n\tcontent: '';\r\n\twidth: var(--PhoneInputCountrySelectArrow-width);\r\n\theight: var(--PhoneInputCountrySelectArrow-width);\r\n\tmargin-left: var(--PhoneInputCountrySelectArrow-marginLeft);\r\n\tborder-style: solid;\r\n\tborder-color: var(--PhoneInputCountrySelectArrow-color);\r\n\tborder-top-width: 0;\r\n\tborder-bottom-width: var(--PhoneInputCountrySelectArrow-borderWidth);\r\n\tborder-left-width: 0;\r\n\tborder-right-width: var(--PhoneInputCountrySelectArrow-borderWidth);\r\n\ttransform: var(--PhoneInputCountrySelectArrow-transform);\r\n\topacity: var(--PhoneInputCountrySelectArrow-opacity);\r\n}\r\n\r\n.PhoneInputCountrySelect:focus + .PhoneInputCountryIcon + .PhoneInputCountrySelectArrow {\r\n\topacity: 1;\r\n\tcolor: var(--PhoneInputCountrySelectArrow-color--focus);\r\n}\r\n\r\n.PhoneInputCountrySelect:focus + .PhoneInputCountryIcon--border {\r\n\tbox-shadow: 0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor--focus),\r\n\t\tinset 0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor--focus);\r\n}\r\n\r\n.PhoneInputCountrySelect:focus + .PhoneInputCountryIcon .PhoneInputInternationalIconGlobe {\r\n\topacity: 1;\r\n\tcolor: var(--PhoneInputCountrySelectArrow-color--focus);\r\n}";
98
101
  styleInject(css_248z);
@@ -108,6 +111,23 @@ declare const isValidPhone: (val: string) => boolean;
108
111
  declare const formatPhoneIntl: (val: string) => string;
109
112
  declare const InputPhone: ({ locale, value, placeholder, isDisabled, inputProps, ...props }: InputPhoneProps) => JSX.Element;
110
113
 
114
+ interface ValueProps {
115
+ from: Date | null | undefined;
116
+ to: Date | null | undefined;
117
+ }
118
+ type InputRangePickerProps = {
119
+ fromLabel: string;
120
+ toLabel: string;
121
+ onChange: Dispatch<SetStateAction<ValueProps | undefined>>;
122
+ minDate?: Date | null;
123
+ maxDate?: Date | null;
124
+ format?: string;
125
+ value?: ValueProps;
126
+ withTime?: boolean;
127
+ variant?: 'unstyled' | 'filled' | 'outlined';
128
+ };
129
+ declare const InputRangePicker: ({ fromLabel, toLabel, value, onChange, minDate, maxDate, withTime, format, variant, ...props }: InputRangePickerProps) => JSX.Element;
130
+
111
131
  type ModalResponsiveProps = ModalProps & DrawerProps;
112
132
  declare const ModalResponsive: ({ isOpen, onClose, finalFocusRef, children, ...rest }: ModalResponsiveProps) => JSX.Element;
113
133
 
@@ -318,4 +338,4 @@ declare const dateFormat = "dd/MM/yyyy";
318
338
 
319
339
  declare const useIsMobile: (currentBreakpoint: string) => boolean;
320
340
 
321
- export { ActionsButton, ActionsButtonProps, BottomBar, Card, ConfirmMenuItem, DataList, DataListAccordion, DataListAccordionButton, DataListAccordionIcon, DataListAccordionPanel, DataListCell, DataListCellProps, DataListContext, DataListFooter, DataListFooterProps, DataListHeader, DataListHeaderContext, DataListHeaderProps, DataListProps, DataListRow, DataListRowProps, DayPicker, FormGroup, FormGroupProps, InputDayPicker, InputDayPickerProps, InputPhone, InputPhoneProps, LayoutContainer, MenuItem, ModalResponsive, Pagination, PaginationButtonFirstPage, PaginationButtonLastPage, PaginationButtonNextPage, PaginationButtonPrevPage, PaginationContext, PaginationContextValue, PaginationInfo, PaginationProps, SearchInput, Select, SelectProps, SideNav, SideNavBody, SideNavContainer, SideNavFooter, SideNavHeader, SideNavMenu, SideNavMenuItem, SideNavMenuItemProps, SideNavMenuProps, SideNavProps, StyledMenuItemProps, TopBar, TopBarBackAction, TopBarBackActionProps, TopBarFirstElement, TopBarLastElement, dateFormat, formatPhoneIntl, getPaginationInfo, isValidPhone, theme, useIsMobile };
341
+ export { ActionsButton, ActionsButtonProps, BottomBar, Card, ConfirmMenuItem, DataList, DataListAccordion, DataListAccordionButton, DataListAccordionIcon, DataListAccordionPanel, DataListCell, DataListCellProps, DataListContext, DataListFooter, DataListFooterProps, DataListHeader, DataListHeaderContext, DataListHeaderProps, DataListProps, DataListRow, DataListRowProps, DayPicker, FormGroup, FormGroupProps, InputDayPicker, InputDayPickerProps, InputPhone, InputPhoneProps, InputRangePicker, InputRangePickerProps, LayoutContainer, MenuItem, ModalResponsive, Pagination, PaginationButtonFirstPage, PaginationButtonLastPage, PaginationButtonNextPage, PaginationButtonPrevPage, PaginationContext, PaginationContextValue, PaginationInfo, PaginationProps, SearchInput, Select, SelectProps, SideNav, SideNavBody, SideNavContainer, SideNavFooter, SideNavHeader, SideNavMenu, SideNavMenuItem, SideNavMenuItemProps, SideNavMenuProps, SideNavProps, StyledMenuItemProps, TopBar, TopBarBackAction, TopBarBackActionProps, TopBarFirstElement, TopBarLastElement, ValueProps, dateFormat, formatPhoneIntl, getPaginationInfo, isValidPhone, theme, useIsMobile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paygreen/pgui",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "PGUI is the design system coming from Paygreen.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",