@mtes-mct/monitor-ui 2.9.3 → 2.9.5

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
+ ## [2.9.4](https://github.com/MTES-MCT/monitor-ui/compare/v2.9.3...v2.9.4) (2023-01-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **elements:** make Fieldset width 100% of parent width ([63d10c6](https://github.com/MTES-MCT/monitor-ui/commit/63d10c60ab12ebe437ea236ea5cde12fa13fd6ff))
7
+ * **fields:** fix MultiSelect placeholder alignment ([8c335b2](https://github.com/MTES-MCT/monitor-ui/commit/8c335b2d26208f2b7faecc9434ef1e0c201698e3))
8
+ * **fields:** improve MultiZoneEditor alignments ([b7d5784](https://github.com/MTES-MCT/monitor-ui/commit/b7d5784edefba4bf6e294f5cdf6cf27b79c309db))
9
+
10
+ ## [2.9.3](https://github.com/MTES-MCT/monitor-ui/compare/v2.9.2...v2.9.3) (2023-01-27)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **components:** use px instead of rem for Dropdown icon size ([c0b24ac](https://github.com/MTES-MCT/monitor-ui/commit/c0b24ac4c90f666bbdeeae533c3d6153088a80eb))
16
+
1
17
  ## [2.9.2](https://github.com/MTES-MCT/monitor-ui/compare/v2.9.1...v2.9.2) (2023-01-27)
2
18
 
3
19
 
package/index.js CHANGED
@@ -2121,6 +2121,7 @@ const StyledField = styled(Field$2) `
2121
2121
  const Box$b = styled.div `
2122
2122
  background-color: ${p => (p.$isLight ? p.theme.color.white : 'transparent')};
2123
2123
  padding: ${p => (p.$hasBorder || p.$isLight ? '16px' : 0)};
2124
+ width: 100%;
2124
2125
 
2125
2126
  ${p => p.$hasBorder &&
2126
2127
  css `
@@ -5091,12 +5092,11 @@ const Box$1 = styled.div `
5091
5092
  > .rs-stack-item {
5092
5093
  > .rs-picker-toggle-placeholder {
5093
5094
  font-size: 13px;
5094
- line-height: 1.3846;
5095
+ line-height: 1.5385; // = 20px
5095
5096
  }
5096
5097
 
5097
5098
  > svg {
5098
5099
  height: 18px;
5099
- /* margin-top: -2px; */
5100
5100
  }
5101
5101
  }
5102
5102
  }
@@ -5229,9 +5229,7 @@ function MultiZoneEditor({ addButtonLabel, defaultValue = [], initialZone, isLab
5229
5229
  }, [defaultValue]);
5230
5230
  return (jsxs(Fieldset, { isHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(Button, { accent: Accent.SECONDARY, Icon: Plus, isFullWidth: true, onClick: addZone, children: addButtonLabel }), jsx(Fragment, { children: zones.map((zone, index) => (
5231
5231
  // eslint-disable-next-line react/no-array-index-key
5232
- jsxs(Row, { children: [jsxs(ZoneWrapper, { children: [zone[labelPropName], jsxs("a", { onClick: () => centerZone(zone), style: {
5233
- cursor: 'pointer'
5234
- }, children: [jsx(SelectRectangle, {}), " Centrer sur la carte"] })] }), jsx(IconButton, { accent: Accent.SECONDARY, Icon: Edit, onClick: () => editZone(index, zone) }), jsx(IconButton, { accent: Accent.SECONDARY, "aria-label": "Supprimer cette zone", Icon: Delete, onClick: () => deleteZone(index) })] }, `zone-${index}`))) })] }));
5232
+ jsxs(Row, { children: [jsxs(ZoneWrapper, { children: [zone[labelPropName], jsxs(Link, { onClick: () => centerZone(zone), children: [jsx(SelectRectangle, {}), jsx("span", { children: "Centrer sur la carte" })] })] }), jsx(IconButton, { accent: Accent.SECONDARY, Icon: Edit, onClick: () => editZone(index, zone) }), jsx(IconButton, { accent: Accent.SECONDARY, "aria-label": "Supprimer cette zone", Icon: Delete, onClick: () => deleteZone(index) })] }, `zone-${index}`))) })] }));
5235
5233
  }
5236
5234
  const Row = styled.div `
5237
5235
  align-items: center;
@@ -5247,10 +5245,20 @@ const ZoneWrapper = styled.div `
5247
5245
  display: flex;
5248
5246
  flex-grow: 1;
5249
5247
  font-size: 13px;
5250
- line-height: 1.5;
5248
+ line-height: 1.3077; // = 17px
5251
5249
  justify-content: space-between;
5252
5250
  padding: 6px 12px 6px;
5253
5251
  `;
5252
+ const Link = styled.a `
5253
+ align-items: center;
5254
+ cursor: pointer;
5255
+ display: inline-flex;
5256
+
5257
+ > span {
5258
+ line-height: 1;
5259
+ margin: -2px 0 0 8px;
5260
+ }
5261
+ `;
5254
5262
 
5255
5263
  function NumberInput({ isLabelHidden = false, isLight = false, label, onChange, ...originalProps }) {
5256
5264
  const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
@@ -5292,8 +5300,19 @@ searchable = false, ...originalProps }) {
5292
5300
  onChange(normalizedNextValue);
5293
5301
  }
5294
5302
  }, [close, onChange]);
5295
- const toggle = useCallback(() => {
5296
- setIsOpen(!isOpen);
5303
+ const toggle = useCallback((event) => {
5304
+ let targetElement = event.target;
5305
+ if (targetElement.tagName === 'path') {
5306
+ if (targetElement.parentElement) {
5307
+ targetElement = targetElement.parentElement;
5308
+ }
5309
+ }
5310
+ if (targetElement.classList.contains('rs-picker-toggle') ||
5311
+ targetElement.classList.contains('rs-stack-item') ||
5312
+ targetElement.classList.contains('rs-picker-toggle-caret') ||
5313
+ targetElement.classList.contains('rs-picker-toggle-placeholder')) {
5314
+ setIsOpen(!isOpen);
5315
+ }
5297
5316
  }, [isOpen]);
5298
5317
  useClickOutside(boxRef, close, baseContainer);
5299
5318
  useEffect(() => {