@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.
- package/dist/cjs/index.js +19 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Tabs/Styles.d.ts +5 -1
- package/dist/cjs/types/components/Tabs/Tab.d.ts +2 -1
- package/dist/cjs/types/components/Tabs/types.d.ts +4 -1
- package/dist/esm/index.esm.js +19 -6
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/Tabs/Styles.d.ts +5 -1
- package/dist/esm/types/components/Tabs/Tab.d.ts +2 -1
- package/dist/esm/types/components/Tabs/types.d.ts +4 -1
- package/dist/index.d.ts +4 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -22126,6 +22126,8 @@ const TabsBar = styled.nav `
|
|
|
22126
22126
|
}
|
|
22127
22127
|
`;
|
|
22128
22128
|
const TabButton = styled.button `
|
|
22129
|
+
display: flex;
|
|
22130
|
+
align-items: center;
|
|
22129
22131
|
cursor: pointer;
|
|
22130
22132
|
background-color: transparent;
|
|
22131
22133
|
border: none;
|
|
@@ -22135,18 +22137,29 @@ const TabButton = styled.button `
|
|
|
22135
22137
|
font-size: 14px;
|
|
22136
22138
|
${({ $variant }) => tabButtonVariantSelector($variant)};
|
|
22137
22139
|
`;
|
|
22140
|
+
const NotificationBubble = styled.span `
|
|
22141
|
+
margin-left: 5px;
|
|
22142
|
+
background-color: ${({ $isActive }) => $isActive ? Styles.color.transparent : Styles.color.core.accent};
|
|
22143
|
+
border-radius: 100%;
|
|
22144
|
+
padding: ${({ $isActive }) => ($isActive ? "1px 4px 1px 3px" : "1px 4px")};
|
|
22145
|
+
font-size: ${({ $isActive }) => ($isActive ? "12px" : "10px")};
|
|
22146
|
+
line-height: 12px;
|
|
22147
|
+
color: ${({ $isActive }) => $isActive ? Styles.color.core.primary : Styles.color.white};
|
|
22148
|
+
`;
|
|
22138
22149
|
|
|
22139
|
-
const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, }) => {
|
|
22140
|
-
return (a$l.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
|
|
22150
|
+
const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, notifications, }) => {
|
|
22151
|
+
return (a$l.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
|
|
22152
|
+
label,
|
|
22153
|
+
notifications && notifications > 0 && (a$l.createElement(NotificationBubble, { "$isActive": active }, notifications))));
|
|
22141
22154
|
};
|
|
22142
22155
|
|
|
22143
22156
|
const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
|
|
22144
22157
|
const [activeTab, setActiveTab] = a$l.useState(defaultActiveTab ?? tabs[0]);
|
|
22145
|
-
const handleClick = (
|
|
22146
|
-
setActiveTab(
|
|
22147
|
-
onTabClick(
|
|
22158
|
+
const handleClick = (label) => {
|
|
22159
|
+
setActiveTab(label);
|
|
22160
|
+
onTabClick(label);
|
|
22148
22161
|
};
|
|
22149
|
-
return (a$l.createElement(TabsBar, { "$variant": variant, "$isPill": isPill, id: id, className: className, ...htmlProps }, tabs.map((tab) => (a$l.createElement(Tab, { key: `${id}-${tab}`, id: `${id}-${tab}`, label: tab, active: tab === activeTab, variant: variant, onClick: () => handleClick(tab) })))));
|
|
22162
|
+
return (a$l.createElement(TabsBar, { "$variant": variant, "$isPill": isPill, id: id, className: className, ...htmlProps }, tabs.map((tab) => (a$l.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 })))));
|
|
22150
22163
|
};
|
|
22151
22164
|
|
|
22152
22165
|
exports.HelperText = HelperText;
|