@loja-integrada/admin-components 0.9.2 → 0.9.6

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.
@@ -679,7 +679,7 @@ var LoadingPlaceholderComponent = function LoadingPlaceholderComponent(_ref) {
679
679
  return React.createElement("div", {
680
680
  className: "animate-pulse flex " + className
681
681
  }, React.createElement("div", {
682
- className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-80 max-w-full"
682
+ className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-full max-w-full"
683
683
  }));
684
684
  };
685
685
 
@@ -1588,7 +1588,9 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1588
1588
  checked = _ref.checked,
1589
1589
  disabled = _ref.disabled,
1590
1590
  indeterminate = _ref.indeterminate,
1591
- props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate"]);
1591
+ _ref$boxAlign = _ref.boxAlign,
1592
+ boxAlign = _ref$boxAlign === void 0 ? 'center' : _ref$boxAlign,
1593
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign"]);
1592
1594
 
1593
1595
  var inputRef = React.useRef(null);
1594
1596
  var inputId = id || name;
@@ -1601,6 +1603,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1601
1603
  isIndeterminate = _React$useState2[0],
1602
1604
  setIsIndeterminate = _React$useState2[1];
1603
1605
 
1606
+ var isCenterBoxAlign = boxAlign === 'center';
1604
1607
  React.useEffect(function () {
1605
1608
  setIsChecked(!!checked);
1606
1609
  if (checked) setIsIndeterminate(false);
@@ -1619,11 +1622,11 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1619
1622
  };
1620
1623
 
1621
1624
  var checkboxIconClasses = "transition duration-200 ease-in-out " + (isChecked || isIndeterminate ? 'scale-100' : 'scale-0');
1622
- var checkboxIconContainerClasses = "border border-card-stroke transition duration-200 ease-in-out " + (disabled ? 'bg-base-4' : isChecked || isIndeterminate ? 'bg-primary border-primary' : 'bg-base-1') + " rounded w-4 h-4 flex justify-center items-center m-px";
1625
+ 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 ";
1623
1626
  var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (disabled ? 'text-inverted-2' : '');
1624
1627
  return React.createElement("label", {
1625
1628
  htmlFor: inputId,
1626
- className: "inline-flex items-center cursor-pointer"
1629
+ className: "inline-flex items-" + boxAlign + " cursor-pointer"
1627
1630
  }, React.createElement("span", {
1628
1631
  className: "rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1629
1632
  }, React.createElement("input", Object.assign({
@@ -1838,10 +1841,12 @@ var TableComponent = function TableComponent(_ref2) {
1838
1841
  }));
1839
1842
  })), React.createElement("tbody", Object.assign({}, getTableBodyProps(), {
1840
1843
  className: "text-sm text-on-base"
1841
- }), isLoading ? React.createElement("tr", null, React.createElement("td", {
1842
- colSpan: columnsLength || 1,
1843
- className: "" + TdClasses
1844
- }, React.createElement(TdWrapper, null, React.createElement(LoadingPlaceholder, null)))) : !rows || !rows.length ? React.createElement("tr", null, React.createElement("td", {
1844
+ }), isLoading ? React.createElement("tr", null, Array(columnsLength).fill(0).map(function (key) {
1845
+ return React.createElement("td", {
1846
+ key: key,
1847
+ className: "" + TdClasses
1848
+ }, React.createElement(TdWrapper, null, React.createElement(LoadingPlaceholder, null)));
1849
+ })) : !rows || !rows.length ? React.createElement("tr", null, React.createElement("td", {
1845
1850
  colSpan: columnsLength || 1,
1846
1851
  className: "" + TdClasses
1847
1852
  }, React.createElement(TdWrapper, null, React.createElement("div", {
@@ -1893,19 +1898,24 @@ var activeStyles = function activeStyles(active) {
1893
1898
 
1894
1899
 
1895
1900
  var boldFixStyle = "before:content-[attr(data-title)] before:block before:font-semibold before:h-0 before:overflow-hidden before:visibility-hidden";
1901
+ var disabledStyle = 'text-inverted-2 cursor-not-allowed';
1896
1902
  var TabsItem = function TabsItem(_ref) {
1897
1903
  var id = _ref.id,
1898
1904
  title = _ref.title,
1899
1905
  _ref$active = _ref.active,
1900
1906
  active = _ref$active === void 0 ? false : _ref$active,
1907
+ _ref$disabled = _ref.disabled,
1908
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1901
1909
  onChange = _ref.onChange;
1902
1910
  return React.createElement("button", {
1903
- 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",
1911
+ id: "btnTab" + id,
1912
+ 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 : ''),
1904
1913
  onClick: function onClick() {
1905
1914
  return onChange(id);
1906
- }
1915
+ },
1916
+ disabled: disabled
1907
1917
  }, React.createElement("span", {
1908
- className: "block text-f6 text-sm py-4 border-b-4 break-words group-hover:font-semibold " + activeStyles(active) + " " + boldFixStyle,
1918
+ className: "block tracking-4 text-f6 text-sm py-4 border-b-4 break-words " + (disabled ? '' : 'group-hover:font-semibold') + " " + activeStyles(active) + " " + boldFixStyle,
1909
1919
  "data-title": title
1910
1920
  }, title));
1911
1921
  };
@@ -2695,6 +2705,7 @@ var ActionBarComponent = function ActionBarComponent(_ref) {
2695
2705
  className: "lg:hidden"
2696
2706
  }, React.Children.map(children, function (_ref3) {
2697
2707
  var props = _ref3.props;
2708
+ if (!props.children) return;
2698
2709
  return React.createElement("button", {
2699
2710
  className: 'px-4 py-1 text-base-1' + (props != null && props.loading ? ' pointer-events-none' : ''),
2700
2711
  onClick: props == null ? void 0 : props.onClick
@@ -2813,6 +2824,7 @@ var PaginationInfoComponent = function PaginationInfoComponent(_ref) {
2813
2824
  }, React.createElement("div", {
2814
2825
  className: "flex items-center mr-5 text-inverted-2 tracking-4 text-f6"
2815
2826
  }, itemsLengthOptions ? React.createElement(Select, {
2827
+ id: "selectItemsPerPage",
2816
2828
  options: itemsLengthOptions,
2817
2829
  withoutStyle: true,
2818
2830
  "aria-label": "Itens por p\xE1gina",
@@ -2882,6 +2894,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2882
2894
  }, React.createElement("div", {
2883
2895
  className: "text-inverted-2 text-f6 tracking-4"
2884
2896
  }, React.createElement("span", {
2897
+ id: "btnPaginationActualPage",
2885
2898
  className: "pagination-nav-current text-primary font-semibold",
2886
2899
  ref: inputEl,
2887
2900
  contentEditable: true,
@@ -2891,6 +2904,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2891
2904
  onCut: onPreventDefault,
2892
2905
  onPaste: onPreventDefault
2893
2906
  }, currentPage), ' ', "/", ' ', React.createElement("button", {
2907
+ id: "btnPaginationLastPage",
2894
2908
  className: "pagination-nav-total focus:outline-none",
2895
2909
  onClick: function onClick() {
2896
2910
  if (currentPage !== maxTotalPages) handleChange(maxTotalPages);
@@ -2898,7 +2912,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2898
2912
  }, maxTotalPages)), React.createElement("div", {
2899
2913
  className: "text-inverted-2 ml-5 flex items-center"
2900
2914
  }, React.createElement("button", {
2901
- className: "pagination-nav-previous mr-3 duration-200 focus:outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2915
+ id: "btnPaginationPrev",
2916
+ className: "pagination-nav-previous mr-3 duration-200 outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2902
2917
  "aria-label": "Ir para p\xE1gina anterior",
2903
2918
  onClick: function onClick() {
2904
2919
  if (hasPrev) handleChange(currentPage - 1);
@@ -2908,7 +2923,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2908
2923
  block: true,
2909
2924
  size: 4
2910
2925
  })), React.createElement("button", {
2911
- className: "pagination-nav-next duration-200 focus:outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2926
+ id: "btnPaginationNext",
2927
+ className: "pagination-nav-next duration-200 outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2912
2928
  "aria-label": "Ir para pr\xF3xima p\xE1gina",
2913
2929
  onClick: function onClick() {
2914
2930
  if (hasNext) handleChange(currentPage + 1);