acsi-core 0.1.9 → 0.1.10

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,7 +1,7 @@
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 { Row, Col, Form, Modal, ModalHeader, ModalBody, ModalFooter, Button, Pagination, PaginationItem, PaginationLink, FormGroup, Input, Label } from 'reactstrap';
4
+ import { Row, Col, Form, Modal, ModalHeader, ModalBody, ModalFooter, Button, Pagination, PaginationItem, PaginationLink, FormGroup, Input, Label, Tooltip } from 'reactstrap';
5
5
  import GoogleLogin, { useGoogleLogout } from '@leecheuk/react-google-login';
6
6
  import axios from 'axios';
7
7
  import moment from 'moment';
@@ -10,7 +10,7 @@ import { useDispatch, useSelector } from 'react-redux';
10
10
  import { gapi } from 'gapi-script';
11
11
  import { Box, Typography } from '@mui/material';
12
12
  export { ToastContainer, toast } from 'react-toastify';
13
- import Select, { components } from 'react-select';
13
+ import ReactSelect, { components } from 'react-select';
14
14
  import { FaCaretDown } from 'react-icons/fa';
15
15
  import CreatableSelect from 'react-select/creatable';
16
16
 
@@ -71,7 +71,8 @@ var COLORS = {
71
71
  darkBrandBlue: "#025675",
72
72
  darkBrandBlueHover: "#007a99",
73
73
  brandAccent: "#ffce09",
74
- red: "#ce3636"
74
+ red: "#ce3636",
75
+ lightYellow: "#fff5ce"
75
76
  };
76
77
 
77
78
  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","pr-30":"_2HB5r"};
@@ -1225,7 +1226,7 @@ var CoreSelect = function CoreSelect(props) {
1225
1226
  }
1226
1227
  }, label && React.createElement("span", {
1227
1228
  className: styles$3["label"]
1228
- }, label), React.createElement(Select, {
1229
+ }, label), React.createElement(ReactSelect, {
1229
1230
  name: name,
1230
1231
  value: options.filter(function (i) {
1231
1232
  return value && (isMulti ? value.includes(i.value) : i.value === value);
@@ -1383,40 +1384,7 @@ var CoreRange = function CoreRange(props) {
1383
1384
  }));
1384
1385
  };
1385
1386
 
1386
- var styles$8 = {"core-text-area":"_1b_C3"};
1387
-
1388
- var CoreTextArea = function CoreTextArea(props) {
1389
- var name = props.name,
1390
- _onChange = props.onChange,
1391
- value = props.value,
1392
- _props$cols = props.cols,
1393
- cols = _props$cols === void 0 ? 0 : _props$cols,
1394
- label = props.label,
1395
- _props$rows = props.rows,
1396
- rows = _props$rows === void 0 ? 2 : _props$rows,
1397
- _props$placeholder = props.placeholder,
1398
- placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
1399
- width = props.width;
1400
- return React.createElement("div", {
1401
- className: styles$8["core-text-area"],
1402
- style: {
1403
- width: width != null ? width : "100%"
1404
- }
1405
- }, label && React.createElement("label", null, label), React.createElement("textarea", {
1406
- style: {
1407
- whiteSpace: "pre-wrap"
1408
- },
1409
- placeholder: placeholder,
1410
- value: value,
1411
- cols: cols,
1412
- rows: rows,
1413
- onChange: function onChange(e) {
1414
- return _onChange(name, e.target.value);
1415
- }
1416
- }));
1417
- };
1418
-
1419
- var styles$9 = {"core-search":"_wyI1K","input":"_9XW-D","clear":"_1nhXy"};
1387
+ var styles$8 = {"core-text-area":"_1b_C3","label":"_15n2K","optional":"_1fHZB","icon":"_38AfS"};
1420
1388
 
1421
1389
  var Search = function Search(props) {
1422
1390
  var _props$size = props.size,
@@ -1480,6 +1448,85 @@ var Close = function Close(props) {
1480
1448
  }))));
1481
1449
  };
1482
1450
 
