@abgov/react-components 6.9.3-dev.1 → 6.9.3-next.1

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,
@@ -664,6 +668,11 @@ function GoabDatePicker({
664
668
  onChange
665
669
  }) {
666
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
+ }, []);
667
676
  useEffect(() => {
668
677
  if (!ref.current) {
669
678
  return;
@@ -694,12 +703,12 @@ function GoabDatePicker({
694
703
  {
695
704
  ref,
696
705
  name,
697
- value: formatValue(value),
706
+ value: formatValue(value) || void 0,
698
707
  type,
699
708
  error: error ? "true" : void 0,
700
709
  disabled: disabled ? "true" : void 0,
701
- min: formatValue(min),
702
- max: formatValue(max),
710
+ min: formatValue(min) || void 0,
711
+ max: formatValue(max) || void 0,
703
712
  testid: testId,
704
713
  mt,
705
714
  mr,