ish-ui 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.
Files changed (126) hide show
  1. package/.eslintrc.json +39 -0
  2. package/.gitattributes +3 -0
  3. package/.github/workflows/release-package.yml +33 -0
  4. package/.prettierrc +5 -0
  5. package/README.md +80 -0
  6. package/assets/fonts/inter/Inter-Italic.var.woff2 +0 -0
  7. package/assets/fonts/inter/Inter-Roman.var.woff2 +0 -0
  8. package/assets/fonts/inter/LICENSE.txt +92 -0
  9. package/assets/fonts/inter/index.d.ts +10 -0
  10. package/assets/fonts/inter/inter.scss +17 -0
  11. package/package.json +108 -0
  12. package/src/actions/FieldProcessing.ts +21 -0
  13. package/src/actions/index.ts +10 -0
  14. package/src/appBar/AppBarHelpMenu.tsx +139 -0
  15. package/src/appBar/index.ts +9 -0
  16. package/src/buttons/AddButton.tsx +30 -0
  17. package/src/buttons/TimetableButton.tsx +19 -0
  18. package/src/buttons/index.ts +10 -0
  19. package/src/colorPicker/ColorPicker.tsx +223 -0
  20. package/src/colorPicker/index.ts +9 -0
  21. package/src/dialog/BrowserWarning.tsx +24 -0
  22. package/src/dialog/confirm/ConfirmBase.tsx +59 -0
  23. package/src/dialog/index.ts +11 -0
  24. package/src/dialog/message/Message.tsx +140 -0
  25. package/src/documents/DocumentIconsChooser.tsx +69 -0
  26. package/src/documents/index.ts +10 -0
  27. package/src/documents/utils/index.tsx +71 -0
  28. package/src/dynamicSizeList/DynamicSizeList.tsx +208 -0
  29. package/src/dynamicSizeList/index.ts +9 -0
  30. package/src/fieldMessage/ErrorMessage.tsx +28 -0
  31. package/src/fieldMessage/WarningMessage.tsx +28 -0
  32. package/src/fieldMessage/index.ts +11 -0
  33. package/src/fieldMessage/styles.ts +21 -0
  34. package/src/fileUploader/FileUploaderDialog.tsx +158 -0
  35. package/src/fileUploader/index.ts +9 -0
  36. package/src/formFields/CheckboxField.tsx +90 -0
  37. package/src/formFields/CodeEditorField.tsx +103 -0
  38. package/src/formFields/ColoredCheckBox.tsx +74 -0
  39. package/src/formFields/DateTimeField.tsx +61 -0
  40. package/src/formFields/EditInPlaceDateTimeField.tsx +285 -0
  41. package/src/formFields/EditInPlaceDurationField.tsx +79 -0
  42. package/src/formFields/EditInPlaceField.tsx +131 -0
  43. package/src/formFields/EditInPlaceFieldBase.tsx +241 -0
  44. package/src/formFields/EditInPlaceFileField.tsx +67 -0
  45. package/src/formFields/EditInPlaceMoneyField.tsx +64 -0
  46. package/src/formFields/EditInPlacePhoneField.tsx +97 -0
  47. package/src/formFields/EditInPlaceSearchSelect.tsx +562 -0
  48. package/src/formFields/FieldAdornments.tsx +70 -0
  49. package/src/formFields/FilePreview.tsx +149 -0
  50. package/src/formFields/FormRadioButtons.tsx +62 -0
  51. package/src/formFields/SelectCustomComponents.tsx +228 -0
  52. package/src/formFields/Switch.tsx +146 -0
  53. package/src/formFields/TextField.tsx +60 -0
  54. package/src/formFields/UneditableBase.tsx +101 -0
  55. package/src/formFields/index.ts +27 -0
  56. package/src/index.ts +26 -0
  57. package/src/layout/InfoPill.tsx +36 -0
  58. package/src/layout/index.ts +10 -0
  59. package/src/layout/resizable/ResizableWrapper.tsx +87 -0
  60. package/src/markdownEditor/HtmlEditor.tsx +44 -0
  61. package/src/markdownEditor/WysiwygEditor.tsx +137 -0
  62. package/src/markdownEditor/index.ts +12 -0
  63. package/src/markdownEditor/style.ts +188 -0
  64. package/src/markdownEditor/utils/index.ts +48 -0
  65. package/src/model/AppBar.ts +20 -0
  66. package/src/model/CommomObjects.ts +8 -0
  67. package/src/model/CommonFunctions.ts +20 -0
  68. package/src/model/Confirm.ts +27 -0
  69. package/src/model/Fields.ts +254 -0
  70. package/src/model/NestedEntity.ts +14 -0
  71. package/src/model/Theme.ts +42 -0
  72. package/src/model/index.ts +16 -0
  73. package/src/styles/GlobalStylesProvider.tsx +520 -0
  74. package/src/styles/StylesProviderCustom.tsx +8 -0
  75. package/src/styles/animateStyles.ts +94 -0
  76. package/src/styles/bootstrap.ts +503 -0
  77. package/src/styles/hooks.ts +44 -0
  78. package/src/styles/index.ts +18 -0
  79. package/src/styles/makeStyles.ts +21 -0
  80. package/src/styles/mixins/common.ts +40 -0
  81. package/src/styles/mixins/keyframes.ts +16 -0
  82. package/src/styles/mixins/prefixer.ts +21 -0
  83. package/src/tagsInput/AddTagMenu.tsx +74 -0
  84. package/src/tagsInput/AddTagMenuItem.tsx +50 -0
  85. package/src/tagsInput/TagInputList.tsx +428 -0
  86. package/src/tagsInput/index.ts +4 -0
  87. package/src/themes/appTheme.ts +324 -0
  88. package/src/themes/index.ts +10 -0
  89. package/src/themes/ishTheme.ts +401 -0
  90. package/src/timetable/datePeriodFilter/DayPeriodIcons.tsx +95 -0
  91. package/src/timetable/datePeriodFilter/index.ts +10 -0
  92. package/src/timetable/index.ts +11 -0
  93. package/src/timetable/miniCalendar/CalendarDay.tsx +109 -0
  94. package/src/timetable/miniCalendar/CalendarHeader.tsx +37 -0
  95. package/src/timetable/miniCalendar/CalendarWeekPanel.tsx +35 -0
  96. package/src/timetable/miniCalendar/WeekDay.tsx +49 -0
  97. package/src/timetable/miniCalendar/index.ts +13 -0
  98. package/src/utils/DOM/Links.ts +17 -0
  99. package/src/utils/DOM/getCaretCoordinates.ts +122 -0
  100. package/src/utils/DOM/getOS.ts +32 -0
  101. package/src/utils/DOM/index.ts +34 -0
  102. package/src/utils/dates/datesNormalizing.ts +4 -0
  103. package/src/utils/dates/format.ts +52 -0
  104. package/src/utils/dates/formatRelative.ts +22 -0
  105. package/src/utils/dates/formatString.ts +233 -0
  106. package/src/utils/dates/formatTimezone.ts +37 -0
  107. package/src/utils/dates/index.ts +15 -0
  108. package/src/utils/dates/timetable.ts +46 -0
  109. package/src/utils/events/index.ts +8 -0
  110. package/src/utils/fields/index.ts +23 -0
  111. package/src/utils/formatting/PhoneMasks.ts +320 -0
  112. package/src/utils/formatting/index.tsx +20 -0
  113. package/src/utils/hooks/index.ts +19 -0
  114. package/src/utils/index.ts +15 -0
  115. package/src/utils/numbers/decimalCalculation.ts +26 -0
  116. package/src/utils/numbers/index.ts +11 -0
  117. package/src/utils/numbers/numbersNormalizing.ts +52 -0
  118. package/src/utils/stubs/index.tsx +12 -0
  119. package/src/utils/tags/index.ts +53 -0
  120. package/tools/webpack/webpack.aliases.js +13 -0
  121. package/tools/webpack/webpack.config.dev.js +29 -0
  122. package/tools/webpack/webpack.config.prod.js +36 -0
  123. package/tools/webpack/webpack.helpers.js +26 -0
  124. package/tools/webpack/webpack.plugins.js +15 -0
  125. package/tools/webpack/webpack.rules.js +51 -0
  126. package/tsconfig.json +24 -0
