@lets-events/react 12.8.4 → 12.8.6

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- > @lets-events/react@12.8.4 build
3
+ > @lets-events/react@12.8.6 build
4
4
  > tsup src/index.tsx --format esm,cjs --dts --external react
5
5
 
6
6
  CLI Building entry: src/index.tsx
@@ -10,12 +10,12 @@
10
10
  CLI Target: es6
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 397.40 KB
14
- ESM ⚡️ Build success in 76497ms
15
- CJS dist/index.js 412.83 KB
16
- CJS ⚡️ Build success in 76497ms
13
+ ESM dist/index.mjs 398.26 KB
14
+ ESM ⚡️ Build success in 334ms
15
+ CJS dist/index.js 413.69 KB
16
+ CJS ⚡️ Build success in 335ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 9188ms
19
- DTS dist/index.d.mts 404.15 KB
20
- DTS dist/index.d.ts 404.15 KB
18
+ DTS ⚡️ Build success in 7365ms
19
+ DTS dist/index.d.mts 404.21 KB
20
+ DTS dist/index.d.ts 404.21 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.8.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Calendar and timer icon color
8
+
9
+ ## 12.8.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Calendar layout
14
+
3
15
  ## 12.8.4
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -4722,13 +4722,14 @@ type CalendarProps = ComponentProps<typeof CalendarStyled> & {
4722
4722
  position?: "top" | "bottom" | "top-right" | "bottom-right";
4723
4723
  action?: boolean;
4724
4724
  actionText?: string;
4725
+ actionAlign?: "left" | "center" | "right";
4725
4726
  hasError?: boolean;
4726
4727
  expand?: boolean;
4727
4728
  allowPastDates?: boolean;
4728
4729
  maxDate?: Date;
4729
4730
  maxYearsFromNow?: number;
4730
4731
  };
