cortex-react-ui 0.2.31 → 0.2.33
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/lib/cjs/Chip/Chip.d.ts +13 -0
- package/lib/cjs/Chip/index.d.ts +1 -0
- package/lib/cjs/DataGrid/DataGrid.d.ts +33 -0
- package/lib/cjs/DataGrid/DataGridRow.d.ts +3 -0
- package/lib/cjs/DataGrid/common.d.ts +50 -0
- package/lib/cjs/DataGrid/index.d.ts +1 -0
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/Chip/Chip.d.ts +13 -0
- package/lib/esm/Chip/index.d.ts +1 -0
- package/lib/esm/DataGrid/DataGrid.d.ts +33 -0
- package/lib/esm/DataGrid/DataGridRow.d.ts +3 -0
- package/lib/esm/DataGrid/common.d.ts +50 -0
- package/lib/esm/DataGrid/index.d.ts +1 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/index.d.ts +66 -5
- package/lib/styles/Chip/index.scss +131 -0
- package/lib/styles/DataGrid/index.scss +94 -0
- package/lib/styles/index.scss +4 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { CSSProperties } from 'react';
|
|
3
3
|
import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
|
|
4
4
|
import { WebcamProps } from 'react-webcam';
|
|
@@ -79,6 +79,67 @@ interface ButtonProps {
|
|
|
79
79
|
}
|
|
80
80
|
declare const Button: React__default.FC<ButtonProps>;
|
|
81
81
|
|
|
82
|
+
interface ChipProps {
|
|
83
|
+
label: string;
|
|
84
|
+
chipColor?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
|
|
85
|
+
chipRadius?: 'low' | 'medium' | 'hight';
|
|
86
|
+
size?: 'small' | 'medium' | 'large';
|
|
87
|
+
deletable: boolean;
|
|
88
|
+
onDelete?: () => void;
|
|
89
|
+
chipStyle?: React__default.CSSProperties;
|
|
90
|
+
icon?: React__default.ReactElement;
|
|
91
|
+
}
|
|
92
|
+
declare const Chip: React__default.FC<ChipProps>;
|
|
93
|
+
|
|
94
|
+
interface CellSegment {
|
|
95
|
+
value: React.ReactNode;
|
|
96
|
+
span: number;
|
|
97
|
+
}
|
|
98
|
+
interface ColumnBase<T> {
|
|
99
|
+
key: string;
|
|
100
|
+
header: React.ReactNode;
|
|
101
|
+
icon?: React.ReactElement;
|
|
102
|
+
width?: number | string;
|
|
103
|
+
align?: 'left' | 'center' | 'right';
|
|
104
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
105
|
+
whiteSpace?: 'normal' | 'nowrap' | 'pre-wrap' | 'break-spaces';
|
|
106
|
+
getSegments?: (row: T) => CellSegment[];
|
|
107
|
+
}
|
|
108
|
+
type ColumnDef<T> = ColumnBase<T> & {
|
|
109
|
+
columns?: readonly ColumnBase<T>[];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
type DataGridProps<T> = {
|
|
113
|
+
rows: readonly T[];
|
|
114
|
+
getRowId: (row: T) => string;
|
|
115
|
+
columns: readonly ColumnDef<T>[];
|
|
116
|
+
loading?: boolean;
|
|
117
|
+
dataEmptyLabel?: React__default.ReactNode;
|
|
118
|
+
linePerPageLabel?: string;
|
|
119
|
+
tableContainer?: React__default.CSSProperties;
|
|
120
|
+
tableStyle?: React__default.CSSProperties;
|
|
121
|
+
headerCellStyle?: React__default.CSSProperties;
|
|
122
|
+
cellStyle?: React__default.CSSProperties;
|
|
123
|
+
footerCellStyle?: React__default.CSSProperties;
|
|
124
|
+
contextMenuStyle?: React__default.CSSProperties;
|
|
125
|
+
primaryRowColor?: string;
|
|
126
|
+
secondaryRowColor?: string;
|
|
127
|
+
hoverRowColor?: string;
|
|
128
|
+
selectedRowColor?: string;
|
|
129
|
+
defaultRowsPerPage?: number;
|
|
130
|
+
rowsPerPageOptions?: number[];
|
|
131
|
+
hoverableRows?: boolean;
|
|
132
|
+
selectableRows?: boolean;
|
|
133
|
+
onSelectedRowChange?: (row: T | null) => void;
|
|
134
|
+
onClickRow?: (row: T) => void;
|
|
135
|
+
onContextMenuRow?: (row: T) => void;
|
|
136
|
+
renderContextMenu?: (row: T, close: () => void) => React__default.ReactNode;
|
|
137
|
+
conditionnalRowStyle?: (row: T) => React__default.CSSProperties | undefined;
|
|
138
|
+
conditionnalColumnStyle?: (column: ColumnBase<T>, row: T) => React__default.CSSProperties | undefined;
|
|
139
|
+
conditionnalColumnHeaderStyle?: (column: ColumnBase<T>) => React__default.CSSProperties | undefined;
|
|
140
|
+
};
|
|
141
|
+
declare function DataGrid<T>(props: DataGridProps<T>): React__default.JSX.Element;
|
|
142
|
+
|
|
82
143
|
type TScanConfirmDialogLabels = {
|
|
83
144
|
title?: string;
|
|
84
145
|
message?: string;
|
|
@@ -415,12 +476,12 @@ declare const CrossIcon: React__default.FC<Props>;
|
|
|
415
476
|
* En React 18, ref est passé séparément via forwardRef
|
|
416
477
|
*/
|
|
417
478
|
type ForwardRefProps<T, P = object> = P & {
|
|
418
|
-
ref?: React.Ref<T>;
|
|
479
|
+
ref?: React$1.Ref<T>;
|
|
419
480
|
};
|
|
420
481
|
/**
|
|
421
482
|
* Type pour la fonction de rendu compatible React 18/19
|
|
422
483
|
*/
|
|
423
|
-
type ForwardRefRenderFunction<T, P> = (props: P, ref: React.ForwardedRef<T>) => React.ReactElement | null;
|
|
484
|
+
type ForwardRefRenderFunction<T, P> = (props: P, ref: React$1.ForwardedRef<T>) => React$1.ReactElement | null;
|
|
424
485
|
/**
|
|
425
486
|
* Composant wrapper compatible React 18 et React 19
|
|
426
487
|
*
|
|
@@ -441,7 +502,7 @@ type ForwardRefRenderFunction<T, P> = (props: P, ref: React.ForwardedRef<T>) =>
|
|
|
441
502
|
* );
|
|
442
503
|
* ```
|
|
443
504
|
*/
|
|
444
|
-
declare function forwardRef<T, P>(render: ForwardRefRenderFunction<T, P>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
505
|
+
declare function forwardRef<T, P>(render: ForwardRefRenderFunction<T, P>): React$1.ForwardRefExoticComponent<React$1.PropsWithoutRef<P> & React$1.RefAttributes<T>>;
|
|
445
506
|
|
|
446
|
-
export { AuthDownloadLink, BarLoader, Button, Camera, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ConfirmDialog, ContextMenu, CrossIcon, Dialog, DialogActions, DialogContent, DialogFooter, DialogHeader, DialogTitle, Divider, DomContainer, ErrorDialog, Map, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Scanner, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog, forwardRef };
|
|
507
|
+
export { AuthDownloadLink, BarLoader, Button, Camera, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, Chip, ConfirmDialog, ContextMenu, CrossIcon, DataGrid, Dialog, DialogActions, DialogContent, DialogFooter, DialogHeader, DialogTitle, Divider, DomContainer, ErrorDialog, Map, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Scanner, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog, forwardRef };
|
|
447
508
|
export type { ForwardRefProps, ForwardRefRenderFunction };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
@use "../global.scss";
|
|
2
|
+
|
|
3
|
+
@mixin chip($props: null, $options: null) {
|
|
4
|
+
|
|
5
|
+
$internal-options: global.$default-options;
|
|
6
|
+
|
|
7
|
+
$internal-props: ();
|
|
8
|
+
|
|
9
|
+
$internal-props: global.safe-map-merge($internal-props, $props);
|
|
10
|
+
$internal-options: global.safe-map-merge($internal-options, $options);
|
|
11
|
+
|
|
12
|
+
.chip-container {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
line-height: 2;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
background-color: global.$color-white;
|
|
20
|
+
color: global.$color-black;
|
|
21
|
+
border: 1px solid global.$color-black;
|
|
22
|
+
padding: 10px;
|
|
23
|
+
margin: 1px 2px 1px 2px;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
.chip-container-radius-low {
|
|
27
|
+
border-radius: 5px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.chip-container-radius-medium {
|
|
31
|
+
border-radius: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.chip-container-radius-hight {
|
|
35
|
+
border-radius: 25px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.chip-icon-wrapper {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
line-height: 0px;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
.chip-label {
|
|
46
|
+
display: inline-block;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
.chip-delete-button {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
padding: 0px;
|
|
54
|
+
border: none;
|
|
55
|
+
background: transparent;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
border-radius: 999px;
|
|
58
|
+
line-height: 1px;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
.chip-small-font {
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
padding-right: 6px;
|
|
64
|
+
padding-left: 6px;
|
|
65
|
+
gap: 6px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.chip-small-icon {
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
padding-right: 6px;
|
|
71
|
+
padding-left: 6px;
|
|
72
|
+
width: 16px;
|
|
73
|
+
height: 16px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.chip-medium-font {
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
padding-right: 8px;
|
|
79
|
+
padding-left: 8px;
|
|
80
|
+
gap: 8px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.chip-medium-icon {
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
padding-right: 8px;
|
|
86
|
+
padding-left: 8px;
|
|
87
|
+
width: 18px;
|
|
88
|
+
height: 18px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.chip-large-font {
|
|
92
|
+
font-size: 16px;
|
|
93
|
+
padding-right: 10px;
|
|
94
|
+
padding-left: 10px;
|
|
95
|
+
gap: 10px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.chip-large-icon {
|
|
99
|
+
font-size: 16px;
|
|
100
|
+
padding-right: 10px;
|
|
101
|
+
padding-left: 10px;
|
|
102
|
+
width: 20px;
|
|
103
|
+
height: 20px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.chip-color-primary {
|
|
107
|
+
color: global.$color-black;
|
|
108
|
+
background-color: global.$color-white;
|
|
109
|
+
border-color: global.$color-black;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.chip-color-secondary {
|
|
113
|
+
color: global.$color-grey-darker;
|
|
114
|
+
background-color: global.$color-grey-lighter;
|
|
115
|
+
border-color: global.$color-grey-darker;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.chip-color-success {
|
|
119
|
+
color: global.$color-green-darker;
|
|
120
|
+
background-color: global.$color-green-lighter;
|
|
121
|
+
border-color: global.$color-green-darker;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.chip-color-danger {
|
|
125
|
+
color: global.$color-red-darker;
|
|
126
|
+
background-color: global.$color-red-lighter;
|
|
127
|
+
border-color: global.$color-red-darker;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@use "../global.scss";
|
|
2
|
+
|
|
3
|
+
@mixin datagrid($props: null, $options: null) {
|
|
4
|
+
|
|
5
|
+
$internal-options: global.$default-options;
|
|
6
|
+
|
|
7
|
+
$internal-props: ();
|
|
8
|
+
|
|
9
|
+
$internal-props: global.safe-map-merge($internal-props, $props);
|
|
10
|
+
$internal-options: global.safe-map-merge($internal-options, $options);
|
|
11
|
+
|
|
12
|
+
.base-table-container {
|
|
13
|
+
max-height: 750px;
|
|
14
|
+
overflow: auto;
|
|
15
|
+
border: 1px solid global.$color-white;
|
|
16
|
+
position: relative;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
.base-table {
|
|
20
|
+
width: 100%;
|
|
21
|
+
border-collapse: collapse;
|
|
22
|
+
table-layout: fixed;
|
|
23
|
+
min-width: 900px;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
.base-thead {
|
|
27
|
+
position: sticky;
|
|
28
|
+
top: 0;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
.base-th {
|
|
32
|
+
border: 1px solid #eee;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
background-color: #fafafa;
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
position: sticky;
|
|
39
|
+
top: 0;
|
|
40
|
+
z-index: 3;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
.base-th span {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 6px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.base-td {
|
|
50
|
+
border: 1px solid #eee;
|
|
51
|
+
padding: 10px;
|
|
52
|
+
vertical-align: middle;
|
|
53
|
+
white-space: normal;
|
|
54
|
+
text-align: 'center',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
.base-foot-cell {
|
|
58
|
+
position: sticky;
|
|
59
|
+
bottom: 0;
|
|
60
|
+
z-index: 2;
|
|
61
|
+
background: #fff;
|
|
62
|
+
padding: 10px;
|
|
63
|
+
border-top: 1px solid #eee;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
.base-foot-cell div {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: flex-end;
|
|
70
|
+
gap: 16px;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.base-foot-cell div div {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: 8px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.base-context-menu {
|
|
81
|
+
position: fixed;
|
|
82
|
+
background: #fff;
|
|
83
|
+
border: 1px solid #d9d9d9;
|
|
84
|
+
border-radius: 8px;
|
|
85
|
+
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
86
|
+
padding: 8px;
|
|
87
|
+
min-width: 180px;
|
|
88
|
+
z-index: 9999;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
.text-align-center {
|
|
92
|
+
text-align: center;
|
|
93
|
+
}
|
|
94
|
+
}
|
package/lib/styles/index.scss
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
@use "Dialog";
|
|
11
11
|
@use "Scanner";
|
|
12
12
|
@use "Button";
|
|
13
|
+
@use "Chip";
|
|
14
|
+
@use "DataGrid";
|
|
13
15
|
@use "ToggleButton";
|
|
14
16
|
@use "Selected";
|
|
15
17
|
@use "BarLoader";
|
|
@@ -26,6 +28,8 @@
|
|
|
26
28
|
@include Scanner.scanner();
|
|
27
29
|
@include Dialog.dialog();
|
|
28
30
|
@include Button.button();
|
|
31
|
+
@include DataGrid.datagrid();
|
|
32
|
+
@include Chip.chip();
|
|
29
33
|
@include ToggleButton.toggleButton();
|
|
30
34
|
@include Selected.selected();
|
|
31
35
|
@include BarLoader.barLoader();
|