@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.
@@ -15,7 +15,7 @@ export interface ButtonProps extends ButtonAnchorProps {
15
15
  /** Button variant
16
16
  * @default primary
17
17
  * */
18
- variant?: 'primary' | 'secondary' | 'tertiary' | 'info' | 'warning' | 'danger' | 'outline';
18
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'info' | 'warning' | 'danger' | 'outline' | 'onlyText';
19
19
  /**
20
20
  * Button is loading
21
21
  * */
@@ -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?: 'start' | 'end' | 'center' | 'baseline' | 'stretch';
6
7
  }
@@ -581,7 +581,8 @@ var listOfStylesHover = {
581
581
  info: "hover:bg-secondary-bold",
582
582
  warning: "hover:bg-warning-dark",
583
583
  danger: "hover:bg-danger-dark",
584
- outline: "hover:bg-primary-light"
584
+ outline: "hover:bg-primary-light",
585
+ onlyText: "hover:bg-base-2"
585
586
  };
586
587
  var listOfStylesActive = {
587
588
  primary: "active:bg-primary-bold",
@@ -589,13 +590,15 @@ var listOfStylesActive = {
589
590
  tertiary: "active:bg-tertiary-bold",
590
591
  warning: "active:bg-warning-bold",
591
592
  danger: "hover:bg-danger-bold",
592
- outline: "active:shadow-inner active:bg-base-1"
593
+ outline: "active:shadow-inner active:bg-base-1",
594
+ onlyText: "active:bg-base-1"
593
595
  };
594
596
  var listOfStylesFocus = {
595
597
  primary: "focus:ring-1 focus:ring-primary-dark focus:ring-opacity-50",
596
598
  secondary: "focus:ring focus:ring-focus",
597
599
  danger: "focus:ring-1 focus:ring-danger-dark",
598
- outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1"
600
+ outline: "focus:ring-2 focus:ring-focus focus:ring-offset-1",
601
+ onlyText: "focus:bg-base-1"
599
602
  };
600
603
  var listOfStyles = {
601
604
  primary: "bg-primary text-base-1 " + listOfStylesHover['primary'] + " " + listOfStylesActive['primary'] + " " + listOfStylesFocus['primary'],
@@ -604,7 +607,8 @@ var listOfStyles = {
604
607
  info: "bg-secondary-dark text-base-1 " + listOfStylesHover['info'],
605
608
  warning: "bg-warning text-on-base " + listOfStylesHover['warning'] + " " + listOfStylesActive['warning'],
606
609
  danger: "bg-danger text-base-1 " + listOfStylesHover['danger'] + " " + listOfStylesActive['danger'] + " " + listOfStylesFocus['danger'],
607
- outline: "bg-transparent text-inverted-2 border border-inverted-2 " + listOfStylesHover['outline'] + " " + listOfStylesActive['outline'] + " " + listOfStylesFocus['outline']
610
+ outline: "bg-transparent text-inverted-2 border border-inverted-2 " + listOfStylesHover['outline'] + " " + listOfStylesActive['outline'] + " " + listOfStylesFocus['outline'],
611
+ onlyText: "bg-transparent border-transparent text-inverted-2 px-0 " + listOfStylesHover['onlyText'] + " " + listOfStylesActive['onlyText'] + " " + listOfStylesFocus['onlyText']
608
612
  };
609
613
  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 ";
610
614
  var listOfStylesDisabled = {
@@ -614,7 +618,8 @@ var listOfStylesDisabled = {
614
618
  info: defaultDisabledStyle,
615
619
  warning: defaultDisabledStyle,
616
620
  danger: defaultDisabledStyle,
617
- outline: defaultDisabledStyle
621
+ outline: defaultDisabledStyle,
622
+ onlyText: "bg-transparent text-on-base-3 shadow-none ring-0 border-0"
618
623
  };
619
624
  var listOfSizes = {
620
625
  small: "text-f7 h-8",
@@ -687,7 +692,7 @@ var LoadingPlaceholderComponent = function LoadingPlaceholderComponent(_ref) {
687
692
  return React__default.createElement("div", {
688
693
  className: "animate-pulse flex " + className
689
694
  }, React__default.createElement("div", {
690
- className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-80 max-w-full"
695
+ className: "h-4 bg-inverted-2 bg-opacity-20 rounded w-full max-w-full"
691
696
  }));
692
697
  };
693
698
 
@@ -1596,7 +1601,9 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1596
1601
  checked = _ref.checked,
1597
1602
  disabled = _ref.disabled,
1598
1603
  indeterminate = _ref.indeterminate,
1599
- props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate"]);
1604
+ _ref$boxAlign = _ref.boxAlign,
1605
+ boxAlign = _ref$boxAlign === void 0 ? 'center' : _ref$boxAlign,
1606
+ props = _objectWithoutPropertiesLoose(_ref, ["label", "id", "name", "onChange", "checked", "disabled", "indeterminate", "boxAlign"]);
1600
1607
 
1601
1608
  var inputRef = React__default.useRef(null);
1602
1609
  var inputId = id || name;
@@ -1609,6 +1616,7 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1609
1616
  isIndeterminate = _React$useState2[0],
1610
1617
  setIsIndeterminate = _React$useState2[1];
1611
1618
 
1619
+ var isCenterBoxAlign = boxAlign === 'center';
1612
1620
  React__default.useEffect(function () {
1613
1621
  setIsChecked(!!checked);
1614
1622
  if (checked) setIsIndeterminate(false);
@@ -1627,11 +1635,18 @@ var CheckboxComponent = function CheckboxComponent(_ref, ref) {
1627
1635
  };
1628
1636
 
1629
1637
  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";
1638
+ 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
1639
  var checkboxLabelClasses = "ml-1 input-label text-f6 tracking-4 leading-6 " + (disabled ? 'text-inverted-2' : '');
1640
+ var alignOptions = {
1641
+ start: 'items-start',
1642
+ end: 'items-end',
1643
+ center: 'items-center',
1644
+ baseline: 'items-baseline',
1645
+ stretch: 'items-stretch'
1646
+ };
1632
1647
  return React__default.createElement("label", {
1633
1648
  htmlFor: inputId,
1634
- className: "inline-flex items-center cursor-pointer"
1649
+ className: "inline-flex " + alignOptions[boxAlign] + " cursor-pointer"
1635
1650
  }, React__default.createElement("span", {
1636
1651
  className: "rounded z-50 flex items-center justify-center focus-within:ring-2 ring-focus"
1637
1652
  }, React__default.createElement("input", Object.assign({
@@ -1846,10 +1861,12 @@ var TableComponent = function TableComponent(_ref2) {
1846
1861
  }));
1847
1862
  })), React__default.createElement("tbody", Object.assign({}, getTableBodyProps(), {
1848
1863
  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", {
1864
+ }), isLoading ? React__default.createElement("tr", null, Array(columnsLength).fill(0).map(function (key) {
1865
+ return React__default.createElement("td", {
1866
+ key: key,
1867
+ className: "" + TdClasses
1868
+ }, React__default.createElement(TdWrapper, null, React__default.createElement(LoadingPlaceholder, null)));
1869
+ })) : !rows || !rows.length ? React__default.createElement("tr", null, React__default.createElement("td", {
1853
1870
  colSpan: columnsLength || 1,
1854
1871
  className: "" + TdClasses
1855
1872
  }, React__default.createElement(TdWrapper, null, React__default.createElement("div", {
@@ -1901,19 +1918,24 @@ var activeStyles = function activeStyles(active) {
1901
1918
 
1902
1919
 
1903
1920
  var boldFixStyle = "before:content-[attr(data-title)] before:block before:font-semibold before:h-0 before:overflow-hidden before:visibility-hidden";
1921
+ var disabledStyle = 'text-inverted-2 cursor-not-allowed';
1904
1922
  var TabsItem = function TabsItem(_ref) {
1905
1923
  var id = _ref.id,
1906
1924
  title = _ref.title,
1907
1925
  _ref$active = _ref.active,
1908
1926
  active = _ref$active === void 0 ? false : _ref$active,
1927
+ _ref$disabled = _ref.disabled,
1928
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1909
1929
  onChange = _ref.onChange;
1910
1930
  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",
1931
+ id: "btnTab" + id,
1932
+ 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
1933
  onClick: function onClick() {
1913
1934
  return onChange(id);
1914
- }
1935
+ },
1936
+ disabled: disabled
1915
1937
  }, 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,
1938
+ className: "block tracking-4 text-f6 text-sm py-4 border-b-4 break-words " + (disabled ? '' : 'group-hover:font-semibold') + " " + activeStyles(active) + " " + boldFixStyle,
1917
1939
  "data-title": title
1918
1940
  }, title));
1919
1941
  };
@@ -2822,6 +2844,7 @@ var PaginationInfoComponent = function PaginationInfoComponent(_ref) {
2822
2844
  }, React__default.createElement("div", {
2823
2845
  className: "flex items-center mr-5 text-inverted-2 tracking-4 text-f6"
2824
2846
  }, itemsLengthOptions ? React__default.createElement(Select, {
2847
+ id: "selectItemsPerPage",
2825
2848
  options: itemsLengthOptions,
2826
2849
  withoutStyle: true,
2827
2850
  "aria-label": "Itens por p\xE1gina",
@@ -2891,6 +2914,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2891
2914
  }, React__default.createElement("div", {
2892
2915
  className: "text-inverted-2 text-f6 tracking-4"
2893
2916
  }, React__default.createElement("span", {
2917
+ id: "btnPaginationActualPage",
2894
2918
  className: "pagination-nav-current text-primary font-semibold",
2895
2919
  ref: inputEl,
2896
2920
  contentEditable: true,
@@ -2900,6 +2924,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2900
2924
  onCut: onPreventDefault,
2901
2925
  onPaste: onPreventDefault
2902
2926
  }, currentPage), ' ', "/", ' ', React__default.createElement("button", {
2927
+ id: "btnPaginationLastPage",
2903
2928
  className: "pagination-nav-total focus:outline-none",
2904
2929
  onClick: function onClick() {
2905
2930
  if (currentPage !== maxTotalPages) handleChange(maxTotalPages);
@@ -2907,7 +2932,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2907
2932
  }, maxTotalPages)), React__default.createElement("div", {
2908
2933
  className: "text-inverted-2 ml-5 flex items-center"
2909
2934
  }, React__default.createElement("button", {
2910
- className: "pagination-nav-previous mr-3 duration-200 focus:outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2935
+ id: "btnPaginationPrev",
2936
+ className: "pagination-nav-previous mr-3 duration-200 outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
2911
2937
  "aria-label": "Ir para p\xE1gina anterior",
2912
2938
  onClick: function onClick() {
2913
2939
  if (hasPrev) handleChange(currentPage - 1);
@@ -2917,7 +2943,8 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
2917
2943
  block: true,
2918
2944
  size: 4
2919
2945
  })), React__default.createElement("button", {
2920
- className: "pagination-nav-next duration-200 focus:outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2946
+ id: "btnPaginationNext",
2947
+ className: "pagination-nav-next duration-200 outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
2921
2948
  "aria-label": "Ir para pr\xF3xima p\xE1gina",
2922
2949
  onClick: function onClick() {
2923
2950
  if (hasNext) handleChange(currentPage + 1);