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.
- package/build/jamespot-react-components.js +208 -192
- package/build/jamespot-react-components.js.map +1 -1
- package/build/src/components/Common/JRCConditionalWrapper.d.ts +4 -4
- package/build/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.d.ts +5 -2
- package/build/src/components/Form/Input/JRCInputDate/JRCInputDate.d.ts +11 -0
- package/build/src/components/Form/Input/JRCInputDate/JRCInputDate.stories.d.ts +5 -0
- package/build/src/components/Form/Input/JRCInputText/JRCInputText.d.ts +1 -1
- package/build/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.d.ts +15 -0
- package/build/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.stories.d.ts +5 -0
- package/build/src/components/JRCButton/JRCButton.d.ts +25 -0
- package/build/src/components/JRCButton/JRCButtonConfig.d.ts +1 -2
- package/build/src/components/JRCEllipsis/JRCEllipsis.d.ts +5 -0
- package/build/src/components/JRCEllipsis/JRCEllipsis.stories.d.ts +5 -0
- package/build/src/components/JRCHref/JRCHref.d.ts +18 -10
- package/build/src/components/JRCImg/url.util.d.ts +3 -3
- package/build/src/components/JRCList/JRCList.d.ts +2 -0
- package/build/src/components/JRCModal/JRCModal.d.ts +5 -1
- package/build/src/components/JRCModal/JRCModal.styles.d.ts +0 -1
- package/build/src/components/JRCTag/JRCTag.d.ts +2 -0
- package/build/src/hooks/UseDidMountEffect.d.ts +1 -2
- package/build/src/index.d.ts +8 -5
- package/build/src/styles/theme.d.ts +1 -0
- package/build/src/types.d.ts +4 -0
- package/externals.json +2 -1
- package/package.json +2 -2
- package/src/components/Common/JRCConditionalWrapper.tsx +6 -13
- package/src/components/Form/Input/JRCFormColor/JRCFormColor.tsx +12 -12
- package/src/components/Form/Input/JRCFormEmail/JRCInputEmail.tsx +4 -8
- package/src/components/Form/Input/JRCFormSelect/JRCFormSelect.tsx +5 -1
- package/src/components/Form/Input/JRCFormSelect/JRCFormSelectTag.tsx +3 -1
- package/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.stories.tsx +1 -4
- package/src/components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.tsx +12 -10
- package/src/components/Form/Input/JRCInputDate/JRCInputDate.stories.tsx +50 -0
- package/src/components/Form/Input/JRCInputDate/JRCInputDate.tsx +26 -0
- package/src/components/Form/Input/JRCInputText/JRCInputText.tsx +2 -2
- package/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.stories.tsx +52 -0
- package/src/components/Form/Input/JRCInputTextarea/JRCInputTextarea.tsx +36 -0
- package/src/components/Form/Input/JRCSelect/JRCInputSelect.tsx +1 -1
- package/src/components/JRCButton/JRCButton.stories.tsx +1 -1
- package/src/components/JRCButton/JRCButton.tsx +9 -3
- package/src/components/JRCButton/JRCButtonConfig.tsx +1 -1
- package/src/components/JRCButton/JRCValidationButton.tsx +10 -4
- package/src/components/JRCButtonDropdown/JRCButtonDropdown.tsx +2 -2
- package/src/components/JRCEllipsis/JRCEllipsis.stories.tsx +18 -0
- package/src/components/JRCEllipsis/JRCEllipsis.tsx +22 -0
- package/src/components/JRCHref/JRCHref.stories.tsx +2 -0
- package/src/components/JRCHref/JRCHref.tsx +42 -15
- package/src/components/JRCIcon/JRCIcon.tsx +1 -1
- package/src/components/JRCIconButton/JRCIconButton.tsx +1 -4
- package/src/components/JRCImg/JRCImg.tsx +4 -2
- package/src/components/JRCImg/url.util.ts +7 -6
- package/src/components/JRCImg/url.utils.test.ts +7 -1
- package/src/components/JRCList/JRCList.styles.tsx +16 -2
- package/src/components/JRCList/JRCList.tsx +5 -5
- package/src/components/JRCList/JRCListMockData.stories.tsx +1 -1
- package/src/components/JRCModal/JRCModal.styles.tsx +0 -6
- package/src/components/JRCModal/JRCModal.tsx +77 -62
- package/src/components/JRCTag/JRCTag.tsx +29 -9
- package/src/components/JRCThemeProvider/animation.css +19 -0
- package/src/components/JRCThemeProvider/gabarit.css +4 -0
- package/src/components/JRCTooltip/JRCTooltip.tsx +5 -2
- package/src/hooks/UseDidMountEffect.tsx +1 -3
- package/src/index.tsx +9 -5
- package/src/styles/theme.tsx +3 -2
- package/src/translation/lang.json +3 -2
- package/src/types.ts +4 -0
- package/src/variables.scss +0 -67
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useTable, usePagination, useSortBy, UseSortByColumnProps, HeaderGroup, Column, Row, Cell } from 'react-table';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
4
|
import JRCPagination from '../JRCPagination/JRCPagination';
|
|
5
|
-
import useDidMountEffect from '../../hooks/UseDidMountEffect';
|
|
5
|
+
import { useDidMountEffect } from '../../hooks/UseDidMountEffect';
|
|
6
6
|
import JRCIcon from '../JRCIcon/JRCIcon';
|
|
7
7
|
|
|
8
8
|
import {
|
|
@@ -25,6 +25,7 @@ import type { Orders } from 'jamespot-user-api';
|
|
|
25
25
|
* @member data default react-table data props
|
|
26
26
|
* @member eventHandlers event handlers: onDrag, onSort and onPage. You Must rearrange the array of data when these events are dispatched
|
|
27
27
|
* @member config config object. See the Type for use
|
|
28
|
+
* @member className className
|
|
28
29
|
*/
|
|
29
30
|
export type JRCListProps<T extends Record<string, unknown>> = {
|
|
30
31
|
columns: Array<Column<T>>;
|
|
@@ -45,6 +46,7 @@ export type JRCListProps<T extends Record<string, unknown>> = {
|
|
|
45
46
|
nbResults: number;
|
|
46
47
|
};
|
|
47
48
|
};
|
|
49
|
+
className?: string;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export const JRCList = <T extends Record<string, unknown>>(props: JRCListProps<T>) => {
|
|
@@ -133,7 +135,7 @@ export const JRCList = <T extends Record<string, unknown>>(props: JRCListProps<T
|
|
|
133
135
|
|
|
134
136
|
return (
|
|
135
137
|
<React.Fragment>
|
|
136
|
-
<Table {...getTableProps()}>
|
|
138
|
+
<Table {...getTableProps()} className={props.className}>
|
|
137
139
|
<Thead>
|
|
138
140
|
{headerGroups.map((headerGroup) => (
|
|
139
141
|
<Tr {...headerGroup.getHeaderGroupProps()}>
|
|
@@ -162,9 +164,7 @@ export const JRCList = <T extends Record<string, unknown>>(props: JRCListProps<T
|
|
|
162
164
|
<TBody {...getTableBodyProps()}>
|
|
163
165
|
<DraggableTBody draggable={props.config.draggable}>
|
|
164
166
|
{rows.map((row: Row<T>, index: number): any => {
|
|
165
|
-
|
|
166
|
-
prepareRow(row);
|
|
167
|
-
}
|
|
167
|
+
prepareRow(row);
|
|
168
168
|
return (
|
|
169
169
|
<DraggableTr
|
|
170
170
|
index={index}
|
|
@@ -83,7 +83,7 @@ const Template: Story<never> = (/*args: JRCListProps<MyData>*/) => {
|
|
|
83
83
|
limit: config.pagination.perPage,
|
|
84
84
|
orders,
|
|
85
85
|
};
|
|
86
|
-
jamespot.
|
|
86
|
+
jamespot.bookmark.getList(args).then((res: any) => {
|
|
87
87
|
setData(res.data);
|
|
88
88
|
setConfig({
|
|
89
89
|
...config,
|
|
@@ -63,12 +63,6 @@ export const JRCModalHeader = styled.div`
|
|
|
63
63
|
justify-content: space-between;
|
|
64
64
|
`;
|
|
65
65
|
|
|
66
|
-
export const JRCModalHeaderTitle = styled.div`
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: row;
|
|
69
|
-
flex: 1;
|
|
70
|
-
`;
|
|
71
|
-
|
|
72
66
|
export const JRCModalFooter = styled.div`
|
|
73
67
|
flex-shrink: 0;
|
|
74
68
|
display: flex;
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
JRCModalContainerFull,
|
|
10
10
|
JRCModalContent,
|
|
11
11
|
JRCModalHeader,
|
|
12
|
-
JRCModalHeaderTitle,
|
|
13
12
|
JRCModalFooter,
|
|
14
13
|
JRCModalClose,
|
|
15
14
|
} from './JRCModal.styles';
|
|
@@ -40,6 +39,8 @@ export interface JRCModalButtonType extends ComponentPropsWithoutRef<'button'> {
|
|
|
40
39
|
* @member enableClickAwayCloseModal boolean to enable the close of the Modal by Click Outside of Modal
|
|
41
40
|
* @member children default ReactNode children in the Modal content
|
|
42
41
|
* @member portalId id attribute for createPortal
|
|
42
|
+
* @member inPlace if true, does not use a portal
|
|
43
|
+
* @member className use for overriding the styled-components styles
|
|
43
44
|
*/
|
|
44
45
|
export interface JRCModalProps {
|
|
45
46
|
open: boolean;
|
|
@@ -52,6 +53,8 @@ export interface JRCModalProps {
|
|
|
52
53
|
isFull?: boolean;
|
|
53
54
|
headerButtons?: ReactNode;
|
|
54
55
|
portalId?: string;
|
|
56
|
+
inPlace?: boolean;
|
|
57
|
+
className?: string;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
type MouseEvents = 'click' | 'mousedown' | 'mouseup';
|
|
@@ -90,7 +93,9 @@ const JRCModalContainerClickAway = ({
|
|
|
90
93
|
return React.createElement(props.isFull ? JRCModalContainerFull : JRCModalContainer, { ref: node, ...props });
|
|
91
94
|
};
|
|
92
95
|
|
|
93
|
-
const JRCModal = (
|
|
96
|
+
const JRCModal = React.forwardRef(
|
|
97
|
+
(
|
|
98
|
+
{
|
|
94
99
|
open,
|
|
95
100
|
closeHandler,
|
|
96
101
|
buttons,
|
|
@@ -101,8 +106,11 @@ const JRCModal = ({
|
|
|
101
106
|
isFull,
|
|
102
107
|
headerButtons,
|
|
103
108
|
portalId = 'react-modal',
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
inPlace = false,
|
|
110
|
+
className,
|
|
111
|
+
}: JRCModalProps,
|
|
112
|
+
ref: React.ForwardedRef<HTMLDivElement>,
|
|
113
|
+
) => {
|
|
106
114
|
|
|
107
115
|
const closeModal = () => {
|
|
108
116
|
closeHandler();
|
|
@@ -111,14 +119,11 @@ const JRCModal = ({
|
|
|
111
119
|
const escapeHandler = (e: React.KeyboardEvent) => {
|
|
112
120
|
if (e.key == 'Escape') closeHandler();
|
|
113
121
|
};
|
|
114
|
-
const dummyVoid = (): undefined => {
|
|
115
|
-
return undefined;
|
|
116
|
-
};
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
const handleClickAway = (event: any) => {
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
closeHandler();
|
|
126
|
+
};
|
|
122
127
|
|
|
123
128
|
const getClickHandlerList = () => {
|
|
124
129
|
const handlerList: (() => void)[] = [];
|
|
@@ -127,63 +132,73 @@ const JRCModal = ({
|
|
|
127
132
|
if (button.isClosed == undefined || !button.isClosed)
|
|
128
133
|
handlerList.push(() => {
|
|
129
134
|
closeHandler();
|
|
130
|
-
button.clickHandler != undefined
|
|
135
|
+
button.clickHandler != undefined && button.clickHandler();
|
|
131
136
|
});
|
|
132
137
|
else
|
|
133
138
|
handlerList.push(() => {
|
|
134
|
-
|
|
139
|
+
/* dummy void */
|
|
135
140
|
});
|
|
136
141
|
});
|
|
137
142
|
}
|
|
138
143
|
return handlerList;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const ModalBox =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const displayHeaderButtons = headerButtons ? headerButtons : null;
|
|
147
|
+
const clickHandlerList = getClickHandlerList();
|
|
148
|
+
const portalDiv = document.getElementById(portalId);
|
|
149
|
+
|
|
150
|
+
const ModalBox = () => (
|
|
151
|
+
<JRCModalBox onKeyDown={(e) => escapeHandler(e)} tabIndex={0} ref={ref} className={className}>
|
|
152
|
+
<JRCModalContainerClickAway
|
|
153
|
+
className="modal-container"
|
|
154
|
+
onClickAway={enableClickAwayCloseModal ? handleClickAway : undefined}
|
|
155
|
+
isFull={isFull}>
|
|
156
|
+
{(title || showIconClose) && (
|
|
157
|
+
<JRCModalHeader className={'modal-header'}>
|
|
158
|
+
{title && <JRCH3>{title}</JRCH3>}
|
|
159
|
+
{displayHeaderButtons}
|
|
160
|
+
{showIconClose && (
|
|
161
|
+
<JRCModalClose>
|
|
162
|
+
<JRCIconButton icon="icon-times" onClick={closeModal} />
|
|
163
|
+
</JRCModalClose>
|
|
164
|
+
)}
|
|
165
|
+
</JRCModalHeader>
|
|
166
|
+
)}
|
|
167
|
+
|
|
168
|
+
<JRCModalContent className="modal-content">{children}</JRCModalContent>
|
|
169
|
+
|
|
170
|
+
{buttons ? (
|
|
171
|
+
<JRCModalFooter>
|
|
172
|
+
{buttons.map((button: JRCModalButtonType, index: number) => (
|
|
173
|
+
<JRCButton
|
|
174
|
+
key={index}
|
|
175
|
+
color={button.color}
|
|
176
|
+
variant={button.variant}
|
|
177
|
+
onClick={button.isClosed ? closeModal : clickHandlerList[index]}>
|
|
178
|
+
{button.children}
|
|
179
|
+
</JRCButton>
|
|
180
|
+
))}
|
|
181
|
+
</JRCModalFooter>
|
|
182
|
+
) : null}
|
|
183
|
+
</JRCModalContainerClickAway>
|
|
184
|
+
</JRCModalBox>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
if (open) {
|
|
188
|
+
if (inPlace) {
|
|
189
|
+
return <ModalBox />;
|
|
190
|
+
} else if (portalDiv) {
|
|
191
|
+
// when using a portal, we need to provide the Theme explicitely
|
|
192
|
+
return ReactDOM.createPortal(
|
|
193
|
+
<JRCThemeProvider>
|
|
194
|
+
<ModalBox />
|
|
195
|
+
</JRCThemeProvider>,
|
|
196
|
+
portalDiv,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
);
|
|
188
203
|
|
|
189
204
|
export default JRCModal;
|
|
@@ -19,6 +19,7 @@ import JRCTooltip from '../JRCTooltip/JRCTooltip';
|
|
|
19
19
|
* @member focusable - whether the element is focusable. Independant of onClick property
|
|
20
20
|
* @member isFocused - whether the element is focused. Property used with variant for styling the component
|
|
21
21
|
* @member tooltipDescription - if present, show a tooltip with the description
|
|
22
|
+
* @member clickVariant - whether the hover/focus style is a selectable item or a deletable item
|
|
22
23
|
*/
|
|
23
24
|
export type JRCTagProps<T> = UriOrTypeId & {
|
|
24
25
|
collapsed?: boolean;
|
|
@@ -31,9 +32,10 @@ export type JRCTagProps<T> = UriOrTypeId & {
|
|
|
31
32
|
isFocused?: boolean;
|
|
32
33
|
tooltipDescription?: string;
|
|
33
34
|
alt?: string;
|
|
35
|
+
clickVariant?: 'select' | 'delete';
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
const TagWrapper = styled.div<{ focusable: boolean; isFocused: boolean }>`
|
|
38
|
+
const TagWrapper = styled.div<{ focusable: boolean; isFocused: boolean; clickVariant: 'select' | 'delete' }>`
|
|
37
39
|
position: relative;
|
|
38
40
|
display: inline-flex;
|
|
39
41
|
align-items: center;
|
|
@@ -44,16 +46,16 @@ const TagWrapper = styled.div<{ focusable: boolean; isFocused: boolean }>`
|
|
|
44
46
|
cursor: ${(props) => (props.focusable ? 'pointer' : 'default')};
|
|
45
47
|
background-color: ${(props) => {
|
|
46
48
|
if (props.focusable && props.isFocused) {
|
|
47
|
-
return props.theme.color.
|
|
49
|
+
return props.theme.color[config[props.clickVariant].hoverBGColor];
|
|
48
50
|
} else {
|
|
49
|
-
return props.theme.color.
|
|
51
|
+
return props.theme.color[config[props.clickVariant].backgroundColor];
|
|
50
52
|
}
|
|
51
53
|
}};
|
|
52
54
|
color: ${(props) => {
|
|
53
55
|
if (props.focusable && props.isFocused) {
|
|
54
|
-
return props.theme.color.
|
|
56
|
+
return props.theme.color[config[props.clickVariant].hoverColor];
|
|
55
57
|
} else {
|
|
56
|
-
return props.theme.color.
|
|
58
|
+
return props.theme.color[config[props.clickVariant].color];
|
|
57
59
|
}
|
|
58
60
|
}};
|
|
59
61
|
|
|
@@ -72,14 +74,15 @@ const TagWrapper = styled.div<{ focusable: boolean; isFocused: boolean }>`
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
:hover {
|
|
75
|
-
${(props) =>
|
|
76
|
-
|
|
77
|
+
${(props) =>
|
|
78
|
+
props.focusable && `background-color: ${props.theme.color[config[props.clickVariant].hoverBGColor]}`};
|
|
79
|
+
${(props) => props.focusable && `color: ${props.theme.color[config[props.clickVariant].hoverColor]}`};
|
|
77
80
|
}
|
|
78
81
|
:hover i {
|
|
79
|
-
${(props) => props.focusable && `display: block`};
|
|
82
|
+
${(props) => props.focusable && props.clickVariant === 'delete' && `display: block`};
|
|
80
83
|
}
|
|
81
84
|
& i {
|
|
82
|
-
${(props) => props.focusable && props.isFocused && `display: block`};
|
|
85
|
+
${(props) => props.focusable && props.isFocused && props.clickVariant === 'delete' && `display: block`};
|
|
83
86
|
}
|
|
84
87
|
`;
|
|
85
88
|
|
|
@@ -87,8 +90,24 @@ const TagLabel = styled.div`
|
|
|
87
90
|
margin-left: 4px;
|
|
88
91
|
`;
|
|
89
92
|
|
|
93
|
+
const config = {
|
|
94
|
+
select: {
|
|
95
|
+
color: 'grey4',
|
|
96
|
+
backgroundColor: 'white',
|
|
97
|
+
hoverColor: 'grey5',
|
|
98
|
+
hoverBGColor: 'grey0',
|
|
99
|
+
},
|
|
100
|
+
delete: {
|
|
101
|
+
color: 'grey5',
|
|
102
|
+
backgroundColor: 'grey0',
|
|
103
|
+
hoverColor: 'grey4',
|
|
104
|
+
hoverBGColor: 'orangeL80',
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
90
108
|
export function JRCTag<T>(props: JRCTagProps<T>) {
|
|
91
109
|
const uri = 'uri' in props ? props.uri : `${props.type}/${props.recordId}`;
|
|
110
|
+
const clickVariant = props.clickVariant || 'delete';
|
|
92
111
|
|
|
93
112
|
const getAvatar = () =>
|
|
94
113
|
React.createElement(
|
|
@@ -104,6 +123,7 @@ export function JRCTag<T>(props: JRCTagProps<T>) {
|
|
|
104
123
|
: undefined,
|
|
105
124
|
focusable: props.focusable,
|
|
106
125
|
isFocused: props.isFocused,
|
|
126
|
+
clickVariant,
|
|
107
127
|
},
|
|
108
128
|
<>
|
|
109
129
|
<JRCAvatar alt={props.alt} uri={uri} variant={props.variant} focusable={props.focusable} />
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
.wiggle {
|
|
2
|
+
animation: 0.25s ease-in-out 0s 4 wiggle;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@keyframes wiggle {
|
|
6
|
+
0% {
|
|
7
|
+
transform: rotate(0deg);
|
|
8
|
+
}
|
|
9
|
+
25% {
|
|
10
|
+
transform: rotate(10deg) scale(1.1);
|
|
11
|
+
}
|
|
12
|
+
75% {
|
|
13
|
+
transform: rotate(-10deg) scale(1.1);
|
|
14
|
+
}
|
|
15
|
+
100% {
|
|
16
|
+
transform: rotate(0deg);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
1
20
|
.scale-left {
|
|
2
21
|
animation: scale var(--timeout, 1000ms) linear 0s 1;
|
|
3
22
|
}
|
|
@@ -71,6 +71,9 @@ const Text = styled(JRCText)<{ sizeTooltip: keyof typeof sizes.padding }>`
|
|
|
71
71
|
margin: 0;
|
|
72
72
|
text-align: ${(props) => (props.sizeTooltip === 'small' ? 'center' : 'initial')};
|
|
73
73
|
`;
|
|
74
|
+
const InlineBlock = styled.span`
|
|
75
|
+
display: inline-block;
|
|
76
|
+
`;
|
|
74
77
|
|
|
75
78
|
export const JRCTooltip = (props: JRCTooltipProps) => {
|
|
76
79
|
const id = uuidv4();
|
|
@@ -86,14 +89,14 @@ export const JRCTooltip = (props: JRCTooltipProps) => {
|
|
|
86
89
|
};
|
|
87
90
|
return (
|
|
88
91
|
<>
|
|
89
|
-
<
|
|
92
|
+
<InlineBlock
|
|
90
93
|
aria-describedby={id}
|
|
91
94
|
data-event="mouseenter focusin"
|
|
92
95
|
data-event-off={props.closeButton && props.button ? 'click' : 'mouseleave'}
|
|
93
96
|
data-tip
|
|
94
97
|
data-for={id}>
|
|
95
98
|
{props.children}
|
|
96
|
-
</
|
|
99
|
+
</InlineBlock>
|
|
97
100
|
<Tooltip
|
|
98
101
|
effect="solid"
|
|
99
102
|
role="tooltip"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DependencyList, useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
const useDidMountEffect = (func: Function, deps: DependencyList) => {
|
|
3
|
+
export const useDidMountEffect = (func: Function, deps: DependencyList) => {
|
|
4
4
|
const didMount = useRef(false);
|
|
5
5
|
|
|
6
6
|
useEffect(() => {
|
|
@@ -8,5 +8,3 @@ const useDidMountEffect = (func: Function, deps: DependencyList) => {
|
|
|
8
8
|
else didMount.current = true;
|
|
9
9
|
}, deps);
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
export default useDidMountEffect;
|
package/src/index.tsx
CHANGED
|
@@ -17,6 +17,8 @@ import * as reactHookForm from 'react-hook-form';
|
|
|
17
17
|
|
|
18
18
|
declare global {
|
|
19
19
|
interface Window {
|
|
20
|
+
React: any;
|
|
21
|
+
ReactDOM: any;
|
|
20
22
|
jamespotUserApi: any;
|
|
21
23
|
reactRedux: any;
|
|
22
24
|
redux: any;
|
|
@@ -90,6 +92,8 @@ export { JRCConditionalWrapper } from './components/Common/JRCConditionalWrapper
|
|
|
90
92
|
|
|
91
93
|
export { JRCDate } from './components/JRCDate/JRCDate';
|
|
92
94
|
|
|
95
|
+
export { JRCEllipsis } from './components/JRCEllipsis/JRCEllipsis';
|
|
96
|
+
|
|
93
97
|
export { JRCFormCheckbox } from './components/Form/Input/JRCFormCheckbox/JRCFormCheckbox';
|
|
94
98
|
|
|
95
99
|
export { JRCFormColorField } from './components/Form/Input/JRCFormColor/JRCFormColor';
|
|
@@ -173,14 +177,12 @@ export { JRCTypography };
|
|
|
173
177
|
|
|
174
178
|
export { JRCValidationButton } from './components/JRCButton/JRCValidationButton';
|
|
175
179
|
|
|
176
|
-
|
|
177
|
-
export {
|
|
180
|
+
export { default as Theme } from './styles/theme';
|
|
181
|
+
export { default as Resources } from './translation';
|
|
178
182
|
|
|
179
|
-
import Resources from './translation';
|
|
180
183
|
export { useTimeout } from './hooks/UseTimeout';
|
|
181
184
|
export { useDebounce } from './hooks/UseDebounce';
|
|
182
|
-
export {
|
|
183
|
-
export { Resources };
|
|
185
|
+
export { useDidMountEffect } from './hooks/UseDidMountEffect';
|
|
184
186
|
|
|
185
187
|
export { StyledInput } from './components/Form/Input/JRCStyledInput';
|
|
186
188
|
|
|
@@ -190,6 +192,8 @@ export { JRCInputSelect } from './components/Form/Input/JRCSelect/JRCInputSelect
|
|
|
190
192
|
export { JRCInputAutocomplete } from './components/Form/Input/JRCSelect/JRCInputAutocomplete';
|
|
191
193
|
export { JRCInputCommunity } from './components/Form/Input/JRCSelect/JRCAutocompleteCommunity';
|
|
192
194
|
export { JRCInputText } from './components/Form/Input/JRCInputText/JRCInputText';
|
|
195
|
+
export { JRCInputTextarea } from './components/Form/Input/JRCInputTextarea/JRCInputTextarea';
|
|
196
|
+
export { JRCInputDate } from './components/Form/Input/JRCInputDate/JRCInputDate';
|
|
193
197
|
|
|
194
198
|
/****
|
|
195
199
|
*
|
package/src/styles/theme.tsx
CHANGED
|
@@ -49,7 +49,6 @@ export type Colors =
|
|
|
49
49
|
| 'white';
|
|
50
50
|
type ThemeConfigColorType = { [color in Colors]: string };
|
|
51
51
|
|
|
52
|
-
// contained hover | outlined pressed | outlined hover | contained pressed
|
|
53
52
|
export type Shades =
|
|
54
53
|
| 'primaryL15'
|
|
55
54
|
| 'primaryL80'
|
|
@@ -72,6 +71,7 @@ export type FontWeight = {
|
|
|
72
71
|
};
|
|
73
72
|
|
|
74
73
|
export type ThemeType = {
|
|
74
|
+
dpr: number;
|
|
75
75
|
font: {
|
|
76
76
|
family: string;
|
|
77
77
|
color: string;
|
|
@@ -147,7 +147,7 @@ const Theme: ITheme = {
|
|
|
147
147
|
black15: '#00000026',
|
|
148
148
|
black20: '#00000033',
|
|
149
149
|
|
|
150
|
-
grey6: '#
|
|
150
|
+
grey6: '#2E2E33',
|
|
151
151
|
grey5: '#4A4A52',
|
|
152
152
|
grey4: '#848491',
|
|
153
153
|
grey3: '#BEBED1',
|
|
@@ -175,6 +175,7 @@ const Theme: ITheme = {
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
this.config = {
|
|
178
|
+
dpr: Math.ceil(window?.devicePixelRatio || 2),
|
|
178
179
|
font: {
|
|
179
180
|
// Before using these properties, check JRCTypo.tsx
|
|
180
181
|
family: "'Poppins',sans-serif",
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
"GLOBAL_Form_Controls_MinValue": "Must be at least {min}",
|
|
8
8
|
"GLOBAL_Form_Controls_MaxValue": "Must be at max {max}",
|
|
9
9
|
"GLOBAL_Form_Controls_Pattern": "Must follow the specified pattern {pattern}",
|
|
10
|
+
"GLOBAL_Error_occurred": "An error occurred",
|
|
10
11
|
"GLOBAL_Form_No_Options": "No options",
|
|
11
12
|
"GLOBAL_Form_Characters": "characters",
|
|
12
13
|
"GLOBAL_Loading": "Loading",
|
|
13
14
|
"GLOBAL_Validation": "Confirm",
|
|
14
|
-
"GLOBAL_Error_occurred": "An error occurred",
|
|
15
15
|
"GROUP_more": "More",
|
|
16
16
|
"GLOBAL_Select": "Select",
|
|
17
17
|
"ERROR_Mail_Invalid": "Must be a valid email",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"AppLeftColumn_App_Navigation": "App navigation",
|
|
25
25
|
"GLOBAL_Today": "Today",
|
|
26
26
|
"GLOBAL_Yesterday": "Yesterday",
|
|
27
|
-
"GLOBAL_Unsuported_File_Format": "Unsuported file format"
|
|
27
|
+
"GLOBAL_Unsuported_File_Format": "Unsuported file format",
|
|
28
|
+
"GLOBAL_Move": "Move"
|
|
28
29
|
}
|
|
29
30
|
}
|
package/src/types.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { JRCColumnRightProps } from './components/JRCColumnRight/JRCColumnRight'
|
|
|
41
41
|
export { JRCColumnRightProps };
|
|
42
42
|
export { JRCDateProps } from './components/JRCDate/JRCDate';
|
|
43
43
|
export { JRCDropDownProps } from './components/JRCDropDown/JRCDropDown';
|
|
44
|
+
export { JRCEllipsisProps } from './components/JRCEllipsis/JRCEllipsis';
|
|
44
45
|
export { JRCFileOpenProps } from './components/JRCFileOpen/JRCFileOpen';
|
|
45
46
|
import { JRCGridProps } from './components/JRCGrid/JRCGrid';
|
|
46
47
|
export { JRCGridProps };
|
|
@@ -83,6 +84,9 @@ export { JRCTypographyProps };
|
|
|
83
84
|
export { JRCValidationButtonProps } from './components/JRCButton/JRCValidationButton';
|
|
84
85
|
|
|
85
86
|
export * from './components/Form/Input/JRCInputCheckbox/JRCInputCheckbox.types';
|
|
87
|
+
export { JRCInputDateProps } from './components/Form/Input/JRCInputDate/JRCInputDate';
|
|
88
|
+
export { JRCInputTextProps } from './components/Form/Input/JRCInputText/JRCInputText';
|
|
89
|
+
export { JRCInputTextareaProps } from './components/Form/Input/JRCInputTextarea/JRCInputTextarea';
|
|
86
90
|
export { JRCInputFieldProps } from './components/Form/Input/Common/JRCFormFieldRenderer.types';
|
|
87
91
|
export { JRCInputSelectProps } from './components/Form/Input/JRCSelect/JRCInputSelect.types';
|
|
88
92
|
export { JRCAutocompleteProps } from './components/Form/Input/JRCSelect/JRCInputSelect.types';
|
package/src/variables.scss
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// COLORS //
|
|
2
|
-
|
|
3
|
-
// Primary Color
|
|
4
|
-
$linkColor: rgb(52, 230, 243);
|
|
5
|
-
|
|
6
|
-
// Originals colors
|
|
7
|
-
$grey: #a7a7a7;
|
|
8
|
-
$blue: #3ec3ef;
|
|
9
|
-
$blueDark: #0064cd;
|
|
10
|
-
$green: #4dbf96;
|
|
11
|
-
$red: #f67370;
|
|
12
|
-
$yellow: #f8d120;
|
|
13
|
-
$orange: #f89406;
|
|
14
|
-
$pink: #c3325f;
|
|
15
|
-
$purple: #7a43b6;
|
|
16
|
-
|
|
17
|
-
// black to white
|
|
18
|
-
$black: #000000;
|
|
19
|
-
$white: #ffffff;
|
|
20
|
-
|
|
21
|
-
// --------------------------------- //
|
|
22
|
-
|
|
23
|
-
// TEXT //
|
|
24
|
-
|
|
25
|
-
// Fonts
|
|
26
|
-
$sansSerif: sans-serif;
|
|
27
|
-
|
|
28
|
-
// Line height
|
|
29
|
-
$lineHeightBase: 18px;
|
|
30
|
-
|
|
31
|
-
// Text Color
|
|
32
|
-
$textColor: #3f3f3f;
|
|
33
|
-
$textColorBlur: #858585;
|
|
34
|
-
|
|
35
|
-
// Text Weights
|
|
36
|
-
$fontWeightLight: 300;
|
|
37
|
-
$fontWeightBase: 400;
|
|
38
|
-
$fontWeightBold: 700;
|
|
39
|
-
|
|
40
|
-
// Text Sizes
|
|
41
|
-
$fontSizeHeader: 22px;
|
|
42
|
-
$fontSizeTitle: 18px;
|
|
43
|
-
$fontSizeBase: 14.5px;
|
|
44
|
-
$fontSizeSmall: 12px;
|
|
45
|
-
|
|
46
|
-
// Text Modal Window
|
|
47
|
-
$fontSizeTitleModal: 18px;
|
|
48
|
-
|
|
49
|
-
// --------------------------------- //
|
|
50
|
-
|
|
51
|
-
// PADDINGS & MARGINS (En cours de réflexion) //
|
|
52
|
-
|
|
53
|
-
// Paddings
|
|
54
|
-
$paddingLight: 4px;
|
|
55
|
-
$paddingBase: 8px;
|
|
56
|
-
$paddingMedium: 16px;
|
|
57
|
-
$paddingBold: 24px;
|
|
58
|
-
$paddingExtraBold: 32px;
|
|
59
|
-
$paddingBlack: 48px;
|
|
60
|
-
|
|
61
|
-
// Margins
|
|
62
|
-
$marginLight: 4px;
|
|
63
|
-
$marginBase: 8px;
|
|
64
|
-
$marginMedium: 16px;
|
|
65
|
-
$marginBold: 24px;
|
|
66
|
-
$marginExtraBold: 32px;
|
|
67
|
-
$marginBlack: 48px;
|