cortex-react-ui 0.1.156 → 0.1.158

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.
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export declare const Dialog: (props: DialogProps) => JSX.Element;
3
+ export declare type DialogTitleProps = {
4
+ title?: string;
5
+ };
6
+ export declare type DialogProps = DialogTitleProps & {
7
+ open: boolean;
8
+ className?: string;
9
+ message?: string;
10
+ confirmation?: boolean;
11
+ children?: React.ReactNode;
12
+ onClose?: () => void;
13
+ };
@@ -0,0 +1,3 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export declare const DialogBody: (props: DialogBodyProps) => JSX.Element;
3
+ export declare type DialogBodyProps = HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1,3 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export declare const DialogMask: (props: DialogMaskProps) => JSX.Element;
3
+ export declare type DialogMaskProps = HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1,18 @@
1
+ export declare const ScanConfirmationDialog: (props: TScanConfirmDialogProps) => JSX.Element;
2
+ export declare type TScanConfirmDialogLabels = {
3
+ title?: string;
4
+ message?: string;
5
+ btnOk?: {
6
+ label: string;
7
+ style?: React.CSSProperties;
8
+ };
9
+ btnCancel?: {
10
+ label: string;
11
+ style?: React.CSSProperties;
12
+ };
13
+ };
14
+ export declare type TScanConfirmDialogProps = {
15
+ open: boolean;
16
+ onConfirm: () => void;
17
+ onClose: () => void;
18
+ } & TScanConfirmDialogLabels;
@@ -1,7 +1,9 @@
1
- import { IDetectedBarcode } from '@yudiel/react-qr-scanner';
2
- export interface ScannerProps {
1
+ import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
2
+ import { TScanConfirmDialogLabels } from './ScanConfirmationDialog';
3
+ declare const Scanner: ({ scanConfirmation, ...props }: ScannerProps) => JSX.Element;
4
+ declare type ScannerProps = {
3
5
  scanConfirmation?: boolean;
6
+ scanConfirmDialog?: TScanConfirmDialogLabels;
4
7
  onScan?: (detectedCodes: IDetectedBarcode[]) => void;
5
- }
6
- declare const Scanner: React.FC<ScannerProps>;
8
+ } & IScannerProps;
7
9
  export default Scanner;
@@ -2,6 +2,7 @@ export { default as Popper } from './Popper';
2
2
  export { default as DomContainer } from './DomContainer';
3
3
  export { default as Spinner } from './Spinner';
4
4
  export { default as BarLoader } from './BarLoader';
5
+ export { default as Scanner } from './Scanner';
5
6
  export { default as Selected } from './Selected';
6
7
  export { default as Button } from './Button';
7
8
  export { default as ToggleButton } from './ToggleButton';
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import React, { CSSProperties } from 'react';
1
+ import React$1, { CSSProperties } from 'react';
2
+ import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
2
3
 
