@lets-events/react 12.8.3 → 12.8.5

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.3 build
3
+ > @lets-events/react@12.8.5 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
- CJS dist/index.js 411.36 KB
14
- CJS ⚡️ Build success in 459ms
15
- ESM dist/index.mjs 395.98 KB
16
- ESM ⚡️ Build success in 460ms
13
+ CJS dist/index.js 413.65 KB
14
+ CJS ⚡️ Build success in 336ms
15
+ ESM dist/index.mjs 398.23 KB
16
+ ESM ⚡️ Build success in 337ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 8332ms
19
- DTS dist/index.d.mts 404.05 KB
20
- DTS dist/index.d.ts 404.05 KB
18
+ DTS ⚡️ Build success in 6837ms
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.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Calendar layout
8
+
9
+ ## 12.8.4
10
+
11
+ ### Patch Changes
12
+
13
+ - MultiSelect ShowMoreButton
14
+
3
15
  ## 12.8.3
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;
@@ -13548,6 +13549,9 @@ type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
13548
13549
  selectedAllOptions?: boolean;
13549
13550
  selectedAllText?: string;
13550
13551
  selectedScroll?: boolean;
13552
+ showMoreButton?: boolean;
13553
+ showMoreButtonLabel?: string;
13554
+ showMoreButtonOnClick?: () => void;
13551
13555
  };
13552
13556
  declare const MultiSelect: React__default.ForwardRefExoticComponent<Omit<MultiSelectProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
13553
13557
 
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;
@@ -13548,6 +13549,9 @@ type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
13548
13549
  selectedAllOptions?: boolean;
13549
13550
  selectedAllText?: string;
13550
13551
  selectedScroll?: boolean;
13552
+ showMoreButton?: boolean;
13553
+ showMoreButtonLabel?: string;
13554
+ showMoreButtonOnClick?: () => void;
13551
13555
  };
13552
13556
  declare const MultiSelect: React__default.ForwardRefExoticComponent<Omit<MultiSelectProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
13553
13557
 
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",
@@ -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",
@@ -9928,7 +9949,10 @@ var MultiSelect = import_react18.default.forwardRef(
9928
9949
  maxHeight,
9929
9950
  selectedAllOptions = false,
9930
9951
  selectedAllText,
9931
- selectedScroll = false
9952
+ selectedScroll = false,
9953
+ showMoreButton = false,
9954
+ showMoreButtonLabel = "Carregar mais",
9955
+ showMoreButtonOnClick
9932
9956
  }, fowardedRef) => {
9933
9957
  const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
9934
9958
  const triggerRef = (0, import_react18.useRef)(null);
@@ -10056,19 +10080,51 @@ var MultiSelect = import_react18.default.forwardRef(
10056
10080
  ]
10057
10081
  }
10058
10082
  ),
10059
- options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i))
10083
+ options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
10084
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10085
+ Button,
10086
+ {
10087
+ variant: "menuDropdownItem",
10088
+ color: "brand",
10089
+ onClick: showMoreButtonOnClick,
10090
+ fontWeight: "semibold",
10091
+ type: "button",
10092
+ css: {
10093
+ justifyContent: "flex-start",
10094
+ color: "var(--colors-brand500)!important"
10095
+ },
10096
+ children: showMoreButtonLabel
10097
+ }
10098
+ )
10060
10099
  ]
10061
10100
  }
10062
10101
  )
10063
10102
  }
10064
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10103
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10065
10104
  StyledFlexWithMaxHeight,
10066
10105
  {
10067
10106
  direction: "column",
10068
10107
  gap: 8,
10069
10108
  hasMaxHeight: !!maxHeight,
10070
10109
  style: maxHeight ? { maxHeight } : void 0,
10071
- children: options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i))
10110
+ children: [
10111
+ options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
10112
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10113
+ Button,
10114
+ {
10115
+ variant: "menuDropdownItem",
10116
+ color: "brand",
10117
+ onClick: showMoreButtonOnClick,
10118
+ fontWeight: "semibold",
10119
+ type: "button",
10120
+ css: {
10121
+ justifyContent: "flex-start",
10122
+ color: "var(--colors-brand500)!important"
10123
+ },
10124
+ children: showMoreButtonLabel
10125
+ }
10126
+ )
10127
+ ]
10072
10128
  }
10073
10129
  )
10074
10130
  }
