jamespot-react-components 1.0.151 → 1.0.152

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.
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { JRCInputSelectProps } from './JRCInputSelect.types';
3
- import { JRCModalProps } from 'components/JRCModal/JRCModal';
3
+ import { JRCModalLayoutProps } from 'components/JRCModal/JRCModalLayout';
4
4
  import { AutoCompleteConcept, PagingResults } from 'jamespot-user-api';
5
- export type JRCInputSelectHierarchicalTreeProps = Omit<JRCInputSelectProps, 'asyncPromise'> & JRCModalProps & {
5
+ export type JRCInputSelectHierarchicalTreeProps = Omit<JRCInputSelectProps, 'asyncPromise'> & JRCModalLayoutProps & {
6
6
  asyncPromise?: (inputValue: string, page?: number) => Promise<PagingResults<any>>;
7
7
  hierarchicalTaxonomyPromise: (uriConcept: string) => Promise<PagingResults<AutoCompleteConcept>>;
8
8
  displayModal?: boolean;
@@ -11,7 +11,7 @@ export type JRCInputSelectHierarchicalTreeProps = Omit<JRCInputSelectProps, 'asy
11
11
  value: any;
12
12
  }>;
13
13
  };
14
- export declare const JRCInputSelectHierarchicalTree: React.ForwardRefExoticComponent<Omit<JRCInputSelectProps<import("react-hook-form").FieldValues>, "asyncPromise"> & JRCModalProps & {
14
+ export declare const JRCInputSelectHierarchicalTree: React.ForwardRefExoticComponent<Omit<JRCInputSelectProps<import("react-hook-form").FieldValues>, "asyncPromise"> & JRCModalLayoutProps & {
15
15
  asyncPromise?: ((inputValue: string, page?: number) => Promise<PagingResults<any>>) | undefined;
16
16
  hierarchicalTaxonomyPromise: (uriConcept: string) => Promise<PagingResults<AutoCompleteConcept>>;
17
17
  displayModal?: boolean | undefined;
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { JRCInputSelectProps } from './JRCInputSelect.types';
3
- import { JRCModalProps } from 'components/JRCModal/JRCModal';
4
3
  import { BaseAutocomplete, PagingResults } from 'jamespot-user-api';
5
- export type JRCInputSelectListProps = Omit<JRCInputSelectProps, 'asyncPromise'> & JRCModalProps & {
4
+ import { FieldValues } from 'react-hook-form';
5
+ import { JRCModalProps } from '../../../JRCModal/templates/JRCModal.types';
6
+ export type JRCInputSelectListProps<T extends FieldValues = FieldValues> = Omit<JRCInputSelectProps<T>, 'asyncPromise'> & Pick<JRCModalProps, 'inPlace'> & {
6
7
  asyncPromise?: (inputValue: string, page?: number) => Promise<PagingResults<any>>;
7
8
  displayModal?: boolean;
8
- setValues: (name: string, values: BaseAutocomplete[]) => void;
9
+ onChange: (values: BaseAutocomplete[]) => void;
9
10
  };
10
- export declare const JRCInputSelectList: ({ asyncPromise, displayModal, inPlace, width, placeholder, setValues, control, name, ...props }: JRCInputSelectListProps) => React.JSX.Element;
11
+ export declare const JRCInputSelectList: <T extends FieldValues = FieldValues>({ asyncPromise, displayModal, inPlace, width, placeholder, onChange, control, name, ...props }: JRCInputSelectListProps<T>) => React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Area as _Area, Point as _Point, Size as _Size } from 'react-easy-crop/types';
3
- import { JRCModalProps } from '../JRCModal/JRCModal';
3
+ import { JRCModalProps } from '../JRCModal/templates/JRCModal.types';
4
4
  export type Size = _Size;
5
5
  export type Point = _Point;
6
6
  export type Area = _Area;
@@ -1,28 +1,30 @@
1
+ import { ModalVariant } from './JRCModalLayout';
1
2
  export type ModalBorderRadius = 'medium' | 'small';
2
3
  export declare const JRCModalBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
3
4
  isFullHeight?: boolean | undefined;
5
+ overflow?: "hidden" | "visible" | undefined;
4
6
  }, never>;
5
7
  export declare const JRCModalContainerFull: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
6
8
  isFullScreen?: boolean | undefined;
7
9
  maxHeight?: string | undefined;
8
10
  }, never>;