1451
+ var Info = function Info() {
1452
+ return React.createElement("svg", {
1453
+ width: "12",
1454
+ height: "12",
1455
+ viewBox: "0 0 12 12",
1456
+ fill: "none",
1457
+ xmlns: "http://www.w3.org/2000/svg"
1458
+ }, React.createElement("path", {
1459
+ "fill-rule": "evenodd",
1460
+ "clip-rule": "evenodd",
1461
+ d: "M6.0002 2.1002C3.84628 2.1002 2.1002 3.84628 2.1002 6.0002C2.1002 8.15411 3.84628 9.9002 6.0002 9.9002C8.15411 9.9002 9.9002 8.15411 9.9002 6.0002C9.9002 3.84628 8.15411 2.1002 6.0002 2.1002ZM1.2002 6.0002C1.2002 3.34923 3.34923 1.2002 6.0002 1.2002C8.65116 1.2002 10.8002 3.34923 10.8002 6.0002C10.8002 8.65116 8.65116 10.8002 6.0002 10.8002C3.34923 10.8002 1.2002 8.65116 1.2002 6.0002Z",
1462
+ fill: "#A6A6AD"
1463
+ }), React.createElement("path", {
1464
+ "fill-rule": "evenodd",
1465
+ "clip-rule": "evenodd",
1466
+ d: "M5.9998 5.1001C6.24833 5.1001 6.4498 5.30157 6.4498 5.5501V8.2915C6.4498 8.54003 6.24833 8.7415 5.9998 8.7415C5.75128 8.7415 5.5498 8.54003 5.5498 8.2915V5.5501C5.5498 5.30157 5.75128 5.1001 5.9998 5.1001Z",
1467
+ fill: "#A6A6AD"
1468
+ }), React.createElement("path", {
1469
+ d: "M5.9999 4.6502C5.6687 4.6502 5.3999 4.3808 5.3999 4.0502C5.3999 3.7196 5.6687 3.4502 5.9999 3.4502C6.3311 3.4502 6.5999 3.7196 6.5999 4.0502C6.5999 4.3808 6.3311 4.6502 5.9999 4.6502Z",
1470
+ fill: "#A6A6AD"
1471
+ }));
1472
+ };
1473
+
1474
+ var CoreTextArea = function CoreTextArea(props) {
1475
+ var name = props.name,
1476
+ _onChange = props.onChange,
1477
+ value = props.value,
1478
+ _props$cols = props.cols,
1479
+ cols = _props$cols === void 0 ? 0 : _props$cols,
1480
+ label = props.label,
1481
+ _props$rows = props.rows,
1482
+ rows = _props$rows === void 0 ? 2 : _props$rows,
1483
+ _props$placeholder = props.placeholder,
1484
+ placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
1485
+ width = props.width,
1486
+ _props$tooltip = props.tooltip,
1487
+ tooltip = _props$tooltip === void 0 ? '' : _props$tooltip,
1488
+ _props$isOptional = props.isOptional,
1489
+ isOptional = _props$isOptional === void 0 ? false : _props$isOptional;
1490
+ var _useState = useState(false),
1491
+ isOpenTooltip = _useState[0],
1492
+ setIsOpenTooltip = _useState[1];
1493
+ var toggleTooltip = function toggleTooltip() {
1494
+ return setIsOpenTooltip(!isOpenTooltip);
1495
+ };
1496
+ return React.createElement("div", {
1497
+ className: styles$8["core-text-area"],
1498
+ style: {
1499
+ width: width != null ? width : "100%"
1500
+ }
1501
+ }, label && React.createElement("div", {
1502
+ className: styles$8['label']
1503
+ }, React.createElement("div", {
1504
+ className: styles$8['text']
1505
+ }, label), isOptional && React.createElement("div", {
1506
+ className: styles$8['optional']
1507
+ }, "(optional)"), React.createElement("div", {
1508
+ className: styles$8['icon'],
1509
+ id: name
1510
+ }, React.createElement(Info, null)), tooltip ? React.createElement(Tooltip, {
1511
+ target: name,
1512
+ isOpen: isOpenTooltip,
1513
+ toggle: toggleTooltip
1514
+ }, tooltip) : null), React.createElement("textarea", {
1515
+ style: {
1516
+ whiteSpace: "pre-wrap"
1517
+ },
1518
+ placeholder: placeholder,
1519
+ value: value,
1520
+ cols: cols,
1521
+ rows: rows,
1522
+ onChange: function onChange(e) {
1523
+ return _onChange(name, e.target.value);
1524
+ }
1525
+ }));
1526
+ };
1527
+
1528
+ var styles$9 = {"core-search":"_wyI1K","input":"_9XW-D","clear":"_1nhXy"};
1529
+
1483
1530
  var CoreSearch = function CoreSearch(props) {
1484
1531
  var _props$name = props.name,
1485
1532
  name = _props$name === void 0 ? "" : _props$name,
@@ -1510,6 +1557,258 @@ var CoreSearch = function CoreSearch(props) {
1510
1557
  }, React.createElement(Close, null)) : null);
