@loja-integrada/admin-components 0.12.5 → 0.12.8

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TimelineItemInterface } from './TimelineItem.interface';
3
- export declare const Timeline: React.MemoExoticComponent<({ className, items, isLoading, emptyTitle, }: TimelineProps) => JSX.Element | null>;
3
+ export declare const Timeline: React.MemoExoticComponent<({ className, items, isLoading, toggleItems, emptyTitle, }: TimelineProps) => JSX.Element | null>;
4
4
  export interface TimelineProps {
5
5
  /**
6
6
  * Custom class name
@@ -18,4 +18,8 @@ export interface TimelineProps {
18
18
  * @default 'Nenhum registro encontrado'
19
19
  */
20
20
  emptyTitle?: string;
21
+ /** Timeline item show toggle
22
+ * @default true
23
+ */
24
+ toggleItems?: boolean;
21
25
  }
@@ -2,5 +2,6 @@ import { TimelineProps } from './Timeline';
2
2
  declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("@storybook/react").Args>;
3
3
  export default _default;
4
4
  export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TimelineProps>;
5
+ export declare const WithoutToggle: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TimelineProps>;
5
6
  export declare const Loading: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TimelineProps>;
6
7
  export declare const Empty: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, TimelineProps>;
@@ -21,4 +21,8 @@ export interface TimelineItemInterface {
21
21
  * Background of the current icon (className)
22
22
  */
23
23
  iconBackgroundColor?: string;
24
+ /**
25
+ * Toggle item description
26
+ */
27
+ toggle?: boolean;
24
28
  }
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const MoneyBill: () => JSX.Element;
@@ -31,6 +31,7 @@ export declare const icons: {
31
31
  externalLink: () => JSX.Element;
32
32
  home: () => JSX.Element;
33
33
  image: () => JSX.Element;
34
+ moneyBill: () => JSX.Element;
34
35
  move: () => JSX.Element;
35
36
  order: () => JSX.Element;
36
37
  pagali: () => JSX.Element;
@@ -14,6 +14,10 @@ export interface BoxProps extends Partial<SharedContextProps> {
14
14
  * Custom class name
15
15
  * */
16
16
  className?: string;
17
+ /**
18
+ * Box ID
19
+ * */
20
+ id?: string;
17
21
  /**
18
22
  * Box Header and Content
19
23
  */
@@ -298,6 +298,14 @@ var Image = function Image() {
298
298
  });
299
299
  };
300
300
 
