mozrest-sdk-react-dev 0.1.71 → 0.1.73

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/mozrest-sdk.es.js CHANGED
@@ -96844,7 +96844,13 @@ const SelectedDateDisplay = ({ initialDate, selectedDate, onSelectDate, datesSum
96844
96844
  style: { marginLeft: 10, marginRight: 10 }
96845
96845
  }, "No date selected"));
96846
96846
  };
96847
- const CustomDatePicker = ({ onSelectDate, onOpenHoursAvailability, bookingSumary, initialDate, setInitialDate }) => {
96847
+ const CustomDatePicker = ({
96848
+ onSelectDate,
96849
+ onOpenHoursAvailability,
96850
+ bookingSumary,
96851
+ initialDate,
96852
+ setInitialDate
96853
+ }) => {
96848
96854
  const [selectedDate, setSelectedDate] = useState(() => {
96849
96855
  const date4 = new Date();
96850
96856
  const year2 = date4.getFullYear();
@@ -96853,6 +96859,7 @@ const CustomDatePicker = ({ onSelectDate, onOpenHoursAvailability, bookingSumary
96853
96859
  return `${year2}-${month2}-${day2}`;
96854
96860
  });
96855
96861
  const [datePickerOpen, setDatePickerOpen] = useState(false);
96862
+ const datePickerRef = useRef(null);
96856
96863
  const onChange3 = (date4, dateString) => {
96857
96864
  setSelectedDate(dateString);
96858
96865
  setInitialDate(dateString);
@@ -96862,6 +96869,18 @@ const CustomDatePicker = ({ onSelectDate, onOpenHoursAvailability, bookingSumary
96862
96869
  useEffect(() => {
96863
96870
  onSelectDate(selectedDate);
96864
96871
  }, [selectedDate]);
96872
+ useEffect(() => {
96873
+ function handleDocumentClick(event) {
96874
+ var _a2, _b;
96875
+ if (datePickerRef.current && typeof ((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.className) === "string" && !((_b = event == null ? void 0 : event.target) == null ? void 0 : _b.className.includes("ant"))) {
96876
+ setDatePickerOpen(false);
96877
+ }
96878
+ }
96879
+ document.addEventListener("mousedown", handleDocumentClick);
96880
+ return () => {
96881
+ document.removeEventListener("mousedown", handleDocumentClick);
96882
+ };
96883
+ }, []);
96865
96884
  return /* @__PURE__ */ React__default.createElement("div", {
96866
96885
  style: { display: "flex" }
96867
96886
  }, /* @__PURE__ */ React__default.createElement(SelectedDateDisplay, {
@@ -96880,6 +96899,7 @@ const CustomDatePicker = ({ onSelectDate, onOpenHoursAvailability, bookingSumary
96880
96899
  size: "medium",
96881
96900
  onClick: () => setDatePickerOpen(true)
96882
96901
  })), /* @__PURE__ */ React__default.createElement(DatePicker$2, {
96902
+ ref: datePickerRef,
96883
96903
  onChange: onChange3,
96884
96904
  open: datePickerOpen,
96885
96905
  style: {
@@ -99265,11 +99285,11 @@ const ReservationDetail = ({ open, onClose: onClose2, venueId, reloadMainTable,
99265
99285
  isLoading: isExecuting
99266
99286
  }));
99267
99287
  };
99268
- const timeSlot = "_timeSlot_1rz9z_1";
99288
+ const timeSlot = "_timeSlot_1d7nu_1";
99269
99289
  var styles$6 = {
99270
99290
  timeSlot,
99271
- "timeSlot-active-true": "_timeSlot-active-true_1rz9z_5",
99272
- "timeSlot-active-false": "_timeSlot-active-false_1rz9z_8"
99291
+ "timeSlot-active-true": "_timeSlot-active-true_1d7nu_6",
99292
+ "timeSlot-active-false": "_timeSlot-active-false_1d7nu_9"
99273
99293
  };
99274
99294
  const FilterForm = ({ currentDate }) => {
99275
99295
  const { t: t2 } = useTranslation();
@@ -99327,15 +99347,18 @@ const TableFilters = ({ params, setParams, reload, currentTimeZone, currentDate
99327
99347
  currentDate
99328
99348
  })));
99329
99349
  };
99330
- const TableRow = ({ row: row2 }) => {
99350
+ const TableRow = ({ row: row2, currentTimeZone }) => {
99331
99351
  const formatHour = (hour2) => {
99332
- return hooks.utc(hour2, "HH:mm").local().format("H:mm");
99352
+ const utcHour2 = moment$1.utc(hour2, "HH:mm", true);
99353
+ return moment$1.tz(utcHour2, currentTimeZone ? currentTimeZone : "").format("H:mm");
99333
99354
  };
99334
99355
  return /* @__PURE__ */ React__default.createElement("div", {
99335
99356
  style: { display: "flex", flexDirection: "column" }
99357
+ }, /* @__PURE__ */ React__default.createElement("div", {
99358
+ style: { display: "block", height: 20 }
99336
99359
  }, /* @__PURE__ */ React__default.createElement("small", {
99337
- className: ""
99338
- }, row2.name), /* @__PURE__ */ React__default.createElement("div", {
99360
+ style: { position: "absolute", cursor: "default" }
99361
+ }, row2.name)), /* @__PURE__ */ React__default.createElement("div", {
99339
99362
  style: { display: "flex", gap: 3 }
99340
99363
  }, row2 && row2.slots && row2.slots.length && row2.slots.length > 0 ? row2.slots.map((slot2, index2) => /* @__PURE__ */ React__default.createElement("div", {
99341
99364
  key: index2
@@ -99343,13 +99366,14 @@ const TableRow = ({ row: row2 }) => {
99343
99366
  className: classNames$2(styles$6["timeSlot"], styles$6[`timeSlot-active-${slot2.available ? "true" : "false"}`])
99344
99367
  }, formatHour(slot2.time)))) : null));
99345
99368
  };
99346
- const Table = ({ data: data2 }) => {
99369
+ const Table = ({ data: data2, currentTimeZone }) => {
99347
99370
  const { t: t2 } = useTranslation();
99348
99371
  return /* @__PURE__ */ React__default.createElement("div", {
99349
99372
  style: { width: "100%", margin: "auto" }
99350
99373
  }, /* @__PURE__ */ React__default.createElement("div", {
99351
99374
  style: { overflowX: "auto", display: "flex", flexDirection: "column", gap: 10, marginTop: 20 }
99352
99375
  }, data2.length && data2.length > 0 ? data2.map((table2, index2) => /* @__PURE__ */ React__default.createElement(TableRow, {
99376
+ currentTimeZone,
99353
99377
  row: table2,
99354
99378
  key: index2
99355
99379
  })) : /* @__PURE__ */ React__default.createElement("div", {
@@ -99367,6 +99391,7 @@ const HoursTableAvailability = ({ venueId, params, setParams, currentTimeZone, c
99367
99391
  currentTimeZone,
99368
99392
  currentDate
99369
99393
  }), /* @__PURE__ */ React__default.createElement(Table, {
99394
+ currentTimeZone,
99370
99395
  data: data2 != null ? data2 : []
99371
99396
  }));
99372
99397
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozrest-sdk-react-dev",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "main": "mozrest-sdk.es.js",
5
5
  "keywords": ["mozrest"],
6
6
  "author": {