@mtes-mct/monitor-ui 2.1.0 → 2.2.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,18 @@
1
+ ## [2.1.1](https://github.com/MTES-MCT/monitor-ui/compare/v2.1.0...v2.1.1) (2022-12-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **formiks:** remove set undefined on destruction ([#137](https://github.com/MTES-MCT/monitor-ui/issues/137)) ([fd375ae](https://github.com/MTES-MCT/monitor-ui/commit/fd375aec5047ba3aad31237bec4863f56fb1043f))
7
+
8
+ # [2.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.0.0...v2.1.0) (2022-12-15)
9
+
10
+
11
+ ### Features
12
+
13
+ * **elements:** add isLight & hasBorder props to Fieldset ([#134](https://github.com/MTES-MCT/monitor-ui/issues/134)) ([761ea73](https://github.com/MTES-MCT/monitor-ui/commit/761ea733f1441c32986b64f2ad6be4541073a485))
14
+ * **fields:** add MultiZoneEditor ([#135](https://github.com/MTES-MCT/monitor-ui/issues/135)) ([8a3d653](https://github.com/MTES-MCT/monitor-ui/commit/8a3d6537484f8a0b85289f6903e5567cdef0673b))
15
+
1
16
  # [2.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v1.14.0...v2.0.0) (2022-12-14)
2
17
 
3
18
 
@@ -1,6 +1,6 @@
1
1
  import type { LabelHTMLAttributes } from 'react';
2
2
  export type LabelProps = LabelHTMLAttributes<HTMLLabelElement> & {
3
- isHidden: boolean;
3
+ isHidden?: boolean;
4
4
  };
5
5
  export declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {
6
6
  isHidden?: boolean | undefined;
@@ -0,0 +1,3 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ export type TagGroupProps = HTMLAttributes<HTMLDivElement>;
3
+ export declare const TagGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
package/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { IconButton } from './elements/IconButton';
10
10
  export { Label } from './elements/Label';
11
11
  export { Legend } from './elements/Legend';
12
12
  export { Tag } from './elements/Tag';
13
+ export { TagGroup } from './elements/TagGroup';
13
14
  export { AutoComplete } from './fields/AutoComplete';
14
15
  export { Checkbox } from './fields/Checkbox';
15
16
  export { DateRangePicker } from './fields/DateRangePicker';
@@ -43,6 +44,7 @@ export type { IconButtonProps } from './elements/IconButton';
43
44
  export type { LabelProps } from './elements/Label';
44
45
  export type { LegendProps } from './elements/Legend';
45
46
  export type { TagProps } from './elements/Tag';
47
+ export type { TagGroupProps } from './elements/TagGroup';
46
48
  export type { AutoCompleteProps } from './fields/AutoComplete';
47
49
  export type { CheckboxProps } from './fields/Checkbox';
48
50
  export type { DateRangePickerProps } from './fields/DateRangePicker';
package/index.js CHANGED
@@ -1679,6 +1679,7 @@ const Box$7 = styled.span `
1679
1679
  color: ${p => (p.$color ? p.$color : p.theme.color.gunMetal)};
1680
1680
  display: inline-flex;
1681
1681
  font-size: 13px;
1682
+ line-height: 1.4;
1682
1683
  padding: 1px 8px 3px 8px;
1683
1684
 
1684
1685
  /* Bullet components are a span */
@@ -1707,6 +1708,14 @@ const TertiaryTag = styled(Box$7) `
1707
1708
  color: ${p => p.theme.color.white};
1708
1709
  `;
1709
1710
 
1711
+ const TagGroup = styled.div `
1712
+ display: flex;
1713
+
1714
+ > span:not(:first-child) {
1715
+ margin-left: 8px;
1716
+ }
1717
+ `;
1718
+
1710
1719
  // eslint-lint-disable-next-line @typescript-eslint/naming-convention
1711
1720
  class HTTPError extends Error {
1712
1721
  constructor(response, request, options) {
@@ -4851,36 +4860,20 @@ function FormikAutoComplete({ name, ...originalProps }) {
4851
4860
  const [field, , helpers] = useField(name);
4852
4861
  // eslint-disable-next-line react-hooks/exhaustive-deps, @typescript-eslint/naming-convention
4853
4862
  const defaultValue = useMemo(() => field.value, []);
4854
- const handleChange = useCallback((nextValue) => {
4855
- helpers.setValue(nextValue);
4856
- },
4857
- // eslint-disable-next-line react-hooks/exhaustive-deps
4858
- []);
4859
- // eslint-disable-next-line react-hooks/exhaustive-deps
4860
- useEffect(() => () => helpers.setValue(undefined), []);
4861
- return jsx(AutoComplete, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4863
+ return jsx(AutoComplete, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4862
4864
  }
4863
4865
 
4864
4866
  function FormikCheckbox({ name, ...originalProps }) {
4865
4867
  const [field, , helpers] = useField(name);
4866
4868
  // eslint-disable-next-line react-hooks/exhaustive-deps, @typescript-eslint/naming-convention
4867
4869
  const defaultChecked = useMemo(() => Boolean(field.value), []);
4868
- const handleChange = useCallback((isChecked) => {
4869
- helpers.setValue(isChecked);
4870
- },
4871
- // eslint-disable-next-line react-hooks/exhaustive-deps
4872
- []);
4873
- // eslint-disable-next-line react-hooks/exhaustive-deps
4874
- useEffect(() => () => helpers.setValue(undefined), []);
4875
- return jsx(Checkbox, { defaultChecked: defaultChecked, name: name, onChange: handleChange, ...originalProps });
4870
+ return jsx(Checkbox, { defaultChecked: defaultChecked, name: name, onChange: helpers.setValue, ...originalProps });
4876
4871
  }
4877
4872
 
4878
4873
  function FormikDatePicker({ name, ...originalProps }) {
4879
4874
  const [field, , helpers] = useField(name);
4880
4875
  // eslint-disable-next-line react-hooks/exhaustive-deps
4881
4876
  const defaultValue = useMemo(() => field.value, []);
4882
- // eslint-disable-next-line react-hooks/exhaustive-deps
4883
- useEffect(() => () => helpers.setValue(undefined), []);
4884
4877
  return jsx(DatePicker, { defaultValue: defaultValue, onChange: helpers.setValue, ...originalProps });
4885
4878
  }
4886
4879
 
@@ -4888,8 +4881,6 @@ function FormikDateRangePicker({ name, ...originalProps }) {
4888
4881
  const [field, , helpers] = useField(name);
4889
4882
  // eslint-disable-next-line react-hooks/exhaustive-deps
4890
4883
  const defaultValue = useMemo(() => field.value, []);
4891
- // eslint-disable-next-line react-hooks/exhaustive-deps
4892
- useEffect(() => () => helpers.setValue(undefined), []);
4893
4884
  return jsx(DateRangePicker, { defaultValue: defaultValue, onChange: helpers.setValue, ...originalProps });
4894
4885
  }
4895
4886
 
@@ -4905,85 +4896,43 @@ function FormikMultiCheckbox({ name, ...originalProps }) {
4905
4896
  const [field, , helpers] = useField(name);
4906
4897
  // eslint-disable-next-line react-hooks/exhaustive-deps
4907
4898
  const defaultValue = useMemo(() => field.value, []);
4908
- const handleChange = useCallback((nextValue) => {
4909
- helpers.setValue(nextValue);
4910
- },
4911
- // eslint-disable-next-line react-hooks/exhaustive-deps
4912
- []);
4913
- // eslint-disable-next-line react-hooks/exhaustive-deps
4914
- useEffect(() => () => helpers.setValue(undefined), []);
4915
- return jsx(MultiCheckbox, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4899
+ return jsx(MultiCheckbox, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4916
4900
  }
4917
4901
 
4918
4902
  function FormikMultiSelect({ name, ...originalProps }) {
4919
4903
  const [field, , helpers] = useField(name);
4920
4904
  // eslint-disable-next-line react-hooks/exhaustive-deps
4921
4905
  const defaultValue = useMemo(() => field.value, []);
4922
- const handleChange = useCallback((nextValue) => {
4923
- helpers.setValue(nextValue);
4924
- },
4925
- // eslint-disable-next-line react-hooks/exhaustive-deps
4926
- []);
4927
- // eslint-disable-next-line react-hooks/exhaustive-deps
4928
- useEffect(() => () => helpers.setValue(undefined), []);
4929
- return jsx(MultiSelect, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4906
+ return jsx(MultiSelect, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4930
4907
  }
4931
4908
 
4932
4909
  function FormikMultiRadio({ name, ...originalProps }) {
4933
4910
  const [field, , helpers] = useField(name);
4934
4911
  // eslint-disable-next-line react-hooks/exhaustive-deps
4935
4912
  const defaultValue = useMemo(() => field.value, []);
4936
- const handleChange = useCallback((nextValue) => {
4937
- helpers.setValue(nextValue);
4938
- },
4939
- // eslint-disable-next-line react-hooks/exhaustive-deps
4940
- []);
4941
- // eslint-disable-next-line react-hooks/exhaustive-deps
4942
- useEffect(() => () => helpers.setValue(undefined), []);
4943
- return jsx(MultiRadio, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4913
+ return jsx(MultiRadio, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4944
4914
  }
4945
4915
 
4946
4916
  function FormikSelect({ name, ...originalProps }) {
4947
4917
  const [field, , helpers] = useField(name);
4948
4918
  // eslint-disable-next-line react-hooks/exhaustive-deps
4949
4919
  const defaultValue = useMemo(() => field.value, []);
4950
- const handleChange = useCallback((nextValue) => {
4951
- helpers.setValue(nextValue);
4952
- },
4953
- // eslint-disable-next-line react-hooks/exhaustive-deps
4954
- []);
4955
- // eslint-disable-next-line react-hooks/exhaustive-deps
4956
- useEffect(() => () => helpers.setValue(undefined), []);
4957
- return jsx(Select, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4920
+ return jsx(Select, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4958
4921
  }
4959
4922
 
4960
4923
  function FormikTextarea({ name, ...originalProps }) {
4961
4924
  const [field, , helpers] = useField(name);
4962
4925
  // eslint-disable-next-line react-hooks/exhaustive-deps
4963
4926
  const defaultValue = useMemo(() => field.value, []);
4964
- const handleChange = useCallback((nextValue) => {
4965
- helpers.setValue(nextValue);
4966
- },
4967
- // eslint-disable-next-line react-hooks/exhaustive-deps
4968
- []);
4969
- // eslint-disable-next-line react-hooks/exhaustive-deps
4970
- useEffect(() => () => helpers.setValue(undefined), []);
4971
- return jsx(Textarea, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4927
+ return jsx(Textarea, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4972
4928
  }
4973
4929
 
4974
4930
  function FormikTextInput({ name, ...originalProps }) {
4975
4931
  const [field, , helpers] = useField(name);
4976
4932
  // eslint-disable-next-line react-hooks/exhaustive-deps
4977
4933
  const defaultValue = useMemo(() => field.value, []);
4978
- const handleChange = useCallback((nextValue) => {
4979
- helpers.setValue(nextValue);
4980
- },
4981
- // eslint-disable-next-line react-hooks/exhaustive-deps
4982
- []);
4983
- // eslint-disable-next-line react-hooks/exhaustive-deps
4984
- useEffect(() => () => helpers.setValue(undefined), []);
4985
- return jsx(TextInput, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
4934
+ return jsx(TextInput, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
4986
4935
  }
4987
4936
 
4988
- export { Accent, AutoComplete, Button, Checkbox, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikAutoComplete, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, Select, Size, THEME, Tag$1 as Tag, TextInput, Textarea, ThemeProvider };
4937
+ export { Accent, AutoComplete, Button, Checkbox, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikAutoComplete, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, Select, Size, THEME, Tag$1 as Tag, TagGroup, TextInput, Textarea, ThemeProvider };
4989
4938
  //# sourceMappingURL=index.js.map