@licklist/design 0.50.1-dev.9 → 0.50.1

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.
Files changed (163) hide show
  1. package/dist/assets/dashboard/addImage.svg.js +1 -1
  2. package/dist/assets/dashboard/chartBar.svg.js +1 -1
  3. package/dist/assets/dashboard/genderFemale.svg.js +1 -1
  4. package/dist/assets/dashboard/genderMale.svg.js +1 -1
  5. package/dist/assets/dashboard/increment.svg.js +1 -1
  6. package/dist/assets/dashboard/info.svg.js +1 -1
  7. package/dist/assets/dashboard/managerRole.svg.js +1 -1
  8. package/dist/assets/dashboard/subManagerRole.svg.js +1 -1
  9. package/dist/assets/dashboard/viewerRole.svg.js +1 -1
  10. package/dist/assets/dashboard/visitedProviderLink.svg.js +1 -1
  11. package/dist/assets/dashboard/warning.svg.js +1 -1
  12. package/dist/assets/editor/bold.svg.js +1 -1
  13. package/dist/assets/editor/double-quotes-l.svg.js +1 -1
  14. package/dist/assets/editor/format-clear.svg.js +1 -1
  15. package/dist/assets/editor/h1.svg.js +1 -1
  16. package/dist/assets/editor/h2.svg.js +1 -1
  17. package/dist/assets/editor/italic.svg.js +1 -1
  18. package/dist/assets/editor/paragraph.svg.js +1 -1
  19. package/dist/assets/editor/separator.svg.js +1 -1
  20. package/dist/assets/editor/strikethrough.svg.js +1 -1
  21. package/dist/assets/editor/text-wrap.svg.js +1 -1
  22. package/dist/assets/iframe/available.svg.js +1 -1
  23. package/dist/assets/iframe/calendar.svg.js +1 -1
  24. package/dist/assets/iframe/clock.svg.js +1 -1
  25. package/dist/assets/iframe/close.svg.js +1 -1
  26. package/dist/assets/iframe/limited.svg.js +1 -1
  27. package/dist/assets/iframe/selectArrow.svg.js +1 -1
  28. package/dist/assets/iframe/soldOut.svg.js +1 -1
  29. package/dist/assets/iframe/success.svg.js +1 -1
  30. package/dist/assets/iframe/ticket.svg.js +1 -1
  31. package/dist/assets/logo/bookedit.svg.js +1 -1
  32. package/dist/assets/logo/licklist.sm.svg.js +1 -1
  33. package/dist/assets/logo/licklist.svg.js +1 -1
  34. package/dist/calendar/Calendar.d.ts +0 -3
  35. package/dist/calendar/Calendar.d.ts.map +1 -1
  36. package/dist/calendar/components/CalendarButtons/CalendarButtons.js +1 -1
  37. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +1 -1
  38. package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  39. package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
  40. package/dist/calendar/utils/index.d.ts +1 -2
  41. package/dist/calendar/utils/index.d.ts.map +1 -1
  42. package/dist/calendar/utils/index.js +1 -1
  43. package/dist/date-time-button/DateTimeButton.d.ts +2 -3
  44. package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
  45. package/dist/date-time-button/DateTimeButton.js +1 -1
  46. package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
  47. package/dist/events/edit-event-modal/IntervalInput.js +1 -1
  48. package/dist/events/event-card/EventCard.d.ts +1 -2
  49. package/dist/events/event-card/EventCard.d.ts.map +1 -1
  50. package/dist/events/event-card/EventCard.js +1 -1
  51. package/dist/events/event-venue-map/components/Scrollbars/Scrollbars.js +1 -1
  52. package/dist/iframe/event/event-booking-products/EventBookingProducts.js +1 -1
  53. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +2 -2
  54. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
  55. package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.js +1 -1
  56. package/dist/iframe/event/event-card/IframeEventCard.d.ts +1 -2
  57. package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
  58. package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
  59. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
  60. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  61. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  62. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +1 -2
  63. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +1 -1
  64. package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +1 -1
  65. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +1 -2
  66. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
  67. package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
  68. package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.js +1 -1
  69. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -1
  70. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  71. package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
  72. package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
  73. package/dist/iframe/order-process/components/BookingSummaryFooter/BookingSummaryFooter.d.ts +1 -2
  74. package/dist/iframe/order-process/components/BookingSummaryFooter/BookingSummaryFooter.d.ts.map +1 -1
  75. package/dist/iframe/order-process/components/BookingSummaryFooter/BookingSummaryFooter.js +1 -1
  76. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  77. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.js +1 -1
  78. package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
  79. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +2 -3
  80. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
  81. package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -1
  82. package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  85. package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
  86. package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
  87. package/dist/sales/booking/results/components/ResultCard.js +1 -1
  88. package/dist/sales/manual-booking/select-event/SelectEvent.d.ts.map +1 -1
  89. package/dist/sales/manual-booking/select-event/SelectEvent.js +1 -1
  90. package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts +1 -2
  91. package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
  92. package/dist/sales/manual-booking/summary/ManualBookingSummary.js +1 -1
  93. package/dist/static/date-range-input/DateRangeInput.d.ts.map +1 -1
  94. package/dist/static/date-range-input/DateRangeInput.js +1 -1
  95. package/dist/styles/affiliate/AffiliateCard.scss +6 -26
  96. package/dist/styles/events/EventCard.scss +6 -3
  97. package/dist/styles/product-set/ProductSetCard.scss +0 -4
  98. package/dist/styles/resources-blocking/_index.scss +0 -6
  99. package/dist/styles/sales/BookingFilter.scss +0 -18
  100. package/dist/styles/sales/BookingResults.scss +1 -1
  101. package/dist/styles/sales/BookingTabs.scss +5 -63
  102. package/dist/styles/sales/LifeTimeSales.scss +0 -1
  103. package/dist/styles/sales/ManualBooking.scss +3 -62
  104. package/dist/styles/sales/SourceOfSales.scss +0 -3
  105. package/dist/styles/snippet-templates/SnippetTemplateCard.scss +2 -3
  106. package/dist/styles/static/Tabs.scss +0 -6
  107. package/dist/styles/themes/bookedit/_index.scss +8 -9
  108. package/dist/table/TableHelperComponent.d.ts.map +1 -1
  109. package/package.json +3 -3
  110. package/src/calendar/Calendar.tsx +0 -5
  111. package/src/calendar/components/CalendarButtons/CalendarButtons.tsx +3 -3
  112. package/src/calendar/components/CalendarDates/CalendarDates.tsx +2 -5
  113. package/src/calendar/utils/index.ts +6 -15
  114. package/src/date-time-button/DateTimeButton.tsx +3 -16
  115. package/src/events/edit-event-modal/IntervalInput.tsx +80 -8
  116. package/src/events/event-card/EventCard.stories.tsx +0 -1
  117. package/src/events/event-card/EventCard.tsx +2 -27
  118. package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +1 -1
  119. package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +8 -8
  120. package/src/iframe/event/event-card/IframeEventCard.tsx +1 -3
  121. package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +5 -5
  122. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +0 -2
  123. package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +6 -12
  124. package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +2 -5
  125. package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -1
  126. package/src/iframe/order-process/components/BookingSummary/utils/index.ts +4 -2
  127. package/src/iframe/order-process/components/BookingSummaryFooter/BookingSummaryFooter.tsx +3 -16
  128. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +23 -13
  129. package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
  130. package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +5 -11
  131. package/src/iframe/order-process/components/utils/useCategoryVerification.ts +1 -1
  132. package/src/iframe/payment/payment-page/PaymentPage.stories.tsx +1 -1
  133. package/src/notification/email-template/control/EmailTemplateControl.tsx +15 -5
  134. package/src/sales/booking/results/components/ResultCard.tsx +4 -6
  135. package/src/sales/manual-booking/select-event/SelectEvent.tsx +1 -4
  136. package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +1 -9
  137. package/src/static/date-range-input/DateRangeInput.tsx +2 -23
  138. package/src/static/switch/BooleanSwitch.tsx +1 -1
  139. package/src/styles/affiliate/AffiliateCard.scss +6 -26
  140. package/src/styles/events/EventCard.scss +6 -3
  141. package/src/styles/product-set/ProductSetCard.scss +0 -4
  142. package/src/styles/resources-blocking/_index.scss +0 -6
  143. package/src/styles/sales/BookingFilter.scss +0 -18
  144. package/src/styles/sales/BookingResults.scss +1 -1
  145. package/src/styles/sales/BookingTabs.scss +5 -63
  146. package/src/styles/sales/LifeTimeSales.scss +0 -1
  147. package/src/styles/sales/ManualBooking.scss +3 -62
  148. package/src/styles/sales/SourceOfSales.scss +0 -3
  149. package/src/styles/snippet-templates/SnippetTemplateCard.scss +2 -3
  150. package/src/styles/static/Tabs.scss +0 -6
  151. package/src/styles/themes/bookedit/_index.scss +8 -9
  152. package/src/table/TableHelperComponent.tsx +13 -11
  153. package/dist/events/edit-event-modal/hooks/index.d.ts +0 -3
  154. package/dist/events/edit-event-modal/hooks/index.d.ts.map +0 -1
  155. package/dist/events/edit-event-modal/hooks/useFormattedDuration.d.ts +0 -2
  156. package/dist/events/edit-event-modal/hooks/useFormattedDuration.d.ts.map +0 -1
  157. package/dist/events/edit-event-modal/hooks/useFormattedDuration.js +0 -1
  158. package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts +0 -11
  159. package/dist/events/edit-event-modal/hooks/useValidationOptions.d.ts.map +0 -1
  160. package/dist/events/edit-event-modal/hooks/useValidationOptions.js +0 -1
  161. package/src/events/edit-event-modal/hooks/index.ts +0 -2
  162. package/src/events/edit-event-modal/hooks/useFormattedDuration.tsx +0 -40
  163. package/src/events/edit-event-modal/hooks/useValidationOptions.tsx +0 -36
