acsi-core 0.1.21 → 0.1.23

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.
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface IProps {
3
+ value: string;
4
+ }
5
+ declare const ContentTextArea: (props: IProps) => React.JSX.Element;
6
+ export default ContentTextArea;
@@ -1,16 +1,16 @@
1
1
  import React from "react";
2
2
  interface IProps {
3
- name: string;
3
+ name?: string;
4
4
  value: string;
5
5
  onChange: (name: string, value: string) => void;
6
6
  placeholder?: string;
7
+ error?: boolean;
7
8
  label?: string;
8
- cols?: number;
9
- rows?: number;
10
- width?: number;
11
- tooltip?: string;
12
9
  isOptional?: boolean;
13
- minHeight?: string;
10
+ tooltip?: string;
11
+ noBorder?: boolean;
12
+ smallHeight?: boolean;
13
+ hideToolbar?: boolean;
14
14
  }
15
15
  declare const CoreTextArea: (props: IProps) => React.JSX.Element;
16
16
  export default CoreTextArea;
@@ -11,3 +11,4 @@ export { default as CoreSearch } from "./CoreSearch";
11
11
  export { default as CoreSelectCompact } from "./CoreSelectCompact";
12
12
  export { default as CoreInputCompact } from "./CoreInputCompact";
13
13
  export { default as CoreTitleInput } from "./CoreTitleInput";
14
+ export { default as ContentTextArea } from "./ContentTextArea";
package/dist/index.css CHANGED
@@ -292,34 +292,47 @@
292
292
  font-weight: 600;
293
293
  margin-bottom: 4px; }
294
294
 
