@coopdigital/react 1.1.2 → 1.1.3

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.
@@ -44,8 +44,10 @@ const DatePicker = ({ className, closeOnSelect = true, dateFormat = "dd/MM/yyyy"
44
44
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
45
45
  const uid = useId(id);
46
46
  initialDate = getInitialDate(mode, initialDate);
47
- startDate = useMemo(() => startDate !== null && startDate !== void 0 ? startDate : getStartDate(initialDate), [initialDate, startDate]);
48
- endDate = useMemo(() => endDate !== null && endDate !== void 0 ? endDate : getEndDate(initialDate), [initialDate, endDate]);
47
+ const startDateProp = startDate;
48
+ const endDateProp = endDate;
49
+ startDate = useMemo(() => startDateProp !== null && startDateProp !== void 0 ? startDateProp : getStartDate(initialDate), [initialDate, startDateProp]);
50
+ endDate = useMemo(() => endDateProp !== null && endDateProp !== void 0 ? endDateProp : getEndDate(initialDate), [initialDate, endDateProp]);
49
51
  const defaultMonth = useMemo(() => getDefaultMonth(initialDate), [initialDate]);
50
52
  let initialValues = {
51
53
  state: undefined,
@@ -17,8 +17,6 @@ const Pill = ({ as, children, className, href, ref, size = "md", ...props }) =>
17
17
  href,
18
18
  ...props,
19
19
  };
20
- // https://github.com/facebook/react/issues/34775
21
- // eslint-disable-next-line react-hooks/refs
22
20
  return React.createElement(element, { ...componentProps, ref }, slots.PillBadge, slots.Children);
23
21
  };
24
22
  const PillBadge = ({ children, className }) => {
@@ -21,7 +21,7 @@ const defaultButtonText = React.createElement(SearchIcon, {
21
21
  width: 24,
22
22
  });
23
23
  const Searchbox = ({ action, children, className, id, label, labelVisible = false, onSubmit, ref, size = "md", variant = "solid", ...props }) => {
24
- const slots = useSlots(componentSlots, children);
24
+ const slots = { ...useSlots(componentSlots, children) };
25
25
  const [isPending, setIsPending] = useState(false);
26
26
  const uid = useId(id);
27
27
  const handleSubmit = useCallback(async (event) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -89,5 +89,5 @@
89
89
  "clsx": "^2.1.1",
90
90
  "react-day-picker": "^9.12.0"
91
91
  },
92
- "gitHead": "773259f20340eb832f4ec5a5241df5140f34ab43"
92
+ "gitHead": "fd986750a8a2cbc8d0540f7d6d4345984eb8ce85"
93
93
  }
@@ -186,8 +186,14 @@ export const DatePicker = ({
186
186
 
187
187
  initialDate = getInitialDate(mode, initialDate)
188
188
 
189
- startDate = useMemo(() => startDate ?? getStartDate(initialDate), [initialDate, startDate])
190
- endDate = useMemo(() => endDate ?? getEndDate(initialDate), [initialDate, endDate])
189
+ const startDateProp = startDate
190
+ const endDateProp = endDate
191
+
192
+ startDate = useMemo(
193
+ () => startDateProp ?? getStartDate(initialDate),
194
+ [initialDate, startDateProp]
195
+ )
196
+ endDate = useMemo(() => endDateProp ?? getEndDate(initialDate), [initialDate, endDateProp])
191
197
 
192
198
  const defaultMonth = useMemo(() => getDefaultMonth(initialDate), [initialDate])
193
199
 
@@ -55,8 +55,6 @@ export const Pill = ({
55
55
  ...props,
56
56
  }
57
57
 
58
- // https://github.com/facebook/react/issues/34775
59
- // eslint-disable-next-line react-hooks/refs
60
58
  return React.createElement(element, { ...componentProps, ref }, slots.PillBadge, slots.Children)
61
59
  }
62
60
 
@@ -65,7 +65,7 @@ export const Searchbox = ({
65
65
  variant = "solid",
66
66
  ...props
67
67
  }: SearchboxProps): JSX.Element => {
68
- const slots = useSlots(componentSlots, children)
68
+ const slots = { ...useSlots(componentSlots, children) }
69
69
 
70
70
  const [isPending, setIsPending] = useState(false)
71
71
  const uid = useId(id)