@mtes-mct/monitor-ui 8.1.1 → 8.3.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,19 @@
1
+ # [8.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.1.1...v8.2.0) (2023-08-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * **components:** create primary and secondary accent for dropdown component ([7e29c6a](https://github.com/MTES-MCT/monitor-ui/commit/7e29c6a6d81a610b5a97c2fc4271adfd6504d8f1))
7
+ * **elements:** add buttonsGroup component in TableWithSelectableRows component ([4a144d6](https://github.com/MTES-MCT/monitor-ui/commit/4a144d6571ac365339d89f20e792ea3f72217bf4))
8
+
9
+ ## [8.1.1](https://github.com/MTES-MCT/monitor-ui/compare/v8.1.0...v8.1.1) (2023-08-09)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **elements:** clean RowCheckbox component ([0128e98](https://github.com/MTES-MCT/monitor-ui/commit/0128e98ec19e3a302f696b8e62f33aa949601193))
15
+ * **elements:** update checkbox style for TableWithSelectableRows components ([aa15faa](https://github.com/MTES-MCT/monitor-ui/commit/aa15faae2adb7359d11ad548c23c8c67353505c7))
16
+
1
17
  # [8.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.0.0...v8.1.0) (2023-08-07)
2
18
 
3
19
 
package/index.js CHANGED
@@ -2188,7 +2188,7 @@ const Action = styled.div `
2188
2188
  }
2189
2189
  `;
2190
2190
 
2191
- const Body = styled.div `
2191
+ const Body$1 = styled.div `
2192
2192
  background-color: ${p => p.theme.color.white};
2193
2193
  border-top-left-radius: 2px;
2194
2194
  border-top-right-radius: 2px;
@@ -2207,7 +2207,7 @@ const Body = styled.div `
2207
2207
  }
2208
2208
  `;
2209
2209
 
2210
- const Title = styled.h4 `
2210
+ const Title$1 = styled.h4 `
2211
2211
  font-size: 125%;
2212
2212
  font-weight: 500;
2213
2213
  line-height: 48px;
@@ -2264,42 +2264,63 @@ const Window = styled.div `
2264
2264
  RawDialog.displayName = 'Dialog';
2265
2265
  const Dialog = Object.assign(RawDialog, {
2266
2266
  Action,
2267
- Body,
2268
- Title
2267
+ Body: Body$1,
2268
+ Title: Title$1
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
@@ -3332,27 +3377,35 @@ var index = /*#__PURE__*/Object.freeze({
3332
3377
  Vms: Vms
3333
3378
  });
3334
3379
 
3335
- function SingleTag({ children, className, onDelete, ...nativeProps }) {
3380
+ function SingleTag({ accent = Accent.PRIMARY, children, className, onDelete, ...nativeProps }) {
3336
3381
  const controlledClassName = classnames('Component-SingleTag', className);
3337
3382
  const handleDelete = useCallback(() => {
3338
3383
  if (onDelete) {
3339
3384
  onDelete();
3340
3385
  }
3341
3386
  }, [onDelete]);
3342
- return (jsxs(Box$g, { className: controlledClassName, ...nativeProps, children: [jsx(Text, { children: children }), jsx(StyledIconButton, { accent: Accent.TERTIARY, Icon: Close, iconSize: 10, onClick: handleDelete })] }));
3387
+ switch (accent) {
3388
+ case Accent.SECONDARY:
3389
+ return (jsxs(Box$g, { className: controlledClassName, ...nativeProps, children: [jsx(SecondaryText, { children: children }), jsx(SecondaryIconButton, { accent: Accent.TERTIARY, Icon: Close, iconSize: 10, onClick: handleDelete })] }));
3390
+ default:
3391
+ return (jsxs(Box$g, { className: controlledClassName, ...nativeProps, children: [jsx(PrimaryText, { children: children }), jsx(PrimaryIconButton, { accent: Accent.TERTIARY, Icon: Close, iconSize: 10, onClick: handleDelete })] }));
3392
+ }
3343
3393
  }
3344
3394
  const Box$g = styled.div `
3345
3395
  align-items: center;
3346
3396
  display: inline-flex;
3347
3397
  `;
3348
- const Text = styled.span `
3398
+ const PrimaryText = styled.span `
3349
3399
  background-color: ${p => p.theme.color.lightGray};
3350
3400
  color: ${p => p.theme.color.gunMetal};
3351
3401
  font-size: 13px;
3352
3402
  line-height: 1.3846;
3353
3403
  padding: 3px 8px 5px;
3404
+ overflow: hidden;
3405
+ text-overflow: ellipsis;
3406
+ white-space: nowrap;
3354
3407
  `;
3355
- const StyledIconButton = styled(IconButton) `
3408
+ const PrimaryIconButton = styled(IconButton) `
3356
3409
  background-color: ${p => p.theme.color.lightGray};
3357
3410
  margin-left: 1px;
3358
3411
  padding: 7px;
@@ -3372,6 +3425,85 @@ const StyledIconButton = styled(IconButton) `
3372
3425
  background-color: ${p => p.theme.color.lightGray};
3373
3426
  }
3374
3427
  `;
3428
+ const SecondaryText = styled(PrimaryText) `
3429
+ background-color: ${p => p.theme.color.blueYonder[100]};
3430
+ color: ${p => p.theme.color.white};
3431
+ `;
3432
+ const SecondaryIconButton = styled(PrimaryIconButton) `
3433
+ background-color: ${p => p.theme.color.blueYonder[100]};
3434
+ color: ${p => p.theme.color.white};
3435
+
3436
+ :hover,
3437
+ &._hover {
3438
+ background-color: ${p => p.theme.color.blueYonder[100]};
3439
+ color: ${p => p.theme.color.blueYonder[25]};
3440
+ }
3441
+
3442
+ :active,
3443
+ &._active {
3444
+ background-color: ${p => p.theme.color.blueYonder[100]};
3445
+ color: ${p => p.theme.color.blueYonder[25]};
3446
+ }
3447
+
3448
+ :disabled,
3449
+ &._disabled {
3450
+ background-color: ${p => p.theme.color.blueYonder[100]};
3451
+ color: ${p => p.theme.color.blueYonder[25]};
3452
+ }
3453
+ `;
3454
+
3455
+ const Container = styled.div `
3456
+ width: 320px;
3457
+ max-height: 520px;
3458
+ margin-right: 6px;
3459
+ background-color: ${p => p.theme.color.white};
3460
+ box-shadow: 0px 3px 6px ${p => p.theme.color.slateGray};
3461
+ position: relative;
3462
+ `;
3463
+ const Header = styled.div `
3464
+ height: 40px;
3465
+ background-color: ${p => p.theme.color.charcoal};
3466
+ display: flex;
3467
+ justify-content: space-between;
3468
+ padding-right: 4px;
3469
+ padding-left: 10px;
3470
+ align-items: center;
3471
+ `;
3472
+ const Title = styled.span `
3473
+ font-size: 16px;
3474
+ line-height: 22px;
3475
+ color: ${p => p.theme.color.white};
3476
+ `;
3477
+ const Body = styled.div `
3478
+ height: calc(100% - 40px);
3479
+ overflow-y: auto;
3480
+ padding: 12px;
3481
+ `;
3482
+ const VisibilityButton = styled(IconButton) `
3483
+ background-color: ${p => p.theme.color.gainsboro};
3484
+ `;
3485
+ const CloseButton = styled(IconButton) `
3486
+ color: white;
3487
+ `;
3488
+ const Footer = styled.div `
3489
+ background: ${p => p.theme.color.white};
3490
+ display: flex;
3491
+ flex-direction: column;
3492
+ gap: 8px;
3493
+ padding: 12px;
3494
+ position: absolute;
3495
+ bottom: 0;
3496
+ width: 100%;
3497
+ `;
3498
+ const MapMenuModal = {
3499
+ Body,
3500
+ CloseButton,
3501
+ Container,
3502
+ Footer,
3503
+ Header,
3504
+ Title,
3505
+ VisibilityButton
3506
+ };
3375
3507
 
3376
3508
  const Field$2 = styled.div.attrs(props => ({
3377
3509
  className: classnames('Element-Field', props.className)
@@ -3613,10 +3745,12 @@ const Th = styled(SimpleTable.Th) `
3613
3745
  border-top: 1px solid ${p => p.theme.color.lightGray};
3614
3746
  border-bottom: 1px solid ${p => p.theme.color.lightGray};
3615
3747
  border-right: none;
3748
+ padding: 2px 10px;
3616
3749
  `;
3617
3750
  const BodyTr = styled(SimpleTable.BodyTr) `
3618
3751
  td:last-child {
3619
3752
  border-right: 1px solid ${p => p.theme.color.lightGray};
3753
+ overflow: visible;
3620
3754
  }
3621
3755
  `;
3622
3756
  const Td = styled(SimpleTable.Td) `
@@ -3624,6 +3758,7 @@ const Td = styled(SimpleTable.Td) `
3624
3758
  border-top: 1px solid ${p => p.theme.color.lightGray};
3625
3759
  border-right: none;
3626
3760
  padding: 4px 10px;
3761
+ border-right: ${p => (p.$hasRightBorder ? `1px solid ${p.theme.color.lightGray}` : '')};
3627
3762
  `;
3628
3763
  const TableWithSelectableRows = {
3629
3764
  BodyTr,
@@ -36426,5 +36561,5 @@ function logSoftError({ context = {}, isSideWindowError = false, message, origin
36426
36561
  }
36427
36562
  }
36428
36563
 
36429
- export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
36564
+ export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MapMenuModal, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
36430
36565
  //# sourceMappingURL=index.js.map