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
package/.eslintrc.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es6": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "eslint:recommended",
9
+ "plugin:react/recommended",
10
+ "plugin:@typescript-eslint/eslint-recommended",
11
+ "plugin:@typescript-eslint/recommended",
12
+ "plugin:import/errors",
13
+ "plugin:import/warnings"
14
+ ],
15
+ "parser": "@typescript-eslint/parser",
16
+ "settings": {
17
+ "import/resolver": {
18
+ "node": {
19
+ "extensions": [".js", ".jsx", ".ts", ".tsx"]
20
+ },
21
+ "alias": {
22
+ "map": [
23
+ ["@src", "./src"],
24
+ ["@assets", "./assets"]
25
+ ],
26
+ "extensions": [".js", ".jsx", ".ts", ".tsx"]
27
+ }
28
+ },
29
+ "react": {
30
+ "version": "latest"
31
+ }
32
+ },
33
+ "rules": {
34
+ "quotes": ["error", "single"],
35
+ "react/prop-types": "off",
36
+ "@typescript-eslint/no-var-requires": "off",
37
+ "@typescript-eslint/no-explicit-any": "off"
38
+ }
39
+ }
package/.gitattributes ADDED
@@ -0,0 +1,3 @@
1
+ *.scss linguist-detectable=false
2
+ *.sass linguist-detectable=false
3
+ *.js linguist-detectable=false
@@ -0,0 +1,33 @@
1
+ name: Node.js Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+ - uses: actions/setup-node@v3
13
+ with:
14
+ node-version: 16
15
+ - run: npm ci --legacy-peer-deps
16
+ - run: npm test
17
+
18
+ publish-gpr:
19
+ needs: build
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ packages: write
23
+ contents: read
24
+ steps:
25
+ - uses: actions/checkout@v3
26
+ - uses: actions/setup-node@v3
27
+ with:
28
+ node-version: 16
29
+ registry-url: https://registry.npmjs.org/
30
+ - run: npm ci --legacy-peer-deps
31
+ - run: npm publish
32
+ env:
33
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all",
4
+ "jsxSingleQuote": true
5
+ }
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Ish UI
2
+
3
+ UI elements for onCourse and other ish apps
4
+
5
+
6
+ ## Installation
7
+
8
+ #### To install you need to run following commands
9
+
10
+ <br>
11
+
12
+ Clone the repository :
13
+
14
+ ```bash
15
+ git clone https://github.com/ishgroup/ish-ui.git
16
+ ```
17
+
18
+ <br>
19
+
20
+ Install dependencies using Yarn:
21
+
22
+ ```bash
23
+ yarn install
24
+ ```
25
+
26
+ <br />
27
+
28
+ ## Start : Development
29
+
30
+ To develop and run your web application, you need to run following command :
31
+
32
+ ```bash
33
+ yarn start
34
+ ```
35
+
36
+ <br />
37
+
38
+ ## Lint : Development
39
+
40
+ To lint application source code using ESLint via this command :
41
+
42
+ ```bash
43
+ yarn lint
44
+ ```
45
+
46
+ <br />
47
+
48
+ ## Build : Production
49
+
50
+ Distribution files output will be generated in `dist/` directory by default.
51
+
52
+ To build the production ready files for distribution, use the following command :
53
+
54
+ ```bash
55
+ yarn build
56
+ ```
57
+
58
+ <br />
59
+
60
+ ## Serve : Production
61
+
62
+ Serve helps you serve a static site, single page application or just a static file. It also provides a neat interface for listing the directory's contents. This command serves build files from `dist/` directory.
63
+
64
+ ```bash
65
+ yarn serve
66
+ ```
67
+
68
+ <br />
69
+
70
+ ## Webpack Configurations
71
+
72
+ To make it easier for managing environment based webpack configurations, we using separated `development` and `production` configuration files, they are available in :
73
+
74
+ ```bash
75
+ # Development webpack config
76
+ tools/webpack/webpack.config.dev.js
77
+
78
+ # Production webpack config
79
+ tools/webpack/webpack.config.prod.js
80
+ ```
@@ -0,0 +1,92 @@
1
+ Copyright (c) 2016-2019 The Inter Project Authors (me@rsms.me)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+ -----------------------------------------------------------
8
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9
+ -----------------------------------------------------------
10
+
11
+ PREAMBLE
12
+ The goals of the Open Font License (OFL) are to stimulate worldwide
13
+ development of collaborative font projects, to support the font creation
14
+ efforts of academic and linguistic communities, and to provide a free and
15
+ open framework in which fonts may be shared and improved in partnership
16
+ with others.
17
+
18
+ The OFL allows the licensed fonts to be used, studied, modified and
19
+ redistributed freely as long as they are not sold by themselves. The
20
+ fonts, including any derivative works, can be bundled, embedded,
21
+ redistributed and/or sold with any software provided that any reserved
22
+ names are not used by derivative works. The fonts and derivatives,
23
+ however, cannot be released under any other type of license. The
24
+ requirement for fonts to remain under this license does not apply
25
+ to any document created using the fonts or their derivatives.
26
+
27
+ DEFINITIONS
28
+ "Font Software" refers to the set of files released by the Copyright
29
+ Holder(s) under this license and clearly marked as such. This may
30
+ include source files, build scripts and documentation.
31
+
32
+ "Reserved Font Name" refers to any names specified as such after the
33
+ copyright statement(s).
34
+
35
+ "Original Version" refers to the collection of Font Software components as
36
+ distributed by the Copyright Holder(s).
37
+
38
+ "Modified Version" refers to any derivative made by adding to, deleting,
39
+ or substituting -- in part or in whole -- any of the components of the
40
+ Original Version, by changing formats or by porting the Font Software to a
41
+ new environment.
42
+
43
+ "Author" refers to any designer, engineer, programmer, technical
44
+ writer or other person who contributed to the Font Software.
45
+
46
+ PERMISSION AND CONDITIONS
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
49
+ redistribute, and sell modified and unmodified copies of the Font
50
+ Software, subject to the following conditions:
51
+
52
+ 1) Neither the Font Software nor any of its individual components,
53
+ in Original or Modified Versions, may be sold by itself.
54
+
55
+ 2) Original or Modified Versions of the Font Software may be bundled,
56
+ redistributed and/or sold with any software, provided that each copy
57
+ contains the above copyright notice and this license. These can be
58
+ included either as stand-alone text files, human-readable headers or
59
+ in the appropriate machine-readable metadata fields within text or
60
+ binary files as long as those fields can be easily viewed by the user.
61
+
62
+ 3) No Modified Version of the Font Software may use the Reserved Font
63
+ Name(s) unless explicit written permission is granted by the corresponding
64
+ Copyright Holder. This restriction only applies to the primary font name as
65
+ presented to the users.
66
+
67
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68
+ Software shall not be used to promote, endorse or advertise any
69
+ Modified Version, except to acknowledge the contribution(s) of the
70
+ Copyright Holder(s) and the Author(s) or with their explicit written
71
+ permission.
72
+
73
+ 5) The Font Software, modified or unmodified, in part or in whole,
74
+ must be distributed entirely under this license, and must not be
75
+ distributed under any other license. The requirement for fonts to
76
+ remain under this license does not apply to any document created
77
+ using the Font Software.
78
+
79
+ TERMINATION
80
+ This license becomes null and void if any of the above conditions are
81
+ not met.
82
+
83
+ DISCLAIMER
84
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -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
+ declare module '*.var.woff2'
@@ -0,0 +1,17 @@
1
+ @font-face {
2
+ font-family: 'Inter';
3
+ font-weight: 100 900;
4
+ font-display: swap;
5
+ font-style: normal;
6
+ font-named-instance: 'Regular';
7
+ src: local('Inter'), url("Inter-Roman.var.woff2") format("woff2");
8
+ }
9
+
10
+ @font-face {
11
+ font-family: 'Inter';
12
+ font-weight: 100 900;
13
+ font-display: swap;
14
+ font-style: italic;
15
+ font-named-instance: 'Italic';
16
+ src: local('Inter'), url("Inter-Italic.var.woff2") format("woff2");
17
+ }
package/package.json ADDED
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "ish-ui",
3
+ "version": "1.0.2",
4
+ "description": "UI elements for onCourse and other ish apps",
5
+ "main": "main.ts",
6
+ "devDependencies": {
7
+ "@marshallofsound/webpack-asset-relocator-loader": "^0.5.0",
8
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.8",
9
+ "@types/node": "^18.11.5",
10
+ "@types/react": "^18.0.23",
11
+ "@types/react-color": "^3.0.6",
12
+ "@types/react-dom": "^18.0.7",
13
+ "@types/react-window": "^1.8.5",
14
+ "@types/react-window-infinite-loader": "^1.0.6",
15
+ "@types/redux": "^3.6.0",
16
+ "@types/webpack-env": "^1.18.0",
17
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
18
+ "@typescript-eslint/parser": "^5.41.0",
19
+ "cross-env": "^7.0.3",
20
+ "css-loader": "^6.7.1",
21
+ "eslint": "^8.26.0",
22
+ "eslint-import-resolver-alias": "^1.1.2",
23
+ "eslint-plugin-import": "^2.26.0",
24
+ "eslint-plugin-react": "^7.31.10",
25
+ "file-loader": "^6.2.0",
26
+ "fork-ts-checker-webpack-plugin": "^7.2.13",
27
+ "html-webpack-plugin": "^5.5.0",
28
+ "jest": "^29.6.1",
29
+ "less": "^4.1.3",
30
+ "less-loader": "11.1.0",
31
+ "mini-css-extract-plugin": "^2.6.1",
32
+ "react-refresh": "^0.14.0",
33
+ "sass": "^1.55.0",
34
+ "sass-loader": "^13.1.0",
35
+ "serve": "^14.0.1",
36
+ "style-loader": "^3.3.1",
37
+ "terser-webpack-plugin": "^5.3.9",
38
+ "ts-loader": "^9.4.4",
39
+ "tsc-alias": "^1.8.7",
40
+ "typescript": "^4.8.4",
41
+ "webpack": "^5.74.0",
42
+ "webpack-cli": "^4.10.0",
43
+ "webpack-dev-server": "^4.11.1"
44
+ },
45
+ "dependencies": {
46
+ "@ckeditor/ckeditor5-autoformat": "35.1.0",
47
+ "@ckeditor/ckeditor5-basic-styles": "35.1.0",
48
+ "@ckeditor/ckeditor5-editor-classic": "35.1.0",
49
+ "@ckeditor/ckeditor5-essentials": "35.1.0",
50
+ "@ckeditor/ckeditor5-heading": "35.1.0",
51
+ "@ckeditor/ckeditor5-image": "35.1.0",
52
+ "@ckeditor/ckeditor5-link": "35.1.0",
53
+ "@ckeditor/ckeditor5-list": "35.1.0",
54
+ "@ckeditor/ckeditor5-markdown-gfm": "35.1.0",
55
+ "@ckeditor/ckeditor5-paragraph": "35.1.0",
56
+ "@ckeditor/ckeditor5-react": "5.0.2",
57
+ "@ckeditor/ckeditor5-source-editing": "35.1.0",
58
+ "@ckeditor/ckeditor5-table": "35.1.0",
59
+ "@ckeditor/ckeditor5-theme-lark": "35.1.0",
60
+ "@emotion/cache": "latest",
61
+ "@emotion/react": "latest",
62
+ "@emotion/styled": "latest",
63
+ "@fortawesome/fontawesome-svg-core": "latest",
64
+ "@fortawesome/free-regular-svg-icons": "latest",
65
+ "@fortawesome/free-solid-svg-icons": "latest",
66
+ "@fortawesome/react-fontawesome": "latest",
67
+ "@mui/icons-material": "latest",
68
+ "@mui/lab": "latest",
69
+ "@mui/material": "latest",
70
+ "@mui/styles": "latest",
71
+ "@mui/x-date-pickers": "latest",
72
+ "autosuggest-highlight": "^3.3.4",
73
+ "date-fns": "^2.30.0",
74
+ "date-fns-tz": "^2.0.0",
75
+ "decimal.js-light": "^2.5.1",
76
+ "lodash.debounce": "^4.0.8",
77
+ "re-resizable": "^6.9.9",
78
+ "react": "^18.2.0",
79
+ "react-ace": "^10.1.0",
80
+ "react-color": "^2.19.3",
81
+ "react-dom": "^18.2.0",
82
+ "react-dropzone": "^14.2.3",
83
+ "react-number-format": "^5.2.2",
84
+ "react-window": "^1.8.9",
85
+ "react-window-infinite-loader": "^1.0.9",
86
+ "redux": "^4.2.1"
87
+ },
88
+ "scripts": {
89
+ "test": "exit 0",
90
+ "start": "cross-env NODE_ENV=development webpack serve --config tools/webpack/webpack.config.dev.js",
91
+ "build": "tsc && tsc-alias",
92
+ "serve": "cross-env NODE_ENV=production webpack --config tools/webpack/webpack.config.prod.js && cross-env serve dist/",
93
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx src/"
94
+ },
95
+ "repository": {
96
+ "type": "git",
97
+ "url": "git+https://github.com/ishgroup/ish-ui.git"
98
+ },
99
+ "author": "yuryyas",
100
+ "license": "ISC",
101
+ "bugs": {
102
+ "url": "https://github.com/ishgroup/ish-ui/issues"
103
+ },
104
+ "homepage": "https://github.com/ishgroup/ish-ui#readme",
105
+ "publishConfig": {
106
+ "@yuryyas:registry": "https://npm.pkg.github.com"
107
+ }
108
+ }
@@ -0,0 +1,21 @@
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 const START_FIELD_PROCESSING_ACTION = 'add/field/processing/action';
11
+ export const END_FIELD_PROCESSING_ACTION = 'remove/field/processing/action';
12
+
13
+ export const startFieldProcessingAction = (id: string) => ({
14
+ type: START_FIELD_PROCESSING_ACTION,
15
+ payload: id
16
+ });
17
+
18
+ export const endFieldProcessingAction = (id: string) => ({
19
+ type: END_FIELD_PROCESSING_ACTION,
20
+ payload: id
21
+ });
@@ -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 './FieldProcessing';
@@ -0,0 +1,139 @@
1
+ import * as React from 'react';
2
+ import { withStyles, createStyles } from '@mui/styles';
3
+ import clsx from 'clsx';
4
+ import HelpOutline from '@mui/icons-material/HelpOutline';
5
+ import IconButton from '@mui/material/IconButton';
6
+ import Typography from '@mui/material/Typography';
7
+ import Menu from '@mui/material/Menu';
8
+ import MenuItem from '@mui/material/MenuItem';
9
+ import Tooltip from '@mui/material/Tooltip';
10
+ import { format as formatDate } from 'date-fns';
11
+ import { III_DD_MMM_YYYY_HH_MM_SPECIAL, openInternalLink } from '@src/utils';
12
+
13
+ const styles = theme =>
14
+ createStyles({
15
+ button: {
16
+ color: theme.appBarButton.helpMenu.color,
17
+ },
18
+ info: {
19
+ display: 'flex',
20
+ flexDirection: 'column',
21
+ alignItems: 'baseline',
22
+ padding: theme.spacing(1, 2, 0, 2)
23
+ },
24
+ divider: {
25
+ marginTop: theme.spacing(2),
26
+ borderTop: `1px solid ${theme.palette.divider}`
27
+ }
28
+ });
29
+
30
+ interface Props {
31
+ classes?: any;
32
+ created?: any;
33
+ modified?: any;
34
+ manualUrl?: string;
35
+ auditsUrl?: string;
36
+ iconClasses?: any;
37
+ }
38
+
39
+ class AppBarHelpMenu extends React.Component<Props, any> {
40
+ constructor(props) {
41
+ super(props);
42
+
43
+ this.state = {
44
+ anchorEl: null
45
+ };
46
+ }
47
+
48
+ handleAddFieldClick = e => {
49
+ this.setState({ anchorEl: e.currentTarget });
50
+ };
51
+
52
+ handleClose = () => {
53
+ this.setState({ anchorEl: null });
54
+ };
55
+
56
+ openManual = () => {
57
+ window.open(this.props.manualUrl);
58
+ this.handleClose();
59
+ };
60
+
61
+ openAudits = () => {
62
+ openInternalLink('/' + this.props.auditsUrl);
63
+ this.handleClose();
64
+ };
65
+
66
+ render() {
67
+ const { anchorEl } = this.state;
68
+ const {
69
+ classes, created, modified, iconClasses, auditsUrl
70
+ } = this.props;
71
+
72
+ return (
73
+ <>
74
+ <Menu
75
+ id="form-help-menu"
76
+ anchorEl={anchorEl}
77
+ open={Boolean(anchorEl)}
78
+ onClose={this.handleClose}
79
+ marginThreshold={16}
80
+ transformOrigin={{
81
+ vertical: 'center',
82
+ horizontal: 'right'
83
+ }}
84
+ >
85
+ {created && (
86
+ <MenuItem disabled className={classes.info}>
87
+ <Typography variant="caption">Created</Typography>
88
+ <Typography variant="subtitle1">
89
+ {typeof created === 'object' && isFinite(created)
90
+ ? formatDate(created, III_DD_MMM_YYYY_HH_MM_SPECIAL)
91
+ : '---- ---- ---- ---- ----'}
92
+ </Typography>
93
+ </MenuItem>
94
+ )}
95
+
96
+ {modified && (
97
+ <MenuItem disabled className={classes.info}>
98
+ <Typography variant="caption">Modified</Typography>
99
+ <Typography variant="subtitle1">
100
+ {typeof modified === 'object' && isFinite(modified)
101
+ ? formatDate(modified, III_DD_MMM_YYYY_HH_MM_SPECIAL)
102
+ : '---- ---- ---- ---- ----'}
103
+ </Typography>
104
+ </MenuItem>
105
+ )}
106
+
107
+ <MenuItem className={created || modified ? classes.divider : undefined} onClick={this.openManual}>
108
+ Open manual
109
+ </MenuItem>
110
+ {auditsUrl && (
111
+ <MenuItem onClick={this.openAudits}>
112
+ View audit trail
113
+ </MenuItem>
114
+ )}
115
+ </Menu>
116
+
117
+ <Tooltip title="Additional information">
118
+ <div>
119
+ <IconButton
120
+ type="button"
121
+ aria-owns={anchorEl ? 'form-help-menu' : null}
122
+ aria-haspopup="true"
123
+ onClick={this.handleAddFieldClick}
124
+ size="large"
125
+ className={clsx({
126
+ [classes.button]: !iconClasses,
127
+ [iconClasses]: !!iconClasses
128
+ })}
129
+ >
130
+ <HelpOutline />
131
+ </IconButton>
132
+ </div>
133
+ </Tooltip>
134
+ </>
135
+ );
136
+ }
137
+ }
138
+
139
+ export default withStyles(styles)(AppBarHelpMenu);
@@ -0,0 +1,9 @@
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
+ export * from './AppBarHelpMenu';
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import AddCircleOutlineOutlinedIcon from '@mui/icons-material/AddCircleOutlineOutlined';
3
+ import IconButton, { IconButtonProps , IconButtonPropsColorOverrides, IconButtonPropsSizeOverrides } from '@mui/material/IconButton';
4
+ import { OverridableStringUnion } from '@mui/types';
5
+
6
+ interface Props extends Partial<IconButtonProps> {
7
+ onClick?: any;
8
+ className?: any;
9
+ disabled?: boolean;
10
+ iconClassName?: any;
11
+ iconFontSize?: 'inherit' | 'large' | 'medium' | 'small';
12
+ color?: OverridableStringUnion<
13
+ 'inherit' | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
14
+ IconButtonPropsColorOverrides
15
+ >,
16
+ size?: OverridableStringUnion<'small' | 'medium' | 'large', IconButtonPropsSizeOverrides>;
17
+ }
18
+
19
+ const AddButton = React.forwardRef<any, Props>((props, ref) => {
20
+ const {
21
+ onClick, className, disabled, iconClassName, iconFontSize, color, size
22
+ } = props;
23
+ return (
24
+ <IconButton color={color} size={size} onClick={onClick} className={className} disabled={disabled} ref={ref}>
25
+ <AddCircleOutlineOutlinedIcon className={iconClassName || 'addButtonColor'} fontSize={iconFontSize || 'small'} />
26
+ </IconButton>
27
+ );
28
+ });
29
+
30
+ export default AddButton;
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
3
+ * No copying or use of this code is allowed without permission in writing from ish.
4
+ */
5
+
6
+ import React from 'react';
7
+ import OpenInNew from '@mui/icons-material/OpenInNew';
8
+ import IconButton from '@mui/material/IconButton';
9
+
10
+ const TimetableButton: React.FC<any> = ({ title = 'Timetable', onClick }) => (
11
+ <div className="centeredFlex">
12
+ <div className="heading">{title}</div>
13
+ <IconButton size="small" color="primary" onClick={onClick}>
14
+ <OpenInNew fontSize="inherit" />
15
+ </IconButton>
16
+ </div>
17
+ );
18
+
19
+ export default TimetableButton;
@@ -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
+ export * from './AddButton';
10
+ export * from './TimetableButton';