@ceed/cds 1.7.7 → 1.7.8
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 +36 -17
- package/dist/index.js +37 -18
- package/framer/index.js +39 -39
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2924,7 +2924,7 @@ function getTextAlign(props) {
|
|
|
2924
2924
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2925
2925
|
}
|
|
2926
2926
|
var DefaultLoadingOverlay = () => /* @__PURE__ */ import_react25.default.createElement(import_joy33.LinearProgress, { value: 8, variant: "plain" });
|
|
2927
|
-
var
|
|
2927
|
+
var EllipsisDiv = (0, import_joy33.styled)("div", {
|
|
2928
2928
|
name: "DataTable",
|
|
2929
2929
|
slot: "textEllipsis"
|
|
2930
2930
|
})({
|
|
@@ -2932,6 +2932,22 @@ var TextEllipsis = (0, import_joy33.styled)("div", {
|
|
|
2932
2932
|
textOverflow: "ellipsis",
|
|
2933
2933
|
whiteSpace: "nowrap"
|
|
2934
2934
|
});
|
|
2935
|
+
var TextEllipsis = ({ children }) => {
|
|
2936
|
+
const textRef = (0, import_react25.useRef)(null);
|
|
2937
|
+
const [showTooltip, setShowTooltip] = (0, import_react25.useState)(false);
|
|
2938
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
2939
|
+
const element = textRef.current;
|
|
2940
|
+
if (element) {
|
|
2941
|
+
const isTextTruncated = element.scrollWidth > element.clientWidth;
|
|
2942
|
+
setShowTooltip(isTextTruncated);
|
|
2943
|
+
}
|
|
2944
|
+
}, [children]);
|
|
2945
|
+
const content = /* @__PURE__ */ import_react25.default.createElement(EllipsisDiv, { ref: textRef }, children);
|
|
2946
|
+
if (showTooltip) {
|
|
2947
|
+
return /* @__PURE__ */ import_react25.default.createElement(Tooltip_default, { title: children, placement: "top" }, content);
|
|
2948
|
+
}
|
|
2949
|
+
return content;
|
|
2950
|
+
};
|
|
2935
2951
|
var OverlayWrapper = (0, import_joy33.styled)("tr", {
|
|
2936
2952
|
name: "DataTable",
|
|
2937
2953
|
slot: "overlayWrapper"
|
|
@@ -3080,6 +3096,7 @@ var HeadCell = (props) => {
|
|
|
3080
3096
|
} = props;
|
|
3081
3097
|
const theme = (0, import_joy33.useTheme)();
|
|
3082
3098
|
const ref = headerRef;
|
|
3099
|
+
const [isHovered, setIsHovered] = (0, import_react25.useState)(false);
|
|
3083
3100
|
const sortable = type === "actions" ? false : _sortable;
|
|
3084
3101
|
const headId = (0, import_react25.useMemo)(
|
|
3085
3102
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -3117,10 +3134,13 @@ var HeadCell = (props) => {
|
|
|
3117
3134
|
);
|
|
3118
3135
|
const textAlign = getTextAlign(props);
|
|
3119
3136
|
const initialSort = sortOrder[0];
|
|
3120
|
-
const sortIcon = (0, import_react25.useMemo)(
|
|
3121
|
-
|
|
3137
|
+
const sortIcon = (0, import_react25.useMemo)(() => {
|
|
3138
|
+
const isSorted = !!sort;
|
|
3139
|
+
const isVisible = sortable && (isSorted || isHovered);
|
|
3140
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_framer_motion21.AnimatePresence, { mode: "wait" }, isVisible && /* @__PURE__ */ import_react25.default.createElement(
|
|
3122
3141
|
MotionSortIcon,
|
|
3123
3142
|
{
|
|
3143
|
+
key: "sort-icon",
|
|
3124
3144
|
style: {
|
|
3125
3145
|
width: "16px",
|
|
3126
3146
|
height: "16px"
|
|
@@ -3129,25 +3149,22 @@ var HeadCell = (props) => {
|
|
|
3129
3149
|
"aria-labelledby": headId,
|
|
3130
3150
|
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3131
3151
|
"data-testid": void 0,
|
|
3132
|
-
|
|
3133
|
-
hover: { opacity: 1 },
|
|
3134
|
-
initial: { opacity: 0 }
|
|
3135
|
-
},
|
|
3152
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
3136
3153
|
animate: {
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3154
|
+
opacity: 1,
|
|
3155
|
+
scale: 1,
|
|
3156
|
+
color: isSorted ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3157
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0
|
|
3140
3158
|
},
|
|
3159
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
3141
3160
|
transition: {
|
|
3142
|
-
duration: 0,
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3161
|
+
duration: 0.2,
|
|
3162
|
+
ease: "easeInOut",
|
|
3163
|
+
rotate: { duration: 0.2, ease: "easeOut" }
|
|
3146
3164
|
}
|
|
3147
3165
|
}
|
|
3148
|
-
)
|
|
3149
|
-
|
|
3150
|
-
);
|
|
3166
|
+
));
|
|
3167
|
+
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3151
3168
|
const infoSign = (0, import_react25.useMemo)(
|
|
3152
3169
|
() => description ? /* @__PURE__ */ import_react25.default.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3153
3170
|
[description]
|
|
@@ -3165,6 +3182,8 @@ var HeadCell = (props) => {
|
|
|
3165
3182
|
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3166
3183
|
[field, onSortChange, sort, sortable]
|
|
3167
3184
|
),
|
|
3185
|
+
onMouseEnter: () => setIsHovered(true),
|
|
3186
|
+
onMouseLeave: () => setIsHovered(false),
|
|
3168
3187
|
whileHover: "hover",
|
|
3169
3188
|
initial: "initial"
|
|
3170
3189
|
},
|
package/dist/index.js
CHANGED
|
@@ -2665,7 +2665,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
2665
2665
|
var Tooltip_default = Tooltip;
|
|
2666
2666
|
|
|
2667
2667
|
// src/components/DataTable/DataTable.tsx
|
|
2668
|
-
import { motion as motion21 } from "framer-motion";
|
|
2668
|
+
import { motion as motion21, AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2669
2669
|
|
|
2670
2670
|
// src/components/Pagination/Pagination.tsx
|
|
2671
2671
|
import React21, { useCallback as useCallback8, useEffect as useEffect4 } from "react";
|
|
@@ -2892,7 +2892,7 @@ function getTextAlign(props) {
|
|
|
2892
2892
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2893
2893
|
}
|
|
2894
2894
|
var DefaultLoadingOverlay = () => /* @__PURE__ */ React23.createElement(LinearProgress, { value: 8, variant: "plain" });
|
|
2895
|
-
var
|
|
2895
|
+
var EllipsisDiv = styled12("div", {
|
|
2896
2896
|
name: "DataTable",
|
|
2897
2897
|
slot: "textEllipsis"
|
|
2898
2898
|
})({
|
|
@@ -2900,6 +2900,22 @@ var TextEllipsis = styled12("div", {
|
|
|
2900
2900
|
textOverflow: "ellipsis",
|
|
2901
2901
|
whiteSpace: "nowrap"
|
|
2902
2902
|
});
|
|
2903
|
+
var TextEllipsis = ({ children }) => {
|
|
2904
|
+
const textRef = useRef4(null);
|
|
2905
|
+
const [showTooltip, setShowTooltip] = useState6(false);
|
|
2906
|
+
useLayoutEffect(() => {
|
|
2907
|
+
const element = textRef.current;
|
|
2908
|
+
if (element) {
|
|
2909
|
+
const isTextTruncated = element.scrollWidth > element.clientWidth;
|
|
2910
|
+
setShowTooltip(isTextTruncated);
|
|
2911
|
+
}
|
|
2912
|
+
}, [children]);
|
|
2913
|
+
const content = /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef }, children);
|
|
2914
|
+
if (showTooltip) {
|
|
2915
|
+
return /* @__PURE__ */ React23.createElement(Tooltip_default, { title: children, placement: "top" }, content);
|
|
2916
|
+
}
|
|
2917
|
+
return content;
|
|
2918
|
+
};
|
|
2903
2919
|
var OverlayWrapper = styled12("tr", {
|
|
2904
2920
|
name: "DataTable",
|
|
2905
2921
|
slot: "overlayWrapper"
|
|
@@ -3048,6 +3064,7 @@ var HeadCell = (props) => {
|
|
|
3048
3064
|
} = props;
|
|
3049
3065
|
const theme = useTheme();
|
|
3050
3066
|
const ref = headerRef;
|
|
3067
|
+
const [isHovered, setIsHovered] = useState6(false);
|
|
3051
3068
|
const sortable = type === "actions" ? false : _sortable;
|
|
3052
3069
|
const headId = useMemo8(
|
|
3053
3070
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -3085,10 +3102,13 @@ var HeadCell = (props) => {
|
|
|
3085
3102
|
);
|
|
3086
3103
|
const textAlign = getTextAlign(props);
|
|
3087
3104
|
const initialSort = sortOrder[0];
|
|
3088
|
-
const sortIcon = useMemo8(
|
|
3089
|
-
|
|
3105
|
+
const sortIcon = useMemo8(() => {
|
|
3106
|
+
const isSorted = !!sort;
|
|
3107
|
+
const isVisible = sortable && (isSorted || isHovered);
|
|
3108
|
+
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
3090
3109
|
MotionSortIcon,
|
|
3091
3110
|
{
|
|
3111
|
+
key: "sort-icon",
|
|
3092
3112
|
style: {
|
|
3093
3113
|
width: "16px",
|
|
3094
3114
|
height: "16px"
|
|
@@ -3097,25 +3117,22 @@ var HeadCell = (props) => {
|
|
|
3097
3117
|
"aria-labelledby": headId,
|
|
3098
3118
|
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3099
3119
|
"data-testid": void 0,
|
|
3100
|
-
|
|
3101
|
-
hover: { opacity: 1 },
|
|
3102
|
-
initial: { opacity: 0 }
|
|
3103
|
-
},
|
|
3120
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
3104
3121
|
animate: {
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3122
|
+
opacity: 1,
|
|
3123
|
+
scale: 1,
|
|
3124
|
+
color: isSorted ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3125
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0
|
|
3108
3126
|
},
|
|
3127
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
3109
3128
|
transition: {
|
|
3110
|
-
duration: 0,
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3129
|
+
duration: 0.2,
|
|
3130
|
+
ease: "easeInOut",
|
|
3131
|
+
rotate: { duration: 0.2, ease: "easeOut" }
|
|
3114
3132
|
}
|
|
3115
3133
|
}
|
|
3116
|
-
)
|
|
3117
|
-
|
|
3118
|
-
);
|
|
3134
|
+
));
|
|
3135
|
+
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3119
3136
|
const infoSign = useMemo8(
|
|
3120
3137
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3121
3138
|
[description]
|
|
@@ -3133,6 +3150,8 @@ var HeadCell = (props) => {
|
|
|
3133
3150
|
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3134
3151
|
[field, onSortChange, sort, sortable]
|
|
3135
3152
|
),
|
|
3153
|
+
onMouseEnter: () => setIsHovered(true),
|
|
3154
|
+
onMouseLeave: () => setIsHovered(false),
|
|
3136
3155
|
whileHover: "hover",
|
|
3137
3156
|
initial: "initial"
|
|
3138
3157
|
},
|