@@ -0,0 +1,401 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2022.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+
9
+ import { createTheme } from '@mui/material/styles';
10
+ import { Components } from '@mui/material/styles/components';
11
+ import { PaletteMode } from '@mui/material';
12
+ import { theme } from './appTheme';
13
+ import {
14
+ AppTheme,
15
+ DarkThemeKey,
16
+ DefaultThemeKey,
17
+ HighcontrastThemeKey,
18
+ MonochromeThemeKey,
19
+ ThemeValues
20
+ } from '@src/model';
21
+
22
+ const createOverrides = (palette):{ components: Components } => ({
23
+ components: {
24
+ MuiButtonBase: {
25
+ styleOverrides: {
26
+ root: {
27
+ userSelect: 'auto',
28
+ }
29
+ }
30
+ },
31
+ MuiCollapse: {
32
+ styleOverrides: {
33
+ entered: {
34
+ height: 'auto',
35
+ overflow: 'visible'
36
+ }
37
+ }
38
+ },
39
+ MuiFormControl: {
40
+ styleOverrides: {
41
+ root: {
42
+ maxWidth: '100%',
43
+ }
44
+ }
45
+ },
46
+ MuiFormControlLabel: {
47
+ styleOverrides: {
48
+ label: {
49
+ fontSize: '14px',
50
+ '&$disabled': {
51
+ color: 'unset'
52
+ }
53
+ },
54
+ disabled: {}
55
+ }
56
+ },
57
+ MuiInput: {
58
+ styleOverrides: {
59
+ underline: {
60
+ '&:before': {
61
+ borderBottom: '1px solid transparent',
62
+ },
63
+ '&:hover:not(.Mui-disabled):not(.primaryContarstUnderline):before': {
64
+ borderBottom: `1px solid ${palette.primary.main}`
65
+ },
66
+ '&.primaryContarstUnderline:hover:not(.Mui-disabled):before': {
67
+ borderBottom: `1px solid ${palette.primary.contrastText}`
68
+ }
69
+ }
70
+ }
71
+ },
72
+ MuiInputLabel: {
73
+ styleOverrides: {
74
+ shrink: {
75
+ '& .inputAdornmentIcon': {
76
+ transform: 'scale(1.25)'
77
+ }
78
+ }
79
+ }
80
+ },
81
+ MuiSelect: {
82
+ styleOverrides: {
83
+ select: {
84
+ '&:focus': {
85
+ backgroundColor: 'none',
86
+ },
87
+ },
88
+ }
89
+ },
90
+ MuiFormLabel: {
91
+ styleOverrides: {
92
+ root: {
93
+ lineHeight: 1.2,
94
+ whiteSpace: 'nowrap'
95
+ },
96
+ }
97
+ },
98
+ MuiInputBase: {
99
+ styleOverrides: {
100
+ root: {
101
+ maxWidth: '100%',
102
+ width: '100%',
103
+ MuiInput: {
104
+ root: {
105
+ '&:before': {
106
+ borderBottom: '1px solid transparent',
107
+ },
108
+ '&:hover:not(.Mui-disabled):not(.primaryContarstUnderline):before': {
109
+ borderBottom: `1px solid ${palette.primary.main}`
110
+ },
111
+ '&.primaryContarstUnderline:hover:not(.Mui-disabled):before': {
112
+ borderBottom: `1px solid ${palette.primary.contrastText}`
113
+ }
114
+ },
115
+ },
116
+ },
117
+ input: {
118
+ '&.Mui-disabled': {
119
+ fontWeight: 300,
120
+ WebkitTextFillColor: 'inherit'
121
+ },
122
+ '&::placeholder': {
123
+ opacity: 0.15
124
+ },
125
+ textOverflow: 'ellipsis',
126
+ color: palette.text.primaryEditable,
127
+ fontWeight: 400,
128
+ '&:hover:not(.Mui-disabled):not(&:focus):not(.primaryContarstHover)': {
129
+ color: palette.primary.main,
130
+ MuiSelect: {
131
+ icon: {
132
+ color: palette.primary.main,
133
+ },
134
+ },
135
+ },
136
+ },
137
+ inputMultiline: {
138
+ lineHeight: '1.5em'
139
+ }
140
+ }
141
+ },
142
+ MuiCssBaseline: {
143
+ styleOverrides: {
144
+ body: {
145
+ fontFeatureSettings:
146
+ '"dlig" 0, "numr" 0, "dnom" 0, "tnum" 0, "case" 0, "zero" 0, "frac" 0, '
147
+ + '"sups" 0, "subs" 0, "cpsp" 0, "salt" 0, "ss01" 0, "ss02" 0, "ss03" 0, '
148
+ + '"cv01", "cv02", "cv03", "cv04", "cv05", "cv06", "cv07", "cv08", "cv09", '
149
+ + '"cv10", "cv11", "calt", "liga", "kern"',
150
+ fontSize: '0.875rem'
151
+ }
152
+ }
153
+ },
154
+ MuiMenuItem: {
155
+ styleOverrides: {
156
+ root: {
157
+ fontWeight: 400,
158
+ '@media (min-width: 600px)': {
159
+ minHeight: '36px'
160
+ }
161
+ }
162
+ }
163
+ },
164
+ MuiTableSortLabel: {
165
+ styleOverrides: {
166
+ root: {
167
+ '&:hover': {
168
+ color: palette.text.primary
169
+ },
170
+ '&$active': {
171
+ color: palette.text.primary
172
+ }
173
+ },
174
+ active: {},
175
+ icon: {
176
+ fontSize: '18px'
177
+ }
178
+ }
179
+ },
180
+ MuiAutocomplete: {
181
+ styleOverrides: {
182
+ inputRoot: {
183
+ flexWrap: 'inherit',
184
+ }
185
+ }
186
+ },
187
+ MuiFormHelperText: {
188
+ styleOverrides: {
189
+ root: {
190
+ marginLeft: 0
191
+ }
192
+ }
193
+ }
194
+ }
195
+ });
196
+
197
+ const commonTypography = {
198
+ typography: {
199
+ fontFamily: 'Inter, sans-serif',
200
+ fontSize: 14,
201
+ fontWeightLight: 300,
202
+ fontWeightRegular: 400,
203
+ fontWeightMedium: 600,
204
+ body2: {
205
+ fontWeight: 300
206
+ },
207
+ body1: {
208
+ fontWeight: 300
209
+ },
210
+ caption: {
211
+ fontWeight: 300
212
+ }
213
+ }
214
+ };
215
+
216
+ // Default Theme
217
+
218
+ const defaultThemePalette = {
219
+ primary: {
220
+ main: '#f7941d',
221
+ contrastText: '#fff'
222
+ },
223
+ background: {
224
+ default: '#fbf9f0'
225
+ },
226
+ secondary: {
227
+ main: '#4b6390'
228
+ },
229
+ text: {
230
+ secondary: 'rgba(0, 0, 0, 0.54)',
231
+ primary: 'rgba(0, 0, 0, 0.87)',
232
+ primaryEditable: 'rgba(0, 0, 0, 0.95)',
233
+ disabled: 'rgba(34, 34, 34, 0.38)',
234
+ hint: 'rgba(34, 34, 34, 0.38)',
235
+ grey: '#434343',
236
+ }
237
+ };
238
+
239
+ export const defaultTheme = createTheme({
240
+ palette: defaultThemePalette,
241
+ ...commonTypography,
242
+ ...theme.default,
243
+ ...createOverrides(defaultThemePalette)
244
+ }) as AppTheme;
245
+
246
+ // Dark Theme
247
+ const darkThemePalette = {
248
+ mode: 'dark' as PaletteMode,
249
+ common: { black: '#000', white: '#fff' },
250
+ primary: {
251
+ main: '#f7941d',
252
+ dark: 'rgba(255, 143, 0, 1)',
253
+ contrastText: 'rgba(255, 255, 255, 1)'
254
+ },
255
+ background: {
256
+ default: '#1b1b1b',
257
+ paper: '#313131'
258
+ },
259
+ secondary: {
260
+ light: 'rgba(75, 99, 144, 1)',
261
+ main: '#9bbeff',
262
+ dark: 'rgba(75, 99, 144, 1)',
263
+ contrastText: '#fff'
264
+ },
265
+ error: {
266
+ light: '#e57373', main: '#f44336', dark: '#d32f2f', contrastText: '#fff'
267
+ },
268
+ text: {
269
+ primary: 'rgba(255, 255, 255, 0.87)',
270
+ primaryEditable: 'rgba(255, 255, 255, 0.95)',
271
+ secondary: 'rgba(255, 255, 255, 0.65)',
272
+ disabled: 'rgba(255, 255, 255, 0.38)',
273
+ hint: 'rgba(255, 255, 255, 0.38)',
274
+ grey: 'rgba(255, 255, 255, 0.65)',
275
+ }
276
+ };
277
+
278
+ export const darkTheme = createTheme({
279
+ palette: darkThemePalette,
280
+ ...commonTypography,
281
+ ...theme.dark,
282
+ ...createOverrides(darkThemePalette)
283
+ }) as AppTheme;
284
+
285
+ // Monochrome Theme
286
+
287
+ const monochromeThemePalette = {
288
+ mode: 'light' as PaletteMode,
289
+ common: { black: '#000', white: '#fff' },
290
+ primary: {
291
+ main: '#111111',
292
+ dark: '#76838f',
293
+ contrastText: '#fff'
294
+ },
295
+ secondary: {
296
+ light: '#9bbeff',
297
+ main: '#111111',
298
+ dark: '#111111',
299
+ contrastText: '#fff'
300
+ },
301
+ error: {
302
+ light: '#e57373', main: '#f44336', dark: '#d32f2f', contrastText: '#fff'
303
+ },
304
+ text: {
305
+ primary: '#222222',
306
+ primaryEditable: '#181818',
307
+ secondary: 'rgba(34, 34, 34, 0.54)',
308
+ disabled: 'rgba(34, 34, 34, 0.38)',
309
+ hint: 'rgba(34, 34, 34, 0.38)',
310
+ grey: '#434343',
311
+ }
312
+ };
313
+
314
+ export const monochromeTheme = createTheme({
315
+ palette: monochromeThemePalette,
316
+ ...commonTypography,
317
+ ...theme.monochrome,
318
+ ...createOverrides(monochromeThemePalette)
319
+ }) as AppTheme;
320
+
321
+ // High Contrast Theme
322
+
323
+ const highcontrastThemePalette = {
324
+ common: { black: '#111111', white: '#fff' },
325
+ primary: {
326
+ main: '#111111',
327
+ dark: '#76838f',
328
+ contrastText: '#fff'
329
+ },
330
+ secondary: {
331
+ light: '#9bbeff',
332
+ main: '#111111',
333
+ dark: '#111111',
334
+ contrastText: '#fff'
335
+ },
336
+ background: {
337
+ default: '#f2f2f2'
338
+ },
339
+ error: {
340
+ light: '#e57373', main: '#f44336', dark: '#d32f2f', contrastText: '#fff'
341
+ },
342
+ text: {
343
+ primary: '#111111',
344
+ primaryEditable: '#070707',
345
+ secondary: '#111111',
346
+ disabled: 'rgba(34, 34, 34, 0.38)',
347
+ hint: 'rgba(34, 34, 34, 0.38)',
348
+ grey: '#434343',
349
+ },
350
+ action: {
351
+ selected: 'rgba(0, 0, 0, 0.3)'
352
+ },
353
+ divider: 'rgba(0, 0, 0, 0.40)'
354
+ };
355
+
356
+ export const highcontrastTheme = createTheme({
357
+ palette: highcontrastThemePalette,
358
+ ...commonTypography,
359
+ ...theme.highcontrast,
360
+ ...createOverrides(highcontrastThemePalette)
361
+ }) as AppTheme;
362
+
363
+ export const currentTheme = (themeName: ThemeValues): AppTheme => {
364
+ switch (themeName) {
365
+ case DarkThemeKey: {
366
+ return darkTheme;
367
+ }
368
+ case DefaultThemeKey: {
369
+ return defaultTheme;
370
+ }
371
+ case MonochromeThemeKey: {
372
+ return monochromeTheme;
373
+ }
374
+ case HighcontrastThemeKey: {
375
+ return highcontrastTheme;
376
+ }
377
+ default: {
378
+ return defaultTheme;
379
+ }
380
+ }
381
+ };
382
+
383
+ export const getTheme = (): AppTheme => {
384
+ let actualTheme = defaultTheme;
385
+
386
+ try {
387
+ const storageThemeName = localStorage.getItem('theme') as ThemeValues;
388
+ if (storageThemeName) {
389
+ actualTheme = currentTheme(storageThemeName);
390
+ }
391
+ } catch (e) {
392
+ console.error(e);
393
+ return actualTheme;
394
+ }
395
+
396
+ return actualTheme;
397
+ };
398
+
399
+ export const useAppTheme = (): AppTheme => ({
400
+ ...getTheme()
401
+ });
@@ -0,0 +1,95 @@
1
+ {
2
+ /* tslint:disable:max-line-length */
3
+ }
4
+ import React from "react";
5
+
6
+ interface IconProps {
7
+ className?: string;
8
+ }
9
+
10
+ export const MorningIcon: React.FunctionComponent<IconProps> = ({ className }) => (
11
+ <svg className={className} width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
12
+ <path
13
+ d="M9 3C9 2.44772 9.44772 2 10 2C10.5523 2 11 2.44772 11 3V4C11 4.55228 10.5523 5 10 5C9.44772 5 9 4.55228 9 4V3Z"
14
+ fill="black"
15
+ />
16
+ <path
17
+ d="M16.3638 7.05022C15.9733 7.44074 15.3402 7.44074 14.9496 7.05022C14.5591 6.65969 14.5591 6.02653 14.9496 5.636L15.6567 4.9289C16.0473 4.53837 16.6804 4.53837 17.071 4.9289C17.4615 5.31942 17.4615 5.95259 17.071 6.34311L16.3638 7.05022Z"
18
+ fill="black"
19
+ />
20
+ <path
21
+ d="M5.04997 5.63603C5.4405 6.02656 5.4405 6.65972 5.04997 7.05025C4.65945 7.44077 4.02628 7.44077 3.63576 7.05025L2.92865 6.34314C2.53813 5.95262 2.53813 5.31945 2.92865 4.92893C3.31918 4.5384 3.95234 4.5384 4.34287 4.92893L5.04997 5.63603Z"
22
+ fill="black"
23
+ />
24
+ <path
25
+ d="M12.8356 11.0181C13.0163 11.54 13.4477 12 14 12C14.5523 12 15.0104 11.5478 14.9013 11.0064C14.4405 8.72096 12.4212 7 9.99999 7C7.57878 7 5.55952 8.72096 5.09872 11.0064C4.98956 11.5478 5.44771 12 5.99999 12C6.55228 12 6.98368 11.54 7.16437 11.0181C7.57105 9.84347 8.68702 9 9.99999 9C11.313 9 12.4289 9.84347 12.8356 11.0181Z"
26
+ fill="black"
27
+ />
28
+ <path
29
+ d="M0 15C0 14.4477 0.447715 14 1 14H19C19.5523 14 20 14.4477 20 15C20 15.5523 19.5523 16 19 16H1C0.447716 16 0 15.5523 0 15Z"
30
+ fill="black"
31
+ />
32
+ </svg>
33
+ );
34
+
35
+ export const AfternoonIcon: React.FunctionComponent<IconProps> = ({ className }) => (
36
+ <svg className={className} width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
37
+ <g clipPath="url(#clip0)">
38
+ <path
39
+ d="M9 1C9 0.447715 9.44772 0 10 0C10.5523 0 11 0.447715 11 1V2C11 2.55228 10.5523 3 10 3C9.44772 3 9 2.55228 9 2V1Z"
40
+ fill="black"
41
+ />
42
+ <path
43
+ d="M9 18C9 17.4477 9.44772 17 10 17C10.5523 17 11 17.4477 11 18V19C11 19.5523 10.5523 20 10 20C9.44772 20 9 19.5523 9 19V18Z"
44
+ fill="black"
45
+ />
46
+ <path
47
+ d="M1 11C0.447715 11 2.41411e-08 10.5523 0 10C-2.41411e-08 9.44772 0.447715 9 1 9H2C2.55228 9 3 9.44772 3 10C3 10.5523 2.55228 11 2 11H1Z"
48
+ fill="black"
49
+ />
50
+ <path
51
+ d="M18 11C17.4477 11 17 10.5523 17 10C17 9.44772 17.4477 9 18 9H19C19.5523 9 20 9.44772 20 10C20 10.5523 19.5523 11 19 11H18Z"
52
+ fill="black"
53
+ />
54
+ <path
55
+ d="M4.34309 17.0711C3.95257 17.4616 3.3194 17.4616 2.92888 17.0711C2.53836 16.6806 2.53836 16.0474 2.92888 15.6569L3.63599 14.9498C4.02651 14.5592 4.65968 14.5592 5.0502 14.9498C5.44072 15.3403 5.44072 15.9735 5.0502 16.364L4.34309 17.0711Z"
56
+ fill="black"
57
+ />
58
+ <path
59
+ d="M16.3638 5.05022C15.9733 5.44074 15.3402 5.44074 14.9496 5.05022C14.5591 4.65969 14.5591 4.02653 14.9496 3.636L15.6567 2.9289C16.0473 2.53837 16.6804 2.53837 17.071 2.9289C17.4615 3.31942 17.4615 3.95259 17.071 4.34311L16.3638 5.05022Z"
60
+ fill="black"
61
+ />
62
+ <path
63
+ d="M17.071 15.6568C17.4615 16.0473 17.4615 16.6805 17.071 17.071C16.6804 17.4615 16.0473 17.4615 15.6568 17.071L14.9496 16.3639C14.5591 15.9734 14.5591 15.3402 14.9496 14.9497C15.3402 14.5592 15.9733 14.5592 16.3639 14.9497L17.071 15.6568Z"
64
+ fill="black"
65
+ />
66
+ <path
67
+ d="M5.04997 3.63603C5.4405 4.02656 5.4405 4.65972 5.04997 5.05025C4.65945 5.44077 4.02628 5.44077 3.63576 5.05025L2.92865 4.34314C2.53813 3.95262 2.53813 3.31945 2.92865 2.92893C3.31918 2.5384 3.95234 2.5384 4.34287 2.92893L5.04997 3.63603Z"
68
+ fill="black"
69
+ />
70
+ <path
71
+ fillRule="evenodd"
72
+ clipRule="evenodd"
73
+ d="M10 15C12.7614 15 15 12.7614 15 10C15 7.23858 12.7614 5 10 5C7.23858 5 5 7.23858 5 10C5 12.7614 7.23858 15 10 15ZM10 13C11.6569 13 13 11.6569 13 10C13 8.34315 11.6569 7 10 7C8.34315 7 7 8.34315 7 10C7 11.6569 8.34315 13 10 13Z"
74
+ fill="black"
75
+ />
76
+ </g>
77
+ <defs>
78
+ <clipPath id="clip0">
79
+ <rect width="20" height="20" fill="white" />
80
+ </clipPath>
81
+ </defs>
82
+ </svg>
83
+ );
84
+
85
+ export const EveningIcon: React.FunctionComponent<IconProps> = ({ className }) => (
86
+ <svg className={className} width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
87
+ <rect width="20" height="20" fill="none" />
88
+ <path
89
+ fillRule="evenodd"
90
+ clipRule="evenodd"
91
+ d="M8.38031 2.16405C8.28754 2.18313 8.19536 2.20381 8.10379 2.22606C4.6008 3.07753 2 6.23504 2 10C2 14.4183 5.58172 18 10 18C13.765 18 16.9225 15.3992 17.7739 11.8962C17.7962 11.8046 17.8169 11.7125 17.8359 11.6197C17.9102 11.2587 17.9601 10.8887 17.9839 10.5117C17.9946 10.3425 18 10.1719 18 10C18 9.65868 17.5651 9.52223 17.3093 9.74823C17.2098 9.83613 17.1068 9.92014 17.0005 10C16.7187 10.2117 16.4139 10.3943 16.0904 10.5434C16.0508 10.5616 16.0109 10.5794 15.9707 10.5966C15.366 10.8562 14.6998 11 14 11C11.2386 11 9 8.76142 9 6C9 5.30021 9.14376 4.634 9.40336 4.02929C9.4206 3.98912 9.43836 3.94922 9.45662 3.9096C9.6057 3.58611 9.78831 3.28127 10 2.99951C10.0799 2.89321 10.1639 2.7902 10.2518 2.69071C10.4778 2.43493 10.3413 2 10 2C9.8281 2 9.65747 2.00542 9.48826 2.0161C9.11126 2.0399 8.74135 2.08982 8.38031 2.16405ZM7.11363 4.73861C7.039 5.14795 7 5.56956 7 6C7 9.86599 10.134 13 14 13C14.4304 13 14.8521 12.961 15.2614 12.8864C14.2411 14.7423 12.2674 16 10 16C6.68629 16 4 13.3137 4 10C4 7.73257 5.25775 5.7589 7.11363 4.73861Z"
92
+ fill="black"
93
+ />
94
+ </svg>
95
+ );
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+
9
+
10
+ export * from './DayPeriodIcons';
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+
9
+
10
+ export * from './datePeriodFilter';
11
+ export * from './miniCalendar';
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Copyright ish group pty ltd 2023.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
5
+ *
6
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
7
+ */
8
+
9
+ import React, { useMemo } from 'react';
10
+ import { Button } from '@mui/material';
11
+ import { isSameDay } from 'date-fns';
12
+ import clsx from 'clsx';
13
+ import { alpha } from '@mui/material/styles';
14
+ import { makeAppStyles } from '@src/styles';
15
+ import { useAppTheme } from '@src/themes';
16
+
17
+
18
+ interface Props {
19
+ day: number;
20
+ isToday?: boolean;
21
+ today?: any;
22
+ date: Date;
23
+ status: string;
24
+ selectedMonthSessionDays: number[];
25
+ disabled: boolean;
26
+ theme?: any;
27
+ targetDay?: any;
28
+ setTargetDay?: any;
29
+ }
30
+
31
+ const useStyles = makeAppStyles(theme => ({
32
+ root: {
33
+ padding: 0,
34
+ border: '2px solid transparent',
35
+ borderRadius: 4,
36
+ minWidth: 'initial',
37
+ boxShadow: 'none',
38
+ fontWeight: 'normal',
39
+ color: theme.palette.text.primary,
40
+ '&:active': {
41
+ boxShadow: 'none'
42
+ },
43
+ '&:focus': {
44
+ boxShadow: 'none'
45
+ },
46
+ '&::after': {
47
+ content: '\'\'',
48
+ position: 'absolute',
49
+ width: 4,
50
+ height: 4,
51
+ top: 4,
52
+ borderRadius: '100%'
53
+ },
54
+ '&$same': {
55
+ border: `2px solid ${theme.palette.text.primary}`
56
+ }
57
+ },
58
+ same: {}
59
+ }));
60
+
61
+ const CalendarDay = React.memo((props: Props) => {
62
+ const {
63
+ day, status, date, disabled, targetDay, setTargetDay, selectedMonthSessionDays
64
+ } = props;
65
+
66
+ const classes = useStyles();
67
+
68
+ const theme = useAppTheme();
69
+ const isSame = isSameDay(targetDay, date);
70
+ const isToday = isSameDay(new Date(), date);
71
+
72
+ const style = useMemo(() => {
73
+ let result;
74
+
75
+ const dayIndexValue = selectedMonthSessionDays[day - 1];
76
+
77
+ if (selectedMonthSessionDays.length && status === 'current' && dayIndexValue !== 0) {
78
+ const backgroundColor = alpha(theme.palette.primary.main, dayIndexValue);
79
+
80
+ result = {
81
+ ...result || {},
82
+ backgroundColor,
83
+ color: theme.palette.getContrastText(backgroundColor)
84
+ };
85
+ }
86
+
87
+ if (isToday) {
88
+ result = {
89
+ ...result || {},
90
+ fontWeight: '900'
91
+ };
92
+ }
93
+
94
+ return result;
95
+ }, [isToday, status, selectedMonthSessionDays, day, theme]);
96
+
97
+ return (
98
+ <Button
99
+ className={clsx(classes.root, isSame && classes.same)}
100
+ onClick={() => setTargetDay(date)}
101
+ disabled={disabled}
102
+ style={style}
103
+ >
104
+ {day}
105
+ </Button>
106
+ );
107
+ });
108
+
109
+ export default CalendarDay;
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { IconButton, Typography } from "@mui/material";
3
+ import { createStyles, withStyles } from "@mui/styles";
4
+ import { KeyboardArrowLeft, KeyboardArrowRight } from "@mui/icons-material";
5
+
6
+ interface Props {
7
+ month: string;
8
+ year: number;
9
+ previousMonth: () => void;
10
+ nextMonth: () => void;
11
+ classes?: any;
12
+ }
13
+
14
+ const styles = createStyles(theme => ({
15
+ root: {
16
+ display: "flex",
17
+ justifyContent: "space-between",
18
+ alignItems: "center",
19
+ padding: theme.spacing(0, 1)
20
+ }
21
+ }));
22
+
23
+ const CalendarHeader = ({ classes, month, year, previousMonth, nextMonth }: Props) => (
24
+ <div className={classes.root}>
25
+ <IconButton onClick={previousMonth}>
26
+ <KeyboardArrowLeft />
27
+ </IconButton>
28
+ <Typography align="center">
29
+ {month} {year}
30
+ </Typography>
31
+ <IconButton onClick={nextMonth}>
32
+ <KeyboardArrowRight />
33
+ </IconButton>
34
+ </div>
35
+ );
36
+
37
+ export default withStyles(styles)(CalendarHeader);
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import { createStyles, withStyles } from "@mui/styles";
3
+ import WeekDay from "./WeekDay";
4
+
5
+ interface Props {
6
+ classes?: any;
7
+ switchWeekDays: (dayId: number) => void;
8
+ selectedWeekDays: boolean[];
9
+ }
10
+
11
+ const styles = theme =>
12
+ createStyles({
13
+ root: {
14
+ display: "grid",
15
+ gridTemplateColumns: `repeat(7, ${theme.spacing(4)})`,
16
+ gridColumnGap: 1,
17
+ padding: theme.spacing(0, 1),
18
+ marginBottom: theme.spacing(1),
19
+ justifyContent: "center"
20
+ }
21
+ });
22
+
23
+ const week = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
24
+
25
+ const CalendarWeekPanel = ({ classes, switchWeekDays, selectedWeekDays }: Props) => {
26
+ return (
27
+ <div className={classes.root}>
28
+ {week.map((el, id) => (
29
+ <WeekDay key={id} id={id} name={el} selected={selectedWeekDays[id]} click={switchWeekDays} />
30
+ ))}
31
+ </div>
32
+ );
33
+ };
34
+
35
+ export default withStyles(styles)(CalendarWeekPanel);