hazo_ui 2.1.0 → 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.cjs +44 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +43 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ var FiIcons = require('react-icons/fi');
|
|
|
28
28
|
var IoIcons = require('react-icons/io5');
|
|
29
29
|
var RiIcons = require('react-icons/ri');
|
|
30
30
|
var TbIcons = require('react-icons/tb');
|
|
31
|
+
var CiIcons = require('react-icons/ci');
|
|
31
32
|
|
|
32
33
|
function _interopNamespace(e) {
|
|
33
34
|
if (e && e.__esModule) return e;
|
|
@@ -64,6 +65,7 @@ var FiIcons__namespace = /*#__PURE__*/_interopNamespace(FiIcons);
|
|
|
64
65
|
var IoIcons__namespace = /*#__PURE__*/_interopNamespace(IoIcons);
|
|
65
66
|
var RiIcons__namespace = /*#__PURE__*/_interopNamespace(RiIcons);
|
|
66
67
|
var TbIcons__namespace = /*#__PURE__*/_interopNamespace(TbIcons);
|
|
68
|
+
var CiIcons__namespace = /*#__PURE__*/_interopNamespace(CiIcons);
|
|
67
69
|
|
|
68
70
|
var ExampleComponent = ({ children, className = "" }) => {
|
|
69
71
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `cls_example_component ${className}`, children });
|
|
@@ -1230,7 +1232,8 @@ var iconSetMap = {
|
|
|
1230
1232
|
io: IoIcons__namespace,
|
|
1231
1233
|
io5: IoIcons__namespace,
|
|
1232
1234
|
ri: RiIcons__namespace,
|
|
1233
|
-
tb: TbIcons__namespace
|
|
1235
|
+
tb: TbIcons__namespace,
|
|
1236
|
+
ci: CiIcons__namespace
|
|
1234
1237
|
};
|
|
1235
1238
|
function getIconLibrary(iconSet) {
|
|
1236
1239
|
if (!iconSet) return null;
|
|
@@ -1253,7 +1256,8 @@ function MultiStateRadio({
|
|
|
1253
1256
|
selection = "single",
|
|
1254
1257
|
value,
|
|
1255
1258
|
onChange,
|
|
1256
|
-
className
|
|
1259
|
+
className,
|
|
1260
|
+
compressed = false
|
|
1257
1261
|
}) {
|
|
1258
1262
|
const handleSingleSelection = (selectedValue) => {
|
|
1259
1263
|
onChange(selectedValue);
|
|
@@ -1284,7 +1288,8 @@ function MultiStateRadio({
|
|
|
1284
1288
|
className: cn(
|
|
1285
1289
|
"cls_radio_option flex items-center gap-2",
|
|
1286
1290
|
layout === "horizontal" ? "flex-row" : "flex-col",
|
|
1287
|
-
"p-2 rounded-md
|
|
1291
|
+
compressed ? "" : "p-2 rounded-md",
|
|
1292
|
+
"hover:bg-accent transition-colors",
|
|
1288
1293
|
selected && "bg-accent"
|
|
1289
1294
|
),
|
|
1290
1295
|
children: [
|
|
@@ -1318,7 +1323,8 @@ function MultiStateRadio({
|
|
|
1318
1323
|
className: cn(
|
|
1319
1324
|
"cls_radio_option flex items-center gap-2 cursor-pointer",
|
|
1320
1325
|
layout === "horizontal" ? "flex-row" : "flex-col",
|
|
1321
|
-
"p-2 rounded-md
|
|
1326
|
+
compressed ? "" : "p-2 rounded-md",
|
|
1327
|
+
"hover:bg-accent transition-colors",
|
|
1322
1328
|
selected && "bg-accent"
|
|
1323
1329
|
),
|
|
1324
1330
|
onClick: () => handleMultiSelection(item.value),
|
|
@@ -1373,6 +1379,10 @@ function MultiStateRadio({
|
|
|
1373
1379
|
const SelectedIcon = icon_set && item.icon_selected ? getIconComponent(icon_set, item.icon_selected) : null;
|
|
1374
1380
|
const UnselectedIcon = icon_set && item.icon_unselected ? getIconComponent(icon_set, item.icon_unselected) : null;
|
|
1375
1381
|
const IconComponent = selected && SelectedIcon ? SelectedIcon : UnselectedIcon || SelectedIcon;
|
|
1382
|
+
const buttonStyles = {};
|
|
1383
|
+
if (item.bgcolor) {
|
|
1384
|
+
buttonStyles.backgroundColor = item.bgcolor;
|
|
1385
|
+
}
|
|
1376
1386
|
const buttonContent = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1377
1387
|
Button,
|
|
1378
1388
|
{
|
|
@@ -1381,10 +1391,13 @@ function MultiStateRadio({
|
|
|
1381
1391
|
className: cn(
|
|
1382
1392
|
"cls_icon_option border-0",
|
|
1383
1393
|
layout === "horizontal" ? "flex-row" : "flex-col",
|
|
1384
|
-
"gap-2 h-auto
|
|
1385
|
-
|
|
1386
|
-
|
|
1394
|
+
"gap-2 h-auto",
|
|
1395
|
+
compressed ? "py-0 px-0" : "py-2 px-3 sm:py-3 sm:px-4",
|
|
1396
|
+
// Only apply default colors if custom colors are not provided
|
|
1397
|
+
!item.bgcolor && selected && "bg-primary text-primary-foreground",
|
|
1398
|
+
!item.bgcolor && !selected && "hover:bg-accent"
|
|
1387
1399
|
),
|
|
1400
|
+
style: Object.keys(buttonStyles).length > 0 ? buttonStyles : void 0,
|
|
1388
1401
|
onClick: () => {
|
|
1389
1402
|
if (selection === "single") {
|
|
1390
1403
|
handleSingleSelection(item.value);
|
|
@@ -1395,8 +1408,21 @@ function MultiStateRadio({
|
|
|
1395
1408
|
"aria-label": item.label,
|
|
1396
1409
|
"aria-pressed": selected,
|
|
1397
1410
|
children: [
|
|
1398
|
-
IconComponent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1399
|
-
|
|
1411
|
+
IconComponent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1412
|
+
IconComponent,
|
|
1413
|
+
{
|
|
1414
|
+
className: "cls_icon h-4 w-4 sm:h-5 sm:w-5",
|
|
1415
|
+
style: item.fgcolor ? { color: item.fgcolor } : void 0
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
display_label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1419
|
+
"span",
|
|
1420
|
+
{
|
|
1421
|
+
className: "cls_icon_label text-sm font-medium",
|
|
1422
|
+
style: item.fgcolor ? { color: item.fgcolor } : void 0,
|
|
1423
|
+
children: item.label
|
|
1424
|
+
}
|
|
1425
|
+
)
|
|
1400
1426
|
]
|
|
1401
1427
|
}
|
|
1402
1428
|
);
|
|
@@ -1406,8 +1432,15 @@ function MultiStateRadio({
|
|
|
1406
1432
|
] }, item.value);
|
|
1407
1433
|
};
|
|
1408
1434
|
const containerClasses = cn(
|
|
1409
|
-
"cls_multi_state_radio border border-input rounded-md
|
|
1410
|
-
|
|
1435
|
+
"cls_multi_state_radio border border-input rounded-md",
|
|
1436
|
+
compressed ? "" : "p-2 sm:p-3",
|
|
1437
|
+
layout === "horizontal" ? cn(
|
|
1438
|
+
"flex flex-row flex-wrap",
|
|
1439
|
+
compressed ? "gap-0" : "gap-2 sm:gap-3"
|
|
1440
|
+
) : cn(
|
|
1441
|
+
"flex flex-col",
|
|
1442
|
+
compressed ? "gap-0" : "gap-2 sm:gap-3"
|
|
1443
|
+
),
|
|
1411
1444
|
className
|
|
1412
1445
|
);
|
|
1413
1446
|
const radioGroupClasses = cn(
|