@loja-integrada/admin-components 0.9.3 → 0.9.7

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.
@@ -573,7 +573,8 @@ var listOfStylesHover = {
573
573
  info: "hover:bg-secondary-bold",
574
574
  warning: "hover:bg-warning-dark",
575
575
  danger: "hover:bg-danger-dark",
576
- outline: "hover:bg-primary-light"
576
+ outline: "hover:bg-primary-light",
577
+ onlyText: "hover:bg-base-2"
577
578
  };
578
579
  var listOfStylesActive = {
579
580
  primary: "active:bg-primary-bold",
@@ -581,13 +582,15 @@ var listOfStylesActive = {
581
582
  tertiary: "active:bg-tertiary-bold",
582
583
  warning: "active:bg-warning-bold",
583
584
  danger: "hover:bg-danger-bold",
584
- outline: "active:shadow-inner active:bg-base-1"
585
+ outline: "active:shadow-inner active:bg-base-1",
586
+ onlyText: "active:bg-base-1"
585
587
  };
586
588
  var listOfStylesFocus = {
587
589
  primary: "focus:ring-1 focus:ring-primary-dark focus:ring-opacity-50",
588
590
  secondary: "focus:ring focus:ring-focus",
589
591
  danger: "focus:ring-1 focus:ring-danger-dark",
590
- outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1"
592
+ outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1",
593
+ onlyText: "focus:bg-base-1"
591
594
  };
592
595
  var listOfStyles = {
593
596
  primary: "bg-primary text-base-1 " + listOfStylesHover['primary'] + " " + listOfStylesActive['primary'] + " " + listOfStylesFocus['primary'],
@@ -596,7 +599,8 @@ var listOfStyles = {
596
599
  info: "bg-secondary-dark text-base-1 " + listOfStylesHover['info'],
597
600
  warning: "bg-warning text-on-base " + listOfStylesHover['warning'] + " " + listOfStylesActive['warning'],
598
601
  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']
602
+ outline: "bg-transparent text-inverted-2 border border-inverted-2 " + listOfStylesHover['outline'] + " " + listOfStylesActive['outline'] + " " + listOfStylesFocus['outline'],
603
+ onlyText: "bg-transparent border-transparent text-inverted-2 px-0 " + listOfStylesHover['onlyText'] + " " + listOfStylesActive['onlyText'] + " " + listOfStylesFocus['onlyText']
600
604
  };
601
605
  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
606
  var listOfStylesDisabled = {
@@ -606,7 +610,8 @@ var listOfStylesDisabled = {
606
610
  info: defaultDisabledStyle,
607
611
  warning: defaultDisabledStyle,
608
612
  danger: defaultDisabledStyle,
609
- outline: defaultDisabledStyle
613
+ outline: defaultDisabledStyle,
614
+ onlyText: "bg-transparent text-on-base-3 shadow-none ring-0 border-0"
610
615
  };
611
616
  var listOfSizes = {
612
617
  small: "text-f7 h-8",
@@ -679,7 +684,7 @@ var LoadingPlaceholderComponent = function LoadingPlaceholderComponent(_ref) {
679
684
  return React.createElement("div", {
680
685
  className: "animate-pulse flex " + className
681
686
  }, React.createElement("div", {
682
- className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-80 max-w-full"
687
+ className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-full max-w-full"
683
688
  }));
684
689
  };
685
690
 
@@ -1588,7 +1593,9 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1588
1593
  checked = _ref.checked,
1589
1594
  disabled = _ref.disabled,
1590
1595
  indeterminate = _ref.indeterminate,
1591
- props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate"]);
1596
+ _ref$boxAlign = _ref.boxAlign,
1597
+ boxAlign = _ref$boxAlign === void 0 ? 'center' : _ref$boxAlign,
1598
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign"]);
1592
1599
 
1593
1600
  var inputRef = React.useRef(null);
1594
1601
  var inputId = id || name;
@@ -1601,6 +1608,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1601
1608
  isIndeterminate = _React$useState2[0],
1602
1609
  setIsIndeterminate = _React$useState2[1];
1603
1610
 
1611
+ var isCenterBoxAlign = boxAlign === 'center';
1604
1612
  React.useEffect(function () {
1605
1613
  setIsChecked(!!checked);
1606
1614
  if (checked) setIsIndeterminate(false);
@@ -1619,11 +1627,18 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1619
1627
  };
1620
1628
 
1621
1629
  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";
1630
+ 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
1631
  var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (disabled ? 'text-inverted-2' : '');
1632
+ var alignOptions = {
1633
+ start: 'items-start',
1634
+ end: 'items-end',
1635
+ center: 'items-center',
1636
+ baseline: 'items-baseline',
1637
+ stretch: 'items-stretch'
1638
+ };
1624
1639
  return React.createElement("label", {
1625
1640
  htmlFor: inputId,
1626
- className: "inline-flex items-center cursor-pointer"
1641
+ className: "inline-flex " + alignOptions[boxAlign] + " cursor-pointer"
1627
1642
  }, React.createElement("span", {
1628
1643
  className: "rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1629
1644
  }, React.createElement("input", Object.assign({
@@ -1838,10 +1853,12 @@ var TableComponent = function TableComponent(_ref2) {
1838
1853
  }));
1839
1854
  })), React.createElement("tbody", Object.assign({}, getTableBodyProps(), {
1840
1855
  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", {
1856
+ }), isLoading ? React.createElement("tr", null, Array(columnsLength).fill(0).map(function (key) {
1857
+ return React.createElement("td", {
1858
+ key: key,
1859
+ className: "" + TdClasses
1860
+ }, React.createElement(TdWrapper, null, React.createElement(LoadingPlaceholder, null)));
1861
+ })) : !rows || !rows.length ? React.createElement("tr", null, React.createElement("td", {
1845
1862
  colSpan: columnsLength || 1,
1846
1863
  className: "" + TdClasses
1847
1864
  }, React.createElement(TdWrapper, null, React.createElement("div", {
@@ -1893,19 +1910,24 @@ var activeStyles = function activeStyles(active) {
1893
1910
 
1894
1911
 
1895
1912
  var boldFixStyle = "before:content-[attr(data-title)] before:block before:font-semibold before:h-0 before:overflow-hidden before:visibility-hidden";
1913
+ var disabledStyle = 'text-inverted-2 cursor-not-allowed';
1896
1914
  var TabsItem = function TabsItem(_ref) {
1897
1915
  var id = _ref.id,
1898
1916
  title = _ref.title,
1899
1917
  _ref$active = _ref.active,
1900
1918
  active = _ref$active === void 0 ? false : _ref$active,
1919
+ _ref$disabled = _ref.disabled,
1920
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1901
1921
  onChange = _ref.onChange;
1902
1922
  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",
1923
+ id: "btnTab" + id,
1924
+ 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
1925
  onClick: function onClick() {
1905
1926
  return onChange(id);
1906
- }
1927
+ },
1928
+ disabled: disabled
1907
1929
  }, React.createElement("span", {
1908
- className: "block text-f6 text-sm py-4 border-b-4 break-words group-hover:font-semibold " + activeStyles(active) + " " + boldFixStyle,
1930
+ className: "block tracking-4 text-f6 text-sm py-4 border-b-4 break-words " + (disabled ? '' : 'group-hover:font-semibold') + " " + activeStyles(active) + " " + boldFixStyle,
1909
1931
  "data-title": title
1910
1932
  }, title));
1911
1933
  };
@@ -2814,6 +2836,7 @@ var PaginationInfoComponent = function PaginationInfoComponent(_ref) {
2814
2836
  }, React.createElement("div", {
2815
2837
  className: "flex items-center mr-5 text-inverted-2 tracking-4 text-f6"
2816
2838
  }, itemsLengthOptions ? React.createElement(Select, {
2839
+ id: "selectItemsPerPage",
2817
2840
  options: itemsLengthOptions,
2818
2841
  withoutStyle: true,
2819
2842
  "aria-label": "Itens por p\xE1gina",
@@ -2883,6 +2906,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2883
2906
  }, React.createElement("div", {
2884
2907
  className: "text-inverted-2 text-f6 tracking-4"
2885
2908
  }, React.createElement("span", {
2909
+ id: "btnPaginationActualPage",
2886
2910
  className: "pagination-nav-current text-primary font-semibold",
2887
2911
  ref: inputEl,
2888
2912
  contentEditable: true,
@@ -2892,6 +2916,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2892
2916
  onCut: onPreventDefault,
2893
2917
  onPaste: onPreventDefault
2894
2918
  }, currentPage), ' ', "/", ' ', React.createElement("button", {
2919
+ id: "btnPaginationLastPage",
2895
2920
  className: "pagination-nav-total focus:outline-none",
2896
2921
  onClick: function onClick() {
2897
2922
  if (currentPage !== maxTotalPages) handleChange(maxTotalPages);
@@ -2899,7 +2924,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2899
2924
  }, maxTotalPages)), React.createElement("div", {
2900
2925
  className: "text-inverted-2 ml-5 flex items-center"
2901
2926
  }, React.createElement("button", {
2902
- className: "pagination-nav-previous mr-3 duration-200 focus:outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2927
+ id: "btnPaginationPrev",
2928
+ className: "pagination-nav-previous mr-3 duration-200 outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2903
2929
  "aria-label": "Ir para p\xE1gina anterior",
2904
2930
  onClick: function onClick() {
2905
2931
  if (hasPrev) handleChange(currentPage - 1);
@@ -2909,7 +2935,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2909
2935
  block: true,
2910
2936
  size: 4
2911
2937
  })), React.createElement("button", {
2912
- className: "pagination-nav-next duration-200 focus:outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2938
+ id: "btnPaginationNext",
2939
+ className: "pagination-nav-next duration-200 outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2913
2940
  "aria-label": "Ir para pr\xF3xima p\xE1gina",
2914
2941
  onClick: function onClick() {
2915
2942
  if (hasNext) handleChange(currentPage + 1);