9
11
  export declare const JRCModalContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
10
- isFullHeight?: boolean | undefined;
11
- overflow?: "hidden" | "visible" | "scroll" | undefined;
12
+ variant?: ModalVariant | undefined;
13
+ overflow?: "hidden" | "visible" | undefined;
12
14
  radius?: ModalBorderRadius | undefined;
13
15
  maxHeight?: string | undefined;
14
16
  }, never>;
15
17
  export declare const JRCModalTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
18
  export declare const JRCModalOptions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
17
- export declare const JRCModalContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
18
- overflow?: "hidden" | "visible" | "scroll" | undefined;
19
+ export declare const JRCModalBody: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
20
+ modalOverflow?: "hidden" | "visible" | "scroll" | undefined;
19
21
  }, never>;
20
22
  export declare const JRCModalContentFull: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
21
23
  export declare const JRCModalContentScrollbox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
22
24
  export declare const JRCModalHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
23
- overflow?: "hidden" | "visible" | "scroll" | undefined;
25
+ modalOverflow?: "hidden" | "visible" | "scroll" | undefined;
24
26
  }, never>;
25
27
  export declare const JRCModalFooter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
26
- overflow?: "hidden" | "visible" | "scroll" | undefined;
28
+ modalOverflow?: "hidden" | "visible" | "scroll" | undefined;
27
29
  }, never>;
28
30
  export declare const JRCModalClose: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,27 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ButtonColors } from '../JRCButton/JRCButton';
3
+ export type JRCModalContentBase = {
4
+ title?: ReactNode;
5
+ children?: ReactNode;
6
+ options?: ReactNode;
7
+ overflow?: 'visible' | 'hidden' | 'scroll';
8
+ onClickIconClose?: () => void;
9
+ };
10
+ export type JRCModalContentProps = JRCModalContentBase & {
11
+ isFull?: boolean;
12
+ buttons?: JRCModalButtonType[];
13
+ };
14
+ export interface JRCModalButtonType {
15
+ children: ReactNode;
16
+ color?: ButtonColors;
17
+ variant?: 'contained' | 'outlined';
18
+ clickHandler?: () => void;
19
+ dataCy?: string;
20
+ }
21
+ export declare const ModalOptions: ({ children }: {
22
+ children?: React.ReactNode;
23
+ }) => React.JSX.Element;
24
+ export declare const ModalTitle: ({ children }: {
25
+ children?: React.ReactNode;
26
+ }) => React.JSX.Element;
27
+ export declare const JRCModalContent: ({ title, onClickIconClose, overflow, options, children, buttons, isFull, }: JRCModalContentProps) => React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import React, { FormEvent } from 'react';
2
+ import { JRCModalButtonType, JRCModalContentBase } from './JRCModalContent';
3
+ export type JRCModalContentFormProps = JRCModalContentBase & {
4
+ buttons?: JRCModalFormButtonType[];
5
+ onSubmit: (e: FormEvent) => Promise<void>;
6
+ loading?: boolean;
7
+ };
8
+ export interface JRCModalFormButtonType extends JRCModalButtonType {
9
+ loading?: boolean;
10
+ isSubmit?: boolean;
11
+ disabled?: boolean;
12
+ }
13
+ export declare const JRCModalContentForm: ({ onSubmit, children, loading, title, onClickIconClose, options, buttons, overflow, }: JRCModalContentFormProps) => React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ModalBorderRadius } from './JRCModal.styles';
3
+ export type ModalVariant = 'full-width' | 'full-screen' | 'full-height' | 'fixed-height';
4
+ export interface JRCModalLayoutProps {
5
+ open: boolean;
6
+ closeHandler: () => void;
7
+ children?: ReactNode;
8
+ enableClickAwayCloseModal?: boolean;
9
+ radius?: ModalBorderRadius;
10
+ portalId?: string;
11
+ inPlace?: boolean;
12
+ className?: string;
13
+ maxHeight?: string;
14
+ variant?: ModalVariant;
15
+ overflow?: 'visible' | 'hidden';
16
+ }
17
+ export declare const JRCModalLayout: React.ForwardRefExoticComponent<JRCModalLayoutProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { JRCModalProps } from './JRCModal.types';
3
+ export declare const JRCModal: ({ children, open, closeHandler, buttons, title, options, portalId, inPlace, ref, enableClickAwayCloseModal, }: JRCModalProps) => React.JSX.Element;
@@ -1,5 +1,4 @@
1
- import { JRCModalProps } from './JRCModal';
2
1
  import { Meta, Story } from '@storybook/react';
