@loja-integrada/admin-components 0.12.5 → 0.12.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.
@@ -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
  }
@@ -2067,12 +2067,13 @@ var Tabs = /*#__PURE__*/React__default.memo(TabsComponent);
2067
2067
  var TimelineItem = function TimelineItem(_ref) {
2068
2068
  var item = _ref.item;
2069
2069
 
2070
- var _useState = React.useState(false),
2070
+ var _useState = React.useState(!item.toggle),
2071
2071
  isOpen = _useState[0],
2072
2072
  setIsOpen = _useState[1];
2073
2073
 
2074
2074
  var iconBackgroundColor = item.iconBackgroundColor || "bg-inverted-2";
2075
2075
  var icon = item.icon || 'minus';
2076
+ var showToggle = item.toggle && item.description;
2076
2077
  return React__default.createElement("li", {
2077
2078
  className: "timeline-item relative mb-10 last:mb-0"
2078
2079
  }, React__default.createElement("div", {
@@ -2083,13 +2084,13 @@ var TimelineItem = function TimelineItem(_ref) {
2083
2084
  })), React__default.createElement("div", {
2084
2085
  className: "ml-7 pt-px"
2085
2086
  }, 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' : ''),
2087
+ className: "timeline-title group py-1 text-f6 leading-6 tracking-4 text-inverted-1 font-semibold break-words " + (showToggle ? 'cursor-pointer' : ''),
2087
2088
  onClick: function onClick() {
2088
- return item.description && setIsOpen(function (isOpen) {
2089
+ return showToggle && setIsOpen(function (isOpen) {
2089
2090
  return !isOpen;
2090
2091
  });
2091
2092
  }
2092
- }, item.description && React__default.createElement("button", {
2093
+ }, showToggle && React__default.createElement("button", {
2093
2094
  className: "float-right p-1 -mt-px text-inverted-2 group-hover:text-inverted-1 focus:outline-none"
2094
2095
  }, React__default.createElement(Icon, {
2095
2096
  icon: "angleLeft",
@@ -2099,9 +2100,13 @@ var TimelineItem = function TimelineItem(_ref) {
2099
2100
  })), React__default.createElement("span", {
2100
2101
  className: "inline break-words"
2101
2102
  }, 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')
2103
+ className: "timeline-timestamp mb-1 inline-flex items-center text-xs tracking-4 text-inverted-2 break-words"
2104
+ }, React__default.createElement(Icon, {
2105
+ icon: "clock",
2106
+ size: 3,
2107
+ className: "mr-1"
2108
+ }), item.timestamp), item.description && React__default.createElement("div", {
2109
+ 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
2110
  }, item.description)));
2106
2111
  };
2107
2112
 
@@ -2111,6 +2116,8 @@ var TimelineComponent = function TimelineComponent(_ref) {
2111
2116
  items = _ref.items,
2112
2117
  _ref$isLoading = _ref.isLoading,
2113
2118
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
2119
+ _ref$toggleItems = _ref.toggleItems,
2120
+ toggleItems = _ref$toggleItems === void 0 ? true : _ref$toggleItems,
2114
2121
  _ref$emptyTitle = _ref.emptyTitle,
2115
2122
  emptyTitle = _ref$emptyTitle === void 0 ? 'Nenhum registro encontrado' : _ref$emptyTitle;
2116
2123
  if (!isLoading && (!items || !Array.isArray(items))) return null;
@@ -2136,9 +2143,13 @@ var TimelineComponent = function TimelineComponent(_ref) {
2136
2143
  icon: 'ban'
2137
2144
  }
2138
2145
  }) : items == null ? void 0 : items.map(function (item, index) {
2146
+ var _item$toggle;
2147
+
2139
2148
  return React__default.createElement(TimelineItem, {
2140
2149
  key: "timeline-item-" + index,
2141
- item: item
2150
+ item: _extends({}, item, {
2151
+ toggle: (_item$toggle = item.toggle) != null ? _item$toggle : toggleItems
2152
+ })
2142
2153
  });
2143
2154
  })));
2144
2155
  };