ublo-lib 1.6.27 → 1.7.0
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/admin-links/admin-links.d.ts +12 -0
- package/es/common/components/admin-links/admin-links.d.ts.map +1 -0
- package/es/common/components/admin-links/admin-links.js +50 -95
- package/es/common/components/admin-links/index.d.ts +3 -0
- package/es/common/components/admin-links/index.d.ts.map +1 -0
- package/es/common/components/admin-links/index.js +1 -1
- package/es/common/components/scrolling-carousel/index.d.ts +3 -0
- package/es/common/components/scrolling-carousel/index.d.ts.map +1 -0
- package/es/common/components/scrolling-carousel/index.js +1 -1
- package/es/common/components/scrolling-carousel/scrolling-carousel.d.ts +8 -0
- package/es/common/components/scrolling-carousel/scrolling-carousel.d.ts.map +1 -0
- package/es/common/components/scrolling-carousel/scrolling-carousel.js +57 -84
- package/es/common/components/tabbed-zones.d.ts +13 -0
- package/es/common/components/tabbed-zones.d.ts.map +1 -0
- package/es/common/components/tabbed-zones.js +47 -102
- package/es/common/hooks/use-faq.d.ts +3 -0
- package/es/common/hooks/use-faq.d.ts.map +1 -0
- package/es/common/hooks/use-faq.js +36 -37
- package/es/common/hooks/use-in-view.d.ts +5 -0
- package/es/common/hooks/use-in-view.d.ts.map +1 -0
- package/es/common/hooks/use-in-view.js +62 -59
- package/es/common/hooks/use-scroll-direction.d.ts +11 -0
- package/es/common/hooks/use-scroll-direction.d.ts.map +1 -0
- package/es/common/hooks/use-scroll-direction.js +32 -33
- package/es/common/hooks/use-stay.d.ts +4 -0
- package/es/common/hooks/use-stay.d.ts.map +1 -0
- package/es/common/hooks/use-stay.js +14 -25
- package/es/common/hooks/use-sticky.d.ts +4 -0
- package/es/common/hooks/use-sticky.d.ts.map +1 -0
- package/es/common/hooks/use-sticky.js +35 -31
- package/es/common/hooks/use-tunnel.d.ts +6 -0
- package/es/common/hooks/use-tunnel.d.ts.map +1 -0
- package/es/common/hooks/use-tunnel.js +36 -43
- package/es/common/hooks/use-window-sizes.d.ts +7 -0
- package/es/common/hooks/use-window-sizes.d.ts.map +1 -0
- package/es/common/hooks/use-window-sizes.js +28 -27
- package/es/common/utils/cookies.d.ts +2 -0
- package/es/common/utils/cookies.d.ts.map +1 -0
- package/es/common/utils/cookies.js +11 -10
- package/es/common/utils/copy.d.ts +2 -0
- package/es/common/utils/copy.d.ts.map +1 -0
- package/es/common/utils/copy.js +11 -11
- package/es/common/utils/dates.d.ts +2 -0
- package/es/common/utils/dates.d.ts.map +1 -0
- package/es/common/utils/dates.js +10 -8
- package/es/common/utils/elements.d.ts +3 -0
- package/es/common/utils/elements.d.ts.map +1 -0
- package/es/common/utils/elements.js +7 -7
- package/es/common/utils/events.d.ts +4 -0
- package/es/common/utils/events.d.ts.map +1 -0
- package/es/common/utils/events.js +19 -21
- package/es/common/utils/file-manager.d.ts +13 -0
- package/es/common/utils/file-manager.d.ts.map +1 -0
- package/es/common/utils/file-manager.js +10 -12
- package/es/common/utils/load-js.d.ts +2 -0
- package/es/common/utils/load-js.d.ts.map +1 -0
- package/es/common/utils/load-js.js +11 -10
- package/es/common/utils/msem-widget.d.ts +8 -0
- package/es/common/utils/msem-widget.d.ts.map +1 -0
- package/es/common/utils/msem-widget.js +9 -11
- package/es/common/utils/url-parameters.d.ts +2 -0
- package/es/common/utils/url-parameters.d.ts.map +1 -0
- package/es/common/utils/url-parameters.js +7 -11
- package/es/esf/components/period-picker/period-picker.module.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Link = {
|
|
3
|
+
name: string;
|
|
4
|
+
onClick: string | (() => void);
|
|
5
|
+
target?: string;
|
|
6
|
+
};
|
|
7
|
+
declare type Props = {
|
|
8
|
+
customLinks?: Record<string, Link>;
|
|
9
|
+
};
|
|
10
|
+
declare const AdminLinks: ({ customLinks }: Props) => JSX.Element;
|
|
11
|
+
export default AdminLinks;
|
|
12
|
+
//# sourceMappingURL=admin-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-links.d.ts","sourceRoot":"","sources":["../../../../src/common/components/admin-links/admin-links.tsx"],"names":[],"mappings":";AAMA,aAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CACpC,CAAC;AAeF,QAAA,MAAM,UAAU,oBAAqB,KAAK,gBA0EzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,102 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useUbloContext } from "ublo/with-ublo";
|
|
3
4
|
import { loadFileManager } from "../../utils/file-manager";
|
|
4
5
|
import styles from "./admin-links.module.css";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
6
|
const ToggleIcon = () => {
|
|
9
|
-
|
|
10
|
-
viewBox: "0 0 24 24",
|
|
11
|
-
width: "24",
|
|
12
|
-
height: "24",
|
|
13
|
-
className: styles.toggleIcon,
|
|
14
|
-
children: _jsx("path", {
|
|
15
|
-
d: "M19.44 12.99l-.01.02c.04-.33.08-.67.08-1.01 0-.34-.03-.66-.07-.99l.01.02 2.44-1.92-2.43-4.22-2.87 1.16.01.01c-.52-.4-1.09-.74-1.71-1h.01L14.44 2H9.57l-.44 3.07h.01c-.62.26-1.19.6-1.71 1l.01-.01-2.88-1.17-2.44 4.22 2.44 1.92.01-.02c-.04.33-.07.65-.07.99 0 .34.03.68.08 1.01l-.01-.02-2.1 1.65-.33.26 2.43 4.2 2.88-1.15-.02-.04c.53.41 1.1.75 1.73 1.01h-.03L9.58 22h4.85s.03-.18.06-.42l.38-2.65h-.01c.62-.26 1.2-.6 1.73-1.01l-.02.04 2.88 1.15 2.43-4.2s-.14-.12-.33-.26l-2.11-1.66zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"
|
|
16
|
-
})
|
|
17
|
-
});
|
|
7
|
+
return (_jsx("svg", { viewBox: "0 0 24 24", width: "24", height: "24", className: styles.toggleIcon, children: _jsx("path", { d: "M19.44 12.99l-.01.02c.04-.33.08-.67.08-1.01 0-.34-.03-.66-.07-.99l.01.02 2.44-1.92-2.43-4.22-2.87 1.16.01.01c-.52-.4-1.09-.74-1.71-1h.01L14.44 2H9.57l-.44 3.07h.01c-.62.26-1.19.6-1.71 1l.01-.01-2.88-1.17-2.44 4.22 2.44 1.92.01-.02c-.04.33-.07.65-.07.99 0 .34.03.68.08 1.01l-.01-.02-2.1 1.65-.33.26 2.43 4.2 2.88-1.15-.02-.04c.53.41 1.1.75 1.73 1.01h-.03L9.58 22h4.85s.03-.18.06-.42l.38-2.65h-.01c.62-.26 1.2-.6 1.73-1.01l-.02.04 2.88 1.15 2.43-4.2s-.14-.12-.33-.26l-2.11-1.66zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z" }) }));
|
|
18
8
|
};
|
|
19
|
-
const AdminLinks = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
className: styles.links,
|
|
67
|
-
children: [_jsx("div", {
|
|
68
|
-
className: styles.linksTitle,
|
|
69
|
-
children: "Liens utiles"
|
|
70
|
-
}), Object.keys(links).map((key, i) => {
|
|
71
|
-
const link = links[key];
|
|
72
|
-
if (!link) return;
|
|
73
|
-
const {
|
|
74
|
-
name,
|
|
75
|
-
onClick,
|
|
76
|
-
target
|
|
77
|
-
} = link;
|
|
78
|
-
const isHrefValid = typeof onClick === "string" && onClick !== "";
|
|
79
|
-
const isFunction = typeof onClick === "function";
|
|
80
|
-
if (!isHrefValid && !isFunction) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const Tag = isHrefValid ? "a" : "button";
|
|
84
|
-
const anchorProps = {
|
|
85
|
-
href: onClick,
|
|
86
|
-
target
|
|
87
|
-
};
|
|
88
|
-
const buttonProps = {
|
|
89
|
-
onClick
|
|
90
|
-
};
|
|
91
|
-
const props = isFunction ? buttonProps : anchorProps;
|
|
92
|
-
return _jsx(Tag, {
|
|
93
|
-
className: styles.link,
|
|
94
|
-
...props,
|
|
95
|
-
children: name
|
|
96
|
-
}, i);
|
|
97
|
-
})]
|
|
98
|
-
})]
|
|
99
|
-
})
|
|
100
|
-
});
|
|
9
|
+
const AdminLinks = ({ customLinks }) => {
|
|
10
|
+
const { lang, cmsMode, config } = useUbloContext();
|
|
11
|
+
const [open, setOpen] = React.useState(false);
|
|
12
|
+
const hasLangPrefix = config.langPrefix.links;
|
|
13
|
+
const { plausibleLink } = config;
|
|
14
|
+
const links = {
|
|
15
|
+
msemAdmin: {
|
|
16
|
+
name: "Administration MseM",
|
|
17
|
+
onClick: "https://admin.mon-sejour-en-montagne.com/",
|
|
18
|
+
target: "_blank",
|
|
19
|
+
},
|
|
20
|
+
tutoriels: {
|
|
21
|
+
name: "Tutoriels",
|
|
22
|
+
onClick: "http://esf-tutoriels.valraiso.net/",
|
|
23
|
+
target: "_blank",
|
|
24
|
+
},
|
|
25
|
+
popup: {
|
|
26
|
+
name: "Popup",
|
|
27
|
+
onClick: hasLangPrefix ? `/${lang.concat("/popup")}` : "/popup",
|
|
28
|
+
},
|
|
29
|
+
fileManager: {
|
|
30
|
+
name: "Photothèque",
|
|
31
|
+
onClick: loadFileManager,
|
|
32
|
+
},
|
|
33
|
+
plausible: {
|
|
34
|
+
name: "Statistiques",
|
|
35
|
+
onClick: plausibleLink,
|
|
36
|
+
target: "_blank",
|
|
37
|
+
},
|
|
38
|
+
...customLinks,
|
|
39
|
+
};
|
|
40
|
+
return (_jsx("div", { className: styles.root, children: cmsMode && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.toggle, onClick: () => setOpen(!open), children: _jsx(ToggleIcon, {}) }), open && (_jsxs("div", { className: styles.links, children: [_jsx("div", { className: styles.linksTitle, children: "Liens utiles" }), Object.keys(links).map((key, i) => {
|
|
41
|
+
const link = links[key];
|
|
42
|
+
if (!link)
|
|
43
|
+
return;
|
|
44
|
+
const { name, onClick, target } = link;
|
|
45
|
+
const isHrefValid = typeof onClick === "string" && onClick !== "";
|
|
46
|
+
const isFunction = typeof onClick === "function";
|
|
47
|
+
if (!isHrefValid && !isFunction) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const Tag = isHrefValid ? "a" : "button";
|
|
51
|
+
const anchorProps = { href: onClick, target };
|
|
52
|
+
const buttonProps = { onClick };
|
|
53
|
+
const props = isFunction ? buttonProps : anchorProps;
|
|
54
|
+
return (_jsx(Tag, { className: styles.link, ...props, children: name }, i));
|
|
55
|
+
})] }))] })) }));
|
|
101
56
|
};
|
|
102
|
-
export default AdminLinks;
|
|
57
|
+
export default AdminLinks;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/admin-links/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,eAAe,UAAU,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import AdminLinks from "./admin-links";
|
|
2
|
-
export default AdminLinks;
|
|
2
|
+
export default AdminLinks;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/scrolling-carousel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AAErD,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import ScrollingCarousel from "./scrolling-carousel";
|
|
2
|
-
export default ScrollingCarousel;
|
|
2
|
+
export default ScrollingCarousel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare type Props = {
|
|
3
|
+
className?: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
declare const ScrollingCarousel: ({ className, children }: Props) => JSX.Element;
|
|
7
|
+
export default ScrollingCarousel;
|
|
8
|
+
//# sourceMappingURL=scrolling-carousel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrolling-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/scrolling-carousel/scrolling-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,aAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAKF,QAAA,MAAM,iBAAiB,4BAA6B,KAAK,gBAiGxD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,92 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import classnames from "classnames";
|
|
3
4
|
import Button from "dt-design-system/es/button";
|
|
4
5
|
import * as Icons from "dt-design-system/es/icons";
|
|
5
|
-
import useWindowSizes from "
|
|
6
|
+
import useWindowSizes from "../../hooks/use-window-sizes";
|
|
6
7
|
import css from "./scrolling-carousel.module.css";
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
const PREV = 0;
|
|
10
9
|
const NEXT = 1;
|
|
11
|
-
const ScrollingCarousel = ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
onClick: slideTo(PREV),
|
|
66
|
-
disabled: controls.prevDisabled,
|
|
67
|
-
"data-control": "prev",
|
|
68
|
-
children: _jsx(Icons.ChevronLeft, {
|
|
69
|
-
className: css.controlIcon
|
|
70
|
-
})
|
|
71
|
-
}), _jsx(Button, {
|
|
72
|
-
className: css.control,
|
|
73
|
-
variant: "link",
|
|
74
|
-
onClick: slideTo(NEXT),
|
|
75
|
-
disabled: controls.nextDisabled,
|
|
76
|
-
"data-control": "next",
|
|
77
|
-
children: _jsx(Icons.ChevronRight, {
|
|
78
|
-
className: css.controlIcon
|
|
79
|
-
})
|
|
80
|
-
})]
|
|
81
|
-
}), _jsx("div", {
|
|
82
|
-
className: css.inner,
|
|
83
|
-
ref: ref,
|
|
84
|
-
onScroll: refreshControls,
|
|
85
|
-
"data-inner": "",
|
|
86
|
-
children: React.cloneElement(children, {
|
|
87
|
-
ref: zoneRef
|
|
88
|
-
})
|
|
89
|
-
})]
|
|
90
|
-
});
|
|
10
|
+
const ScrollingCarousel = ({ className, children }) => {
|
|
11
|
+
const ref = React.useRef(null);
|
|
12
|
+
const zoneRef = React.useRef(null);
|
|
13
|
+
const [overflow, setOverflow] = React.useState(false);
|
|
14
|
+
const [controls, setControls] = React.useState({
|
|
15
|
+
prevDisabled: false,
|
|
16
|
+
nextDisabled: false,
|
|
17
|
+
});
|
|
18
|
+
const { width } = useWindowSizes();
|
|
19
|
+
const slideTo = (direction) => () => {
|
|
20
|
+
const zone = zoneRef.current;
|
|
21
|
+
const inner = ref.current;
|
|
22
|
+
if (zone && inner) {
|
|
23
|
+
const zoneContainer = zone;
|
|
24
|
+
const innerContainer = inner;
|
|
25
|
+
const firstSection = zoneContainer.querySelector("section:not([data-hidden], [hidden])");
|
|
26
|
+
if (firstSection) {
|
|
27
|
+
const scrollDistance = firstSection.clientWidth;
|
|
28
|
+
if (direction === PREV) {
|
|
29
|
+
innerContainer.scrollLeft -= scrollDistance;
|
|
30
|
+
}
|
|
31
|
+
if (direction === NEXT) {
|
|
32
|
+
innerContainer.scrollLeft += scrollDistance;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const refreshControls = React.useCallback(() => {
|
|
38
|
+
const zone = zoneRef.current;
|
|
39
|
+
const inner = ref.current;
|
|
40
|
+
if (zone && inner) {
|
|
41
|
+
const zoneContainer = zone;
|
|
42
|
+
const innerContainer = inner;
|
|
43
|
+
setOverflow(innerContainer.clientWidth < zoneContainer.clientWidth);
|
|
44
|
+
setControls({
|
|
45
|
+
prevDisabled: innerContainer.scrollLeft === 0,
|
|
46
|
+
nextDisabled: innerContainer.scrollLeft ===
|
|
47
|
+
Math.round(innerContainer.scrollWidth) -
|
|
48
|
+
Math.round(innerContainer.clientWidth),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
refreshControls();
|
|
54
|
+
}, [refreshControls]);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
const inner = ref.current;
|
|
57
|
+
if (inner) {
|
|
58
|
+
const innerContainer = inner;
|
|
59
|
+
innerContainer.scrollLeft = 0;
|
|
60
|
+
}
|
|
61
|
+
}, [width]);
|
|
62
|
+
const classes = classnames(css.carousel, className);
|
|
63
|
+
return (_jsxs("div", { className: classes, children: [overflow && (_jsxs("div", { className: css.controls, "data-controls": "", children: [_jsx(Button, { className: css.control, variant: "link", onClick: slideTo(PREV), disabled: controls.prevDisabled, "data-control": "prev", children: _jsx(Icons.ChevronLeft, { className: css.controlIcon }) }), _jsx(Button, { className: css.control, variant: "link", onClick: slideTo(NEXT), disabled: controls.nextDisabled, "data-control": "next", children: _jsx(Icons.ChevronRight, { className: css.controlIcon }) })] })), _jsx("div", { className: css.inner, ref: ref, onScroll: refreshControls, "data-inner": "", children: React.cloneElement(children, { ref: zoneRef }) })] }));
|
|
91
64
|
};
|
|
92
|
-
export default ScrollingCarousel;
|
|
65
|
+
export default ScrollingCarousel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Tab = {
|
|
3
|
+
subs: number | null;
|
|
4
|
+
};
|
|
5
|
+
declare type Props = {
|
|
6
|
+
current?: number;
|
|
7
|
+
currentSub?: number;
|
|
8
|
+
tabs?: Tab[];
|
|
9
|
+
zonesProps: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
declare const TabbedZones: ({ current, currentSub, tabs, zonesProps, }: Props) => JSX.Element;
|
|
12
|
+
export default TabbedZones;
|
|
13
|
+
//# sourceMappingURL=tabbed-zones.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabbed-zones.d.ts","sourceRoot":"","sources":["../../../src/common/components/tabbed-zones.tsx"],"names":[],"mappings":";AAIA,aAAK,GAAG,GAAG;IACT,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAIF,QAAA,MAAM,WAAW,+CAKd,KAAK,gBAmHP,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,106 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import { useState } from "react";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import Zone from "ublo/zone";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return _jsx("div", {
|
|
51
|
-
className: classes,
|
|
52
|
-
children: length.map((_, j) => {
|
|
53
|
-
const onClick = () => setCurrentSubTab(j);
|
|
54
|
-
const classes = classnames(`tabbed-zones__sub-tab tabbed-zones__sub-tab--${i}-${j}`, {
|
|
55
|
-
"tabbed-zones__sub-tab--current": i === currentTab && j === currentSubTab
|
|
56
|
-
});
|
|
57
|
-
return _jsx("div", {
|
|
58
|
-
className: classes,
|
|
59
|
-
onClick: onClick,
|
|
60
|
-
children: _jsx(Zone, {
|
|
61
|
-
id: `tabbed-zones-sub-tab-${i}-${j}`,
|
|
62
|
-
section: "rich-text",
|
|
63
|
-
maxSections: "1",
|
|
64
|
-
tooltip: "Aide: Titre onglet",
|
|
65
|
-
...zonesProps
|
|
66
|
-
})
|
|
67
|
-
}, j);
|
|
68
|
-
})
|
|
69
|
-
}, i);
|
|
70
|
-
}), _jsxs("div", {
|
|
71
|
-
className: "tabbed-zones__zones",
|
|
72
|
-
children: [tabs.map((tab, i) => {
|
|
73
|
-
const classes = classnames(`tabbed-zones__zone tabbed-zones__zone--${i}`, {
|
|
74
|
-
"tabbed-zones__zone--current": i === currentTab
|
|
75
|
-
});
|
|
76
|
-
if (tab.subs) return null;
|
|
77
|
-
return _jsx("div", {
|
|
78
|
-
className: classes,
|
|
79
|
-
children: _jsx(Zone, {
|
|
80
|
-
id: `tabbed-zone-${i}`,
|
|
81
|
-
tooltip: "Zone d'edition : Contenu onglet",
|
|
82
|
-
...zonesProps
|
|
83
|
-
})
|
|
84
|
-
}, i);
|
|
85
|
-
}), tabs.map((tab, i) => {
|
|
86
|
-
if (!tab.subs) return null;
|
|
87
|
-
const length = [...new Array(tab.subs)];
|
|
88
|
-
return length.map((_, j) => {
|
|
89
|
-
const classes = classnames(`tabbed-zones__zone tabbed-zones__zone--${i}-${j}`, {
|
|
90
|
-
"tabbed-zones__zone--current": i === currentTab && j === currentSubTab
|
|
91
|
-
});
|
|
92
|
-
return _jsx("div", {
|
|
93
|
-
className: classes,
|
|
94
|
-
children: _jsx(Zone, {
|
|
95
|
-
id: `tabbed-zone-offers-${i}-${j}`,
|
|
96
|
-
className: "tabbed-zone-offers",
|
|
97
|
-
tooltip: "Zone d'edition : Contenu et blocs produit",
|
|
98
|
-
...zonesProps
|
|
99
|
-
})
|
|
100
|
-
}, j);
|
|
101
|
-
});
|
|
102
|
-
})]
|
|
103
|
-
})]
|
|
104
|
-
});
|
|
5
|
+
const defaultTabs = [{ subs: null }, { subs: 2 }];
|
|
6
|
+
const TabbedZones = ({ current = 0, currentSub = 0, tabs = defaultTabs, zonesProps = {}, }) => {
|
|
7
|
+
const [currentTab, setCurrentTab] = React.useState(current);
|
|
8
|
+
const [currentSubTab, setCurrentSubTab] = React.useState(currentSub);
|
|
9
|
+
return (_jsxs("div", { className: "tabbed-zones", children: [_jsx("div", { className: "tabbed-zones__tabs", children: tabs.map((_, i) => {
|
|
10
|
+
const updateCurrentTab = () => {
|
|
11
|
+
setCurrentTab(i);
|
|
12
|
+
setCurrentSubTab(0);
|
|
13
|
+
};
|
|
14
|
+
const classes = classnames("tabbed-zones__tab", `tabbed-zones__tab--${i}`, {
|
|
15
|
+
"tabbed-zones__tab--current": i === currentTab,
|
|
16
|
+
});
|
|
17
|
+
return (_jsx("div", { className: classes, onClick: updateCurrentTab, children: _jsx(Zone, { id: `tabbed-zones-tab-${i}`, section: "rich-text", maxSections: "1", tooltip: "Zone d'edition: Titre onglet" }) }, i));
|
|
18
|
+
}) }), tabs.map((tab, i) => {
|
|
19
|
+
if (!tab.subs)
|
|
20
|
+
return null;
|
|
21
|
+
const length = [...new Array(tab.subs)];
|
|
22
|
+
const classes = classnames("tabbed-zones__sub-tabs", `tabbed-zones__sub-tabs--${i}`, {
|
|
23
|
+
"tabbed-zones__sub-tabs--current": i === currentTab,
|
|
24
|
+
});
|
|
25
|
+
return (_jsx("div", { className: classes, children: length.map((_, j) => {
|
|
26
|
+
const updateCurrentTab = () => setCurrentSubTab(j);
|
|
27
|
+
const classes = classnames("tabbed-zones__sub-tab", `tabbed-zones__sub-tab--${i}-${j}`, {
|
|
28
|
+
"tabbed-zones__sub-tab--current": i === currentTab && j === currentSubTab,
|
|
29
|
+
});
|
|
30
|
+
return (_jsx("div", { className: classes, onClick: updateCurrentTab, children: _jsx(Zone, { id: `tabbed-zones-sub-tab-${i}-${j}`, section: "rich-text", maxSections: "1", tooltip: "Zone d'edition: Titre onglet", ...zonesProps }) }, j));
|
|
31
|
+
}) }, i));
|
|
32
|
+
}), _jsxs("div", { className: "tabbed-zones__zones", children: [tabs.map((tab, i) => {
|
|
33
|
+
const classes = classnames("tabbed-zones__zone", `tabbed-zones__zone--${i}`, {
|
|
34
|
+
"tabbed-zones__zone--current": i === currentTab,
|
|
35
|
+
});
|
|
36
|
+
if (tab.subs)
|
|
37
|
+
return null;
|
|
38
|
+
return (_jsx("div", { className: classes, children: _jsx(Zone, { id: `tabbed-zone-${i}`, tooltip: "Zone d'edition : Contenu onglet", ...zonesProps }) }, i));
|
|
39
|
+
}), tabs.map((tab, i) => {
|
|
40
|
+
if (!tab.subs)
|
|
41
|
+
return null;
|
|
42
|
+
const length = [...new Array(tab.subs)];
|
|
43
|
+
return length.map((_, j) => {
|
|
44
|
+
const classes = classnames("tabbed-zones__zone", `tabbed-zones__zone--${i}-${j}`, {
|
|
45
|
+
"tabbed-zones__zone--current": i === currentTab && j === currentSubTab,
|
|
46
|
+
});
|
|
47
|
+
return (_jsx("div", { className: classes, children: _jsx(Zone, { id: `tabbed-zone-offers-${i}-${j}`, className: "tabbed-zone-offers", tooltip: "Zone d'edition : Contenu et blocs produit", ...zonesProps }) }, j));
|
|
48
|
+
});
|
|
49
|
+
})] })] }));
|
|
105
50
|
};
|
|
106
|
-
export default TabbedZones;
|
|
51
|
+
export default TabbedZones;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-faq.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-faq.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,0CAA8C,MAAM,SA4C/D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useUbloContext } from "ublo/with-ublo";
|
|
3
|
-
const buildClass = className => `${className}--opened`;
|
|
3
|
+
const buildClass = (className) => `${className}--opened`;
|
|
4
4
|
const useFaq = (selector = ".faq-block", refresh) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [blocks, cleanup, init]);
|
|
5
|
+
const [blocks, setBlocks] = React.useState([]);
|
|
6
|
+
const { cmsMode } = useUbloContext();
|
|
7
|
+
const clicked = React.useCallback((clickedBlock, blocks) => () => {
|
|
8
|
+
if (cmsMode)
|
|
9
|
+
return;
|
|
10
|
+
const openedClass = buildClass(clickedBlock.classList[0]);
|
|
11
|
+
blocks.forEach((block) => {
|
|
12
|
+
const { classList } = block;
|
|
13
|
+
block !== clickedBlock || block.classList.contains(openedClass)
|
|
14
|
+
? classList.remove(openedClass)
|
|
15
|
+
: classList.add(openedClass);
|
|
16
|
+
});
|
|
17
|
+
}, [cmsMode]);
|
|
18
|
+
const init = React.useCallback((block, blocks) => {
|
|
19
|
+
block.clicked = clicked(block, blocks);
|
|
20
|
+
block.addEventListener("click", block.clicked);
|
|
21
|
+
}, [clicked]);
|
|
22
|
+
const cleanup = React.useCallback((block) => {
|
|
23
|
+
block.removeEventListener("click", block.clicked);
|
|
24
|
+
const openedClass = buildClass(block.classList[0]);
|
|
25
|
+
block.classList.remove(openedClass);
|
|
26
|
+
}, []);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (cmsMode === undefined) {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
const blocks = Array.from(document.querySelectorAll(selector));
|
|
31
|
+
setBlocks(blocks);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, [cmsMode, selector, refresh]);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
blocks.forEach((block) => init(block, blocks));
|
|
37
|
+
return () => blocks.forEach(cleanup);
|
|
38
|
+
}, [blocks, cleanup, init]);
|
|
40
39
|
};
|
|
41
|
-
export default useFaq;
|
|
40
|
+
export default useFaq;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare type CmsMode = "connected" | "info" | "editing";
|
|
3
|
+
declare const useInView: (ref: React.MutableRefObject<HTMLElement>, cmsMode: CmsMode, targetedClass: string, repeat?: boolean, intersectionValue?: number) => void;
|
|
4
|
+
export default useInView;
|
|
5
|
+
//# sourceMappingURL=use-in-view.d.ts.map
|