@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.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,
@@ -662,9 +666,15 @@ function GoabDatePicker({
662
666
  mb,
663
667
  ml,
664
668
  relative,
669
+ width,
665
670
  onChange
666
671
  }) {
667
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
+ }, []);
668
678
  react.useEffect(() => {
669
679
  if (!ref.current) {
670
680
  return;
@@ -695,18 +705,19 @@ function GoabDatePicker({
695
705
  {
696
706
  ref,
697
707
  name,
698
- value: formatValue(value),
708
+ value: formatValue(value) || void 0,
699
709
  type,
700
710
  error: error ? "true" : void 0,
701
711
  disabled: disabled ? "true" : void 0,
702
- min: formatValue(min),
703
- max: formatValue(max),
712
+ min: formatValue(min) || void 0,
713
+ max: formatValue(max) || void 0,
704
714
  testid: testId,
705
715
  mt,
706
716
  mr,
707
717
  mb,
708
718
  ml,
709
- relative: relative ? "true" : void 0
719
+ relative: relative ? "true" : void 0,
720
+ width
710
721
  }
711
722
  );
712
723
  }