ublo-lib 1.34.2 → 1.34.4

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.
@@ -8,5 +8,17 @@
8
8
  ) !important;
9
9
  background-size: 400% 400% !important;
10
10
  background-position: 0% 50%;
11
- animation: loader-gradient 1.28s ease infinite;
11
+ animation: sliding-gradient 1.28s ease infinite;
12
+ }
13
+
14
+ @keyframes sliding-gradient {
15
+ 0% {
16
+ background-position: 0% 50%;
17
+ }
18
+ 50% {
19
+ background-position: 100% 50%;
20
+ }
21
+ 100% {
22
+ background-position: 0% 50%;
23
+ }
12
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"week-selector.d.ts","sourceRoot":"","sources":["../../../../src/common/components/week-selector/week-selector.tsx"],"names":[],"mappings":"AAUA,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;CAC3C,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,cAAc,EACd,OAAO,GACR,EAAE,KAAK,2CAkNP"}
1
+ {"version":3,"file":"week-selector.d.ts","sourceRoot":"","sources":["../../../../src/common/components/week-selector/week-selector.tsx"],"names":[],"mappings":"AAWA,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;CAC3C,CAAC;AAOF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,cAAc,EACd,OAAO,GACR,EAAE,KAAK,2CAoPP"}
@@ -3,6 +3,7 @@ import * as React from "react";
3
3
  import classNames from "classnames";
4
4
  import { motion } from "framer-motion";
5
5
  import getConfig from "next/config";
6
+ import Tooltip from "dt-design-system/es/tooltip";
6
7
  import Button from "dt-design-system/es/button";
7
8
  import Select from "dt-design-system/es/select";
8
9
  import * as Icons from "dt-design-system/es/icons";
@@ -10,12 +11,14 @@ import * as Weeks from "./services/weeks";
10
11
  import styles from "./week-selector.module.css";
11
12
  const { publicRuntimeConfig } = getConfig();
12
13
  const { start, end } = publicRuntimeConfig.season;
14
+ const MINIMIZED_STORAGE_KEY = "week-selector-minimized";
13
15
  export default function WeekSelector({ displayDate, setDisplayDate, cmsMode, }) {
14
16
  const constraintsRef = React.useRef(null);
15
17
  const scrollingAreaRef = React.useRef(null);
16
18
  const [yearOffset, setYearOffset] = React.useState(0);
17
19
  const [allowDrag, setAllowDrag] = React.useState(false);
18
20
  const [dragging, setDragging] = React.useState(false);
21
+ const [minimized, setMinimized] = React.useState(false);
19
22
  const christmasWeek = Weeks.getChristmasWeek(end, yearOffset);
20
23
  const christmasWeekYear = React.useRef(christmasWeek.getFullYear());
21
24
  React.useEffect(() => {
@@ -31,8 +34,20 @@ export default function WeekSelector({ displayDate, setDisplayDate, cmsMode, })
31
34
  }
32
35
  }
33
36
  }, [cmsMode, displayDate, scrollingAreaRef]);
37
+ React.useEffect(() => {
38
+ const minimized = window.localStorage.getItem(MINIMIZED_STORAGE_KEY);
39
+ setMinimized(minimized === "true");
40
+ }, []);
34
41
  if (cmsMode !== "connected")
35
42
  return null;
43
+ const minimize = () => {
44
+ setMinimized(true);
45
+ window.localStorage.setItem(MINIMIZED_STORAGE_KEY, "true");
46
+ };
47
+ const maximize = () => {
48
+ setMinimized(false);
49
+ window.localStorage.removeItem(MINIMIZED_STORAGE_KEY);
50
+ };
36
51
  const enableDrag = () => {
37
52
  setAllowDrag(true);
38
53
  };
@@ -76,6 +91,9 @@ export default function WeekSelector({ displayDate, setDisplayDate, cmsMode, })
76
91
  const classes = classNames(styles.selector, {
77
92
  [styles.dragging]: dragging,
78
93
  });
94
+ if (minimized) {
95
+ return (_jsx(Tooltip, { content: "Afficher le s\u00E9lecteur de date", contentProps: { side: "right" }, children: _jsx(Button, { className: styles.minimizedButton, onClick: maximize, children: _jsx(Icons.Calendar, {}) }) }));
96
+ }
79
97
  return (_jsx("div", { ref: constraintsRef, className: classes, children: _jsxs(motion.div, { animate: {
80
98
  boxShadow: "var(--ds-shadow-200, 0 5px 10px rgba(0, 0, 0, 0.12))",
81
99
  }, dragMomentum: false, drag: allowDrag, dragConstraints: constraintsRef, className: styles.container, whileDrag: {
@@ -86,7 +104,7 @@ export default function WeekSelector({ displayDate, setDisplayDate, cmsMode, })
86
104
  day: "2-digit",
87
105
  month: "2-digit",
88
106
  year: "numeric",
89
- }) }), _jsx(Select, { className: styles.seasonSelect, label: "Saison", options: seasons, value: yearOffset, onValueChange: (value) => setYearOffset(Number(value)), compact: true })] }), _jsxs("div", { className: styles.inner, children: [_jsx("div", { ref: scrollingAreaRef, className: styles.items, children: weeks.map((week) => {
107
+ }) }), _jsx(Select, { className: styles.seasonSelect, label: "Saison", options: seasons, value: yearOffset, onValueChange: (value) => setYearOffset(Number(value)), compact: true }), _jsx(Tooltip, { content: "R\u00E9duire", children: _jsx(Button, { variant: "transparent", onClick: minimize, children: _jsx(Icons.MinusSquare, {}) }) })] }), _jsxs("div", { className: styles.inner, children: [_jsx("div", { ref: scrollingAreaRef, className: styles.items, children: weeks.map((week) => {
90
108
  const prevDate = Weeks.weekToDate(week - 1, end, yearOffset);
91
109
  const currDate = Weeks.weekToDate(week, end, yearOffset);
92
110
  const nextDate = Weeks.weekToDate(week + 1, end, yearOffset);
@@ -1,3 +1,14 @@
1
+ .minimizedButton {
2
+ --ds-button-padding: 14px;
3
+ --ds-button-radius: 0 var(--ds-radius-400, 20px) var(--ds-radius-400, 20px) 0;
4
+ --ds-button-shadow: var(--ds-shadow-200, 0 5px 10px rgba(0, 0, 0, 0.12));
5
+
6
+ position: fixed;
7
+ left: 0;
8
+ bottom: 150px;
9
+ z-index: 1000;
10
+ }
11
+
1
12
  .selector {
2
13
  position: fixed;
3
14
  top: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.34.2",
3
+ "version": "1.34.4",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.5",
6
6
  "leaflet": "^1.9.1",