3
2
  declare const _default: Meta<import("@storybook/react").Args>;
4
3
  export default _default;
5
- export declare const Modal: Story<JRCModalProps>;
4
+ export declare const Modal: Story<import("@storybook/react").Args>;
@@ -0,0 +1,24 @@
1
+ import { FormEvent, ForwardedRef, ReactNode } from 'react';
2
+ import { JRCModalButtonType } from '../JRCModalContent';
3
+ import { JRCModalFormButtonType } from '../JRCModalContentForm';
4
+ type JRCModalBaseProps = {
5
+ title?: ReactNode;
6
+ children?: ReactNode;
7
+ options?: ReactNode;
8
+ open: boolean;
9
+ closeHandler: () => void;
10
+ portalId?: string;
11
+ inPlace?: boolean;
12
+ ref?: ForwardedRef<HTMLDivElement>;
13
+ enableClickAwayCloseModal?: boolean;
14
+ };
15
+ export type JRCModalProps = JRCModalBaseProps & {
16
+ buttons?: JRCModalButtonType[];
17
+ };
18
+ export type JRCModalFormProps = JRCModalBaseProps & {
19
+ buttons?: JRCModalFormButtonType[];
20
+ onSubmit: (e: FormEvent) => Promise<void>;
21
+ loading?: boolean;
22
+ maxHeight?: string;
23
+ };
24
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { JRCModalFormProps } from './JRCModal.types';
3
+ export declare const JRCModalForm: ({ title, children, options, open, closeHandler, buttons, onSubmit, loading, portalId, inPlace, ref, enableClickAwayCloseModal, maxHeight, }: JRCModalFormProps) => React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Modal: Story<import("@storybook/react").Args>;
@@ -113,7 +113,11 @@ export { JRCList } from './components/JRCList/JRCList';
113
113
  export { JRCLoader } from './components/JRCLoader/JRCLoader';
114
114
  export { JRCMainColumn } from './components/Templates/JRCMainColumn';
115
115
  export { JRCMenu } from './components/JRCMenu/JRCMenu';
116
- export { JRCModal } from './components/JRCModal/JRCModal';
116
+ export { JRCModal } from './components/JRCModal/templates/JRCModal';
117
+ export { JRCModalForm } from './components/JRCModal/templates/JRCModalForm';
118
+ export { JRCModalLayout } from './components/JRCModal/JRCModalLayout';
119
+ export { JRCModalContent } from './components/JRCModal/JRCModalContent';
120
+ export { JRCModalContentForm } from './components/JRCModal/JRCModalContentForm';
117
121
  export { JRCModalImg } from './components/JRCModalImg/JRCModalImg';
118
122
  export { JRCPageNotLogged } from './components/Pages/JRCPageNotLogged';
119
123
  export { JRCPagination } from './components/JRCPagination/JRCPagination';
@@ -61,8 +61,11 @@ export { JRCLinkToProps, JRCStyledHrefProps } from './components/JRCHref/JRCHref
61
61
  export { JRCListProps, PaginationPagination } from './components/JRCList/JRCList';
62
62
  export { JRCLoaderProps } from './components/JRCLoader/JRCLoader';
