@stella-source/stellasource-dsl 2.0.0 → 3.0.0

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,6 +3,10 @@ interface TabsStylesProps {
3
3
  $variant: `${TabsVariant}`;
4
4
  $isPill?: boolean;
5
5
  }
6
+ interface NotificationBubbleProps {
7
+ $isActive?: boolean;
8
+ }
6
9
  declare const TabsBar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, TabsStylesProps>> & string;
7
10
  declare const TabButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, TabsStylesProps>> & string;
8
- export { TabsBar, TabButton };
11
+ declare const NotificationBubble: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, NotificationBubbleProps>> & string;
12
+ export { TabsBar, TabButton, NotificationBubble };
@@ -7,7 +7,8 @@ interface TabProps {
7
7
  htmlProps?: HTMLAttributes<HTMLButtonElement>;
8
8
  active?: boolean;
9
9
  variant?: `${TabsVariant}`;
10
+ notifications?: number;
10
11
  label: string;
11
12
  }
12
- declare const Tab: ({ id, className, onClick, htmlProps, label, variant, active, }: TabProps) => React.JSX.Element;
13
+ declare const Tab: ({ id, className, onClick, htmlProps, label, variant, active, notifications, }: TabProps) => React.JSX.Element;
13
14
  export default Tab;
@@ -11,7 +11,10 @@ interface TabsBaseProps {
11
11
  defaultActiveTab?: string;
12
12
  isPill?: boolean;
13
13
  variant?: `${TabsVariant}`;
14
- tabs: string[];
14
+ tabs: {
15
+ label: string;
16
+ notifications?: number;
17
+ }[];
15
18
  onTabClick: (label?: string) => void;
16
19
  }
17
20
  interface TabsPropsLight {
@@ -22106,6 +22106,8 @@ const TabsBar = styled.nav `
22106
22106
  }
22107
22107
  `;
22108
22108
  const TabButton = styled.button `
22109
+ display: flex;
22110
+ align-items: center;
22109
22111
  cursor: pointer;
22110
22112
  background-color: transparent;
22111
22113
  border: none;
@@ -22115,18 +22117,29 @@ const TabButton = styled.button `
22115
22117
  font-size: 14px;
22116
22118
  ${({ $variant }) => tabButtonVariantSelector($variant)};
22117
22119
  `;
22120
+ const NotificationBubble = styled.span `
22121
+ margin-left: 5px;
22122
+ background-color: ${({ $isActive }) => $isActive ? Styles.color.transparent : Styles.color.core.accent};
22123
+ border-radius: 100%;
22124
+ padding: ${({ $isActive }) => ($isActive ? "1px 4px 1px 3px" : "1px 4px")};
22125
+ font-size: ${({ $isActive }) => ($isActive ? "12px" : "10px")};
22126
+ line-height: 12px;
22127
+ color: ${({ $isActive }) => $isActive ? Styles.color.core.primary : Styles.color.white};
22128
+ `;
22118
22129
 
22119
- const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, }) => {
22120
- return (a__default.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps }, label));
22130
+ const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, notifications, }) => {
22131
+ return (a__default.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
22132
+ label,
22133
+ notifications && notifications > 0 && (a__default.createElement(NotificationBubble, { "$isActive": active }, notifications))));
22121
22134
  };
22122
22135
 
22123
22136
  const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
22124
22137
  const [activeTab, setActiveTab] = useState(defaultActiveTab ?? tabs[0]);
22125
- const handleClick = (tab) => {
22126
- setActiveTab(tab);
22127
- onTabClick(tab);
22138
+ const handleClick = (label) => {
22139
+ setActiveTab(label);
22140
+ onTabClick(label);
22128
22141
  };
22129
- return (a__default.createElement(TabsBar, { "$variant": variant, "$isPill": isPill, id: id, className: className, ...htmlProps }, tabs.map((tab) => (a__default.createElement(Tab, { key: `${id}-${tab}`, id: `${id}-${tab}`, label: tab, active: tab === activeTab, variant: variant, onClick: () => handleClick(tab) })))));
22142
+ return (a__default.createElement(TabsBar, { "$variant": variant, "$isPill": isPill, id: id, className: className, ...htmlProps }, tabs.map((tab) => (a__default.createElement(Tab, { key: `${id}-${tab.label}`, id: `${id}-${tab.label}`, label: tab.label, active: tab.label === activeTab, variant: variant, onClick: () => handleClick(tab.label), notifications: tab.notifications })))));
22130
22143
  };
22131
22144
 
22132
22145
  export { HelperText, IconButton, Label, Loader, NumberInput, Pagination, PasswordInput, PaymentStatus, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, Tabs, TextInput, Tooltip };