@licklist/design 0.53.0-dev.3 → 0.53.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/dist/auth/Login/LoginComponent.d.ts.map +1 -1
- package/dist/auth/Login/LoginComponent.js +1 -1
- package/dist/calendar/Calendar.d.ts +8 -3
- package/dist/calendar/Calendar.d.ts.map +1 -1
- package/dist/calendar/Calendar.js +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts +2 -2
- package/dist/calendar/components/CalendarButtons/CalendarButtons.d.ts.map +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +2 -2
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/calendar/utils/index.d.ts +2 -0
- package/dist/calendar/utils/index.d.ts.map +1 -1
- package/dist/calendar/utils/index.js +1 -1
- package/dist/date-time-button/DateTimeButton.d.ts +3 -3
- package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/events/event-venue-map/components/Scrollbars/Scrollbars.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +1 -2
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +1 -2
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -2
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -1
- package/dist/index.js +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts +1 -2
- package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.js +1 -1
- package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/static/date-range-input/DateRangeInput.d.ts.map +1 -1
- package/dist/static/date-range-input/DateRangeInput.js +1 -1
- package/dist/styles/resources-blocking/_index.scss +0 -6
- package/dist/styles/sales/BookingFilter.scss +2 -24
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/styles/sales/BookingTabs.scss +5 -63
- package/dist/styles/sales/LifeTimeSales.scss +0 -1
- package/dist/styles/sales/ManualBooking.scss +3 -62
- package/dist/styles/sales/SourceOfSales.scss +0 -3
- package/dist/styles/snippet-templates/SnippetTemplate.scss +11 -17
- package/dist/styles/snippet-templates/SnippetTemplateCard.scss +2 -3
- package/dist/styles/static/Tabs.scss +0 -6
- package/dist/styles/themes/bookedit/_index.scss +8 -9
- package/dist/styles/themes/bookedit/_variables.scss +0 -2
- package/package.json +3 -3
- package/src/auth/Login/LoginComponent.tsx +1 -9
- package/src/calendar/Calendar.tsx +16 -9
- package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +5 -8
- package/src/calendar/components/CalendarDates/CalendarDates.tsx +13 -12
- package/src/calendar/utils/index.ts +19 -0
- package/src/date-time-button/DateTimeButton.tsx +3 -3
- package/src/events/edit-event-modal/IntervalInput.tsx +80 -8
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +0 -2
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +6 -12
- package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +0 -3
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -1
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +4 -2
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +23 -13
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +3 -10
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +3 -9
- package/src/notification/email-template/control/EmailTemplateControl.tsx +15 -5
- package/src/sales/booking/results/components/ResultCard.tsx +4 -6
- package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +1 -9
- package/src/snippet/snippet-template/preview/Preview.tsx +0 -3
- package/src/static/date-range-input/DateRangeInput.tsx +2 -23
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/resources-blocking/_index.scss +0 -6
- package/src/styles/sales/BookingFilter.scss +2 -24
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/styles/sales/BookingTabs.scss +5 -63
- package/src/styles/sales/LifeTimeSales.scss +0 -1
- package/src/styles/sales/ManualBooking.scss +3 -62
- package/src/styles/sales/SourceOfSales.scss +0 -3
- package/src/styles/snippet-templates/SnippetTemplate.scss +11 -17
- package/src/styles/snippet-templates/SnippetTemplateCard.scss +2 -3
- package/src/styles/static/Tabs.scss +0 -6
- package/src/styles/themes/bookedit/_index.scss +8 -9
- package/src/styles/themes/bookedit/_variables.scss +0 -2
- package/dist/events/edit-event-modal/hooks/index.d.ts +0 -3
- package/dist/events/edit-event-modal/hooks/index.d.ts.map +0 -1
- package/dist/events/edit-event-modal/hooks/useFormattedDuration.d.ts +0 -2
- package/dist/events/edit-event-modal/hooks/useFormattedDuration.d.ts.map +0 -1
- package/dist/events/edit-event-modal/hooks/useFormattedDuration.js +0 -1
- package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts +0 -11
- package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts.map +0 -1
- package/dist/events/edit-event-modal/hooks/useValidationOptions.js +0 -1
- package/src/events/edit-event-modal/hooks/index.ts +0 -2
- package/src/events/edit-event-modal/hooks/useFormattedDuration.tsx +0 -40
- package/src/events/edit-event-modal/hooks/useValidationOptions.tsx +0 -36
|
@@ -59,8 +59,7 @@
|
|
|
59
59
|
color: $snippet-elements-button-color;
|
|
60
60
|
border: none;
|
|
61
61
|
background-color: $snippet-elements-button-background-color;
|
|
62
|
-
box-shadow: 0 0 0 $input-btn-focus-width
|
|
63
|
-
$snippet-elements-button-background-color;
|
|
62
|
+
box-shadow: 0 0 0 $input-btn-focus-width $snippet-elements-button-background-color;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
&:disabled {
|
|
@@ -73,14 +72,14 @@
|
|
|
73
72
|
&:focus,
|
|
74
73
|
&.focus {
|
|
75
74
|
&:not(:disabled) {
|
|
76
|
-
opacity:
|
|
75
|
+
opacity: .7;
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
&:active,
|
|
81
80
|
&.active {
|
|
82
81
|
&:not(:disabled) {
|
|
83
|
-
opacity:
|
|
82
|
+
opacity: .8;
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
&__label {
|
|
94
|
-
font-size:
|
|
93
|
+
font-size: .8rem;
|
|
95
94
|
margin-top: 1rem;
|
|
96
95
|
margin-bottom: 0.2rem;
|
|
97
96
|
}
|
|
@@ -104,8 +103,8 @@
|
|
|
104
103
|
position: absolute;
|
|
105
104
|
top: 0;
|
|
106
105
|
right: 0;
|
|
107
|
-
margin-right:
|
|
108
|
-
margin-top:
|
|
106
|
+
margin-right: .5rem;
|
|
107
|
+
margin-top: .5rem;
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
.form-label {
|
|
@@ -182,8 +181,7 @@
|
|
|
182
181
|
color: $snippet-elements-button-color;
|
|
183
182
|
border: none;
|
|
184
183
|
background-color: $snippet-elements-button-background-color;
|
|
185
|
-
box-shadow: 0 0 0 $input-btn-focus-width
|
|
186
|
-
$snippet-elements-button-background-color;
|
|
184
|
+
box-shadow: 0 0 0 $input-btn-focus-width $snippet-elements-button-background-color;
|
|
187
185
|
}
|
|
188
186
|
|
|
189
187
|
&:disabled {
|
|
@@ -196,14 +194,14 @@
|
|
|
196
194
|
&:focus,
|
|
197
195
|
&.focus {
|
|
198
196
|
&:not(:disabled) {
|
|
199
|
-
opacity:
|
|
197
|
+
opacity: .7;
|
|
200
198
|
}
|
|
201
199
|
}
|
|
202
200
|
|
|
203
201
|
&:active,
|
|
204
202
|
&.active {
|
|
205
203
|
&:not(:disabled) {
|
|
206
|
-
opacity:
|
|
204
|
+
opacity: .8;
|
|
207
205
|
}
|
|
208
206
|
}
|
|
209
207
|
}
|
|
@@ -338,8 +336,7 @@
|
|
|
338
336
|
}
|
|
339
337
|
}
|
|
340
338
|
|
|
341
|
-
.bottom-wrapper,
|
|
342
|
-
.snippet-template__form {
|
|
339
|
+
.bottom-wrapper, .snippet-template__form {
|
|
343
340
|
.btn {
|
|
344
341
|
border-radius: 0.25rem;
|
|
345
342
|
width: 100%;
|
|
@@ -384,10 +381,6 @@
|
|
|
384
381
|
}
|
|
385
382
|
}
|
|
386
383
|
|
|
387
|
-
.disabled-number-input-button {
|
|
388
|
-
background-color: $snippet-calendar-disabled-button-font-color !important;
|
|
389
|
-
border-color: $snippet-calendar-disabled-button-font-color !important;
|
|
390
|
-
}
|
|
391
384
|
.color-picker {
|
|
392
385
|
&__color {
|
|
393
386
|
position: absolute;
|
|
@@ -449,6 +442,7 @@
|
|
|
449
442
|
}
|
|
450
443
|
}
|
|
451
444
|
}
|
|
445
|
+
|
|
452
446
|
}
|
|
453
447
|
|
|
454
448
|
@include media-breakpoint-down(xs) {
|
|
@@ -28,13 +28,12 @@ $snippet-template-card-button-transition: $product-set-card-transition !default;
|
|
|
28
28
|
border: 1px solid #ccc;
|
|
29
29
|
border-radius: $border-radius;
|
|
30
30
|
height: 10rem;
|
|
31
|
-
|
|
31
|
+
width: 15rem;
|
|
32
32
|
padding: 1rem;
|
|
33
33
|
|
|
34
34
|
@include media-breakpoint-down(sm) {
|
|
35
35
|
height: 100%;
|
|
36
36
|
max-height: 10rem;
|
|
37
|
-
width: 100%;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
p {
|
|
@@ -110,4 +109,4 @@ $snippet-template-card-button-transition: $product-set-card-transition !default;
|
|
|
110
109
|
&:hover {
|
|
111
110
|
border: 2px solid $blue;
|
|
112
111
|
}
|
|
113
|
-
}
|
|
112
|
+
}
|
|
@@ -11,12 +11,6 @@ $tab-nav-link-active-border-bottom: 1px solid $tab-nav-link-active-color !defaul
|
|
|
11
11
|
margin-left: -1.25rem;
|
|
12
12
|
border-bottom: 1px solid $nav-tabs-border-color;
|
|
13
13
|
|
|
14
|
-
@include media-breakpoint-down(sm) {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
14
|
.nav-link {
|
|
21
15
|
color: $tab-nav-link-color;
|
|
22
16
|
background-color: transparent;
|
|
@@ -98,8 +98,7 @@
|
|
|
98
98
|
color: gray("600");
|
|
99
99
|
|
|
100
100
|
&.sortable {
|
|
101
|
-
&::before,
|
|
102
|
-
&::after {
|
|
101
|
+
&::before, &::after {
|
|
103
102
|
opacity: 1;
|
|
104
103
|
}
|
|
105
104
|
|
|
@@ -133,20 +132,20 @@
|
|
|
133
132
|
width: 2.5rem;
|
|
134
133
|
height: 2.5rem;
|
|
135
134
|
background-color: transparent;
|
|
136
|
-
|
|
135
|
+
|
|
137
136
|
svg {
|
|
138
137
|
margin-bottom: 2.5px;
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
&:hover {
|
|
142
141
|
cursor: pointer;
|
|
143
|
-
border-radius:
|
|
142
|
+
border-radius: .5rem;
|
|
144
143
|
background-color: lighten($primary, 40);
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
.page-item {
|
|
149
|
-
margin-left:
|
|
148
|
+
margin-left: .4rem;
|
|
150
149
|
min-width: 15px;
|
|
151
150
|
width: 2.5rem;
|
|
152
151
|
height: 2.5rem;
|
|
@@ -154,7 +153,7 @@
|
|
|
154
153
|
.page-link {
|
|
155
154
|
border: 0;
|
|
156
155
|
padding: 0;
|
|
157
|
-
border-radius:
|
|
156
|
+
border-radius: .5rem;
|
|
158
157
|
height: 100%;
|
|
159
158
|
display: flex;
|
|
160
159
|
align-items: center;
|
|
@@ -163,13 +162,13 @@
|
|
|
163
162
|
color: $black;
|
|
164
163
|
font-weight: 600;
|
|
165
164
|
font-size: 0.875rem;
|
|
166
|
-
|
|
165
|
+
|
|
167
166
|
&:hover {
|
|
168
|
-
border-radius:
|
|
167
|
+
border-radius: .5rem;
|
|
169
168
|
background-color: lighten($primary, 40);
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
|
-
|
|
171
|
+
|
|
173
172
|
&.active {
|
|
174
173
|
.page-link {
|
|
175
174
|
border: 2px solid $primary;
|
|
@@ -197,7 +197,6 @@ $grid-breakpoints: (
|
|
|
197
197
|
md: 768px,
|
|
198
198
|
lg: 992px,
|
|
199
199
|
xl: 1200px,
|
|
200
|
-
xxl: 1500px,
|
|
201
200
|
) !default;
|
|
202
201
|
|
|
203
202
|
@include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
|
|
@@ -212,7 +211,6 @@ $container-max-widths: (
|
|
|
212
211
|
md: 720px,
|
|
213
212
|
lg: 960px,
|
|
214
213
|
xl: 1140px,
|
|
215
|
-
xxl: 1500px,
|
|
216
214
|
) !default;
|
|
217
215
|
|
|
218
216
|
@include _assert-ascending($container-max-widths, "$container-max-widths");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormattedDuration.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/useFormattedDuration.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,cAiChC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),u=((e=r)&&"object"==typeof e&&"default"in e&&e.default,require("react-hook-form")),n=require("luxon"),o=require("react-intl");exports.useFormattedDuration=function(){var e=u.useFormContext().control,a=u.useWatch({control:e,name:"start"}),i=u.useWatch({control:e,name:"end"}),s=o.useIntl(),l=s.formatList,m=s.formatNumber,f=r.useMemo((function(){var e=n.Interval.fromDateTimes(n.DateTime.fromISO(a),n.DateTime.fromISO(i)).toDuration(["days","hours","minutes"]);if(e.isValid){var r=function(e,t){return m(e,{style:"unit",unit:t,unitDisplay:"long"})},u=[[e.days,"day"],[e.hours,"hour"],[e.minutes,"minute"]].filter((function(e){return t.__read(e,1)[0]}));return l(u.map((function(e){return r.apply(void 0,t.__spreadArray([],t.__read(e),!1))})),{style:"long",type:"unit"})}}),[a,i]);return f};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const useValidationOptions: () => {
|
|
2
|
-
start: {
|
|
3
|
-
required: string;
|
|
4
|
-
validate: (value: any) => string | true;
|
|
5
|
-
};
|
|
6
|
-
end: {
|
|
7
|
-
required: string;
|
|
8
|
-
validate: (value: any) => string | true;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=useValidationOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useValidationOptions.d.ts","sourceRoot":"","sources":["../../../../src/events/edit-event-modal/hooks/useValidationOptions.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;;;;;;;;CA+BhC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react-i18next"),t=require("react-hook-form"),i=require("luxon");exports.useValidationOptions=function(){var r=t.useFormContext().control,a=e.useTranslation(["Design","Validation"]).t,n=t.useWatch({control:r,name:"start"});return{start:{required:a("Validation:fieldRequired",{attribute:a("start")}),validate:function(e){return i.DateTime.fromISO(e).diffNow().toMillis()>0||a("Validation:fieldValidEventStart")}},end:{required:a("Validation:fieldRequired",{attribute:a("end")}),validate:function(e){return!e||(i.DateTime.fromISO(e).diff(i.DateTime.fromISO(n)).toMillis()>0||a("Validation:fieldValidEventEnd"))}}}};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { useFormContext, useWatch } from "react-hook-form";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
|
-
import { DateTime, Interval } from "luxon";
|
|
5
|
-
import { IntervalInputValues } from "../IntervalInput";
|
|
6
|
-
|
|
7
|
-
export const useFormattedDuration = () => {
|
|
8
|
-
const { control } = useFormContext<IntervalInputValues>();
|
|
9
|
-
const start = useWatch({ control, name: "start" });
|
|
10
|
-
const end = useWatch({ control, name: "end" });
|
|
11
|
-
const { formatList, formatNumber } = useIntl();
|
|
12
|
-
|
|
13
|
-
const duration = useMemo(() => {
|
|
14
|
-
const interval = Interval.fromDateTimes(
|
|
15
|
-
DateTime.fromISO(start),
|
|
16
|
-
DateTime.fromISO(end)
|
|
17
|
-
).toDuration(["days", "hours", "minutes"]);
|
|
18
|
-
|
|
19
|
-
if (!interval.isValid) return undefined;
|
|
20
|
-
|
|
21
|
-
const formatUnit = (value: number, unit: string) =>
|
|
22
|
-
formatNumber(value, { style: "unit", unit, unitDisplay: "long" });
|
|
23
|
-
|
|
24
|
-
const units = (
|
|
25
|
-
[
|
|
26
|
-
[interval.days, "day"],
|
|
27
|
-
[interval.hours, "hour"],
|
|
28
|
-
[interval.minutes, "minute"],
|
|
29
|
-
] as Parameters<typeof formatUnit>[]
|
|
30
|
-
).filter(([value]) => value);
|
|
31
|
-
|
|
32
|
-
return formatList(
|
|
33
|
-
units.map((args) => formatUnit(...args)),
|
|
34
|
-
{ style: "long", type: "unit" }
|
|
35
|
-
);
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
-
}, [start, end]);
|
|
38
|
-
|
|
39
|
-
return duration;
|
|
40
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DateTime } from "luxon";
|
|
2
|
-
import { useFormContext, useWatch } from "react-hook-form";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
|
|
5
|
-
export const useValidationOptions = () => {
|
|
6
|
-
const { control } = useFormContext();
|
|
7
|
-
const { t } = useTranslation(["Design", "Validation"]);
|
|
8
|
-
const start = useWatch({ control, name: "start" });
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
start: {
|
|
12
|
-
required: t("Validation:fieldRequired", {
|
|
13
|
-
attribute: t("start"),
|
|
14
|
-
}) as string,
|
|
15
|
-
// TODO: uncomment when event splitting is implemented
|
|
16
|
-
// and extract into plugins
|
|
17
|
-
validate: (value) =>
|
|
18
|
-
DateTime.fromISO(value).diffNow().toMillis() > 0 ||
|
|
19
|
-
(t("Validation:fieldValidEventStart") as string),
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
end: {
|
|
23
|
-
required: t("Validation:fieldRequired", {
|
|
24
|
-
attribute: t("end"),
|
|
25
|
-
}) as string,
|
|
26
|
-
// TODO: uncomment when event splitting is implemented
|
|
27
|
-
// and extract into plugins
|
|
28
|
-
validate: (value) =>
|
|
29
|
-
// endAt not required
|
|
30
|
-
value
|
|
31
|
-
? DateTime.fromISO(value).diff(DateTime.fromISO(start)).toMillis() >
|
|
32
|
-
0 || (t("Validation:fieldValidEventEnd") as string)
|
|
33
|
-
: true,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
};
|