jamespot-react-components 1.0.215 → 1.0.217

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.
@@ -2,11 +2,17 @@ import * as React from 'react';
2
2
  import { ControllerRenderProps, FieldValues } from 'react-hook-form';
3
3
  import { DataCy } from 'types/dataAttributes';
4
4
  import { JRCTooltipProps } from 'components/JRCTooltip/JRCTooltip';
5
+ import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
6
+ import { ButtonColors } from '../../../JRCButton/JRCButton';
7
+ type Sizes = 's' | 'm';
5
8
  type ToggleListOption<TFieldValues> = {
6
9
  label: string | JSX.Element;
7
10
  value: string | number | TFieldValues;
11
+ color?: ButtonColors;
8
12
  };
9
13
  export type ToggleProps = DataCy & {
14
+ size?: Sizes;
15
+ width?: string;
10
16
  disabled?: boolean;
11
17
  options: Array<ToggleListOption<string>>;
12
18
  };
@@ -17,6 +23,8 @@ export type ToggleRawProps<TFieldValues extends FieldValues = FieldValues> = Tog
17
23
  tooltip?: JRCTooltipProps;
18
24
  };
19
25
  export declare const JRCInputToggleRaw: React.ForwardRefExoticComponent<Omit<DataCy & {
26
+ size?: Sizes | undefined;
27
+ width?: string | undefined;
20
28
  disabled?: boolean | undefined;
21
29
  options: Array<ToggleListOption<string>>;
22
30
  } & Omit<ControllerRenderProps<FieldValues, string>, "ref" | "value"> & {
@@ -25,4 +33,6 @@ export declare const JRCInputToggleRaw: React.ForwardRefExoticComponent<Omit<Dat
25
33
  value: string;
26
34
  tooltip?: JRCTooltipProps | undefined;
27
35
  }, "ref"> & React.RefAttributes<HTMLInputElement>>;
36
+ export type JRCInputToggleProps<TFieldValues extends FieldValues = FieldValues> = ToggleRawProps<TFieldValues> & JRCInputFieldProps<TFieldValues>;
37
+ export declare function JRCInputToggle<TFieldValues extends FieldValues = FieldValues>({ name, control, rules, label, htmlFor, labelIsLegend, description, helper, ...props }: JRCInputToggleProps<TFieldValues>): React.JSX.Element;
28
38
  export {};
