@mtes-mct/monitor-ui 2.12.0 → 2.12.1

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
+ # [2.12.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.11.0...v2.12.0) (2023-02-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * **fields:** add error prop ([26d7494](https://github.com/MTES-MCT/monitor-ui/commit/26d7494157528d853da4a26077f4d63012bd2bd0))
7
+ * **fields:** set onChange value to undefined on disabled ([323ef7a](https://github.com/MTES-MCT/monitor-ui/commit/323ef7ace51acdc117187118bc2a3a8b7ac59ed6))
8
+
1
9
  # [2.11.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.10.0...v2.11.0) (2023-02-07)
2
10
 
3
11
 
package/index.js CHANGED
@@ -5029,26 +5029,37 @@ disabled = false, error, isInline = false, isLabelHidden = false, isLight = fals
5029
5029
  }
5030
5030
  }, [onChange]);
5031
5031
  useFieldUndefineEffect(disabled, onChange);
5032
- return (jsxs(Fieldset, { isHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(ChecboxesBox$1, { "$isInline": isInline, children: options.map((option, index) => (jsx(Checkbox
5033
- // eslint-disable-next-line react/no-array-index-key
5034
- , { defaultChecked: defaultValue.includes(option.value), disabled: disabled, label: option.label, name: `${name}${index}`, onChange: (isChecked) => handleChange(option.value, isChecked) }, `${name}-${index}`))) }), hasError && jsx(FieldError, { children: controlledError })] }, key));
5032
+ const checkboxesElement = useMemo(() => (jsx(Fragment, { children: options.map((option, index) => (jsx(Checkbox, { defaultChecked: defaultValue.includes(option.value), disabled: disabled, label: option.label, name: `${name}${index}`, onChange: (isChecked) => handleChange(option.value, isChecked) }, option.value))) })),
5033
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5034
+ [disabled, handleChange, name, options]);
5035
+ return (jsxs(Fieldset, { isHidden: isLabelHidden, isLight: isLight, legend: label, children: [jsx(ChecboxesBox$1, { "$isInline": isInline, children: checkboxesElement }), hasError && jsx(FieldError, { children: controlledError })] }, key));
5035
5036
  }
5036
5037
  const ChecboxesBox$1 = styled.div `
5037
5038
  color: ${p => p.theme.color.gunMetal};
5038
5039
  display: flex;
5039
5040
  flex-direction: ${p => (p.$isInline ? 'row' : 'column')};
5040
5041
 
5042
+ > div {
5043
+ > .rs-checkbox {
5044
+ user-select: none;
5045
+ }
5046
+ }
5047
+
5041
5048
  ${p => !p.$isInline &&
5042
5049
  css `
5043
- > .rs-checkbox:not(:first-child) {
5044
- margin-top: 8px;
5050
+ > div:not(:first-child) {
5051
+ > .rs-checkbox {
5052
+ margin-top: 8px;
5053
+ }
5045
5054
  }
5046
5055
  `}
5047
5056
 
5048
5057
  ${p => p.$isInline &&
5049
5058
  css `
5050
- > .rs-checkbox:not(:first-child) {
5051
- margin-left: 12px;
5059
+ > div:not(:first-child) {
5060
+ .rs-checkbox {
5061
+ margin-left: 12px;
5062
+ }
5052
5063
  }
5053
5064
  `}
5054
5065
  `;
@@ -5207,6 +5218,7 @@ const ChecboxesBox = styled.div `
5207
5218
  > .rs-radio-checker {
5208
5219
  min-height: 0;
5209
5220
  padding: 0 0 0 28px;
5221
+ user-select: none;
5210
5222
 
5211
5223
  .rs-radio-wrapper {
5212
5224
  left: 2px;