acsi-core 0.1.1 → 0.1.3

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.
@@ -1,20 +1,25 @@
1
1
  import { createBrowserHistory } from 'history';
2
2
  import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
3
3
  import React, { useState, useCallback, useEffect, Fragment } from 'react';
4
- import { Container, Card, CardTitle, CardBody, Modal, ModalHeader, ModalBody, ModalFooter, Button, Pagination, PaginationItem, PaginationLink } from 'reactstrap';
4
+ import { Row, Col, Form, Modal, ModalHeader, ModalBody, ModalFooter, Button, Pagination, PaginationItem, PaginationLink, FormGroup, Input, Label } from 'reactstrap';
5
5
  import GoogleLogin, { useGoogleLogout } from '@leecheuk/react-google-login';
6
6
  import axios from 'axios';
7
7
  import moment from 'moment';
8
+ import { Link } from 'react-router-dom';
8
9
  import { gapi } from 'gapi-script';
9
10
  import { useSelector, useDispatch } from 'react-redux';
10
11
  import { Box, Typography } from '@mui/material';
11
12
  export { ToastContainer, toast } from 'react-toastify';
13
+ import Select, { components } from 'react-select';
14
+ import { FaCaretDown } from 'react-icons/fa';
15
+ import CreatableSelect from 'react-select/creatable';
12
16
 
13
17
  var setLoading = createAction("common/setLoading");
14
18
  var setAlert = createAction("common/setAlert");
15
19
  var setUser = createAction("common/setUser");
16
20
  var setLanguage = createAction("common/setLanguage");
17
21
  var reset = createAction("common/reset");
22
+ var setMenuCollapse = createAction("common/setMenuCollapse");
18
23
 
19
24
  var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
20
25
  var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
@@ -28,6 +33,7 @@ var PUSHER_CONFIG = {
28
33
  };
29
34
  var ACCESS_TOKEN = "ACCESS_TOKEN";
30
35
  var ACADEMY_DOMAIN = "ACADEMY_DOMAIN";
36
+ var DefaultErrorMessage = "an_unexpected_error_has_occurred";
31
37
  var getAccessToken = function getAccessToken() {
32
38
  try {
33
39
  return localStorage.getItem(ACCESS_TOKEN);
@@ -48,7 +54,7 @@ var encodeParams = function encodeParams(params) {
48
54
  }).join('&');
49
55
  };
50
56
 
51
- var styles = {"signup_wrap":"_18HOc","back_btn":"_397BX","sign_card":"_2ZRO9","card-header":"_ii7EY","card-body-item":"_LLdCT"};
57
+ var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","box-field":"_2e9xO","box-input":"_3zXRp","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","box-right-body":"_JzdCr","box-right-footer":"_19aCA"};
52
58
 