3
4
  declare const PopperPlacement: {
4
5
  readonly Center: "center";
@@ -16,7 +17,7 @@ declare const PopperPlacement: {
16
17
  readonly RightCenter: "right-center";
17
18
  };
18
19
  declare type Props$5 = {
19
- anchorEl?: string | HTMLElement | React.RefObject<HTMLElement>;
20
+ anchorEl?: string | HTMLElement | React$1.RefObject<HTMLElement>;
20
21
  anchorPosition?: {
21
22
  top: number;
22
23
  left: number;
@@ -24,30 +25,30 @@ declare type Props$5 = {
24
25
  placement?: ObjectValues<typeof PopperPlacement>;
25
26
  open?: boolean;
26
27
  role?: string;
27
- children?: React.ReactNode;
28
+ children?: React$1.ReactNode;
28
29
  className?: string;
29
30
  overflow?: boolean;
30
- onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
31
- onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
32
- onMouseMove?: React.MouseEventHandler<HTMLDivElement>;
33
- onMouseOut?: React.MouseEventHandler<HTMLDivElement>;
34
- onMouseOver?: React.MouseEventHandler<HTMLDivElement>;
35
- onTouchStart?: React.TouchEventHandler<HTMLDivElement>;
36
- onTouchEnd?: React.TouchEventHandler<HTMLDivElement>;
31
+ onMouseEnter?: React$1.MouseEventHandler<HTMLDivElement>;
32
+ onMouseLeave?: React$1.MouseEventHandler<HTMLDivElement>;
33
+ onMouseMove?: React$1.MouseEventHandler<HTMLDivElement>;
34
+ onMouseOut?: React$1.MouseEventHandler<HTMLDivElement>;
35
+ onMouseOver?: React$1.MouseEventHandler<HTMLDivElement>;
36
+ onTouchStart?: React$1.TouchEventHandler<HTMLDivElement>;
37
+ onTouchEnd?: React$1.TouchEventHandler<HTMLDivElement>;
37
38
  };
38
- declare const Popper: React.ForwardRefExoticComponent<Props$5 & React.RefAttributes<HTMLElement>>;
39
+ declare const Popper: React$1.ForwardRefExoticComponent<Props$5 & React$1.RefAttributes<HTMLElement>>;
39
40
 
40
41
  declare type Props$4 = {
41
- children?: React.ReactNode;
42
+ children?: React$1.ReactNode;
42
43
  container?: HTMLElement | (() => HTMLElement);
43
44
  };
44
- declare const DomContainer: React.ForwardRefExoticComponent<Props$4 & React.RefAttributes<HTMLElement>>;
45
+ declare const DomContainer: React$1.ForwardRefExoticComponent<Props$4 & React$1.RefAttributes<HTMLElement>>;
45
46
 
46
47
  interface SpinnerProps {
47
48
  className?: string;
48
49
  variant?: 'indeterminate' | 'determinate';
49
50
  }
50
- declare const Spinner: React.FC<SpinnerProps>;
51
+ declare const Spinner: React$1.FC<SpinnerProps>;
51
52
 
52
53
  interface BarLoaderProps {
53
54
  title?: string;
@@ -56,45 +57,65 @@ interface BarLoaderProps {
56
57
  mode: 'determinate' | 'indeterminate';
57
58
  isComplete: boolean;
58
59
  }
59
- declare const BarLoader: React.FC<BarLoaderProps>;
60
+ declare const BarLoader: React$1.FC<BarLoaderProps>;
61
+
62
+ declare type TScanConfirmDialogLabels = {
63
+ title?: string;
64
+ message?: string;
65
+ btnOk?: {
66
+ label: string;
67
+ style?: React.CSSProperties;
68
+ };
69
+ btnCancel?: {
70
+ label: string;
71
+ style?: React.CSSProperties;
72
+ };
73
+ };
74
+
75
+ declare const Scanner: ({ scanConfirmation, ...props }: ScannerProps) => JSX.Element;
76
+ declare type ScannerProps = {
77
+ scanConfirmation?: boolean;
78
+ scanConfirmDialog?: TScanConfirmDialogLabels;
79
+ onScan?: (detectedCodes: IDetectedBarcode[]) => void;
80
+ } & IScannerProps;
60
81
 
61
82
  interface SelectedProps {
62
83
  title?: string;
63
84
  data: any[];
64
85
  onClick: (elt: any) => void;
65
86
  }
66
- declare const Selected: React.FC<SelectedProps>;
87
+ declare const Selected: React$1.FC<SelectedProps>;
67
88
 
68
89
  interface ButtonProps {
69
90
  variant?: 'text' | 'contained' | 'outlined';
70
91
  color?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
71
92
  className?: string;
72
93
  disable?: boolean;
73
- children?: React.ReactNode;
74
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
94
+ children?: React$1.ReactNode;
95
+ onClick?: (event: React$1.MouseEvent<HTMLButtonElement>) => void;
75
96
  }
76
- declare const Button: React.FC<ButtonProps>;
97
+ declare const Button: React$1.FC<ButtonProps>;
77
98
 
78
99
  interface ToggleButtonProps {
79
100
  selected?: boolean;
80
101
  value?: string;
81
102
  className?: string;
82
103
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
83
- children?: React.ReactNode;
104
+ children?: React$1.ReactNode;
84
105
  onChange?: (value: string | undefined) => void;
85
106
  }
86
- declare const ToggleButton: React.FC<ToggleButtonProps>;
107
+ declare const ToggleButton: React$1.FC<ToggleButtonProps>;
87
108
 
88
109
  interface TooltipProps$1 {
89
- children?: React.ReactElement<any>;
90
- anchorEl?: string | HTMLElement | React.RefObject<HTMLElement>;
91
- title: React.ReactNode;
110
+ children?: React$1.ReactElement<any>;
111
+ anchorEl?: string | HTMLElement | React$1.RefObject<HTMLElement>;
112
+ title: React$1.ReactNode;
92
113
  enterDelay?: number;
93
114
  leaveDelay?: number;
94
115
  className?: string;
95
116
  disabled?: boolean;
96
117
  }
97
- declare const Tooltip: React.FC<TooltipProps$1>;
118
+ declare const Tooltip: React$1.FC<TooltipProps$1>;
98
119
 
99
120
  declare namespace Cortex {
100
121
  type Tag = {
@@ -119,16 +140,16 @@ interface TooltipProps {
119
140
  onTextChange?: (text: string) => void;
120
141
  onChange?: (tags: Cortex.Tag[]) => void;
121
142
  }
122
- declare const TagInput: React.FC<TooltipProps>;
143
+ declare const TagInput: React$1.FC<TooltipProps>;
123
144
 
124
145
  interface MenuProps {
125
- containerRef: React.RefObject<HTMLElement>;
146
+ containerRef: React$1.RefObject<HTMLElement>;
126
147
  className?: string;
127
- children?: React.ReactNode;
148
+ children?: React$1.ReactNode;
128
149
  onClose?: () => void;
129
- onClick?: (event: React.MouseEvent<HTMLUListElement> | undefined) => void;
150
+ onClick?: (event: React$1.MouseEvent<HTMLUListElement> | undefined) => void;
130
151
  }
131
- declare const Menu: React.FC<MenuProps>;
152
+ declare const Menu: React$1.FC<MenuProps>;
132
153
 
133
154
  interface AuthDownloadLinkProps {
134
155
  url: string;
@@ -137,61 +158,61 @@ interface AuthDownloadLinkProps {
137
158
  };
138
159
  token: string;
139
160
  label?: string;
140
- onStart?: (event: React.MouseEvent<HTMLButtonElement> | undefined) => void;
161
+ onStart?: (event: React$1.MouseEvent<HTMLButtonElement> | undefined) => void;
141
162
  onCompleted?: () => void;
142
163
  onError?: (error: any) => void;
143
164
  }
144
- declare const AuthDownloadLink: React.FC<AuthDownloadLinkProps>;
165
+ declare const AuthDownloadLink: React$1.FC<AuthDownloadLinkProps>;
145
166
 
146
167
  interface ContextMenuProps {
147
168
  className?: string;
148
- children?: React.ReactNode;
169
+ children?: React$1.ReactNode;
149
170
  open?: boolean;
150
171
  placement?: ObjectValues<typeof PopperPlacement>;
151
- container?: string | HTMLElement | React.RefObject<HTMLElement>;
172
+ container?: string | HTMLElement | React$1.RefObject<HTMLElement>;
152
173
  onOpen?: () => void;
153
174
  onClose?: () => void;
154
175
  }
155
- declare const ContextMenu: React.FC<ContextMenuProps>;
176
+ declare const ContextMenu: React$1.FC<ContextMenuProps>;
156
177
 
157
178
  interface MenuItemProps {
158
179
  className?: string;
159
180
  style?: CSSProperties | undefined;
160
- children?: React.ReactNode;
181
+ children?: React$1.ReactNode;
161
182
  label?: string;
162
- icon?: React.ReactNode;
183
+ icon?: React$1.ReactNode;
163
184
  active?: boolean;
164
185
  disable?: boolean;
165
- itemTemplate?: React.ReactNode;
166
- onClick?: (event: React.MouseEvent<HTMLButtonElement> | undefined) => void;
186
+ itemTemplate?: React$1.ReactNode;
187
+ onClick?: (event: React$1.MouseEvent<HTMLButtonElement> | undefined) => void;
167
188
  }
168
- declare const MenuItem: React.FC<MenuItemProps>;
189
+ declare const MenuItem: React$1.FC<MenuItemProps>;
169
190
 
170
191
  interface DividerProps {
171
192
  className?: string;
172
193
  }
173
- declare const Divider: React.FC<DividerProps>;
194
+ declare const Divider: React$1.FC<DividerProps>;
174
195
 
175
196
  interface PopupMenuProps {
176
197
  className?: string;
177
- children?: React.ReactNode;
198
+ children?: React$1.ReactNode;
178
199
  open?: boolean;
179
200
  placement?: ObjectValues<typeof PopperPlacement>;
180
201
  anchorPosition?: {
181
202
  top: number;
182
203
  left: number;
183
204
  };
184
- anchorEl?: string | HTMLElement | React.RefObject<HTMLElement>;
205
+ anchorEl?: string | HTMLElement | React$1.RefObject<HTMLElement>;
185
206
  onClose?: () => void;
186
207
  }
187
- declare const PopupMenu: React.FC<PopupMenuProps>;
208
+ declare const PopupMenu: React$1.FC<PopupMenuProps>;
188
209
 
189
210
  interface MenuGroupProps {
190
211
  title?: string;
191
212
  className?: string;
192
- children?: React.ReactNode;
213
+ children?: React$1.ReactNode;
193
214
  }
194
- declare const MenuGroup: React.FC<MenuGroupProps>;
215
+ declare const MenuGroup: React$1.FC<MenuGroupProps>;
195
216
 
196
217
  interface DialogProps {
197
218
  open: boolean;
@@ -199,89 +220,89 @@ interface DialogProps {
199
220
  fullWidth?: boolean;
200
221
  fullHeight?: boolean;
201
222
  className?: string;
202
- children?: React.ReactNode;
223
+ children?: React$1.ReactNode;
203
224
  onClose?: (() => void);
204
225
  }
205
- declare const Dialog: React.FC<DialogProps>;
226
+ declare const Dialog: React$1.FC<DialogProps>;
206
227
 
207
228
  interface DialogContentProps$2 {
208
229
  className?: string;
209
- children?: React.ReactNode;
230
+ children?: React$1.ReactNode;
210
231
  }
211
- declare const DialogContent$1: React.FC<DialogContentProps$2>;
232
+ declare const DialogContent$1: React$1.FC<DialogContentProps$2>;
212
233
 
213
234
  interface DialogFooterProps {
214
235
  className?: string;
215
- children?: React.ReactNode;
236
+ children?: React$1.ReactNode;
216
237
  }
217
- declare const DialogFooter: React.FC<DialogFooterProps>;
238
+ declare const DialogFooter: React$1.FC<DialogFooterProps>;
218
239
 
219
240
  interface DialogHeaderProps {
220
241
  className?: string;
221
- children?: React.ReactNode;
242
+ children?: React$1.ReactNode;
222
243
  }
223
- declare const DialogHeader: React.FC<DialogHeaderProps>;
244
+ declare const DialogHeader: React$1.FC<DialogHeaderProps>;
224
245
 
225
246
  interface DialogContentProps$1 {
226
247
  className?: string;
227
- children?: React.ReactNode;
248
+ children?: React$1.ReactNode;
228
249
  closeDisable?: boolean;
229
250
  onClose?: (() => void);
230
251
  }
231
- declare const DialogContent: React.FC<DialogContentProps$1>;
252
+ declare const DialogContent: React$1.FC<DialogContentProps$1>;
232
253
 
233
254
  interface DialogContentProps {
234
255
  className?: string;
235
- children?: React.ReactNode;
256
+ children?: React$1.ReactNode;
236
257
  }
237
- declare const DialogActions: React.FC<DialogContentProps>;
258
+ declare const DialogActions: React$1.FC<DialogContentProps>;
238
259
 
239
260
  interface ConfirmDialogProps {
240
261
  title: string;
241
262
  ok?: string;
242
263
  cancel?: string;
243
- children?: React.ReactNode;
264
+ children?: React$1.ReactNode;
244
265
  className?: string;
245
266
  onClose?: (isOk: boolean) => void;
246
267
  }
247
- declare const ConfirmDialog: React.FC<ConfirmDialogProps>;
268
+ declare const ConfirmDialog: React$1.FC<ConfirmDialogProps>;
248
269
 
249
270
  interface ErrorDialogProps {
250
271
  title: string;
251
272
  ok?: string;
252
- children?: React.ReactNode;
273
+ children?: React$1.ReactNode;
253
274
  className?: string;
254
275
  onClose?: (isOk: boolean) => void;
255
276
  }
256
- declare const ErrorDialog: React.FC<ErrorDialogProps>;
277
+ declare const ErrorDialog: React$1.FC<ErrorDialogProps>;
257
278
 
258
279
  interface WarningDialogProps {
259
280
  title: string;
260
281
  ok?: string;
261
- children?: React.ReactNode;
282
+ children?: React$1.ReactNode;
262
283
  className?: string;
263
284
  onClose?: (isOk: boolean) => void;
264
285
  }
265
- declare const WarningDialog: React.FC<WarningDialogProps>;
286
+ declare const WarningDialog: React$1.FC<WarningDialogProps>;
266
287
 
267
288
  interface Props$3 {
268
289
  className?: string;
269
290
  }
270
- declare const ChevronDownIcon: React.FC<Props$3>;
291
+ declare const ChevronDownIcon: React$1.FC<Props$3>;
271
292
 
272
293
  interface Props$2 {
273
294
  className?: string;
274
295
  }
275
- declare const ChevronRightIcon: React.FC<Props$2>;
296
+ declare const ChevronRightIcon: React$1.FC<Props$2>;
276
297
 
277
298
  interface Props$1 {
278
299
  className?: string;
279
300
  }
280
- declare const ChevronLeftIcon: React.FC<Props$1>;
301
+ declare const ChevronLeftIcon: React$1.FC<Props$1>;
281
302
 
282
303
  interface Props {
283
304
  className?: string;
284
305
  }
285
- declare const CrossIcon: React.FC<Props>;
306
+ declare const CrossIcon: React$1.FC<Props>;
286
307
 
287
- export { AuthDownloadLink, BarLoader, Button, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ConfirmDialog, ContextMenu, CrossIcon, Dialog, DialogActions, DialogContent$1 as DialogContent, DialogFooter, DialogHeader, DialogContent as DialogTitle, Divider, DomContainer, ErrorDialog, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog };
308
+ export { AuthDownloadLink, BarLoader, Button, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ConfirmDialog, ContextMenu, CrossIcon, Dialog, DialogActions, DialogContent$1 as DialogContent, DialogFooter, DialogHeader, DialogContent as DialogTitle, Divider, DomContainer, ErrorDialog, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Scanner, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog };
@@ -0,0 +1,106 @@
1
+ @import "../global.scss";
2
+
3
+ @mixin scanner($props: null, $options: null) {
4
+ $internal-options: $default-options;
5
+
6
+ $internal-props: (
7
+ bgColor: #ffffff,
8
+ fgColor: $color-grey-darker,
9
+ closeBtnColor: $color-grey,
10
+ closeBtnHoverColor: $color-blue,
11
+ closeBtnDisableColor: $color-blue-grey-lighter,
12
+ confirm: (
13
+ headerBgColor: $color-orange-dark,
14
+ headerFgColor: #ffffff,
15
+ bgColor: #ffffff,
16
+ fgColor: $color-grey-darker,
17
+ ),
18
+ error: (
19
+ headerBgColor: $color-red,
20
+ headerFgColor: #ffffff,
21
+ bgColor: #ffffff,
22
+ fgColor: $color-grey-darker,
23
+ ),
24
+ warning: (
25
+ headerBgColor: $color-grey,
26
+ headerFgColor: #ffffff,
27
+ bgColor: #ffffff,
28
+ fgColor: $color-grey-darker,
29
+ ),
30
+ );
31
+
32
+ $internal-props: safe-map-merge($internal-props, $props);
33
+ $internal-options: safe-map-merge($internal-options, $options);
34
+
35
+ .btn {
36
+ display: 'flex';
37
+ align-items: 'center';
38
+ justify-content: 'center';
39
+ padding: '0.5rem 1rem';
40
+ border: '1px solid transparent';
41
+ border-radius: '0.375rem';
42
+ box-shadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)';
43
+ font-size: '0.875rem';
44
+ font-weight: '500';
45
+ line-height: '1.25rem';
46
+ text-align: 'center';
47
+ text-transform: 'none';
48
+ white-space: 'nowrap';
49
+ vertical-align: 'middle';
50
+ user-select: 'none';
51
+ background-color: '#4F46E5';
52
+ color: '#fff';
53
+ cursor: 'pointer';
54
+ outline: 'none';
55
+ transition: 'background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s';
56
+ }
57
+
58
+ .btn-default {
59
+ background-color: '#4F46E5';
60
+ }
61
+
62
+ .btn-default:hover {
63
+ opacity: '0.8';
64
+ }
65
+
66
+ .select {
67
+ display: 'block';
68
+ width: '100%';
69
+ padding-left: '0.75rem';
70
+ color: '#000';
71
+ padding-right: '2.5rem';
72
+ padding-top: '0.5rem';
73
+ padding-bottom: '0.5rem';
74
+ font-size: '1rem';
75
+ border-radius: '0.375rem';
76
+ }
77
+
78
+ /* DIALOG */
79
+ .dialog-header {
80
+ display: 'flex';
81
+ justify-content: 'space-between';
82
+ }
83
+
84
+ .dialog-mask {
85
+ overflow-x: 'hidden';
86
+ overflow-y: 'auto';
87
+ display: 'flex';
88
+ justify-content: 'center';
89
+ padding-top: '2.5rem';
90
+ padding-bottom: '5rem';
91
+ background-color: #0005;
92
+ position: fixed;
93
+ inset: 0;
94
+ }
95
+
96
+ .dialog-body {
97
+ display: 'flex';
98
+ flex-direction: 'column';
99
+ gap: '1.25rem';
100
+ padding: '1.25rem';
101
+ height: 'max-content';
102
+ background-color: white;
103
+ }
104
+
105
+ /* DIALOG */
106
+ }
@@ -8,6 +8,7 @@
8
8
  @import "TextField";
9
9
  @import "Menu";
10
10
  @import "Dialog";
11
+ @import "Scanner";
11
12
  @import "Button";
12
13
  @import "ToggleButton";
13
14
  @import "Selected";
@@ -21,6 +22,7 @@
21
22
  @include taginput();
22
23
  @include input();
23
24
  @include menu();
25
+ @include scanner();
24
26
  @include dialog();
25
27
  @include button();
26
28
  @include toggleButton();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortex-react-ui",
3
- "version": "0.1.156",
3
+ "version": "0.1.158",
4
4
  "description": "React UI",
5
5
  "author": "Anthony",
6
6
  "license": "MIT",