295
- ._1b_C3 textarea {
296
- width: 100%;
295
+ ._3TUh3 > div {
296
+ padding: 8px 12px;
297
297
  outline: none;
298
- border-radius: 8px;
299
298
  border: 1px solid #e6e6eb;
300
- padding: 8px 12px;
299
+ border-radius: 8px;
300
+ font-family: Nunito;
301
301
  font-size: 14px;
302
- font-weight: 400;
303
- color: #212126; }
304
- ._1b_C3 textarea:hover {
302
+ color: #212126;
303
+ min-height: 73px; }
304
+ ._3TUh3 > div:hover {
305
305
  background-color: #e5f9ff; }
306
- ._1b_C3 textarea::-moz-placeholder {
307
- color: #a6a6ad; }
308
- ._1b_C3 textarea::placeholder {
309
- color: #a6a6ad; }
306
+ ._3TUh3 > div::before {
307
+ left: 12px !important;
308
+ color: #a6a6ad !important; }
310
309
 
311
- ._1b_C3 ._15n2K {
310
+ ._3TUh3 p {
311
+ margin: 0; }
312
+
313
+ ._3TUh3 ._15n2K {
314
+ display: flex;
315
+ align-items: center;
316
+ gap: 4px;
312
317
  font-size: 14px;
313
318
  font-weight: 400;
314
- margin-bottom: 4px;
315
319
  color: #585869;
316
- display: flex;
317
- align-items: center;
318
- gap: 2px; }
319
- ._1b_C3 ._15n2K ._1fHZB {
320
+ margin-bottom: 8px; }
321
+ ._3TUh3 ._15n2K ._1fHZB {
320
322
  color: #a6a6ad; }
321
- ._1b_C3 ._15n2K ._38AfS {
322
- cursor: pointer; }
323
+ ._3TUh3 ._15n2K ._38AfS {
324
+ cursor: pointer;
325
+ display: flex;
326
+ align-items: center; }
327
+
328
+ ._DaofN > div {
329
+ background-color: #fff5ce; }
330
+
331
+ ._2JOcF > div {
332
+ border: none; }
333
+
334
+ ._1EXev > div {
335
+ min-height: 54px; }
323
336
 
324
337
  ._wyI1K {
325
338
  height: 32px;
@@ -420,3 +433,28 @@
420
433
  font-size: 18px;
421
434
  font-weight: 700;
422
435
  line-height: 24.55px; }
436
+
437
+ ._1akNq > div {
438
+ padding: 8px 12px;
439
+ outline: none;
440
+ font-size: 14px;
441
+ color: #212126;
442
+ min-height: 73px; }
443
+
444
+ ._1akNq p {
445
+ margin: 0; }
446
+
447
+ ._1akNq ._2Tff6 {
448
+ display: flex;
449
+ align-items: center;
450
+ gap: 4px;
451
+ font-size: 14px;
452
+ font-weight: 400;
453
+ color: #585869;
454
+ margin-bottom: 8px; }
455
+ ._1akNq ._2Tff6 ._30bfd {
456
+ color: #a6a6ad; }
457
+ ._1akNq ._2Tff6 ._1p5kJ {
458
+ cursor: pointer;
459
+ display: flex;
460
+ align-items: center; }
package/dist/index.d.ts CHANGED
@@ -13,10 +13,10 @@ import { ToastContainer, toast } from "react-toastify";
13
13
  import { Role } from "./containers/Login/configs/constants";
14
14
  import CustomPagination from "./components/Paginations/CustomPagination";
15
15
  import useGoogleSignOut from "./utils/hooks/useGoogleSignOut";
16
- import { CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput } from "./components";
16
+ import { CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, ContentTextArea } from "./components";
17
17
  import { getErrorMessage } from "./utils/getErrorMessage";
18
18
  import CustomSelect from "./components/Selects/CustomSelect";
19
19
  import CustomAsyncSelect from "./components/Selects/CustomAsyncSelect";
20
20
  import CustomCreatable from "./components/Selects/CustomCreatable";
21
21
  import CustomSelectOption from "./components/Selects/CustomSelectOption";
22
- export { setLoading, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, Login, store, historyCore, setAlert, setUser, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, getErrorMessage, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption };
22
+ export { setLoading, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, Login, store, historyCore, setAlert, setUser, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, ContentTextArea, getErrorMessage, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption };
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var material = require('@mui/material');
16
16
  var reactToastify = require('react-toastify');
17
17
  var ReactSelect = require('react-select');
18
18
  var ReactSelect__default = _interopDefault(ReactSelect);
19
+ var tinymceReact = require('@tinymce/tinymce-react');
19
20
  var fa = require('react-icons/fa');
20
21
  var CreatableSelect = _interopDefault(require('react-select/creatable'));
21
22
 
@@ -38,6 +39,7 @@ var PUSHER_CONFIG = {
38
39
  key: process.env.REACT_APP_PUSHER_CONFIG_KEY || ""
39
40
  };
40
41
  var OPENSALT_BASE_URL = process.env.REACT_APP_OPENSALT || "";
42
+ var REACT_KEY_TINYMCE = "pko716e6i67met1af7d98ygkma5u38citul7ch78y6pz8bvr";
41
43
  var ACCESS_TOKEN = "ACCESS_TOKEN";
42
44
  var ACADEMY_DOMAIN = "ACADEMY_DOMAIN";
43
45
  var DATE_TIME_MIN_VALUE = "0001-01-01T00:00:00";
@@ -1400,7 +1402,7 @@ var CoreRange = function CoreRange(props) {
1400
1402
  }));
1401
1403
  };
1402
1404
 
1403
- var styles$8 = {"core-text-area":"_1b_C3","label":"_15n2K","optional":"_1fHZB","icon":"_38AfS"};
1405
+ var styles$8 = {"editor":"_3TUh3","label":"_15n2K","optional":"_1fHZB","icon":"_38AfS","error":"_DaofN","no-border":"_2JOcF","small-height":"_1EXev"};
1404
1406
 
1405
1407
  var Search = function Search(props) {
1406
1408
  var _props$size = props.size,
@@ -1488,78 +1490,57 @@ var Info = function Info() {
1488
1490
  };
1489
1491
 
1490
1492
  var CoreTextArea = function CoreTextArea(props) {
1491
- var name = props.name,
1492
- _onChange = props.onChange,
1493
+ var _props$name = props.name,
1494
+ name = _props$name === void 0 ? "" : _props$name,
1493
1495
  value = props.value,
1494
- _props$cols = props.cols,
1495
- cols = _props$cols === void 0 ? 0 : _props$cols,
1496
- label = props.label,
1497
- _props$rows = props.rows,
1498
- rows = _props$rows === void 0 ? 2 : _props$rows,
1496
+ onChange = props.onChange,
1499
1497
  _props$placeholder = props.placeholder,
1500
- placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
1501
- width = props.width,
1502
- _props$tooltip = props.tooltip,
1503
- tooltip = _props$tooltip === void 0 ? '' : _props$tooltip,
1498
+ placeholder = _props$placeholder === void 0 ? "Type here..." : _props$placeholder,
1499
+ _props$error = props.error,
1500
+ error = _props$error === void 0 ? false : _props$error,
1501
+ label = props.label,
1504
1502
  _props$isOptional = props.isOptional,
1505
1503
  isOptional = _props$isOptional === void 0 ? false : _props$isOptional,
1506
- minHeight = props.minHeight;
1507
- var textareaRef = React.useRef(null);
1504
+ tooltip = props.tooltip,
1505
+ _props$noBorder = props.noBorder,
1506
+ noBorder = _props$noBorder === void 0 ? false : _props$noBorder,
1507
+ _props$smallHeight = props.smallHeight,
1508
+ smallHeight = _props$smallHeight === void 0 ? false : _props$smallHeight,
1509
+ _props$hideToolbar = props.hideToolbar,
1510
+ hideToolbar = _props$hideToolbar === void 0 ? false : _props$hideToolbar;
1508
1511
  var _useState = React.useState(false),
1509
1512
  isOpenTooltip = _useState[0],
1510
1513
  setIsOpenTooltip = _useState[1];
1511
1514
  var toggleTooltip = function toggleTooltip() {
1512
1515
  return setIsOpenTooltip(!isOpenTooltip);
1513
1516
  };
1514
- React.useEffect(function () {
1515
- var _textareaRef$current2;
1516
- if (textareaRef.current) {
1517
- var _textareaRef$current;
1518
- textareaRef.current.style.height = "auto";
1519
- textareaRef.current.style.height = ((_textareaRef$current = textareaRef.current) === null || _textareaRef$current === void 0 ? void 0 : _textareaRef$current.scrollHeight) + "px";
1520
- }
1521
- if (((_textareaRef$current2 = textareaRef.current) === null || _textareaRef$current2 === void 0 ? void 0 : _textareaRef$current2.scrollHeight) == 0 && value.length > 0) {
1522
- setTimeout(function () {
1523
- if (textareaRef.current) {
1524
- var _textareaRef$current3;
1525
- textareaRef.current.style.height = ((_textareaRef$current3 = textareaRef.current) === null || _textareaRef$current3 === void 0 ? void 0 : _textareaRef$current3.scrollHeight) + "px";
1526
- }
1527
- }, 0);
1528
- }
1529
- }, [value]);
1530
1517
  return React__default.createElement("div", {
1531
- className: styles$8["core-text-area"],
1532
- style: {
1533
- width: width != null ? width : "100%"
1534
- }
1535
- }, label && React__default.createElement("div", {
1536
- className: styles$8['label']
1518
+ className: styles$8["editor"] + " " + (error ? styles$8["error"] : "") + " " + (noBorder ? styles$8["no-border"] : "") + " " + (smallHeight ? styles$8["small-height"] : "")
1519
+ }, label && React__default.createElement("span", {
1520
+ className: styles$8["label"]
1537
1521
  }, React__default.createElement("div", {
1538
- className: styles$8['text']
1522
+ className: styles$8["label-content"]
1539
1523
  }, label), isOptional && React__default.createElement("div", {
1540
- className: styles$8['optional']
1541
- }, "(optional)"), React__default.createElement("div", {
1542
- className: styles$8['icon'],
1543
- id: name
1544
- }, React__default.createElement(Info, null)), tooltip ? React__default.createElement(reactstrap.Tooltip, {
1524
+ className: styles$8["optional"]
1525
+ }, "(optional)"), tooltip && React__default.createElement("div", {
1526
+ id: name,
1527
+ className: styles$8["icon"]
1528
+ }, React__default.createElement(Info, null), React__default.createElement(reactstrap.Tooltip, {
1545
1529
  target: name,
1546
1530
  isOpen: isOpenTooltip,
1547
1531
  toggle: toggleTooltip
1548
- }, tooltip) : null), React__default.createElement("textarea", {
1549
- ref: textareaRef,
1550
- placeholder: placeholder,
1551
- style: {
1552
- whiteSpace: "pre-wrap",
1553
- width: "100%",
1554
- minHeight: minHeight ? minHeight : "123px",
1555
- resize: "none",
1556
- overflow: "hidden"
1557
- },
1532
+ }, tooltip))), React__default.createElement(tinymceReact.Editor, {
1533
+ apiKey: REACT_KEY_TINYMCE,
1558
1534
  value: value,
1559
- cols: cols,
1560
- rows: rows,
1561
- onChange: function onChange(e) {
1562
- return _onChange(name, e.target.value);
1535
+ onEditorChange: function onEditorChange(value) {
1536
+ return onChange(name, value);
1537
+ },
1538
+ init: {
1539
+ menubar: false,
1540
+ inline: true,
1541
+ plugins: ["lists", "table", "link", "image", "advlist"],
1542
+ toolbar: hideToolbar ? '' : "undo redo | styleselect | bold italic forecolor backcolor | \n table link image | \n alignleft aligncenter alignright bullist numlist",
1543
+ placeholder: placeholder
1563
1544
  }
1564
1545
  }));
1565
1546
  };
@@ -1877,6 +1858,18 @@ var CoreTitleInput = function CoreTitleInput(props) {
1877
1858
  }));
1878
1859
  };
1879
1860
 
1861
+ var styles$d = {"editor":"_1akNq","label":"_2Tff6","optional":"_30bfd","icon":"_1p5kJ"};
1862
+
1863
+ var ContentTextArea = function ContentTextArea(props) {
1864
+ var value = props.value;
1865
+ return React__default.createElement("div", {
1866
+ className: "" + styles$d["editor"]
1867
+ }, React__default.createElement(tinymceReact.Editor, {
1868
+ apiKey: REACT_KEY_TINYMCE,
1869
+ value: value
1870
+ }));
1871
+ };
1872
+
1880
1873
  var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
1881
1874
  var _error$response, _error$response$data, _error$response2, _error$response3, _error$response3$data;
1882
1875
  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;
@@ -2095,6 +2088,7 @@ exports.ACCESS_TOKEN = ACCESS_TOKEN;
2095
2088
  exports.BASE_URL = BASE_URL;
2096
2089
  exports.CommonDialog = CommonDialog;
2097
2090
  exports.ConfirmDialog = ConfirmDialog;
2091
+ exports.ContentTextArea = ContentTextArea;
2098
2092
  exports.CoreButton = CoreButton;
2099
2093
  exports.CoreCheckbox = CoreInput$1;
2100
2094
  exports.CoreError = CoreError;