@@ -361,11 +361,10 @@
361
361
  width: inherit;
362
362
 
363
363
  @include media-breakpoint-down(sm) {
364
- display: none;
364
+ padding: 0 0.5rem;
365
+ padding-top: 2rem;
365
366
  }
366
367
 
367
-
368
-
369
368
  .form-control {
370
369
  margin-bottom: 1.5rem;
371
370
  }
@@ -412,64 +411,6 @@
412
411
  }
413
412
  }
414
413
 
415
- .manual-booking-summary-mobile {
416
- display: none;
417
-
418
- @include media-breakpoint-down(sm) {
419
- display: block;
420
- padding: 0 1.5rem;
421
- padding-top: 2rem;
422
- height: max-content;
423
- margin-bottom: 1.5rem;
424
- width: inherit;
425
-
426
- .form-control {
427
- margin-bottom: .5rem;
428
- }
429
- .receipt-title {
430
- font-size: 1.125rem;
431
- font-weight: 600;
432
- padding-bottom: 0.4rem;
433
- margin-bottom: 1rem;
434
- border-bottom: 2px solid $gray-400;
435
- }
436
- .event-name {
437
- font-size: 0.94rem;
438
- font-weight: 600;
439
- }
440
-
441
- .border-summary-item {
442
- padding-bottom: 0.9rem;
443
- margin-bottom: 1%;
444
- border-bottom: 2px solid $gray-100;
445
- flex-wrap: wrap;
446
- }
447
-
448
- .total-container {
449
- display: flex;
450
- justify-content: space-between;
451
- font-size: 1rem;
452
- font-weight: 600;
453
-
454
- @include media-breakpoint-down(lg) {
455
- flex-wrap: wrap;
456
- }
457
- .total-amount {
458
- padding-left: 1rem;
459
- @include media-breakpoint-down(lg) {
460
- padding-left: 0;
461
- }
462
- }
463
- }
464
-
465
- .summary-item-container {
466
- .border-summary-item:nth-last-child(2) {
467
- border-bottom: 2px solid $gray-400;
468
- }
469
- }
470
- }
471
- }
472
-
473
414
  .menu-list-manual-booking {
474
415
  display: flex;
475
416
  align-items: center;
@@ -496,4 +437,4 @@
496
437
  color: $blue;
497
438
  }
