@mtes-mct/monitor-ui 8.1.0 → 8.2.0
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/CHANGELOG.md +22 -0
- package/assets/stylesheets/rsuite-override.css +0 -6
- package/index.js +65 -10
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Dropdown/Item.d.ts +3 -1
- package/src/components/Dropdown/index.d.ts +2 -0
- package/src/elements/Table/TableWithSelectableRows/RowCheckbox.d.ts +9 -0
- package/src/elements/Table/{TableWithSelectableRows.d.ts → TableWithSelectableRows/index.d.ts} +5 -0
- package/src/fields/Checkbox.d.ts +1 -1
- package/src/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [8.1.1](https://github.com/MTES-MCT/monitor-ui/compare/v8.1.0...v8.1.1) (2023-08-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **elements:** clean RowCheckbox component ([0128e98](https://github.com/MTES-MCT/monitor-ui/commit/0128e98ec19e3a302f696b8e62f33aa949601193))
|
|
7
|
+
* **elements:** update checkbox style for TableWithSelectableRows components ([aa15faa](https://github.com/MTES-MCT/monitor-ui/commit/aa15faae2adb7359d11ad548c23c8c67353505c7))
|
|
8
|
+
|
|
9
|
+
# [8.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.0.0...v8.1.0) (2023-08-07)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **components:** anyify children type in NewWindow ([5a73dfa](https://github.com/MTES-MCT/monitor-ui/commit/5a73dfadb676417f1436245e9824bd1b96761a19))
|
|
15
|
+
* **components:** re-type ToastContainer in Notifier ([b2f8e74](https://github.com/MTES-MCT/monitor-ui/commit/b2f8e747ca1fbfb5fe0a3ba25d2a76f719bcaa58))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **elements:** add TableWithRowSelection ([93ed01e](https://github.com/MTES-MCT/monitor-ui/commit/93ed01ef5d96644f1ce04a11d59225eb02af69b2))
|
|
21
|
+
* **elements:** use SimpleTable style ([90beafa](https://github.com/MTES-MCT/monitor-ui/commit/90beafa5f3905781a7b59d85389028427713d9b7))
|
|
22
|
+
|
|
1
23
|
# [8.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v7.6.2...v8.0.0) (2023-07-19)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -259,9 +259,7 @@ label {
|
|
|
259
259
|
border-width: 0 0 2px;
|
|
260
260
|
-webkit-transform: rotate(0deg) scale(1);
|
|
261
261
|
transform: rotate(0deg) scale(1);
|
|
262
|
-
width: 8px;
|
|
263
262
|
margin-top: -1px;
|
|
264
|
-
margin-left: 5px;
|
|
265
263
|
}
|
|
266
264
|
|
|
267
265
|
.rs-checkbox-indeterminate .rs-checkbox-wrapper .rs-checkbox-inner::before {
|
|
@@ -274,9 +272,7 @@ label {
|
|
|
274
272
|
border-width: 0 0 2px;
|
|
275
273
|
-webkit-transform: rotate(0deg) scale(1);
|
|
276
274
|
transform: rotate(0deg) scale(1);
|
|
277
|
-
width: 8px;
|
|
278
275
|
margin-top: 0px;
|
|
279
|
-
margin-left: 6px;
|
|
280
276
|
}
|
|
281
277
|
|
|
282
278
|
.rs-checkbox-disabled:not(.rs-checkbox-checked):not(.rs-checkbox-indeterminate)
|
|
@@ -303,8 +299,6 @@ label:hover .rs-checkbox-wrapper .rs-checkbox-inner:before {
|
|
|
303
299
|
.rs-checkbox-checked .rs-checkbox-wrapper .rs-checkbox-inner::after {
|
|
304
300
|
border: solid var(--white);
|
|
305
301
|
border-width: 0 2px 2px 0;
|
|
306
|
-
margin-top: 3px !important;
|
|
307
|
-
margin-left: 6px !important;
|
|
308
302
|
}
|
|
309
303
|
|
|
310
304
|
.checkbox-hidden > div > label > .rs-checkbox-wrapper {
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, css } from 'styled-components';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import t, { useMemo, PureComponent, forwardRef, useEffect, useReducer, useState, useRef, isValidElement, cloneElement, useLayoutEffect, useCallback, useImperativeHandle, createContext, useContext } from 'react';
|
|
4
|
-
import { Dropdown as Dropdown$1,
|
|
4
|
+
import { Dropdown as Dropdown$1, Checkbox as Checkbox$1, AutoComplete, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, TagPicker, Radio, Input, SelectPicker } from 'rsuite';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
import { useField, useFormikContext } from 'formik';
|
|
7
7
|
import { captureMessage } from '@sentry/react';
|
|
@@ -2268,38 +2268,59 @@ const Dialog = Object.assign(RawDialog, {
|
|
|
2268
2268
|
Title
|
|
2269
2269
|
});
|
|
2270
2270
|
|
|
2271
|
-
function Item({ Icon, ...originalProps }) {
|
|
2271
|
+
function Item({ accent, Icon, ...originalProps }) {
|
|
2272
2272
|
const icon = useMemo(() => (Icon ? jsx(Icon, { size: 20 }) : undefined), [Icon]);
|
|
2273
2273
|
const hasIcon = useMemo(() => Boolean(Icon), [Icon]);
|
|
2274
|
-
|
|
2274
|
+
switch (accent) {
|
|
2275
|
+
case Accent.SECONDARY:
|
|
2276
|
+
return jsx(SecondaryDropdownItem, { "$hasIcon": hasIcon, icon: icon, ...originalProps });
|
|
2277
|
+
default:
|
|
2278
|
+
return jsx(PrimaryDropdownItem, { "$hasIcon": hasIcon, icon: icon, ...originalProps });
|
|
2279
|
+
}
|
|
2275
2280
|
}
|
|
2276
2281
|
// TODO We need to split that into multiple styled components as done in `<Button />`.
|
|
2277
|
-
const
|
|
2282
|
+
const SecondaryDropdownItem = styled(Dropdown$1.Item) `
|
|
2283
|
+
background-color: ${p => p.theme.color.cultured};
|
|
2284
|
+
border: 1px solid ${p => p.theme.color.lightGray};
|
|
2285
|
+
padding: 5px 7px;
|
|
2286
|
+
:hover {
|
|
2287
|
+
background-color: ${p => p.theme.color.cultured};
|
|
2288
|
+
border: 1px solid ${p => p.theme.color.lightGray};
|
|
2289
|
+
color: ${p => p.theme.color.blueYonder['100']};
|
|
2290
|
+
}
|
|
2291
|
+
&:not(:last-child) {
|
|
2292
|
+
margin-bottom: 1px;
|
|
2293
|
+
}
|
|
2294
|
+
`;
|
|
2295
|
+
const PrimaryDropdownItem = styled(Dropdown$1.Item) `
|
|
2278
2296
|
align-items: center;
|
|
2279
2297
|
display: flex;
|
|
2280
2298
|
font-size: 13px;
|
|
2281
2299
|
line-height: 1;
|
|
2282
|
-
padding: 12px;
|
|
2283
2300
|
padding: ${p => (p.$hasIcon ? '7px' : '11px')} 12px ${p => (p.$hasIcon ? '9px' : '14px')};
|
|
2284
2301
|
|
|
2285
2302
|
&:not(:last-child) {
|
|
2286
2303
|
border-bottom: 1px solid var(--lightGray);
|
|
2287
2304
|
}
|
|
2288
|
-
|
|
2289
|
-
/* SVG Icon Components are wrapped within a <div /> */
|
|
2305
|
+
/* SVG Icon Components are wrapped within a <div /> */
|
|
2290
2306
|
> div {
|
|
2291
2307
|
margin-top: 1px;
|
|
2292
2308
|
}
|
|
2293
2309
|
`;
|
|
2294
2310
|
|
|
2295
|
-
function RawDropdown({ className, Icon, ...originalProps }) {
|
|
2311
|
+
function RawDropdown({ accent, className, Icon, ...originalProps }) {
|
|
2296
2312
|
const controlledClassName = classnames('Component-Dropdow', className);
|
|
2297
2313
|
const icon = useMemo(() => (Icon ? jsx(Icon, { size: 20 }) : undefined), [Icon]);
|
|
2298
2314
|
const hasIcon = useMemo(() => Boolean(Icon), [Icon]);
|
|
2299
|
-
|
|
2315
|
+
switch (accent) {
|
|
2316
|
+
case Accent.SECONDARY:
|
|
2317
|
+
return jsx(SecondaryDropdown, { "$hasIcon": hasIcon, className: controlledClassName, icon: icon, ...originalProps });
|
|
2318
|
+
default:
|
|
2319
|
+
return jsx(PrimaryDropdown, { "$hasIcon": hasIcon, className: controlledClassName, icon: icon, ...originalProps });
|
|
2320
|
+
}
|
|
2300
2321
|
}
|
|
2301
2322
|
// TODO We need to split into multiple styled components as done in `<Button />`.
|
|
2302
|
-
const
|
|
2323
|
+
const PrimaryDropdown = styled(Dropdown$1) `
|
|
2303
2324
|
.rs-btn {
|
|
2304
2325
|
align-items: center;
|
|
2305
2326
|
background-color: ${p => p.theme.color.charcoal};
|
|
@@ -2347,6 +2368,30 @@ const StyledDropdown = styled(Dropdown$1) `
|
|
|
2347
2368
|
margin-right: 10px;
|
|
2348
2369
|
}
|
|
2349
2370
|
`;
|
|
2371
|
+
const SecondaryDropdown = styled(Dropdown$1) `
|
|
2372
|
+
.rs-btn {
|
|
2373
|
+
align-items: center;
|
|
2374
|
+
display: flex;
|
|
2375
|
+
padding: ${p => (p.$hasIcon ? '0px ' : '5px 12px 7px')};
|
|
2376
|
+
|
|
2377
|
+
:hover,
|
|
2378
|
+
:active {
|
|
2379
|
+
background-color: transparent;
|
|
2380
|
+
border: none;
|
|
2381
|
+
color: ${p => p.theme.color.blueYonder['100']};
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
> svg {
|
|
2385
|
+
display: none;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
> .rs-dropdown-menu {
|
|
2390
|
+
background-color: transparent;
|
|
2391
|
+
border-radius: 0;
|
|
2392
|
+
padding: 0;
|
|
2393
|
+
}
|
|
2394
|
+
`;
|
|
2350
2395
|
RawDropdown.displayName = 'Dropdown';
|
|
2351
2396
|
const Dropdown = Object.assign(RawDropdown, {
|
|
2352
2397
|
Item
|
|
@@ -3589,6 +3634,12 @@ const SimpleTable = {
|
|
|
3589
3634
|
Th: Th$1
|
|
3590
3635
|
};
|
|
3591
3636
|
|
|
3637
|
+
function RowCheckbox({ className = '', disabled = false, isChecked = false, isIndeterminate = false, onChange = () => undefined }) {
|
|
3638
|
+
return (jsx(Checkbox$1, { checked: isChecked, className: `${className} cursor-pointer`, disabled: disabled, indeterminate: isIndeterminate,
|
|
3639
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3640
|
+
onChange: (_, __, event) => onChange(event) }));
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3592
3643
|
const Table = styled(SimpleTable.Table) `
|
|
3593
3644
|
border-collapse: separate;
|
|
3594
3645
|
border-spacing: 0 5px;
|
|
@@ -3607,10 +3658,12 @@ const Th = styled(SimpleTable.Th) `
|
|
|
3607
3658
|
border-top: 1px solid ${p => p.theme.color.lightGray};
|
|
3608
3659
|
border-bottom: 1px solid ${p => p.theme.color.lightGray};
|
|
3609
3660
|
border-right: none;
|
|
3661
|
+
padding: 2px 10px;
|
|
3610
3662
|
`;
|
|
3611
3663
|
const BodyTr = styled(SimpleTable.BodyTr) `
|
|
3612
3664
|
td:last-child {
|
|
3613
3665
|
border-right: 1px solid ${p => p.theme.color.lightGray};
|
|
3666
|
+
overflow: visible;
|
|
3614
3667
|
}
|
|
3615
3668
|
`;
|
|
3616
3669
|
const Td = styled(SimpleTable.Td) `
|
|
@@ -3618,10 +3671,12 @@ const Td = styled(SimpleTable.Td) `
|
|
|
3618
3671
|
border-top: 1px solid ${p => p.theme.color.lightGray};
|
|
3619
3672
|
border-right: none;
|
|
3620
3673
|
padding: 4px 10px;
|
|
3674
|
+
border-right: ${p => (p.$hasRightBorder ? `1px solid ${p.theme.color.lightGray}` : '')};
|
|
3621
3675
|
`;
|
|
3622
3676
|
const TableWithSelectableRows = {
|
|
3623
3677
|
BodyTr,
|
|
3624
3678
|
Head,
|
|
3679
|
+
RowCheckbox,
|
|
3625
3680
|
SortContainer,
|
|
3626
3681
|
Table,
|
|
3627
3682
|
Td,
|