@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.
@@ -3,3 +3,4 @@ import { TabsProps } from './Tabs';
3
3
  declare const _default: Meta<import("@storybook/react").Args>;
4
4
  export default _default;
5
5
  export declare const Default: Story<TabsProps>;
6
+ export declare const WithTabDisabled: Story<TabsProps>;
@@ -10,5 +10,5 @@ interface TabsItemProps extends TabsItemInterface {
10
10
  */
11
11
  onChange: (arg0: string) => void;
12
12
  }
13
- export declare const TabsItem: ({ id, title, active, onChange, }: TabsItemProps) => JSX.Element;
13
+ export declare const TabsItem: ({ id, title, active, disabled, onChange, }: TabsItemProps) => JSX.Element;
14
14
  export {};
@@ -7,6 +7,10 @@ export interface TabsItemInterface {
7
7
  * Item visible title
8
8
  */
9
9
  title: string;
10
+ /**
11
+ * Disabled a specific tab
12
+ */
13
+ disabled?: boolean;
10
14
  /**
11
15
  * Item content
12
16
  * @deprecated Not implemented
@@ -3,4 +3,5 @@ export declare const Checkbox: React.MemoExoticComponent<React.ForwardRefExoticC
3
3
  export interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
4
4
  label?: string | React.ReactNode;
5
5
  indeterminate?: boolean;
6
+ boxAlign?: 'center' | 'baseline';
6
7
  }
@@ -687,7 +687,7 @@ var LoadingPlaceholderComponent = function LoadingPlaceholderComponent(_ref) {
687
687
  return React__default.createElement("div", {
688
688
  className: "animate-pulse flex " + className
689
689
  }, React__default.createElement("div", {
690
- className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-80 max-w-full"
690
+ className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-full max-w-full"
691
691
  }));
692
692
  };
693
693
 
@@ -1596,7 +1596,9 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1596
1596
  checked = _ref.checked,
1597
1597
  disabled = _ref.disabled,
1598
1598
  indeterminate = _ref.indeterminate,
1599
- props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate"]);
1599
+ _ref$boxAlign = _ref.boxAlign,
1600
+ boxAlign = _ref$boxAlign === void 0 ? 'center' : _ref$boxAlign,
1601
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign"]);
1600
1602
 
1601
1603
  var inputRef = React__default.useRef(null);
1602
1604
  var inputId = id || name;
@@ -1609,6 +1611,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1609
1611
  isIndeterminate = _React$useState2[0],
1610
1612
  setIsIndeterminate = _React$useState2[1];
1611
1613
 
1614
+ var isCenterBoxAlign = boxAlign === 'center';
1612
1615
  React__default.useEffect(function () {
1613
1616
  setIsChecked(!!checked);
1614
1617
  if (checked) setIsIndeterminate(false);
@@ -1627,11 +1630,11 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1627
1630
  };
1628
1631
 
1629
1632
  var checkboxIconClasses = "transition duration-200 ease-in-out " + (isChecked || isIndeterminate ? 'scale-100' : 'scale-0');
1630
- 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";
1633
+ 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 ";
1631
1634
  var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (disabled ? 'text-inverted-2' : '');
1632
1635
  return React__default.createElement("label", {
1633
1636
  htmlFor: inputId,
1634
- className: "inline-flex items-center cursor-pointer"
1637
+ className: "inline-flex items-" + boxAlign + " cursor-pointer"
1635
1638
  }, React__default.createElement("span", {
1636
1639
  className: "rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1637
1640
  }, React__default.createElement("input", Object.assign({
@@ -1846,10 +1849,12 @@ var TableComponent = function TableComponent(_ref2) {
1846
1849
  }));
1847
1850
  })), React__default.createElement("tbody", Object.assign({}, getTableBodyProps(), {
1848
1851
  className: "text-sm text-on-base"
1849
- }), isLoading ? React__default.createElement("tr", null, React__default.createElement("td", {
1850
- colSpan: columnsLength || 1,
1851
- className: "" + TdClasses
1852
- }, React__default.createElement(TdWrapper, null, React__default.createElement(LoadingPlaceholder, null)))) : !rows || !rows.length ? React__default.createElement("tr", null, React__default.createElement("td", {
1852
+ }), isLoading ? React__default.createElement("tr", null, Array(columnsLength).fill(0).map(function (key) {
1853
+ return React__default.createElement("td", {
1854
+ key: key,
1855
+ className: "" + TdClasses
1856
+ }, React__default.createElement(TdWrapper, null, React__default.createElement(LoadingPlaceholder, null)));
1857
+ })) : !rows || !rows.length ? React__default.createElement("tr", null, React__default.createElement("td", {
1853
1858
  colSpan: columnsLength || 1,
1854
1859
  className: "" + TdClasses
1855
1860
  }, React__default.createElement(TdWrapper, null, React__default.createElement("div", {
@@ -1901,19 +1906,24 @@ var activeStyles = function activeStyles(active) {
1901
1906
 
1902
1907
 
1903
1908
  var boldFixStyle = "before:content-[attr(data-title)] before:block before:font-semibold before:h-0 before:overflow-hidden before:visibility-hidden";
1909
+ var disabledStyle = 'text-inverted-2 cursor-not-allowed';
1904
1910
  var TabsItem = function TabsItem(_ref) {
1905
1911
  var id = _ref.id,
1906
1912
  title = _ref.title,
1907
1913
  _ref$active = _ref.active,
1908
1914
  active = _ref$active === void 0 ? false : _ref$active,
1915
+ _ref$disabled = _ref.disabled,
1916
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1909
1917
  onChange = _ref.onChange;
1910
1918
  return React__default.createElement("button", {
1911
- 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",
1919
+ id: "btnTab" + id,
1920
+ 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 : ''),
1912
1921
  onClick: function onClick() {
1913
1922
  return onChange(id);
1914
- }
1923
+ },
1924
+ disabled: disabled
1915
1925
  }, React__default.createElement("span", {
1916
- className: "block text-f6 text-sm py-4 border-b-4 break-words group-hover:font-semibold " + activeStyles(active) + " " + boldFixStyle,
1926
+ className: "block tracking-4 text-f6 text-sm py-4 border-b-4 break-words " + (disabled ? '' : 'group-hover:font-semibold') + " " + activeStyles(active) + " " + boldFixStyle,
1917
1927
  "data-title": title
1918
1928
  }, title));
1919
1929
  };
@@ -2703,6 +2713,7 @@ var ActionBarComponent = function ActionBarComponent(_ref) {
2703
2713
  className: "lg:hidden"
2704
2714
  }, React__default.Children.map(children, function (_ref3) {
2705
2715
  var props = _ref3.props;
2716
+ if (!props.children) return;
2706
2717
  return React__default.createElement("button", {
2707
2718
  className: 'px-4 py-1 text-base-1' + (props != null && props.loading ? ' pointer-events-none' : ''),
2708
2719
  onClick: props == null ? void 0 : props.onClick
@@ -2821,6 +2832,7 @@ var PaginationInfoComponent = function PaginationInfoComponent(_ref) {
2821
2832
  }, React__default.createElement("div", {
2822
2833
  className: "flex items-center mr-5 text-inverted-2 tracking-4 text-f6"
2823
2834
  }, itemsLengthOptions ? React__default.createElement(Select, {
2835
+ id: "selectItemsPerPage",
2824
2836
  options: itemsLengthOptions,
2825
2837
  withoutStyle: true,
2826
2838
  "aria-label": "Itens por p\xE1gina",
@@ -2890,6 +2902,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2890
2902
  }, React__default.createElement("div", {
2891
2903
  className: "text-inverted-2 text-f6 tracking-4"
2892
2904
  }, React__default.createElement("span", {
2905
+ id: "btnPaginationActualPage",
2893
2906
  className: "pagination-nav-current text-primary font-semibold",
2894
2907
  ref: inputEl,
2895
2908
  contentEditable: true,
@@ -2899,6 +2912,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2899
2912
  onCut: onPreventDefault,
2900
2913
  onPaste: onPreventDefault
2901
2914
  }, currentPage), ' ', "/", ' ', React__default.createElement("button", {
2915
+ id: "btnPaginationLastPage",
2902
2916
  className: "pagination-nav-total focus:outline-none",
2903
2917
  onClick: function onClick() {
2904
2918
  if (currentPage !== maxTotalPages) handleChange(maxTotalPages);
@@ -2906,7 +2920,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2906
2920
  }, maxTotalPages)), React__default.createElement("div", {
2907
2921
  className: "text-inverted-2 ml-5 flex items-center"
2908
2922
  }, React__default.createElement("button", {
2909
- className: "pagination-nav-previous mr-3 duration-200 focus:outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2923
+ id: "btnPaginationPrev",
2924
+ className: "pagination-nav-previous mr-3 duration-200 outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2910
2925
  "aria-label": "Ir para p\xE1gina anterior",
2911
2926
  onClick: function onClick() {
2912
2927
  if (hasPrev) handleChange(currentPage - 1);
@@ -2916,7 +2931,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2916
2931
  block: true,
2917
2932
  size: 4
2918
2933
  })), React__default.createElement("button", {
2919
- className: "pagination-nav-next duration-200 focus:outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2934
+ id: "btnPaginationNext",
2935
+ className: "pagination-nav-next duration-200 outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2920
2936
  "aria-label": "Ir para pr\xF3xima p\xE1gina",
2921
2937
  onClick: function onClick() {
2922
2938
  if (hasNext) handleChange(currentPage + 1);