@loja-integrada/admin-components 0.9.5 → 0.9.9

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.
@@ -342,6 +342,14 @@ var InfoCircle = function InfoCircle() {
342
342
  });
343
343
  };
344
344
 
345
+ var Link = function Link() {
346
+ return React.createElement("path", {
347
+ fillRule: "evenodd",
348
+ clipRule: "evenodd",
349
+ d: "M10.5645 7.44624c-.301-.301-.78701-.301-1.08701 0-.301.301-.301.787 0 1.088l.74501.747c.34.34.526.79196.526 1.27096-.001.482-.189.933-.53 1.271l-3.82701 3.811c-1.106 1.103-2.91 1.102-4.016 0-.54-.539-.838-1.256-.838-2.02 0-.765.298-1.482.838-2.022l2.038-2.03096c.3-.3.302-.786.002-1.088-.299-.301-.786-.301-1.087-.002l-2.038 2.03196c-.833.83-1.29 1.933-1.29 3.111 0 1.177.457 2.281 1.29 3.112.854.849 1.973 1.274 3.093 1.274 1.12-.001 2.24-.425 3.093-1.273l3.82701-3.812c.632-.63.982-1.468.983-2.361.001-.89096-.346-1.72996-.977-2.36196l-.745-.746Zm6.154.057-2.31 2.314c-.301.30096-.787.30096-1.088 0-.3-.301-.3-.788 0-1.089l2.311-2.313c1.111-1.112 1.111-2.922 0-4.033-1.121-1.122-2.926-1.122-4.038-.01l-3.83001 3.835c-.7.701-.7 1.84 0 2.54l.75.752c.301.3.301.78696 0 1.08796-.149.15-.345.225-.543.225-.197 0-.393-.075-.544-.225l-.75-.75196c-1.299-1.3-1.299-3.416 0-4.716l3.83001-3.835c1.71-1.712 4.493-1.712 6.203 0 1.719 1.722 1.719 4.508.009 6.219Z"
350
+ });
351
+ };
352
+
345
353
  var Loading = function Loading() {
346
354
  return React.createElement("path", {
347
355
  fillRule: "evenodd",
@@ -519,6 +527,7 @@ var icons = {
519
527
  plusCircle: PlusCircle,
520
528
  print: Print,
521
529
  infoCircle: InfoCircle,
530
+ link: Link,
522
531
  loading: Loading,
523
532
  pix: Pix,
524
533
  search: Search,
@@ -573,7 +582,8 @@ var listOfStylesHover = {
573
582
  info: "hover:bg-secondary-bold",
574
583
  warning: "hover:bg-warning-dark",
575
584
  danger: "hover:bg-danger-dark",
576
- outline: "hover:bg-primary-light"
585
+ outline: "hover:bg-primary-light",
586
+ onlyText: "hover:bg-base-2"
577
587
  };
578
588
  var listOfStylesActive = {
579
589
  primary: "active:bg-primary-bold",
@@ -581,13 +591,15 @@ var listOfStylesActive = {
581
591
  tertiary: "active:bg-tertiary-bold",
582
592
  warning: "active:bg-warning-bold",
583
593
  danger: "hover:bg-danger-bold",
584
- outline: "active:shadow-inner active:bg-base-1"
594
+ outline: "active:shadow-inner active:bg-base-1",
595
+ onlyText: "active:bg-base-1"
585
596
  };
586
597
  var listOfStylesFocus = {
587
598
  primary: "focus:ring-1 focus:ring-primary-dark focus:ring-opacity-50",
588
599
  secondary: "focus:ring focus:ring-focus",
589
600
  danger: "focus:ring-1 focus:ring-danger-dark",
590
- outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1"
601
+ outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1",
602
+ onlyText: "focus:bg-base-1"
591
603
  };
592
604
  var listOfStyles = {
593
605
  primary: "bg-primary text-base-1 " + listOfStylesHover['primary'] + " " + listOfStylesActive['primary'] + " " + listOfStylesFocus['primary'],
@@ -596,7 +608,8 @@ var listOfStyles = {
596
608
  info: "bg-secondary-dark text-base-1 " + listOfStylesHover['info'],
597
609
  warning: "bg-warning text-on-base " + listOfStylesHover['warning'] + " " + listOfStylesActive['warning'],
598
610
  danger: "bg-danger text-base-1 " + listOfStylesHover['danger'] + " " + listOfStylesActive['danger'] + " " + listOfStylesFocus['danger'],
599
- outline: "bg-transparent text-inverted-2 border border-inverted-2 " + listOfStylesHover['outline'] + " " + listOfStylesActive['outline'] + " " + listOfStylesFocus['outline']
611
+ outline: "bg-transparent text-inverted-2 border border-inverted-2 " + listOfStylesHover['outline'] + " " + listOfStylesActive['outline'] + " " + listOfStylesFocus['outline'],
612
+ onlyText: "bg-transparent border-transparent text-inverted-2 px-0 " + listOfStylesHover['onlyText'] + " " + listOfStylesActive['onlyText'] + " " + listOfStylesFocus['onlyText']
600
613
  };
601
614
  var defaultDisabledStyle = "bg-base-3 cursor-default text-on-base-2 shadow-none ring-0 border-0 hover:bg-base-3 hover:text-on-base-2 ";
602
615
  var listOfStylesDisabled = {
@@ -606,7 +619,8 @@ var listOfStylesDisabled = {
606
619
  info: defaultDisabledStyle,
607
620
  warning: defaultDisabledStyle,
608
621
  danger: defaultDisabledStyle,
609
- outline: defaultDisabledStyle
622
+ outline: defaultDisabledStyle,
623
+ onlyText: "bg-transparent text-on-base-3 shadow-none ring-0 border-0"
610
624
  };
611
625
  var listOfSizes = {
612
626
  small: "text-f7 h-8",
@@ -1581,16 +1595,23 @@ var DropdownWithFowardRef = /*#__PURE__*/React.forwardRef(DropdownComponent);
1581
1595
  var Dropdown = /*#__PURE__*/React.memo(DropdownWithFowardRef);
1582
1596
 
1583
1597
  var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1584
- var label = _ref.label,
1598
+ var _ref$className = _ref.className,
1599
+ className = _ref$className === void 0 ? '' : _ref$className,
1600
+ label = _ref.label,
1585
1601
  id = _ref.id,
1586
1602
  name = _ref.name,
1587
1603
  onChange = _ref.onChange,
1588
1604
  checked = _ref.checked,
1589
1605
  disabled = _ref.disabled,
1590
- indeterminate = _ref.indeterminate,
1606
+ _ref$indeterminate = _ref.indeterminate,
1607
+ indeterminate = _ref$indeterminate === void 0 ? false : _ref$indeterminate,
1591
1608
  _ref$boxAlign = _ref.boxAlign,
1592
1609
  boxAlign = _ref$boxAlign === void 0 ? 'center' : _ref$boxAlign,
1593
- props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign"]);
1610
+ helpText = _ref.helpText,
1611
+ _ref$hasError = _ref.hasError,
1612
+ hasError = _ref$hasError === void 0 ? false : _ref$hasError,
1613
+ errorMessage = _ref.errorMessage,
1614
+ props = _objectWithoutPropertiesLoose(_ref, ["className", "label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign", "helpText", "hasError", "errorMessage"]);
1594
1615
 
1595
1616
  var inputRef = React.useRef(null);
1596
1617
  var inputId = id || name;
@@ -1604,6 +1625,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1604
1625
  setIsIndeterminate = _React$useState2[1];
1605
1626
 
1606
1627
  var isCenterBoxAlign = boxAlign === 'center';
1628
+ var hasErrorState = hasError || !!errorMessage;
1607
1629
  React.useEffect(function () {
1608
1630
  setIsChecked(!!checked);
1609
1631
  if (checked) setIsIndeterminate(false);
@@ -1623,10 +1645,24 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1623
1645
 
1624
1646
  var checkboxIconClasses = "transition duration-200 ease-in-out " + (isChecked || isIndeterminate ? 'scale-100' : 'scale-0');
1625
1647
  var checkboxIconContainerClasses = "border border-card-stroke transition duration-200 ease-in-out\n " + (disabled ? 'bg-base-4' : isChecked || isIndeterminate ? 'bg-primary border-primary' : 'bg-base-1') + "\n " + (isCenterBoxAlign ? 'items-center' : '') + "\n rounded w-4 h-4 flex justify-center m-px\n ";
1626
- var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (disabled ? 'text-inverted-2' : '');
1627
- return React.createElement("label", {
1648
+ var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (hasErrorState ? 'text-danger' : disabled ? 'text-inverted-2' : '');
1649
+ var alignOptions = {
1650
+ start: 'items-start',
1651
+ end: 'items-end',
1652
+ center: 'items-center',
1653
+ baseline: 'items-baseline',
1654
+ stretch: 'items-stretch'
1655
+ };
1656
+ var HelpTextComponent = React.createElement(InputHelpText, {
1657
+ helpText: errorMessage || helpText,
1658
+ hasError: hasErrorState,
1659
+ className: "mt-2"
1660
+ });
1661
+ return React.createElement("div", {
1662
+ className: "inline-block " + className
1663
+ }, React.createElement("label", {
1628
1664
  htmlFor: inputId,
1629
- className: "inline-flex items-" + boxAlign + " cursor-pointer"
1665
+ className: "inline-flex " + alignOptions[boxAlign] + " cursor-pointer"
1630
1666
  }, React.createElement("span", {
1631
1667
  className: "rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1632
1668
  }, React.createElement("input", Object.assign({
@@ -1658,7 +1694,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1658
1694
  fill: "white"
1659
1695
  })))), React.createElement("span", {
1660
1696
  className: checkboxLabelClasses
1661
- }, label));
1697
+ }, label)), HelpTextComponent);
1662
1698
  };
1663
1699
 
1664
1700
  var CheckboxWithFowardRef = /*#__PURE__*/React.forwardRef(CheckboxComponent);
@@ -1697,7 +1733,8 @@ var TableComponent = function TableComponent(_ref2) {
1697
1733
  onChange = _ref2.onChange,
1698
1734
  selectedData = _ref2.selectedData,
1699
1735
  _ref2$disabledRows = _ref2.disabledRows,
1700
- disabledRows = _ref2$disabledRows === void 0 ? [] : _ref2$disabledRows;
1736
+ disabledRows = _ref2$disabledRows === void 0 ? [] : _ref2$disabledRows,
1737
+ id = _ref2.id;
1701
1738
  var rowsPropsMemoized = React.useMemo(function () {
1702
1739
  return rowsProps;
1703
1740
  }, [rowsProps]);
@@ -1800,9 +1837,13 @@ var TableComponent = function TableComponent(_ref2) {
1800
1837
  var columnsLength = React.useMemo(function () {
1801
1838
  return selectable ? columns.length + 1 : columns.length;
1802
1839
  }, [columns, selectable]);
1840
+ var tableId = React.useMemo(function () {
1841
+ return id ? "" + id.charAt(0).toUpperCase() + id.slice(1) : '';
1842
+ }, [id]);
1803
1843
  return React.createElement("div", {
1804
1844
  className: "max-w-full overflow-x-auto"
1805
1845
  }, React.createElement("table", Object.assign({}, getTableProps(), {
1846
+ id: id,
1806
1847
  className: "w-full bg-base-1 rounded border-separate border border-card-stroke",
1807
1848
  cellSpacing: "0"
1808
1849
  }), React.createElement("thead", {
@@ -1825,7 +1866,8 @@ var TableComponent = function TableComponent(_ref2) {
1825
1866
  },
1826
1867
  checked: isHeaderSelectChecked,
1827
1868
  indeterminate: isHeaderSelectedIndeterminate,
1828
- disabled: isHeaderSelectDisabled
1869
+ disabled: isHeaderSelectDisabled,
1870
+ id: "checkboxSelectAllRows" + tableId
1829
1871
  })), headerGroup.headers.map(function (column) {
1830
1872
  var _column$getHeaderProp = column.getHeaderProps(),
1831
1873
  key = _column$getHeaderProp.key,
@@ -1841,7 +1883,7 @@ var TableComponent = function TableComponent(_ref2) {
1841
1883
  }));
1842
1884
  })), React.createElement("tbody", Object.assign({}, getTableBodyProps(), {
1843
1885
  className: "text-sm text-on-base"
1844
- }), isLoading ? React.createElement("tr", null, Array(columnsLength).fill(0).map(function (key) {
1886
+ }), isLoading ? React.createElement("tr", null, Array(columnsLength).fill(0).map(function (_, key) {
1845
1887
  return React.createElement("td", {
1846
1888
  key: key,
1847
1889
  className: "" + TdClasses
@@ -1871,7 +1913,8 @@ var TableComponent = function TableComponent(_ref2) {
1871
1913
  return handleSelectRow(index, e);
1872
1914
  },
1873
1915
  checked: isRowChecked,
1874
- disabled: isRowDisabled
1916
+ disabled: isRowDisabled,
1917
+ id: "checkboxRow" + index + tableId
1875
1918
  })), row.cells.map(function (cell) {
1876
1919
  var _cell$getCellProps = cell.getCellProps(),
1877
1920
  key = _cell$getCellProps.key,
@@ -1898,20 +1941,24 @@ var activeStyles = function activeStyles(active) {
1898
1941
 
1899
1942
 
1900
1943
  var boldFixStyle = "before:content-[attr(data-title)] before:block before:font-semibold before:h-0 before:overflow-hidden before:visibility-hidden";
1944
+ var disabledStyle = 'text-inverted-2 cursor-not-allowed';
1901
1945
  var TabsItem = function TabsItem(_ref) {
1902
1946
  var id = _ref.id,
1903
1947
  title = _ref.title,
1904
1948
  _ref$active = _ref.active,
1905
1949
  active = _ref$active === void 0 ? false : _ref$active,
1950
+ _ref$disabled = _ref.disabled,
1951
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1906
1952
  onChange = _ref.onChange;
1907
1953
  return React.createElement("button", {
1908
1954
  id: "btnTab" + id,
1909
- className: "tabs-item " + (active ? 'tabs-item-active' : '') + " group min-w-0 flex-shrink-0 overflow-x-hidden px-2 last:-mr-2 first:-ml-2",
1955
+ className: "tabs-item " + (active ? 'tabs-item-active' : '') + " group min-w-0 flex-shrink-0 overflow-x-hidden px-2 last:-mr-2 first:-ml-2 " + (disabled ? disabledStyle : ''),
1910
1956
  onClick: function onClick() {
1911
1957
  return onChange(id);
1912
- }
1958
+ },
1959
+ disabled: disabled
1913
1960
  }, React.createElement("span", {
1914
- className: "block text-f6 tracking-4 text-sm py-4 border-b-4 break-words group-hover:font-semibold " + activeStyles(active) + " " + boldFixStyle,
1961
+ className: "block tracking-4 text-f6 text-sm py-4 border-b-4 break-words " + (disabled ? '' : 'group-hover:font-semibold') + " " + activeStyles(active) + " " + boldFixStyle,
1915
1962
  "data-title": title
1916
1963
  }, title));
1917
1964
  };
@@ -2102,6 +2149,8 @@ var ModalComponent = function ModalComponent(_ref) {
2102
2149
  }, React.createElement("span", {
2103
2150
  className: "min-w-0 text-inverted-2 text-xs font-semibold uppercase break-words " + (headerTitle ? 'pb-3' : '')
2104
2151
  }, headerTitle), React.createElement("button", {
2152
+ type: "button",
2153
+ id: "btnCloseModal",
2105
2154
  className: (preventClose ? 'hidden' : 'flex') + " items-center p-2 pb-1 -mr-2 -mt-3 text-sm font-semibold text-inverted-2 hover:text-inverted-1",
2106
2155
  onClick: handleRequestCloseFunc
2107
2156
  }, headerClose !== false && React.createElement("span", {