jamespot-react-components 1.0.3 → 1.0.9

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.
Files changed (67) hide show
  1. package/build/jamespot-react-components.js +208 -192
  2. package/build/jamespot-react-components.js.map +1 -1
  3. package/build/src/components/Common/JRCConditionalWrapper.d.ts +4 -4
  4. package/build/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.d.ts +5 -2
  5. package/build/src/components/Form/Input/JRCInputDate/JRCInputDate.d.ts +11 -0
  6. package/build/src/components/Form/Input/JRCInputDate/JRCInputDate.stories.d.ts +5 -0
  7. package/build/src/components/Form/Input/JRCInputText/JRCInputText.d.ts +1 -1
  8. package/build/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.d.ts +15 -0
  9. package/build/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.stories.d.ts +5 -0
  10. package/build/src/components/JRCButton/JRCButton.d.ts +25 -0
  11. package/build/src/components/JRCButton/JRCButtonConfig.d.ts +1 -2
  12. package/build/src/components/JRCEllipsis/JRCEllipsis.d.ts +5 -0
  13. package/build/src/components/JRCEllipsis/JRCEllipsis.stories.d.ts +5 -0
  14. package/build/src/components/JRCHref/JRCHref.d.ts +18 -10
  15. package/build/src/components/JRCImg/url.util.d.ts +3 -3
  16. package/build/src/components/JRCList/JRCList.d.ts +2 -0
  17. package/build/src/components/JRCModal/JRCModal.d.ts +5 -1
  18. package/build/src/components/JRCModal/JRCModal.styles.d.ts +0 -1
  19. package/build/src/components/JRCTag/JRCTag.d.ts +2 -0
  20. package/build/src/hooks/UseDidMountEffect.d.ts +1 -2
  21. package/build/src/index.d.ts +8 -5
  22. package/build/src/styles/theme.d.ts +1 -0
  23. package/build/src/types.d.ts +4 -0
  24. package/externals.json +2 -1
  25. package/package.json +2 -2
  26. package/src/components/Common/JRCConditionalWrapper.tsx +6 -13
  27. package/src/components/Form/Input/JRCFormColor/JRCFormColor.tsx +12 -12
  28. package/src/components/Form/Input/JRCFormEmail/JRCInputEmail.tsx +4 -8
  29. package/src/components/Form/Input/JRCFormSelect/JRCFormSelect.tsx +5 -1
  30. package/src/components/Form/Input/JRCFormSelect/JRCFormSelectTag.tsx +3 -1
  31. package/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.stories.tsx +1 -4
  32. package/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.tsx +12 -10
  33. package/src/components/Form/Input/JRCInputDate/JRCInputDate.stories.tsx +50 -0
  34. package/src/components/Form/Input/JRCInputDate/JRCInputDate.tsx +26 -0
  35. package/src/components/Form/Input/JRCInputText/JRCInputText.tsx +2 -2
  36. package/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.stories.tsx +52 -0
  37. package/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.tsx +36 -0
  38. package/src/components/Form/Input/JRCSelect/JRCInputSelect.tsx +1 -1
  39. package/src/components/JRCButton/JRCButton.stories.tsx +1 -1
  40. package/src/components/JRCButton/JRCButton.tsx +9 -3
  41. package/src/components/JRCButton/JRCButtonConfig.tsx +1 -1
  42. package/src/components/JRCButton/JRCValidationButton.tsx +10 -4
  43. package/src/components/JRCButtonDropdown/JRCButtonDropdown.tsx +2 -2
  44. package/src/components/JRCEllipsis/JRCEllipsis.stories.tsx +18 -0
  45. package/src/components/JRCEllipsis/JRCEllipsis.tsx +22 -0
  46. package/src/components/JRCHref/JRCHref.stories.tsx +2 -0
  47. package/src/components/JRCHref/JRCHref.tsx +42 -15
  48. package/src/components/JRCIcon/JRCIcon.tsx +1 -1
  49. package/src/components/JRCIconButton/JRCIconButton.tsx +1 -4
  50. package/src/components/JRCImg/JRCImg.tsx +4 -2
  51. package/src/components/JRCImg/url.util.ts +7 -6
  52. package/src/components/JRCImg/url.utils.test.ts +7 -1
  53. package/src/components/JRCList/JRCList.styles.tsx +16 -2
  54. package/src/components/JRCList/JRCList.tsx +5 -5
  55. package/src/components/JRCList/JRCListMockData.stories.tsx +1 -1
  56. package/src/components/JRCModal/JRCModal.styles.tsx +0 -6
  57. package/src/components/JRCModal/JRCModal.tsx +77 -62
  58. package/src/components/JRCTag/JRCTag.tsx +29 -9
  59. package/src/components/JRCThemeProvider/animation.css +19 -0
  60. package/src/components/JRCThemeProvider/gabarit.css +4 -0
  61. package/src/components/JRCTooltip/JRCTooltip.tsx +5 -2
  62. package/src/hooks/UseDidMountEffect.tsx +1 -3
  63. package/src/index.tsx +9 -5
  64. package/src/styles/theme.tsx +3 -2
  65. package/src/translation/lang.json +3 -2
  66. package/src/types.ts +4 -0
  67. package/src/variables.scss +0 -67
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  export interface JRCConditionalWrapperProps {
3
3
  condition: boolean;
4
- wrapper: (children: React.ReactNode) => React.ReactElement;
5
- wrapperFalse?: (children: React.ReactNode) => React.ReactElement;
6
- children?: React.ReactElement;
4
+ wrapper: (children: React.ReactNode) => React.ReactNode;
5
+ wrapperFalse?: (children: React.ReactNode) => React.ReactNode;
6
+ children?: React.ReactNode;
7
7
  }