@@ -13368,21 +13424,27 @@ var DateAndTimeFormField = (_a) => {
13368
13424
  const haveError = !!fieldError;
13369
13425
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
13370
13426
  const { value: isoValue, onChange: setIsoValue } = field;
13371
- const { selectedDate, selectedTime } = (0, import_react28.useMemo)(() => {
13372
- 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 };
13373
13429
  try {
13374
13430
  const date = new Date(isoValue);
13375
13431
  if (isNaN(date.getTime())) {
13376
- return { selectedDate: void 0, selectedTime: void 0 };
13432
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13377
13433
  }
13378
13434
  const hours = String(date.getHours()).padStart(2, "0");
13379
13435
  const minutes = String(date.getMinutes()).padStart(2, "0");
13380
13436
  const time = `${hours}:${minutes}`;
13381
- return { selectedDate: date, selectedTime: time };
13437
+ return { selectedDateFromIso: date, selectedTimeFromIso: time };
13382
13438
  } catch (e) {
13383
- return { selectedDate: void 0, selectedTime: void 0 };
13439
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13384
13440
  }
13385
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]);
13386
13448
  const combineDateTime = (0, import_react28.useCallback)(
13387
13449
  (date, time) => {
13388
13450
  if (!date || !time) {
@@ -13397,10 +13459,12 @@ var DateAndTimeFormField = (_a) => {
13397
13459
  [setIsoValue]
13398
13460
  );
13399
13461
  const handleDateChange = (date) => {
13400
- combineDateTime(date, selectedTime);
13462
+ setDraftDate(date);
13463
+ combineDateTime(date, draftTime);
13401
13464
  };
13402
13465
  const handleTimeChange = (time) => {
13403
- combineDateTime(selectedDate, time);
13466
+ setDraftTime(time);
13467
+ combineDateTime(draftDate, time);
13404
13468
  };
13405
13469
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { direction: "column", children: [
13406
13470
  label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
@@ -13416,9 +13480,9 @@ var DateAndTimeFormField = (_a) => {
13416
13480
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Flex, { direction: "column", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13417
13481
  Calendar,
13418
13482
  __spreadValues({
13419
- selected: selectedDate,
13483
+ selected: draftDate,
13420
13484
  setSelected: (date) => {
13421
- const d = typeof date === "function" ? date(selectedDate) : date;
13485
+ const d = typeof date === "function" ? date(draftDate) : date;
13422
13486
  handleDateChange(d);
13423
13487
  },
13424
13488
  hasError: haveError,
@@ -13430,9 +13494,9 @@ var DateAndTimeFormField = (_a) => {
13430
13494
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Flex, { direction: "column", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
13431
13495
  TimePicker,
13432
13496
  __spreadValues({
13433
- selected: selectedTime,
13497
+ selected: draftTime,
13434
13498
  setSelected: (value) => {
13435
- const time = typeof value === "function" ? value(selectedTime) : value;
13499
+ const time = typeof value === "function" ? value(draftTime) : value;
13436
13500
  handleTimeChange(time);
13437
13501
  },
13438
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",
@@ -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",
@@ -9816,7 +9837,10 @@ var MultiSelect = React10.forwardRef(
9816
9837
  maxHeight,
9817
9838
  selectedAllOptions = false,
9818
9839
  selectedAllText,
9819
- selectedScroll = false
9840
+ selectedScroll = false,
9841
+ showMoreButton = false,
9842
+ showMoreButtonLabel = "Carregar mais",
9843
+ showMoreButtonOnClick
9820
9844
  }, fowardedRef) => {
9821
9845
  const [isOpen, setIsOpen] = useState8(false);
9822
9846
  const triggerRef = useRef8(null);
@@ -9944,19 +9968,51 @@ var MultiSelect = React10.forwardRef(
9944
9968
  ]
9945
9969
  }
9946
9970
  ),
9947
- options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i))
9971
+ options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i)),
9972
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ jsx27(
9973
+ Button,
9974
+ {
9975
+ variant: "menuDropdownItem",
9976
+ color: "brand",
9977
+ onClick: showMoreButtonOnClick,
9978
+ fontWeight: "semibold",
9979
+ type: "button",
9980
+ css: {
9981
+ justifyContent: "flex-start",
9982
+ color: "var(--colors-brand500)!important"
9983
+ },
9984
+ children: showMoreButtonLabel
9985
+ }
9986
+ )
9948
9987
  ]
9949
9988
  }
9950
9989
  )
9951
9990
  }
9952
- ) : /* @__PURE__ */ jsx27(
9991
+ ) : /* @__PURE__ */ jsxs16(
9953
9992
  StyledFlexWithMaxHeight,
9954
9993
  {
9955
9994
  direction: "column",
9956
9995
  gap: 8,
9957
9996
  hasMaxHeight: !!maxHeight,
9958
9997
  style: maxHeight ? { maxHeight } : void 0,
9959
- children: options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i))
9998
+ children: [
9999
+ options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, i)),
10000
+ showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ jsx27(
10001
+ Button,
10002
+ {
10003
+ variant: "menuDropdownItem",
10004
+ color: "brand",
10005
+ onClick: showMoreButtonOnClick,
10006
+ fontWeight: "semibold",
10007
+ type: "button",
10008
+ css: {
10009
+ justifyContent: "flex-start",
10010
+ color: "var(--colors-brand500)!important"
10011
+ },
10012
+ children: showMoreButtonLabel
10013
+ }
10014
+ )
10015
+ ]
9960
10016
  }
