@bbl-digital/snorre 3.1.21 → 3.1.23
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +485 -432
- package/esm/core/Autocomplete/index.d.js +1 -0
- package/esm/core/DatepickerRange/YearMonthForm.js +56 -0
- package/esm/core/Input/index.js +35 -32
- package/esm/core/Input/styles.js +28 -28
- package/esm/core/Tooltip/index.js +42 -0
- package/esm/core/Tooltip/styles.js +15 -0
- package/esm/index.js +2 -1
- package/lib/core/Autocomplete/index.d.js +1 -0
- package/lib/core/DatepickerRange/YearMonthForm.d.ts +10 -0
- package/lib/core/DatepickerRange/YearMonthForm.d.ts.map +1 -0
- package/lib/core/DatepickerRange/YearMonthForm.js +56 -0
- package/lib/core/Input/index.d.ts +1 -1
- package/lib/core/Input/index.d.ts.map +1 -1
- package/lib/core/Input/index.js +35 -32
- package/lib/core/Input/styles.d.ts +2 -2
- package/lib/core/Input/styles.d.ts.map +1 -1
- package/lib/core/Input/styles.js +28 -28
- package/lib/core/Tooltip/index.d.ts +12 -0
- package/lib/core/Tooltip/index.d.ts.map +1 -0
- package/lib/core/Tooltip/index.js +42 -0
- package/lib/core/Tooltip/styles.d.ts +6 -0
- package/lib/core/Tooltip/styles.d.ts.map +1 -0
- package/lib/core/Tooltip/styles.js +15 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/package.json +3 -1
- package/esm/enums/ModifierKey.js +0 -13
- package/lib/enums/ModifierKey.d.ts +0 -12
- package/lib/enums/ModifierKey.d.ts.map +0 -1
- package/lib/enums/ModifierKey.js +0 -13
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -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/esm/core/Input/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
2
2
|
import React, { useState } from 'react';
|
3
|
-
import { styles
|
3
|
+
import { styles } from './styles';
|
4
4
|
import IconSearch from '../../icons/General/IconSearch';
|
5
5
|
import { useEffect } from 'react';
|
6
6
|
import { useDebounce } from '../utils/debounce';
|
@@ -62,38 +62,41 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
62
62
|
|
63
63
|
handleDebounceChange(debouncedValue); // eslint-disable-next-line react-hooks/exhaustive-deps
|
64
64
|
}, [debouncedValue]);
|
65
|
-
return _jsxs("
|
66
|
-
css:
|
67
|
-
children: [
|
68
|
-
css:
|
69
|
-
children: props.label
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
65
|
+
return _jsxs("div", {
|
66
|
+
css: styles.relative,
|
67
|
+
children: [_jsxs("label", {
|
68
|
+
css: theme => [styles.default(theme), props.highlight && styles.highligted(height), type === 'search' && styles.searchLabel(theme), (props.invalid || props.invalidMessage) && styles.invalid(theme), height && styles.height(height)],
|
69
|
+
children: [props.label && _jsx("span", {
|
70
|
+
css: info && styles.pr4,
|
71
|
+
children: props.label
|
72
|
+
}), _jsx("input", {
|
73
|
+
type: type,
|
74
|
+
...(type !== 'password' && {
|
75
|
+
value
|
76
|
+
}),
|
77
|
+
placeholder: props.placeholder,
|
78
|
+
disabled: props.disabled,
|
79
|
+
autoFocus: props.focus,
|
80
|
+
onBlur: props.onBlur,
|
81
|
+
onFocus: props.onFocus,
|
82
|
+
onChange: onInputChange,
|
83
|
+
maxLength: maxlength,
|
84
|
+
ref: ref,
|
85
|
+
name: props.name,
|
86
|
+
css: theme => [type === 'text' && styles.text(theme), type === 'search' && styles.search(theme), type === 'password' && styles.password(theme), type === 'number' && styles.number(theme), type === 'file' && styles.file, props.disabled && styles.disabled(theme), props.cardInput && styles.cardInput],
|
87
|
+
children: React.Children.map(props.children, child => {
|
88
|
+
if (!child) {
|
89
|
+
return null;
|
90
|
+
}
|
89
91
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
return child;
|
93
|
+
})
|
94
|
+
}), type === 'search' && _jsx(IconSearch, {}), props.invalidMessage && _jsx(IconErrorOutline, {
|
95
|
+
size: "16px"
|
96
|
+
}), props.invalidMessage && _jsx("span", {
|
97
|
+
css: styles.errorMessage,
|
98
|
+
children: props.invalidMessage
|
99
|
+
})]
|
97
100
|
}), info && _jsx("span", {
|
98
101
|
css: styles.infoButton,
|
99
102
|
children: _jsx(InfoButton, {
|