498
439
  }
499
- }
440
+ }
@@ -13,9 +13,6 @@
13
13
 
14
14
  &__pie-chart {
15
15
  height: 100%;
16
- @include media-breakpoint-down(sm) {
17
- height: 12rem;
18
- }
19
16
  }
20
17
 
21
18
  .colors-0 {
@@ -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
- min-width: 15rem;
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: 0.5rem;
142
+ border-radius: .5rem;
144
143
  background-color: lighten($primary, 40);
145
144
  }
146
145
  }
147
146
 
148
147
  .page-item {
149
- margin-left: 0.4rem;
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: 0.5rem;
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: 0.5rem;
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;
@@ -173,18 +173,20 @@ function TableHelperComponent(props: TableHelperComponentProps) {
173
173
  };
174
174
  });
175
175
  }
176
- } else if (filteredOrdersOptions) {
177
- filteredOrdersOptions((prevOptions) => ({
178
- ...prevOptions,
179
- sortKey: key,
180
- sortDirection: nextDirection,
181
- }));
182
176
  } else {
183
- setOptions((prevOptions) => ({
184
- ...prevOptions,
185
- sortKey: key,
186
- sortDirection: nextDirection,
187
- }));
177
+ if (filteredOrdersOptions) {
178
+ filteredOrdersOptions((prevOptions) => ({
179
+ ...prevOptions,
180
+ sortKey: key,
181
+ sortDirection: nextDirection,
182
+ }));
183
+ } else {
184
+ setOptions((prevOptions) => ({
185
+ ...prevOptions,
186
+ sortKey: key,
187
+ sortDirection: nextDirection,
188
+ }));
189
+ }
188
190
  }
189
191
  };
190
192
 
@@ -1,3 +0,0 @@
1
- export * from "./useFormattedDuration";
2
- export * from "./useValidationOptions";
3
- //# sourceMappingURL=index.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const useFormattedDuration: () => string;
2
- //# sourceMappingURL=useFormattedDuration.d.ts.map
@@ -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,2 +0,0 @@
1
- export * from "./useFormattedDuration";
2
- export * from "./useValidationOptions";
@@ -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
- };