@monolith-forensics/monolith-ui 1.1.29 → 1.1.30
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/Button/Button.d.ts +19 -0
- package/dist/Button/Button.js +332 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +8 -0
- package/dist/Calendar/Calendar.d.ts +15 -0
- package/dist/Calendar/Calendar.js +232 -0
- package/dist/Calendar/CalendarStyles.d.ts +36 -0
- package/dist/Calendar/CalendarStyles.js +170 -0
- package/dist/Calendar/calendarHelpers.d.ts +53 -0
- package/dist/Calendar/calendarHelpers.js +181 -0
- package/dist/Calendar/index.d.ts +1 -0
- package/dist/Calendar/index.js +8 -0
- package/dist/CheckBox/CheckBox.d.ts +13 -0
- package/dist/CheckBox/CheckBox.js +46 -0
- package/dist/CheckBox/index.d.ts +1 -0
- package/dist/CheckBox/index.js +8 -0
- package/dist/DateInput/DateInput.d.ts +24 -0
- package/dist/DateInput/DateInput.js +509 -0
- package/dist/DateInput/index.d.ts +1 -0
- package/dist/DateInput/index.js +8 -0
- package/dist/DropDownMenu/DropDownMenu.d.ts +36 -0
- package/dist/DropDownMenu/DropDownMenu.js +213 -0
- package/dist/DropDownMenu/index.d.ts +1 -0
- package/dist/DropDownMenu/index.js +8 -0
- package/dist/Error/Error.d.ts +4 -0
- package/dist/Error/Error.js +38 -0
- package/dist/Error/index.d.ts +1 -0
- package/dist/Error/index.js +8 -0
- package/dist/FieldLabel/FieldLabel.d.ts +19 -0
- package/dist/FieldLabel/FieldLabel.js +119 -0
- package/dist/FieldLabel/index.d.ts +1 -0
- package/dist/FieldLabel/index.js +8 -0
- package/dist/FileInputField/FileInputField.d.ts +19 -0
- package/dist/FileInputField/FileInputField.js +117 -0
- package/dist/FileInputField/index.d.ts +1 -0
- package/dist/FileInputField/index.js +8 -0
- package/dist/Flyout/Flyout.d.ts +11 -0
- package/dist/Flyout/Flyout.js +111 -0
- package/dist/Flyout/FlyoutHeader.d.ts +5 -0
- package/dist/Flyout/FlyoutHeader.js +12 -0
- package/dist/Flyout/FlyoutTitle.d.ts +2 -0
- package/dist/Flyout/FlyoutTitle.js +13 -0
- package/dist/Flyout/index.d.ts +3 -0
- package/dist/Flyout/index.js +12 -0
- package/dist/FormSection/FormSection.d.ts +9 -0
- package/dist/FormSection/FormSection.js +51 -0
- package/dist/FormSection/index.d.ts +1 -0
- package/dist/FormSection/index.js +8 -0
- package/dist/Grid/Grid.d.ts +8 -0
- package/dist/Grid/Grid.js +18 -0
- package/dist/Grid/index.d.ts +1 -0
- package/dist/Grid/index.js +8 -0
- package/dist/IconButton/IconButton.d.ts +5 -0
- package/dist/IconButton/IconButton.js +30 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/IconButton/index.js +8 -0
- package/dist/Input/Input.d.ts +21 -0
- package/dist/Input/Input.js +149 -0
- package/dist/Input/index.d.ts +1 -0
- package/dist/Input/index.js +8 -0
- package/dist/Modal/Modal.d.ts +14 -0
- package/dist/Modal/Modal.js +110 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +8 -0
- package/dist/MonolithUIProvider/GlobalStyle.d.ts +4 -0
- package/dist/MonolithUIProvider/GlobalStyle.js +53 -0
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +10 -0
- package/dist/MonolithUIProvider/MonolithUIProvider.js +29 -0
- package/dist/MonolithUIProvider/index.d.ts +3 -0
- package/dist/MonolithUIProvider/index.js +12 -0
- package/dist/MonolithUIProvider/useMonolithUITheme.d.ts +2 -0
- package/dist/MonolithUIProvider/useMonolithUITheme.js +12 -0
- package/dist/Pill/Pill.d.ts +11 -0
- package/dist/Pill/Pill.js +152 -0
- package/dist/Pill/index.d.ts +1 -0
- package/dist/Pill/index.js +8 -0
- package/dist/SelectBox/SelectBox.d.ts +45 -0
- package/dist/SelectBox/SelectBox.js +477 -0
- package/dist/SelectBox/index.d.ts +1 -0
- package/dist/SelectBox/index.js +8 -0
- package/dist/Switch/Switch.d.ts +18 -0
- package/dist/Switch/Switch.js +157 -0
- package/dist/Switch/index.d.ts +1 -0
- package/dist/Switch/index.js +8 -0
- package/dist/Table/Table.d.ts +91 -0
- package/dist/Table/Table.js +715 -0
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.js +10 -0
- package/dist/TagBox/TagBox.d.ts +39 -0
- package/dist/TagBox/TagBox.js +590 -0
- package/dist/TagBox/TagBoxStyles.d.ts +11 -0
- package/dist/TagBox/TagBoxStyles.js +113 -0
- package/dist/TagBox/index.d.ts +1 -0
- package/dist/TagBox/index.js +8 -0
- package/dist/TextArea/TextArea.d.ts +16 -0
- package/dist/TextArea/TextArea.js +81 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/TextArea/index.js +8 -0
- package/dist/TextAreaInput/TextAreaInput.d.ts +19 -0
- package/dist/TextAreaInput/TextAreaInput.js +11 -0
- package/dist/TextAreaInput/index.d.ts +1 -0
- package/dist/TextAreaInput/index.js +8 -0
- package/dist/TextInput/TextInput.d.ts +13 -0
- package/dist/TextInput/TextInput.js +31 -0
- package/dist/TextInput/index.d.ts +1 -0
- package/dist/TextInput/index.js +8 -0
- package/dist/Tooltip/Tooltip.d.ts +12 -0
- package/dist/Tooltip/Tooltip.js +53 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.js +8 -0
- package/dist/core/ArrowButton.d.ts +6 -0
- package/dist/core/ArrowButton.js +48 -0
- package/dist/core/ClearButton.d.ts +6 -0
- package/dist/core/ClearButton.js +48 -0
- package/dist/core/MonolithThemeProvider.d.ts +4 -0
- package/dist/core/MonolithThemeProvider.js +20 -0
- package/dist/core/StyledContent.d.ts +7 -0
- package/dist/core/StyledContent.js +47 -0
- package/dist/core/StyledFloatContainer.d.ts +2 -0
- package/dist/core/StyledFloatContainer.js +10 -0
- package/dist/core/Types/Size.d.ts +2 -0
- package/dist/core/Types/Size.js +2 -0
- package/dist/core/Types/Variant.d.ts +2 -0
- package/dist/core/Types/Variant.js +2 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +14 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +59 -0
- package/dist/theme/index.d.ts +168 -0
- package/dist/theme/index.js +14 -0
- package/dist/theme/typography.d.ts +45 -0
- package/dist/theme/typography.js +59 -0
- package/dist/theme/variants.d.ts +172 -0
- package/dist/theme/variants.js +276 -0
- package/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NoValueButton = exports.TimeItemActive = exports.TimeItem = exports.TimeMinuteSelect = exports.TimeHourSelect = exports.TimeHeader = exports.TimePickerContainer = exports.TimeContainer = exports.TodayCalendarDate = exports.HighlightedCalendarDate = exports.CalendarDate = exports.CalendarDay = exports.CalendarCell = exports.CalendarMonth = exports.CalendarGrid = exports.CalendarHeader = exports.CalendarContainer = exports.MainContainer = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
exports.MainContainer = styled_components_1.default.div `
|
|
9
|
+
display: flex;
|
|
10
|
+
`;
|
|
11
|
+
exports.CalendarContainer = styled_components_1.default.div `
|
|
12
|
+
font-size: 5px;
|
|
13
|
+
width: 250px;
|
|
14
|
+
border-radius: 4px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
`;
|
|
17
|
+
exports.CalendarHeader = styled_components_1.default.div `
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
`;
|
|
22
|
+
exports.CalendarGrid = styled_components_1.default.div `
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-template: repeat(7, auto) / repeat(7, auto);
|
|
25
|
+
`;
|
|
26
|
+
exports.CalendarMonth = styled_components_1.default.div `
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
color: ${(props) => props.theme.palette.text.primary};
|
|
30
|
+
text-align: center;
|
|
31
|
+
padding: 0.5em 0.25em;
|
|
32
|
+
word-spacing: 5px;
|
|
33
|
+
user-select: none;
|
|
34
|
+
`;
|
|
35
|
+
exports.CalendarCell = styled_components_1.default.div `
|
|
36
|
+
text-align: center;
|
|
37
|
+
align-self: center;
|
|
38
|
+
letter-spacing: 0.1rem;
|
|
39
|
+
padding: 7px;
|
|
40
|
+
user-select: none;
|
|
41
|
+
border-radius: 5px;
|
|
42
|
+
border: 1px solid transparent;
|
|
43
|
+
grid-column: ${({ index = 0 }) => (index % 7) + 1} / span 1;
|
|
44
|
+
`;
|
|
45
|
+
exports.CalendarDay = (0, styled_components_1.default)(exports.CalendarCell) `
|
|
46
|
+
font-weight: bold;
|
|
47
|
+
font-size: 10px;
|
|
48
|
+
border-radius: 0px;
|
|
49
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
50
|
+
`;
|
|
51
|
+
exports.CalendarDate = (0, styled_components_1.default)(exports.CalendarCell) `
|
|
52
|
+
font-weight: ${(props) => (props.inMonth ? 500 : 300)};
|
|
53
|
+
font-size: 10px;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
|
|
56
|
+
color: ${({ inMonth, theme }) => inMonth ? theme.palette.text.primary : theme.palette.text.secondary};
|
|
57
|
+
grid-row: ${({ index }) => Math.floor((index || 0) / 7) + 2} / span 1;
|
|
58
|
+
transition: all 0.2s ease-out;
|
|
59
|
+
border-radius: 5px;
|
|
60
|
+
:hover {
|
|
61
|
+
background: ${({ theme }) => theme.palette.action.hover};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&[data-disabled="true"] {
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
color: ${({ theme }) => theme.palette.text.disabled};
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
exports.HighlightedCalendarDate = (0, styled_components_1.default)(exports.CalendarDate) `
|
|
70
|
+
color: white !important;
|
|
71
|
+
background: ${(props) => props.theme.palette.primary.main} !important;
|
|
72
|
+
border: 1px solid ${(props) => props.theme.palette.primary.main} !important;
|
|
73
|
+
position: relative;
|
|
74
|
+
::before {
|
|
75
|
+
content: "";
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: -1px;
|
|
78
|
+
left: -1px;
|
|
79
|
+
width: calc(100% + 2px);
|
|
80
|
+
height: calc(100% + 2px);
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
exports.TodayCalendarDate = (0, styled_components_1.default)(exports.HighlightedCalendarDate) `
|
|
84
|
+
color: ${(props) => props.theme.palette.text.primary} !important;
|
|
85
|
+
background: transparent !important;
|
|
86
|
+
::after {
|
|
87
|
+
content: "";
|
|
88
|
+
position: absolute;
|
|
89
|
+
right: 0;
|
|
90
|
+
bottom: 0;
|
|
91
|
+
border-bottom: 0.75em solid #06c;
|
|
92
|
+
border-left: 0.75em solid transparent;
|
|
93
|
+
border-top: 0.75em solid transparent;
|
|
94
|
+
}
|
|
95
|
+
:hover {
|
|
96
|
+
color: ${(props) => props.theme.palette.text.primary} !important;
|
|
97
|
+
background: ${(props) => props.theme.palette.action.hover} !important;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
exports.TimeContainer = styled_components_1.default.div `
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
width: 150px;
|
|
103
|
+
height: 100%;
|
|
104
|
+
border: 1px solid ${(props) => props.theme.palette.divider};
|
|
105
|
+
border-left: none;
|
|
106
|
+
border-radius: 4px;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
`;
|
|
109
|
+
exports.TimePickerContainer = styled_components_1.default.div `
|
|
110
|
+
display: flex;
|
|
111
|
+
height: 100%;
|
|
112
|
+
`;
|
|
113
|
+
exports.TimeHeader = styled_components_1.default.div `
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
color: ${(props) => props.theme.palette.text.primary};
|
|
117
|
+
border-bottom: 1px solid ${(props) => props.theme.palette.divider};
|
|
118
|
+
text-align: center;
|
|
119
|
+
padding: 5px;
|
|
120
|
+
line-height: 2.3;
|
|
121
|
+
height: 40px;
|
|
122
|
+
user-select: none;
|
|
123
|
+
`;
|
|
124
|
+
exports.TimeHourSelect = styled_components_1.default.div `
|
|
125
|
+
border-right: 1px solid ${(props) => props.theme.palette.divider};
|
|
126
|
+
width: 50%;
|
|
127
|
+
height: 250px;
|
|
128
|
+
overflow-y: auto;
|
|
129
|
+
`;
|
|
130
|
+
exports.TimeMinuteSelect = styled_components_1.default.div `
|
|
131
|
+
width: 50%;
|
|
132
|
+
height: 250px;
|
|
133
|
+
overflow-y: auto;
|
|
134
|
+
`;
|
|
135
|
+
exports.TimeItem = styled_components_1.default.div `
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
font-size: 10px;
|
|
138
|
+
color: ${(props) => props.theme.palette.text.primary};
|
|
139
|
+
text-align: center;
|
|
140
|
+
padding: 5px;
|
|
141
|
+
user-select: none;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
transition: all 0.2s ease-out;
|
|
144
|
+
:hover {
|
|
145
|
+
background: ${(props) => props.theme.palette.action.hover};
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
exports.TimeItemActive = (0, styled_components_1.default)(exports.TimeItem) `
|
|
149
|
+
background: ${(props) => props.theme.palette.primary.main};
|
|
150
|
+
color: white;
|
|
151
|
+
&:hover {
|
|
152
|
+
background: ${(props) => props.theme.palette.primary.main};
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
exports.NoValueButton = styled_components_1.default.button `
|
|
156
|
+
font-weight: normal;
|
|
157
|
+
font-size: 12px;
|
|
158
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
159
|
+
text-align: center;
|
|
160
|
+
padding: 5px;
|
|
161
|
+
user-select: none;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
transition: all 0.2s ease-out;
|
|
164
|
+
border: none;
|
|
165
|
+
border-radius: 5px;
|
|
166
|
+
background: transparent;
|
|
167
|
+
:hover {
|
|
168
|
+
background: ${(props) => props.theme.palette.action.hover};
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const THIS_YEAR: number;
|
|
2
|
+
export declare const THIS_MONTH: number;
|
|
3
|
+
export declare const HOURS24: {
|
|
4
|
+
value: number;
|
|
5
|
+
label: string;
|
|
6
|
+
}[];
|
|
7
|
+
export declare const HOURS12: {
|
|
8
|
+
value: number;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const MINUTES: (string | number)[];
|
|
12
|
+
export declare const WEEK_DAYS: {
|
|
13
|
+
Sunday: string;
|
|
14
|
+
Monday: string;
|
|
15
|
+
Tuesday: string;
|
|
16
|
+
Wednesday: string;
|
|
17
|
+
Thursday: string;
|
|
18
|
+
Friday: string;
|
|
19
|
+
Saturday: string;
|
|
20
|
+
};
|
|
21
|
+
export type WeekDay = keyof typeof WEEK_DAYS;
|
|
22
|
+
export declare const CALENDAR_MONTHS: {
|
|
23
|
+
January: string;
|
|
24
|
+
February: string;
|
|
25
|
+
March: string;
|
|
26
|
+
April: string;
|
|
27
|
+
May: string;
|
|
28
|
+
June: string;
|
|
29
|
+
July: string;
|
|
30
|
+
August: string;
|
|
31
|
+
September: string;
|
|
32
|
+
October: string;
|
|
33
|
+
November: string;
|
|
34
|
+
December: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const CALENDAR_WEEKS = 6;
|
|
37
|
+
export declare const zeroPad: (value: number, length: number) => string;
|
|
38
|
+
export declare const getMonthDays: (month?: number, year?: number) => 29 | 28 | 30 | 31;
|
|
39
|
+
export declare const getMonthFirstDay: (month?: number, year?: number) => number;
|
|
40
|
+
export declare const isDate: (date: Date) => boolean;
|
|
41
|
+
export declare const isSameMonth: (date: Date, basedate?: Date) => boolean;
|
|
42
|
+
export declare const isSameDay: (date: Date, basedate?: Date) => boolean;
|
|
43
|
+
export declare const getDateISO: (date: Date) => string | null;
|
|
44
|
+
export declare const getPreviousMonth: (month: number, year: number) => {
|
|
45
|
+
month: number;
|
|
46
|
+
year: number;
|
|
47
|
+
};
|
|
48
|
+
export declare const getNextMonth: (month: number, year: number) => {
|
|
49
|
+
month: number;
|
|
50
|
+
year: number;
|
|
51
|
+
};
|
|
52
|
+
declare const calendarBuilder: (month?: number, year?: number) => (string | number)[][];
|
|
53
|
+
export default calendarBuilder;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNextMonth = exports.getPreviousMonth = exports.getDateISO = exports.isSameDay = exports.isSameMonth = exports.isDate = exports.getMonthFirstDay = exports.getMonthDays = exports.zeroPad = exports.CALENDAR_WEEKS = exports.CALENDAR_MONTHS = exports.WEEK_DAYS = exports.MINUTES = exports.HOURS12 = exports.HOURS24 = exports.THIS_MONTH = exports.THIS_YEAR = void 0;
|
|
4
|
+
// (int) The current year
|
|
5
|
+
exports.THIS_YEAR = +new Date().getFullYear();
|
|
6
|
+
// (int) The current month starting from 1 - 12
|
|
7
|
+
// 1 => January, 12 => December
|
|
8
|
+
exports.THIS_MONTH = +new Date().getMonth() + 1;
|
|
9
|
+
// Week days names and shortnames
|
|
10
|
+
exports.HOURS24 = [...new Array(24)].map((n, index) => {
|
|
11
|
+
return {
|
|
12
|
+
value: index,
|
|
13
|
+
label: index < 10 ? `0${index}` : `${index}`,
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
exports.HOURS12 = [
|
|
17
|
+
...[...new Array(12)].map((n, index) => {
|
|
18
|
+
return {
|
|
19
|
+
value: index,
|
|
20
|
+
label: index < 10 ? `0${index} AM` : `${index} AM`,
|
|
21
|
+
};
|
|
22
|
+
}),
|
|
23
|
+
...[...new Array(12)].map((n, index) => {
|
|
24
|
+
return {
|
|
25
|
+
value: index + 12,
|
|
26
|
+
label: index < 10 ? `0${index} PM` : `${index} PM`,
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
];
|
|
30
|
+
exports.MINUTES = new Array(60).fill(0).map((n, index) => {
|
|
31
|
+
return index < 10 ? `0${index}` : index;
|
|
32
|
+
});
|
|
33
|
+
exports.WEEK_DAYS = {
|
|
34
|
+
Sunday: "Su",
|
|
35
|
+
Monday: "Mo",
|
|
36
|
+
Tuesday: "Tu",
|
|
37
|
+
Wednesday: "We",
|
|
38
|
+
Thursday: "Th",
|
|
39
|
+
Friday: "Fr",
|
|
40
|
+
Saturday: "Sa",
|
|
41
|
+
};
|
|
42
|
+
// Calendar months names and short names
|
|
43
|
+
exports.CALENDAR_MONTHS = {
|
|
44
|
+
January: "Jan",
|
|
45
|
+
February: "Feb",
|
|
46
|
+
March: "Mar",
|
|
47
|
+
April: "Apr",
|
|
48
|
+
May: "May",
|
|
49
|
+
June: "Jun",
|
|
50
|
+
July: "Jul",
|
|
51
|
+
August: "Aug",
|
|
52
|
+
September: "Sep",
|
|
53
|
+
October: "Oct",
|
|
54
|
+
November: "Nov",
|
|
55
|
+
December: "Dec",
|
|
56
|
+
};
|
|
57
|
+
// Weeks displayed on calendar
|
|
58
|
+
exports.CALENDAR_WEEKS = 6;
|
|
59
|
+
// Pads a string value with leading zeroes(0) until length is reached
|
|
60
|
+
// For example: zeroPad(5, 2) => "05"
|
|
61
|
+
const zeroPad = (value, length) => {
|
|
62
|
+
return `${value}`.padStart(length, "0");
|
|
63
|
+
};
|
|
64
|
+
exports.zeroPad = zeroPad;
|
|
65
|
+
// (int) Number days in a month for a given year from 28 - 31
|
|
66
|
+
const getMonthDays = (month = exports.THIS_MONTH, year = exports.THIS_YEAR) => {
|
|
67
|
+
const months30 = [4, 6, 9, 11];
|
|
68
|
+
const leapYear = year % 4 === 0;
|
|
69
|
+
return month === 2
|
|
70
|
+
? leapYear
|
|
71
|
+
? 29
|
|
72
|
+
: 28
|
|
73
|
+
: months30.includes(month)
|
|
74
|
+
? 30
|
|
75
|
+
: 31;
|
|
76
|
+
};
|
|
77
|
+
exports.getMonthDays = getMonthDays;
|
|
78
|
+
// (int) First day of the month for a given year from 1 - 7
|
|
79
|
+
// 1 => Sunday, 7 => Saturday
|
|
80
|
+
const getMonthFirstDay = (month = exports.THIS_MONTH, year = exports.THIS_YEAR) => {
|
|
81
|
+
return +new Date(`${year}-${(0, exports.zeroPad)(month, 2)}-01`).getDay() + 1;
|
|
82
|
+
};
|
|
83
|
+
exports.getMonthFirstDay = getMonthFirstDay;
|
|
84
|
+
// (bool) Checks if a value is a date - this is just a simple check
|
|
85
|
+
const isDate = (date) => {
|
|
86
|
+
const isDate = Object.prototype.toString.call(date) === "[object Date]";
|
|
87
|
+
const isValidDate = date && !Number.isNaN(date.valueOf());
|
|
88
|
+
return isDate && isValidDate;
|
|
89
|
+
};
|
|
90
|
+
exports.isDate = isDate;
|
|
91
|
+
// (bool) Checks if two date values are of the same month and year
|
|
92
|
+
const isSameMonth = (date, basedate = new Date()) => {
|
|
93
|
+
if (!((0, exports.isDate)(date) && (0, exports.isDate)(basedate)))
|
|
94
|
+
return false;
|
|
95
|
+
const basedateMonth = +basedate.getMonth() + 1;
|
|
96
|
+
const basedateYear = basedate.getFullYear();
|
|
97
|
+
const dateMonth = +date.getMonth() + 1;
|
|
98
|
+
const dateYear = date.getFullYear();
|
|
99
|
+
return +basedateMonth === +dateMonth && +basedateYear === +dateYear;
|
|
100
|
+
};
|
|
101
|
+
exports.isSameMonth = isSameMonth;
|
|
102
|
+
// (bool) Checks if two date values are the same day
|
|
103
|
+
const isSameDay = (date, basedate = new Date()) => {
|
|
104
|
+
if (!((0, exports.isDate)(date) && (0, exports.isDate)(basedate)))
|
|
105
|
+
return false;
|
|
106
|
+
const basedateDate = basedate.getDate();
|
|
107
|
+
const basedateMonth = +basedate.getMonth() + 1;
|
|
108
|
+
const basedateYear = basedate.getFullYear();
|
|
109
|
+
const dateDate = date.getDate();
|
|
110
|
+
const dateMonth = +date.getMonth() + 1;
|
|
111
|
+
const dateYear = date.getFullYear();
|
|
112
|
+
return (+basedateDate === +dateDate &&
|
|
113
|
+
+basedateMonth === +dateMonth &&
|
|
114
|
+
+basedateYear === +dateYear);
|
|
115
|
+
};
|
|
116
|
+
exports.isSameDay = isSameDay;
|
|
117
|
+
// (string) Formats the given date as YYYY-MM-DD
|
|
118
|
+
// Months and Days are zero padded
|
|
119
|
+
const getDateISO = (date) => {
|
|
120
|
+
if (!(0, exports.isDate)(date))
|
|
121
|
+
return null;
|
|
122
|
+
return [
|
|
123
|
+
date.getFullYear(),
|
|
124
|
+
(0, exports.zeroPad)(+date.getMonth() + 1, 2),
|
|
125
|
+
(0, exports.zeroPad)(+date.getDate(), 2),
|
|
126
|
+
].join("-");
|
|
127
|
+
};
|
|
128
|
+
exports.getDateISO = getDateISO;
|
|
129
|
+
// ({month, year}) Gets the month and year before the given month and year
|
|
130
|
+
// For example: getPreviousMonth(1, 2000) => {month: 12, year: 1999}
|
|
131
|
+
// while: getPreviousMonth(12, 2000) => {month: 11, year: 2000}
|
|
132
|
+
const getPreviousMonth = (month, year) => {
|
|
133
|
+
const prevMonth = month > 1 ? month - 1 : 12;
|
|
134
|
+
const prevMonthYear = month > 1 ? year : year - 1;
|
|
135
|
+
return { month: prevMonth, year: prevMonthYear };
|
|
136
|
+
};
|
|
137
|
+
exports.getPreviousMonth = getPreviousMonth;
|
|
138
|
+
// ({month, year}) Gets the month and year after the given month and year
|
|
139
|
+
// For example: getNextMonth(1, 2000) => {month: 2, year: 2000}
|
|
140
|
+
// while: getNextMonth(12, 2000) => {month: 1, year: 2001}
|
|
141
|
+
const getNextMonth = (month, year) => {
|
|
142
|
+
const nextMonth = month < 12 ? month + 1 : 1;
|
|
143
|
+
const nextMonthYear = month < 12 ? year : year + 1;
|
|
144
|
+
return { month: nextMonth, year: nextMonthYear };
|
|
145
|
+
};
|
|
146
|
+
exports.getNextMonth = getNextMonth;
|
|
147
|
+
// Calendar builder for a month in the specified year
|
|
148
|
+
// Returns an array of the calendar dates.
|
|
149
|
+
// Each calendar date is represented as an array => [YYYY, MM, DD]
|
|
150
|
+
const calendarBuilder = (month = exports.THIS_MONTH, year = exports.THIS_YEAR) => {
|
|
151
|
+
// Get number of days in the month and the month's first day
|
|
152
|
+
const monthDays = (0, exports.getMonthDays)(month, year);
|
|
153
|
+
const monthFirstDay = (0, exports.getMonthFirstDay)(month, year);
|
|
154
|
+
// Get number of days to be displayed from previous and next months
|
|
155
|
+
// These ensure a total of 42 days (6 weeks) displayed on the calendar
|
|
156
|
+
const daysFromPrevMonth = monthFirstDay - 1;
|
|
157
|
+
const daysFromNextMonth = exports.CALENDAR_WEEKS * 7 - (daysFromPrevMonth + monthDays);
|
|
158
|
+
// Get the previous and next months and years
|
|
159
|
+
const { month: prevMonth, year: prevMonthYear } = (0, exports.getPreviousMonth)(month, year);
|
|
160
|
+
const { month: nextMonth, year: nextMonthYear } = (0, exports.getNextMonth)(month, year);
|
|
161
|
+
// Get number of days in previous month
|
|
162
|
+
const prevMonthDays = (0, exports.getMonthDays)(prevMonth, prevMonthYear);
|
|
163
|
+
// Builds dates to be displayed from previous month
|
|
164
|
+
const prevMonthDates = [...new Array(daysFromPrevMonth)].map((n, index) => {
|
|
165
|
+
const day = index + 1 + (prevMonthDays - daysFromPrevMonth);
|
|
166
|
+
return [prevMonthYear, (0, exports.zeroPad)(prevMonth, 2), (0, exports.zeroPad)(day, 2)];
|
|
167
|
+
});
|
|
168
|
+
// Builds dates to be displayed from current month
|
|
169
|
+
const thisMonthDates = [...new Array(monthDays)].map((n, index) => {
|
|
170
|
+
const day = index + 1;
|
|
171
|
+
return [year, (0, exports.zeroPad)(month, 2), (0, exports.zeroPad)(day, 2)];
|
|
172
|
+
});
|
|
173
|
+
// Builds dates to be displayed from next month
|
|
174
|
+
const nextMonthDates = [...new Array(daysFromNextMonth)].map((n, index) => {
|
|
175
|
+
const day = index + 1;
|
|
176
|
+
return [nextMonthYear, (0, exports.zeroPad)(nextMonth, 2), (0, exports.zeroPad)(day, 2)];
|
|
177
|
+
});
|
|
178
|
+
// Combines all dates from previous, current and next months
|
|
179
|
+
return [...prevMonthDates, ...thisMonthDates, ...nextMonthDates];
|
|
180
|
+
};
|
|
181
|
+
exports.default = calendarBuilder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Calendar";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var Calendar_1 = require("./Calendar");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Calendar_1).default; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import { Size } from "../core";
|
|
3
|
+
interface CheckBoxProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: Size;
|
|
6
|
+
defaultValue?: boolean;
|
|
7
|
+
value?: boolean | undefined;
|
|
8
|
+
partialCheck?: boolean;
|
|
9
|
+
onChange?: (value: boolean) => void;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
}
|
|
12
|
+
declare const CheckBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<CheckBoxProps, never>> & string & Omit<({ className, defaultValue, value, partialCheck, onChange, }: CheckBoxProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
13
|
+
export default CheckBox;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const fa_1 = require("react-icons/fa");
|
|
10
|
+
const CheckBox = (0, styled_components_1.default)(({ className, defaultValue = false, value, partialCheck = false, onChange = () => { }, }) => {
|
|
11
|
+
const [checkedState, setCheckedState] = (0, react_1.useState)(defaultValue);
|
|
12
|
+
const handleChange = (e) => {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
setCheckedState(!checkedState);
|
|
15
|
+
onChange(!checkedState);
|
|
16
|
+
};
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
if (value !== undefined)
|
|
19
|
+
setCheckedState(value);
|
|
20
|
+
}, [value]);
|
|
21
|
+
const _checked = value === undefined ? checkedState : value;
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, onClick: handleChange, children: partialCheck === true ? ((0, jsx_runtime_1.jsx)(fa_1.FaRegMinusSquare, { className: "checkbox partial" })) : _checked === true ? ((0, jsx_runtime_1.jsx)(fa_1.FaCheckSquare, { className: "checkbox checked" })) : ((0, jsx_runtime_1.jsx)(fa_1.FaRegSquare, { className: "checkbox unchecked" })) }));
|
|
23
|
+
}) `
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
|
|
28
|
+
.checkbox {
|
|
29
|
+
color: ${(props) => props.theme.palette.primary.main};
|
|
30
|
+
font-size: ${({ size }) => {
|
|
31
|
+
switch (size) {
|
|
32
|
+
case "xs":
|
|
33
|
+
return "12px";
|
|
34
|
+
case "sm":
|
|
35
|
+
return "16px";
|
|
36
|
+
case "md":
|
|
37
|
+
return "24px";
|
|
38
|
+
case "lg":
|
|
39
|
+
return "32px";
|
|
40
|
+
default:
|
|
41
|
+
return "16px";
|
|
42
|
+
}
|
|
43
|
+
}};
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
exports.default = CheckBox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./CheckBox";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var CheckBox_1 = require("./CheckBox");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CheckBox_1).default; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Size, Variant } from "../core";
|
|
3
|
+
interface DateInputProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
defaultValue?: string | null | undefined;
|
|
6
|
+
format?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
arrow?: boolean;
|
|
10
|
+
size?: Size;
|
|
11
|
+
variant?: Variant;
|
|
12
|
+
clearable?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
onChange?: (value: string | null) => void;
|
|
15
|
+
min?: Date;
|
|
16
|
+
max?: Date;
|
|
17
|
+
error?: string;
|
|
18
|
+
width?: string;
|
|
19
|
+
enableCalendar?: boolean;
|
|
20
|
+
utc?: boolean;
|
|
21
|
+
closeOnSelect?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const DateInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<DateInputProps, never>> & string & Omit<({ className, defaultValue, format, label, description, arrow, size, variant, clearable, required, onChange, min, max, error, enableCalendar, utc, closeOnSelect, }: DateInputProps) => import("react/jsx-runtime").JSX.Element, keyof React.Component<any, {}, any>>;
|
|
24
|
+
export default DateInput;
|