53
59
  var api = axios.create({
54
60
  baseURL: BASE_URL,
@@ -99,6 +105,8 @@ var apiLoginGoogle = function apiLoginGoogle(body) {
99
105
  return api.post(BASE_URL + "/api/Auth/login", body);
100
106
  };
101
107
 
108
+ var itemLogin = ['Seamless lesson planning', 'Flexibility and customization', 'Data protection and security', 'Standards alignment', 'AI smart assist'];
109
+
102
110
  var BlockLogin = function BlockLogin(_ref) {
103
111
  var onNavigate = _ref.onNavigate,
104
112
  role = _ref.role;
@@ -139,36 +147,127 @@ var BlockLogin = function BlockLogin(_ref) {
139
147
  var onFailureGoogle = function onFailureGoogle() {
140
148
  onNavigate("/login");
141
149
  };
142
- return React.createElement(Container, {
143
- className: "pt-5"
144
- }, React.createElement(Card, {
145
- className: styles["sign_card"] + " mx-auto"
146
- }, React.createElement(CardTitle, {
147
- className: styles["card-header"]
148
- }, "Sign in with Google"), React.createElement(CardBody, {
149
- className: styles["card-body-item"]
150
- }, React.createElement(GoogleLogin, {
150
+ return React.createElement(Row, {
151
+ style: {
152
+ height: "100%"
153
+ }
154
+ }, React.createElement(Col, {
155
+ sm: 12,
156
+ lg: 7
157
+ }, React.createElement("div", {
158
+ className: "" + styleGlobal["box-signin-container"]
159
+ }, React.createElement("div", {
160
+ className: styleGlobal["box-signin-logo"] + " "
161
+ }, React.createElement(Link, {
162
+ to: "/",
163
+ className: "d-flex"
164
+ }, React.createElement("img", {
165
+ src: "/images/Logo.png",
166
+ alt: "",
167
+ height: 37,
168
+ width: 155,
169
+ className: "my-auto"
170
+ }))), React.createElement("div", {
171
+ className: styleGlobal["box-signin"] + " "
172
+ }, React.createElement("div", {
173
+ className: "" + styleGlobal["signin_title"]
174
+ }, React.createElement("span", null, "Welcome to Edusfere")), React.createElement("div", {
175
+ className: "" + styleGlobal["signup_link"]
176
+ }, React.createElement("span", null, "Don't have an account?", " ", React.createElement(Link, {
177
+ to: "/",
178
+ style: {
179
+ color: "#00A0DA"
180
+ },
181
+ className: "text-decoration-none"
182
+ }, "Sign up"))), React.createElement(GoogleLogin, {
151
183
  clientId: GOOGLE_CLIENT_ID,
152
184
  render: function render(renderProps) {
153
185
  return React.createElement("div", {
154
- className: "d-flex justify-content-center mt-5"
186
+ className: "" + styleGlobal["google_button"]
155
187
  }, React.createElement("button", {
156
188
  onClick: renderProps.onClick,
157
- disabled: renderProps.disabled,
158
- className: "d-flex py-3 text-black align-items-center px-3 justify-content-center"
189
+ disabled: renderProps.disabled
159
190
  }, React.createElement("img", {
160
- width: 30,
191
+ width: 24,
192
+ height: 24,
161
193
  alt: "Google sign-in",
162
- src: "/images/icons8-google-96.svg"
163
- }), React.createElement("h6", {
164
- className: "mb-0 ms-3 fw-bold"
165
- }, "sign in with Google")));
194
+ src: "/images/icons/Google__G__logo.png"
195
+ }), "Sign in with Google"));
166
196
  },
167
197
  onSuccess: onSuccessGoogle,
168
198
  onFailure: onFailureGoogle,
169
- cookiePolicy: "single_host_origin",
170
- className: "" + styles["btn-login-google"]
171
- }))));
199
+ cookiePolicy: "single_host_origin"
200
+ }), React.createElement("span", {
201
+ className: "" + styleGlobal["box-field"]
202
+ }, "OR"), React.createElement(Form, null, React.createElement("div", {
203
+ className: "" + styleGlobal["box-input"]
204
+ }, React.createElement("input", {
205
+ type: "email",
206
+ placeholder: "Email"
207
+ })), React.createElement("button", {
208
+ type: "submit",
209
+ className: "" + styleGlobal["box-button-email"]
210
+ }, React.createElement("img", {
211
+ width: 20,
212
+ height: 20,
213
+ alt: "Email sign-in",
214
+ src: "/images/icons/Login_icon.png"
215
+ }), "Sign in with Email"))), React.createElement("div", {
216
+ className: styleGlobal["box-signin-text"] + " "
217
+ }, React.createElement("span", {
218
+ style: {
219
+ fontSize: "13px",
220
+ color: "#A6A6AD"
221
+ }
222
+ }, "By signing in, you agree to our Terms & Privacy Policy")))), React.createElement(Col, {
223
+ sm: 12,
224
+ lg: 5,
225
+ className: "d-none d-lg-block"
226
+ }, React.createElement("div", {
227
+ className: "" + styleGlobal["box-right"],
228
+ style: {
229
+ backgroundImage: "url('/images/bg_login.png')"
230
+ }
231
+ }, React.createElement("div", {
232
+ className: "" + styleGlobal["box-right-body"]
233
+ }, React.createElement("span", {
234
+ style: {
235
+ fontSize: "24px",
236
+ fontWeight: "700"
237
+ }
238
+ }, "As a teacher, your time and energy are too valuable to waste"), React.createElement("p", {
239
+ className: " fw-normal ",
240
+ style: {
241
+ marginTop: "12px",
242
+ marginBottom: "24px",
243
+ color: "#03191F"
244
+ }
245
+ }, "So we\u2019re building a curriculum hub and and workspace that puts everything you need to plan and prep within reach."), React.createElement("ul", null, itemLogin.map(function (item, it) {
246
+ return React.createElement("li", {
247
+ key: it,
248
+ className: "mb-2 ",
249
+ style: {
250
+ color: "#212126"
251
+ }
252
+ }, item);
253
+ })), React.createElement("div", {
254
+ className: "" + styleGlobal["box-right-footer"]
255
+ }, React.createElement("img", {
256
+ className: "img-fluid",
257
+ alt: "",
258
+ src: "/images/image_login.png",
259
+ style: {
260
+ width: "15vw"
261
+ }
262
+ }), React.createElement("div", null, React.createElement("p", null, "As one of our earliest users,", React.createElement("br", null), "you are a vital part of this process"), React.createElement("div", null, React.createElement("span", {
263
+ className: "d-block"
264
+ }, "Thank you!"), React.createElement("img", {
265
+ style: {
266
+ marginTop: "-15px"
267
+ },
268
+ alt: "",
269
+ src: "/images/icons/Vector 22.png"
270
+ }))))))));
172
271
  };
