@tenancy.nz/ui 1.0.0 → 1.0.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/README.md +0 -69
- package/dist/cjs/components/Alert.cjs +48 -0
- package/dist/cjs/components/Alert.styled.cjs +41 -0
- package/dist/cjs/components/Autocomplete.cjs +176 -0
- package/dist/cjs/components/Autocomplete.styled.cjs +15 -0
- package/dist/cjs/components/Avatar.cjs +52 -0
- package/dist/cjs/components/Avatar.styled.cjs +24 -0
- package/dist/cjs/components/AvatarCropDialog.cjs +200 -0
- package/dist/cjs/components/AvatarCropDialog.styled.cjs +21 -0
- package/dist/cjs/components/AvatarInput.cjs +215 -0
- package/dist/cjs/components/AvatarInput.styled.cjs +151 -0
- package/dist/cjs/components/Badge.cjs +83 -0
- package/dist/cjs/components/Badge.styled.cjs +23 -0
- package/dist/cjs/components/BankAccountInput.cjs +296 -0
- package/dist/cjs/components/BankAccountInput.styled.cjs +163 -0
- package/dist/cjs/components/Bar.cjs +44 -0
- package/dist/cjs/components/Bar.styled.cjs +22 -0
- package/dist/cjs/components/BaseModal.cjs +41 -0
- package/dist/cjs/components/BaseModal.styled.cjs +20 -0
- package/dist/cjs/components/BooleanInput.cjs +173 -0
- package/dist/cjs/components/BooleanInput.styled.cjs +65 -0
- package/dist/cjs/components/BorderedGrid.cjs +46 -0
- package/dist/cjs/components/Box.cjs +97 -0
- package/dist/cjs/components/Button.cjs +48 -0
- package/dist/cjs/components/Button.styled.cjs +106 -0
- package/dist/cjs/components/Card.cjs +61 -0
- package/dist/cjs/components/Card.styled.cjs +15 -0
- package/dist/cjs/components/CardContent.cjs +21 -0
- package/dist/cjs/components/CardContent.styled.cjs +10 -0
- package/dist/cjs/components/Checkbox.cjs +49 -0
- package/dist/cjs/components/Checkbox.styled.cjs +25 -0
- package/dist/cjs/components/CircularProgress.cjs +14 -0
- package/dist/cjs/components/CollapsedText.cjs +88 -0
- package/dist/cjs/components/CollapsedText.styled.cjs +52 -0
- package/dist/cjs/components/Confirmation.cjs +60 -0
- package/dist/cjs/components/Container.cjs +21 -0
- package/dist/cjs/components/CroppedImageInput.cjs +465 -0
- package/dist/cjs/components/CroppedImageInput.styled.cjs +91 -0
- package/dist/cjs/components/CroppedImageInputActions.cjs +78 -0
- package/dist/cjs/components/DateInput.cjs +218 -0
- package/dist/cjs/components/DateInput.styled.cjs +26 -0
- package/dist/cjs/components/DateNumberInput.cjs +175 -0
- package/dist/cjs/components/DateNumberInput.styled.cjs +58 -0
- package/dist/cjs/components/DatePicker.cjs +134 -0
- package/dist/cjs/components/DatePicker.styled.cjs +17 -0
- package/dist/cjs/components/DateSelect.cjs +212 -0
- package/dist/cjs/components/DateSelect.styled.cjs +15 -0
- package/dist/cjs/components/Divider.cjs +67 -0
- package/dist/cjs/components/Divider.styled.cjs +62 -0
- package/dist/cjs/components/DropZone.cjs +153 -0
- package/dist/cjs/components/DropZone.styled.cjs +76 -0
- package/dist/cjs/components/Embed.cjs +41 -0
- package/dist/cjs/components/Embed.styled.cjs +38 -0
- package/dist/cjs/components/FileUpload.cjs +319 -0
- package/dist/cjs/components/FileUpload.styled.cjs +47 -0
- package/dist/cjs/components/FileUploadButton.cjs +117 -0
- package/dist/cjs/components/FileUploadButtonLoader.cjs +27 -0
- package/dist/cjs/components/FileViewer.cjs +117 -0
- package/dist/cjs/components/FileViewer.styled.cjs +29 -0
- package/dist/cjs/components/FlashMessage.cjs +69 -0
- package/dist/cjs/components/FormControl.cjs +102 -0
- package/dist/cjs/components/FormControl.styled.cjs +22 -0
- package/dist/cjs/components/FormFocus.cjs +37 -0
- package/dist/cjs/components/FormLabel.cjs +24 -0
- package/dist/cjs/components/FormLabel.styled.cjs +55 -0
- package/dist/cjs/components/Grid.cjs +52 -0
- package/dist/cjs/components/Grid.styled.cjs +12 -0
- package/dist/cjs/components/Heading.cjs +41 -0
- package/dist/cjs/components/IconButton.cjs +31 -0
- package/dist/cjs/components/IconButton.styled.cjs +31 -0
- package/dist/cjs/components/Icons.cjs +62 -0
- package/dist/cjs/components/LinearProgress.cjs +14 -0
- package/dist/cjs/components/Link.cjs +37 -0
- package/dist/cjs/components/Link.styled.cjs +39 -0
- package/dist/cjs/components/Media.cjs +44 -0
- package/dist/cjs/components/Media.styled.cjs +46 -0
- package/dist/cjs/components/Modal.cjs +56 -0
- package/dist/cjs/components/ModalActions.cjs +23 -0
- package/dist/cjs/components/ModalContent.cjs +32 -0
- package/dist/cjs/components/ModalHeader.cjs +24 -0
- package/dist/cjs/components/ModalHeader.styled.cjs +29 -0
- package/dist/cjs/components/Nameplate.cjs +110 -0
- package/dist/cjs/components/Nameplate.styled.cjs +49 -0
- package/dist/cjs/components/Pagination.cjs +147 -0
- package/dist/cjs/components/Pagination.styled.cjs +83 -0
- package/dist/cjs/components/Paper.cjs +34 -0
- package/dist/cjs/components/Paper.styled.cjs +63 -0
- package/dist/cjs/components/Popper.cjs +64 -0
- package/dist/cjs/components/PropertyCard.cjs +222 -0
- package/dist/cjs/components/PropertyCard.styled.cjs +67 -0
- package/dist/cjs/components/Radio.cjs +49 -0
- package/dist/cjs/components/Radio.styled.cjs +25 -0
- package/dist/cjs/components/Rating.cjs +14 -0
- package/dist/cjs/components/Select.cjs +105 -0
- package/dist/cjs/components/Select.styled.cjs +104 -0
- package/dist/cjs/components/Skeleton.cjs +23 -0
- package/dist/cjs/components/StatusMessage.cjs +27 -0
- package/dist/cjs/components/StepIcon.cjs +50 -0
- package/dist/cjs/components/StepIcon.styled.cjs +57 -0
- package/dist/cjs/components/Stepper.cjs +58 -0
- package/dist/cjs/components/Stepper.styled.cjs +61 -0
- package/dist/cjs/components/SuccessModal.cjs +43 -0
- package/dist/cjs/components/SuccessModal.styled.cjs +22 -0
- package/dist/cjs/components/Switch.cjs +46 -0
- package/dist/cjs/components/Switch.styled.cjs +109 -0
- package/dist/cjs/components/Tab.cjs +39 -0
- package/dist/cjs/components/Tab.styled.cjs +14 -0
- package/dist/cjs/components/TabPanel.cjs +30 -0
- package/dist/cjs/components/TabPanel.styled.cjs +12 -0
- package/dist/cjs/components/Table.cjs +21 -0
- package/dist/cjs/components/TableBody.cjs +21 -0
- package/dist/cjs/components/TableCell.cjs +21 -0
- package/dist/cjs/components/TableContainer.cjs +21 -0
- package/dist/cjs/components/TableFooter.cjs +21 -0
- package/dist/cjs/components/TableHead.cjs +21 -0
- package/dist/cjs/components/TableRow.cjs +21 -0
- package/dist/cjs/components/Tabs.cjs +65 -0
- package/dist/cjs/components/Tabs.styled.cjs +90 -0
- package/dist/cjs/components/Tag.cjs +37 -0
- package/dist/cjs/components/Tag.styled.cjs +120 -0
- package/dist/cjs/components/Text.cjs +36 -0
- package/dist/cjs/components/TextInput.cjs +145 -0
- package/dist/cjs/components/TextInput.styled.cjs +117 -0
- package/dist/cjs/components/ThemeProvider.cjs +43 -0
- package/dist/cjs/components/TimeInput.cjs +248 -0
- package/dist/cjs/components/TimeInput.styled.cjs +38 -0
- package/dist/cjs/components/Tooltip.cjs +40 -0
- package/dist/cjs/components/Tooltip.styled.cjs +55 -0
- package/dist/cjs/components/Truncate.cjs +23 -0
- package/dist/cjs/index.cjs +182 -0
- package/dist/cjs/theme/index.cjs +252 -0
- package/dist/cjs/utils/animations.cjs +68 -0
- package/dist/cjs/utils/colors.cjs +31 -0
- package/dist/cjs/utils/constants.cjs +8 -0
- package/dist/cjs/utils/files.cjs +44 -0
- package/dist/cjs/utils/helpers/array.cjs +24 -0
- package/dist/cjs/utils/helpers/boolean.cjs +25 -0
- package/dist/cjs/utils/helpers/date.cjs +11 -0
- package/dist/cjs/utils/helpers/dateSelect.cjs +41 -0
- package/dist/cjs/utils/helpers/file.cjs +53 -0
- package/dist/cjs/utils/helpers/index.cjs +36 -0
- package/dist/cjs/utils/helpers/number.cjs +18 -0
- package/dist/cjs/utils/helpers/object.cjs +97 -0
- package/dist/cjs/utils/helpers/string.cjs +21 -0
- package/dist/cjs/utils/helpers/time.cjs +64 -0
- package/dist/cjs/utils/loadFont.cjs +19 -0
- package/dist/cjs/utils/useResize.cjs +24 -0
- package/dist/esm/components/Alert.js +44 -0
- package/dist/esm/components/Alert.styled.js +36 -0
- package/dist/esm/components/Autocomplete.js +172 -0
- package/dist/esm/components/Autocomplete.styled.js +13 -0
- package/dist/esm/components/Avatar.js +48 -0
- package/dist/esm/components/Avatar.styled.js +22 -0
- package/dist/esm/components/AvatarCropDialog.js +196 -0
- package/dist/esm/components/AvatarCropDialog.styled.js +19 -0
- package/dist/esm/components/AvatarInput.js +211 -0
- package/dist/esm/components/AvatarInput.styled.js +143 -0
- package/dist/esm/components/Badge.js +79 -0
- package/dist/esm/components/Badge.styled.js +21 -0
- package/dist/esm/components/BankAccountInput.js +292 -0
- package/dist/esm/components/BankAccountInput.styled.js +158 -0
- package/dist/esm/components/Bar.js +40 -0
- package/dist/esm/components/Bar.styled.js +20 -0
- package/dist/esm/components/BaseModal.js +37 -0
- package/dist/esm/components/BaseModal.styled.js +16 -0
- package/dist/esm/components/BooleanInput.js +169 -0
- package/dist/esm/components/BooleanInput.styled.js +62 -0
- package/dist/esm/components/BorderedGrid.js +42 -0
- package/dist/esm/components/Box.js +93 -0
- package/dist/esm/components/Button.js +44 -0
- package/dist/esm/components/Button.styled.js +96 -0
- package/dist/esm/components/Card.js +57 -0
- package/dist/esm/components/Card.styled.js +13 -0
- package/dist/esm/components/CardContent.js +17 -0
- package/dist/esm/components/CardContent.styled.js +8 -0
- package/dist/esm/components/Checkbox.js +45 -0
- package/dist/esm/components/Checkbox.styled.js +23 -0
- package/dist/esm/components/CircularProgress.js +10 -0
- package/dist/esm/components/CollapsedText.js +84 -0
- package/dist/esm/components/CollapsedText.styled.js +48 -0
- package/dist/esm/components/Confirmation.js +56 -0
- package/dist/esm/components/Container.js +17 -0
- package/dist/esm/components/CroppedImageInput.js +461 -0
- package/dist/esm/components/CroppedImageInput.styled.js +85 -0
- package/dist/esm/components/CroppedImageInputActions.js +74 -0
- package/dist/esm/components/DateInput.js +214 -0
- package/dist/esm/components/DateInput.styled.js +21 -0
- package/dist/esm/components/DateNumberInput.js +171 -0
- package/dist/esm/components/DateNumberInput.styled.js +55 -0
- package/dist/esm/components/DatePicker.js +130 -0
- package/dist/esm/components/DatePicker.styled.js +15 -0
- package/dist/esm/components/DateSelect.js +208 -0
- package/dist/esm/components/DateSelect.styled.js +11 -0
- package/dist/esm/components/Divider.js +63 -0
- package/dist/esm/components/Divider.styled.js +60 -0
- package/dist/esm/components/DropZone.js +149 -0
- package/dist/esm/components/DropZone.styled.js +71 -0
- package/dist/esm/components/Embed.js +37 -0
- package/dist/esm/components/Embed.styled.js +34 -0
- package/dist/esm/components/FileUpload.js +315 -0
- package/dist/esm/components/FileUpload.styled.js +43 -0
- package/dist/esm/components/FileUploadButton.js +113 -0
- package/dist/esm/components/FileUploadButtonLoader.js +23 -0
- package/dist/esm/components/FileViewer.js +113 -0
- package/dist/esm/components/FileViewer.styled.js +25 -0
- package/dist/esm/components/FlashMessage.js +65 -0
- package/dist/esm/components/FormControl.js +98 -0
- package/dist/esm/components/FormControl.styled.js +18 -0
- package/dist/esm/components/FormFocus.js +33 -0
- package/dist/esm/components/FormLabel.js +20 -0
- package/dist/esm/components/FormLabel.styled.js +51 -0
- package/dist/esm/components/Grid.js +48 -0
- package/dist/esm/components/Grid.styled.js +10 -0
- package/dist/esm/components/Heading.js +37 -0
- package/dist/esm/components/IconButton.js +27 -0
- package/dist/esm/components/IconButton.styled.js +27 -0
- package/dist/esm/components/Icons.js +58 -0
- package/dist/esm/components/LinearProgress.js +10 -0
- package/dist/esm/components/Link.js +33 -0
- package/dist/esm/components/Link.styled.js +37 -0
- package/dist/esm/components/Media.js +40 -0
- package/dist/esm/components/Media.styled.js +42 -0
- package/dist/esm/components/Modal.js +52 -0
- package/dist/esm/components/ModalActions.js +19 -0
- package/dist/esm/components/ModalContent.js +28 -0
- package/dist/esm/components/ModalHeader.js +20 -0
- package/dist/esm/components/ModalHeader.styled.js +25 -0
- package/dist/esm/components/Nameplate.js +106 -0
- package/dist/esm/components/Nameplate.styled.js +44 -0
- package/dist/esm/components/Pagination.js +143 -0
- package/dist/esm/components/Pagination.styled.js +79 -0
- package/dist/esm/components/Paper.js +30 -0
- package/dist/esm/components/Paper.styled.js +59 -0
- package/dist/esm/components/Popper.js +60 -0
- package/dist/esm/components/PropertyCard.js +218 -0
- package/dist/esm/components/PropertyCard.styled.js +62 -0
- package/dist/esm/components/Radio.js +45 -0
- package/dist/esm/components/Radio.styled.js +23 -0
- package/dist/esm/components/Rating.js +10 -0
- package/dist/esm/components/Select.js +101 -0
- package/dist/esm/components/Select.styled.js +95 -0
- package/dist/esm/components/Skeleton.js +19 -0
- package/dist/esm/components/StatusMessage.js +23 -0
- package/dist/esm/components/StepIcon.js +46 -0
- package/dist/esm/components/StepIcon.styled.js +54 -0
- package/dist/esm/components/Stepper.js +54 -0
- package/dist/esm/components/Stepper.styled.js +59 -0
- package/dist/esm/components/SuccessModal.js +39 -0
- package/dist/esm/components/SuccessModal.styled.js +19 -0
- package/dist/esm/components/Switch.js +42 -0
- package/dist/esm/components/Switch.styled.js +103 -0
- package/dist/esm/components/Tab.js +35 -0
- package/dist/esm/components/Tab.styled.js +12 -0
- package/dist/esm/components/TabPanel.js +26 -0
- package/dist/esm/components/TabPanel.styled.js +10 -0
- package/dist/esm/components/Table.js +17 -0
- package/dist/esm/components/TableBody.js +17 -0
- package/dist/esm/components/TableCell.js +17 -0
- package/dist/esm/components/TableContainer.js +17 -0
- package/dist/esm/components/TableFooter.js +17 -0
- package/dist/esm/components/TableHead.js +17 -0
- package/dist/esm/components/TableRow.js +17 -0
- package/dist/esm/components/Tabs.js +61 -0
- package/dist/esm/components/Tabs.styled.js +88 -0
- package/dist/esm/components/Tag.js +33 -0
- package/dist/esm/components/Tag.styled.js +114 -0
- package/dist/esm/components/Text.js +32 -0
- package/dist/esm/components/TextInput.js +141 -0
- package/dist/esm/components/TextInput.styled.js +105 -0
- package/dist/esm/components/ThemeProvider.js +39 -0
- package/dist/esm/components/TimeInput.js +244 -0
- package/dist/esm/components/TimeInput.styled.js +34 -0
- package/dist/esm/components/Tooltip.js +36 -0
- package/dist/esm/components/Tooltip.styled.js +51 -0
- package/dist/esm/components/Truncate.js +19 -0
- package/dist/esm/index.js +84 -0
- package/dist/esm/theme/index.js +247 -0
- package/dist/esm/utils/animations.js +60 -0
- package/dist/esm/utils/colors.js +28 -0
- package/dist/esm/utils/constants.js +5 -0
- package/dist/esm/utils/files.js +39 -0
- package/dist/esm/utils/helpers/array.js +20 -0
- package/dist/esm/utils/helpers/boolean.js +16 -0
- package/dist/esm/utils/helpers/date.js +6 -0
- package/dist/esm/utils/helpers/dateSelect.js +35 -0
- package/dist/esm/utils/helpers/file.js +47 -0
- package/dist/esm/utils/helpers/index.js +6 -0
- package/dist/esm/utils/helpers/number.js +15 -0
- package/dist/esm/utils/helpers/object.js +88 -0
- package/dist/esm/utils/helpers/string.js +15 -0
- package/dist/esm/utils/helpers/time.js +59 -0
- package/dist/esm/utils/loadFont.js +15 -0
- package/dist/esm/utils/useResize.js +20 -0
- package/package.json +2 -2
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const palette = {
|
|
3
|
+
default: {
|
|
4
|
+
light: "#F1F1F1",
|
|
5
|
+
main: "#6D6D6D",
|
|
6
|
+
dark: "#575757",
|
|
7
|
+
contrastText: "#fff"
|
|
8
|
+
},
|
|
9
|
+
grey: {
|
|
10
|
+
main: "#BCBCBC",
|
|
11
|
+
transparent: "rgba(140,152, 178, 0.10)"
|
|
12
|
+
},
|
|
13
|
+
primary: {
|
|
14
|
+
main: "#0E0044",
|
|
15
|
+
light: "#3e3369",
|
|
16
|
+
dark: "#0b0036",
|
|
17
|
+
contrastText: "#fff"
|
|
18
|
+
},
|
|
19
|
+
primaryAlt: {
|
|
20
|
+
main: "#264A9A",
|
|
21
|
+
dark: "#142855",
|
|
22
|
+
contrastText: "#fff"
|
|
23
|
+
},
|
|
24
|
+
secondary: {
|
|
25
|
+
// main: '#394869',
|
|
26
|
+
// light: '#526897',
|
|
27
|
+
// dark: '#2E3B57',
|
|
28
|
+
// contrastText: '#fff',
|
|
29
|
+
main: "#274A9A",
|
|
30
|
+
light: "#2F5BC0",
|
|
31
|
+
dark: "#254794",
|
|
32
|
+
contrastText: "#fff"
|
|
33
|
+
},
|
|
34
|
+
secondaryAlt: {
|
|
35
|
+
main: "#AA0270",
|
|
36
|
+
dark: "#7E0052",
|
|
37
|
+
contrastText: "#fff"
|
|
38
|
+
},
|
|
39
|
+
tertiary: {
|
|
40
|
+
light: "#3dcdb5",
|
|
41
|
+
main: "#0CC1A3",
|
|
42
|
+
dark: "#0a9a82",
|
|
43
|
+
contrastText: "#fff"
|
|
44
|
+
},
|
|
45
|
+
// error: {
|
|
46
|
+
// main: '#721C24',
|
|
47
|
+
// light: '#F8D7DA',
|
|
48
|
+
// dark: '#721C24',
|
|
49
|
+
// contrastText: '#fff',
|
|
50
|
+
// },
|
|
51
|
+
error: {
|
|
52
|
+
main: "#d1293d",
|
|
53
|
+
light: "#fcf8f8",
|
|
54
|
+
dark: "#921d2b",
|
|
55
|
+
contrastText: "#fff"
|
|
56
|
+
},
|
|
57
|
+
warning: {
|
|
58
|
+
main: "#6C4F25",
|
|
59
|
+
light: "#FFF9C4",
|
|
60
|
+
dark: "#6C4F25",
|
|
61
|
+
contrastText: "#fff"
|
|
62
|
+
},
|
|
63
|
+
success: {
|
|
64
|
+
main: "#155724",
|
|
65
|
+
light: "#E6F9E0",
|
|
66
|
+
dark: "#155724",
|
|
67
|
+
contrastText: "#fff"
|
|
68
|
+
},
|
|
69
|
+
info: {
|
|
70
|
+
main: "#0D47A1",
|
|
71
|
+
light: "#E3F2FD",
|
|
72
|
+
dark: "#0D47A1",
|
|
73
|
+
contrastText: "#fff"
|
|
74
|
+
},
|
|
75
|
+
purple: {
|
|
76
|
+
main: "#7D00C0",
|
|
77
|
+
light: "#F9EDFF",
|
|
78
|
+
dark: "#64009a",
|
|
79
|
+
contrastText: "#fff"
|
|
80
|
+
},
|
|
81
|
+
orange: {
|
|
82
|
+
main: "#AA5B00",
|
|
83
|
+
light: "#FCF2E6",
|
|
84
|
+
dark: "#884900",
|
|
85
|
+
contrastText: "#fff"
|
|
86
|
+
},
|
|
87
|
+
text: {
|
|
88
|
+
primary: "#0e0044",
|
|
89
|
+
secondary: "#274A9A",
|
|
90
|
+
blue: "#1F1C4F",
|
|
91
|
+
body: "#181B25",
|
|
92
|
+
muted: "#757578"
|
|
93
|
+
},
|
|
94
|
+
action: {
|
|
95
|
+
disabled: null,
|
|
96
|
+
disabledBackground: null
|
|
97
|
+
},
|
|
98
|
+
background: {
|
|
99
|
+
default: "#ffffff",
|
|
100
|
+
paper: "#ffffff",
|
|
101
|
+
muted: "#E8E8ED"
|
|
102
|
+
},
|
|
103
|
+
divider: "#707070"
|
|
104
|
+
};
|
|
105
|
+
const breakpoints = {
|
|
106
|
+
values: {
|
|
107
|
+
xs: 0,
|
|
108
|
+
sm: 768,
|
|
109
|
+
md: 992,
|
|
110
|
+
lg: 1280,
|
|
111
|
+
xl: 1920
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const typography = {
|
|
115
|
+
fontWeightLight: 700,
|
|
116
|
+
fontWeightRegular: 500,
|
|
117
|
+
fontWeightMedium: 600,
|
|
118
|
+
fontWeightBold: 600,
|
|
119
|
+
fontSize: 16,
|
|
120
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
121
|
+
button: {
|
|
122
|
+
fontSize: 16,
|
|
123
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
124
|
+
fontWeight: 600
|
|
125
|
+
},
|
|
126
|
+
h1: {
|
|
127
|
+
fontSize: 24,
|
|
128
|
+
fontWeight: 600,
|
|
129
|
+
lineHeight: 1.3,
|
|
130
|
+
[`@media (min-width: ${breakpoints.values.md}px)`]: {
|
|
131
|
+
fontSize: 32
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
h2: {
|
|
135
|
+
fontSize: 22,
|
|
136
|
+
fontWeight: 600,
|
|
137
|
+
lineHeight: 1.3,
|
|
138
|
+
[`@media (min-width: ${breakpoints.values.md}px)`]: {
|
|
139
|
+
fontSize: 28
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
h3: {
|
|
143
|
+
fontSize: 18,
|
|
144
|
+
fontWeight: 600,
|
|
145
|
+
lineHeight: 1.3,
|
|
146
|
+
[`@media (min-width: ${breakpoints.values.md}px)`]: {
|
|
147
|
+
fontSize: 24
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
h4: {
|
|
151
|
+
fontSize: 17,
|
|
152
|
+
fontWeight: 600,
|
|
153
|
+
lineHeight: 1.3,
|
|
154
|
+
[`@media (min-width: ${breakpoints.values.md}px)`]: {
|
|
155
|
+
fontSize: 19
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
h5: {
|
|
159
|
+
fontSize: 17,
|
|
160
|
+
fontWeight: 600,
|
|
161
|
+
lineHeight: 1.3
|
|
162
|
+
},
|
|
163
|
+
h6: {
|
|
164
|
+
fontSize: 13,
|
|
165
|
+
fontWeight: 600,
|
|
166
|
+
lineHeight: 1.3
|
|
167
|
+
},
|
|
168
|
+
subtitle1: {
|
|
169
|
+
fontSize: 22,
|
|
170
|
+
lineHeight: "inherit"
|
|
171
|
+
},
|
|
172
|
+
subtitle2: {
|
|
173
|
+
fontSize: 22,
|
|
174
|
+
fontWeight: 400
|
|
175
|
+
},
|
|
176
|
+
body1: {
|
|
177
|
+
fontSize: 15,
|
|
178
|
+
fontWeight: 500
|
|
179
|
+
},
|
|
180
|
+
body2: {
|
|
181
|
+
fontSize: 14
|
|
182
|
+
},
|
|
183
|
+
size: {
|
|
184
|
+
scale: (factor) => `${0.25 * factor}em`,
|
|
185
|
+
small: "16px",
|
|
186
|
+
medium: "18px",
|
|
187
|
+
large: "22px"
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const shape = {
|
|
191
|
+
borderRadius: 4
|
|
192
|
+
};
|
|
193
|
+
const components = {
|
|
194
|
+
MuiBackdrop: {
|
|
195
|
+
styleOverrides: {
|
|
196
|
+
root: {
|
|
197
|
+
backgroundColor: "rgba(39, 50, 74, 0.8)"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
MuiTouchRipple: {
|
|
202
|
+
styleOverrides: {
|
|
203
|
+
root: {
|
|
204
|
+
opacity: 0,
|
|
205
|
+
visiblity: "hidden",
|
|
206
|
+
display: "none"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
MuiTooltip: {
|
|
211
|
+
styleOverrides: {
|
|
212
|
+
tooltip: {
|
|
213
|
+
backgroundColor: "rgba(39, 50, 74, 0.7)"
|
|
214
|
+
},
|
|
215
|
+
arrow: {
|
|
216
|
+
color: "rgba(39, 50, 74, 0.7)"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const spacing = (factor) => `${0.25 * factor}rem`;
|
|
222
|
+
const props = {
|
|
223
|
+
MuiButton: {
|
|
224
|
+
disableRipple: true,
|
|
225
|
+
disableFocusRipple: true
|
|
226
|
+
},
|
|
227
|
+
MuiButtonBase: {
|
|
228
|
+
disableRipple: true,
|
|
229
|
+
disableFocusRipple: true
|
|
230
|
+
},
|
|
231
|
+
MuiLoadingButton: {
|
|
232
|
+
disableRipple: true,
|
|
233
|
+
disableFocusRipple: true
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const theme = {
|
|
237
|
+
palette,
|
|
238
|
+
typography,
|
|
239
|
+
spacing,
|
|
240
|
+
shape,
|
|
241
|
+
breakpoints,
|
|
242
|
+
props,
|
|
243
|
+
components
|
|
244
|
+
};
|
|
245
|
+
const fontUrl = "https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap";
|
|
246
|
+
|
|
247
|
+
export { theme as default, fontUrl };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { keyframes, css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const easing = {
|
|
5
|
+
rubber: "cubic-bezier(0.175, 0.885, 0.335, 1.05)"
|
|
6
|
+
};
|
|
7
|
+
const rotate360 = keyframes`
|
|
8
|
+
0% {
|
|
9
|
+
transform: rotate(0deg);
|
|
10
|
+
}
|
|
11
|
+
100% {
|
|
12
|
+
transform: rotate(1turn);
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
const glow = keyframes`
|
|
16
|
+
0%, 100% { opacity: 1; }
|
|
17
|
+
50% { opacity: .4; }
|
|
18
|
+
`;
|
|
19
|
+
const float = keyframes`
|
|
20
|
+
0% { transform: translateY(1px); }
|
|
21
|
+
25% { transform: translateY(0px); }
|
|
22
|
+
50% { transform: translateY(-3px); }
|
|
23
|
+
100% { transform: translateY(1px); }
|
|
24
|
+
`;
|
|
25
|
+
const jiggle = keyframes`
|
|
26
|
+
0%, 100% { transform:translate3d(0,0,0); }
|
|
27
|
+
12.5%, 62.5% { transform:translate3d(-4px,0,0); }
|
|
28
|
+
37.5%, 87.5% { transform: translate3d(4px,0,0); }
|
|
29
|
+
`;
|
|
30
|
+
const shake = keyframes`
|
|
31
|
+
0% { transform:rotate(-3deg) }
|
|
32
|
+
1.68421% { transform:rotate(3deg) }
|
|
33
|
+
2.10526% { transform:rotate(6deg) }
|
|
34
|
+
3.78947% { transform:rotate(-6deg) }
|
|
35
|
+
4.21053% { transform:rotate(-6deg) }
|
|
36
|
+
5.89474% { transform:rotate(6deg) }
|
|
37
|
+
6.31579% { transform:rotate(6deg) }
|
|
38
|
+
8% { transform:rotate(-6deg) }
|
|
39
|
+
8.42105% { transform:rotate(-6deg) }
|
|
40
|
+
10.10526% { transform:rotate(6deg) }
|
|
41
|
+
10.52632% { transform:rotate(6deg) }
|
|
42
|
+
12.21053% { transform:rotate(-6deg) }
|
|
43
|
+
12.63158% { transform:rotate(-6deg) }
|
|
44
|
+
14.31579% { transform:rotate(6deg) }
|
|
45
|
+
15.78947% { transform:rotate(0deg) }
|
|
46
|
+
100% { transform:rotate(0deg) }
|
|
47
|
+
`;
|
|
48
|
+
const inlineGlow = css`
|
|
49
|
+
animation: ${glow} 1.5s ease-in-out infinite;
|
|
50
|
+
background-color: #eee !important;
|
|
51
|
+
color: transparent !important;
|
|
52
|
+
cursor: default;
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
user-select: none;
|
|
55
|
+
background-clip: padding-box !important;
|
|
56
|
+
border: none !important;
|
|
57
|
+
box-shadow: none !important;
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
export { easing, float, glow, inlineGlow, jiggle, rotate360, shake };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const hexToRgba = (hex, opacity) => {
|
|
3
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
4
|
+
return result ? `rgba(${[
|
|
5
|
+
parseInt(result[1], 16),
|
|
6
|
+
parseInt(result[2], 16),
|
|
7
|
+
parseInt(result[3], 16)
|
|
8
|
+
].join()},${opacity})` : null;
|
|
9
|
+
};
|
|
10
|
+
const mixColors = (firstColor, secondColor, weight = 50) => {
|
|
11
|
+
const decimalToHex = (d) => d.toString(16);
|
|
12
|
+
const hexToDecimal = (h) => parseInt(h, 16);
|
|
13
|
+
let color = "#";
|
|
14
|
+
const color1 = firstColor.replace("#", "");
|
|
15
|
+
const color2 = secondColor.replace("#", "");
|
|
16
|
+
for (let i = 0; i <= 5; i += 2) {
|
|
17
|
+
const v1 = hexToDecimal(color1.substr(i, 2));
|
|
18
|
+
const v2 = hexToDecimal(color2.substr(i, 2));
|
|
19
|
+
let val = decimalToHex(Math.floor(v2 + (v1 - v2) * (weight / 100)));
|
|
20
|
+
while (val.length < 2) {
|
|
21
|
+
val = `0${val}`;
|
|
22
|
+
}
|
|
23
|
+
color += val;
|
|
24
|
+
}
|
|
25
|
+
return color;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { hexToRgba, mixColors };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import mime from 'mime/lite';
|
|
3
|
+
|
|
4
|
+
const getFileNameFromURL = (url) => {
|
|
5
|
+
if (url) {
|
|
6
|
+
const cleanURL = url.split(/[?#]/)[0];
|
|
7
|
+
return cleanURL.substring(cleanURL.lastIndexOf("/") + 1);
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
};
|
|
11
|
+
const getFileName = (file) => {
|
|
12
|
+
if (file.filename) {
|
|
13
|
+
return file.filename;
|
|
14
|
+
}
|
|
15
|
+
if (file.url) {
|
|
16
|
+
return getFileNameFromURL(file.url);
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
19
|
+
};
|
|
20
|
+
const getFileExtension = (file) => {
|
|
21
|
+
if (file.filetype) {
|
|
22
|
+
return mime.getExtension(file.filetype);
|
|
23
|
+
}
|
|
24
|
+
let filetype = mime.getType(getFileName(file));
|
|
25
|
+
if (!filetype) {
|
|
26
|
+
filetype = mime.getType(getFileNameFromURL(file.url || file));
|
|
27
|
+
}
|
|
28
|
+
if (filetype) {
|
|
29
|
+
return mime.getExtension(filetype);
|
|
30
|
+
}
|
|
31
|
+
return "unsupported";
|
|
32
|
+
};
|
|
33
|
+
const isImage = (file) => {
|
|
34
|
+
const extension = getFileExtension(file);
|
|
35
|
+
const extensions = ["jpg", "jpeg", "png", "gif", "svg"];
|
|
36
|
+
return extensions.includes(extension);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { getFileExtension, getFileName, getFileNameFromURL, isImage };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { isEmpty, isArray } from './boolean.js';
|
|
3
|
+
|
|
4
|
+
const implode = (delimiter, arr, noEmpty = true) => (noEmpty ? arr.filter((item) => !isEmpty(item)) : arr).join(delimiter);
|
|
5
|
+
const range = (start, end, step = 1) => {
|
|
6
|
+
if (start === end) {
|
|
7
|
+
return [start];
|
|
8
|
+
}
|
|
9
|
+
return [start, ...range(start + step, end, step)];
|
|
10
|
+
};
|
|
11
|
+
const arrayUnique = (arr) => {
|
|
12
|
+
if (!isArray(arr)) {
|
|
13
|
+
console.error("first argument should be an array.");
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const iterator = (value, index, self) => self.indexOf(value) === index;
|
|
17
|
+
return arr.filter(iterator);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { arrayUnique, implode, range };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const isEmpty = (val) => {
|
|
3
|
+
if (val === false || val === null || val === void 0 || val === "" || val === 0 || Array.isArray(val) && val.length === 0 || typeof val === "object" && Object.keys(val).length === 0) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
return false;
|
|
7
|
+
};
|
|
8
|
+
const isNotEmpty = (val) => !isEmpty(val);
|
|
9
|
+
const isObject = (object) => typeof object === "object" && object instanceof Object && !Array.isArray(object);
|
|
10
|
+
const isArray = (value) => Array.isArray(value);
|
|
11
|
+
const isString = (value) => typeof value === "string";
|
|
12
|
+
const isFunction = (value) => typeof value === "function";
|
|
13
|
+
const isNumber = (val) => /^\d+$/.test(val);
|
|
14
|
+
const isNumeric = (val) => /^(?!0\d)\d*(\.\d+)?$/.test(val);
|
|
15
|
+
|
|
16
|
+
export { isArray, isEmpty, isFunction, isNotEmpty, isNumber, isNumeric, isObject, isString };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { range } from './array.js';
|
|
3
|
+
import './date.js';
|
|
4
|
+
import { strPadStart, toString } from './string.js';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
|
|
7
|
+
const rangeYearValue = (val) => {
|
|
8
|
+
if (val === "now" || !val) {
|
|
9
|
+
return dayjs().get("year");
|
|
10
|
+
}
|
|
11
|
+
if (val.indexOf("-") === 0) {
|
|
12
|
+
return dayjs().subtract(parseInt(val.substr(1), 10), "year").get("year");
|
|
13
|
+
}
|
|
14
|
+
const literal = dayjs(val, "YYYY").get("year");
|
|
15
|
+
return literal || dayjs().add(parseInt(val, 10), "year").get("year");
|
|
16
|
+
};
|
|
17
|
+
const getYearRange = (format) => {
|
|
18
|
+
const [minYear, maxYear] = format.split(":");
|
|
19
|
+
return [rangeYearValue(minYear), rangeYearValue(maxYear)];
|
|
20
|
+
};
|
|
21
|
+
const dayOptions = () => {
|
|
22
|
+
const options = range(1, 31).map((val) => strPadStart(val, 2, "0"));
|
|
23
|
+
return ["", ...options];
|
|
24
|
+
};
|
|
25
|
+
const monthOptions = () => {
|
|
26
|
+
const options = range(1, 12).map((val) => strPadStart(val, 2, "0"));
|
|
27
|
+
return ["", ...options];
|
|
28
|
+
};
|
|
29
|
+
const yearOptions = (rng) => {
|
|
30
|
+
const [min, max] = getYearRange(rng);
|
|
31
|
+
const options = range(min, max).map((val) => toString(val));
|
|
32
|
+
return ["", ...options];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { dayOptions, getYearRange, monthOptions, rangeYearValue, yearOptions };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import mime from 'mime/lite';
|
|
3
|
+
|
|
4
|
+
const getFileNameFromURL = (file) => {
|
|
5
|
+
if (file.url) {
|
|
6
|
+
const cleanURL = file.url.split(/[?#]/)[0];
|
|
7
|
+
return cleanURL.substring(cleanURL.lastIndexOf("/") + 1);
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
};
|
|
11
|
+
const getFileName = (file) => {
|
|
12
|
+
if (file.filename) {
|
|
13
|
+
return file.filename;
|
|
14
|
+
}
|
|
15
|
+
if (file.url) {
|
|
16
|
+
return getFileNameFromURL(file);
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
19
|
+
};
|
|
20
|
+
const getFileExtension = (file) => {
|
|
21
|
+
if (file.filetype) {
|
|
22
|
+
return mime.getExtension(file.filetype);
|
|
23
|
+
}
|
|
24
|
+
let filetype = mime.getType(getFileName(file));
|
|
25
|
+
if (!filetype) {
|
|
26
|
+
filetype = mime.getType(getFileNameFromURL(file));
|
|
27
|
+
}
|
|
28
|
+
if (filetype) {
|
|
29
|
+
return mime.getExtension(filetype);
|
|
30
|
+
}
|
|
31
|
+
return "unsupported";
|
|
32
|
+
};
|
|
33
|
+
const isImage = (file) => {
|
|
34
|
+
const extension = getFileExtension(file);
|
|
35
|
+
const extensions = ["jpg", "jpeg", "png", "gif", "svg"];
|
|
36
|
+
return extensions.includes(extension);
|
|
37
|
+
};
|
|
38
|
+
const formatBytes = (bytes, decimals = 2) => {
|
|
39
|
+
if (bytes === 0) return "0 Bytes";
|
|
40
|
+
const k = 1024;
|
|
41
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
42
|
+
const sizes = ["Bytes", "KB", "MB"];
|
|
43
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
44
|
+
return `${parseFloat((bytes / k ** i).toFixed(dm))}${sizes[i]}`;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { formatBytes, getFileExtension, getFileName, getFileNameFromURL, isImage };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export { arrayUnique, implode, range } from './array.js';
|
|
3
|
+
export { isArray, isEmpty, isFunction, isNotEmpty, isNumber, isNumeric, isObject, isString } from './boolean.js';
|
|
4
|
+
export { formatBytes, getFileExtension, getFileName, getFileNameFromURL, isImage } from './file.js';
|
|
5
|
+
export { strPadStart, stripNonNumeric, stripTags, toString, ucFirstChar } from './string.js';
|
|
6
|
+
export { getHourOptions, getMeridianOptions, getMinuteOptions, parseTimeStrByFormat } from './time.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { isNumeric } from './boolean.js';
|
|
3
|
+
|
|
4
|
+
const toNumber = (val, radix = 10) => isNumeric(val) ? parseInt(val, radix) : false;
|
|
5
|
+
const toFloat = (val, decimals) => {
|
|
6
|
+
if (isNumeric(val) || !isNaN(val)) {
|
|
7
|
+
if (decimals) {
|
|
8
|
+
return parseFloat(val).toFixed(decimals);
|
|
9
|
+
}
|
|
10
|
+
return parseFloat(val);
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { toFloat, toNumber };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { isObject, isArray, isEmpty, isNotEmpty, isString } from './boolean.js';
|
|
3
|
+
|
|
4
|
+
const pick = (object, props) => {
|
|
5
|
+
if (!isObject(object)) {
|
|
6
|
+
console.error("first argument should be an object.");
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (!isArray(props)) {
|
|
10
|
+
console.error("second argument should be an array.");
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return props.reduce((prevVal, curVal) => {
|
|
14
|
+
if (object.hasOwnProperty(curVal)) {
|
|
15
|
+
return {
|
|
16
|
+
...prevVal,
|
|
17
|
+
[curVal]: object[curVal]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return prevVal;
|
|
21
|
+
}, {});
|
|
22
|
+
};
|
|
23
|
+
const transformArrToObject = (arr, prop) => {
|
|
24
|
+
if (prop) {
|
|
25
|
+
return arr.reduce(
|
|
26
|
+
(obj, item) => ({
|
|
27
|
+
...obj,
|
|
28
|
+
[item[prop]]: item
|
|
29
|
+
}),
|
|
30
|
+
{}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return { ...arr };
|
|
34
|
+
};
|
|
35
|
+
const objectHasAllValues = (obj) => {
|
|
36
|
+
if (isEmpty(obj)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return Object.values(obj).every(isNotEmpty);
|
|
40
|
+
};
|
|
41
|
+
const objectHasSomeValues = (obj) => {
|
|
42
|
+
if (isEmpty(obj)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return Object.values(obj).some(isNotEmpty);
|
|
46
|
+
};
|
|
47
|
+
const getObjectProp = (obj, prop, fallback = "") => prop.split(".").reduce((value, key) => isObject(value) && value[key] || fallback, obj);
|
|
48
|
+
const objectRemoveEmpty = (obj) => {
|
|
49
|
+
if (!isObject(obj)) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
return Object.entries(obj).filter(([, value]) => !!value).reduce(
|
|
53
|
+
(carry, [k, value]) => ({
|
|
54
|
+
...carry,
|
|
55
|
+
[k]: value
|
|
56
|
+
}),
|
|
57
|
+
{}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
const objectOmit = (obj, props) => {
|
|
61
|
+
if (!isObject(obj)) {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
const omit = isString(props) ? [props] : props;
|
|
65
|
+
return Object.keys(obj).reduce((carry, k) => {
|
|
66
|
+
if (omit.includes(k)) {
|
|
67
|
+
return carry;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...carry,
|
|
71
|
+
[k]: obj[k]
|
|
72
|
+
};
|
|
73
|
+
}, {});
|
|
74
|
+
};
|
|
75
|
+
const objectDeepMerge = (target, source) => {
|
|
76
|
+
for (let key in source) {
|
|
77
|
+
if (source.hasOwnProperty(key)) {
|
|
78
|
+
if (isObject(source[key]) && isObject(target[key])) {
|
|
79
|
+
objectDeepMerge(target[key], source[key]);
|
|
80
|
+
} else {
|
|
81
|
+
target[key] = source[key];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export { getObjectProp, objectDeepMerge, objectHasAllValues, objectHasSomeValues, objectOmit, objectRemoveEmpty, pick, transformArrToObject };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { isString } from './boolean.js';
|
|
3
|
+
|
|
4
|
+
const stripTags = (str) => str.replace(/(<([^>]+)>)/gi, "");
|
|
5
|
+
const stripNonNumeric = (str) => {
|
|
6
|
+
if (str && isString(str)) {
|
|
7
|
+
return str.replace(/\D/g, "");
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
};
|
|
11
|
+
const toString = (val) => String(val);
|
|
12
|
+
const strPadStart = (str, targetLength, padString = "") => toString(str).padStart(targetLength, padString);
|
|
13
|
+
const ucFirstChar = (val) => `${String(val).charAt(0).toUpperCase()}${String(val).slice(1)}`;
|
|
14
|
+
|
|
15
|
+
export { strPadStart, stripNonNumeric, stripTags, toString, ucFirstChar };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
4
|
+
import { range } from './array.js';
|
|
5
|
+
import { strPadStart } from './string.js';
|
|
6
|
+
|
|
7
|
+
dayjs.extend(customParseFormat);
|
|
8
|
+
const getHourOptions = (disableFirstOption = false) => {
|
|
9
|
+
const options = range(1, 12).map((hour) => {
|
|
10
|
+
const formatted = strPadStart(hour, 2, "0");
|
|
11
|
+
return {
|
|
12
|
+
label: formatted,
|
|
13
|
+
value: formatted
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
label: "",
|
|
19
|
+
value: "",
|
|
20
|
+
disabled: disableFirstOption
|
|
21
|
+
},
|
|
22
|
+
...options
|
|
23
|
+
];
|
|
24
|
+
};
|
|
25
|
+
const getMinuteOptions = (min, max, step, disableFirstOption = false) => {
|
|
26
|
+
const options = range(min, max, step).map((minute) => {
|
|
27
|
+
const formatted = strPadStart(minute, 2, "0");
|
|
28
|
+
return {
|
|
29
|
+
label: formatted,
|
|
30
|
+
value: formatted
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
label: "",
|
|
36
|
+
value: "",
|
|
37
|
+
disabled: disableFirstOption
|
|
38
|
+
},
|
|
39
|
+
...options
|
|
40
|
+
];
|
|
41
|
+
};
|
|
42
|
+
const getMeridianOptions = (disableFirstOption = false) => [
|
|
43
|
+
{
|
|
44
|
+
label: "",
|
|
45
|
+
value: "",
|
|
46
|
+
disabled: disableFirstOption
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "AM",
|
|
50
|
+
value: "am"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "PM",
|
|
54
|
+
value: "pm"
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
const parseTimeStrByFormat = (timeStr, format = "HH:mm:ss") => dayjs(timeStr, format);
|
|
58
|
+
|
|
59
|
+
export { getHourOptions, getMeridianOptions, getMinuteOptions, parseTimeStrByFormat };
|