@sarunyu/system-one 4.0.3 → 4.1.0
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 +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/dist/src/components/table.d.ts.map +1 -1
- package/llms.txt +103 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3850,7 +3850,7 @@ const Table = forwardRef(function Table2({ className, responsive = true, ...prop
|
|
|
3850
3850
|
return /* @__PURE__ */ jsx(TableScrollShadowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { ref: scrollRef, className: "w-full overflow-x-auto", children: table }) });
|
|
3851
3851
|
});
|
|
3852
3852
|
const TableRow = forwardRef(
|
|
3853
|
-
function TableRow2({ className, selected = false, hoverable =
|
|
3853
|
+
function TableRow2({ className, selected = false, hoverable = true, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
3854
3854
|
const [hovered, setHovered] = useState(false);
|
|
3855
3855
|
const handleMouseEnter = (e) => {
|
|
3856
3856
|
if (hoverable) setHovered(true);
|
|
@@ -3883,7 +3883,7 @@ const TableHeaderCell = forwardRef(
|
|
|
3883
3883
|
state = "default",
|
|
3884
3884
|
sortable = true,
|
|
3885
3885
|
icon,
|
|
3886
|
-
sortDirection
|
|
3886
|
+
sortDirection,
|
|
3887
3887
|
onSortChange,
|
|
3888
3888
|
checkState = false,
|
|
3889
3889
|
onCheckChange,
|
|
@@ -3892,16 +3892,22 @@ const TableHeaderCell = forwardRef(
|
|
|
3892
3892
|
fixedShadow,
|
|
3893
3893
|
children = "Title text",
|
|
3894
3894
|
style: styleProp,
|
|
3895
|
+
onClick: onClickProp,
|
|
3895
3896
|
...props
|
|
3896
3897
|
}, ref) {
|
|
3897
3898
|
const { hasLeftOverflow, hasRightOverflow } = useContext(TableScrollShadowContext);
|
|
3899
|
+
const [internalDirection, setInternalDirection] = useState("none");
|
|
3900
|
+
const isControlledSort = sortDirection !== void 0;
|
|
3901
|
+
const currentDirection = isControlledSort ? sortDirection : internalDirection;
|
|
3898
3902
|
const stateClass = state === "disabled" ? "bg-[var(--bg-default-tertiary,#f3f4f6)] text-[var(--text-default-tertiary,#6a7282)]" : state === "hover" ? "bg-[var(--bg-default-secondary,#f9fafb)] text-[var(--text-default-tertiary,#6a7282)]" : "bg-[var(--bg-default-primary,white)] text-[var(--text-default-tertiary,#6a7282)]";
|
|
3899
3903
|
const interactiveHoverClass = state === "default" ? "hover:bg-[var(--bg-default-secondary,#f9fafb)]" : "";
|
|
3900
|
-
const sortIcon =
|
|
3901
|
-
const
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3904
|
+
const sortIcon = currentDirection === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { size: 16, weight: "fill", className: "shrink-0" }) : currentDirection === "desc" ? /* @__PURE__ */ jsx(ArrowDown, { size: 16, weight: "fill", className: "shrink-0" }) : /* @__PURE__ */ jsx(ArrowsDownUp, { size: 16, weight: "fill", className: "shrink-0" });
|
|
3905
|
+
const handleClick = (e) => {
|
|
3906
|
+
onClickProp == null ? void 0 : onClickProp(e);
|
|
3907
|
+
if (type !== "text" || !sortable || state === "disabled") return;
|
|
3908
|
+
const nextDirection = currentDirection === "none" ? "asc" : currentDirection === "asc" ? "desc" : "none";
|
|
3909
|
+
if (!isControlledSort) setInternalDirection(nextDirection);
|
|
3910
|
+
onSortChange == null ? void 0 : onSortChange(nextDirection);
|
|
3905
3911
|
};
|
|
3906
3912
|
const content = type === "text" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3907
3913
|
/* @__PURE__ */ jsx("span", { className: "text-sm leading-5 font-normal", children }),
|
|
@@ -3928,12 +3934,12 @@ const TableHeaderCell = forwardRef(
|
|
|
3928
3934
|
stateClass,
|
|
3929
3935
|
interactiveHoverClass,
|
|
3930
3936
|
fixed && "sticky z-20",
|
|
3931
|
-
sortable && type === "text" &&
|
|
3937
|
+
sortable && type === "text" && state !== "disabled" && "cursor-pointer select-none",
|
|
3932
3938
|
className
|
|
3933
3939
|
),
|
|
3934
3940
|
style: { ...fixedStyle, ...styleProp },
|
|
3935
3941
|
...props,
|
|
3936
|
-
onClick:
|
|
3942
|
+
onClick: handleClick,
|
|
3937
3943
|
children: [
|
|
3938
3944
|
shadowDirection && shouldShowShadow && /* @__PURE__ */ jsx(StickyShadowEdge, { direction: shadowDirection }),
|
|
3939
3945
|
/* @__PURE__ */ jsx(
|