@ceed/ads 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 +38 -38
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2938,7 +2938,7 @@ function getTextAlign(props) {
|
|
|
2938
2938
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2939
2939
|
}
|
|
2940
2940
|
var DefaultLoadingOverlay = () => /* @__PURE__ */ import_react25.default.createElement(import_joy33.LinearProgress, { value: 8, variant: "plain" });
|
|
2941
|
-
var
|
|
2941
|
+
var EllipsisDiv = (0, import_joy33.styled)("div", {
|
|
2942
2942
|
name: "DataTable",
|
|
2943
2943
|
slot: "textEllipsis"
|
|
2944
2944
|
})({
|
|
@@ -2946,6 +2946,22 @@ var TextEllipsis = (0, import_joy33.styled)("div", {
|
|
|
2946
2946
|
textOverflow: "ellipsis",
|
|
2947
2947
|
whiteSpace: "nowrap"
|
|
2948
2948
|
});
|
|
2949
|
+
var TextEllipsis = ({ children }) => {
|
|
2950
|
+
const textRef = (0, import_react25.useRef)(null);
|
|
2951
|
+
const [showTooltip, setShowTooltip] = (0, import_react25.useState)(false);
|
|
2952
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
2953
|
+
const element = textRef.current;
|
|
2954
|
+
if (element) {
|
|
2955
|
+
const isTextTruncated = element.scrollWidth > element.clientWidth;
|
|
2956
|
+
setShowTooltip(isTextTruncated);
|
|
2957
|
+
}
|
|
2958
|
+
}, [children]);
|
|
2959
|
+
const content = /* @__PURE__ */ import_react25.default.createElement(EllipsisDiv, { ref: textRef }, children);
|
|
2960
|
+
if (showTooltip) {
|
|
2961
|
+
return /* @__PURE__ */ import_react25.default.createElement(Tooltip_default, { title: children, placement: "top" }, content);
|
|
2962
|
+
}
|
|
2963
|
+
return content;
|
|
2964
|
+
};
|
|
2949
2965
|
var OverlayWrapper = (0, import_joy33.styled)("tr", {
|
|
2950
2966
|
name: "DataTable",
|
|
2951
2967
|
slot: "overlayWrapper"
|
|
@@ -3094,6 +3110,7 @@ var HeadCell = (props) => {
|
|
|
3094
3110
|
} = props;
|
|
3095
3111
|
const theme = (0, import_joy33.useTheme)();
|
|
3096
3112
|
const ref = headerRef;
|
|
3113
|
+
const [isHovered, setIsHovered] = (0, import_react25.useState)(false);
|
|
3097
3114
|
const sortable = type === "actions" ? false : _sortable;
|
|
3098
3115
|
const headId = (0, import_react25.useMemo)(
|
|
3099
3116
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -3131,10 +3148,13 @@ var HeadCell = (props) => {
|
|
|
3131
3148
|
);
|
|
3132
3149
|
const textAlign = getTextAlign(props);
|
|
3133
3150
|
const initialSort = sortOrder[0];
|
|
3134
|
-
const sortIcon = (0, import_react25.useMemo)(
|
|
3135
|
-
|
|
3151
|
+
const sortIcon = (0, import_react25.useMemo)(() => {
|
|
3152
|
+
const isSorted = !!sort;
|
|
3153
|
+
const isVisible = sortable && (isSorted || isHovered);
|
|
3154
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_framer_motion21.AnimatePresence, { mode: "wait" }, isVisible && /* @__PURE__ */ import_react25.default.createElement(
|
|
3136
3155
|
MotionSortIcon,
|
|
3137
3156
|
{
|
|
3157
|
+
key: "sort-icon",
|
|
3138
3158
|
style: {
|
|
3139
3159
|
width: "16px",
|
|
3140
3160
|
height: "16px"
|
|
@@ -3143,25 +3163,22 @@ var HeadCell = (props) => {
|
|
|
3143
3163
|
"aria-labelledby": headId,
|
|
3144
3164
|
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3145
3165
|
"data-testid": void 0,
|
|
3146
|
-
|
|
3147
|
-
hover: { opacity: 1 },
|
|
3148
|
-
initial: { opacity: 0 }
|
|
3149
|
-
},
|
|
3166
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
3150
3167
|
animate: {
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3168
|
+
opacity: 1,
|
|
3169
|
+
scale: 1,
|
|
3170
|
+
color: isSorted ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3171
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0
|
|
3154
3172
|
},
|
|
3173
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
3155
3174
|
transition: {
|
|
3156
|
-
duration: 0,
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3175
|
+
duration: 0.2,
|
|
3176
|
+
ease: "easeInOut",
|
|
3177
|
+
rotate: { duration: 0.2, ease: "easeOut" }
|
|
3160
3178
|
}
|
|
3161
3179
|
}
|
|
3162
|
-
)
|
|
3163
|
-
|
|
3164
|
-
);
|
|
3180
|
+
));
|
|
3181
|
+
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3165
3182
|
const infoSign = (0, import_react25.useMemo)(
|
|
3166
3183
|
() => description ? /* @__PURE__ */ import_react25.default.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3167
3184
|
[description]
|
|
@@ -3179,6 +3196,8 @@ var HeadCell = (props) => {
|
|
|
3179
3196
|
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3180
3197
|
[field, onSortChange, sort, sortable]
|
|
3181
3198
|
),
|
|
3199
|
+
onMouseEnter: () => setIsHovered(true),
|
|
3200
|
+
onMouseLeave: () => setIsHovered(false),
|
|
3182
3201
|
whileHover: "hover",
|
|
3183
3202
|
initial: "initial"
|
|
3184
3203
|
},
|
package/dist/index.js
CHANGED
|
@@ -2668,7 +2668,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
2668
2668
|
var Tooltip_default = Tooltip;
|
|
2669
2669
|
|
|
2670
2670
|
// src/components/DataTable/DataTable.tsx
|
|
2671
|
-
import { motion as motion21 } from "framer-motion";
|
|
2671
|
+
import { motion as motion21, AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2672
2672
|
|
|
2673
2673
|
// src/components/Pagination/Pagination.tsx
|
|
2674
2674
|
import React21, { useCallback as useCallback8, useEffect as useEffect4 } from "react";
|
|
@@ -2895,7 +2895,7 @@ function getTextAlign(props) {
|
|
|
2895
2895
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2896
2896
|
}
|
|
2897
2897
|
var DefaultLoadingOverlay = () => /* @__PURE__ */ React23.createElement(LinearProgress, { value: 8, variant: "plain" });
|
|
2898
|
-
var
|
|
2898
|
+
var EllipsisDiv = styled12("div", {
|
|
2899
2899
|
name: "DataTable",
|
|
2900
2900
|
slot: "textEllipsis"
|
|
2901
2901
|
})({
|
|
@@ -2903,6 +2903,22 @@ var TextEllipsis = styled12("div", {
|
|
|
2903
2903
|
textOverflow: "ellipsis",
|
|
2904
2904
|
whiteSpace: "nowrap"
|
|
2905
2905
|
});
|
|
2906
|
+
var TextEllipsis = ({ children }) => {
|
|
2907
|
+
const textRef = useRef4(null);
|
|
2908
|
+
const [showTooltip, setShowTooltip] = useState6(false);
|
|
2909
|
+
useLayoutEffect(() => {
|
|
2910
|
+
const element = textRef.current;
|
|
2911
|
+
if (element) {
|
|
2912
|
+
const isTextTruncated = element.scrollWidth > element.clientWidth;
|
|
2913
|
+
setShowTooltip(isTextTruncated);
|
|
2914
|
+
}
|
|
2915
|
+
}, [children]);
|
|
2916
|
+
const content = /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef }, children);
|
|
2917
|
+
if (showTooltip) {
|
|
2918
|
+
return /* @__PURE__ */ React23.createElement(Tooltip_default, { title: children, placement: "top" }, content);
|
|
2919
|
+
}
|
|
2920
|
+
return content;
|
|
2921
|
+
};
|
|
2906
2922
|
var OverlayWrapper = styled12("tr", {
|
|
2907
2923
|
name: "DataTable",
|
|
2908
2924
|
slot: "overlayWrapper"
|
|
@@ -3051,6 +3067,7 @@ var HeadCell = (props) => {
|
|
|
3051
3067
|
} = props;
|
|
3052
3068
|
const theme = useTheme();
|
|
3053
3069
|
const ref = headerRef;
|
|
3070
|
+
const [isHovered, setIsHovered] = useState6(false);
|
|
3054
3071
|
const sortable = type === "actions" ? false : _sortable;
|
|
3055
3072
|
const headId = useMemo8(
|
|
3056
3073
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -3088,10 +3105,13 @@ var HeadCell = (props) => {
|
|
|
3088
3105
|
);
|
|
3089
3106
|
const textAlign = getTextAlign(props);
|
|
3090
3107
|
const initialSort = sortOrder[0];
|
|
3091
|
-
const sortIcon = useMemo8(
|
|
3092
|
-
|
|
3108
|
+
const sortIcon = useMemo8(() => {
|
|
3109
|
+
const isSorted = !!sort;
|
|
3110
|
+
const isVisible = sortable && (isSorted || isHovered);
|
|
3111
|
+
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
3093
3112
|
MotionSortIcon,
|
|
3094
3113
|
{
|
|
3114
|
+
key: "sort-icon",
|
|
3095
3115
|
style: {
|
|
3096
3116
|
width: "16px",
|
|
3097
3117
|
height: "16px"
|
|
@@ -3100,25 +3120,22 @@ var HeadCell = (props) => {
|
|
|
3100
3120
|
"aria-labelledby": headId,
|
|
3101
3121
|
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3102
3122
|
"data-testid": void 0,
|
|
3103
|
-
|
|
3104
|
-
hover: { opacity: 1 },
|
|
3105
|
-
initial: { opacity: 0 }
|
|
3106
|
-
},
|
|
3123
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
3107
3124
|
animate: {
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3125
|
+
opacity: 1,
|
|
3126
|
+
scale: 1,
|
|
3127
|
+
color: isSorted ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3128
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0
|
|
3111
3129
|
},
|
|
3130
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
3112
3131
|
transition: {
|
|
3113
|
-
duration: 0,
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3132
|
+
duration: 0.2,
|
|
3133
|
+
ease: "easeInOut",
|
|
3134
|
+
rotate: { duration: 0.2, ease: "easeOut" }
|
|
3117
3135
|
}
|
|
3118
3136
|
}
|
|
3119
|
-
)
|
|
3120
|
-
|
|
3121
|
-
);
|
|
3137
|
+
));
|
|
3138
|
+
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3122
3139
|
const infoSign = useMemo8(
|
|
3123
3140
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3124
3141
|
[description]
|
|
@@ -3136,6 +3153,8 @@ var HeadCell = (props) => {
|
|
|
3136
3153
|
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3137
3154
|
[field, onSortChange, sort, sortable]
|
|
3138
3155
|
),
|
|
3156
|
+
onMouseEnter: () => setIsHovered(true),
|
|
3157
|
+
onMouseLeave: () => setIsHovered(false),
|
|
3139
3158
|
whileHover: "hover",
|
|
3140
3159
|
initial: "initial"
|
|
3141
3160
|
},
|