8
- export declare const JRCConditionalWrapper: ({ condition, wrapper, wrapperFalse, children, }: JRCConditionalWrapperProps) => React.ReactElement;
8
+ export declare const JRCConditionalWrapper: ({ condition, wrapper, wrapperFalse, children }: JRCConditionalWrapperProps) => JSX.Element;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { ControllerRenderProps } from 'react-hook-form/dist/types/controller';
2
3
  import { DataCy } from '../../../../types/dataAttributes';
3
4
  import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
4
- declare type Value<T> = string | number | T;
5
5
  declare type CheckboxOption<TFieldValues> = {
6
6
  label: string | JSX.Element;
7
- value: Value<TFieldValues>;
7
+ value: string | number | TFieldValues;
8
8
  disabled?: boolean;
9
9
  };
10
10
  export declare type CheckboxProps<TFieldValues> = DataCy & {
@@ -20,6 +20,9 @@ export declare type CheckboxProps<TFieldValues> = DataCy & {
20
20
  valueTypeIsBoolean?: boolean;
21
21
  };
22
22
  export declare type JRCInputCheckboxProps<TFieldValues> = CheckboxProps<TFieldValues> & JRCInputFieldProps<TFieldValues>;
23
+ export declare type NativeCheckboxProps<TFieldValues> = CheckboxProps<TFieldValues> & Omit<ControllerRenderProps<TFieldValues>, 'value'> & {
24
+ value: TFieldValues | TFieldValues[];
25
+ };
23
26
  export declare function JRCInputCheckbox<TFieldValues>({ name, control, rules, label, htmlFor, labelIsLegend, description, helper, ...props }: JRCInputCheckboxProps<TFieldValues>): JSX.Element;
24
27
  export declare namespace JRCInputCheckbox {
25
28
  var defaultProps: {
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
3
+ import { DataCy } from '../../../../types/dataAttributes';
4
+ export declare type JRCInputDateProps = DataCy & React.ComponentPropsWithoutRef<'input'>;
5
+ /**
6
+ * Component used as a <input type="date"/>
7
+ * @param props JRCInputFieldProps
8
+ * validation props: required
9
+ * @returns JSX.Element
10
+ */
11
+ export declare function JRCInputDate<T>(props: JRCInputFieldProps<T>): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
2
+ import { Meta, Story } from '@storybook/react';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const InputDate: Story<JRCInputFieldProps<"date">>;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
3
3
  import { DataCy } from '../../../../types/dataAttributes';
4
- export declare type InputTextProps = DataCy & React.ComponentPropsWithoutRef<'input'>;
4
+ export declare type JRCInputTextProps = DataCy & React.ComponentPropsWithoutRef<'input'>;
5
5
  /**
6
6
  * Component used as a <input type="text"/>
7
7
  * @param props JRCInputFieldProps
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
3
+ import { DataCy } from '../../../../types/dataAttributes';
4
+ export declare type JRCInputTextareaProps = DataCy & React.ComponentPropsWithoutRef<'textarea'>;
5
+ export declare const StyledTextArea: import("styled-components").StyledComponent<"textarea", any, DataCy & {
6
+ error?: boolean | undefined;
7
+ valid?: boolean | undefined;
8
+ }, never>;
9
+ /**
10
+ * Component used as a <input type="text"/>
11
+ * @param props JRCInputFieldProps
12
+ * validation props: required
13
+ * @returns JSX.Element
14
+ */
15
+ export declare function JRCInputTextarea<T>(props: JRCInputFieldProps<T>): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
2
+ import { Meta, Story } from '@storybook/react';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const InputTextarea: Story<JRCInputFieldProps<"textarea">>;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { JRCIconProps } from '../JRCIcon/JRCIcon';
3
+ import { ButtonType } from './JRCButtonConfig';
3
4
  import { DataCy } from '../../types/dataAttributes';
4
5
  export declare type JRCButtonProps = React.ComponentPropsWithoutRef<'button'> & DataCy & {
5
6
  /** Color of the background of the button */
@@ -20,6 +21,30 @@ export declare type JRCButtonProps = React.ComponentPropsWithoutRef<'button'> &
20
21
  minWidth?: string;
21
22
  };
22
23
  export declare const transformColor: (color?: string | undefined) => JRCIconProps['color'];
24
+ /**
25
+ * Button styling. May be used as a <a> tag
26
+ */
27
+ export declare const Button: import("styled-components").StyledComponent<"button", any, {
28
+ themeButton: ButtonType;
29
+ hasChildren: boolean;
30
+ } & Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & DataCy & {
31
+ /** Color of the background of the button */
32
+ color?: "primary" | "valid" | "danger" | "secondary" | undefined;
33
+ /** Indicates loading of content on the button */
34
+ loader?: boolean | undefined;
35
+ /** This Boolean attribute specifies that the button should have input focus when the page loads */
36
+ autofocus?: boolean | undefined;
37
+ /** Defines the value associated with the button’s name when it’s submitted with the form data */
38
+ value?: string | undefined;
39
+ /** Enhance your button with an icon */
40
+ icon?: string | undefined;
41
+ /** The variant is used to define what type of action the button will take */
42
+ variant?: "contained" | "outlined" | undefined;
43
+ /** CSS float attribute */
44
+ float?: "left" | "right" | undefined;
45
+ /** CSS min-width attribute */
46
+ minWidth?: string | undefined;
47
+ }, never>;
23
48
  declare const JRCButton: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & DataCy & {
24
49
  /** Color of the background of the button */
25
50
  color?: "primary" | "valid" | "danger" | "secondary" | undefined;
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ export declare const BUTTON_CONFIG: {
2
2
  contained: {
3
3
  primary: {
4
4
  color: string;
@@ -134,7 +134,6 @@ declare const _default: {
134
134
  };
135
135
  };
136
136
  };
137
- export default _default;
138
137
  export declare type ButtonType = {
139
138
  color: string;
140
139
  background: string;
@@ -0,0 +1,5 @@
1
+ export declare type JRCEllipsisProps = {
2
+ label?: string;
3
+ length: number;
4
+ };
5
+ export declare const JRCEllipsis: ({ label, length }: JRCEllipsisProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import { JRCEllipsisProps } from './JRCEllipsis';
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
5
+ export declare const CustomButton: Story<JRCEllipsisProps>;
@@ -2,20 +2,28 @@ import * as React from 'react';
2
2
  import { DataCy } from '../../types/dataAttributes';
3
3
  /**
4
4
  * Props type for JRCLinkToArticle and JRCLinkToUser
5
- * @member id number : id of the record
6
- * @member href string : href for href
7
- * @member children: enclosed React component
5
+ * @member idObject number : id of the record
8
6
  */
9
- export interface JRCLinkToProps extends JRCStyledHrefProps {
7
+ export declare type JRCLinkToProps = DataCy & React.ComponentPropsWithoutRef<'a'> & {
10
8
  idObject?: number;
11
- href?: string;
12
- children: React.ReactNode;
13
- }
9
+ };
10
+ declare type AnchorProps = {
11
+ as?: 'a';
12
+ };
13
+ declare type ButtonProps = {
14
+ variant?: 'contained' | 'outlined';
15
+ color?: 'primary' | 'valid' | 'danger' | 'secondary';
16
+ float?: 'left' | 'right';
17
+ children?: React.ReactNode;
18
+ } & {
19
+ as: 'button';
20
+ };
14
21
  /**
15
22
  * Props type for JRCStyledHref
16
- * @see HTML.a default props
23
+ * @member as render the link styled as a button
17
24
  */
18
- export declare type JRCStyledHrefProps = DataCy & React.ComponentPropsWithoutRef<'a'>;
19
- export declare const JRCStyledHref: import("styled-components").StyledComponent<"a", any, {}, never>;
25
+ export declare type JRCStyledHrefProps = DataCy & React.ComponentPropsWithoutRef<'a'> & (AnchorProps | ButtonProps);
26
+ export declare const JRCStyledHref: (props: JRCStyledHrefProps) => JSX.Element;
20
27
  export declare const JRCLinkToArticle: ({ idObject, href, children, ...props }: JRCLinkToProps) => JSX.Element;
21
28
  export declare const JRCLinkToUser: ({ idObject, href, children, ...props }: JRCLinkToProps) => JSX.Element;
29
+ export {};
@@ -39,10 +39,10 @@ export declare type ImgUrlProps = {
39
39
  format?: string;
40
40
  timestamp?: string | number;
41
41
  };
42
- export declare function getFrom(arg: Pick<ImgUrlProps, 'from'>): string | undefined;
42
+ export declare function getFrom(arg: Pick<ImgUrlProps, 'from'>): string;
43
43
  export declare function getTimestamp(arg: Timestamp): string;
44
44
  export declare function getUri(arg: UriOrTypeId): string;
45
- export declare function getSize(arg: Size & WidthHeight): string;
45
+ export declare function getSize(arg: Size & WidthHeight, dpr?: number): string;
46
46
  export declare function getFormat(arg: Format): string;
47
47
  export declare function getUrl(url: string): URL | undefined;
48
48
  /**
@@ -58,5 +58,5 @@ export declare function getUrl(url: string): URL | undefined;
58
58
  * The final url is {from}/{size}/{uri}.{format}?_={timestamp}
59
59
  * @param arg
60
60
  */
61
- export declare function formatImgUrl(arg: ImgUrlProps): string;
61
+ export declare function formatImgUrl(arg: ImgUrlProps, dpr?: number): string;
62
62
  export {};
@@ -6,6 +6,7 @@ import type { Orders } from 'jamespot-user-api';
6
6
  * @member data default react-table data props
7
7
  * @member eventHandlers event handlers: onDrag, onSort and onPage. You Must rearrange the array of data when these events are dispatched
8
8
  * @member config config object. See the Type for use
9
+ * @member className className
9
10
  */
10
11
  export declare type JRCListProps<T extends Record<string, unknown>> = {
11
12
  columns: Array<Column<T>>;
@@ -26,5 +27,6 @@ export declare type JRCListProps<T extends Record<string, unknown>> = {
26
27
  nbResults: number;
27
28
  };
28
29
  };
30
+ className?: string;
29
31
  };
30
32
  export declare const JRCList: <T extends Record<string, unknown>>(props: JRCListProps<T>) => JSX.Element;
@@ -23,6 +23,8 @@ export interface JRCModalButtonType extends ComponentPropsWithoutRef<'button'> {
23
23
  * @member enableClickAwayCloseModal boolean to enable the close of the Modal by Click Outside of Modal
24
24
  * @member children default ReactNode children in the Modal content
25
25
  * @member portalId id attribute for createPortal
26
+ * @member inPlace if true, does not use a portal
27
+ * @member className use for overriding the styled-components styles
26
28
  */
27
29
  export interface JRCModalProps {
28
30
  open: boolean;
@@ -35,6 +37,8 @@ export interface JRCModalProps {
35
37
  isFull?: boolean;
36
38
  headerButtons?: ReactNode;
37
39
  portalId?: string;
40
+ inPlace?: boolean;
41
+ className?: string;
38
42
  }
39
- declare const JRCModal: ({ open, closeHandler, buttons, children, title, showIconClose, enableClickAwayCloseModal, isFull, headerButtons, portalId, }: JRCModalProps) => React.ReactPortal | null;
43
+ declare const JRCModal: React.ForwardRefExoticComponent<JRCModalProps & React.RefAttributes<HTMLDivElement>>;
40
44
  export default JRCModal;
@@ -4,6 +4,5 @@ export declare const JRCModalContainer: import("styled-components").StyledCompon
4
4
  export declare const JRCModalContent: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const JRCModalContentScrollbox: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export declare const JRCModalHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
7
- export declare const JRCModalHeaderTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
8
7
  export declare const JRCModalFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
9
8
  export declare const JRCModalClose: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -13,6 +13,7 @@ import { UriOrTypeId } from 'components/Form/Common/types';
13
13
  * @member focusable - whether the element is focusable. Independant of onClick property
14
14
  * @member isFocused - whether the element is focused. Property used with variant for styling the component
15
15
  * @member tooltipDescription - if present, show a tooltip with the description
16
+ * @member clickVariant - whether the hover/focus style is a selectable item or a deletable item
16
17
  */
17
18
  export declare type JRCTagProps<T> = UriOrTypeId & {
18
19
  collapsed?: boolean;
@@ -25,5 +26,6 @@ export declare type JRCTagProps<T> = UriOrTypeId & {
25
26
  isFocused?: boolean;
26
27
  tooltipDescription?: string;
27
28
  alt?: string;
29
+ clickVariant?: 'select' | 'delete';
28
30
  };
29
31
  export declare function JRCTag<T>(props: JRCTagProps<T>): JSX.Element;
@@ -1,3 +1,2 @@
1
1
  import { DependencyList } from 'react';
2
- declare const useDidMountEffect: (func: Function, deps: DependencyList) => void;
3
- export default useDidMountEffect;
2
+ export declare const useDidMountEffect: (func: Function, deps: DependencyList) => void;
@@ -3,6 +3,8 @@
3
3
  */
4
4
  declare global {
5
5
  interface Window {
6
+ React: any;
7
+ ReactDOM: any;
6
8
  jamespotUserApi: any;
7
9
  reactRedux: any;
8
10
  redux: any;
@@ -45,6 +47,7 @@ import JRCColumnRight from './components/JRCColumnRight/JRCColumnRight';
45
47
  export { JRCColumnRight };
46
48
  export { JRCConditionalWrapper } from './components/Common/JRCConditionalWrapper';
47
49
  export { JRCDate } from './components/JRCDate/JRCDate';
50
+ export { JRCEllipsis } from './components/JRCEllipsis/JRCEllipsis';
48
51
  export { JRCFormCheckbox } from './components/Form/Input/JRCFormCheckbox/JRCFormCheckbox';
49
52
  export { JRCFormColorField } from './components/Form/Input/JRCFormColor/JRCFormColor';
50
53
  export { JRCFormDatetimeField } from './components/Form/Input/JRCFormDateTime/JRCFormDateTime';
@@ -94,13 +97,11 @@ export { JRCH1, JRCH2, JRCH3, JRCH4, JRCH5, JRCText };
94
97
  import { JRCTypography } from './components/JRCTypography/JRCTypography';
95
98
  export { JRCTypography };
96
99
  export { JRCValidationButton } from './components/JRCButton/JRCValidationButton';
97
- import Theme from './styles/theme';
98
- export { Theme };
99
- import Resources from './translation';
100
+ export { default as Theme } from './styles/theme';
101
+ export { default as Resources } from './translation';
100
102
  export { useTimeout } from './hooks/UseTimeout';
101
103
  export { useDebounce } from './hooks/UseDebounce';
102
- export { default as useDidMountEffect } from './hooks/UseDidMountEffect';
103
- export { Resources };
104
+ export { useDidMountEffect } from './hooks/UseDidMountEffect';
104
105
  export { StyledInput } from './components/Form/Input/JRCStyledInput';
105
106
  export { JRCInputCheckbox } from './components/Form/Input/JRCInputCheckbox/JRCInputCheckbox';
106
107
  export { JRCInputEmail } from './components/Form/Input/JRCFormEmail/JRCInputEmail';
@@ -108,6 +109,8 @@ export { JRCInputSelect } from './components/Form/Input/JRCSelect/JRCInputSelect
108
109
  export { JRCInputAutocomplete } from './components/Form/Input/JRCSelect/JRCInputAutocomplete';
109
110
  export { JRCInputCommunity } from './components/Form/Input/JRCSelect/JRCAutocompleteCommunity';
110
111
  export { JRCInputText } from './components/Form/Input/JRCInputText/JRCInputText';
112
+ export { JRCInputTextarea } from './components/Form/Input/JRCInputTextarea/JRCInputTextarea';
113
+ export { JRCInputDate } from './components/Form/Input/JRCInputDate/JRCInputDate';
111
114
  /****
112
115
  *
113
116
  * PLEASE RESPECT ALPHABETICAL ORDER
@@ -30,6 +30,7 @@ export declare type FontWeight = {
30
30
  bold: number;
31
31
  };
32
32
  export declare type ThemeType = {
33
+ dpr: number;
33
34
  font: {
34
35
  family: string;
35
36
  color: string;
@@ -39,6 +39,7 @@ import { JRCColumnRightProps } from './components/JRCColumnRight/JRCColumnRight'
39
39
  export { JRCColumnRightProps };
40
40
  export { JRCDateProps } from './components/JRCDate/JRCDate';
41
41
  export { JRCDropDownProps } from './components/JRCDropDown/JRCDropDown';
42
+ export { JRCEllipsisProps } from './components/JRCEllipsis/JRCEllipsis';
42
43
  export { JRCFileOpenProps } from './components/JRCFileOpen/JRCFileOpen';
43
44
  import { JRCGridProps } from './components/JRCGrid/JRCGrid';
44
45
  export { JRCGridProps };
@@ -80,6 +81,9 @@ import { JRCTypographyProps } from './components/JRCTypography/JRCTypography.d';
80
81
  export { JRCTypographyProps };
81
82
  export { JRCValidationButtonProps } from './components/JRCButton/JRCValidationButton';
82
83
  export * from './components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.types';
84
+ export { JRCInputDateProps } from './components/Form/Input/JRCInputDate/JRCInputDate';
85
+ export { JRCInputTextProps } from './components/Form/Input/JRCInputText/JRCInputText';
86
+ export { JRCInputTextareaProps } from './components/Form/Input/JRCInputTextarea/JRCInputTextarea';
83
87
  export { JRCInputFieldProps } from './components/Form/Input/Common/JRCFormFieldRenderer.types';
84
88
  export { JRCInputSelectProps } from './components/Form/Input/JRCSelect/JRCInputSelect.types';
85
89
  export { JRCAutocompleteProps } from './components/Form/Input/JRCSelect/JRCInputSelect.types';
package/externals.json CHANGED
@@ -11,5 +11,6 @@
11
11
  "react-intl": "reactIntl",
12
12
  "styled-components": "styledComponents",
13
13
  "react-dnd": "reactDnd",
14
- "react-dnd-html5-backend": "reactDndHtml5Backend"
14
+ "react-dnd-html5-backend": "reactDndHtml5Backend",
15
+ "jamespot-react-core": "ReactCore"
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-components",
3
- "version": "1.0.3",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "./build/jamespot-react-components.js",
6
6
  "types": "./build/src/index.d.ts",
@@ -96,7 +96,7 @@
96
96
  "@types/redux-logger": "^3.0.8",
97
97
  "chroma-js": "^2.1.1",
98
98
  "classnames": "^2.3.1",
99
- "jamespot-user-api": "file:../jamespot-user-api",
99
+ "jamespot-user-api": "1.0.13",
100
100
  "moment": "^2.29.1",
101
101
  "react": "^17.x",
102
102
  "react-dnd": "^14.0.4",
@@ -2,18 +2,11 @@ import * as React from 'react';
2
2
 
3
3
  export interface JRCConditionalWrapperProps {
4
4
  condition: boolean;
5
- wrapper: (children: React.ReactNode) => React.ReactElement;
6
- wrapperFalse?: (children: React.ReactNode) => React.ReactElement;
7
- children?: React.ReactElement;
5
+ wrapper: (children: React.ReactNode) => React.ReactNode;
6
+ wrapperFalse?: (children: React.ReactNode) => React.ReactNode;
7
+ children?: React.ReactNode;
8
8
  }
9
9
 
10
- export const JRCConditionalWrapper = ({
11
- condition,
12
- wrapper,
13
- wrapperFalse,
14
- children,
15
- }: JRCConditionalWrapperProps): React.ReactElement =>
16
- // FIXME TYPESCRIPT-STRICT
17
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
18
- // @ts-ignore
19
- condition ? wrapper(children) : wrapperFalse ? wrapperFalse(children) : children;
10
+ export const JRCConditionalWrapper = ({ condition, wrapper, wrapperFalse, children }: JRCConditionalWrapperProps) => (
11
+ <>{condition ? wrapper(children) : wrapperFalse ? wrapperFalse(children) : children}</>
12
+ );
@@ -8,32 +8,32 @@ import { ClickAwayListener } from '../../Common/ClickAwayListener';
8
8
 
9
9
  const StyledInputColor = styled.input.attrs(() => ({ type: 'color' }))<FormInputProps>`
10
10
  &&& {
11
- padding: 8px;
12
- margin: 0px;
13
11
  width: 40px;
14
12
  height: 40px;
13
+ border: none;
14
+ padding: 0;
15
+ margin: 0;
15
16
  cursor: pointer;
16
- border-radius: 4px;
17
- text-align: center;
17
+ border-radius: 8px;
18
18
  box-sizing: border-box;
19
19
  ::-webkit-color-swatch {
20
20
  border-color: transparent;
21
+ border: none;
21
22
  }
22
23
  ::-moz-color-swatch {
23
24
  border-color: transparent;
25
+ border: none;
26
+ }
27
+ ::-webkit-color-swatch-wrapper {
28
+ padding: 0;
24
29
  }
25
30
  }
26
31
  `;
27
32
 
28
33
  const Container = styled.div`
29
- display: flex;
30
- flex: 1;
31
- flex-direction: row;
32
- justify-content: flex-start;
33
- align-items: center;
34
- margin: 0px;
35
- padding: 5px;
36
- border-radius: 4px;
34
+ display: inline-flex;
35
+ border-radius: 8px;
36
+ overflow: hidden;
37
37
  `;
38
38
 
39
39
  const JRCFormColorFieldRender = (input: WrappedFieldInputProps, props: JRCWritableFormInputProps) => {
@@ -2,15 +2,11 @@ import * as React from 'react';
2
2
  import { StyledInput } from '../JRCStyledInput';
3
3
  import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
4
4
  import { JRCFormFieldRenderer } from '../Common/JRCFormFieldRenderer';
5
+ import { JRCInputTextProps } from '../JRCInputText/JRCInputText';
5
6
 
6
- const RenderInput = React.forwardRef(
7
- // FIXME TYPESCRIPT-STRICT
8
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9
- // @ts-ignore
10
- (props: React.ComponentPropsWithoutRef<'input'>, ref: React.RefCallback<HTMLInputElement>) => {
11
- return <StyledInput type="text" id={props.name} {...props} ref={ref} />;
12
- },
13
- );
7
+ const RenderInput = React.forwardRef((props: JRCInputTextProps, ref: React.ForwardedRef<HTMLInputElement>) => {
8
+ return <StyledInput type="text" id={props.name} {...props} ref={ref} />;
9
+ });
14
10
 
15
11
  /**
16
12
  * Component used as a <input type="text"/>
@@ -150,7 +150,11 @@ export const JRCFormSelectInput = (props: any) => {
150
150
  const intl = useIntl();
151
151
  const { selectedOption, onInputChange, components, placeholder, options, ...otherProps } = props;
152
152
 
153
- const [loadedOptions, setLoadedOptions] = React.useState(options);
153
+ const [loadedOptions, setLoadedOptions] = React.useState([]);
154
+
155
+ React.useEffect(() => {
156
+ if (!props.asyncPromise) setLoadedOptions(options);
157
+ }, [options]);
154
158
 
155
159
  React.useEffect(() => {
156
160
  if (props.frontFiltering && props.asyncPromise) {
@@ -49,6 +49,7 @@ const JRCFormSelectTagRenderer = <T,>(
49
49
  onMouseDown={props.removeProps.onMouseDown}
50
50
  onClick={(e) => props.removeProps.onClick(e)}
51
51
  focusable={true}
52
+ clickVariant="delete"
52
53
  isFocused={props.isFocused}
53
54
  uri={props.data.uri}
54
55
  label={getOptionLabel(props)}
@@ -60,7 +61,7 @@ const JRCFormSelectTagRenderer = <T,>(
60
61
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61
62
  // @ts-ignore
62
63
  SingleValue: (props: SingleValueProps<OptionTypeBase>) => (
63
- <JRCTag uri={props.data.uri} label={getOptionLabel(props)} />
64
+ <JRCTag uri={props.data.uri} label={getOptionLabel(props)} clickVariant="delete" />
64
65
  ),
65
66
  // FIXME TYPESCRIPT-STRICT
66
67
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -88,6 +89,7 @@ const Option = <isMulti extends boolean>(props: OptionProps<OptionTypeBase, isMu
88
89
  <JRCTag
89
90
  uri={props.data.uri}
90
91
  focusable={true}
92
+ clickVariant="select"
91
93
  isFocused={props.isFocused}
92
94
  label={getOptionLabel(props)}
93
95
  />
@@ -13,7 +13,7 @@ export default {
13
13
  const Template: Story<JRCInputCheckboxProps<any>> = (args) => {
14
14
  const { handleSubmit, control } = useForm({
15
15
  defaultValues: {
16
- [args.name]: [],
16
+ checkbox: [],
17
17
  },
18
18
  criteriaMode: 'all',
19
19
  });
@@ -23,9 +23,6 @@ const Template: Story<JRCInputCheckboxProps<any>> = (args) => {
23
23
  };
24
24
 
25
25
  return (
26
- // FIXME TYPESCRIPT-STRICT
27
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
- // @ts-ignore
29
26
  <form onSubmit={handleSubmit(onSubmit)}>
30
27
  <JRCInputCheckbox {...args} control={control as any} />
31
28
  <input type="submit" />
@@ -12,12 +12,11 @@ import { deepEqual } from '../../../../utils/utils.object';
12
12
  import { DataCy } from '../../../../types/dataAttributes';
13
13
  import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
14
14
  import { CheckboxValue } from './JRCInputCheckbox.types';
15
-
16
- type Value<T> = string | number | T;
15
+ import { RefCallBack } from 'react-hook-form';
17
16
 
18
17
  type CheckboxOption<TFieldValues> = {
19
18
  label: string | JSX.Element;
20
- value: Value<TFieldValues>;
19
+ value: string | number | TFieldValues;
21
20
  disabled?: boolean;
22
21
  };
23
22
 
@@ -35,18 +34,19 @@ export type CheckboxProps<TFieldValues> = DataCy & {
35
34
  };
36
35
 
37
36
  export type JRCInputCheckboxProps<TFieldValues> = CheckboxProps<TFieldValues> & JRCInputFieldProps<TFieldValues>;
37
+ export type NativeCheckboxProps<TFieldValues> = CheckboxProps<TFieldValues> &
38
+ Omit<ControllerRenderProps<TFieldValues>, 'value'> & { value: TFieldValues | TFieldValues[] };
38
39
 
39
- function RenderInput<TFieldValues>({
40
- variant = 'default',
41
- ...props
42
- }: CheckboxProps<TFieldValues> &
43
- Omit<ControllerRenderProps<TFieldValues>, 'value'> & { value: TFieldValues | TFieldValues[] }) {
40
+ const RenderInput = React.forwardRef(function <TFieldValues>(
41
+ { variant = 'default', ...props }: NativeCheckboxProps<TFieldValues>,
42
+ ref: React.ForwardedRef<HTMLInputElement>,
43
+ ) {
44
44
  const field = {
45
45
  onChange: props.onChange,
46
46
  onBlur: props.onBlur,
47
47
  value: props.value,
48
48
  name: props.name,
49
- ref: props.ref,
49
+ ref: ref as RefCallBack,
50
50
  };
51
51
 
52
52
  const [valueTypeIsBoolean, setValueTypeIsBoolean] = React.useState(
@@ -98,6 +98,7 @@ function RenderInput<TFieldValues>({
98
98
  {props.checkboxMode === 'radio' ? (
99
99
  <JRCRadio
100
100
  name={props.name}
101
+ ref={(index === 0 && ref) || undefined}
101
102
  data-cy={props.dataCy && `${props.dataCy}-option-${index}`}
102
103
  disabled={props.disabled || option.disabled}
103
104
  checked={checked}
@@ -109,6 +110,7 @@ function RenderInput<TFieldValues>({
109
110
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
110
111
  // @ts-ignore
111
112
  checkboxMode={props.checkboxMode}
113
+ ref={(index === 0 && ref) || undefined}
112
114
  name={props.name}
113
115
  data-cy={props.dataCy && `${props.dataCy}-option-${index}`}
114
116
  disabled={props.disabled || option.disabled}
@@ -147,7 +149,7 @@ function RenderInput<TFieldValues>({
147
149
  })}
148
150
  </DirectionContainer>
149
151
  );
150
- }
152
+ }) as unknown as <T>(props: NativeCheckboxProps<T>) => JSX.Element;
151
153
 
152
154
  export function JRCInputCheckbox<TFieldValues>({
153
155
  name,