@farmzone/fz-react-ui 1.0.14 → 1.0.16
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 +67 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +67 -51
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1096,43 +1096,50 @@ function Radio(props) {
|
|
|
1096
1096
|
"--radio-checked": checkColor,
|
|
1097
1097
|
"--radio-unchecked": unCheckColor
|
|
1098
1098
|
};
|
|
1099
|
-
const control = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
"border-(--radio-unchecked) data-[state=checked]:border-(--radio-checked)",
|
|
1109
|
-
"data-[state=unchecked]:hover:opacity-80",
|
|
1110
|
-
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
1111
|
-
),
|
|
1112
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "relative flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
|
-
lucideReact.CircleIcon,
|
|
1099
|
+
const control = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1100
|
+
"label",
|
|
1101
|
+
{
|
|
1102
|
+
htmlFor: inputId,
|
|
1103
|
+
className: cn("flex items-center gap-1.5", disabled ? "cursor-not-allowed" : "cursor-pointer", wrapperClassName),
|
|
1104
|
+
style: colorVars,
|
|
1105
|
+
children: [
|
|
1106
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
+
RadioGroupPrimitive__namespace.Item,
|
|
1114
1108
|
{
|
|
1109
|
+
value,
|
|
1110
|
+
disabled,
|
|
1111
|
+
id: inputId,
|
|
1115
1112
|
className: cn(
|
|
1116
|
-
"
|
|
1117
|
-
|
|
1118
|
-
|
|
1113
|
+
"group relative size-4 shrink-0 rounded-full border box-border transition-colors duration-200 outline-none",
|
|
1114
|
+
"border-(--radio-unchecked) data-[state=checked]:border-(--radio-checked)",
|
|
1115
|
+
"data-[state=unchecked]:hover:opacity-80",
|
|
1116
|
+
disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
1117
|
+
),
|
|
1118
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "relative flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
+
lucideReact.CircleIcon,
|
|
1120
|
+
{
|
|
1121
|
+
className: cn(
|
|
1122
|
+
"absolute top-1/2 left-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 fill-(--radio-checked) text-(--radio-checked) transition-opacity duration-200",
|
|
1123
|
+
indicatorClassName
|
|
1124
|
+
)
|
|
1125
|
+
}
|
|
1126
|
+
) })
|
|
1119
1127
|
}
|
|
1120
|
-
) })
|
|
1121
|
-
}
|
|
1122
|
-
),
|
|
1123
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1124
|
-
"label",
|
|
1125
|
-
{
|
|
1126
|
-
htmlFor: inputId,
|
|
1127
|
-
className: cn(
|
|
1128
|
-
"text-sm font-medium cursor-pointer text-black select-none",
|
|
1129
|
-
disabled && "cursor-not-allowed text-gray-400 opacity-50",
|
|
1130
|
-
labelClassName
|
|
1131
1128
|
),
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1129
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
+
"span",
|
|
1131
|
+
{
|
|
1132
|
+
className: cn(
|
|
1133
|
+
"text-sm font-medium text-black select-none",
|
|
1134
|
+
disabled && "text-gray-400 opacity-50",
|
|
1135
|
+
labelClassName
|
|
1136
|
+
),
|
|
1137
|
+
children: label
|
|
1138
|
+
}
|
|
1139
|
+
)
|
|
1140
|
+
]
|
|
1141
|
+
}
|
|
1142
|
+
);
|
|
1136
1143
|
const withTooltip = (node) => {
|
|
1137
1144
|
if (!disabled || !disabledMessage) return node;
|
|
1138
1145
|
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip2, { content: disabledMessage, position: "bottom", asChild: true, sideOffset: 4, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: node }) });
|
|
@@ -1179,11 +1186,7 @@ function RadioGroup(props) {
|
|
|
1179
1186
|
value,
|
|
1180
1187
|
onValueChange: (newValue) => onChange(newValue),
|
|
1181
1188
|
disabled,
|
|
1182
|
-
className: cn(
|
|
1183
|
-
"flex flex-wrap gap-3",
|
|
1184
|
-
direction === "horizontal" ? "flex-row" : "flex-col",
|
|
1185
|
-
containerClassName
|
|
1186
|
-
),
|
|
1189
|
+
className: cn("flex flex-wrap gap-3", direction === "horizontal" ? "flex-row" : "flex-col", containerClassName),
|
|
1187
1190
|
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1188
1191
|
Radio,
|
|
1189
1192
|
{
|
|
@@ -1428,7 +1431,8 @@ function getVisiblePageRange(currentPage, totalPages) {
|
|
|
1428
1431
|
return { start, end };
|
|
1429
1432
|
}
|
|
1430
1433
|
function Pagination(props) {
|
|
1431
|
-
const { page = 0, totalPages =
|
|
1434
|
+
const { page = 0, totalPages: rawTotalPages = 0, onPageChange } = props;
|
|
1435
|
+
const totalPages = Math.max(1, rawTotalPages);
|
|
1432
1436
|
const [displayPage, setDisplayPage] = React6.useState(page);
|
|
1433
1437
|
React6.useEffect(() => {
|
|
1434
1438
|
setDisplayPage(page);
|
|
@@ -1440,6 +1444,7 @@ function Pagination(props) {
|
|
|
1440
1444
|
},
|
|
1441
1445
|
[onPageChange]
|
|
1442
1446
|
);
|
|
1447
|
+
const isEmpty = rawTotalPages === 0;
|
|
1443
1448
|
const pageButtons = React6.useMemo(() => {
|
|
1444
1449
|
const { start, end } = getVisiblePageRange(displayPage, totalPages);
|
|
1445
1450
|
const buttons = [];
|
|
@@ -1451,9 +1456,10 @@ function Pagination(props) {
|
|
|
1451
1456
|
"button",
|
|
1452
1457
|
{
|
|
1453
1458
|
type: "button",
|
|
1459
|
+
disabled: isEmpty,
|
|
1454
1460
|
className: cn(
|
|
1455
|
-
"min-w-7 min-h-7 rounded-[4px] text-[14px] px-[5px] font-medium
|
|
1456
|
-
isActive ? "bg-[#2675e2] text-white font-bold" : "bg-white text-[#000000] font-normal hover:bg-gray-50"
|
|
1461
|
+
"min-w-7 min-h-7 rounded-[4px] text-[14px] px-[5px] font-medium",
|
|
1462
|
+
isEmpty ? "bg-[#2675e2] text-white font-bold cursor-default" : isActive ? "bg-[#2675e2] text-white font-bold cursor-pointer" : "bg-white text-[#000000] font-normal hover:bg-gray-50 cursor-pointer"
|
|
1457
1463
|
),
|
|
1458
1464
|
onClick: () => handlePageChange(pageIndex),
|
|
1459
1465
|
children: displayPageNumber
|
|
@@ -1463,7 +1469,7 @@ function Pagination(props) {
|
|
|
1463
1469
|
);
|
|
1464
1470
|
}
|
|
1465
1471
|
return buttons;
|
|
1466
|
-
}, [displayPage, totalPages, handlePageChange]);
|
|
1472
|
+
}, [displayPage, totalPages, handlePageChange, isEmpty]);
|
|
1467
1473
|
const isFirstDisabled = displayPage <= 0;
|
|
1468
1474
|
const isPreviousDisabled = displayPage <= 0;
|
|
1469
1475
|
const isNextDisabled = displayPage >= totalPages - 1;
|
|
@@ -1483,9 +1489,6 @@ function Pagination(props) {
|
|
|
1483
1489
|
children
|
|
1484
1490
|
}
|
|
1485
1491
|
);
|
|
1486
|
-
if (!totalPages || totalPages === 0) {
|
|
1487
|
-
return null;
|
|
1488
|
-
}
|
|
1489
1492
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1.5", children: [
|
|
1490
1493
|
renderNavButton(
|
|
1491
1494
|
() => handlePageChange(0),
|
|
@@ -2825,7 +2828,7 @@ function DatePickerSingle(props) {
|
|
|
2825
2828
|
"div",
|
|
2826
2829
|
{
|
|
2827
2830
|
role: "button",
|
|
2828
|
-
tabIndex:
|
|
2831
|
+
tabIndex: -1,
|
|
2829
2832
|
"aria-hidden": disabled,
|
|
2830
2833
|
onClick: () => {
|
|
2831
2834
|
if (!disabled) toggleCalendar(inputValue);
|
|
@@ -5259,7 +5262,7 @@ function Table(props) {
|
|
|
5259
5262
|
] })
|
|
5260
5263
|
}
|
|
5261
5264
|
),
|
|
5262
|
-
!
|
|
5265
|
+
!showSkeleton && (paginationInfo || renderFooter?.renderLeft || renderFooter?.renderRight) && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: footerRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5263
5266
|
TableFooter,
|
|
5264
5267
|
{
|
|
5265
5268
|
paginationInfo,
|
|
@@ -9242,6 +9245,9 @@ function Sidebar(props) {
|
|
|
9242
9245
|
const [overflowVisible, setOverflowVisible] = React6.useState(true);
|
|
9243
9246
|
const [expandedItems, setExpandedItems] = React6.useState(/* @__PURE__ */ new Set());
|
|
9244
9247
|
const [expandedSubItems, setExpandedSubItems] = React6.useState(/* @__PURE__ */ new Set());
|
|
9248
|
+
const toggleCollapse = () => setIsCollapsed((prev) => !prev);
|
|
9249
|
+
const isHeaderRenderProp = typeof header === "function";
|
|
9250
|
+
const headerContent = isHeaderRenderProp ? header({ isCollapsed, toggleCollapse }) : header;
|
|
9245
9251
|
React6.useEffect(() => {
|
|
9246
9252
|
if (isCollapsed) {
|
|
9247
9253
|
setOverflowVisible(false);
|
|
@@ -9316,21 +9322,22 @@ function Sidebar(props) {
|
|
|
9316
9322
|
${className ?? ""}
|
|
9317
9323
|
`,
|
|
9318
9324
|
children: [
|
|
9319
|
-
showCollapseButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9325
|
+
showCollapseButton && !isHeaderRenderProp && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9320
9326
|
"button",
|
|
9321
9327
|
{
|
|
9322
|
-
onClick:
|
|
9328
|
+
onClick: toggleCollapse,
|
|
9323
9329
|
className: `absolute top-4 z-20 w-6.5 h-6.5 rounded-full flex items-center justify-center transition-colors cursor-pointer ${s.collapseBtn} ${collapseButtonPlacement === "left" ? "left-2" : "right-2"}`,
|
|
9324
9330
|
children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRightClose, { size: 18, color: primaryColor ?? s.collapseIcon }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftClose, { size: 18, color: primaryColor ?? s.collapseIcon })
|
|
9325
9331
|
}
|
|
9326
9332
|
),
|
|
9333
|
+
isHeaderRenderProp && headerContent,
|
|
9327
9334
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-1 min-h-0 hide-scrollbar ${overflowVisible ? "overflow-y-auto" : "overflow-hidden"}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9328
9335
|
"div",
|
|
9329
9336
|
{
|
|
9330
9337
|
className: `transition-opacity duration-200 ease-in-out ${isCollapsed ? "opacity-0 pointer-events-none select-none" : "opacity-100"} ${variant === "system-dark" || variant === "system-light" ? "pb-6" : "px-4 pb-6"}`,
|
|
9331
9338
|
style: { transitionDelay: isCollapsed ? "0ms" : "150ms" },
|
|
9332
9339
|
children: [
|
|
9333
|
-
|
|
9340
|
+
!isHeaderRenderProp && headerContent,
|
|
9334
9341
|
/* @__PURE__ */ jsxRuntime.jsx("nav", { className: `space-y-6 ${variant === "system-dark" || variant === "system-light" ? "px-1" : ""}`, children: menuSections.map((section, sectionIndex) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
9335
9342
|
section.title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: s.sectionTitle, children: section.title }),
|
|
9336
9343
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: section.items.map((item) => {
|
|
@@ -9810,7 +9817,16 @@ function DetailModalFrame(props) {
|
|
|
9810
9817
|
] }),
|
|
9811
9818
|
/* @__PURE__ */ jsxRuntime.jsx(ModalFooter, { className: "flex justify-end", children: isEditMode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9812
9819
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", onClick: handleCancelEdit, disabled: controller.isSaving, children: "\uCDE8\uC18C" }),
|
|
9813
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9820
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9821
|
+
Button,
|
|
9822
|
+
{
|
|
9823
|
+
type: "submit",
|
|
9824
|
+
form: controller.formId,
|
|
9825
|
+
variant: "save",
|
|
9826
|
+
disabled: controller.isSaving || !controller.isDirty,
|
|
9827
|
+
children: "\uC800\uC7A5"
|
|
9828
|
+
}
|
|
9829
|
+
)
|
|
9814
9830
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9815
9831
|
canEdit && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", onClick: handleEdit, children: "\uC218\uC815" }),
|
|
9816
9832
|
renderFooterExtra,
|