jamespot-react-components 1.0.1 → 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/.github/workflows/increment-npm-version.yml +26 -0
- package/build/jamespot-react-components.js +247 -231
- package/build/jamespot-react-components.js.LICENSE.txt +0 -16
- 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/JRCAppLeftColumn/JRCAppLeftColumn.d.ts +1 -1
- 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 -7
- package/build/src/styles/theme.d.ts +1 -0
- package/build/src/types.d.ts +4 -0
- package/externals.d.ts +0 -1
- package/externals.json +2 -1
- package/package.json +5 -5
- 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/JRCAppLeftColumn/JRCAppLeftColumn.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 -10
- package/src/styles/theme.tsx +3 -2
- package/src/translation/lang.json +3 -2
- package/src/types.ts +4 -0
- package/tsconfig.json +1 -0
- package/build/src/components/Form/Input/JRCFormTextEditor/JRCFormTextEditor.d.ts +0 -10
- package/build/src/components/Form/Input/JRCFormTextEditor/JRCFormTextEditor.stories.d.ts +0 -5
- package/src/components/Form/Input/JRCFormTextEditor/JRCFormTextEditor.stories.tsx +0 -30
- package/src/components/Form/Input/JRCFormTextEditor/JRCFormTextEditor.tsx +0 -36
- package/src/variables.scss +0 -67
|
@@ -4,6 +4,7 @@ import { DndProvider, useDrag, useDrop } from 'react-dnd';
|
|
|
4
4
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
5
5
|
import { JRCIconButton } from '../JRCIconButton/JRCIconButton';
|
|
6
6
|
import { JRCConditionalWrapper } from '../Common/JRCConditionalWrapper';
|
|
7
|
+
import { useIntl } from 'react-intl';
|
|
7
8
|
import { DropTargetMonitor } from 'react-dnd/dist/types/types';
|
|
8
9
|
|
|
9
10
|
const TableCss = css`
|
|
@@ -19,13 +20,20 @@ export const Table = styled.table`
|
|
|
19
20
|
border-collapse: collapse;
|
|
20
21
|
`;
|
|
21
22
|
|
|
22
|
-
export const Thead = styled.thead
|
|
23
|
+
export const Thead = styled.thead`
|
|
24
|
+
position: sticky;
|
|
25
|
+
top: 0;
|
|
26
|
+
background-color: white;
|
|
27
|
+
border-bottom: 2px solid ${(props) => props.theme.color.grey2};
|
|
28
|
+
z-index: 1;
|
|
29
|
+
`;
|
|
23
30
|
|
|
24
31
|
export const TBody = styled.tbody``;
|
|
25
32
|
|
|
26
33
|
export const Th = styled.th<{ width?: number | string }>`
|
|
27
34
|
${TableCss};
|
|
28
35
|
font-size: 12px;
|
|
36
|
+
padding: 0 4px;
|
|
29
37
|
font-weight: normal;
|
|
30
38
|
${(props) => props.width && props.width > 0 && `width: ${props.width}px`};
|
|
31
39
|
`;
|
|
@@ -75,6 +83,7 @@ export const Tr = styled.tr<{ dragging?: boolean }>`
|
|
|
75
83
|
|
|
76
84
|
export const Td = styled.td`
|
|
77
85
|
${TableCss};
|
|
86
|
+
padding: 0 4px;
|
|
78
87
|
${(props) => props.width && `width: ${props.width}`};
|
|
79
88
|
`;
|
|
80
89
|
|
|
@@ -137,6 +146,8 @@ export const DraggableTBody = ({ draggable, children }: DraggableTBodyProps) =>
|
|
|
137
146
|
const DND_ITEM_TYPE = 'row';
|
|
138
147
|
|
|
139
148
|
export const DraggableTr = ({ index, onDrag, onDrop, draggable, children }: DraggableTrProps) => {
|
|
149
|
+
const intl = useIntl();
|
|
150
|
+
|
|
140
151
|
const dropRef = React.useRef<HTMLTableRowElement>(null);
|
|
141
152
|
const dragRef = React.useRef<HTMLTableCellElement>(null);
|
|
142
153
|
let dragging = false;
|
|
@@ -199,7 +210,10 @@ export const DraggableTr = ({ index, onDrag, onDrop, draggable, children }: Drag
|
|
|
199
210
|
<Tr ref={dropRef} dragging={dragging}>
|
|
200
211
|
{draggable && (
|
|
201
212
|
<DraggableTd ref={dragRef}>
|
|
202
|
-
<JRCIconButton
|
|
213
|
+
<JRCIconButton
|
|
214
|
+
icon="icon-fs-dw"
|
|
215
|
+
tooltip={{ description: intl.formatMessage({ id: 'GLOBAL_Move' }), position: 'right' }}
|
|
216
|
+
/>
|
|
203
217
|
|
|
204
218
|
</DraggableTd>
|
|
205
219
|
)}
|
|
@@ -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
|
@@ -4,7 +4,6 @@ import * as reduxFormLib from 'redux-form';
|
|
|
4
4
|
import * as reduxLib from 'redux';
|
|
5
5
|
import * as reactReduxLib from 'react-redux';
|
|
6
6
|
import * as reactIntl from 'react-intl';
|
|
7
|
-
import * as reactTransitionGroup from 'react-transition-group';
|
|
8
7
|
import styled from 'styled-components';
|
|
9
8
|
import * as reactSelect from 'react-select';
|
|
10
9
|
import * as jamespotUserApi from 'jamespot-user-api';
|
|
@@ -18,13 +17,14 @@ import * as reactHookForm from 'react-hook-form';
|
|
|
18
17
|
|
|
19
18
|
declare global {
|
|
20
19
|
interface Window {
|
|
20
|
+
React: any;
|
|
21
|
+
ReactDOM: any;
|
|
21
22
|
jamespotUserApi: any;
|
|
22
23
|
reactRedux: any;
|
|
23
24
|
redux: any;
|
|
24
25
|
reduxForm: any;
|
|
25
26
|
reactIntl: any;
|
|
26
27
|
reactSelect: any;
|
|
27
|
-
reactTransitionGroup: any;
|
|
28
28
|
styledComponents: any;
|
|
29
29
|
reactDnd: any;
|
|
30
30
|
reactDndHtml5Backend: any;
|
|
@@ -41,7 +41,6 @@ window.redux = reduxLib;
|
|
|
41
41
|
window.reduxForm = reduxFormLib;
|
|
42
42
|
window.reactIntl = reactIntl;
|
|
43
43
|
window.reactSelect = reactSelect;
|
|
44
|
-
window.reactTransitionGroup = reactTransitionGroup;
|
|
45
44
|
window.styledComponents = styled;
|
|
46
45
|
window.reactDnd = reactDnd;
|
|
47
46
|
window.reactDndHtml5Backend = reactDndHtml5Backend;
|
|
@@ -93,6 +92,8 @@ export { JRCConditionalWrapper } from './components/Common/JRCConditionalWrapper
|
|
|
93
92
|
|
|
94
93
|
export { JRCDate } from './components/JRCDate/JRCDate';
|
|
95
94
|
|
|
95
|
+
export { JRCEllipsis } from './components/JRCEllipsis/JRCEllipsis';
|
|
96
|
+
|
|
96
97
|
export { JRCFormCheckbox } from './components/Form/Input/JRCFormCheckbox/JRCFormCheckbox';
|
|
97
98
|
|
|
98
99
|
export { JRCFormColorField } from './components/Form/Input/JRCFormColor/JRCFormColor';
|
|
@@ -131,8 +132,6 @@ export { JRCPagination };
|
|
|
131
132
|
|
|
132
133
|
export { JRCFormTextarea, JRCFormTextareaField } from './components/Form/Input/JRCFormTextarea/JRCFormTextarea';
|
|
133
134
|
|
|
134
|
-
export { JRCFormTextEditorField } from './components/Form/Input/JRCFormTextEditor/JRCFormTextEditor';
|
|
135
|
-
|
|
136
135
|
export { JRCList } from './components/JRCList/JRCList';
|
|
137
136
|
|
|
138
137
|
import JRCModalImg from './components/JRCModalImg/JRCModalImg';
|
|
@@ -178,14 +177,12 @@ export { JRCTypography };
|
|
|
178
177
|
|
|
179
178
|
export { JRCValidationButton } from './components/JRCButton/JRCValidationButton';
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
export {
|
|
180
|
+
export { default as Theme } from './styles/theme';
|
|
181
|
+
export { default as Resources } from './translation';
|
|
183
182
|
|
|
184
|
-
import Resources from './translation';
|
|
185
183
|
export { useTimeout } from './hooks/UseTimeout';
|
|
186
184
|
export { useDebounce } from './hooks/UseDebounce';
|
|
187
|
-
export {
|
|
188
|
-
export { Resources };
|
|
185
|
+
export { useDidMountEffect } from './hooks/UseDidMountEffect';
|
|
189
186
|
|
|
190
187
|
export { StyledInput } from './components/Form/Input/JRCStyledInput';
|
|
191
188
|
|
|
@@ -195,6 +192,8 @@ export { JRCInputSelect } from './components/Form/Input/JRCSelect/JRCInputSelect
|
|
|
195
192
|
export { JRCInputAutocomplete } from './components/Form/Input/JRCSelect/JRCInputAutocomplete';
|
|
196
193
|
export { JRCInputCommunity } from './components/Form/Input/JRCSelect/JRCAutocompleteCommunity';
|
|
197
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';
|
|
198
197
|
|
|
199
198
|
/****
|
|
200
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/tsconfig.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { JRCWritableFormInputProps } from '../JRCFormFieldRender';
|
|
2
|
-
import 'react-quill/dist/quill.snow.css';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated The component @link JRCFormRichTextField must be used to replace JRCFormTextEditorField
|
|
5
|
-
* Component used as a rich text editor
|
|
6
|
-
* @param props JRCWritableFormInputProps
|
|
7
|
-
* validation props: minValue, maxValue, required
|
|
8
|
-
* @returns JSX.Element
|
|
9
|
-
*/
|
|
10
|
-
export declare const JRCFormTextEditorField: (props: JRCWritableFormInputProps) => JSX.Element;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { JRCWritableFormInputProps } from '../JRCFormFieldRender';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
declare const _default: Meta<import("@storybook/react").Args>;
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const InputTextEditor: Story<JRCWritableFormInputProps>;
|