@beydesign/storybook 0.0.74 → 0.0.76
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/stories/UI/Badge.js
CHANGED
|
@@ -3,7 +3,7 @@ import { BadgeColor, BadgeSize } from './types';
|
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
5
|
import { getIconComponent } from '../../utils';
|
|
6
|
-
export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, style: customStyle, icon = 'Cactus', showIcon = false, fill = true, }) => {
|
|
6
|
+
export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, style: customStyle, icon = 'Cactus', showIcon = false, fill = true, iconWeight = 'regular', iconSize, iconColor, }) => {
|
|
7
7
|
const getBackgroundColor = (color) => {
|
|
8
8
|
switch (color) {
|
|
9
9
|
case BadgeColor.Default:
|
|
@@ -110,9 +110,9 @@ export const Badge = ({ color = BadgeColor.Default, size = BadgeSize.md, text, s
|
|
|
110
110
|
const border = getBorder(color);
|
|
111
111
|
const padding = getPadding(size);
|
|
112
112
|
const iconProps = {
|
|
113
|
-
size: getIconSize(size),
|
|
114
|
-
color: getTextColor(),
|
|
115
|
-
weight:
|
|
113
|
+
size: iconSize || getIconSize(size),
|
|
114
|
+
color: iconColor || getTextColor(),
|
|
115
|
+
weight: iconWeight,
|
|
116
116
|
};
|
|
117
117
|
return (_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "center", bgcolor: fill ? backgroundColor : 'transparent', border: fill ? border : 'none', borderRadius: fill ? 'var(--spacing-tokens-size-in-px-radius-radius-full)' : 'none', padding: padding, margin: 0, gap: "4px", sx: customStyle, children: [showIcon && icon && getIconComponent(icon, iconProps), text && (_jsx(Typography, { text: text, size: getTypographySize(size), weight: TypographyWeight.Medium, color: getTextColor() }))] }));
|
|
118
118
|
};
|
|
@@ -4,6 +4,6 @@ import { Box } from '@mui/material';
|
|
|
4
4
|
import { Typography, TypographySize, TypographyWeight } from '../Typography';
|
|
5
5
|
import { Badge } from './Badge';
|
|
6
6
|
import { ButtonHierarchy, ButtonSize, MainButton } from '../Buttons';
|
|
7
|
-
export const Topbar = ({ title, badgeText, newButtonText, onNewButtonClick, className, style, }) => {
|
|
8
|
-
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', className: className, sx: style, minWidth: '400px', children: [_jsx(Typography, { text: title, size: TypographySize.HeadingS, weight: TypographyWeight.SemiBold, trailingElement: badgeText && (_jsx(Badge, { text: badgeText, size: BadgeSize.xs, color: BadgeColor.Violet, style: { marginBottom: '10px' } })), style: { gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)' } }), _jsx(MainButton, { size: ButtonSize.lg, text: newButtonText, onClick: onNewButtonClick, hierarchy: ButtonHierarchy.Primary, trailingIcon: 'Plus', showTrailingIcon: true })] }));
|
|
7
|
+
export const Topbar = ({ title, badgeText, newButtonText, onNewButtonClick, newButtonHidden, className, style, }) => {
|
|
8
|
+
return (_jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', paddingY: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', className: className, sx: style, minWidth: '400px', children: [_jsx(Typography, { text: title, size: TypographySize.HeadingS, weight: TypographyWeight.SemiBold, trailingElement: badgeText && (_jsx(Badge, { text: badgeText, size: BadgeSize.xs, color: BadgeColor.Violet, style: { marginBottom: '10px' } })), style: { gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-sm)' } }), !newButtonHidden && (_jsx(MainButton, { size: ButtonSize.lg, text: newButtonText, onClick: onNewButtonClick, hierarchy: ButtonHierarchy.Primary, trailingIcon: 'Plus', showTrailingIcon: true }))] }));
|
|
9
9
|
};
|
|
@@ -41,6 +41,12 @@ export type BadgeProps = {
|
|
|
41
41
|
icon?: IconName;
|
|
42
42
|
/** Whether to fill the icon */
|
|
43
43
|
fill?: boolean;
|
|
44
|
+
/** Custom icon weight (regular, bold, duotone, fill, light, thin) */
|
|
45
|
+
iconWeight?: 'regular' | 'bold' | 'duotone' | 'fill' | 'light' | 'thin';
|
|
46
|
+
/** Custom icon size (overrides the default size based on badge size) */
|
|
47
|
+
iconSize?: string | number;
|
|
48
|
+
/** Custom icon color (overrides the default color based on badge color) */
|
|
49
|
+
iconColor?: string;
|
|
44
50
|
};
|
|
45
51
|
/**
|
|
46
52
|
* Avatar size variants
|
|
@@ -209,8 +215,10 @@ export interface TopbarProps {
|
|
|
209
215
|
title: string;
|
|
210
216
|
/** Badge */
|
|
211
217
|
badgeText?: string;
|
|
212
|
-
/** New button */
|
|
218
|
+
/** New button text */
|
|
213
219
|
newButtonText?: string;
|
|
220
|
+
/** New button hidden */
|
|
221
|
+
newButtonHidden?: boolean;
|
|
214
222
|
/** On click of new button */
|
|
215
223
|
onNewButtonClick?: () => void;
|
|
216
224
|
/** Style */
|