1511
1558
  };
1512
1559
 
1560
+ var styles$a = {"core-select-compact":"_3ql5D","label":"_3fPQC"};
1561
+
1562
+ var Option$1 = function Option(props) {
1563
+ return React.createElement("div", null, React.createElement(components.Option, Object.assign({}, props), React.createElement(CoreInput$1, {
1564
+ checked: props.isSelected,
1565
+ onChange: function onChange() {
1566
+ return null;
1567
+ },
1568
+ name: "",
1569
+ label: props.label
1570
+ })));
1571
+ };
1572
+ var CoreSelectCompact = function CoreSelectCompact(props) {
1573
+ var _props$name = props.name,
1574
+ name = _props$name === void 0 ? "" : _props$name,
1575
+ options = props.options,
1576
+ value = props.value,
1577
+ onChange = props.onChange,
1578
+ _props$disabled = props.disabled,
1579
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
1580
+ label = props.label,
1581
+ width = props.width,
1582
+ _props$placeholder = props.placeholder,
1583
+ placeholder = _props$placeholder === void 0 ? "Select" : _props$placeholder,
1584
+ _props$isMulti = props.isMulti,
1585
+ isMulti = _props$isMulti === void 0 ? false : _props$isMulti,
1586
+ _props$isShowDropdown = props.isShowDropdown,
1587
+ isShowDropdown = _props$isShowDropdown === void 0 ? false : _props$isShowDropdown,
1588
+ _props$error = props.error,
1589
+ error = _props$error === void 0 ? false : _props$error;
1590
+ var handleChange = function handleChange(value) {
1591
+ var newValue = isMulti ? value === null || value === void 0 ? void 0 : value.map(function (item) {
1592
+ return item.value;
1593
+ }) : value === null || value === void 0 ? void 0 : value.value;
1594
+ onChange(name, newValue);
1595
+ };
1596
+ var controlStyle = function controlStyle(base, state) {
1597
+ var styles = _extends({}, base, {
1598
+ fontSize: "14px",
1599
+ fontWeight: "400",
1600
+ padding: "0",
1601
+ backgroundColor: state.isDisabled ? "transparent" : error ? COLORS.lightYellow : COLORS.white,
1602
+ border: "none",
1603
+ height: isMulti ? undefined : "26px",
1604
+ minHeight: "26px",
1605
+ boxShadow: "none",
1606
+ cursor: "pointer",
1607
+ "&:hover": {
1608
+ backgroundColor: COLORS.lightBlueHover
1609
+ },
1610
+ "&>div": {
1611
+ padding: "0 2px"
1612
+ }
1613
+ });
1614
+ return styles;
1615
+ };
1616
+ var inputStyles = function inputStyles(base) {
1617
+ var styles = _extends({}, base, {
1618
+ margin: "0",
1619
+ padding: "0",
1620
+ color: "inherit",
1621
+ position: "relative",
1622
+ top: "-2px"
1623
+ });
1624
+ return styles;
1625
+ };
1626
+ var placeholderStyles = function placeholderStyles(base) {
1627
+ var styles = _extends({}, base, {
1628
+ color: COLORS.lightGray
1629
+ });
1630
+ return styles;
1631
+ };
1632
+ var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
1633
+ var styles = _extends({}, base, {
1634
+ position: "relative",
1635
+ padding: "2px 0"
1636
+ });
1637
+ return styles;
1638
+ };
1639
+ var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
1640
+ var styles = _extends({}, base, {
1641
+ display: isShowDropdown && !isMulti ? "block" : "none"
1642
+ });
1643
+ return styles;
1644
+ };
1645
+ var valueContainerStyles = function valueContainerStyles(base) {
1646
+ var styles = _extends({}, base, {
1647
+ height: isMulti ? undefined : "26px",
1648
+ position: "relative"
1649
+ });
1650
+ return styles;
1651
+ };
1652
+ var singleValueStyles = function singleValueStyles(base) {
1653
+ var styles = _extends({}, base);
1654
+ return styles;
1655
+ };
1656
+ var optionStyles = function optionStyles(base, state) {
1657
+ var styles = _extends({}, base, {
1658
+ padding: "8px",
1659
+ borderRadius: "8px",
1660
+ cursor: "pointer",
1661
+ fontSize: "14px",
1662
+ fontWeight: 400,
1663
+ color: COLORS.blackText,
1664
+ backgroundColor: state.isSelected ? COLORS.lightBlueHover : "transparent",
1665
+ "&:hover": {
1666
+ backgroundColor: COLORS.lightBlueHover
1667
+ }
1668
+ });
1669
+ return styles;
1670
+ };
1671
+ var multiValueStyles = function multiValueStyles(base) {
1672
+ var styles = _extends({}, base, {
1673
+ backgroundColor: COLORS.lightBlue,
1674
+ borderRadius: "4px",
1675
+ padding: "0 4px",
1676
+ display: "flex",
1677
+ alignItems: "center",
1678
+ fontSize: "13px",
1679
+ color: COLORS.blackText
1680
+ });
1681
+ return styles;
1682
+ };
1683
+ var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
1684
+ var styles = _extends({}, base, {
1685
+ color: COLORS.lightGray,
1686
+ cursor: "pointer"
1687
+ });
1688
+ return styles;
1689
+ };
1690
+ var multiValueLabelStyles = function multiValueLabelStyles(base) {
1691
+ var styles = _extends({}, base, {
1692
+ color: COLORS.blackText,
1693
+ fontWeight: "400",
1694
+ fontSize: "13px",
1695
+ padding: 0
1696
+ });
1697
+ return styles;
1698
+ };
1699
+ return React.createElement("div", {
1700
+ className: "" + styles$a["core-select-compact"],
1701
+ style: {
1702
+ width: width != null ? width : "100%"
1703
+ }
1704
+ }, label && React.createElement("div", {
1705
+ className: styles$a["label"]
1706
+ }, React.createElement("label", null, label), React.createElement(Info, null)), React.createElement(ReactSelect, {
1707
+ name: name,
1708
+ value: options.filter(function (i) {
1709
+ return value && (isMulti ? value.includes(i.value) : i.value === value);
1710
+ }),
1711
+ onChange: handleChange,
1712
+ placeholder: placeholder,
1713
+ isDisabled: disabled,
1714
+ isMulti: isMulti,
1715
+ closeMenuOnSelect: !isMulti,
1716
+ hideSelectedOptions: false,
1717
+ options: options,
1718
+ components: isMulti ? {
1719
+ Option: Option$1
1720
+ } : undefined,
1721
+ styles: {
1722
+ control: controlStyle,
1723
+ input: inputStyles,
1724
+ placeholder: placeholderStyles,
1725
+ dropdownIndicator: dropdownIndicatorStyles,
1726
+ indicatorSeparator: function indicatorSeparator() {
1727
+ return {
1728
+ display: "none"
1729
+ };
1730
+ },
1731
+ indicatorsContainer: indicatorsContainerStyles,
1732
+ valueContainer: valueContainerStyles,
1733
+ singleValue: singleValueStyles,
1734
+ option: optionStyles,
1735
+ multiValue: multiValueStyles,
1736
+ multiValueRemove: multiValueRemoveStyles,
1737
+ multiValueLabel: multiValueLabelStyles
1738
+ }
1739
+ }));
1740
+ };
1741
+
1742
+ var styles$b = {"core-input-compact":"_1qmXW","label":"_1argp"};
1743
+
1744
+ var CoreInputCompact = function CoreInputCompact(props) {
1745
+ var _props$name = props.name,
1746
+ name = _props$name === void 0 ? "" : _props$name,
1747
+ value = props.value,
1748
+ _onChange = props.onChange,
1749
+ _props$disabled = props.disabled,
1750
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
1751
+ label = props.label,
1752
+ width = props.width,
1753
+ _props$placeholder = props.placeholder,
1754
+ placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
1755
+ error = props.error;
1756
+ return React.createElement("div", {
1757
+ className: "" + styles$b["core-input-compact"],
1758
+ style: {
1759
+ width: width != null ? width : "100%"
1760
+ }
1761
+ }, label && React.createElement("div", {
1762
+ className: styles$b["label"]
1763
+ }, React.createElement("label", null, label), React.createElement(Info, null)), React.createElement("input", {
1764
+ style: {
1765
+ backgroundColor: error ? COLORS.lightYellow : "transparent"
1766
+ },
1767
+ name: name,
1768
+ value: value,
1769
+ onChange: function onChange(e) {
1770
+ return _onChange(name, e.target.value);
1771
+ },
1772
+ disabled: disabled,
1773
+ placeholder: placeholder
1774
+ }));
1775
+ };
1776
+
1777
+ var styles$c = {"core-label-input":"_2YqZu","size-h1":"_23-uu","size-h2":"_16lQL"};
1778
+
1779
+ var CoreTitleInput = function CoreTitleInput(props) {
1780
+ var _props$name = props.name,
1781
+ name = _props$name === void 0 ? "" : _props$name,
1782
+ value = props.value,
1783
+ _onChange = props.onChange,
1784
+ _props$disabled = props.disabled,
1785
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
1786
+ width = props.width,
1787
+ _props$placeholder = props.placeholder,
1788
+ placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
1789
+ error = props.error,
1790
+ _props$size = props.size,
1791
+ size = _props$size === void 0 ? "h1" : _props$size;
1792
+ return React.createElement("div", {
1793
+ className: "" + styles$c["core-label-input"],
1794
+ style: {
1795
+ width: width != null ? width : "100%"
1796
+ }
1797
+ }, React.createElement("input", {
1798
+ className: "" + styles$c["size-" + size],
1799
+ style: {
1800
+ backgroundColor: error ? COLORS.lightYellow : "transparent"
1801
+ },
1802
+ name: name,
1803
+ value: value,
1804
+ onChange: function onChange(e) {
1805
+ return _onChange(name, e.target.value);
1806
+ },
1807
+ disabled: disabled,
1808
+ placeholder: placeholder
1809
+ }));
1810
+ };
1811
+
1513
1812
  var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
