@mtes-mct/monitor-ui 8.1.1 → 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 CHANGED
@@ -1,3 +1,11 @@
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
+
1
9
  # [8.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.0.0...v8.1.0) (2023-08-07)
2
10
 
3
11
 
package/index.js CHANGED
@@ -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
- return jsx(StyledDropdownItem, { "$hasIcon": hasIcon, icon: icon, ...originalProps });
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 StyledDropdownItem = styled(Dropdown$1.Item) `
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
- return jsx(StyledDropdown, { "$hasIcon": hasIcon, className: controlledClassName, icon: icon, ...originalProps });
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 StyledDropdown = styled(Dropdown$1) `
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
@@ -3613,10 +3658,12 @@ const Th = styled(SimpleTable.Th) `
3613
3658
  border-top: 1px solid ${p => p.theme.color.lightGray};
3614
3659
  border-bottom: 1px solid ${p => p.theme.color.lightGray};
3615
3660
  border-right: none;
3661
+ padding: 2px 10px;
3616
3662
  `;
3617
3663
  const BodyTr = styled(SimpleTable.BodyTr) `
3618
3664
  td:last-child {
3619
3665
  border-right: 1px solid ${p => p.theme.color.lightGray};
3666
+ overflow: visible;
3620
3667
  }
3621
3668
  `;
3622
3669
  const Td = styled(SimpleTable.Td) `
@@ -3624,6 +3671,7 @@ const Td = styled(SimpleTable.Td) `
3624
3671
  border-top: 1px solid ${p => p.theme.color.lightGray};
3625
3672
  border-right: none;
3626
3673
  padding: 4px 10px;
3674
+ border-right: ${p => (p.$hasRightBorder ? `1px solid ${p.theme.color.lightGray}` : '')};
3627
3675
  `;
3628
3676
  const TableWithSelectableRows = {
3629
3677
  BodyTr,