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.d.cts
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";
|
|
@@ -77,11 +79,12 @@ interface MultiStateRadioProps {
|
|
|
77
79
|
value: string | string[];
|
|
78
80
|
onChange: (value: string | string[]) => void;
|
|
79
81
|
className?: string;
|
|
82
|
+
compressed?: boolean;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
85
|
* Multi State Radio Component
|
|
83
86
|
* Supports single and multi-selection with radio buttons or icons
|
|
84
87
|
*/
|
|
85
|
-
declare function MultiStateRadio({ layout, style, display_label, icon_set, data, selection, value, onChange, className, }: MultiStateRadioProps): react_jsx_runtime.JSX.Element;
|
|
88
|
+
declare function MultiStateRadio({ layout, style, display_label, icon_set, data, selection, value, onChange, className, compressed, }: MultiStateRadioProps): react_jsx_runtime.JSX.Element;
|
|
86
89
|
|
|
87
90
|
export { ExampleComponent, type FilterConfig, type FilterField, MultiFilterDialog, MultiSortDialog, MultiStateRadio, type MultiStateRadioItem, type MultiStateRadioProps, type SortConfig, type SortField };
|
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";
|
|
@@ -77,11 +79,12 @@ interface MultiStateRadioProps {
|
|
|
77
79
|
value: string | string[];
|
|
78
80
|
onChange: (value: string | string[]) => void;
|
|
79
81
|
className?: string;
|
|
82
|
+
compressed?: boolean;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
85
|
* Multi State Radio Component
|
|
83
86
|
* Supports single and multi-selection with radio buttons or icons
|
|
84
87
|
*/
|
|
85
|
-
declare function MultiStateRadio({ layout, style, display_label, icon_set, data, selection, value, onChange, className, }: MultiStateRadioProps): react_jsx_runtime.JSX.Element;
|
|
88
|
+
declare function MultiStateRadio({ layout, style, display_label, icon_set, data, selection, value, onChange, className, compressed, }: MultiStateRadioProps): react_jsx_runtime.JSX.Element;
|
|
86
89
|
|
|
87
90
|
export { ExampleComponent, type FilterConfig, type FilterField, MultiFilterDialog, MultiSortDialog, MultiStateRadio, type MultiStateRadioItem, type MultiStateRadioProps, type SortConfig, type SortField };
|
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;
|
|
@@ -1216,7 +1218,8 @@ function MultiStateRadio({
|
|
|
1216
1218
|
selection = "single",
|
|
1217
1219
|
value,
|
|
1218
1220
|
onChange,
|
|
1219
|
-
className
|
|
1221
|
+
className,
|
|
1222
|
+
compressed = false
|
|
1220
1223
|
}) {
|
|
1221
1224
|
const handleSingleSelection = (selectedValue) => {
|
|
1222
1225
|
onChange(selectedValue);
|
|
@@ -1247,7 +1250,8 @@ function MultiStateRadio({
|
|
|
1247
1250
|
className: cn(
|
|
1248
1251
|
"cls_radio_option flex items-center gap-2",
|
|
1249
1252
|
layout === "horizontal" ? "flex-row" : "flex-col",
|
|
1250
|
-
"p-2 rounded-md
|
|
1253
|
+
compressed ? "" : "p-2 rounded-md",
|
|
1254
|
+
"hover:bg-accent transition-colors",
|
|
1251
1255
|
selected && "bg-accent"
|
|
1252
1256
|
),
|
|
1253
1257
|
children: [
|
|
@@ -1281,7 +1285,8 @@ function MultiStateRadio({
|
|
|
1281
1285
|
className: cn(
|
|
1282
1286
|
"cls_radio_option flex items-center gap-2 cursor-pointer",
|
|
1283
1287
|
layout === "horizontal" ? "flex-row" : "flex-col",
|
|
1284
|
-
"p-2 rounded-md
|
|
1288
|
+
compressed ? "" : "p-2 rounded-md",
|
|
1289
|
+
"hover:bg-accent transition-colors",
|
|
1285
1290
|
selected && "bg-accent"
|
|
1286
1291
|
),
|
|
1287
1292
|
onClick: () => handleMultiSelection(item.value),
|
|
@@ -1336,6 +1341,10 @@ function MultiStateRadio({
|
|
|
1336
1341
|
const SelectedIcon = icon_set && item.icon_selected ? getIconComponent(icon_set, item.icon_selected) : null;
|
|
1337
1342
|
const UnselectedIcon = icon_set && item.icon_unselected ? getIconComponent(icon_set, item.icon_unselected) : null;
|
|
1338
1343
|
const IconComponent = selected && SelectedIcon ? SelectedIcon : UnselectedIcon || SelectedIcon;
|
|
1344
|
+
const buttonStyles = {};
|
|
1345
|
+
if (item.bgcolor) {
|
|
1346
|
+
buttonStyles.backgroundColor = item.bgcolor;
|
|
1347
|
+
}
|
|
1339
1348
|
const buttonContent = /* @__PURE__ */ jsxs(
|
|
1340
1349
|
Button,
|
|
1341
1350
|
{
|
|
@@ -1344,10 +1353,13 @@ function MultiStateRadio({
|
|
|
1344
1353
|
className: cn(
|
|
1345
1354
|
"cls_icon_option border-0",
|
|
1346
1355
|
layout === "horizontal" ? "flex-row" : "flex-col",
|
|
1347
|
-
"gap-2 h-auto
|
|
1348
|
-
|
|
1349
|
-
|
|
1356
|
+
"gap-2 h-auto",
|
|
1357
|
+
compressed ? "py-0 px-0" : "py-2 px-3 sm:py-3 sm:px-4",
|
|
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"
|
|
1350
1361
|
),
|
|
1362
|
+
style: Object.keys(buttonStyles).length > 0 ? buttonStyles : void 0,
|
|
1351
1363
|
onClick: () => {
|
|
1352
1364
|
if (selection === "single") {
|
|
1353
1365
|
handleSingleSelection(item.value);
|
|
@@ -1358,8 +1370,21 @@ function MultiStateRadio({
|
|
|
1358
1370
|
"aria-label": item.label,
|
|
1359
1371
|
"aria-pressed": selected,
|
|
1360
1372
|
children: [
|
|
1361
|
-
IconComponent && /* @__PURE__ */ jsx(
|
|
1362
|
-
|
|
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
|
+
)
|
|
1363
1388
|
]
|
|
1364
1389
|
}
|
|
1365
1390
|
);
|
|
@@ -1369,8 +1394,15 @@ function MultiStateRadio({
|
|
|
1369
1394
|
] }, item.value);
|
|
1370
1395
|
};
|
|
1371
1396
|
const containerClasses = cn(
|
|
1372
|
-
"cls_multi_state_radio border border-input rounded-md
|
|
1373
|
-
|
|
1397
|
+
"cls_multi_state_radio border border-input rounded-md",
|
|
1398
|
+
compressed ? "" : "p-2 sm:p-3",
|
|
1399
|
+
layout === "horizontal" ? cn(
|
|
1400
|
+
"flex flex-row flex-wrap",
|
|
1401
|
+
compressed ? "gap-0" : "gap-2 sm:gap-3"
|
|
1402
|
+
) : cn(
|
|
1403
|
+
"flex flex-col",
|
|
1404
|
+
compressed ? "gap-0" : "gap-2 sm:gap-3"
|
|
1405
|
+
),
|
|
1374
1406
|
className
|
|
1375
1407
|
);
|
|
1376
1408
|
const radioGroupClasses = cn(
|