hazo_ui 2.1.1 → 2.1.2

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/index.d.ts CHANGED
@@ -66,6 +66,8 @@ interface MultiStateRadioItem {
66
66
  value: string;
67
67
  icon_selected?: string;
68
68
  icon_unselected?: string;
69
+ fgcolor?: string;
70
+ bgcolor?: string;
69
71
  }
70
72
  interface MultiStateRadioProps {
71
73
  layout?: "horizontal" | "vertical";
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ import * as FiIcons from 'react-icons/fi';
27
27
  import * as IoIcons from 'react-icons/io5';
28
28
  import * as RiIcons from 'react-icons/ri';
29
29
  import * as TbIcons from 'react-icons/tb';
30
+ import * as CiIcons from 'react-icons/ci';
30
31
 
31
32
  var ExampleComponent = ({ children, className = "" }) => {
32
33
  return /* @__PURE__ */ jsx("div", { className: `cls_example_component ${className}`, children });
@@ -1193,7 +1194,8 @@ var iconSetMap = {
1193
1194
  io: IoIcons,
1194
1195
  io5: IoIcons,
1195
1196
  ri: RiIcons,
1196
- tb: TbIcons
1197
+ tb: TbIcons,
1198
+ ci: CiIcons
1197
1199
  };
1198
1200
  function getIconLibrary(iconSet) {
1199
1201
  if (!iconSet) return null;
@@ -1339,6 +1341,10 @@ function MultiStateRadio({
1339
1341
  const SelectedIcon = icon_set && item.icon_selected ? getIconComponent(icon_set, item.icon_selected) : null;
1340
1342
  const UnselectedIcon = icon_set && item.icon_unselected ? getIconComponent(icon_set, item.icon_unselected) : null;
1341
1343
  const IconComponent = selected && SelectedIcon ? SelectedIcon : UnselectedIcon || SelectedIcon;
1344
+ const buttonStyles = {};
1345
+ if (item.bgcolor) {
1346
+ buttonStyles.backgroundColor = item.bgcolor;
1347
+ }
1342
1348
  const buttonContent = /* @__PURE__ */ jsxs(
1343
1349
  Button,
1344
1350
  {
@@ -1349,9 +1355,11 @@ function MultiStateRadio({
1349
1355
  layout === "horizontal" ? "flex-row" : "flex-col",
1350
1356
  "gap-2 h-auto",
1351
1357
  compressed ? "py-0 px-0" : "py-2 px-3 sm:py-3 sm:px-4",
1352
- selected && "bg-primary text-primary-foreground",
1353
- !selected && "hover:bg-accent"
1358
+ // Only apply default colors if custom colors are not provided
1359
+ !item.bgcolor && selected && "bg-primary text-primary-foreground",
1360
+ !item.bgcolor && !selected && "hover:bg-accent"
1354
1361
  ),
1362
+ style: Object.keys(buttonStyles).length > 0 ? buttonStyles : void 0,
1355
1363
  onClick: () => {
1356
1364
  if (selection === "single") {
1357
1365
  handleSingleSelection(item.value);
@@ -1362,8 +1370,21 @@ function MultiStateRadio({
1362
1370
  "aria-label": item.label,
1363
1371
  "aria-pressed": selected,
1364
1372
  children: [
1365
- IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: "cls_icon h-4 w-4 sm:h-5 sm:w-5" }),
1366
- display_label && /* @__PURE__ */ jsx("span", { className: "cls_icon_label text-sm font-medium", children: item.label })
1373
+ IconComponent && /* @__PURE__ */ jsx(
1374
+ IconComponent,
1375
+ {
1376
+ className: "cls_icon h-4 w-4 sm:h-5 sm:w-5",
1377
+ style: item.fgcolor ? { color: item.fgcolor } : void 0
1378
+ }
1379
+ ),
1380
+ display_label && /* @__PURE__ */ jsx(
1381
+ "span",
1382
+ {
1383
+ className: "cls_icon_label text-sm font-medium",
1384
+ style: item.fgcolor ? { color: item.fgcolor } : void 0,
1385
+ children: item.label
1386
+ }
1387
+ )
1367
1388
  ]
1368
1389
  }
1369
1390
  );