9961
10017
  )
9962
10018
  }
@@ -13214,7 +13270,7 @@ var TimePickerFormField = (_a) => {
13214
13270
 
13215
13271
  // src/components/FormFields/DateAndTimeFormField.tsx
13216
13272
  import { useController as useController7 } from "react-hook-form";
13217
- 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";
13218
13274
  import { jsx as jsx59, jsxs as jsxs33 } from "react/jsx-runtime";
13219
13275
  var DateAndTimeFormField = (_a) => {
13220
13276
  var _b = _a, {
@@ -13261,21 +13317,27 @@ var DateAndTimeFormField = (_a) => {
13261
13317
  const haveError = !!fieldError;
13262
13318
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
13263
13319
  const { value: isoValue, onChange: setIsoValue } = field;
13264
- const { selectedDate, selectedTime } = useMemo4(() => {
13265
- if (!isoValue) return { selectedDate: void 0, selectedTime: void 0 };
13320
+ const { selectedDateFromIso, selectedTimeFromIso } = useMemo4(() => {
13321
+ if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13266
13322
  try {
13267
13323
  const date = new Date(isoValue);
13268
13324
  if (isNaN(date.getTime())) {
13269
- return { selectedDate: void 0, selectedTime: void 0 };
13325
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13270
13326
  }
13271
13327
  const hours = String(date.getHours()).padStart(2, "0");
13272
13328
  const minutes = String(date.getMinutes()).padStart(2, "0");
13273
13329
  const time = `${hours}:${minutes}`;
13274
- return { selectedDate: date, selectedTime: time };
13330
+ return { selectedDateFromIso: date, selectedTimeFromIso: time };
13275
13331
  } catch (e) {
13276
- return { selectedDate: void 0, selectedTime: void 0 };
13332
+ return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13277
13333
  }
13278
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]);
13279
13341
  const combineDateTime = useCallback8(
13280
13342
  (date, time) => {
13281
13343
  if (!date || !time) {
@@ -13290,10 +13352,12 @@ var DateAndTimeFormField = (_a) => {
13290
13352
  [setIsoValue]
13291
13353
  );
13292
13354
  const handleDateChange = (date) => {
13293
- combineDateTime(date, selectedTime);
13355
+ setDraftDate(date);
13356
+ combineDateTime(date, draftTime);
13294
13357
  };
13295
13358
  const handleTimeChange = (time) => {
13296
- combineDateTime(selectedDate, time);
13359
+ setDraftTime(time);
13360
+ combineDateTime(draftDate, time);
13297
13361
  };
13298
13362
  return /* @__PURE__ */ jsxs33(Flex, { direction: "column", children: [
13299
13363
  label && /* @__PURE__ */ jsx59(
@@ -13309,9 +13373,9 @@ var DateAndTimeFormField = (_a) => {
13309
13373
  /* @__PURE__ */ jsx59(Flex, { direction: "column", children: /* @__PURE__ */ jsx59(
13310
13374
  Calendar,
13311
13375
  __spreadValues({
13312
- selected: selectedDate,
13376
+ selected: draftDate,
13313
13377
  setSelected: (date) => {
13314
- const d = typeof date === "function" ? date(selectedDate) : date;
13378
+ const d = typeof date === "function" ? date(draftDate) : date;
13315
13379
  handleDateChange(d);
13316
13380
  },
13317
13381
  hasError: haveError,
@@ -13323,9 +13387,9 @@ var DateAndTimeFormField = (_a) => {
13323
13387
  /* @__PURE__ */ jsx59(Flex, { direction: "column", children: /* @__PURE__ */ jsx59(
13324
13388
  TimePicker,
13325
13389
  __spreadValues({
13326
- selected: selectedTime,
13390
+ selected: draftTime,
13327
13391
  setSelected: (value) => {
13328
- const time = typeof value === "function" ? value(selectedTime) : value;
13392
+ const time = typeof value === "function" ? value(draftTime) : value;
13329
13393
  handleTimeChange(time);
13330
13394
  },
13331
13395
  hasError: haveError
@@ -13337,11 +13401,11 @@ var DateAndTimeFormField = (_a) => {
13337
13401
  };
13338
13402
 
13339
13403
  // src/hooks/useImageUpload.ts
13340
- import { useState as useState13, useCallback as useCallback9 } from "react";
13404
+ import { useState as useState14, useCallback as useCallback9 } from "react";
13341
13405
  var useImageUpload = (options) => {
13342
- const [isUploading, setIsUploading] = useState13(false);
13343
- const [progress, setProgress] = useState13(null);
13344
- const [error, setError] = useState13(null);
13406
+ const [isUploading, setIsUploading] = useState14(false);
13407
+ const [progress, setProgress] = useState14(null);
13408
+ const [error, setError] = useState14(null);
13345
13409
  const {
13346
13410
  onSuccess,
13347
13411
  onError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.8.3",
3
+ "version": "12.8.5",
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,
@@ -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
@@ -11,6 +11,7 @@ import {
11
11
  import { colors } from "@lets-events/tokens";
12
12
  import { ComponentProps, useMemo } from "react";
13
13
  import { Flex } from "../Flex";
14
+ import { Button } from "../Button";
14
15
  import { CloseBtnStyled, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
15
16
 
16
17
  export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
@@ -31,6 +32,9 @@ export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
31
32
  selectedAllOptions?: boolean;
32
33
  selectedAllText?: string;
33
34
  selectedScroll?: boolean;
35
+ showMoreButton?: boolean;
36
+ showMoreButtonLabel?: string;
37
+ showMoreButtonOnClick?: () => void;
34
38
  };
35
39
 
36
40
  export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
@@ -50,7 +54,10 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
50
54
  maxHeight,
51
55
  selectedAllOptions = false,
52
56
  selectedAllText,
53
- selectedScroll = false
57
+ selectedScroll = false,
58
+ showMoreButton = false,
59
+ showMoreButtonLabel = "Carregar mais",
60
+ showMoreButtonOnClick
54
61
  },
55
62
  fowardedRef
56
63
  ) => {
@@ -182,6 +189,21 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
182
189
  <Text typography={"labelSmall"}>{label}</Text>
183
190
  </CheckboxItem>
184
191
  ))}
192
+ {showMoreButton && showMoreButtonOnClick && (
193
+ <Button
194
+ variant="menuDropdownItem"
195
+ color="brand"
196
+ onClick={showMoreButtonOnClick}
197
+ fontWeight="semibold"
198
+ type="button"
199
+ css={{
200
+ justifyContent: "flex-start",
201
+ color: "var(--colors-brand500)!important",
202
+ }}
203
+ >
204
+ {showMoreButtonLabel}
205
+ </Button>
206
+ )}
185
207
  </StyledFlexWithMaxHeight>
186
208
  </CheckboxGroup>
187
209
  ) : (
@@ -196,6 +218,21 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
196
218
  <Text typography={"labelSmall"}>{label}</Text>
197
219
  </StyledItem>
198
220
  ))}
221
+ {showMoreButton && showMoreButtonOnClick && (
222
+ <Button
223
+ variant="menuDropdownItem"
224
+ color="brand"
225
+ onClick={showMoreButtonOnClick}
226
+ fontWeight="semibold"
227
+ type="button"
228
+ css={{
229
+ justifyContent: "flex-start",
230
+ color: "var(--colors-brand500)!important",
231
+ }}
232
+ >
233
+ {showMoreButtonLabel}
234
+ </Button>
235
+ )}
199
236
  </StyledFlexWithMaxHeight>
200
237
  )}
201
238
  </StyledContent>