ublo-lib 1.12.15 → 1.12.17

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.
@@ -9,6 +9,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
 
11
11
  export default function MarkerList({
12
+ isInDialog,
12
13
  markers,
13
14
  mapRef,
14
15
  iconSet
@@ -19,7 +20,9 @@ export default function MarkerList({
19
20
  const sortedImportantMarkers = importantMarkers.sort(alphaNumSortByTitle);
20
21
  const sortedOtherMarkers = otherMarkers.sort(alphaNumSortByTitle);
21
22
  const allMarkers = [...sortedImportantMarkers, ...sortedOtherMarkers];
22
- const toggleList = () => {
23
+ const toggleList = e => {
24
+ e.preventDefault();
25
+ e.stopPropagation();
23
26
  setOpened(!opened);
24
27
  };
25
28
  const {
@@ -30,7 +33,8 @@ export default function MarkerList({
30
33
  setOpened(width > 992);
31
34
  }, [width]);
32
35
  const classes = classNames(css.list, {
33
- [css.listOpened]: opened
36
+ [css.listOpened]: opened,
37
+ [css.listIsInDialog]: isInDialog
34
38
  });
35
39
  return _jsxs("div", {
36
40
  className: classes,
@@ -43,23 +47,20 @@ export default function MarkerList({
43
47
  position,
44
48
  important
45
49
  }) => {
46
- const focusMarker = () => {
47
- mapRef.current.setView(position, 23);
48
- setTimeout(() => {
49
- const marker = mapRef.current?.getContainer()?.querySelector(`[data-id="${id}"]`)?.parentElement;
50
- if (marker) {
51
- marker.click();
52
- }
53
- }, 400);
50
+ const focusMarker = e => {
51
+ e.preventDefault();
52
+ e.stopPropagation();
54
53
  if (width <= 992) {
55
54
  setOpened(false);
56
55
  }
56
+ mapRef.current.setView(position, 23);
57
57
  };
58
58
  const Icon = Icons[iconSet][icon] || Icons[iconSet].Location;
59
59
  const classes = classNames(css.button, {
60
60
  [css.buttonImportant]: important
61
61
  });
62
- return _jsxs("button", {
62
+ return _jsxs("a", {
63
+ href: "",
63
64
  className: classes,
64
65
  onClick: focusMarker,
65
66
  children: [_jsx(Icon, {
@@ -70,6 +71,7 @@ export default function MarkerList({
70
71
  }, id);
71
72
  })
72
73
  }), _jsx(Button, {
74
+ type: "button",
73
75
  className: css.toggle,
74
76
  onClick: toggleList,
75
77
  children: _jsx(ToggleIcon, {})
@@ -1,24 +1,33 @@
1
1
  .list {
2
2
  position: absolute;
3
- top: 0;
4
- right: 0;
5
- max-width: 220px;
6
- height: 100%;
3
+ top: 6px;
4
+ right: 6px;
5
+ max-width: 250px;
6
+ height: calc(100% - 12px);
7
7
  display: flex;
8
8
  flex-direction: column;
9
- gap: 8px;
10
- padding: 8px;
9
+ gap: 4px;
10
+ border-radius: var(--ds-radius-100, 6px);
11
+ box-shadow: var(--ds-shadow-100, 0px 3px 6px rgba(0, 0, 0, 0.12));
11
12
  transition: background-color 160ms
12
- var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9)),
13
- box-shadow 160ms
14
- var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9)),
15
- opacity 160ms var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
13
+ var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
14
+ }
15
+
16
+ .list::before {
17
+ content: "";
18
+ position: absolute;
19
+ top: 0;
20
+ left: 0;
21
+ width: 100%;
22
+ height: 100%;
23
+ background-color: var(--ds-grey-100, #f5f5f5);
24
+ border-radius: inherit;
25
+ opacity: 0.35;
16
26
  }
17
27
 
18
28
  .listOpened {
19
- opacity: 0.8;
20
- background-color: var(--ds-grey-000, #ffffff);
21
- box-shadow: var(--ds-shadow-200, 0 5px 10px rgba(0, 0, 0, 0.12));
29
+ padding: 2px;
30
+ backdrop-filter: brightness(110%) contrast(90%) blur(var(--ds-blur, 5px));
22
31
  }
23
32
 
24
33
  .listOpened:hover {
@@ -26,15 +35,20 @@
26
35
  }
27
36
 
28
37
  .toggle {
29
- flex: 0 0 auto;
30
- margin: auto 0 0 auto;
38
+ position: absolute;
39
+ bottom: 8px;
40
+ right: 8px;
41
+ user-select: none;
31
42
  }
32
43
 
33
44
  .inner {
45
+ position: relative;
34
46
  flex: 1 1 100%;
35
47
  display: flex;
36
48
  flex-direction: column;
37
- gap: 8px;
49
+ gap: 4px;
50
+ padding: 0 8px;
51
+ padding-top: 8px;
38
52
  overflow: auto;
39
53
  animation: marker-list-inner-appearance 160ms
40
54
  var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
@@ -43,7 +57,6 @@
43
57
  @keyframes marker-list-inner-appearance {
44
58
  0% {
45
59
  opacity: 0;
46
- transform: translateX(6px);
47
60
  }
48
61
  }
49
62
 
@@ -51,15 +64,20 @@
51
64
  display: flex;
52
65
  align-items: center;
53
66
  gap: 1ch;
54
- padding: 8px;
55
- font-size: 13px;
67
+ padding: 6px;
68
+ color: inherit;
69
+ font-size: 14px;
56
70
  text-align: left;
57
71
  border-radius: var(--ds-radius-100, 6px);
58
72
  cursor: pointer;
59
73
  }
60
74
 
75
+ .listIsInDialog .button:first-of-type {
76
+ margin-right: 30px;
77
+ }
78
+
61
79
  .button:is(:hover, :focus) {
62
- background-color: var(--ds-grey-100, #f5f5f5);
80
+ background-color: var(--ds-grey-200, #efefef);
63
81
  }
64
82
 
65
83
  .buttonImportant {
@@ -67,8 +85,9 @@
67
85
  }
68
86
 
69
87
  .icon {
70
- flex: 0 0 26px;
71
- width: 26px;
72
- height: 26px;
88
+ flex: 0 0 32px;
89
+ width: 32px;
90
+ height: 32px;
91
+ filter: drop-shadow(var(--ds-shadow-100, 0px 3px 6px rgba(0, 0, 0, 0.12)));
73
92
  fill: var(--ds-secondary, var(--ds-blue-400, #4177f6));
74
93
  }
@@ -52,10 +52,13 @@ function Marker({
52
52
  });
53
53
  });
54
54
  };
55
- const tooltipProps = {
55
+ const tooltipProps = tooltipOpened ? {
56
56
  direction: "right",
57
57
  permanent: true,
58
58
  offset: [6, -14]
59
+ } : {
60
+ direction: "right",
61
+ offset: [6, -14]
59
62
  };
60
63
  return _jsxs(LeafletMarker, {
61
64
  ref: markerRef,
@@ -75,11 +78,12 @@ function Marker({
75
78
  "data-id": id
76
79
  }))
77
80
  }),
78
- children: [!isEditing && tooltipOpened && _jsx(Tooltip, {
81
+ children: [!isEditing && _jsx(Tooltip, {
79
82
  ...tooltipProps,
80
83
  children: title
81
84
  }), _jsx(Popup, {
82
85
  ref: popupRef,
86
+ offset: [0, -24],
83
87
  children: isEditing ? _jsx(EditForm, {
84
88
  popupRef: popupRef,
85
89
  marker: marker,
@@ -1,6 +1,26 @@
1
1
  .markerIcon > svg {
2
- width: 34px;
3
- height: 34px;
2
+ position: relative;
3
+ width: 42px;
4
+ height: 42px;
4
5
  fill: var(--ds-secondary, var(--ds-blue-400, #4177f6));
6
+ filter: drop-shadow(var(--ds-shadow-100, 0px 3px 6px rgba(0, 0, 0, 0.12)));
5
7
  transform: translate(-35%, -65%);
8
+ transition: transform 160ms
9
+ var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
10
+ }
11
+
12
+ .markerIcon:hover > svg {
13
+ transform: translate(-35%, -65%) scale(1.1);
14
+ }
15
+
16
+ .markerIcon:has([data-pin])::after {
17
+ content: "";
18
+ top: calc(100% + 1px);
19
+ left: calc(50% - 6px);
20
+ width: 16px;
21
+ position: absolute;
22
+ height: 10px;
23
+ background-color: var(--ds-grey-700, #232324);
24
+ border-radius: 50%;
25
+ opacity: 0.3;
6
26
  }
@@ -12,6 +12,9 @@ export default function PopupData({
12
12
  url,
13
13
  label
14
14
  } = marker;
15
+ const isExternalUrl = /^((http|https):\/\/)/.test(url);
16
+ const target = isExternalUrl ? "_blank" : undefined;
17
+ const rel = isExternalUrl ? "noopener" : undefined;
15
18
  const formatedDescription = description.replace(/\n/g, "<br />");
16
19
  return _jsxs("div", {
17
20
  className: css.data,
@@ -27,6 +30,8 @@ export default function PopupData({
27
30
  tag: "a",
28
31
  href: url.trim(),
29
32
  className: css.link,
33
+ target: target,
34
+ rel: rel,
30
35
  children: label || "En savoir plus"
31
36
  })]
32
37
  });
@@ -1,10 +1,10 @@
1
1
  .data {
2
+ position: relative;
2
3
  max-width: 280px;
3
4
  max-height: 280px;
4
5
  display: flex;
5
6
  flex-direction: column;
6
7
  gap: 6px;
7
- font-family: var(--ds-sans-serif-font, "Open Sans", sans-serif);
8
8
  overflow: auto;
9
9
  }
10
10
 
@@ -14,7 +14,6 @@
14
14
  padding: 4px 0;
15
15
  font-size: 17px;
16
16
  font-weight: 700;
17
- background-color: var(--ds-grey-000, #fff);
18
17
  }
19
18
 
20
19
  .description {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.12.15",
3
+ "version": "1.12.17",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^2.1.0",
6
6
  "leaflet": "^1.9.1",