ublo-lib 1.6.19 → 1.6.21

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.
@@ -21,7 +21,7 @@ const EditForm = ({
21
21
  description,
22
22
  url,
23
23
  label,
24
- popupOpened
24
+ tooltipOpened
25
25
  } = marker;
26
26
  const removeMarker = e => {
27
27
  e.stopPropagation();
@@ -79,9 +79,9 @@ const EditForm = ({
79
79
  compact: true
80
80
  })]
81
81
  }), _jsx(Checkbox, {
82
- label: "Ouvert par d\xE9faut",
83
- checked: popupOpened,
84
- onCheckedChange: updateMarker("popupOpened")
82
+ label: "Tooltip affich\xE9 par d\xE9faut",
83
+ checked: tooltipOpened,
84
+ onCheckedChange: updateMarker("tooltipOpened")
85
85
  }), _jsxs("div", {
86
86
  className: css.buttons,
87
87
  children: [_jsxs(Button, {
@@ -64,11 +64,9 @@ const EditableMap = ({
64
64
  setZoom: setZoom,
65
65
  setCenter: setCenter
66
66
  }), _jsx(Markers, {
67
- map: ref,
68
67
  markers: markers,
69
68
  setMarkers: setMarkers,
70
- iconSet: iconSet,
71
- isInDialog: isInDialog
69
+ iconSet: iconSet
72
70
  })]
73
71
  }), cmsMode === "editing" && _jsx(Helper, {})]
74
72
  });
@@ -6,7 +6,7 @@ const DEFAULT_MARKER_DATA = {
6
6
  description: "",
7
7
  url: "",
8
8
  label: "",
9
- popupOpened: false
9
+ tooltipOpened: false
10
10
  };
11
11
  const MapEvents = ({
12
12
  mapRef,
@@ -10,8 +10,6 @@ import PopupData from "./popup-data";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const Marker = ({
13
- isInDialog,
14
- map,
15
13
  marker,
16
14
  setMarkers,
17
15
  iconSet,
@@ -23,7 +21,7 @@ const Marker = ({
23
21
  icon,
24
22
  title,
25
23
  position,
26
- popupOpened
24
+ tooltipOpened
27
25
  } = marker;
28
26
  const Icon = Icons[iconSet][icon] || Icons[iconSet].Location;
29
27
  const updatePosition = e => {
@@ -39,16 +37,13 @@ const Marker = ({
39
37
  });
40
38
  });
41
39
  };
42
- React.useEffect(() => {
43
- if (!isEditing && popupOpened) {
44
- popupRef.current.setLatLng(position).openOn(map.current);
45
- if (isInDialog) {
46
- setInterval(() => {
47
- popupRef.current.update();
48
- }, 1000);
49
- }
50
- }
51
- }, [isEditing, isInDialog, map, popupOpened, position]);
40
+ const tooltipProps = tooltipOpened ? {
41
+ direction: "right",
42
+ permanent: true,
43
+ offset: [6, -14]
44
+ } : {
45
+ sticky: true
46
+ };
52
47
  return _jsxs(LeafletMarker, {
53
48
  draggable: isEditing,
54
49
  eventHandlers: {
@@ -62,11 +57,10 @@ const Marker = ({
62
57
  html: ReactDOM.renderToString(_jsx(Icon, {}))
63
58
  }),
64
59
  children: [!isEditing && _jsx(Tooltip, {
65
- sticky: true,
60
+ ...tooltipProps,
66
61
  children: title
67
62
  }), _jsx(Popup, {
68
63
  ref: popupRef,
69
- className: css.popup,
70
64
  children: isEditing ? _jsx(EditForm, {
71
65
  popupRef: popupRef,
72
66
  marker: marker,
@@ -79,8 +73,6 @@ const Marker = ({
79
73
  }, id);
80
74
  };
81
75
  const Markers = ({
82
- isInDialog,
83
- map,
84
76
  markers,
85
77
  setMarkers,
86
78
  iconSet
@@ -91,8 +83,6 @@ const Markers = ({
91
83
  const isEditing = cmsMode === "editing";
92
84
  return markers.map((marker, i) => {
93
85
  return _jsx(Marker, {
94
- isInDialog: isInDialog,
95
- map: map,
96
86
  marker: marker,
97
87
  setMarkers: setMarkers,
98
88
  iconSet: iconSet,
@@ -4,8 +4,3 @@
4
4
  fill: var(--ds-secondary, var(--ds-blue-400, #4177f6));
5
5
  transform: translate(-35%, -65%);
6
6
  }
7
-
8
- .popup {
9
- transition: all 160ms
10
- var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9)) !important;
11
- }
@@ -36,8 +36,8 @@ const Filter = ({
36
36
  className: css.filterLabel,
37
37
  children: message(lang, code)
38
38
  }), _jsx(Select, {
39
- value: values[code],
40
39
  options: options,
40
+ value: values[code],
41
41
  onValueChange: updateFilter
42
42
  })]
43
43
  });
@@ -18,6 +18,7 @@ const MagicBox = ({
18
18
  className,
19
19
  alignContent,
20
20
  maxCPDuration,
21
+ minDays = 0,
21
22
  children
22
23
  }) => {
23
24
  const [filters, setFilters] = React.useState();
@@ -68,16 +69,28 @@ const MagicBox = ({
68
69
  filters,
69
70
  activities
70
71
  });
71
- const {
72
- filters: newFilters
73
- } = filtersResult;
72
+ const newFilters = Object.keys(filtersResult.filters).reduce((acc, key) => {
73
+ const filter = filtersResult.filters[key];
74
+ if (key !== "days") {
75
+ return {
76
+ ...acc,
77
+ filter
78
+ };
79
+ } else {
80
+ const filteredDays = filter.filter(item => item.value > minDays);
81
+ return {
82
+ ...acc,
83
+ [key]: filteredDays
84
+ };
85
+ }
86
+ }, {});
74
87
  setFilters(newFilters);
75
88
  const defaultValues = Object.keys(newFilters).reduce((acc, key) => ({
76
89
  ...acc,
77
90
  [key]: ""
78
91
  }), {});
79
92
  !values && setValues(defaultValues);
80
- }, [lang, resort, stay, values]);
93
+ }, [lang, minDays, resort, stay, values]);
81
94
  React.useEffect(() => {
82
95
  if (stay) {
83
96
  refreshFilters();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.6.19",
3
+ "version": "1.6.21",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^2.1.0",
6
6
  "next": "^12.0.0",