@bbl-digital/snorre 3.0.4 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/dist/bundle.js +204 -96
  2. package/esm/core/Autocomplete/hooks/useAutocomplete.js +242 -0
  3. package/esm/core/Autocomplete/hooks/useHandleDimentions.js +19 -0
  4. package/esm/core/Autocomplete/index.d.js +1 -0
  5. package/esm/core/Autocomplete/index.interfaces.js +1 -0
  6. package/esm/core/Autocomplete/index.js +50 -184
  7. package/esm/core/Autocomplete/styles.js +30 -25
  8. package/esm/core/DatepickerRange/YearMonthForm.js +56 -0
  9. package/lib/core/Autocomplete/hooks/useAutocomplete.d.ts +21 -0
  10. package/lib/core/Autocomplete/hooks/useAutocomplete.d.ts.map +1 -0
  11. package/lib/core/Autocomplete/hooks/useAutocomplete.js +242 -0
  12. package/lib/core/Autocomplete/hooks/useHandleDimentions.d.ts +8 -0
  13. package/lib/core/Autocomplete/hooks/useHandleDimentions.d.ts.map +1 -0
  14. package/lib/core/Autocomplete/hooks/useHandleDimentions.js +19 -0
  15. package/lib/core/Autocomplete/index.d.js +1 -0
  16. package/lib/core/Autocomplete/index.d.ts +2 -74
  17. package/lib/core/Autocomplete/index.d.ts.map +1 -1
  18. package/lib/core/Autocomplete/index.interfaces.d.ts +81 -0
  19. package/lib/core/Autocomplete/index.interfaces.d.ts.map +1 -0
  20. package/lib/core/Autocomplete/index.interfaces.js +1 -0
  21. package/lib/core/Autocomplete/index.js +50 -184
  22. package/lib/core/Autocomplete/styles.d.ts +18 -1
  23. package/lib/core/Autocomplete/styles.d.ts.map +1 -1
  24. package/lib/core/Autocomplete/styles.js +30 -25
  25. package/lib/core/DatepickerRange/YearMonthForm.d.ts +10 -0
  26. package/lib/core/DatepickerRange/YearMonthForm.d.ts.map +1 -0
  27. package/lib/core/DatepickerRange/YearMonthForm.js +56 -0
  28. package/package.json +2 -1
  29. package/esm/enums/ModifierKey.js +0 -13
  30. package/lib/enums/ModifierKey.d.ts +0 -12
  31. package/lib/enums/ModifierKey.d.ts.map +0 -1
  32. package/lib/enums/ModifierKey.js +0 -13
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface IProps {
3
+ date: Date;
4
+ onChange: (e: Date) => void;
5
+ fromDate: Date;
6
+ toDate: Date;
7
+ }
8
+ declare const YearMonthForm: React.FC<IProps>;
9
+ export default YearMonthForm;
10
+ //# sourceMappingURL=YearMonthForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YearMonthForm.d.ts","sourceRoot":"","sources":["../../../src/packages/core/DatepickerRange/YearMonthForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,UAAU,MAAM;IACd,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC3B,QAAQ,EAAE,IAAI,CAAA;IACd,MAAM,EAAE,IAAI,CAAA;CACb;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAmDnC,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { MONTHS } from '../../utils/dates';
3
+ import { StyledSelect, Div } from './styles';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+
7
+ const YearMonthForm = ({
8
+ onChange,
9
+ date,
10
+ fromDate,
11
+ toDate
12
+ }) => {
13
+ const months = MONTHS;
14
+ const years = [];
15
+
16
+ for (let i = fromDate.getFullYear(); i <= toDate.getFullYear(); i += 1) {
17
+ years.push(i);
18
+ }
19
+
20
+ const changeMonth = e => {
21
+ let newDate = date;
22
+ newDate.setMonth(e.target.value);
23
+ if (newDate > toDate) newDate = toDate;
24
+ onChange(newDate);
25
+ };
26
+
27
+ const changeYear = e => {
28
+ let newDate = date;
29
+ newDate.setFullYear(e.target.value);
30
+ if (newDate > toDate) newDate = toDate;
31
+ onChange(newDate);
32
+ };
33
+
34
+ return /*#__PURE__*/_jsxs(Div, {
35
+ className: "DayPicker-Caption",
36
+ children: [/*#__PURE__*/_jsx(StyledSelect, {
37
+ name: "month",
38
+ onChange: changeMonth,
39
+ value: date.getMonth(),
40
+ children: months.map((month, i) => /*#__PURE__*/_jsx("option", {
41
+ value: i,
42
+ children: month
43
+ }, month))
44
+ }), /*#__PURE__*/_jsx(StyledSelect, {
45
+ name: "year",
46
+ onChange: changeYear,
47
+ value: date.getFullYear(),
48
+ children: years.map(year => /*#__PURE__*/_jsx("option", {
49
+ value: year,
50
+ children: year
51
+ }, year))
52
+ })]
53
+ });
54
+ };
55
+
56
+ export default YearMonthForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "3.0.4",
3
+ "version": "3.0.8",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -24,6 +24,7 @@
24
24
  "@types/react-test-renderer": "^18.0.0",
25
25
  "date-fns": "^2.28.0",
26
26
  "focus-trap-react": "^9.0.2",
27
+ "match-sorter": "^6.3.1",
27
28
  "react-beautiful-dnd": "^13.1.0",
28
29
  "react-day-picker": "^8.0.7",
29
30
  "react-test-renderer": "^18.2.0",
@@ -1,13 +0,0 @@
1
- export let ModifierKey;
2
-
3
- (function (ModifierKey) {
4
- ModifierKey["enter"] = "Enter";
5
- ModifierKey["tab"] = "Tab";
6
- ModifierKey["space"] = " ";
7
- ModifierKey["escape"] = "Escape";
8
- ModifierKey["shift"] = "Shift";
9
- ModifierKey["right"] = "ArrowRight";
10
- ModifierKey["left"] = "ArrowLeft";
11
- ModifierKey["up"] = "ArrowUp";
12
- ModifierKey["down"] = "ArrowDown";
13
- })(ModifierKey || (ModifierKey = {}));
@@ -1,12 +0,0 @@
1
- export declare enum ModifierKey {
2
- enter = "Enter",
3
- tab = "Tab",
4
- space = " ",
5
- escape = "Escape",
6
- shift = "Shift",
7
- right = "ArrowRight",
8
- left = "ArrowLeft",
9
- up = "ArrowUp",
10
- down = "ArrowDown"
11
- }
12
- //# sourceMappingURL=ModifierKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModifierKey.d.ts","sourceRoot":"","sources":["../../src/packages/enums/ModifierKey.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,KAAK,MAAM;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,KAAK,eAAe;IACpB,IAAI,cAAc;IAClB,EAAE,YAAY;IACd,IAAI,cAAc;CACnB"}
@@ -1,13 +0,0 @@
1
- export let ModifierKey;
2
-
3
- (function (ModifierKey) {
4
- ModifierKey["enter"] = "Enter";
5
- ModifierKey["tab"] = "Tab";
6
- ModifierKey["space"] = " ";
7
- ModifierKey["escape"] = "Escape";
8
- ModifierKey["shift"] = "Shift";
9
- ModifierKey["right"] = "ArrowRight";
10
- ModifierKey["left"] = "ArrowLeft";
11
- ModifierKey["up"] = "ArrowUp";
12
- ModifierKey["down"] = "ArrowDown";
13
- })(ModifierKey || (ModifierKey = {}));