301
+ var MoneyBill = function MoneyBill() {
302
+ return React__default.createElement("path", {
303
+ fillRule: "evenodd",
304
+ d: "M3.245 12.2h11.51a1.995 1.995 0 0 1 1.945-1.945v-6.51A1.995 1.995 0 0 1 14.755 1.8H3.245A1.995 1.995 0 0 1 1.3 3.745v6.51A1.995 1.995 0 0 1 3.245 12.2ZM18 2v10a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 0 12V2A1.5 1.5 0 0 1 1.5.5h15A1.5 1.5 0 0 1 18 2Zm-6.5 5c0 2-1 3-2.5 3S6.5 9 6.5 7s1-3 2.5-3 2.5 1 2.5 3Z",
305
+ clipRule: "evenodd"
306
+ });
307
+ };
308
+
301
309
  var Move = function Move() {
302
310
  return React__default.createElement("path", {
303
311
  fillRule: "evenodd",
@@ -545,6 +553,7 @@ var icons = {
545
553
  externalLink: ExternalLink,
546
554
  home: Home,
547
555
  image: Image,
556
+ moneyBill: MoneyBill,
548
557
  move: Move,
549
558
  order: Order,
550
559
  pagali: Pagali,
@@ -2067,12 +2076,13 @@ var Tabs = /*#__PURE__*/React__default.memo(TabsComponent);
2067
2076
  var TimelineItem = function TimelineItem(_ref) {
2068
2077
  var item = _ref.item;
2069
2078
 
2070
- var _useState = React.useState(false),
2079
+ var _useState = React.useState(!item.toggle),
2071
2080
  isOpen = _useState[0],
2072
2081
  setIsOpen = _useState[1];
2073
2082
 
2074
2083
  var iconBackgroundColor = item.iconBackgroundColor || "bg-inverted-2";
2075
2084
  var icon = item.icon || 'minus';
2085
+ var showToggle = item.toggle && item.description;
2076
2086
  return React__default.createElement("li", {
2077
2087
  className: "timeline-item relative mb-10 last:mb-0"
2078
2088
  }, React__default.createElement("div", {
@@ -2083,13 +2093,13 @@ var TimelineItem = function TimelineItem(_ref) {
2083
2093
  })), React__default.createElement("div", {
2084
2094
  className: "ml-7 pt-px"
2085
2095
  }, React__default.createElement("div", {
2086
- className: "timeline-title group mb-1 py-1 text-sm text-inverted-1 font-semibold break-words " + (item.description ? 'cursor-pointer' : ''),
2096
+ className: "timeline-title group py-1 text-f6 leading-6 tracking-4 text-inverted-1 font-semibold break-words " + (showToggle ? 'cursor-pointer' : ''),
2087
2097
  onClick: function onClick() {
2088
- return item.description && setIsOpen(function (isOpen) {
2098
+ return showToggle && setIsOpen(function (isOpen) {
2089
2099
  return !isOpen;
2090
2100
  });
2091
2101
  }
2092
- }, item.description && React__default.createElement("button", {
2102
+ }, showToggle && React__default.createElement("button", {
2093
2103
  className: "float-right p-1 -mt-px text-inverted-2 group-hover:text-inverted-1 focus:outline-none"
2094
2104
  }, React__default.createElement(Icon, {
2095
2105
  icon: "angleLeft",
@@ -2099,9 +2109,13 @@ var TimelineItem = function TimelineItem(_ref) {
2099
2109
  })), React__default.createElement("span", {
2100
2110
  className: "inline break-words"
2101
2111
  }, item.title)), item.timestamp && React__default.createElement("div", {
2102
- className: "timeline-timestamp mb-1 text-xs text-inverted-2 break-words"
2103
- }, item.timestamp), item.description && React__default.createElement("div", {
2104
- className: "timeline-description overflow-hidden text-sm text-inverted-1 break-words transition-max-height " + (isOpen ? 'max-h-96' : 'max-h-0')
2112
+ className: "timeline-timestamp mb-1 inline-flex items-center text-xs tracking-4 text-inverted-2 break-words"
2113
+ }, React__default.createElement(Icon, {
2114
+ icon: "clock",
2115
+ size: 3,
2116
+ className: "mr-1"
2117
+ }), item.timestamp), item.description && React__default.createElement("div", {
2118
+ className: "timeline-description overflow-hidden text-sm tracking-4 text-inverted-1 break-words transition-max-height " + (isOpen ? 'max-h-96' : 'max-h-0')
2105
2119
  }, item.description)));
2106
2120
  };
2107
2121
 
@@ -2111,6 +2125,8 @@ var TimelineComponent = function TimelineComponent(_ref) {
2111
2125
  items = _ref.items,
2112
2126
  _ref$isLoading = _ref.isLoading,
2113
2127
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
2128
+ _ref$toggleItems = _ref.toggleItems,
2129
+ toggleItems = _ref$toggleItems === void 0 ? true : _ref$toggleItems,
2114
2130
  _ref$emptyTitle = _ref.emptyTitle,
2115
2131
  emptyTitle = _ref$emptyTitle === void 0 ? 'Nenhum registro encontrado' : _ref$emptyTitle;
2116
2132
  if (!isLoading && (!items || !Array.isArray(items))) return null;
@@ -2136,9 +2152,13 @@ var TimelineComponent = function TimelineComponent(_ref) {
2136
2152
  icon: 'ban'
2137
2153
  }
2138
2154
  }) : items == null ? void 0 : items.map(function (item, index) {
2155
+ var _item$toggle;
2156
+
2139
2157
  return React__default.createElement(TimelineItem, {
2140
2158
  key: "timeline-item-" + index,
2141
- item: item
2159
+ item: _extends({}, item, {
2160
+ toggle: (_item$toggle = item.toggle) != null ? _item$toggle : toggleItems
2161
+ })
2142
2162
  });
2143
2163
  })));
2144
2164
  };
@@ -2626,7 +2646,8 @@ var Box = /*#__PURE__*/function (_React$PureComponent) {
2626
2646
  _this$props$variant = _this$props.variant,
2627
2647
  variant = _this$props$variant === void 0 ? 'default' : _this$props$variant,
2628
2648
  _this$props$isToggle = _this$props.isToggle,
2629
- isToggle = _this$props$isToggle === void 0 ? false : _this$props$isToggle;
2649
+ isToggle = _this$props$isToggle === void 0 ? false : _this$props$isToggle,
2650
+ id = _this$props.id;
2630
2651
 
2631
2652
  var toggleContent = function toggleContent(value) {
2632
2653
  return _this2.setState({
@@ -2648,7 +2669,8 @@ var Box = /*#__PURE__*/function (_React$PureComponent) {
2648
2669
  didUpdate: toggleContent
2649
2670
  }), React__default.createElement("div", {
2650
2671
  className: "box w-full flex flex-col bg-base-1 border border-card-stroke rounded " + className,
2651
- "data-opened": isOpen
2672
+ "data-opened": isOpen,
2673
+ id: id
2652
2674
  }, children));
2653
2675
  };
2654
2676
 
@@ -3028,6 +3050,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
3028
3050
  onCut: onPreventDefault,
3029
3051
  onPaste: onPreventDefault
3030
3052
  }, currentPage), ' ', "/", ' ', React__default.createElement("button", {
3053
+ type: "button",
3031
3054
  id: "btnPaginationLastPage",
3032
3055
  className: "pagination-nav-total focus:outline-none",
3033
3056
  onClick: function onClick() {
@@ -3036,6 +3059,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
3036
3059
  }, maxTotalPages)), React__default.createElement("div", {
3037
3060
  className: "text-inverted-2 ml-5 flex items-center"
3038
3061
  }, React__default.createElement("button", {
3062
+ type: "button",
3039
3063
  id: "btnPaginationPrev",
3040
3064
  className: "pagination-nav-previous mr-3 duration-200 outline-none " + (hasPrev ? 'hover:text-inverted-1' : ''),
3041
3065
  "aria-label": "Ir para p\xE1gina anterior",
@@ -3047,6 +3071,7 @@ var PaginationNavComponent = function PaginationNavComponent(_ref) {
3047
3071
  block: true,
3048
3072
  size: 4
3049
3073
  })), React__default.createElement("button", {
3074
+ type: "button",
3050
3075
  id: "btnPaginationNext",
3051
3076
  className: "pagination-nav-next duration-200 outline-none " + (hasNext ? 'hover:text-inverted-1' : ''),
3052
3077
  "aria-label": "Ir para pr\xF3xima p\xE1gina",