1514
1813
  var _error$response, _error$response$data, _error$response2, _error$response3, _error$response3$data;
1515
1814
  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;
@@ -1591,7 +1890,7 @@ var CustomSelect = function CustomSelect(_ref) {
1591
1890
  }) : options === null || options === void 0 ? void 0 : options.find(function (i) {
1592
1891
  return i.value == value;
1593
1892
  });
1594
- return React.createElement(Select, Object.assign({
1893
+ return React.createElement(ReactSelect, Object.assign({
1595
1894
  isDisabled: isDisabled,
1596
1895
  options: options,
1597
1896
  value: !isDefault ? initialValues != null ? initialValues : null : undefined,
@@ -1626,7 +1925,7 @@ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1626
1925
  }) : options.find(function (i) {
1627
1926
  return i.value == value;
1628
1927
  });
1629
- return React.createElement(Select, Object.assign({
1928
+ return React.createElement(ReactSelect, Object.assign({
1630
1929
  isDisabled: isDisabled,
1631
1930
  options: options,
1632
1931
  value: !isDefault ? initialValues : undefined,
@@ -1691,7 +1990,7 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
1691
1990
  var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? options.find(function (option) {
1692
1991
  return option.value === defaultValue;
1693
1992
  }) || null : null;
1694
- return React.createElement(Select, Object.assign({
1993
+ return React.createElement(ReactSelect, Object.assign({
1695
1994
  isDisabled: isDisabled,
1696
1995
  options: options,
1697
1996
  value: value,
@@ -1712,5 +2011,5 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
1712
2011
 
1713
2012
  var historyCore = createBrowserHistory();
1714
2013
 
1715
- export { ACCESS_TOKEN, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreTextArea, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, NotFound, Role, api$1 as api, apiUpload$1 as apiUpload, getErrorMessage, historyCore, setAlert, setLoading, setMenuCollapse, setUser, store, useGoogleSignOut };
2014
+ export { ACCESS_TOKEN, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, NotFound, Role, api$1 as api, apiUpload$1 as apiUpload, getErrorMessage, historyCore, setAlert, setLoading, setMenuCollapse, setUser, store, useGoogleSignOut };
1716
2015
  //# sourceMappingURL=index.modern.js.map