ublo-lib 1.25.12 → 1.25.14

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.
@@ -10,7 +10,9 @@ import styles from "./override.module.css";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  export default function Override({
13
+ index,
13
14
  currentOffer,
15
+ overrides,
14
16
  override,
15
17
  currentOverride,
16
18
  setCurrentOverride,
@@ -20,6 +22,8 @@ export default function Override({
20
22
  durations
21
23
  }) {
22
24
  const [formOpen, setFormOpen] = React.useState(false);
25
+ const isFirst = index === 0;
26
+ const isLast = index === overrides.length - 1;
23
27
  const toggleFormOpen = e => {
24
28
  e.stopPropagation();
25
29
  setFormOpen(formOpen => !formOpen);
@@ -32,6 +36,26 @@ export default function Override({
32
36
  setCurrentOverride(isSelected ? null : override);
33
37
  closeCreationForm();
34
38
  };
39
+ const sort = direction => e => {
40
+ e.stopPropagation();
41
+ setConfig((config = {}) => {
42
+ const itemConfig = config[currentOffer] || {};
43
+ const itemOverrides = itemConfig.overrides || [];
44
+ const currentIndex = itemOverrides.findIndex(o => o.id === override.id);
45
+ const newIndex = direction === "up" ? currentIndex - 1 : currentIndex + 1;
46
+ const newOverrides = [...itemOverrides];
47
+ newOverrides.splice(currentIndex, 1);
48
+ newOverrides.splice(newIndex, 0, override);
49
+ const newConfig = {
50
+ ...config,
51
+ [currentOffer]: {
52
+ ...itemConfig,
53
+ overrides: newOverrides
54
+ }
55
+ };
56
+ return newConfig;
57
+ });
58
+ };
35
59
  const removeOverride = () => {
36
60
  if (currentOverride === override) {
37
61
  setCurrentOverride(null);
@@ -90,7 +114,24 @@ export default function Override({
90
114
  return _jsxs("div", {
91
115
  className: classes,
92
116
  onClick: updateCurrentOverride,
93
- children: [_jsx(Input, {
117
+ children: [_jsxs("div", {
118
+ className: styles.sortControls,
119
+ children: [_jsx(Button, {
120
+ variant: "transparent",
121
+ className: styles.sortControl,
122
+ disabled: isFirst,
123
+ onClick: sort("up"),
124
+ compact: true,
125
+ children: _jsx(Icons.ChevronUp, {})
126
+ }), _jsx(Button, {
127
+ variant: "transparent",
128
+ className: styles.sortControl,
129
+ disabled: isLast,
130
+ onClick: sort("down"),
131
+ compact: true,
132
+ children: _jsx(Icons.ChevronDown, {})
133
+ })]
134
+ }), _jsx(Input, {
94
135
  className: styles.input,
95
136
  value: override.name,
96
137
  onChange: updateOverrideName,
@@ -42,6 +42,22 @@
42
42
  border-radius: var(--ds-radius-100, 4px);
43
43
  }
44
44
 
45
+ .sortControls {
46
+ position: absolute;
47
+ top: 50%;
48
+ right: 100%;
49
+ transform: translateY(calc(-50% + 1px));
50
+ opacity: 0;
51
+ }
52
+
53
+ .override:hover .sortControls {
54
+ opacity: 1;
55
+ }
56
+
57
+ .sortControl {
58
+ padding: 1px;
59
+ }
60
+
45
61
  .input input {
46
62
  font-size: 13px !important;
47
63
  user-select: auto;
@@ -59,18 +59,36 @@ export default function OverridesList({
59
59
  setNewOverride("");
60
60
  closeCreationForm();
61
61
  };
62
+ const title = _jsxs("span", {
63
+ className: styles.title,
64
+ children: [overrides.length, " surcharges", _jsxs(Popover, {
65
+ className: styles.titlePopover,
66
+ trigger: _jsx(Button, {
67
+ variant: "transparent",
68
+ compact: true,
69
+ children: _jsx(Icons.Info, {})
70
+ }),
71
+ children: [_jsx("b", {
72
+ children: "Si plusieurs surcharges"
73
+ }), " correspondent au contenu du panier,", " ", _jsx("b", {
74
+ children: "seule la derni\xE8re est appliqu\xE9e"
75
+ }), ".", _jsx("br", {}), "Vous pouvez changer l'ordre des surcharges \xE0 l'aide des fl\xE8ches visibible \xE0 gauche de chaque surcharge au survol de ces derni\xE8res."]
76
+ })]
77
+ });
62
78
  return _jsxs("div", {
63
79
  className: styles.overrides,
64
80
  children: [hasOverrides ? _jsx(Collapsible, {
65
- title: `${overrides.length} surcharges`,
81
+ title: title,
66
82
  className: styles.collapsible,
67
83
  compact: true,
68
84
  open: opened,
69
85
  toggleTooltip: "Afficher toutes les surcharges",
70
86
  onOpenChange: setOpened,
71
- hiddenContent: overrides.map(override => {
87
+ hiddenContent: overrides.map((override, index) => {
72
88
  return _jsx(Override, {
89
+ index: index,
73
90
  currentOffer: currentOffer,
91
+ overrides: overrides,
74
92
  override: override,
75
93
  currentOverride: currentOverride,
76
94
  setCurrentOverride: setCurrentOverride,
@@ -42,6 +42,17 @@
42
42
  gap: 4px;
43
43
  }
44
44
 
45
+ .title {
46
+ display: flex;
47
+ align-items: center;
48
+ }
49
+
50
+ .titlePopover {
51
+ max-width: 320px;
52
+ color: var(--ds-grey-500, #7c7b7b);
53
+ font-size: var(--ds-label-font-size, 13px);
54
+ }
55
+
45
56
  .popover {
46
57
  pointer-events: auto;
47
58
  }
@@ -51,6 +62,3 @@
51
62
  align-items: flex-start;
52
63
  gap: 4px;
53
64
  }
54
-
55
- .createSubmit {
56
- }
@@ -1,10 +1,13 @@
1
1
  import * as React from "react";
2
+ import Link from "ublo/link";
2
3
  import { useUbloContext } from "ublo/with-ublo";
3
4
  import classNames from "classnames";
4
5
  import Loader from "dt-design-system/es/loader";
5
- import T, { t } from "./i18n/translations";
6
+ import Button from "dt-design-system/es/button";
7
+ import * as Icons from "dt-design-system/es/icons";
6
8
  import TelesiegeIcon from "./icons/lifts/telesiege";
7
9
  import SlopesIcon from "./icons/slopes";
10
+ import T, { t } from "./i18n/translations";
8
11
  import css from "./domain.module.css";
9
12
  import { jsx as _jsx } from "react/jsx-runtime";
10
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -12,8 +15,12 @@ const Domain = React.forwardRef(({
12
15
  domain
13
16
  }, ref) => {
14
17
  const {
15
- lang
18
+ lang,
19
+ config
16
20
  } = useUbloContext();
21
+ const {
22
+ slopeMapPath
23
+ } = config;
17
24
  if (domain === undefined) {
18
25
  return _jsx("div", {
19
26
  ref: ref,
@@ -98,6 +105,11 @@ const Domain = React.forwardRef(({
98
105
  })]
99
106
  }, key);
100
107
  })
108
+ }), _jsxs(Button, {
109
+ tag: Link,
110
+ className: css.mapButton,
111
+ href: slopeMapPath,
112
+ children: [_jsx(Icons.Map, {}), t(lang, "domain.map")]
101
113
  })]
102
114
  })
103
115
  });
@@ -109,3 +109,12 @@
109
109
  .slopeCount {
110
110
  font-size: 16px;
111
111
  }
112
+
113
+ .mapButton {
114
+ --ds-button-background: hsl(var(--secondary));
115
+ --ds-button-hover-background: hsl(var(--secondary));
116
+ }
117
+
118
+ .mapButton:is(:hover, :focus) {
119
+ opacity: 0.9;
120
+ }
@@ -49,7 +49,8 @@
49
49
  "BLUE": "Pistes bleues",
50
50
  "RED": "Pistes rouges",
51
51
  "BLACK": "Pistes noires"
52
- }
52
+ },
53
+ "map": "Afficher le plan des pistes"
53
54
  },
54
55
  "weather": {
55
56
  "title": "Météo Neige",
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.25.12",
3
+ "version": "1.25.14",
4
4
  "peerDependencies": {
5
- "dt-design-system": "^3.1.5",
5
+ "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",
7
7
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0",
8
8
  "react": "^18.2.0",
@@ -44,7 +44,7 @@
44
44
  "classnames": "2.5.1",
45
45
  "cors": "2.8.5",
46
46
  "cpx2": "4.2.3",
47
- "dt-design-system": "3.7.6",
47
+ "dt-design-system": "3.8.3",
48
48
  "eslint": "8.56.0",
49
49
  "eslint-config-next": "14.1.0",
50
50
  "mv": "2.1.1",