@agilant/toga-blox 1.0.19 → 1.0.21
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,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
const Badge = ({ borderColor, borderWidth, borderRadius, backgroundColor, hasMobileStyle, mobileIcon, mobileIconLabel, iconSize, hasLeftIcon, hasRightIcon, icon, image, text, badgeContainerClasses, }) => {
|
|
2
|
+
const Badge = ({ borderColor, borderWidth, borderRadius, backgroundColor, hasMobileStyle, mobileIcon, mobileIconLabel, iconSize, hasLeftIcon, hasRightIcon, icon, image, text, badgeContainerClasses, styles, }) => {
|
|
3
3
|
const iconClasses = `${iconSize}`;
|
|
4
4
|
const badgeBackgroundClasses = `${backgroundColor}`;
|
|
5
5
|
const badgeBorderClasses = `${borderWidth} ${borderColor} ${borderRadius}`;
|
|
6
6
|
const badgeClasses = `inline-flex items-center ${badgeBorderClasses} ${badgeBackgroundClasses} ${badgeContainerClasses}`;
|
|
7
|
-
return (_jsxs("span", { "data-testid": "badge-test-id", className: badgeClasses, children: [image && _jsx("span", { className: "mr-2", children: image }), icon && hasLeftIcon && (_jsx("span", { className: `${iconClasses} max-md:hidden mr-2`, children: icon })), mobileIcon && hasMobileStyle && (_jsx("span", { className: `${iconClasses} hidden max-md:flex max-md:p-0 mr-2`, "aria-hidden": "false", "aria-label": mobileIconLabel, children: mobileIcon })), _jsx("div", { className: `${hasMobileStyle ? "max-md:hidden" : ""}`, children: text }), icon && hasRightIcon && (_jsx("span", { className: `${iconClasses} max-md:hidden ml-2`, children: icon }))] }));
|
|
7
|
+
return (_jsxs("span", { "data-testid": "badge-test-id", className: badgeClasses, style: styles, children: [image && _jsx("span", { className: "mr-2", children: image }), icon && hasLeftIcon && (_jsx("span", { className: `${iconClasses} max-md:hidden mr-2`, children: icon })), mobileIcon && hasMobileStyle && (_jsx("span", { className: `${iconClasses} hidden max-md:flex max-md:p-0 mr-2`, "aria-hidden": "false", "aria-label": mobileIconLabel, children: mobileIcon })), _jsx("div", { className: `${hasMobileStyle ? "max-md:hidden" : ""}`, children: text }), icon && hasRightIcon && (_jsx("span", { className: `${iconClasses} max-md:hidden ml-2`, children: icon }))] }));
|
|
8
8
|
};
|
|
9
9
|
export default Badge;
|
|
@@ -118,6 +118,10 @@ export default {
|
|
|
118
118
|
control: "none",
|
|
119
119
|
description: "Sets the text color of the badge using Tailwind CSS classes. Example: `text-gray-800`.",
|
|
120
120
|
},
|
|
121
|
+
styles: {
|
|
122
|
+
control: "none",
|
|
123
|
+
description: "Sets the inline styles of the badge using direct inline styles",
|
|
124
|
+
},
|
|
121
125
|
},
|
|
122
126
|
tags: ["autodocs"],
|
|
123
127
|
parameters: {
|
|
@@ -226,3 +230,21 @@ SupplyBadge.parameters = {
|
|
|
226
230
|
},
|
|
227
231
|
},
|
|
228
232
|
};
|
|
233
|
+
export const StylesBadge = Template.bind({});
|
|
234
|
+
StylesBadge.args = {
|
|
235
|
+
backgroundColor: "bg-gray-300",
|
|
236
|
+
borderRadius: "rounded-full",
|
|
237
|
+
badgeContainerClasses: "px-3 py-1",
|
|
238
|
+
mobileIcon: getFontAwesomeIcon("calculator"),
|
|
239
|
+
icon: getFontAwesomeIcon("calculator"),
|
|
240
|
+
hasLeftIcon: true,
|
|
241
|
+
styles: { background: "#F8F8F9", padding: "1.5rem" },
|
|
242
|
+
text: (_jsx(Text, { color: "text-black", fontFamily: "font-serif", text: "Closed", tag: "span", size: "text-sm" })),
|
|
243
|
+
};
|
|
244
|
+
StylesBadge.parameters = {
|
|
245
|
+
docs: {
|
|
246
|
+
description: {
|
|
247
|
+
story: "The badges using the styles prop",
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
};
|