@mtes-mct/monitor-ui 8.2.0 → 8.4.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.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.2.0...v8.3.0) (2023-08-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * **component:** create MapMenuModal component ([07ff8b5](https://github.com/MTES-MCT/monitor-ui/commit/07ff8b5f41a9367e3131b47e904a6861d5f8c752))
7
+ * **components:** create secondary accent for single tag component ([259bb32](https://github.com/MTES-MCT/monitor-ui/commit/259bb3206f31231ba4af755c2f083c287e1136b4))
8
+
9
+ # [8.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.1.1...v8.2.0) (2023-08-10)
10
+
11
+
12
+ ### Features
13
+
14
+ * **components:** create primary and secondary accent for dropdown component ([7e29c6a](https://github.com/MTES-MCT/monitor-ui/commit/7e29c6a6d81a610b5a97c2fc4271adfd6504d8f1))
15
+ * **elements:** add buttonsGroup component in TableWithSelectableRows component ([4a144d6](https://github.com/MTES-MCT/monitor-ui/commit/4a144d6571ac365339d89f20e792ea3f72217bf4))
16
+
1
17
  ## [8.1.1](https://github.com/MTES-MCT/monitor-ui/compare/v8.1.0...v8.1.1) (2023-08-09)
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,8 +2264,8 @@ 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
2271
  function Item({ accent, Icon, ...originalProps }) {
@@ -3377,27 +3377,36 @@ var index = /*#__PURE__*/Object.freeze({
3377
3377
  Vms: Vms
3378
3378
  });
3379
3379
 
3380
- function SingleTag({ children, className, onDelete, ...nativeProps }) {
3380
+ function SingleTag({ accent = Accent.PRIMARY, children, className, onDelete, ...nativeProps }) {
3381
3381
  const controlledClassName = classnames('Component-SingleTag', className);
3382
3382
  const handleDelete = useCallback(() => {
3383
3383
  if (onDelete) {
3384
3384
  onDelete();
3385
3385
  }
3386
3386
  }, [onDelete]);
3387
- 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
+ }
3388
3393
  }
3389
3394
  const Box$g = styled.div `
3390
3395
  align-items: center;
3391
3396
  display: inline-flex;
3397
+ max-width: 100%;
3392
3398
  `;
3393
- const Text = styled.span `
3399
+ const PrimaryText = styled.span `
3394
3400
  background-color: ${p => p.theme.color.lightGray};
3395
3401
  color: ${p => p.theme.color.gunMetal};
3396
3402
  font-size: 13px;
3397
3403
  line-height: 1.3846;
3398
3404
  padding: 3px 8px 5px;
3405
+ overflow: hidden;
3406
+ text-overflow: ellipsis;
3407
+ white-space: nowrap;
3399
3408
  `;
3400
- const StyledIconButton = styled(IconButton) `
3409
+ const PrimaryIconButton = styled(IconButton) `
3401
3410
  background-color: ${p => p.theme.color.lightGray};
3402
3411
  margin-left: 1px;
3403
3412
  padding: 7px;
@@ -3417,6 +3426,86 @@ const StyledIconButton = styled(IconButton) `
3417
3426
  background-color: ${p => p.theme.color.lightGray};
3418
3427
  }
3419
3428
  `;
3429
+ const SecondaryText = styled(PrimaryText) `
3430
+ background-color: ${p => p.theme.color.blueYonder[100]};
3431
+ color: ${p => p.theme.color.white};
3432
+ `;
3433
+ const SecondaryIconButton = styled(PrimaryIconButton) `
3434
+ background-color: ${p => p.theme.color.blueYonder[100]};
3435
+ color: ${p => p.theme.color.white};
3436
+
3437
+ :hover,
3438
+ &._hover {
3439
+ background-color: ${p => p.theme.color.blueYonder[100]};
3440
+ color: ${p => p.theme.color.blueYonder[25]};
3441
+ }
3442
+
3443
+ :active,
3444
+ &._active {
3445
+ background-color: ${p => p.theme.color.blueYonder[100]};
3446
+ color: ${p => p.theme.color.blueYonder[25]};
3447
+ }
3448
+
3449
+ :disabled,
3450
+ &._disabled {
3451
+ background-color: ${p => p.theme.color.blueYonder[100]};
3452
+ color: ${p => p.theme.color.blueYonder[25]};
3453
+ }
3454
+ `;
3455
+
3456
+ const Container = styled.div `
3457
+ width: 320px;
3458
+ max-height: 520px;
3459
+ margin-right: 6px;
3460
+ background-color: ${p => p.theme.color.white};
3461
+ box-shadow: 0px 3px 6px ${p => p.theme.color.slateGray};
3462
+ position: relative;
3463
+ `;
3464
+ const Header = styled.div `
3465
+ height: 40px;
3466
+ background-color: ${p => p.theme.color.charcoal};
3467
+ display: flex;
3468
+ justify-content: space-between;
3469
+ padding-right: 4px;
3470
+ padding-left: 10px;
3471
+ align-items: center;
3472
+ `;
3473
+ const Title = styled.span `
3474
+ font-size: 16px;
3475
+ line-height: 22px;
3476
+ color: ${p => p.theme.color.white};
3477
+ `;
3478
+ const Body = styled.div `
3479
+ height: calc(100% - 40px);
3480
+ overflow-y: auto;
3481
+ padding: 12px;
3482
+ `;
3483
+ const VisibilityButton = styled(IconButton) `
3484
+ background-color: ${p => p.theme.color.gainsboro};
3485
+ `;
3486
+ const CloseButton = styled(IconButton) `
3487
+ color: white;
3488
+ `;
3489
+ const Footer = styled.div `
3490
+ background: ${p => p.theme.color.white};
3491
+ display: flex;
3492
+ flex-direction: column;
3493
+ gap: 8px;
3494
+ padding: 12px;
3495
+ position: absolute;
3496
+ bottom: 0;
3497
+ width: 100%;
3498
+ z-index: 10;
3499
+ `;
3500
+ const MapMenuModal = {
3501
+ Body,
3502
+ CloseButton,
3503
+ Container,
3504
+ Footer,
3505
+ Header,
3506
+ Title,
3507
+ VisibilityButton
3508
+ };
3420
3509
 
3421
3510
  const Field$2 = styled.div.attrs(props => ({
3422
3511
  className: classnames('Element-Field', props.className)
@@ -22183,7 +22272,7 @@ function sortDates(dates) {
22183
22272
  .map(dateAsIsoString => customDayjs(dateAsIsoString).toDate());
22184
22273
  }
22185
22274
 
22186
- function RangeCalendarPicker({ defaultValue, isHistorical, isOpen, onChange }) {
22275
+ function RangeCalendarPicker({ defaultValue, hasSingleCalendar = false, isHistorical, isOpen, onChange }) {
22187
22276
  const boxRef = useRef();
22188
22277
  // It's called "first" and "second" because the calendar can also be picked from right to left,
22189
22278
  // that's why we sort these first and second dates before calling `onChange()`
@@ -22215,7 +22304,7 @@ function RangeCalendarPicker({ defaultValue, isHistorical, isOpen, onChange }) {
22215
22304
  // and can be used as a container for <RsuiteDateRangePicker />
22216
22305
  forceUpdate();
22217
22306
  }, [forceUpdate]);
22218
- return (jsx(Box$7, { ref: boxRef, onClick: stopMouseEventPropagation, children: boxRef.current && (jsx(DateRangePicker$1, { container: boxRef.current, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, onSelect: handleSelect, open: isOpen, ranges: [], shouldDisableDate: shouldDisableDate,
22307
+ return (jsx(Box$7, { ref: boxRef, onClick: stopMouseEventPropagation, children: boxRef.current && (jsx(DateRangePicker$1, { container: boxRef.current, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, onSelect: handleSelect, open: isOpen, ranges: [], shouldDisableDate: shouldDisableDate, showOneCalendar: hasSingleCalendar,
22219
22308
  // `defaultValue` seems to be immediatly cancelled so we come down to using a controlled `value`
22220
22309
  // eslint-disable-next-line no-null/no-null
22221
22310
  value: controlledValue ?? null })) }));
@@ -22248,15 +22337,17 @@ const Box$7 = styled.div `
22248
22337
  box-shadow: inset 0px 0px 0px 1px ${p => p.theme.color.lightGray};
22249
22338
  border-radius: 0;
22250
22339
  margin-top: 2px;
22251
- width: 495px;
22252
22340
 
22253
22341
  .rs-picker-daterange-header,
22254
22342
  .rs-calendar-header-time-toolbar,
22255
22343
  .rs-picker-toolbar {
22256
22344
  display: none;
22257
22345
  }
22258
-
22259
22346
  .rs-picker-daterange-calendar-group {
22347
+ min-width: 495px;
22348
+ }
22349
+ .rs-picker-daterange-calendar-group,
22350
+ .rs-picker-daterange-calendar-single {
22260
22351
  height: auto;
22261
22352
 
22262
22353
  > .rs-calendar {
@@ -22390,7 +22481,7 @@ var DateRangePosition;
22390
22481
  DateRangePosition["START"] = "START";
22391
22482
  })(DateRangePosition || (DateRangePosition = {}));
22392
22483
 
22393
- function DateRangePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, style, withTime = false, ...nativeProps }) {
22484
+ function DateRangePicker({ baseContainer, className, defaultValue, disabled = false, error, hasSingleCalendar = false, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, style, withTime = false, ...nativeProps }) {
22394
22485
  /* eslint-disable no-null/no-null */
22395
22486
  const startDateInputRef = useRef(null);
22396
22487
  const startTimeInputRef = useRef(null);
@@ -22608,7 +22699,7 @@ function DateRangePicker({ baseContainer, className, defaultValue, disabled = fa
22608
22699
  selectedEndTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedEndDateTimeAsDayjsRef.current);
22609
22700
  forceUpdate();
22610
22701
  }, [defaultValue, forceUpdate, previousDefaultValue]);
22611
- return (jsxs(Fieldset, { className: controlledClassName, disabled: disabled, hasError: hasError, isLegendHidden: isLabelHidden, legend: label, style: style, ...nativeProps, children: [jsxs(Box$6, { "$hasError": hasError, "$isDisabled": disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpen, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onNext: handleStartDateInputNext, value: selectedStartDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputChange(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true), value: selectedStartTimeTupleRef.current }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpen, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious, value: selectedEndDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputChange(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onPrevious: () => endDateInputRef.current?.focus(true), value: selectedEndTimeTupleRef.current }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpen, onChange: handleRangeCalendarPickerChange }, JSON.stringify(rangeCalendarPickerDefaultValue))] }));
22702
+ return (jsxs(Fieldset, { className: controlledClassName, disabled: disabled, hasError: hasError, isLegendHidden: isLabelHidden, legend: label, style: style, ...nativeProps, children: [jsxs(Box$6, { "$hasError": hasError, "$isDisabled": disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpen, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onNext: handleStartDateInputNext, value: selectedStartDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputChange(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true), value: selectedStartTimeTupleRef.current }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpen, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious, value: selectedEndDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputChange(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: callOnChangeUndefinedIfInputsAreEmpty, onPrevious: () => endDateInputRef.current?.focus(true), value: selectedEndTimeTupleRef.current }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, hasSingleCalendar: hasSingleCalendar, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpen, onChange: handleRangeCalendarPickerChange }, JSON.stringify(rangeCalendarPickerDefaultValue))] }));
22612
22703
  }
22613
22704
  const Box$6 = styled.div `
22614
22705
  * {
@@ -36474,5 +36565,5 @@ function logSoftError({ context = {}, isSideWindowError = false, message, origin
36474
36565
  }
36475
36566
  }
36476
36567
 
36477
- 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 };
36568
+ 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 };
36478
36569
  //# sourceMappingURL=index.js.map