ublo-lib 1.25.12 → 1.25.13
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/es/common/components/cross-selling-editor/override.js +42 -1
- package/es/common/components/cross-selling-editor/override.module.css +16 -0
- package/es/common/components/cross-selling-editor/overrides-list.js +20 -2
- package/es/common/components/cross-selling-editor/overrides-list.module.css +11 -3
- package/package.json +3 -3
|
@@ -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: [
|
|
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:
|
|
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
|
-
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ublo-lib",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.13",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"dt-design-system": "^3.
|
|
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.
|
|
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",
|