@abgov/react-components 6.9.3-dev.1 → 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.js CHANGED
@@ -367,21 +367,25 @@ function GoabCalendar({
367
367
  return;
368
368
  }
369
369
  const current = ref.current;
370
- current.addEventListener("_change", (e) => {
370
+ const listener = (e) => {
371
371
  onChange({
372
372
  name: name || "",
373
373
  value: e.detail.value
374
374
  });
375
- });
376
- });
375
+ };
376
+ current.addEventListener("_change", listener);
377
+ return () => {
378
+ current.removeEventListener("_change", listener);
379
+ };
380
+ }, []);
377
381
  return /* @__PURE__ */ jsxRuntime.jsx(
378
382
  "goa-calendar",
379
383
  {
380
384
  ref,
381
385
  name,
382
- value: value == null ? void 0 : value.toISOString(),
383
- min: min == null ? void 0 : min.toISOString(),
384
- max: max == null ? void 0 : max.toISOString(),
386
+ value,
387
+ min: min || void 0,
388
+ max: max || void 0,
385
389
  testid: testId,
386
390
  mt,
387
391
  mr,
@@ -666,6 +670,11 @@ function GoabDatePicker({
666
670
  onChange
667
671
  }) {
668
672
  const ref = react.useRef(null);
673
+ react.useEffect(() => {
674
+ if (value && typeof value !== "string") {
675
+ console.warn("Using a `Date` type for value is deprecated. Instead use a string of the format `yyyy-mm-dd`");
676
+ }
677
+ }, []);
669
678
  react.useEffect(() => {
670
679
  if (!ref.current) {
671
680
  return;
@@ -696,12 +705,12 @@ function GoabDatePicker({
696
705
  {
697
706
  ref,
698
707
  name,
699
- value: formatValue(value),
708
+ value: formatValue(value) || void 0,
700
709
  type,
701
710
  error: error ? "true" : void 0,
702
711
  disabled: disabled ? "true" : void 0,
703
- min: formatValue(min),
704
- max: formatValue(max),
712
+ min: formatValue(min) || void 0,
713
+ max: formatValue(max) || void 0,
705
714
  testid: testId,
706
715
  mt,
707
716
  mr,