@@ -1,257 +1,35 @@
1
- export declare const BUTTON_CONFIG: {
2
- contained: {
3
- primary: {
4
- color: string;
5
- background: string;
6
- border: string;
7
- active: {
8
- background: string;
9
- border: string;
10
- };
11
- hover: {
12
- background: string;
13
- border: string;
14
- };
15
- };
16
- valid: {
17
- color: string;
18
- background: string;
19
- border: string;
20
- active: {
21
- background: string;
22
- border: string;
23
- };
24
- hover: {
25
- background: string;
26
- border: string;
27
- };
28
- };
29
- danger: {
30
- color: string;
31
- background: string;
32
- border: string;
33
- active: {
34
- background: string;
35
- border: string;
36
- };
37
- hover: {
38
- background: string;
39
- border: string;
40
- };
41
- };
42
- secondary: {
43
- color: string;
44
- background: string;
45
- border: string;
46
- active: {
47
- background: string;
48
- border: string;
49
- };
50
- hover: {
51
- background: string;
52
- border: string;
53
- };
54
- };
55
- cancel: {
56
- color: string;
57
- background: string;
58
- border: string;
59
- active: {
60
- background: string;
61
- border: string;
62
- };
63
- hover: {
64
- background: string;
65
- border: string;
66
- };
67
- };
68
- disabled: {
69
- color: string;
70
- background: string;
71
- border: string;
72
- active: {
73
- background: string;
74
- border: string;
75
- };
76
- hover: {
77
- background: string;
78
- border: string;
79
- };
80
- };
1
+ import { Colors, ColorsOrShades } from '../../styles/theme';
2
+ import { ButtonColors } from './JRCButton';
3
+ declare const defaultLinkStyle: {
4
+ color: string;
5
+ background: string;
6
+ border: string;
7
+ active: {
8
+ background: string;
9
+ border: string;
10
+ 'text-decoration': string;
81
11
  };
82
- outlined: {
83
- primary: {
84
- color: string;
85
- background: string;
86
- border: string;
87
- active: {
88
- background: string;
89
- border: string;
90
- };
91
- hover: {
92
- background: string;
93
- border: string;
94
- };
95
- };
96
- valid: {
97
- color: string;
98
- background: string;
99
- border: string;
100
- active: {
101
- background: string;
102
- border: string;
103
- };
104
- hover: {
105
- background: string;
106
- border: string;
107
- };
108
- };
109
- danger: {
110
- color: string;
111
- background: string;
112
- border: string;
113
- active: {
114
- background: string;
115
- border: string;
116
- };
117
- hover: {
118
- background: string;
119
- border: string;
120
- };
121
- };
122
- secondary: {
123
- color: string;
124
- background: string;
125
- border: string;
126
- active: {
127
- background: string;
128
- border: string;
129
- };
130
- hover: {
131
- background: string;
132
- border: string;
133
- };
134
- };
135
- cancel: {
136
- color: string;
137
- background: string;
138
- border: string;
139
- active: {
140
- background: string;
141
- border: string;
142
- };
143
- hover: {
144
- background: string;
145
- border: string;
146
- };
147
- };
148
- disabled: {
149
- color: string;
150
- background: string;
151
- border: string;
152
- active: {
153
- background: string;
154
- border: string;
155
- };
156
- hover: {
157
- background: string;
158
- border: string;
159
- };
160
- };
12
+ hover: {
13
+ background: string;
14
+ border: string;
15
+ 'text-decoration': string;
16
+ };
17
+ };
18
+ type Config = {
19
+ color: Colors;
20
+ background: Colors;
21
+ border: Colors;
22
+ active: {
23
+ background: ColorsOrShades;
24
+ border: ColorsOrShades;
161
25
  };
162
- link: {
163
- primary: {
164
- color: string;
165
- background: string;
166
- border: string;
167
- active: {
168
- background: string;
169
- border: string;
170
- 'text-decoration': string;
171
- };
172
- hover: {
173
- background: string;
174
- border: string;
175
- 'text-decoration': string;
176
- };
177
- };
178
- valid: {
179
- color: string;
180
- background: string;
181
- border: string;
182
- active: {
183
- background: string;
184
- border: string;
185
- 'text-decoration': string;
186
- };
187
- hover: {
188
- background: string;
189
- border: string;
190
- 'text-decoration': string;
191
- };
192
- };
193
- danger: {
194
- color: string;
195
- background: string;
196
- border: string;
197
- active: {
198
- background: string;
199
- border: string;
200
- 'text-decoration': string;
201
- };
202
- hover: {
203
- background: string;
204
- border: string;
205
- 'text-decoration': string;
206
- };
207
- };
208
- secondary: {
209
- color: string;
210
- background: string;
211
- border: string;
212
- active: {
213
- background: string;
214
- border: string;
215
- 'text-decoration': string;
216
- };
217
- hover: {
218
- background: string;
219
- border: string;
220
- 'text-decoration': string;
221
- };
222
- };
223
- cancel: {
224
- color: string;
225
- background: string;
226
- border: string;
227
- active: {
228
- background: string;
229
- border: string;
230
- 'text-decoration': string;
231
- };
232
- hover: {
233
- background: string;
234
- border: string;
235
- 'text-decoration': string;
236
- };
237
- };
238
- disabled: {
239
- color: string;
240
- background: string;
241
- border: string;
242
- active: {
243
- background: string;
244
- border: string;
245
- 'text-decoration': string;
246
- };
247
- hover: {
248
- background: string;
249
- border: string;
250
- 'text-decoration': string;
251
- };
252
- };
26
+ hover: {
27
+ background: ColorsOrShades;
28
+ border: ColorsOrShades;
253
29
  };
254
30
  };
31
+ type ButtonConfig = Record<'contained' | 'outlined', Record<ButtonColors | 'disabled', Config>> & Record<'link', Record<ButtonColors | 'disabled', typeof defaultLinkStyle>>;
32
+ export declare const BUTTON_CONFIG: ButtonConfig;
255
33
  export type ButtonType = {
256
34
  color: string;
257
35
  background: string;
@@ -267,3 +45,4 @@ export type ButtonType = {
267
45
  'text-decoration'?: string;
268
46
  };
269
47
  };
48
+ export {};
@@ -19,7 +19,6 @@ export type JRCCommentsBlocProps = {
19
19
  token?: string;
20
20
  onCommentUpdate: (args: UpdateCommentParams) => Promise<void>;
21
21
  onCommentDelete: (idComment: number) => Promise<void>;
22
- deleteFile: (id: number) => Promise<void>;
23
22
  onError?: (message?: string) => void;
24
23
  highlightFields?: string[];
25
24
  userModel?: Model;
@@ -32,7 +31,7 @@ export type JRCCommentsBlocProps = {
32
31
  canComment: boolean;
33
32
  handlers: {
34
33
  filebank: Pick<JFilebankApi, 'getBanks' | 'getFolders' | 'getDocuments'>;
35
- file: Pick<JFileApi, 'copy'>;
34
+ file: Pick<JFileApi, 'copy' | 'deleteFile'>;
36
35
  drive: Pick<JDriveApi, 'msDocuments' | 'dropboxDocuments' | 'groups' | 'tenants' | 'listAccount' | 'isAccountLogged' | 'checkAccountToken' | 'getAccount' | 'logout' | 'setDefaultAccount' | 'getDocument'>;
37
36
  user: Pick<JUserApi, 'get' | 'getFields'>;
38
37
  socialAction: Pick<JSocialActionApi, 'add' | 'remove' | 'getUsers'>;
@@ -48,4 +47,4 @@ export type JRCCommentsBlocProps = {
48
47
  articleId: number;
49
48
  };
50
49
  export declare const AvatarWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
51
- export declare const JRCCommentsBloc: ({ comments, initialCommentsNumber, currentUser, tinyMCEConfig, onComment, isWidgetActive, widgetListComponent, newWidgetsWrapperComponent, existingWidgetsWrapperComponent, loading, token, onCommentDelete, onCommentUpdate, deleteFile, onError, highlightFields, userModel, userAccountStatus, isWedocActive, getAccessHash, onGetHashError, activeDrives, variant, canComment, handlers, socialQuestion, articleId, }: JRCCommentsBlocProps) => React.JSX.Element;
50
+ export declare const JRCCommentsBloc: ({ comments, initialCommentsNumber, currentUser, tinyMCEConfig, onComment, isWidgetActive, widgetListComponent, newWidgetsWrapperComponent, existingWidgetsWrapperComponent, loading, token, onCommentDelete, onCommentUpdate, onError, highlightFields, userModel, userAccountStatus, isWedocActive, getAccessHash, onGetHashError, activeDrives, variant, canComment, handlers, socialQuestion, articleId, }: JRCCommentsBlocProps) => React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { jUserLittle } from 'jamespot-user-api';
3
+ export type CommentsHeaderProps = {
4
+ lastCommentUser?: jUserLittle;
5
+ variant?: 'modal' | 'inline';
6
+ displayedCommentsNumber: number;
7
+ displayMoreComments: () => void;
8
+ focusLastComment: () => void;
9
+ commentsCount?: number;
10
+ };
11
+ export declare const CommentsHeader: ({ lastCommentUser, commentsCount, variant, displayedCommentsNumber, displayMoreComments, focusLastComment, }: CommentsHeaderProps) => React.JSX.Element | null;
@@ -0,0 +1,24 @@
1
+ import { JRCInputTinyMCERawProps } from '../../Form/Input/JRCInputTinyMCERaw/JRCInputTinyMCERaw';
2
+ import { DriveOrFilebank } from '../../Form/Input/JRCInputFileAdvanced/JRCInputFileAdvancedRaw';
3
+ import React from 'react';
4
+ import { jCommentList, JFileApi, JFilebankApi } from 'jamespot-user-api';
5
+ import { JDriveApi } from 'jamespot-user-api/lib/src/apis/drive/drive';
6
+ export type EditCommentProps = {
7
+ comment: jCommentList;
8
+ activeDrives: DriveOrFilebank[];
9
+ tinyMCEConfig: Pick<JRCInputTinyMCERawProps, 'commonOptions' | 'mentionsQueries' | 'tinymceScriptSrc'>;
10
+ commentContent: string | null;
11
+ setCommentContent: (content: string) => void;
12
+ token: string;
13
+ handlers?: {
14
+ filebank: Pick<JFilebankApi, 'getBanks' | 'getFolders' | 'getDocuments'>;
15
+ file: Pick<JFileApi, 'copy'>;
16
+ drive: Pick<JDriveApi, 'msDocuments' | 'dropboxDocuments' | 'groups' | 'tenants' | 'listAccount' | 'isAccountLogged' | 'checkAccountToken' | 'getAccount' | 'logout' | 'setDefaultAccount' | 'getDocument'>;
17
+ };
18
+ deleteFile?: (id: number) => Promise<void>;
19
+ onError?: (code?: string) => void;
20
+ closeEditMode: () => void;
21
+ updateComment: () => void;
22
+ loading: boolean;
23
+ };
24
+ export declare const EditComment: ({ comment, tinyMCEConfig, activeDrives, setCommentContent, commentContent, token, handlers, deleteFile, onError, closeEditMode, updateComment, loading, }: EditCommentProps) => React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { JRCInputTinyMCERawProps } from '../../Form/Input/JRCInputTinyMCERaw/JRCInputTinyMCERaw';
2
+ import { DriveOrFilebank } from '../../Form/Input/JRCInputFileAdvanced/JRCInputFileAdvancedRaw';
3
+ import React from 'react';
4
+ import { AddCommentParams, JFileApi, JFilebankApi, jUserList } from 'jamespot-user-api';
5
+ import { JDriveApi } from 'jamespot-user-api/lib/src/apis/drive/drive';
6
+ export type NewCommentProps = {
7
+ currentUser: jUserList;
8
+ widgetListComponent: React.ReactNode;
9
+ newWidgetsWrapperComponent: React.ReactNode;
10
+ loading?: boolean;
11
+ canComment: boolean;
12
+ onComment: (params: Pick<AddCommentParams, 'content' | 'alertAuthor' | 'sendAlert'>) => Promise<void>;
13
+ token?: string;
14
+ tinyMCEConfig: Pick<JRCInputTinyMCERawProps, 'commonOptions' | 'mentionsQueries' | 'tinymceScriptSrc'>;
15
+ handlers?: {
16
+ filebank: Pick<JFilebankApi, 'getBanks' | 'getFolders' | 'getDocuments'>;
17
+ file: Pick<JFileApi, 'copy'>;
18
+ drive: Pick<JDriveApi, 'msDocuments' | 'dropboxDocuments' | 'groups' | 'tenants' | 'listAccount' | 'isAccountLogged' | 'checkAccountToken' | 'getAccount' | 'logout' | 'setDefaultAccount' | 'getDocument'>;
19
+ };
20
+ onError?: (message?: string) => void;
21
+ activeDrives: DriveOrFilebank[];
22
+ isWidgetActive?: boolean;
23
+ socialQuestion?: boolean;
24
+ deleteFile?: (id: number) => Promise<void>;
25
+ };
26
+ export declare const NewComment: ({ newWidgetsWrapperComponent, widgetListComponent, canComment, loading, currentUser, onComment, onError, tinyMCEConfig, token, handlers, activeDrives, isWidgetActive, socialQuestion, deleteFile, }: NewCommentProps) => React.JSX.Element;
@@ -53,7 +53,7 @@ export { JRCFormTextField } from './components/Form/Input/Deprecated/JRCFormText
53
53
  export { JRCFormTextarea, JRCFormTextareaField, } from './components/Form/Input/Deprecated/JRCFormTextarea/JRCFormTextarea';
54
54
  export { JRCFormUrlField } from './components/Form/Input/Deprecated/JRCFormURL/JRCFormUrl';
55
55
  export { JRCInputCheckbox, JRCInputCheckboxRaw } from './components/Form/Input/JRCInputCheckbox/JRCInputCheckbox';
56
- export { JRCInputToggleRaw } from './components/Form/Input/JRCInputCheckbox/JRCInputToggle';
56
+ export { JRCInputToggle, JRCInputToggleRaw } from './components/Form/Input/JRCInputCheckbox/JRCInputToggle';
57
57
  export { JRCCheckbox } from './components/Form/Input/JRCInputCheckbox/components/JRCCheckbox';
58
58
  export { JRCInputColor } from './components/Form/Input/JRCInputColor/JRCInputColor';
59
59
  export { JRCInputColorRaw } from './components/Form/Input/JRCInputColor/JRCInputColorRaw';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-components",
3
- "version": "1.0.215",
3
+ "version": "1.0.217",
4
4
  "description": "",
5
5
  "main": "./build/jamespot-react-components.js",
6
6
  "types": "./build/src/index.d.ts",
@@ -80,7 +80,7 @@
80
80
  "chroma-js": "^2.1.1",
81
81
  "classnames": "^2.3.1",
82
82
  "dompurify": "^3.0.5",
83
- "jamespot-user-api": "^1.0.194",
83
+ "jamespot-user-api": "^1.0.196",
84
84
  "moment": "2.29.4",
85
85
  "react": "^17.x",
86
86
  "react-beautiful-dnd": "^13.1.1",