63
63
  export { JRCMenuProps, JRCMenuItemProps } from './components/JRCMenu/JRCMenu';
64
- export { JRCModalButtonType, JRCModalProps } from './components/JRCModal/JRCModal';
64
+ export { JRCModalProps, JRCModalFormProps } from './components/JRCModal/templates/JRCModal.types';
65
+ export { JRCModalContentProps, JRCModalButtonType } from './components/JRCModal/JRCModalContent';
66
+ export { JRCModalContentFormProps, JRCModalFormButtonType } from './components/JRCModal/JRCModalContentForm';
65
67
  export { JRCModalImgButtonType, JRCModalImgProps } from './components/JRCModalImg/JRCModalImg';
68
+ export { JRCModalLayoutProps } from './components/JRCModal/JRCModalLayout';
66
69
  export { JRCPaginationProps } from './components/JRCPagination/JRCPagination';
67
70
  export { JRCSkeletonLineProps } from './components/JRCSkeleton/JRCSkeletonLine';
68
71
  export { JRCSkeletonSquareProps } from './components/JRCSkeleton/JRCSkeletonSquare';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-components",
3
- "version": "1.0.151",
3
+ "version": "1.0.152",
4
4
  "description": "",
5
5
  "main": "./build/jamespot-react-components.js",
6
6
  "types": "./build/src/index.d.ts",
@@ -1,56 +0,0 @@
1
- import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
2
- import { ButtonColors } from '../JRCButton/JRCButton';
3
- import { ModalBorderRadius } from './JRCModal.styles';
4
- /**
5
- * Interface to provide Modal Buttons
6
- * @member color button color ButtonColors
7
- * @member isClosed optional boolean (default false). If true, when click on the button, the modal is closes
8
- * @member clickHandler optional, callback when the button is click
9
- * @member children default ReactNode children in the Modal content
10
- */
11
- export interface JRCModalButtonType extends ComponentPropsWithoutRef<'button'> {
12
- children: ReactNode;
13
- color?: ButtonColors;
14
- variant?: 'contained' | 'outlined';
15
- isClosed?: boolean;
16
- clickHandler?: (setLoading: (isLoading: boolean) => void) => Promise<void>;
17
- dataCy?: string;
18
- preventClose?: boolean;
19
- }
20
- /**
21
- * Interface for JRCModal props
22
- * @member open boolean that open or close the Modal
23
- * @member closeHandler callback called when the Modal is closed
24
- * @member buttons array of JRCModalButton possibly added to the Modal
25
- * @member title optional string or JSX.Element (header content) if hasHeader= true
26
- * @member showIconClose boolean to show/hide the close (x) button of the Modal
27
- * @member enableClickAwayCloseModal boolean to enable the close of the Modal by Click Outside of Modal
28
- * @member contentFull content without padding
29
- * @member overflow allow overflow hidden (crop background for radius)
30
- * @member radius border radius size
31
- * @member children default ReactNode children in the Modal content
32
- * @member portalId id attribute for createPortal
33
- * @member inPlace if true, does not use a portal
34
- * @member className use for overriding the styled-components styles
35
- */
36
- export interface JRCModalProps {
37
- open: boolean;
38
- closeHandler: () => void;
39
- buttons?: JRCModalButtonType[];
40
- children?: ReactNode;
41
- title?: React.ReactNode;
42
- showIconClose?: boolean;
43
- enableClickAwayCloseModal?: boolean;
44
- contentFull?: boolean;
45
- overflow?: 'hidden' | 'scroll' | 'visible';
46
- radius?: ModalBorderRadius;
47
- isFull?: boolean;
48
- isFullHeight?: boolean;
49
- isFullScreen?: boolean;
50
- modalOptions?: ReactNode;
51
- portalId?: string;
52
- inPlace?: boolean;
53
- className?: string;
54
- maxHeight?: string;
55
- }
56
- export declare const JRCModal: React.ForwardRefExoticComponent<JRCModalProps & React.RefAttributes<HTMLDivElement>>;