4731
- declare function Calendar({ action, actionText, calendarLayout, selected, setSelected, position, hasError, expand, allowPastDates, maxDate, maxYearsFromNow, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
4732
+ declare function Calendar({ action, actionText, actionAlign, calendarLayout, selected, setSelected, position, hasError, expand, allowPastDates, maxDate, maxYearsFromNow, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
4732
4733
 
4733
4734
  type DateRange = {
4734
4735
  from?: Date;
package/dist/index.d.ts CHANGED
@@ -4722,13 +4722,14 @@ type CalendarProps = ComponentProps<typeof CalendarStyled> & {
4722
4722
  position?: "top" | "bottom" | "top-right" | "bottom-right";
4723
4723
  action?: boolean;
4724
4724
  actionText?: string;
4725
+ actionAlign?: "left" | "center" | "right";
4725
4726
  hasError?: boolean;
4726
4727
  expand?: boolean;
4727
4728
  allowPastDates?: boolean;
4728
4729
  maxDate?: Date;
4729
4730
  maxYearsFromNow?: number;
4730
4731
  };
4731
- declare function Calendar({ action, actionText, calendarLayout, selected, setSelected, position, hasError, expand, allowPastDates, maxDate, maxYearsFromNow, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
4732
+ declare function Calendar({ action, actionText, actionAlign, calendarLayout, selected, setSelected, position, hasError, expand, allowPastDates, maxDate, maxYearsFromNow, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
4732
4733
 
4733
4734
  type DateRange = {
4734
4735
  from?: Date;
package/dist/index.js CHANGED
@@ -7892,9 +7892,24 @@ var CalendarFooterStyled = styled("div", {
7892
7892
  padding: "$4 $16",
7893
7893
  display: "flex",
7894
7894
  gap: "1rem",
7895
- justifyContent: "flex-end",
7896
7895
  alignItems: "center",
7897
7896
  height: "3rem",
7897
+ variants: {
7898
+ actionAlign: {
7899
+ left: {
7900
+ justifyContent: "flex-start"
7901
+ },
7902
+ center: {
7903
+ justifyContent: "center"
7904
+ },
7905
+ right: {
7906
+ justifyContent: "flex-end"
7907
+ }
7908
+ }
7909
+ },
7910
+ defaultVariants: {
7911
+ actionAlign: "right"
7912
+ },
7898
7913
  "@media (max-width: 748px)": {
7899
7914
  gap: "0",
7900
7915
  padding: "$4 $12",
@@ -7920,19 +7935,22 @@ var DayPickerWrapperStyled = styled("div", {
7920
7935
  color: "$dark400"
7921
7936
  },
7922
7937
  ".rdp-day_button": {
7923
- height: "28px",
7924
- width: "28px",
7938
+ height: "32px",
7939
+ width: "32px",
7925
7940
  borderRadius: "$sm",
7926
7941
  fontSize: "$14",
7927
7942
  color: "$text",
7928
7943
  backgroundColor: "transparent",
7929
7944
  border: "1px solid transparent",
7930
7945
  transition: "all 0.2s ease-in-out",
7931
- cursor: "pointer"
7946
+ cursor: "pointer",
7947
+ display: "flex",
7948
+ alignItems: "center",
7949
+ justifyContent: "center"
7932
7950
  },
7933
7951
  ".rdp-day_button:hover": {
7934
7952
  backgroundColor: "$dark100",
7935
- borderColor: "$brand500"
7953
+ borderColor: "$brand600"
7936
7954
  },
7937
7955
  ".rdp-day.rdp-disabled .rdp-day_button:hover": {
7938
7956
  backgroundColor: "transparent",
@@ -8006,7 +8024,8 @@ var DayPickerWrapperStyled = styled("div", {
8006
8024
  ".rdp-day.rdp-selected .rdp-day_button": {
8007
8025
  backgroundColor: "$brand500",
8008
8026
  color: "$neutral50",
8009
- borderColor: "$brand500"
8027
+ borderColor: "$brand600",
8028
+ borderRadius: "0.5rem"
8010
8029
  },
8011
8030
  ".rdp-dropdowns": {
8012
8031
  display: "flex",
@@ -8094,6 +8113,7 @@ function Calendar(_a) {
8094
8113
  var _b = _a, {
8095
8114
  action,
8096
8115
  actionText,
8116
+ actionAlign = "right",
8097
8117
  calendarLayout,
8098
8118
  selected,
8099
8119
  setSelected,
@@ -8106,6 +8126,7 @@ function Calendar(_a) {
8106
8126
  } = _b, props = __objRest(_b, [
8107
8127
  "action",
8108
8128
  "actionText",
8129
+ "actionAlign",
8109
8130
  "calendarLayout",
8110
8131
  "selected",
8111
8132
  "setSelected",
@@ -8173,7 +8194,7 @@ function Calendar(_a) {
8173
8194
  inputMode: "numeric",
8174
8195
  textAlign: "right",
8175
8196
  color: hasError ? "error" : "default",
8176
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TextFieldSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon_default, { name: "calendar", size: "xl" }) })
8197
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TextFieldSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon_default, { name: "calendar", size: "xl", color: "#4C4F54" }) })
8177
8198
  }
8178
8199
  )
8179
8200
  }
@@ -8193,7 +8214,7 @@ function Calendar(_a) {
8193
8214
  endMonth: resolvedMaxDate
8194
8215
  }
8195
8216
  ) }) }),
8196
- action && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CalendarFooterStyled, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8217
+ action && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CalendarFooterStyled, { actionAlign, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
8197
8218
  Button,
8198
8219
  {
8199
8220
  variant: "text",
@@ -8719,7 +8740,7 @@ function TimePicker({
8719
8740
  typography: "labelSmall",
8720
8741
  fontWeight: "regular",
8721
8742
  color: hasError ? "error" : "default",
8722
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextFieldSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "clock", size: "xl" }) })
8743
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextFieldSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "clock", size: "xl", color: "#4C4F54" }) })
8723
8744
  }
8724
8745
  )
8725
8746
  }
@@ -13403,21 +13424,27 @@ var DateAndTimeFormField = (_a) => {
13403
13424
  const haveError = !!fieldError;
13404
13425
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
13405
13426
  const { value: isoValue, onChange: setIsoValue } = field;
13406
- const { selectedDate, selectedTime } = (0, import_react28.useMemo)(() => {
13407
- if (!isoValue) return { selectedDate: void 0, selectedTime: void 0 };
13427
+ const { selectedDateFromIso, selectedTimeFromIso } = (0, import_react28.useMemo)(() => {
13428
+ if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13408
13429
  try {
13409
13430
  const date = new Date(isoValue);
13410
13431
  if (isNaN(date.getTime())) {
13411
- return { selectedDate: void 0, selectedTime: void 0 };
13432
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13412
13433
  }
13413
13434
  const hours = String(date.getHours()).padStart(2, "0");
13414
13435
  const minutes = String(date.getMinutes()).padStart(2, "0");
13415
13436
  const time = `${hours}:${minutes}`;
13416
- return { selectedDate: date, selectedTime: time };
13437
+ return { selectedDateFromIso: date, selectedTimeFromIso: time };
13417
13438
  } catch (e) {
13418
- return { selectedDate: void 0, selectedTime: void 0 };
13439
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13419
13440
  }
13420
13441
  }, [isoValue]);
13442
+ const [draftDate, setDraftDate] = (0, import_react28.useState)(selectedDateFromIso);
13443
+ const [draftTime, setDraftTime] = (0, import_react28.useState)(selectedTimeFromIso);
13444
+ (0, import_react28.useEffect)(() => {
13445
+ setDraftDate(selectedDateFromIso);
13446
+ setDraftTime(selectedTimeFromIso);
13447
+ }, [selectedDateFromIso, selectedTimeFromIso]);
13421
13448
  const combineDateTime = (0, import_react28.useCallback)(
13422
13449
  (date, time) => {
13423
13450
  if (!date || !time) {
@@ -13432,10 +13459,12 @@ var DateAndTimeFormField = (_a) => {
13432
13459
  [setIsoValue]
13433
13460
  );
13434
13461
  const handleDateChange = (date) => {
13435
- combineDateTime(date, selectedTime);
13462
+ setDraftDate(date);
13463
+ combineDateTime(date, draftTime);
13436
13464
  };
13437
13465
  const handleTimeChange = (time) => {
13438
- combineDateTime(selectedDate, time);
13466
+ setDraftTime(time);
13467
+ combineDateTime(draftDate, time);
13439
13468
  };
13440
13469
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { direction: "column", children: [
13441
13470
  label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
@@ -13451,9 +13480,9 @@ var DateAndTimeFormField = (_a) => {
13451
13480
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Flex, { direction: "column", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13452
13481
  Calendar,
13453
13482
  __spreadValues({
13454
- selected: selectedDate,
13483
+ selected: draftDate,
13455
13484
  setSelected: (date) => {
13456
- const d = typeof date === "function" ? date(selectedDate) : date;
13485
+ const d = typeof date === "function" ? date(draftDate) : date;
13457
13486
  handleDateChange(d);
13458
13487
  },
13459
13488
  hasError: haveError,
@@ -13465,9 +13494,9 @@ var DateAndTimeFormField = (_a) => {
13465
13494
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Flex, { direction: "column", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13466
13495
  TimePicker,
13467
13496
  __spreadValues({
13468
- selected: selectedTime,
13497
+ selected: draftTime,
13469
13498
  setSelected: (value) => {
13470
- const time = typeof value === "function" ? value(selectedTime) : value;
13499
+ const time = typeof value === "function" ? value(draftTime) : value;
13471
13500
  handleTimeChange(time);
13472
13501
  },
13473
13502
  hasError: haveError
package/dist/index.mjs CHANGED
@@ -7776,9 +7776,24 @@ var CalendarFooterStyled = styled("div", {
7776
7776
  padding: "$4 $16",
7777
7777
  display: "flex",
7778
7778
  gap: "1rem",
7779
- justifyContent: "flex-end",
7780
7779
  alignItems: "center",
7781
7780
  height: "3rem",
7781
+ variants: {
7782
+ actionAlign: {
7783
+ left: {
7784
+ justifyContent: "flex-start"
7785
+ },
7786
+ center: {
7787
+ justifyContent: "center"
7788
+ },
7789
+ right: {
7790
+ justifyContent: "flex-end"
7791
+ }
7792
+ }
7793
+ },
7794
+ defaultVariants: {
7795
+ actionAlign: "right"
7796
+ },
7782
7797
  "@media (max-width: 748px)": {
7783
7798
  gap: "0",
7784
7799
  padding: "$4 $12",
@@ -7804,19 +7819,22 @@ var DayPickerWrapperStyled = styled("div", {
7804
7819
  color: "$dark400"
7805
7820
  },
7806
7821
  ".rdp-day_button": {
7807
- height: "28px",
7808
- width: "28px",
7822
+ height: "32px",
7823
+ width: "32px",
7809
7824
  borderRadius: "$sm",
7810
7825
  fontSize: "$14",
7811
7826
  color: "$text",
7812
7827
  backgroundColor: "transparent",
7813
7828
  border: "1px solid transparent",
7814
7829
  transition: "all 0.2s ease-in-out",
7815
- cursor: "pointer"
7830
+ cursor: "pointer",
7831
+ display: "flex",
7832
+ alignItems: "center",
7833
+ justifyContent: "center"
7816
7834
  },
7817
7835
  ".rdp-day_button:hover": {
7818
7836
  backgroundColor: "$dark100",
7819
- borderColor: "$brand500"
7837
+ borderColor: "$brand600"
7820
7838
  },
7821
7839
  ".rdp-day.rdp-disabled .rdp-day_button:hover": {
7822
7840
  backgroundColor: "transparent",
@@ -7890,7 +7908,8 @@ var DayPickerWrapperStyled = styled("div", {
7890
7908
  ".rdp-day.rdp-selected .rdp-day_button": {
7891
7909
  backgroundColor: "$brand500",
7892
7910
  color: "$neutral50",
7893
- borderColor: "$brand500"
7911
+ borderColor: "$brand600",
7912
+ borderRadius: "0.5rem"
7894
7913
  },
7895
7914
  ".rdp-dropdowns": {
7896
7915
  display: "flex",
@@ -7978,6 +7997,7 @@ function Calendar(_a) {
7978
7997
  var _b = _a, {
7979
7998
  action,
7980
7999
  actionText,
8000
+ actionAlign = "right",
7981
8001
  calendarLayout,
7982
8002
  selected,
7983
8003
  setSelected,
@@ -7990,6 +8010,7 @@ function Calendar(_a) {
7990
8010
  } = _b, props = __objRest(_b, [
7991
8011
  "action",
7992
8012
  "actionText",
8013
+ "actionAlign",
7993
8014
  "calendarLayout",
7994
8015
  "selected",
7995
8016
  "setSelected",
@@ -8057,7 +8078,7 @@ function Calendar(_a) {
8057
8078
  inputMode: "numeric",
8058
8079
  textAlign: "right",
8059
8080
  color: hasError ? "error" : "default",
8060
- children: /* @__PURE__ */ jsx15(TextFieldSlot, { children: /* @__PURE__ */ jsx15(Icon_default, { name: "calendar", size: "xl" }) })
8081
+ children: /* @__PURE__ */ jsx15(TextFieldSlot, { children: /* @__PURE__ */ jsx15(Icon_default, { name: "calendar", size: "xl", color: "#4C4F54" }) })
8061
8082
  }
8062
8083
  )
8063
8084
  }
@@ -8077,7 +8098,7 @@ function Calendar(_a) {
8077
8098
  endMonth: resolvedMaxDate
8078
8099
  }
8079
8100
  ) }) }),
8080
- action && /* @__PURE__ */ jsx15(CalendarFooterStyled, { children: /* @__PURE__ */ jsx15(
8101
+ action && /* @__PURE__ */ jsx15(CalendarFooterStyled, { actionAlign, children: /* @__PURE__ */ jsx15(
8081
8102
  Button,
8082
8103
  {
8083
8104
  variant: "text",
@@ -8603,7 +8624,7 @@ function TimePicker({
8603
8624
  typography: "labelSmall",
8604
8625
  fontWeight: "regular",
8605
8626
  color: hasError ? "error" : "default",
8606
- children: /* @__PURE__ */ jsx18(TextFieldSlot, { children: /* @__PURE__ */ jsx18(Icon_default, { name: "clock", size: "xl" }) })
8627
+ children: /* @__PURE__ */ jsx18(TextFieldSlot, { children: /* @__PURE__ */ jsx18(Icon_default, { name: "clock", size: "xl", color: "#4C4F54" }) })
8607
8628
  }
8608
8629
  )
8609
8630
  }
@@ -13249,7 +13270,7 @@ var TimePickerFormField = (_a) => {
13249
13270
 
13250
13271
  // src/components/FormFields/DateAndTimeFormField.tsx
13251
13272
  import { useController as useController7 } from "react-hook-form";
13252
- import { useCallback as useCallback8, useMemo as useMemo4 } from "react";
13273
+ import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo4, useState as useState13 } from "react";
13253
13274
  import { jsx as jsx59, jsxs as jsxs33 } from "react/jsx-runtime";
13254
13275
  var DateAndTimeFormField = (_a) => {
13255
13276
  var _b = _a, {
@@ -13296,21 +13317,27 @@ var DateAndTimeFormField = (_a) => {
13296
13317
  const haveError = !!fieldError;
13297
13318
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
13298
13319
  const { value: isoValue, onChange: setIsoValue } = field;
13299
- const { selectedDate, selectedTime } = useMemo4(() => {
13300
- if (!isoValue) return { selectedDate: void 0, selectedTime: void 0 };
13320
+ const { selectedDateFromIso, selectedTimeFromIso } = useMemo4(() => {
13321
+ if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13301
13322
  try {
13302
13323
  const date = new Date(isoValue);
13303
13324
  if (isNaN(date.getTime())) {
13304
- return { selectedDate: void 0, selectedTime: void 0 };
13325
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13305
13326
  }
13306
13327
  const hours = String(date.getHours()).padStart(2, "0");
13307
13328
  const minutes = String(date.getMinutes()).padStart(2, "0");
13308
13329
  const time = `${hours}:${minutes}`;
13309
- return { selectedDate: date, selectedTime: time };
13330
+ return { selectedDateFromIso: date, selectedTimeFromIso: time };
13310
13331
  } catch (e) {
13311
- return { selectedDate: void 0, selectedTime: void 0 };
13332
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13312
13333
  }
13313
13334
  }, [isoValue]);
13335
+ const [draftDate, setDraftDate] = useState13(selectedDateFromIso);
13336
+ const [draftTime, setDraftTime] = useState13(selectedTimeFromIso);
13337
+ useEffect11(() => {
13338
+ setDraftDate(selectedDateFromIso);
13339
+ setDraftTime(selectedTimeFromIso);
13340
+ }, [selectedDateFromIso, selectedTimeFromIso]);
13314
13341
  const combineDateTime = useCallback8(
13315
13342
  (date, time) => {
13316
13343
  if (!date || !time) {
@@ -13325,10 +13352,12 @@ var DateAndTimeFormField = (_a) => {
13325
13352
  [setIsoValue]
13326
13353
  );
13327
13354
  const handleDateChange = (date) => {
13328
- combineDateTime(date, selectedTime);
13355
+ setDraftDate(date);
13356
+ combineDateTime(date, draftTime);
13329
13357
  };
13330
13358
  const handleTimeChange = (time) => {
13331
- combineDateTime(selectedDate, time);
13359
+ setDraftTime(time);
13360
+ combineDateTime(draftDate, time);
13332
13361
  };
13333
13362
  return /* @__PURE__ */ jsxs33(Flex, { direction: "column", children: [
13334
13363
  label && /* @__PURE__ */ jsx59(
@@ -13344,9 +13373,9 @@ var DateAndTimeFormField = (_a) => {
13344
13373
  /* @__PURE__ */ jsx59(Flex, { direction: "column", children: /* @__PURE__ */ jsx59(
13345
13374
  Calendar,
13346
13375
  __spreadValues({
13347
- selected: selectedDate,
13376
+ selected: draftDate,
13348
13377
  setSelected: (date) => {
13349
- const d = typeof date === "function" ? date(selectedDate) : date;
13378
+ const d = typeof date === "function" ? date(draftDate) : date;
13350
13379
  handleDateChange(d);
13351
13380
  },
13352
13381
  hasError: haveError,
@@ -13358,9 +13387,9 @@ var DateAndTimeFormField = (_a) => {
13358
13387
  /* @__PURE__ */ jsx59(Flex, { direction: "column", children: /* @__PURE__ */ jsx59(
13359
13388
  TimePicker,
13360
13389
  __spreadValues({
13361
- selected: selectedTime,
13390
+ selected: draftTime,
13362
13391
  setSelected: (value) => {
13363
- const time = typeof value === "function" ? value(selectedTime) : value;
13392
+ const time = typeof value === "function" ? value(draftTime) : value;
13364
13393
  handleTimeChange(time);
13365
13394
  },
13366
13395
  hasError: haveError
@@ -13372,11 +13401,11 @@ var DateAndTimeFormField = (_a) => {
13372
13401
  };
13373
13402
 
13374
13403
  // src/hooks/useImageUpload.ts
13375
- import { useState as useState13, useCallback as useCallback9 } from "react";
13404
+ import { useState as useState14, useCallback as useCallback9 } from "react";
13376
13405
  var useImageUpload = (options) => {
13377
- const [isUploading, setIsUploading] = useState13(false);
13378
- const [progress, setProgress] = useState13(null);
13379
- const [error, setError] = useState13(null);
13406
+ const [isUploading, setIsUploading] = useState14(false);
13407
+ const [progress, setProgress] = useState14(null);
13408
+ const [error, setError] = useState14(null);
13380
13409
  const {
13381
13410
  onSuccess,
13382
13411
  onError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.8.4",
3
+ "version": "12.8.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -22,6 +22,7 @@ export type CalendarProps = ComponentProps<typeof CalendarStyled> & {
22
22
  position?: "top" | "bottom" | "top-right" | "bottom-right";
23
23
  action?: boolean;
24
24
  actionText?: string;
25
+ actionAlign?: "left" | "center" | "right";
25
26
  hasError?: boolean;
26
27
  expand?: boolean;
27
28
  allowPastDates?: boolean;
@@ -40,6 +41,7 @@ function formatToDateMask(value: string): string {
40
41
  export function Calendar({
41
42
  action,
42
43
  actionText,
44
+ actionAlign = "right",
43
45
  calendarLayout,
44
46
  selected,
45
47
  setSelected,
@@ -117,7 +119,7 @@ export function Calendar({
117
119
  color={hasError ? "error" : "default"}
118
120
  >
119
121
  <TextFieldSlot>
120
- <Icon name="calendar" size={"xl"} />
122
+ <Icon name="calendar" size={"xl"} color="#4C4F54" />
121
123
  </TextFieldSlot>
122
124
  </TextField>
123
125
  </CalendarButtonStyled>
@@ -140,7 +142,7 @@ export function Calendar({
140
142
  </Box>
141
143
 
142
144
  {action && (
143
- <CalendarFooterStyled>
145
+ <CalendarFooterStyled actionAlign={actionAlign}>
144
146
  <Button
145
147
  variant="text"
146
148
  color="brand"
@@ -76,17 +76,32 @@ export const CalendarFooterStyled = styled("div", {
76
76
  borderTop: "2px solid $neutral100",
77
77
  padding: "$4 $16",
78
78
  display: "flex",
79
- gap: '1rem',
80
- justifyContent: "flex-end",
79
+ gap: "1rem",
81
80
  alignItems: "center",
82
81
  height: "3rem",
82
+ variants: {
83
+ actionAlign: {
84
+ left: {
85
+ justifyContent: "flex-start",
86
+ },
87
+ center: {
88
+ justifyContent: "center",
89
+ },
90
+ right: {
91
+ justifyContent: "flex-end",
92
+ },
93
+ },
94
+ },
95
+ defaultVariants: {
96
+ actionAlign: "right",
97
+ },
83
98
  "@media (max-width: 748px)": {
84
- gap: '0',
99
+ gap: "0",
85
100
  padding: "$4 $12",
86
101
  "> div": {
87
- padding: '0!important',
88
- }
89
- }
102
+ padding: "0!important",
103
+ },
104
+ },
90
105
  });
91
106
 
92
107
  export const DayPickerWrapperStyled = styled("div", {
@@ -106,8 +121,8 @@ export const DayPickerWrapperStyled = styled("div", {
106
121
  color: "$dark400",
107
122
  },
108
123
  ".rdp-day_button": {
109
- height: "28px",
110
- width: "28px",
124
+ height: "32px",
125
+ width: "32px",
111
126
  borderRadius: "$sm",
112
127
  fontSize: "$14",
113
128
  color: "$text",
@@ -115,10 +130,13 @@ export const DayPickerWrapperStyled = styled("div", {
115
130
  border: "1px solid transparent",
116
131
  transition: "all 0.2s ease-in-out",
117
132
  cursor: "pointer",
133
+ display: "flex",
134
+ alignItems: "center",
135
+ justifyContent: "center",
118
136
  },
119
137
  ".rdp-day_button:hover": {
120
138
  backgroundColor: "$dark100",
121
- borderColor: "$brand500",
139
+ borderColor: "$brand600",
122
140
  },
123
141
  ".rdp-day.rdp-disabled .rdp-day_button:hover": {
124
142
  backgroundColor: "transparent",
@@ -196,7 +214,8 @@ export const DayPickerWrapperStyled = styled("div", {
196
214
  ".rdp-day.rdp-selected .rdp-day_button": {
197
215
  backgroundColor: "$brand500",
198
216
  color: "$neutral50",
199
- borderColor: "$brand500",
217
+ borderColor: "$brand600",
218
+ borderRadius: "0.5rem",
200
219
  },
201
220
  ".rdp-dropdowns": {
202
221
  display: "flex",
@@ -4,7 +4,7 @@ import { FormLabel } from "./subComponents/FormLabel";
4
4
  import { ErrorFormMessage } from "./subComponents/ErrorFormMessage";
5
5
  import { Calendar, CalendarProps } from "../Calendar";
6
6
  import { TimePicker, TimePickerProps } from "../TimePicker";
7
- import { useCallback, useMemo } from "react";
7
+ import { useCallback, useEffect, useMemo, useState } from "react";
8
8
 
9
9
  export type DateAndTimeFormFieldProps = Omit<
10
10
  CalendarProps,
@@ -66,25 +66,33 @@ export const DateAndTimeFormField = ({
66
66
 
67
67
  const { value: isoValue, onChange: setIsoValue } = field;
68
68
 
69
- const { selectedDate, selectedTime } = useMemo(() => {
70
- if (!isoValue) return { selectedDate: undefined, selectedTime: undefined };
69
+ const { selectedDateFromIso, selectedTimeFromIso } = useMemo(() => {
70
+ if (!isoValue) return { selectedDateFromIso: undefined, selectedTimeFromIso: undefined };
71
71
 
72
72
  try {
73
73
  const date = new Date(isoValue);
74
74
  if (isNaN(date.getTime())) {
75
- return { selectedDate: undefined, selectedTime: undefined };
75
+ return { selectedDateFromIso: undefined, selectedTimeFromIso: undefined };
76
76
  }
77
77
 
78
78
  const hours = String(date.getHours()).padStart(2, "0");
79
79
  const minutes = String(date.getMinutes()).padStart(2, "0");
80
80
  const time = `${hours}:${minutes}`;
81
81
 
82
- return { selectedDate: date, selectedTime: time };
82
+ return { selectedDateFromIso: date, selectedTimeFromIso: time };
83
83
  } catch {
84
- return { selectedDate: undefined, selectedTime: undefined };
84
+ return { selectedDateFromIso: undefined, selectedTimeFromIso: undefined };
85
85
  }
86
86
  }, [isoValue]);
87
87
 
88
+ const [draftDate, setDraftDate] = useState<Date | undefined>(selectedDateFromIso);
89
+ const [draftTime, setDraftTime] = useState<string | undefined>(selectedTimeFromIso);
90
+
91
+ useEffect(() => {
92
+ setDraftDate(selectedDateFromIso);
93
+ setDraftTime(selectedTimeFromIso);
94
+ }, [selectedDateFromIso, selectedTimeFromIso]);
95
+
88
96
  const combineDateTime = useCallback(
89
97
  (date?: Date, time?: string) => {
90
98
  if (!date || !time) {
@@ -102,11 +110,13 @@ export const DateAndTimeFormField = ({
102
110
  );
103
111
 
104
112
  const handleDateChange = (date: Date | undefined) => {
105
- combineDateTime(date, selectedTime);
113
+ setDraftDate(date);
114
+ combineDateTime(date, draftTime);
106
115
  };
107
116
 
108
117
  const handleTimeChange = (time: string | undefined) => {
109
- combineDateTime(selectedDate, time);
118
+ setDraftTime(time);
119
+ combineDateTime(draftDate, time);
110
120
  };
111
121
 
112
122
  return (
@@ -123,9 +133,9 @@ export const DateAndTimeFormField = ({
123
133
  <Flex gap={12} align="start">
124
134
  <Flex direction="column">
125
135
  <Calendar
126
- selected={selectedDate}
136
+ selected={draftDate}
127
137
  setSelected={(date) => {
128
- const d = typeof date === "function" ? date(selectedDate) : date;
138
+ const d = typeof date === "function" ? date(draftDate) : date;
129
139
  handleDateChange(d);
130
140
  }}
131
141
  hasError={haveError}
@@ -138,9 +148,9 @@ export const DateAndTimeFormField = ({
138
148
 
139
149
  <Flex direction="column">
140
150
  <TimePicker
141
- selected={selectedTime}
151
+ selected={draftTime}
142
152
  setSelected={(value) => {
143
- const time = typeof value === "function" ? value(selectedTime) : value;
153
+ const time = typeof value === "function" ? value(draftTime) : value;
144
154
  handleTimeChange(time);
145
155
  }}
146
156
  hasError={haveError}
@@ -154,4 +164,4 @@ export const DateAndTimeFormField = ({
154
164
  );
155
165
  };
156
166
 
157
- export default DateAndTimeFormField
167
+ export default DateAndTimeFormField
@@ -222,7 +222,7 @@ export function TimePicker({
222
222
  color={hasError ? "error" : "default"}
223
223
  >
224
224
  <TextFieldSlot>
225
- <Icon name="clock" size="xl" />
225
+ <Icon name="clock" size="xl" color="#4C4F54" />
226
226
  </TextFieldSlot>
227
227
  </TextField>
228
228
  </TimePickerButtonStyled>