ublo-lib 1.47.8 → 1.47.9-1.rc0
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 +7 -1
- package/es/common/components/admin-links/admin-links.d.ts.map +1 -1
- package/es/common/components/admin-links/admin-links.js +14 -8
- package/es/common/components/cart-dialog/cart-dialog-inner.d.ts +2 -1
- package/es/common/components/cart-dialog/cart-dialog-inner.d.ts.map +1 -1
- package/es/common/components/cart-dialog/cart-dialog-inner.js +13 -2
- package/es/common/components/cart-dialog/cart-dialog.d.ts +2 -1
- package/es/common/components/cart-dialog/cart-dialog.d.ts.map +1 -1
- package/es/common/components/cart-dialog/cart-dialog.js +2 -2
- package/es/common/components/cart-dialog/default.d.ts +2 -1
- package/es/common/components/cart-dialog/default.d.ts.map +1 -1
- package/es/common/components/cart-dialog/default.js +2 -2
- package/es/common/components/cart-dialog/esf-custom.d.ts +2 -1
- package/es/common/components/cart-dialog/esf-custom.d.ts.map +1 -1
- package/es/common/components/cart-dialog/esf-custom.js +2 -2
- package/es/common/components/cart-dialog/esf.d.ts +2 -1
- package/es/common/components/cart-dialog/esf.d.ts.map +1 -1
- package/es/common/components/cart-dialog/esf.js +2 -2
- package/es/common/components/cart-dialog/lodging.d.ts +2 -1
- package/es/common/components/cart-dialog/lodging.d.ts.map +1 -1
- package/es/common/components/cart-dialog/lodging.js +2 -2
- package/es/common/components/cart-dialog/ski-passes.d.ts +2 -1
- package/es/common/components/cart-dialog/ski-passes.d.ts.map +1 -1
- package/es/common/components/cart-dialog/ski-passes.js +2 -2
- package/es/common/components/cart-dialog/ski-rental.d.ts +2 -1
- package/es/common/components/cart-dialog/ski-rental.d.ts.map +1 -1
- package/es/common/components/cart-dialog/ski-rental.js +2 -2
- package/es/common/components/cart-dialog/vakario.d.ts +2 -1
- package/es/common/components/cart-dialog/vakario.d.ts.map +1 -1
- package/es/common/components/cart-dialog/vakario.js +2 -2
- package/es/common/components/cart-preview/cart-pill.d.ts +3 -1
- package/es/common/components/cart-preview/cart-pill.d.ts.map +1 -1
- package/es/common/components/cart-preview/cart-pill.js +5 -3
- package/es/common/components/cart-preview/cart-preview.d.ts +4 -1
- package/es/common/components/cart-preview/cart-preview.d.ts.map +1 -1
- package/es/common/components/cart-preview/cart-preview.js +19 -6
- package/es/common/components/cart-preview/utils.d.ts.map +1 -1
- package/es/common/components/cart-preview/utils.js +8 -1
- package/es/common/components/cookie-consent/cookie-consent.d.ts.map +1 -1
- package/es/common/components/cookie-consent/cookie-consent.js +10 -1
- package/es/common/components/cross-selling-editor/services/utils.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/services/utils.js +6 -5
- package/es/common/components/custom-contact-form/attachment.js +2 -2
- package/es/common/components/custom-contact-form/custom-contact-form.js +8 -3
- package/es/common/components/date-picker/calendar.d.ts +2 -1
- package/es/common/components/date-picker/calendar.d.ts.map +1 -1
- package/es/common/components/date-picker/calendar.js +2 -4
- package/es/common/components/date-picker/context-lang.d.ts +6 -0
- package/es/common/components/date-picker/context-lang.d.ts.map +1 -0
- package/es/common/components/date-picker/context-lang.js +9 -0
- package/es/common/components/date-picker/date-item.d.ts +2 -1
- package/es/common/components/date-picker/date-item.d.ts.map +1 -1
- package/es/common/components/date-picker/date-item.js +1 -3
- package/es/common/components/date-picker/date-item.module.css +1 -1
- package/es/common/components/date-picker/date-picker.d.ts +2 -1
- package/es/common/components/date-picker/date-picker.d.ts.map +1 -1
- package/es/common/components/date-picker/date-picker.js +6 -3
- package/es/common/components/date-picker/month.d.ts +2 -1
- package/es/common/components/date-picker/month.d.ts.map +1 -1
- package/es/common/components/date-picker/month.js +2 -4
- package/es/common/components/gesco-contact-form/services/messages.js +1 -1
- package/es/common/components/infinite-carousel/index.d.ts +3 -0
- package/es/common/components/infinite-carousel/index.d.ts.map +1 -0
- package/es/common/components/infinite-carousel/index.js +2 -0
- package/es/common/components/infinite-carousel/infinite-carousel.d.ts +20 -0
- package/es/common/components/infinite-carousel/infinite-carousel.d.ts.map +1 -0
- package/es/common/components/infinite-carousel/infinite-carousel.js +196 -0
- package/es/common/components/infinite-carousel/infinite-carousel.module.css +175 -0
- package/es/common/components/information/i18n.json +6 -0
- package/es/common/components/information/information.d.ts.map +1 -1
- package/es/common/components/information/information.js +4 -2
- package/es/common/components/information/information.module.css +1 -2
- package/es/common/components/information/use-season-choice.d.ts +2 -0
- package/es/common/components/information/use-season-choice.d.ts.map +1 -0
- package/es/common/components/information/use-season-choice.js +47 -0
- package/es/common/components/search-bar/search-bar.d.ts +2 -1
- package/es/common/components/search-bar/search-bar.d.ts.map +1 -1
- package/es/common/components/search-bar/search-bar.js +19 -6
- package/es/common/components/season-switch/index.d.ts +6 -0
- package/es/common/components/season-switch/index.d.ts.map +1 -0
- package/es/common/components/season-switch/index.js +42 -0
- package/es/common/components/season-switch/index.module.css +24 -0
- package/es/common/components/season-switch/use-choose-winter.d.ts +2 -0
- package/es/common/components/season-switch/use-choose-winter.d.ts.map +1 -0
- package/es/common/components/season-switch/use-choose-winter.js +47 -0
- package/es/common/components/week-selector/services/weeks.d.ts +1 -1
- package/es/common/components/week-selector/services/weeks.d.ts.map +1 -1
- package/es/common/components/week-selector/services/weeks.js +4 -2
- package/es/common/components/week-selector/week-selector.d.ts +1 -1
- package/es/common/components/week-selector/week-selector.d.ts.map +1 -1
- package/es/common/components/week-selector/week-selector.js +6 -2
- package/es/common/hooks/use-packages.js +1 -1
- package/es/esf/components/espace-prive/index.d.ts +2 -1
- package/es/esf/components/espace-prive/index.d.ts.map +1 -1
- package/es/esf/components/espace-prive/index.js +2 -2
- package/es/esf/components/espace-prive/partenaire.d.ts +2 -1
- package/es/esf/components/espace-prive/partenaire.d.ts.map +1 -1
- package/es/esf/components/espace-prive/partenaire.js +2 -2
- package/es/esf/components/espace-prive/tunnel.d.ts +3 -1
- package/es/esf/components/espace-prive/tunnel.d.ts.map +1 -1
- package/es/esf/components/espace-prive/tunnel.js +2 -2
- package/es/esf/components/instant-search/hooks/use-search.d.ts.map +1 -1
- package/es/esf/components/instant-search/hooks/use-search.js +8 -1
- package/es/esf/components/instant-search/instant-search.d.ts.map +1 -1
- package/es/esf/components/instant-search/instant-search.js +16 -1
- package/es/esf/components/instant-search/links.d.ts +1 -1
- package/es/esf/components/instant-search/links.d.ts.map +1 -1
- package/es/esf/components/instant-search/links.js +1 -1
- package/es/esf/components/instant-search/products.d.ts +1 -1
- package/es/esf/components/instant-search/products.d.ts.map +1 -1
- package/es/esf/components/instant-search/products.js +1 -1
- package/es/esf/components/instant-search/results.d.ts +1 -1
- package/es/esf/components/instant-search/results.d.ts.map +1 -1
- package/es/esf/components/instant-search/results.js +2 -2
- package/es/esf/components/instructors-book/sheet.d.ts.map +1 -1
- package/es/esf/components/instructors-book/sheet.js +16 -1
- package/es/esf/components/levels/levels.d.ts +3 -1
- package/es/esf/components/levels/levels.d.ts.map +1 -1
- package/es/esf/components/levels/levels.js +24 -3
- package/es/esf/components/magic-box/booking.d.ts +3 -1
- package/es/esf/components/magic-box/booking.d.ts.map +1 -1
- package/es/esf/components/magic-box/booking.js +12 -3
- package/es/esf/components/magic-box/filter.d.ts.map +1 -1
- package/es/esf/components/magic-box/filter.js +8 -8
- package/es/esf/components/magic-box/magic-box.d.ts +2 -1
- package/es/esf/components/magic-box/magic-box.d.ts.map +1 -1
- package/es/esf/components/magic-box/magic-box.js +7 -9
- package/es/esf/components/magic-box/services/api.d.ts.map +1 -1
- package/es/esf/components/magic-box/services/api.js +1 -0
- package/es/esf/components/period-picker/period-picker.d.ts.map +1 -1
- package/es/esf/components/period-picker/period-picker.js +1 -1
- package/es/esf/components/period-picker/weeks.module.css +8 -5
- package/es/esf/hooks/use-booking-links.d.ts.map +1 -1
- package/es/esf/hooks/use-booking-links.js +11 -7
- package/es/esf/hooks/use-gesco-referral.d.ts +2 -0
- package/es/esf/hooks/use-gesco-referral.d.ts.map +1 -0
- package/es/esf/hooks/use-gesco-referral.js +18 -0
- package/es/future/components/event-analytics/instant-search.d.ts +10 -0
- package/es/future/components/event-analytics/instant-search.d.ts.map +1 -0
- package/es/future/components/event-analytics/instant-search.js +41 -0
- package/es/future/components/msem/index.d.ts +2 -1
- package/es/future/components/msem/index.d.ts.map +1 -1
- package/es/future/components/msem/index.js +2 -1
- package/es/future/components/msem/tunnel-new.d.ts +32 -0
- package/es/future/components/msem/tunnel-new.d.ts.map +1 -0
- package/es/future/components/msem/tunnel-new.js +27 -0
- package/es/future/components/msem/tunnel.d.ts +1 -1
- package/es/future/components/msem/tunnel.d.ts.map +1 -1
- package/es/future/components/msem/tunnel.js +8 -0
- package/es/future/components/msem/types.d.ts +1 -0
- package/es/future/components/msem/types.d.ts.map +1 -1
- package/es/future/components/msem/utils.d.ts +1 -1
- package/es/future/components/msem/utils.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/components/widget-list-item.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/components/widget-list-item.js +1 -2
- package/es/future/components/msem-preset-editor/editors/lodgings.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/editors/lodgings.js +48 -48
- package/es/future/components/msem-preset-editor/editors/lodgings.module.css +24 -0
- package/es/future/components/msem-preset-editor/editors/ski-passes.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/editors/ski-passes.js +23 -24
- package/es/future/components/msem-preset-editor/editors/ski-rental.d.ts +1 -1
- package/es/future/components/msem-preset-editor/editors/ski-rental.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/editors/ski-rental.js +161 -17
- package/es/future/components/msem-preset-editor/msem-preset-editor.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/msem-preset-editor.js +3 -1
- package/es/future/components/msem-preset-editor/services/api.d.ts +2 -0
- package/es/future/components/msem-preset-editor/services/api.d.ts.map +1 -1
- package/es/future/components/msem-preset-editor/services/api.js +8 -0
- package/es/future/components/plausible/services/callback.d.ts +2 -1
- package/es/future/components/plausible/services/callback.d.ts.map +1 -1
- package/es/future/components/plausible/services/callback.js +102 -6
- package/es/lbm/components/instant-search/faqs.d.ts +1 -1
- package/es/lbm/components/instant-search/faqs.d.ts.map +1 -1
- package/es/lbm/components/instant-search/faqs.js +1 -1
- package/es/lbm/components/instant-search/google-results.d.ts +1 -1
- package/es/lbm/components/instant-search/google-results.d.ts.map +1 -1
- package/es/lbm/components/instant-search/links.d.ts +1 -1
- package/es/lbm/components/instant-search/links.d.ts.map +1 -1
- package/es/lbm/components/instant-search/links.js +1 -1
- package/es/lbm/components/instant-search/products.d.ts +1 -1
- package/es/lbm/components/instant-search/products.d.ts.map +1 -1
- package/es/lbm/components/instant-search/products.js +1 -1
- package/es/lbm/components/instant-search/results.d.ts +1 -1
- package/es/lbm/components/instant-search/results.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/access.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/access.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/activity.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/activity.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/components/card.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/components/card.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/components/card.js +1 -1
- package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/lift.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/lift.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/lifts.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/lifts.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/msem-widget.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/msem-widget.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/openings.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/openings.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/slope.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/slope.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/slopes.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/slopes.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/snow.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/snow.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/weather.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/weather.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets/webcam.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets/webcam.d.ts.map +1 -1
- package/es/lbm/components/instant-search/widgets.d.ts +1 -1
- package/es/lbm/components/instant-search/widgets.d.ts.map +1 -1
- package/es/lbm/components/lumiplan/pois.d.ts.map +1 -1
- package/es/lbm/components/lumiplan/pois.js +6 -2
- package/es/market-place/components/instant-search/google-results.d.ts +1 -1
- package/es/market-place/components/instant-search/google-results.d.ts.map +1 -1
- package/es/market-place/components/instant-search/links.d.ts +1 -1
- package/es/market-place/components/instant-search/links.d.ts.map +1 -1
- package/es/market-place/components/instant-search/links.js +1 -1
- package/es/market-place/components/instant-search/products.d.ts +1 -1
- package/es/market-place/components/instant-search/products.d.ts.map +1 -1
- package/es/market-place/components/instant-search/products.js +1 -1
- package/es/market-place/components/instant-search/results.d.ts +1 -1
- package/es/market-place/components/instant-search/results.d.ts.map +1 -1
- package/package.json +2 -2
- package/es/common/utils/file-manager.d.ts +0 -8
- package/es/common/utils/file-manager.d.ts.map +0 -1
- package/es/common/utils/file-manager.js +0 -12
|
@@ -140,6 +140,7 @@ function checkEllohaGroup(override, ellohaGroups) {
|
|
|
140
140
|
return true;
|
|
141
141
|
return ellohaGroups.includes(ellohaGroup);
|
|
142
142
|
}
|
|
143
|
+
const ESF_OFFERS_KEYS = ["kinds", "activities", "levels", "meetings"];
|
|
143
144
|
function checkEsfProduct(override, esfOffersContent, forcedEsfOverride) {
|
|
144
145
|
if (!esfOffersContent)
|
|
145
146
|
return false;
|
|
@@ -150,11 +151,11 @@ function checkEsfProduct(override, esfOffersContent, forcedEsfOverride) {
|
|
|
150
151
|
if (!rules)
|
|
151
152
|
return true;
|
|
152
153
|
return esfOffersContent.some((content) => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
return ESF_OFFERS_KEYS.every((key) => {
|
|
155
|
+
return (rules?.[key] === "" ||
|
|
156
|
+
content[key]?.some((value) => {
|
|
157
|
+
return rules[key]?.includes(value);
|
|
158
|
+
}));
|
|
158
159
|
});
|
|
159
160
|
});
|
|
160
161
|
}
|
|
@@ -18,8 +18,8 @@ export default function Attachment({ lang, name, label, settings, data, setData,
|
|
|
18
18
|
if (!authorizedSelectionFormats) {
|
|
19
19
|
return { error: Messages.get(lang, "attachmentFormatError") };
|
|
20
20
|
}
|
|
21
|
-
const authorizedSelectionFileNumber = files.length
|
|
22
|
-
if (!authorizedSelectionFileNumber) {
|
|
21
|
+
const authorizedSelectionFileNumber = files.length <= attachmentMaxFiles - items.length;
|
|
22
|
+
if (files.length > 0 && !authorizedSelectionFileNumber) {
|
|
23
23
|
return { error: Messages.get(lang, "attachmentNumberError") };
|
|
24
24
|
}
|
|
25
25
|
const maxSizeinOctet = attachmentMaxSize * 1000000;
|
|
@@ -20,6 +20,7 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
20
20
|
const [sending, setSending] = React.useState(false);
|
|
21
21
|
const [ready, setReady] = React.useState(false);
|
|
22
22
|
const [settings, setSettings] = React.useState();
|
|
23
|
+
const [formKey, setFormKey] = React.useState(0);
|
|
23
24
|
const { lang, config } = useUbloContext();
|
|
24
25
|
const { site: ubloSite } = config;
|
|
25
26
|
const target = site || ubloSite;
|
|
@@ -42,7 +43,6 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
42
43
|
else {
|
|
43
44
|
snackbar.show({ type: "success", message: Messages.get(lang, "sent") });
|
|
44
45
|
Plausible.sendGoal("Contact-us (other requests)");
|
|
45
|
-
setData((currentData) => getInitialFormState(fields, undefined, currentData.subject?.value));
|
|
46
46
|
resetForm();
|
|
47
47
|
}
|
|
48
48
|
setSending(false);
|
|
@@ -51,6 +51,9 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
51
51
|
const resetForm = () => {
|
|
52
52
|
presets?.setter?.(undefined);
|
|
53
53
|
setData((currentData) => getInitialFormState(fields, undefined, currentData.subject?.value));
|
|
54
|
+
setReady(false);
|
|
55
|
+
setFormKey((prevKey) => prevKey + 1);
|
|
56
|
+
setReady(true);
|
|
54
57
|
};
|
|
55
58
|
const blurForm = () => {
|
|
56
59
|
const activeElement = document.activeElement;
|
|
@@ -86,6 +89,8 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
86
89
|
if (ready && !settings) {
|
|
87
90
|
return (_jsx("div", { className: css.root, children: Messages.get(lang, "NO_SETTINGS_FOUND") }));
|
|
88
91
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
92
|
+
const fullFormKey = presets
|
|
93
|
+
? `${formKey}${JSON.stringify(presets.values)}`
|
|
94
|
+
: formKey;
|
|
95
|
+
return (_jsxs("div", { className: classes, children: [title && _jsx("div", { className: css.title, children: title }), _jsx("div", { className: innerClasses, children: Object.keys(fields).map((key) => (_jsx(Field, { target: target, kind: kind, name: key, field: fields[key], data: data, setData: setData, settings: settings, presets: presets }, key))) }), _jsxs("div", { className: css.bottom, children: [presets?.allowReset && (_jsx(Button, { className: css.resetButton, disabled: sending, onClick: resetForm, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: css.submitButton, disabled: !isFormValid || sending, onClick: sendForm, onPointerEnter: blurForm, children: [sendButtonText || Messages.get(lang, "send"), _jsx(MailIcon, {})] })] }), showSendingOverlay && (_jsxs("div", { className: css.sendingOverlay, children: [_jsx(Icons.Spinner, { className: css.sendingIcon }), _jsx("span", { className: css.sendingMessage, children: Messages.get(lang, "sending") })] }))] }, fullFormKey));
|
|
91
96
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export default function Calendar({ display, stayDates, min, max, onSubmit, availabilities, close, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }: {
|
|
1
|
+
export default function Calendar({ display, lang, stayDates, min, max, onSubmit, availabilities, close, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }: {
|
|
2
2
|
display: any;
|
|
3
|
+
lang: any;
|
|
3
4
|
stayDates?: any[];
|
|
4
5
|
min: any;
|
|
5
6
|
max: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/calendar.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/calendar.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;4CAyQC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import { useUbloContext } from "ublo/with-ublo";
|
|
5
4
|
import Dialog from "dt-design-system/es/dialog";
|
|
6
5
|
import Button from "dt-design-system/es/button";
|
|
7
6
|
import ChevronLeftIcon from "dt-design-system/es/icons/chevron-left";
|
|
@@ -13,9 +12,8 @@ import * as Messages from "./messages";
|
|
|
13
12
|
import * as Data from "./data";
|
|
14
13
|
import * as Utils from "./utils";
|
|
15
14
|
import styles from "./calendar.module.css";
|
|
16
|
-
export default function Calendar({ display, stayDates = [], min, max, onSubmit, availabilities, close, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }) {
|
|
15
|
+
export default function Calendar({ display, lang, stayDates = [], min, max, onSubmit, availabilities, close, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }) {
|
|
17
16
|
const date = min ? Utils.createGMTDate(min) : Utils.createGMTDate();
|
|
18
|
-
const { lang } = useUbloContext();
|
|
19
17
|
const [selectedDates, setSelectedDates] = React.useState(stayDates);
|
|
20
18
|
const firstRangeDate = selectedDates[0];
|
|
21
19
|
const selectedMonth = firstRangeDate
|
|
@@ -119,7 +117,7 @@ export default function Calendar({ display, stayDates = [], min, max, onSubmit,
|
|
|
119
117
|
[styles.calendarTouch]: hide2ndMonth,
|
|
120
118
|
[styles.calendarLoading]: isLoading,
|
|
121
119
|
});
|
|
122
|
-
return (_jsxs("div", { className: classes, "data-calendar": "", children: [!singleDate && (_jsx(Helper, { lang: lang, selecting: selecting, selectedDates: selectedDates, availabilities: availabilities, isLoading: isLoading, error: error })), _jsxs("div", { className: styles.months, children: [_jsxs("div", { className: styles.controls, "data-controls": "", children: [_jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoPreviousMonth, disabled: isPast, children: _jsx(ChevronLeftIcon, {}) }), _jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoNextMonth, children: _jsx(ChevronRightIcon, {}) })] }), _jsx(Month, { display: display, month: month, year: year, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }), !hide2ndMonth && (_jsx(Month, { display: display, month: monthAlt, year: yearAlt, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }))] }), _jsxs("div", { className: styles.buttons, children: [_jsx(Button, { variant: "transparent", className: styles.close, onClick: close, children: Messages.get(lang, "close") }), showReset && (_jsx(Button, { variant: "link", className: styles.reset, onClick: reset, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: styles.submit, onClick: () => submit(selectedDates), disabled: !submitEnabled, children: [_jsx(CheckIcon, {}), Messages.get(lang, "submit")] })] }), _jsxs(Dialog, { isOpened: showPopup, className: styles.confirmDateChange, close: () => setShowPopup(false), children: [_jsx("div", { className: styles.confirmDateChangeTitle, children: Messages.get(lang, "warning-date-change-title") }), _jsx("div", { className: styles.confirmDateChangeMessage, children: Messages.get(lang, "warning-date-change-text") }), _jsxs("div", { className: styles.confirmDateChangeButtons, children: [_jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonCancel), onClick: () => setShowPopup(false), children: Messages.get(lang, "warning-date-change-cancel") }), _jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonConfirm), onClick: () => {
|
|
120
|
+
return (_jsxs("div", { className: classes, "data-calendar": "", children: [!singleDate && (_jsx(Helper, { lang: lang, selecting: selecting, selectedDates: selectedDates, availabilities: availabilities, isLoading: isLoading, error: error })), _jsxs("div", { className: styles.months, children: [_jsxs("div", { className: styles.controls, "data-controls": "", children: [_jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoPreviousMonth, disabled: isPast, children: _jsx(ChevronLeftIcon, {}) }), _jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoNextMonth, children: _jsx(ChevronRightIcon, {}) })] }), _jsx(Month, { display: display, lang: lang, month: month, year: year, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }), !hide2ndMonth && (_jsx(Month, { lang: lang, display: display, month: monthAlt, year: yearAlt, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }))] }), _jsxs("div", { className: styles.buttons, children: [_jsx(Button, { variant: "transparent", className: styles.close, onClick: close, children: Messages.get(lang, "close") }), showReset && (_jsx(Button, { variant: "link", className: styles.reset, onClick: reset, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: styles.submit, onClick: () => submit(selectedDates), disabled: !submitEnabled, children: [_jsx(CheckIcon, {}), Messages.get(lang, "submit")] })] }), _jsxs(Dialog, { isOpened: showPopup, className: styles.confirmDateChange, close: () => setShowPopup(false), children: [_jsx("div", { className: styles.confirmDateChangeTitle, children: Messages.get(lang, "warning-date-change-title") }), _jsx("div", { className: styles.confirmDateChangeMessage, children: Messages.get(lang, "warning-date-change-text") }), _jsxs("div", { className: styles.confirmDateChangeButtons, children: [_jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonCancel), onClick: () => setShowPopup(false), children: Messages.get(lang, "warning-date-change-cancel") }), _jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonConfirm), onClick: () => {
|
|
123
121
|
window.sessionStorage.removeItem("cartId");
|
|
124
122
|
submit(selectedDates);
|
|
125
123
|
setShowPopup(false);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-lang.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/context-lang.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IAEX,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,OAQrD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export default function DateItem({ date, index, month, year, min, max, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, selecting, setSelecting, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }: {
|
|
1
|
+
export default function DateItem({ date, lang, index, month, year, min, max, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, selecting, setSelecting, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }: {
|
|
2
2
|
date: any;
|
|
3
|
+
lang: any;
|
|
3
4
|
index: any;
|
|
4
5
|
month: any;
|
|
5
6
|
year: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-item.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/date-item.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-item.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/date-item.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;4CAwLC"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import { useUbloContext } from "ublo/with-ublo";
|
|
5
4
|
import Popover from "dt-design-system/es/popover";
|
|
6
5
|
import Button from "dt-design-system/es/button";
|
|
7
6
|
import * as Utils from "./utils";
|
|
8
7
|
import * as Messages from "./messages";
|
|
9
8
|
import styles from "./date-item.module.css";
|
|
10
|
-
export default function DateItem({ date, index, month, year, min, max, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, selecting, setSelecting, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }) {
|
|
11
|
-
const { lang } = useUbloContext();
|
|
9
|
+
export default function DateItem({ date, lang, index, month, year, min, max, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, selecting, setSelecting, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }) {
|
|
12
10
|
const today = Utils.createGMTDate();
|
|
13
11
|
const _date = React.useMemo(() => Utils.createGMTDate(date), [date]);
|
|
14
12
|
_date.setHours(0, 0, 0, 0);
|
|
@@ -3,6 +3,7 @@ import * as Utils from "./utils";
|
|
|
3
3
|
export { Data, Utils };
|
|
4
4
|
type Props = {
|
|
5
5
|
stayDates?: Date[];
|
|
6
|
+
lang?: string;
|
|
6
7
|
onSubmit: (dates: Date[]) => void;
|
|
7
8
|
close: () => void;
|
|
8
9
|
min?: string;
|
|
@@ -14,5 +15,5 @@ type Props = {
|
|
|
14
15
|
disableConfirmModal?: boolean;
|
|
15
16
|
defaultSelecting?: boolean;
|
|
16
17
|
};
|
|
17
|
-
export default function DatePicker({ stayDates, onSubmit, close, min, max, availabilities, popup, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default function DatePicker({ stayDates, lang: langProps, onSubmit, close, min, max, availabilities, popup, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/date-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAKjC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAEvB,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,SAAc,EACd,IAAI,EAAE,SAAS,EACf,QAAQ,EACR,KAAK,EACL,GAAG,EACH,GAAG,EACH,cAAc,EACd,KAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,EAAE,KAAK,2CA4CP"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
+
import dynamic from "next/dynamic";
|
|
4
5
|
import useWindowSizes from "../../hooks/use-window-sizes";
|
|
5
6
|
import Calendar from "./calendar";
|
|
6
7
|
import * as Data from "./data";
|
|
7
8
|
import * as Utils from "./utils";
|
|
8
9
|
import styles from "./date-picker.module.css";
|
|
10
|
+
const ContextLang = dynamic(() => import("./context-lang"), { ssr: false });
|
|
9
11
|
export { Data, Utils };
|
|
10
|
-
export default function DatePicker({ stayDates = [], onSubmit, close, min, max, availabilities, popup = true, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }) {
|
|
12
|
+
export default function DatePicker({ stayDates = [], lang: langProps, onSubmit, close, min, max, availabilities, popup = true, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }) {
|
|
11
13
|
const [display, setDisplay] = React.useState();
|
|
14
|
+
const [lang, setLang] = React.useState(langProps);
|
|
12
15
|
const { width: windowWidth } = useWindowSizes();
|
|
13
16
|
React.useEffect(() => {
|
|
14
17
|
if (windowWidth <= Data.BREAKPOINTS.PHONE) {
|
|
@@ -26,5 +29,5 @@ export default function DatePicker({ stayDates = [], onSubmit, close, min, max,
|
|
|
26
29
|
const classes = classNames(styles.datePicker, {
|
|
27
30
|
[styles.datePickerPopup]: popup,
|
|
28
31
|
});
|
|
29
|
-
return (_jsxs(_Fragment, { children: [popup && _jsx("div", { className: styles.backdrop, onClick: close }),
|
|
32
|
+
return (_jsxs(_Fragment, { children: [popup && _jsx("div", { className: styles.backdrop, onClick: close }), _jsxs("div", { className: classes, children: [_jsx(Calendar, { display: display, stayDates: stayDates, min: min, max: max, onSubmit: onSubmit, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, availabilities: availabilities, disableConfirmModal: disableConfirmModal, close: close, defaultSelecting: defaultSelecting, lang: lang }), !lang && _jsx(ContextLang, { setLang: setLang })] })] }));
|
|
30
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export default function Month({ display, month, year, min, max, selecting, setSelecting, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }: {
|
|
1
|
+
export default function Month({ display, lang, month, year, min, max, selecting, setSelecting, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }: {
|
|
2
2
|
display: any;
|
|
3
|
+
lang: any;
|
|
3
4
|
month: any;
|
|
4
5
|
year: any;
|
|
5
6
|
min: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"month.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/month.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"month.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/month.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;4CAyEC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useUbloContext } from "ublo/with-ublo";
|
|
4
3
|
import DateItem from "./date-item";
|
|
5
4
|
import * as Data from "./data";
|
|
6
5
|
import styles from "./month.module.css";
|
|
7
|
-
export default function Month({ display, month, year, min, max, selecting, setSelecting, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }) {
|
|
8
|
-
const { lang } = useUbloContext();
|
|
6
|
+
export default function Month({ display, lang, month, year, min, max, selecting, setSelecting, selectedDates, setSelectedDates, setFirstSelectedDate, setLastSelectedDate, singleDate, submitOnSelectionEnd, onSubmit, stays, matchingStays, allMatchingStaysEnd, }) {
|
|
9
7
|
const i18nMonths = Data.MONTHS[lang] || Data.MONTHS.en;
|
|
10
8
|
const monthName = i18nMonths[Object.keys(i18nMonths)[month - 1]];
|
|
11
9
|
const i18nWeekDays = Data.WEEK_DAYS[lang] || Data.WEEK_DAYS.en;
|
|
@@ -16,6 +14,6 @@ export default function Month({ display, month, year, min, max, selecting, setSe
|
|
|
16
14
|
return (_jsxs("div", { className: styles.month, "data-month": "", children: [_jsxs("div", { className: styles.title, children: [monthName, " ", year] }), _jsx("div", { className: styles.days, "data-days": "", children: days.map((day) => {
|
|
17
15
|
return (_jsx("div", { className: styles.day, children: i18nWeekDays[day] }, day));
|
|
18
16
|
}) }), _jsx("div", { className: styles.dates, children: calendarDates.map((date, i) => {
|
|
19
|
-
return (_jsx(DateItem, { index: i, display: display, date: date, month: month, year: year, min: min, max: max, selectedDates: selectedDates, setSelectedDates: setSelectedDates, setFirstSelectedDate: setFirstSelectedDate, setLastSelectedDate: setLastSelectedDate, selecting: selecting, setSelecting: setSelecting, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: onSubmit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }, i));
|
|
17
|
+
return (_jsx(DateItem, { index: i, display: display, lang: lang, date: date, month: month, year: year, min: min, max: max, selectedDates: selectedDates, setSelectedDates: setSelectedDates, setFirstSelectedDate: setFirstSelectedDate, setLastSelectedDate: setLastSelectedDate, selecting: selecting, setSelecting: setSelecting, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: onSubmit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }, i));
|
|
20
18
|
}) })] }));
|
|
21
19
|
}
|
|
@@ -20,7 +20,7 @@ const fr = {
|
|
|
20
20
|
defaultCountry: "Indiquez votre pays...",
|
|
21
21
|
defaultCategory: "Sélectionnez...",
|
|
22
22
|
defaultSubject: "Sélectionnez...",
|
|
23
|
-
sendSucesss: "Votre message
|
|
23
|
+
sendSucesss: "Votre message a bien été envoyé !",
|
|
24
24
|
sendError: "Une erreur est survenue pendant l'envoi du message. Veuillez réessayer ultérieurement.",
|
|
25
25
|
parametersError: "Une erreur est survenue pendant la génération du formulaire. Veuillez réessayer ultérieurement.",
|
|
26
26
|
emailError: 'L\'email doit être au format "john.doe@domaine.com"',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/infinite-carousel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAEnD,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type CarouselVariant = "wheel" | "scale";
|
|
3
|
+
type Props = {
|
|
4
|
+
className?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
variant?: CarouselVariant;
|
|
7
|
+
cloneNumber?: number;
|
|
8
|
+
options: {
|
|
9
|
+
hide_wheel_items?: boolean;
|
|
10
|
+
wheel_items_gap?: number;
|
|
11
|
+
scale_items_gap?: number;
|
|
12
|
+
scale_number?: number;
|
|
13
|
+
rotate_number?: number;
|
|
14
|
+
translateY_number?: number;
|
|
15
|
+
transition_duration?: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default function InfiniteCarousel({ className, children, variant, options, cloneNumber, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=infinite-carousel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infinite-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/infinite-carousel/infinite-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,KAAK,eAAe,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzC,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE;QACP,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EACT,QAAQ,EACR,OAAiB,EACjB,OAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CAoSP"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { useUbloContext } from "ublo/with-ublo";
|
|
5
|
+
import Button from "dt-design-system/es/button";
|
|
6
|
+
import ChevronLeftIcon from "dt-design-system/es/icons/chevron-left";
|
|
7
|
+
import ChevronRightIcon from "dt-design-system/es/icons/chevron-right";
|
|
8
|
+
import ScrollbarSize from "../scrollbar-size";
|
|
9
|
+
import css from "./infinite-carousel.module.css";
|
|
10
|
+
export default function InfiniteCarousel({ className, children, variant = "wheel", options = {}, cloneNumber, }) {
|
|
11
|
+
const { cmsMode } = useUbloContext();
|
|
12
|
+
const zoneRef = React.useRef(null);
|
|
13
|
+
const itemWidth = React.useRef(null);
|
|
14
|
+
const itemHeight = React.useRef(null);
|
|
15
|
+
const [items, setItems] = React.useState([]);
|
|
16
|
+
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
17
|
+
const [isTransitioning, setIsTransitioning] = React.useState(false);
|
|
18
|
+
const isEditing = cmsMode === "editing";
|
|
19
|
+
const { wheel_items_gap = 100, scale_items_gap = 10, hide_wheel_items = false, scale_number = 0.75, rotate_number = 25, translateY_number = 80, transition_duration = 500, } = options;
|
|
20
|
+
const cloneCount = React.useMemo(() => {
|
|
21
|
+
if (cloneNumber !== undefined)
|
|
22
|
+
return cloneNumber;
|
|
23
|
+
return variant === "scale" ? 6 : 3;
|
|
24
|
+
}, [variant, cloneNumber]);
|
|
25
|
+
const extractItems = React.useCallback(() => {
|
|
26
|
+
if (!zoneRef.current)
|
|
27
|
+
return [];
|
|
28
|
+
const zone = zoneRef.current;
|
|
29
|
+
const sections = Array.from(zone.querySelectorAll("section:not([data-hidden], [hidden], [style*='display: none'])"));
|
|
30
|
+
return sections;
|
|
31
|
+
}, []);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (isEditing)
|
|
34
|
+
return;
|
|
35
|
+
const foundItems = extractItems();
|
|
36
|
+
if (foundItems.length > 0) {
|
|
37
|
+
setItems(foundItems);
|
|
38
|
+
setCurrentIndex(cloneCount);
|
|
39
|
+
if (!itemWidth.current && !itemHeight.current) {
|
|
40
|
+
itemWidth.current = foundItems[0].offsetWidth;
|
|
41
|
+
itemHeight.current = foundItems[0].offsetHeight;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [extractItems, isEditing, cloneCount]);
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (!zoneRef.current || isEditing)
|
|
47
|
+
return;
|
|
48
|
+
const observer = new MutationObserver(() => {
|
|
49
|
+
const foundItems = extractItems();
|
|
50
|
+
if (foundItems.length > 0 && items.length === 0) {
|
|
51
|
+
setItems(foundItems);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
observer.observe(zoneRef.current, {
|
|
55
|
+
attributes: true,
|
|
56
|
+
childList: true,
|
|
57
|
+
subtree: true,
|
|
58
|
+
});
|
|
59
|
+
return () => observer.disconnect();
|
|
60
|
+
}, [extractItems, items, isEditing]);
|
|
61
|
+
const infiniteItems = React.useMemo(() => {
|
|
62
|
+
if (items.length === 0)
|
|
63
|
+
return [];
|
|
64
|
+
const createClone = (element) => {
|
|
65
|
+
const clone = element.cloneNode(true);
|
|
66
|
+
clone.setAttribute("aria-hidden", "true");
|
|
67
|
+
clone.removeAttribute("id");
|
|
68
|
+
clone.querySelectorAll("[id]").forEach((el) => {
|
|
69
|
+
el.removeAttribute("id");
|
|
70
|
+
});
|
|
71
|
+
return clone;
|
|
72
|
+
};
|
|
73
|
+
const beforeClones = [];
|
|
74
|
+
const afterClones = [];
|
|
75
|
+
for (let i = 0; i < cloneCount; i++) {
|
|
76
|
+
const itemIndex = (items.length - cloneCount + i + items.length) % items.length;
|
|
77
|
+
beforeClones.push(createClone(items[itemIndex]));
|
|
78
|
+
}
|
|
79
|
+
for (let i = 0; i < cloneCount; i++) {
|
|
80
|
+
const itemIndex = i % items.length;
|
|
81
|
+
afterClones.push(createClone(items[itemIndex]));
|
|
82
|
+
}
|
|
83
|
+
return [...beforeClones, ...items, ...afterClones];
|
|
84
|
+
}, [items, cloneCount]);
|
|
85
|
+
const slideTo = (direction) => {
|
|
86
|
+
if (isTransitioning || items.length === 0)
|
|
87
|
+
return;
|
|
88
|
+
setIsTransitioning(true);
|
|
89
|
+
setCurrentIndex((prev) => {
|
|
90
|
+
if (direction === "next") {
|
|
91
|
+
return prev + 1;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return prev - 1;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (!isTransitioning)
|
|
100
|
+
return;
|
|
101
|
+
const timer = setTimeout(() => {
|
|
102
|
+
setIsTransitioning(false);
|
|
103
|
+
if (currentIndex === items.length + cloneCount) {
|
|
104
|
+
setCurrentIndex(cloneCount);
|
|
105
|
+
}
|
|
106
|
+
else if (currentIndex < cloneCount) {
|
|
107
|
+
setCurrentIndex(items.length + cloneCount - 1);
|
|
108
|
+
}
|
|
109
|
+
}, transition_duration);
|
|
110
|
+
return () => clearTimeout(timer);
|
|
111
|
+
}, [
|
|
112
|
+
isTransitioning,
|
|
113
|
+
currentIndex,
|
|
114
|
+
items.length,
|
|
115
|
+
cloneCount,
|
|
116
|
+
transition_duration,
|
|
117
|
+
]);
|
|
118
|
+
const getItemStyle = (index) => {
|
|
119
|
+
const offset = index - currentIndex;
|
|
120
|
+
const absOffset = Math.abs(offset);
|
|
121
|
+
const width = itemWidth.current;
|
|
122
|
+
if (variant === "wheel") {
|
|
123
|
+
let rotate = 0;
|
|
124
|
+
let translateX = 0;
|
|
125
|
+
let translateY = 0;
|
|
126
|
+
let opacity = 1;
|
|
127
|
+
const gap = wheel_items_gap;
|
|
128
|
+
if (offset === 0) {
|
|
129
|
+
translateX = 0;
|
|
130
|
+
translateY = 0;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
rotate = rotate_number * offset;
|
|
134
|
+
translateX = (width + gap) * offset;
|
|
135
|
+
translateY = translateY_number * (absOffset * absOffset);
|
|
136
|
+
const condition = hide_wheel_items ? absOffset >= 2 : absOffset >= 3;
|
|
137
|
+
if (condition) {
|
|
138
|
+
opacity = 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
transform: `translateX(${translateX}px) translateY(${translateY}px) rotate(${rotate}deg)`,
|
|
143
|
+
opacity,
|
|
144
|
+
transition: isTransitioning
|
|
145
|
+
? `all ${transition_duration}ms cubic-bezier(0.4, 0.0, 0.2, 1)`
|
|
146
|
+
: "none",
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
let scale = scale_number;
|
|
151
|
+
let opacity = 1;
|
|
152
|
+
let translateX = 0;
|
|
153
|
+
const gap = scale_items_gap;
|
|
154
|
+
if (offset === 0) {
|
|
155
|
+
translateX = 0;
|
|
156
|
+
scale = 1;
|
|
157
|
+
}
|
|
158
|
+
else if (absOffset === 1) {
|
|
159
|
+
translateX = offset * (width + gap - (width - width * scale) / 2);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const sign = offset > 0 ? 1 : -1;
|
|
163
|
+
translateX = sign * (width + gap - (width - width * scale) / 2);
|
|
164
|
+
for (let i = 2; i <= absOffset; i++) {
|
|
165
|
+
translateX += sign * (width * scale + gap);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
transform: `translateX(${translateX}px) scale(${scale})`,
|
|
170
|
+
opacity,
|
|
171
|
+
transition: isTransitioning
|
|
172
|
+
? `all ${transition_duration}ms cubic-bezier(0.4, 0.0, 0.2, 1)`
|
|
173
|
+
: "none",
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const classes = classNames(css.carousel, css[`carousel--${variant}`], className);
|
|
178
|
+
return (_jsxs(_Fragment, { children: [React.cloneElement(children, {
|
|
179
|
+
ref: zoneRef,
|
|
180
|
+
style: isEditing
|
|
181
|
+
? {}
|
|
182
|
+
: {
|
|
183
|
+
position: "absolute",
|
|
184
|
+
opacity: 0,
|
|
185
|
+
visibility: "hidden",
|
|
186
|
+
pointerEvents: "none",
|
|
187
|
+
overflow: "hidden",
|
|
188
|
+
},
|
|
189
|
+
}), !isEditing && items.length >= 3 && (_jsx(_Fragment, { children: _jsxs("div", { className: classes, style: {
|
|
190
|
+
"--carousel-item-width": `${itemWidth.current}px`,
|
|
191
|
+
"--carousel-item-height": `${itemHeight.current}px`,
|
|
192
|
+
}, children: [_jsxs("div", { className: css.controls, children: [_jsx(Button, { className: css.control, variant: "link", onClick: () => slideTo("prev"), "data-control": "prev", children: _jsx(ChevronLeftIcon, { className: css.controlIcon }) }), _jsx(Button, { className: css.control, variant: "link", onClick: () => slideTo("next"), "data-control": "next", children: _jsx(ChevronRightIcon, { className: css.controlIcon }) })] }), _jsx("div", { className: css.viewport, children: _jsx("div", { className: css.track, children: infiniteItems.map((item, index) => {
|
|
193
|
+
const current = index === currentIndex;
|
|
194
|
+
return (_jsx("div", { "data-current-item": current, className: css.item, style: getItemStyle(index), dangerouslySetInnerHTML: { __html: item.outerHTML } }, `item-${index}`));
|
|
195
|
+
}) }) })] }) })), _jsx(ScrollbarSize, {})] }));
|
|
196
|
+
}
|