@bbl-digital/snorre 2.4.11 → 2.4.12

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/dist/bundle.js CHANGED
@@ -26113,23 +26113,12 @@
26113
26113
  const fromPickerRef = React.useRef(null);
26114
26114
  const toPickerRef = React.useRef(null);
26115
26115
  const currentYear = new Date().getFullYear();
26116
- const minDateAvailable = new Date(currentYear - 100, 0);
26117
- const maxDateAvailable = maxDate ? new Date(maxDate) : new Date(currentYear, 11, 31);
26116
+ const minDateAvailable = new Date(currentYear - 100, 0, 0);
26117
+ const maxDateAvailable = maxDate ? new Date(maxDate) : new Date(currentYear + 5, 11, 31);
26118
26118
  const [dates, setDates] = React.useState({
26119
26119
  to: undefined,
26120
26120
  from: undefined
26121
26121
  });
26122
-
26123
- const showFromMonth = () => {
26124
- if (!dates.from) return;
26125
- const toMonth = dates.from.getMonth() + 1;
26126
- const fromMonth = dates.from.getMonth() + 1;
26127
-
26128
- if (fromMonth - toMonth < 2) {
26129
- toPickerRef.current?.getDayPicker().showMonth(dates.from);
26130
- }
26131
- };
26132
-
26133
26122
  React.useEffect(() => {
26134
26123
  if (isMobile && fromPickerRef) fromPickerRef.current.input.readOnly = true;
26135
26124
  }, [isMobile, fromPickerRef]);
@@ -26155,7 +26144,8 @@
26155
26144
  setDates(prev => ({ ...prev,
26156
26145
  [key]: e
26157
26146
  }));
26158
- showFromMonth();
26147
+ if (key === 'to') toPickerRef.current?.getDayPicker().showMonth(e);
26148
+ if (key === 'from') fromPickerRef.current?.getDayPicker().showMonth(e);
26159
26149
  }
26160
26150
  }) : undefined,
26161
26151
  // custom
@@ -30,23 +30,12 @@ const DatePickerRange = ({
30
30
  const fromPickerRef = useRef(null);
31
31
  const toPickerRef = useRef(null);
32
32
  const currentYear = new Date().getFullYear();
33
- const minDateAvailable = new Date(currentYear - 100, 0);
34
- const maxDateAvailable = maxDate ? new Date(maxDate) : new Date(currentYear, 11, 31);
33
+ const minDateAvailable = new Date(currentYear - 100, 0, 0);
34
+ const maxDateAvailable = maxDate ? new Date(maxDate) : new Date(currentYear + 5, 11, 31);
35
35
  const [dates, setDates] = useState({
36
36
  to: undefined,
37
37
  from: undefined
38
38
  });
39
-
40
- const showFromMonth = () => {
41
- if (!dates.from) return;
42
- const toMonth = dates.from.getMonth() + 1;
43
- const fromMonth = dates.from.getMonth() + 1;
44
-
45
- if (fromMonth - toMonth < 2) {
46
- toPickerRef.current?.getDayPicker().showMonth(dates.from);
47
- }
48
- };
49
-
50
39
  useEffect(() => {
51
40
  if (isMobile && fromPickerRef) fromPickerRef.current.input.readOnly = true;
52
41
  }, [isMobile, fromPickerRef]);
@@ -72,7 +61,8 @@ const DatePickerRange = ({
72
61
  setDates(prev => ({ ...prev,
73
62
  [key]: e
74
63
  }));
75
- showFromMonth();
64
+ if (key === 'to') toPickerRef.current?.getDayPicker().showMonth(e);
65
+ if (key === 'from') fromPickerRef.current?.getDayPicker().showMonth(e);
76
66
  }
77
67
  }) : undefined,
78
68
  // custom
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/DatepickerRange/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAwBjD,UAAU,MAAM;IACd,0BAA0B;IAC1B,KAAK,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC,6BAA6B;IAC7B,KAAK,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,CAAA;IAClC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB;IACtB,cAAc,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,M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,CAAC,EAAE,IAAI,CAAA;KAAE,CAAA;IAClC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB;IACtB,cAAc,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/C,2BAA2B;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IAC3C,6BAA6B;IAC7B,aAAa,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,uCAAuC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,KAAK,IAAI,CAAA;IACrD,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,uCAAuC;IACvC,GAAG,CAAC,EAAE,gBAAgB,CAAA;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAID,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAgKrC,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -30,23 +30,12 @@ const DatePickerRange = ({
30
30
  const fromPickerRef = useRef(null);
31
31
  const toPickerRef = useRef(null);
32
32
  const currentYear = new Date().getFullYear();
33
- const minDateAvailable = new Date(currentYear - 100, 0);
34
- const maxDateAvailable = maxDate ? new Date(maxDate) : new Date(currentYear, 11, 31);
33
+ const minDateAvailable = new Date(currentYear - 100, 0, 0);
34
+ const maxDateAvailable = maxDate ? new Date(maxDate) : new Date(currentYear + 5, 11, 31);
35
35
  const [dates, setDates] = useState({
36
36
  to: undefined,
37
37
  from: undefined
38
38
  });
39
-
40
- const showFromMonth = () => {
41
- if (!dates.from) return;
42
- const toMonth = dates.from.getMonth() + 1;
43
- const fromMonth = dates.from.getMonth() + 1;
44
-
45
- if (fromMonth - toMonth < 2) {
46
- toPickerRef.current?.getDayPicker().showMonth(dates.from);
47
- }
48
- };
49
-
50
39
  useEffect(() => {
51
40
  if (isMobile && fromPickerRef) fromPickerRef.current.input.readOnly = true;
52
41
  }, [isMobile, fromPickerRef]);
@@ -72,7 +61,8 @@ const DatePickerRange = ({
72
61
  setDates(prev => ({ ...prev,
73
62
  [key]: e
74
63
  }));
75
- showFromMonth();
64
+ if (key === 'to') toPickerRef.current?.getDayPicker().showMonth(e);
65
+ if (key === 'from') fromPickerRef.current?.getDayPicker().showMonth(e);
76
66
  }
77
67
  }) : undefined,
78
68
  // custom
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.4.11",
3
+ "version": "2.4.12",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",