173
272
 
174
273
  var defaultInfo = {
@@ -216,7 +315,7 @@ var Login = function Login(props) {
216
315
  var _useLogin = useLogin(),
217
316
  defaultInfo = _useLogin.defaultInfo;
218
317
  return React.createElement("div", {
219
- className: styles["signup_wrap"] + " container-fluid font-family-lato"
318
+ className: styleGlobal["signup_wrap"] + " container-fluid font-family-lato"
220
319
  }, React.createElement(BlockLogin, {
221
320
  defaultInfo: defaultInfo,
222
321
  onNavigate: onNavigate,
@@ -427,7 +526,8 @@ var initialState = {
427
526
  message: ""
428
527
  },
429
528
  user: null,
430
- academy: null
529
+ academy: null,
530
+ menuCollapse: false
431
531
  };
432
532
  var commonReducer = createReducer(initialState, function (builder) {
433
533
  builder.addCase(setLoading, function (state, action) {
@@ -440,6 +540,8 @@ var commonReducer = createReducer(initialState, function (builder) {
440
540
  state.language = action.payload;
441
541
  }).addCase(reset, function (_state, _action) {
442
542
  return initialState;
543
+ }).addCase(setMenuCollapse, function (state, action) {
544
+ state.menuCollapse = action.payload;
443
545
  });
444
546
  });
445
547
 
@@ -840,7 +942,548 @@ var CustomPagination = function CustomPagination(_ref) {
840
942
  })));
841
943
  };
842
944
 
945
+ var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj"};
946
+
947
+ var CoreButton = function CoreButton(props) {
948
+ var _props$type = props.type,
949
+ type = _props$type === void 0 ? "primary" : _props$type,
950
+ children = props.children,
951
+ onClick = props.onClick,
952
+ icon = props.icon,
953
+ _props$disabled = props.disabled,
954
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
955
+ _props$background = props.background,
956
+ background = _props$background === void 0 ? "#F5F9FA" : _props$background,
957
+ _props$color = props.color,
958
+ color = _props$color === void 0 ? "#585869" : _props$color;
959
+ return React.createElement("button", {
960
+ className: styles["core-button"] + " " + styles[type],
961
+ style: {
962
+ "background": background,
963
+ "color": color
964
+ },
965
+ onClick: onClick,
966
+ disabled: disabled
967
+ }, icon && icon, children);
968
+ };
969
+
970
+ var styles$1 = {"core-input":"_1WdX2","outline":"_3X2RJ","no-outline":"_bVYtv","error":"_n7n3Q"};
971
+
972
+ var styles$2 = {"core-error":"_1Mmxr"};
973
+
974
+ var icons = {
975
+ ErrorRedIcon: "/images/icons/error_red.svg"
976
+ };
977
+
978
+ var CoreError = function CoreError(props) {
979
+ var message = props.message;
980
+ return React.createElement("div", {
981
+ className: "" + styles$2["core-error"]
982
+ }, React.createElement("img", {
983
+ src: icons.ErrorRedIcon,
984
+ alt: "error-icon"
985
+ }), React.createElement("p", null, message));
986
+ };
987
+
988
+ var CoreInput = function CoreInput(props) {
989
+ var name = props.name,
990
+ value = props.value,
991
+ _onChange = props.onChange,
992
+ _props$type = props.type,
993
+ type = _props$type === void 0 ? "outline" : _props$type,
994
+ _props$disabled = props.disabled,
995
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
996
+ label = props.label,
997
+ width = props.width,
998
+ _props$placeholder = props.placeholder,
999
+ placeholder = _props$placeholder === void 0 ? "" : _props$placeholder,
1000
+ error = props.error,
1001
+ _props$errorMessage = props.errorMessage,
1002
+ errorMessage = _props$errorMessage === void 0 ? "" : _props$errorMessage,
1003
+ fontSize = props.fontSize,
1004
+ fontWeight = props.fontWeight,
1005
+ _onKeyDown = props.onKeyDown,
1006
+ ref = props.ref;
1007
+ return React.createElement("div", {
1008
+ className: styles$1["core-input"] + " " + styles$1[type] + " " + (error ? styles$1["error"] : ""),
1009
+ style: {
1010
+ width: width != null ? width : "100%"
1011
+ }
1012
+ }, label && React.createElement("label", null, label), React.createElement("input", Object.assign({
1013
+ style: {
1014
+ fontSize: fontSize,
1015
+ fontWeight: fontWeight
1016
+ },
1017
+ name: name,
1018
+ value: value,
1019
+ onChange: function onChange(e) {
1020
+ return _onChange(name, e.target.value);
1021
+ },
1022
+ disabled: disabled,
1023
+ placeholder: placeholder,
1024
+ onKeyDown: function onKeyDown(e) {
1025
+ return _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
1026
+ }
1027
+ }, ref)), error && React.createElement(CoreError, {
1028
+ message: errorMessage
1029
+ }));
1030
+ };
1031
+
1032
+ function _extends() {
1033
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
1034
+ for (var e = 1; e < arguments.length; e++) {
1035
+ var t = arguments[e];
1036
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1037
+ }
1038
+ return n;
1039
+ }, _extends.apply(null, arguments);
1040
+ }
1041
+ function _objectWithoutPropertiesLoose(r, e) {
1042
+ if (null == r) return {};
1043
+ var t = {};
1044
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1045
+ if (e.includes(n)) continue;
1046
+ t[n] = r[n];
1047
+ }
1048
+ return t;
1049
+ }
1050
+
1051
+ var styles$3 = {"core-select":"_2sg12"};
1052
+
1053
+ var CoreSelect = function CoreSelect(props) {
1054
+ var _options$find;
1055
+ var name = props.name,
1056
+ options = props.options,
1057
+ value = props.value,
1058
+ _onChange = props.onChange,
1059
+ _props$disabled = props.disabled,
1060
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
1061
+ label = props.label,
1062
+ width = props.width,
1063
+ _props$placeholder = props.placeholder,
1064
+ placeholder = _props$placeholder === void 0 ? "" : _props$placeholder,
1065
+ error = props.error,
1066
+ _props$errorMessage = props.errorMessage,
1067
+ errorMessage = _props$errorMessage === void 0 ? "" : _props$errorMessage;
1068
+ return React.createElement("div", {
1069
+ className: "" + styles$3["core-select"],
1070
+ style: {
1071
+ width: width != null ? width : "100%"
1072
+ }
1073
+ }, label && React.createElement("label", null, label), React.createElement(Select, {
1074
+ name: name,
1075
+ value: (_options$find = options.find(function (i) {
1076
+ return i.value === value;
1077
+ })) != null ? _options$find : null,
1078
+ onChange: function onChange(e) {
1079
+ return _onChange(name, e === null || e === void 0 ? void 0 : e.value);
1080
+ },
1081
+ placeholder: placeholder,
1082
+ isDisabled: disabled,
1083
+ options: options,
1084
+ styles: {
1085
+ control: function control(base, state) {
1086
+ return _extends({}, base, {
1087
+ borderRadius: "8px",
1088
+ border: state.isFocused ? "2px solid " + (!error ? "#00AFDA" : "#CE3636") : "1px solid " + (!error ? "#E6E6EB" : "#CE3636"),
1089
+ height: "32px",
1090
+ minHeight: 0,
1091
+ fontSize: "14px",
1092
+ fontWeight: "400",
1093
+ padding: "0 4px",
1094
+ backgroundColor: state.isDisabled ? "#F5F9FA)" : "#FFF",
1095
+ boxShadow: "none",
1096
+ "&:hover": {
1097
+ backgroundColor: "#F5F9FA"
1098
+ },
1099
+ transition: "all .3s",
1100
+ overflow: "hidden"
1101
+ });
1102
+ },
1103
+ input: function input(base) {
1104
+ return _extends({}, base, {
1105
+ margin: "0",
1106
+ padding: "0",
1107
+ color: "inherit"
1108
+ });
1109
+ },
1110
+ placeholder: function placeholder(base) {
1111
+ return _extends({}, base, {
1112
+ color: "#A6A6AD",
1113
+ position: "relative",
1114
+ top: "-4px"
1115
+ });
1116
+ },
1117
+ dropdownIndicator: function dropdownIndicator(base) {
1118
+ return _extends({}, base, {
1119
+ position: "relative",
1120
+ top: "-4px",
1121
+ padding: "8px 0"
1122
+ });
1123
+ },
1124
+ indicatorSeparator: function indicatorSeparator() {
1125
+ return {
1126
+ display: "none"
1127
+ };
1128
+ },
1129
+ valueContainer: function valueContainer(base) {
1130
+ return _extends({}, base, {
1131
+ height: "32px"
1132
+ });
1133
+ },
1134
+ singleValue: function singleValue(base) {
1135
+ return _extends({}, base, {
1136
+ position: "relative",
1137
+ top: "-4px"
1138
+ });
1139
+ }
1140
+ }
1141
+ }), error && React.createElement(CoreError, {
1142
+ message: errorMessage
1143
+ }));
1144
+ };
1145
+
1146
+ var styles$4 = {"core-checkbox":"_3HY4f"};
1147
+
1148
+ var CoreInput$1 = function CoreInput(props) {
1149
+ var name = props.name,
1150
+ checked = props.checked,
1151
+ _onChange = props.onChange,
1152
+ _props$disabled = props.disabled,
1153
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
1154
+ label = props.label;
1155
+ return React.createElement("div", {
1156
+ className: "" + styles$4["core-checkbox"]
1157
+ }, React.createElement(FormGroup, {
1158
+ check: true,
1159
+ inline: true
1160
+ }, React.createElement(Input, {
1161
+ id: "core-checkbox-" + name,
1162
+ type: "checkbox",
1163
+ name: name,
1164
+ checked: checked,
1165
+ onChange: function onChange(e) {
1166
+ return _onChange(name, e.target.checked);
1167
+ },
1168
+ disabled: disabled
1169
+ }), React.createElement(Label, {
1170
+ htmlFor: "core-checkbox-" + name,
1171
+ check: true
1172
+ }, label)));
1173
+ };
1174
+
1175
+ var styles$5 = {"core-radio":"_kvUpe","form-check":"_3ToPe"};
1176
+
1177
+ var CoreRadio = function CoreRadio(props) {
1178
+ var name = props.name,
1179
+ value = props.value,
1180
+ options = props.options,
1181
+ onChange = props.onChange,
1182
+ _props$disabled = props.disabled,
1183
+ disabled = _props$disabled === void 0 ? false : _props$disabled;
1184
+ return React.createElement("div", {
1185
+ className: "" + styles$5["core-radio"]
1186
+ }, React.createElement(FormGroup, {
1187
+ check: true
1188
+ }, options.map(function (i) {
1189
+ return React.createElement("div", {
1190
+ key: i.value
1191
+ }, React.createElement(Input, {
1192
+ id: "core-radio-" + i.value,
1193
+ type: "radio",
1194
+ checked: value === i.value,
1195
+ onClick: function onClick() {
1196
+ onChange(name, i.value);
1197
+ },
1198
+ onChange: function onChange() {
1199
+ return;
1200
+ },
1201
+ disabled: disabled
1202
+ }), React.createElement(Label, {
1203
+ htmlFor: "core-radio-" + i.value
1204
+ }, i.label));
1205
+ })));
1206
+ };
1207
+
1208
+ var styles$6 = {"core-modal-header":"_2y5ln"};
1209
+
1210
+ var CoreModal = function CoreModal(props) {
1211
+ var open = props.open,
1212
+ onClose = props.onClose,
1213
+ children = props.children,
1214
+ title = props.title,
1215
+ footer = props.footer;
1216
+ return React.createElement(Modal, {
1217
+ isOpen: open,
1218
+ toggle: onClose,
1219
+ centered: true,
1220
+ className: styles$6["core-modal"]
1221
+ }, React.createElement(ModalHeader, {
1222
+ toggle: onClose,
1223
+ className: styles$6["core-modal-header"]
1224
+ }, title), React.createElement(ModalBody, null, children), footer && React.createElement(ModalFooter, null, footer));
1225
+ };
1226
+
1227
+ var styles$7 = {"core-range":"_1dzD7"};
1228
+
1229
+ var CoreRange = function CoreRange(props) {
1230
+ var name = props.name,
1231
+ value = props.value,
1232
+ _onChange = props.onChange,
1233
+ label = props.label,
1234
+ width = props.width,
1235
+ min = props.min,
1236
+ max = props.max,
1237
+ step = props.step;
1238
+ return React.createElement("div", {
1239
+ className: "" + styles$7["core-range"],
1240
+ style: {
1241
+ width: width != null ? width : "100%"
1242
+ }
1243
+ }, label && React.createElement("label", null, label), React.createElement("input", {
1244
+ type: "range",
1245
+ name: name,
1246
+ value: value,
1247
+ onChange: function onChange(e) {
1248
+ return _onChange(name, +e.target.value);
1249
+ },
1250
+ min: min,
1251
+ max: max,
1252
+ step: step
1253
+ }));
1254
+ };
1255
+
1256
+ var styles$8 = {"core-text-area":"_1b_C3"};
1257
+
1258
+ var CoreTextArea = function CoreTextArea(props) {
1259
+ var name = props.name,
1260
+ _onChange = props.onChange,
1261
+ value = props.value,
1262
+ _props$cols = props.cols,
1263
+ cols = _props$cols === void 0 ? 0 : _props$cols,
1264
+ label = props.label,
1265
+ _props$rows = props.rows,
1266
+ rows = _props$rows === void 0 ? 2 : _props$rows,
1267
+ _props$placeholder = props.placeholder,
1268
+ placeholder = _props$placeholder === void 0 ? "" : _props$placeholder,
1269
+ width = props.width;
1270
+ return React.createElement("div", {
1271
+ className: styles$8["core-text-area"]
1272
+ }, label && React.createElement("label", null, label), React.createElement("textarea", {
1273
+ placeholder: placeholder,
1274
+ value: value,
1275
+ cols: cols,
1276
+ rows: rows,
1277
+ onChange: function onChange(e) {
1278
+ return _onChange(name, e.target.value);
1279
+ },
1280
+ style: {
1281
+ width: width != null ? width : "100%"
1282
+ }
1283
+ }));
1284
+ };
1285
+
1286
+ var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
1287
+ var _error$response, _error$response$data, _error$response2, _error$response3, _error$response3$data;
1288
+ var errorMessage = error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title;
1289
+ if ((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 500) return defaultErrorMessage || DefaultErrorMessage;
1290
+ if (typeof errorMessage === "string") return decodeURIComponent(errorMessage);
1291
+ errorMessage = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : _error$response3$data.message);
1292
+ if (typeof errorMessage === "string") return errorMessage;
1293
+ return defaultErrorMessage || DefaultErrorMessage;
1294
+ };
1295
+
1296
+ var customStyles = {
1297
+ control: function control(baseStyles, state) {
1298
+ return _extends({}, baseStyles, {
1299
+ fontSize: "14px",
1300
+ fontWeight: 700,
1301
+ color: styleGlobal.darker,
1302
+ borderColor: state.isFocused || state.hasValue ? styleGlobal.dark : styleGlobal.less_dark,
1303
+ boxShadow: state.isFocused ? "0 0 0 1px " + styleGlobal.dark + "4D" : baseStyles.boxShadow,
1304
+ "&:active": {
1305
+ borderColor: state.isFocused || state.hasValue ? styleGlobal.dark : styleGlobal.less_dark
1306
+ },
1307
+ "&:hover": {
1308
+ borderColor: state.isFocused || state.hasValue ? styleGlobal.dark : styleGlobal.less_dark
1309
+ }
1310
+ });
1311
+ },
1312
+ input: function input(baseStyles, _) {
1313
+ return _extends({}, baseStyles, {
1314
+ fontSize: "14px",
1315
+ fontWeight: 700,
1316
+ color: styleGlobal.darker
1317
+ });
1318
+ },
1319
+ singleValue: function singleValue(baseStyles) {
1320
+ return _extends({}, baseStyles, {
1321
+ fontSize: "14px",
1322
+ fontWeight: 700,
1323
+ color: styleGlobal.darker
1324
+ });
1325
+ },
1326
+ option: function option(baseStyles, state) {
1327
+ return _extends({}, baseStyles, {
1328
+ backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.light : 'white',
1329
+ "&:active": {
1330
+ backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.less_dark : baseStyles.backgroundColor
1331
+ }
1332
+ });
1333
+ }
1334
+ };
1335
+
1336
+ var DropdownIndicator = function DropdownIndicator(props) {
1337
+ return React.createElement(components.DropdownIndicator, Object.assign({}, props), React.createElement(FaCaretDown, {
1338
+ size: 20,
1339
+ color: styleGlobal.darker
1340
+ }));
1341
+ };
1342
+ var CustomOption = function CustomOption(props) {
1343
+ return React.createElement(components.Option, Object.assign({}, props), React.createElement("div", {
1344
+ style: {
1345
+ fontSize: "14px",
1346
+ fontWeight: 500
1347
+ }
1348
+ }, props.data.label));
1349
+ };
1350
+
1351
+ var _excluded = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1352
+ var CustomSelect = function CustomSelect(_ref) {
1353
+ var isDefault = _ref.isDefault,
1354
+ options = _ref.options,
1355
+ isDisabled = _ref.isDisabled,
1356
+ scrollBottom = _ref.scrollBottom,
1357
+ value = _ref.value,
1358
+ isMulti = _ref.isMulti,
1359
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1360
+ var initialValues = Array.isArray(value) ? options.filter(function (i) {
1361
+ return value.includes(i.value);
1362
+ }) : isMulti ? options === null || options === void 0 ? void 0 : options.filter(function (i) {
1363
+ return i.value == value;
1364
+ }) : options === null || options === void 0 ? void 0 : options.find(function (i) {
1365
+ return i.value == value;
1366
+ });
1367
+ return React.createElement(Select, Object.assign({
1368
+ isDisabled: isDisabled,
1369
+ options: options,
1370
+ value: !isDefault ? initialValues != null ? initialValues : null : undefined,
1371
+ defaultValue: isDefault ? initialValues : undefined,
1372
+ menuPlacement: scrollBottom ? "top" : "auto",
1373
+ isMulti: isMulti,
1374
+ components: {
1375
+ IndicatorSeparator: function IndicatorSeparator() {
1376
+ return null;
1377
+ },
1378
+ DropdownIndicator: DropdownIndicator,
1379
+ Option: CustomOption
1380
+ },
1381
+ styles: customStyles,
1382
+ placeholder: "Select..."
1383
+ }, rest));
1384
+ };
1385
+
1386
+ var _excluded$1 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1387
+ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1388
+ var isDefault = _ref.isDefault,
1389
+ options = _ref.options,
1390
+ isDisabled = _ref.isDisabled,
1391
+ scrollBottom = _ref.scrollBottom,
1392
+ value = _ref.value,
1393
+ isMulti = _ref.isMulti,
1394
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1395
+ var initialValues = Array.isArray(value) ? options.filter(function (i) {
1396
+ return value.includes(i.value);
1397
+ }) : isMulti ? options.filter(function (i) {
1398
+ return i.value == value;
1399
+ }) : options.find(function (i) {
1400
+ return i.value == value;
1401
+ });
1402
+ return React.createElement(Select, Object.assign({
1403
+ isDisabled: isDisabled,
1404
+ options: options,
1405
+ value: !isDefault ? initialValues : undefined,
1406
+ defaultValue: isDefault ? initialValues : undefined,
1407
+ menuPlacement: scrollBottom ? "top" : "auto",
1408
+ isMulti: isMulti,
1409
+ components: {
1410
+ IndicatorSeparator: function IndicatorSeparator() {
1411
+ return null;
1412
+ },
1413
+ DropdownIndicator: DropdownIndicator,
1414
+ Option: CustomOption
1415
+ },
1416
+ styles: customStyles,
1417
+ placeholder: "Select..."
1418
+ }, rest));
1419
+ };
1420
+
1421
+ var _excluded$2 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1422
+ var CustomCreatable = function CustomCreatable(_ref) {
1423
+ var options = _ref.options,
1424
+ isDisabled = _ref.isDisabled,
1425
+ scrollBottom = _ref.scrollBottom,
1426
+ value = _ref.value,
1427
+ isMulti = _ref.isMulti,
1428
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1429
+ var initialValues = Array.isArray(value) ? options.filter(function (i) {
1430
+ return value.includes(i.value);
1431
+ }) : isMulti ? options.filter(function (i) {
1432
+ return i.value == value;
1433
+ }) : options.find(function (i) {
1434
+ return i.value == value;
1435
+ });
1436
+ return React.createElement(CreatableSelect, Object.assign({
1437
+ isClearable: true,
1438
+ isDisabled: isDisabled,
1439
+ options: options,
1440
+ value: initialValues,
1441
+ menuPlacement: scrollBottom ? "top" : "auto",
1442
+ isMulti: isMulti,
1443
+ components: {
1444
+ IndicatorSeparator: function IndicatorSeparator() {
1445
+ return null;
1446
+ },
1447
+ DropdownIndicator: DropdownIndicator,
1448
+ Option: CustomOption
1449
+ },
1450
+ styles: customStyles,
1451
+ placeholder: "Select..."
1452
+ }, rest));
1453
+ };
1454
+
1455
+ var _excluded$3 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1456
+ var CustomSelectOption = function CustomSelectOption(_ref) {
1457
+ var defaultValue = _ref.defaultValue,
1458
+ options = _ref.options,
1459
+ isDisabled = _ref.isDisabled,
1460
+ scrollBottom = _ref.scrollBottom,
1461
+ value = _ref.value,
1462
+ isMulti = _ref.isMulti,
1463
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1464
+ var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? options.find(function (option) {
1465
+ return option.value === defaultValue;
1466
+ }) || null : null;
1467
+ return React.createElement(Select, Object.assign({
1468
+ isDisabled: isDisabled,
1469
+ options: options,
1470
+ value: value,
1471
+ defaultValue: initialValues,
1472
+ menuPlacement: scrollBottom ? "top" : "auto",
1473
+ isMulti: isMulti,
1474
+ components: {
1475
+ IndicatorSeparator: function IndicatorSeparator() {
1476
+ return null;
1477
+ },
1478
+ DropdownIndicator: DropdownIndicator,
1479
+ Option: CustomOption
1480
+ },
1481
+ styles: customStyles,
1482
+ placeholder: "Select..."
1483
+ }, rest));
1484
+ };
1485
+
843
1486
  var historyCore = createBrowserHistory();
844
1487
 
845
- export { ACCESS_TOKEN, BASE_URL, CommonDialog, ConfirmDialog, CustomPagination, LayoutContext, Loading, Login, NotFound, Role, api$1 as api, apiUpload$1 as apiUpload, historyCore, setAlert, setLoading, setUser, store, useGoogleSignOut };
1488
+ export { ACCESS_TOKEN, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreModal, CoreRadio, CoreRange, CoreSelect, CoreTextArea, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, LayoutContext, Loading, Login, NotFound, Role, api$1 as api, apiUpload$1 as apiUpload, getErrorMessage, historyCore, setAlert, setLoading, setMenuCollapse, setUser, store, useGoogleSignOut };
846
1489
  //# sourceMappingURL=index.modern.js.map