@mtes-mct/monitor-ui 11.0.1 → 11.1.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,10 @@
1
+ ## [11.0.1](https://github.com/MTES-MCT/monitor-ui/compare/v11.0.0...v11.0.1) (2024-01-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **icon:** fix Attention icon ([72f0161](https://github.com/MTES-MCT/monitor-ui/commit/72f016188dbe016842a693e441ce8a22532354f5))
7
+
1
8
  ## [11.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v10.19.1...v11.0.0) (2024-01-16)
2
9
 
3
10
 
package/index.js CHANGED
@@ -33943,7 +33943,7 @@ function IconButton({ accent = Accent.PRIMARY, className, color, Icon, iconSize,
33943
33943
  ]);
33944
33944
  const commonChildren = useMemo(()=>/*#__PURE__*/ jsx(Icon, {
33945
33945
  color: color,
33946
- size: iconSize || ICON_SIZE_IN_PX[size]
33946
+ size: iconSize ?? ICON_SIZE_IN_PX[size]
33947
33947
  }), [
33948
33948
  color,
33949
33949
  Icon,
@@ -37954,7 +37954,7 @@ const Header = styled.div`
37954
37954
  padding: 9px 4px 9px 10px;
37955
37955
  `;
37956
37956
  const Title = styled.span.attrs((props)=>({
37957
- title: String(props.children)
37957
+ title: props.title ?? String(props.children)
37958
37958
  }))`
37959
37959
  color: ${(p)=>p.theme.color.white};
37960
37960
  font-size: 16px;
@@ -37995,9 +37995,9 @@ const MapMenuDialog = {
37995
37995
  };
37996
37996
 
37997
37997
  const ExclamationPoint = styled.span`
37998
- background: ${(p)=>p.backgroundColor || p.theme.color.goldenPoppy};
37998
+ background: ${(p)=>p.backgroundColor ?? p.theme.color.goldenPoppy};
37999
37999
  border-radius: 15px;
38000
- color: ${(p)=>p.color || p.theme.color.white};
38000
+ color: ${(p)=>p.color ?? p.theme.color.white};
38001
38001
  display: inline-block;
38002
38002
  font-size: 11px;
38003
38003
  font-weight: 700;
@@ -38050,8 +38050,8 @@ const Text = styled.div`
38050
38050
  margin-left: 8px;
38051
38051
  `;
38052
38052
  const Box$h = styled.span`
38053
- background: ${(p)=>p.backgroundColor || p.theme.color.goldenPoppy25};
38054
- color: ${(p)=>p.color || p.theme.color.slateGray};
38053
+ background: ${(p)=>p.backgroundColor ?? p.theme.color.goldenPoppy25};
38054
+ color: ${(p)=>p.color ?? p.theme.color.slateGray};
38055
38055
  padding: 8px 16px 16px 8px;
38056
38056
  display: flex;
38057
38057
  border-radius: 2px;
@@ -38152,8 +38152,8 @@ function Tag({ accent, backgroundColor, borderColor, bullet, bulletColor, childr
38152
38152
  withBullet
38153
38153
  ]);
38154
38154
  const commonChildren = useMemo(()=>{
38155
- const defaultColor = color || THEME.color.gunMetal;
38156
- const cutomIconColor = bulletColor || iconColor || (accent ? ({
38155
+ const defaultColor = color ?? THEME.color.gunMetal;
38156
+ const cutomIconColor = bulletColor ?? iconColor ?? (accent ? ({
38157
38157
  [Accent.PRIMARY]: THEME.color.gunMetal,
38158
38158
  [Accent.SECONDARY]: THEME.color.gunMetal,
38159
38159
  [Accent.TERTIARY]: THEME.color.white
@@ -55689,7 +55689,7 @@ function Search({ baseContainer, className, customSearch = undefined, customSear
55689
55689
  container: boxRef.current,
55690
55690
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
55691
55691
  // when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
55692
- data: controlledRsuiteData || data,
55692
+ data: controlledRsuiteData ?? data,
55693
55693
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
55694
55694
  // that's why we send this "always true" filter to disable Rsuite SelectPicker internal search filtering
55695
55695
  filterBy: customSearch ? ()=>true : undefined,
@@ -55968,7 +55968,7 @@ function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1,
55968
55968
  container: boxRef.current,
55969
55969
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
55970
55970
  // when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
55971
- data: controlledRsuiteData || rsuiteData,
55971
+ data: controlledRsuiteData ?? rsuiteData,
55972
55972
  disabled: disabled,
55973
55973
  id: originalProps.name,
55974
55974
  onChange: handleChange,
@@ -55978,7 +55978,7 @@ function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1,
55978
55978
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
55979
55979
  // that's why we send this "always true" filter to disable Rsuite CheckPicker internal search filtering
55980
55980
  searchBy: customSearch ? ()=>true : undefined,
55981
- size: originalProps.size || 'sm',
55981
+ size: originalProps.size ?? 'sm',
55982
55982
  value: selectedRsuiteValue,
55983
55983
  ...originalProps
55984
55984
  }, key)
@@ -56151,7 +56151,7 @@ customDayjs.locale('fr');
56151
56151
  * // => `2022-01-02T03:04:05.006Z
56152
56152
  * ```
56153
56153
  */ function getUtcizedDayjs(localDate) {
56154
- const definedLocalDate = localDate || new Date();
56154
+ const definedLocalDate = localDate ?? new Date();
56155
56155
  // The number of minutes returned by getTimezoneOffset() is positive if the local time zone is behind UTC,
56156
56156
  // and negative if the local time zone is ahead of UTC. For example, for UTC+10, `-600` will be returned.
56157
56157
  //
@@ -57354,7 +57354,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
57354
57354
  /*#__PURE__*/ jsx(Field$1, {
57355
57355
  children: /*#__PURE__*/ jsx(DateInput, {
57356
57356
  ref: dateInputRef,
57357
- baseContainer: baseContainer || undefined,
57357
+ baseContainer: baseContainer ?? undefined,
57358
57358
  disabled: disabled,
57359
57359
  isCompact: isCompact,
57360
57360
  isEndDate: isEndDate,
@@ -57371,7 +57371,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
57371
57371
  $isTimeField: true,
57372
57372
  children: /*#__PURE__*/ jsx(TimeInput, {
57373
57373
  ref: timeInputRef,
57374
- baseContainer: baseContainer || undefined,
57374
+ baseContainer: baseContainer ?? undefined,
57375
57375
  disabled: disabled,
57376
57376
  isCompact: isCompact,
57377
57377
  isLight: isLight,
@@ -57906,7 +57906,7 @@ function DateRangePicker({ baseContainer, className, defaultValue, disabled = fa
57906
57906
  hasMountedRef.current = true;
57907
57907
  return;
57908
57908
  }
57909
- if (defaultValue && previousDefaultValue && defaultValue[0] instanceof Date && defaultValue[1] instanceof Date && previousDefaultValue[0] instanceof Date && previousDefaultValue[1] instanceof Date && defaultValue[0].toISOString() === previousDefaultValue[0].toISOString() && defaultValue[1].toISOString() === previousDefaultValue[1].toISOString() || lodashExports.isEqual(defaultValue, previousDefaultValue)) {
57909
+ if (!!defaultValue && !!previousDefaultValue && defaultValue[0] instanceof Date && defaultValue[1] instanceof Date && previousDefaultValue[0] instanceof Date && previousDefaultValue[1] instanceof Date && defaultValue[0].toISOString() === previousDefaultValue[0].toISOString() && defaultValue[1].toISOString() === previousDefaultValue[1].toISOString() || lodashExports.isEqual(defaultValue, previousDefaultValue)) {
57910
57910
  return;
57911
57911
  }
57912
57912
  selectedStartDateTimeAsDayjsRef.current = defaultValue ? customDayjs(defaultValue[0]) : undefined;
@@ -57937,7 +57937,7 @@ function DateRangePicker({ baseContainer, className, defaultValue, disabled = fa
57937
57937
  /*#__PURE__*/ jsx(Field, {
57938
57938
  children: /*#__PURE__*/ jsx(DateInput, {
57939
57939
  ref: startDateInputRef,
57940
- baseContainer: baseContainer || undefined,
57940
+ baseContainer: baseContainer ?? undefined,
57941
57941
  disabled: disabled,
57942
57942
  isCompact: isCompact,
57943
57943
  isForcedFocused: isRangeCalendarPickerOpen,
@@ -57955,7 +57955,7 @@ function DateRangePicker({ baseContainer, className, defaultValue, disabled = fa
57955
57955
  isTimeField: true,
57956
57956
  children: /*#__PURE__*/ jsx(TimeInput, {
57957
57957
  ref: startTimeInputRef,
57958
- baseContainer: baseContainer || undefined,
57958
+ baseContainer: baseContainer ?? undefined,
57959
57959
  disabled: disabled,
57960
57960
  isCompact: isCompact,
57961
57961
  isLight: isLight,
@@ -57974,7 +57974,7 @@ function DateRangePicker({ baseContainer, className, defaultValue, disabled = fa
57974
57974
  isEndDateField: true,
57975
57975
  children: /*#__PURE__*/ jsx(DateInput, {
57976
57976
  ref: endDateInputRef,
57977
- baseContainer: baseContainer || undefined,
57977
+ baseContainer: baseContainer ?? undefined,
57978
57978
  disabled: disabled,
57979
57979
  isCompact: isCompact,
57980
57980
  isEndDate: true,
@@ -57994,7 +57994,7 @@ function DateRangePicker({ baseContainer, className, defaultValue, disabled = fa
57994
57994
  isTimeField: true,
57995
57995
  children: /*#__PURE__*/ jsx(TimeInput, {
57996
57996
  ref: endTimeInputRef,
57997
- baseContainer: baseContainer || undefined,
57997
+ baseContainer: baseContainer ?? undefined,
57998
57998
  disabled: disabled,
57999
57999
  isCompact: isCompact,
58000
58000
  isEndDate: true,
@@ -58073,9 +58073,9 @@ function MultiCheckbox({ className, disabled = false, error, isErrorMessageHidde
58073
58073
  return;
58074
58074
  }
58075
58075
  const nextCheckedOptionValues = isChecked ? [
58076
- ...value || [],
58076
+ ...value ?? [],
58077
58077
  nextOptionValue
58078
- ] : reject$1(equals$2(nextOptionValue))(value || []);
58078
+ ] : reject$1(equals$2(nextOptionValue))(value ?? []);
58079
58079
  const normalizedNextValue = nextCheckedOptionValues.length ? nextCheckedOptionValues : undefined;
58080
58080
  onChange(normalizedNextValue);
58081
58081
  }, [
@@ -58096,8 +58096,8 @@ function MultiCheckbox({ className, disabled = false, error, isErrorMessageHidde
58096
58096
  $hasError: hasError,
58097
58097
  $isInline: isInline,
58098
58098
  children: options.map((option, index)=>/*#__PURE__*/ jsx(Checkbox, {
58099
- checked: includes$1(option.value, value || []),
58100
- disabled: option.isDisabled || disabled,
58099
+ checked: includes$1(option.value, value ?? []),
58100
+ disabled: !!option.isDisabled || disabled,
58101
58101
  label: option.label,
58102
58102
  name: `${name}${index}`,
58103
58103
  onChange: (isChecked)=>handleChange(option.value, isChecked)
@@ -58164,7 +58164,7 @@ function MultiSelect({ baseContainer, className, customSearch, customSearchMinQu
58164
58164
  originalProps.name,
58165
58165
  value
58166
58166
  ]);
58167
- const selectedRsuiteValue = useMemo(()=>(value || []).map((valueItem)=>getRsuiteValueFromOptionValue(valueItem, optionValueKey)), [
58167
+ const selectedRsuiteValue = useMemo(()=>(value ?? []).map((valueItem)=>getRsuiteValueFromOptionValue(valueItem, optionValueKey)), [
58168
58168
  optionValueKey,
58169
58169
  value
58170
58170
  ]);
@@ -58260,7 +58260,7 @@ function MultiSelect({ baseContainer, className, customSearch, customSearchMinQu
58260
58260
  container: boxRef.current,
58261
58261
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
58262
58262
  // when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
58263
- data: controlledRsuiteData || rsuiteData,
58263
+ data: controlledRsuiteData ?? rsuiteData,
58264
58264
  disabled: disabled,
58265
58265
  id: originalProps.name,
58266
58266
  onChange: handleChange,
@@ -58268,7 +58268,7 @@ function MultiSelect({ baseContainer, className, customSearch, customSearchMinQu
58268
58268
  onSearch: handleSearch,
58269
58269
  open: isOpen,
58270
58270
  renderMenuItem: renderMenuItem,
58271
- searchable: !!customSearch || searchable,
58271
+ searchable: !!customSearch ?? searchable,
58272
58272
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
58273
58273
  // that's why we send this "always true" filter to disable Rsuite TagPicker internal search filtering
58274
58274
  searchBy: customSearch ? ()=>true : undefined,
@@ -58444,7 +58444,7 @@ function MultiRadio({ className, disabled = false, error, isErrorMessageHidden =
58444
58444
  $isReadOnly: isReadOnly,
58445
58445
  children: options.map((option)=>/*#__PURE__*/ jsx(Radio, {
58446
58446
  checked: equals$2(option.value, value),
58447
- disabled: option.isDisabled || disabled,
58447
+ disabled: !!option.isDisabled || disabled,
58448
58448
  name: name,
58449
58449
  onChange: (_, isChecked)=>handleChange(option.value, isChecked),
58450
58450
  readOnly: isReadOnly,
@@ -58733,7 +58733,7 @@ function NumberInput({ className, error, isErrorMessageHidden = false, isLabelHi
58733
58733
  onChange: handleChange,
58734
58734
  onFocus: handleFocus,
58735
58735
  type: "number",
58736
- value: value || '',
58736
+ value: value ?? '',
58737
58737
  ...originalProps
58738
58738
  }, key),
58739
58739
  !isErrorMessageHidden && hasError && /*#__PURE__*/ jsx(FieldError, {
@@ -69517,7 +69517,7 @@ var CoordinateLatLon;
69517
69517
  return [];
69518
69518
  }
69519
69519
  let longitude = longitudeInteger.toString().trim().replace(/-/g, '');
69520
- const decimals = longitudeDecimals?.substring(0, precision) || '000000';
69520
+ const decimals = longitudeDecimals?.substring(0, precision) ?? '000000';
69521
69521
  longitude = `${isNegative ? '-' : ''}${getPaddedDegrees(longitude, "LONGITUDE")}.${decimals}`;
69522
69522
  return [
69523
69523
  `${transformedCoordinates[1].toFixed(precision)}°`,
@@ -69956,7 +69956,7 @@ function Select({ baseContainer, className, customSearch, customSearchMinQueryLe
69956
69956
  isOpen,
69957
69957
  disabled
69958
69958
  ]);
69959
- const disabledItemValues = useMemo(()=>(controlledRsuiteData || rsuiteData).filter((option)=>option.isDisabled).map((option)=>option.value), [
69959
+ const disabledItemValues = useMemo(()=>(controlledRsuiteData ?? rsuiteData).filter((option)=>option.isDisabled).map((option)=>option.value), [
69960
69960
  controlledRsuiteData,
69961
69961
  rsuiteData
69962
69962
  ]);
@@ -69988,7 +69988,7 @@ function Select({ baseContainer, className, customSearch, customSearchMinQueryLe
69988
69988
  container: boxRef.current,
69989
69989
  // When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
69990
69990
  // when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
69991
- data: controlledRsuiteData || rsuiteData,
69991
+ data: controlledRsuiteData ?? rsuiteData,
69992
69992
  disabled: disabled,
69993
69993
  disabledItemValues: disabledItemValues,
69994
69994
  id: originalProps.name,
@@ -70140,7 +70140,7 @@ function Textarea({ className, error, isErrorMessageHidden = false, isLabelHidde
70140
70140
  id: originalProps.name,
70141
70141
  onChange: handleChange,
70142
70142
  rows: rows,
70143
- value: value || '',
70143
+ value: value ?? '',
70144
70144
  ...originalProps
70145
70145
  }, key),
70146
70146
  !isErrorMessageHidden && hasError && /*#__PURE__*/ jsx(FieldError, {
@@ -70225,7 +70225,7 @@ function TextInput({ className, error, Icon, isErrorMessageHidden = false, isLab
70225
70225
  id: originalProps.name,
70226
70226
  onChange: handleChange,
70227
70227
  type: type,
70228
- value: value || '',
70228
+ value: value ?? '',
70229
70229
  ...originalProps
70230
70230
  }, key),
70231
70231
  isSearchInput && !Icon && /*#__PURE__*/ jsxs(IconsContainer, {
@@ -76380,7 +76380,7 @@ const SimpleTable = {
76380
76380
  };
76381
76381
 
76382
76382
  function Td$1({ cell, children }) {
76383
- const controlledChildren = children || flexRender(cell.column.columnDef.cell, cell.getContext());
76383
+ const controlledChildren = children ?? flexRender(cell.column.columnDef.cell, cell.getContext());
76384
76384
  return /*#__PURE__*/ jsx(SimpleTable.Td, {
76385
76385
  $isCenter: false,
76386
76386
  style: {
@@ -76403,7 +76403,7 @@ const SortingIcon = styled(Chevron)`
76403
76403
  `;
76404
76404
 
76405
76405
  function Th$1({ children, header }) {
76406
- const controlledChildren = children || !header.isPlaceholder ? /*#__PURE__*/ jsxs(SimpleTable.SortContainer, {
76406
+ const controlledChildren = children ?? !header.isPlaceholder ? /*#__PURE__*/ jsxs(SimpleTable.SortContainer, {
76407
76407
  className: header.column.getCanSort() ? 'cursor-pointer select-none' : '',
76408
76408
  onClick: header.column.getToggleSortingHandler(),
76409
76409
  children: [
@@ -76432,7 +76432,7 @@ function DataTable({ columns, data, initialSorting }) {
76432
76432
  const [sorting, setSorting] = useState(initialSorting);
76433
76433
  const table = useReactTable({
76434
76434
  columns,
76435
- data: data || [],
76435
+ data: data ?? [],
76436
76436
  // eslint-disable-next-line @typescript-eslint/naming-convention
76437
76437
  enableSortingRemoval: false,
76438
76438
  getCoreRowModel: getCoreRowModel(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtes-mct/monitor-ui",
3
3
  "description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
4
- "version": "11.0.1",
4
+ "version": "11.1.0",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {
@@ -1 +1 @@
1
- {"version":3,"file":"ExclamationPoint.d.ts","sourceRoot":"","sources":["../../src/symbols/ExclamationPoint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,eAAe,CAAC,GAAG;IACpE,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AACD,eAAO,MAAM,gBAAgB;sBAHT,MAAM,GAAG,SAAS;YAC5B,MAAM,GAAG,SAAS;SAkB3B,CAAA"}
1
+ {"version":3,"file":"ExclamationPoint.d.ts","sourceRoot":"","sources":["../../src/symbols/ExclamationPoint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,eAAe,CAAC,GAAG;IACpE,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AACD,eAAO,MAAM,gBAAgB;sBAHT,MAAM,GAAG,SAAS;YAC5B,MAAM,GAAG,SAAS;SAkB3B,CAAA"}