@abgov/react-components 6.9.2 → 6.9.3-dev.2

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/index.mjs CHANGED
@@ -365,21 +365,25 @@ function GoabCalendar({
365
365
  return;
366
366
  }
367
367
  const current = ref.current;
368
- current.addEventListener("_change", (e) => {
368
+ const listener = (e) => {
369
369
  onChange({
370
370
  name: name || "",
371
371
  value: e.detail.value
372
372
  });
373
- });
374
- });
373
+ };
374
+ current.addEventListener("_change", listener);
375
+ return () => {
376
+ current.removeEventListener("_change", listener);
377
+ };
378
+ }, []);
375
379
  return /* @__PURE__ */ jsx(
376
380
  "goa-calendar",
377
381
  {
378
382
  ref,
379
383
  name,
380
- value: value == null ? void 0 : value.toISOString(),
381
- min: min == null ? void 0 : min.toISOString(),
382
- max: max == null ? void 0 : max.toISOString(),
384
+ value,
385
+ min: min || void 0,
386
+ max: max || void 0,
383
387
  testid: testId,
384
388
  mt,
385
389
  mr,
@@ -660,9 +664,15 @@ function GoabDatePicker({
660
664
  mb,
661
665
  ml,
662
666
  relative,
667
+ width,
663
668
  onChange
664
669
  }) {
665
670
  const ref = useRef(null);
671
+ useEffect(() => {
672
+ if (value && typeof value !== "string") {
673
+ console.warn("Using a `Date` type for value is deprecated. Instead use a string of the format `yyyy-mm-dd`");
674
+ }
675
+ }, []);
666
676
  useEffect(() => {
667
677
  if (!ref.current) {
668
678
  return;
@@ -693,18 +703,19 @@ function GoabDatePicker({
693
703
  {
694
704
  ref,
695
705
  name,
696
- value: formatValue(value),
706
+ value: formatValue(value) || void 0,
697
707
  type,
698
708
  error: error ? "true" : void 0,
699
709
  disabled: disabled ? "true" : void 0,
700
- min: formatValue(min),
701
- max: formatValue(max),
710
+ min: formatValue(min) || void 0,
711
+ max: formatValue(max) || void 0,
702
712
  testid: testId,
703
713
  mt,
704
714
  mr,
705
715
  mb,
706
716
  ml,
707
- relative: relative ? "true" : void 0
717
+ relative: relative ? "true" : void 0,
718
+ width
708
719
  }
709
720
  );
710
721
  }