@ceed/ads 1.27.0 → 1.28.1

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 CHANGED
@@ -2319,7 +2319,8 @@ var StyledTd = (0, import_joy25.styled)("td")(({ theme }) => ({
2319
2319
  }));
2320
2320
  var MotionSortIcon = (0, import_framer_motion17.motion)(import_ArrowUpwardRounded.default);
2321
2321
  var DefaultLoadingOverlay = () => /* @__PURE__ */ import_react19.default.createElement(import_joy25.LinearProgress, { value: 8, variant: "plain" });
2322
- var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ import_react19.default.createElement(
2322
+ var DefaultNoRowsOverlay = () => /* @__PURE__ */ import_react19.default.createElement(import_joy25.Typography, { level: "body-sm", textColor: "text.tertiary" }, "No rows");
2323
+ var Resizer = (ref, targetRef = ref, onResizeStateChange) => /* @__PURE__ */ import_react19.default.createElement(
2323
2324
  Box_default,
2324
2325
  {
2325
2326
  sx: {
@@ -2334,6 +2335,7 @@ var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ import_react19.default.c
2334
2335
  onMouseDown: (e) => {
2335
2336
  const initialX = e.clientX;
2336
2337
  const initialWidth = ref.current?.getBoundingClientRect().width;
2338
+ onResizeStateChange?.(true);
2337
2339
  const onMouseMove = (e2) => {
2338
2340
  if (initialWidth && initialX) {
2339
2341
  ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
@@ -2343,6 +2345,7 @@ var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ import_react19.default.c
2343
2345
  const onMouseUp = () => {
2344
2346
  document.removeEventListener("mousemove", onMouseMove);
2345
2347
  document.removeEventListener("mouseup", onMouseUp);
2348
+ requestAnimationFrame(() => onResizeStateChange?.(false));
2346
2349
  };
2347
2350
  document.addEventListener("mousemove", onMouseMove);
2348
2351
  document.addEventListener("mouseup", onMouseUp);
@@ -2930,7 +2933,7 @@ var TextEllipsis = ({ children, lineClamp }) => {
2930
2933
  ro.observe(element);
2931
2934
  return () => ro.disconnect();
2932
2935
  }, [children, lineClamp]);
2933
- return /* @__PURE__ */ import_react24.default.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react24.default.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
2936
+ return /* @__PURE__ */ import_react24.default.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top" }, /* @__PURE__ */ import_react24.default.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
2934
2937
  };
2935
2938
  var CellTextEllipsis = ({ children }) => {
2936
2939
  const textRef = (0, import_react24.useRef)(null);
@@ -2993,7 +2996,13 @@ var HeadCell = (props) => {
2993
2996
  () => `${tableId}_header_${headerName ?? field}`.trim(),
2994
2997
  [tableId, headerName, field]
2995
2998
  );
2996
- const resizer = (0, import_react24.useMemo)(() => resizable ?? true ? Resizer(ref, colRef) : null, [resizable, ref, colRef]);
2999
+ const isResizingRef = (0, import_react24.useRef)(false);
3000
+ const resizer = (0, import_react24.useMemo)(
3001
+ () => resizable ?? true ? Resizer(ref, colRef, (isResizing) => {
3002
+ isResizingRef.current = isResizing;
3003
+ }) : null,
3004
+ [resizable, ref, colRef]
3005
+ );
2997
3006
  const style = (0, import_react24.useMemo)(
2998
3007
  () => ({
2999
3008
  width,
@@ -3067,7 +3076,11 @@ var HeadCell = (props) => {
3067
3076
  key: field,
3068
3077
  style,
3069
3078
  onClick: (0, import_react24.useCallback)(
3070
- (e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
3079
+ (e) => {
3080
+ if (isResizingRef.current) return;
3081
+ if (!(e.target instanceof Element) || !e.currentTarget.contains(e.target)) return;
3082
+ sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey });
3083
+ },
3071
3084
  [field, onSortChange, sort, sortable]
3072
3085
  ),
3073
3086
  onMouseEnter: () => setIsHovered(true),
@@ -4033,9 +4046,15 @@ function Component(props, apiRef) {
4033
4046
  checkbox: RenderCheckbox = Checkbox_default,
4034
4047
  toolbar: Toolbar,
4035
4048
  footer: Footer,
4036
- loadingOverlay: LoadingOverlay = DefaultLoadingOverlay
4049
+ loadingOverlay: LoadingOverlay = DefaultLoadingOverlay,
4050
+ noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
4051
+ } = {},
4052
+ slotProps: {
4053
+ checkbox: checkboxProps = {},
4054
+ toolbar: toolbarProps,
4055
+ background: backgroundProps = {},
4056
+ noRowsOverlay: noRowsOverlayProps = {}
4037
4057
  } = {},
4038
- slotProps: { checkbox: checkboxProps = {}, toolbar: toolbarProps, background: backgroundProps = {} } = {},
4039
4058
  stripe,
4040
4059
  isTotalSelected: ___________,
4041
4060
  ...innerProps
@@ -4079,6 +4098,8 @@ function Component(props, apiRef) {
4079
4098
  const paginationModel = (0, import_react28.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
4080
4099
  const totalSize = virtualizer.getTotalSize();
4081
4100
  const virtualizedItems = virtualizer.getVirtualItems();
4101
+ const showNoRowsOverlay = !loading && rowCount === 0;
4102
+ const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0));
4082
4103
  const getRowClickHandler = (0, import_react28.useCallback)(
4083
4104
  (row, rowId) => (e) => {
4084
4105
  onRowClick?.({ row, rowId }, e);
@@ -4370,6 +4391,18 @@ function Component(props, apiRef) {
4370
4391
  /* @__PURE__ */ import_react28.default.createElement(LoadingOverlay, null)
4371
4392
  )
4372
4393
  )),
4394
+ showNoRowsOverlay && /* @__PURE__ */ import_react28.default.createElement("tr", null, /* @__PURE__ */ import_react28.default.createElement("td", { colSpan: totalColCount, style: { border: "none" } }, /* @__PURE__ */ import_react28.default.createElement(
4395
+ Box_default,
4396
+ {
4397
+ sx: {
4398
+ display: "flex",
4399
+ alignItems: "center",
4400
+ justifyContent: "center",
4401
+ minHeight: "150px"
4402
+ }
4403
+ },
4404
+ /* @__PURE__ */ import_react28.default.createElement(NoRowsOverlay, { ...noRowsOverlayProps })
4405
+ ))),
4373
4406
  virtualizedItems.map((virtualizedRow, index) => {
4374
4407
  const rowIndex = virtualizedRow.index;
4375
4408
  const row = dataInPage[rowIndex];
package/dist/index.js CHANGED
@@ -2079,7 +2079,7 @@ var numberFormatter = (value) => "Intl" in window ? new Intl.NumberFormat().form
2079
2079
 
2080
2080
  // src/components/DataTable/styled.tsx
2081
2081
  import React17 from "react";
2082
- import { styled as styled8, LinearProgress, buttonClasses, iconButtonClasses } from "@mui/joy";
2082
+ import { styled as styled8, LinearProgress, buttonClasses, iconButtonClasses, Typography as Typography3 } from "@mui/joy";
2083
2083
  import { motion as motion17 } from "framer-motion";
2084
2084
  import SortIcon from "@mui/icons-material/ArrowUpwardRounded";
2085
2085
  var EllipsisDiv = styled8("div", {
@@ -2185,7 +2185,8 @@ var StyledTd = styled8("td")(({ theme }) => ({
2185
2185
  }));
2186
2186
  var MotionSortIcon = motion17(SortIcon);
2187
2187
  var DefaultLoadingOverlay = () => /* @__PURE__ */ React17.createElement(LinearProgress, { value: 8, variant: "plain" });
2188
- var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ React17.createElement(
2188
+ var DefaultNoRowsOverlay = () => /* @__PURE__ */ React17.createElement(Typography3, { level: "body-sm", textColor: "text.tertiary" }, "No rows");
2189
+ var Resizer = (ref, targetRef = ref, onResizeStateChange) => /* @__PURE__ */ React17.createElement(
2189
2190
  Box_default,
2190
2191
  {
2191
2192
  sx: {
@@ -2200,6 +2201,7 @@ var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ React17.createElement(
2200
2201
  onMouseDown: (e) => {
2201
2202
  const initialX = e.clientX;
2202
2203
  const initialWidth = ref.current?.getBoundingClientRect().width;
2204
+ onResizeStateChange?.(true);
2203
2205
  const onMouseMove = (e2) => {
2204
2206
  if (initialWidth && initialX) {
2205
2207
  ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
@@ -2209,6 +2211,7 @@ var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ React17.createElement(
2209
2211
  const onMouseUp = () => {
2210
2212
  document.removeEventListener("mousemove", onMouseMove);
2211
2213
  document.removeEventListener("mouseup", onMouseUp);
2214
+ requestAnimationFrame(() => onResizeStateChange?.(false));
2212
2215
  };
2213
2216
  document.addEventListener("mousemove", onMouseMove);
2214
2217
  document.addEventListener("mouseup", onMouseUp);
@@ -2656,7 +2659,7 @@ var Textarea_default = Textarea;
2656
2659
 
2657
2660
  // src/components/Select/Select.tsx
2658
2661
  import React20, { useMemo as useMemo7 } from "react";
2659
- import { Select as JoySelect, Option as JoyOption, ListItemContent as ListItemContent2, Typography as Typography3 } from "@mui/joy";
2662
+ import { Select as JoySelect, Option as JoyOption, ListItemContent as ListItemContent2, Typography as Typography4 } from "@mui/joy";
2660
2663
  import { motion as motion20 } from "framer-motion";
2661
2664
  var MotionOption = motion20(JoyOption);
2662
2665
  var Option = MotionOption;
@@ -2730,7 +2733,7 @@ function Select(props) {
2730
2733
  return optionMap.get(selected.value)?.label;
2731
2734
  }
2732
2735
  },
2733
- options.map((option) => /* @__PURE__ */ React20.createElement(Option, { key: option.value, value: option.value, disabled: option.disabled }, option.secondaryText ? /* @__PURE__ */ React20.createElement(ListItemContent2, { sx: { gap: 0.5 } }, /* @__PURE__ */ React20.createElement(Typography3, { level: "inherit" }, option.label), /* @__PURE__ */ React20.createElement(Typography3, { level: secondaryTextLevelMap2[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : option.label))
2736
+ options.map((option) => /* @__PURE__ */ React20.createElement(Option, { key: option.value, value: option.value, disabled: option.disabled }, option.secondaryText ? /* @__PURE__ */ React20.createElement(ListItemContent2, { sx: { gap: 0.5 } }, /* @__PURE__ */ React20.createElement(Typography4, { level: "inherit" }, option.label), /* @__PURE__ */ React20.createElement(Typography4, { level: secondaryTextLevelMap2[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : option.label))
2734
2737
  );
2735
2738
  return /* @__PURE__ */ React20.createElement(
2736
2739
  FormControl_default,
@@ -2805,7 +2808,7 @@ var TextEllipsis = ({ children, lineClamp }) => {
2805
2808
  ro.observe(element);
2806
2809
  return () => ro.disconnect();
2807
2810
  }, [children, lineClamp]);
2808
- return /* @__PURE__ */ React22.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React22.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
2811
+ return /* @__PURE__ */ React22.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top" }, /* @__PURE__ */ React22.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
2809
2812
  };
2810
2813
  var CellTextEllipsis = ({ children }) => {
2811
2814
  const textRef = useRef5(null);
@@ -2868,7 +2871,13 @@ var HeadCell = (props) => {
2868
2871
  () => `${tableId}_header_${headerName ?? field}`.trim(),
2869
2872
  [tableId, headerName, field]
2870
2873
  );
2871
- const resizer = useMemo8(() => resizable ?? true ? Resizer(ref, colRef) : null, [resizable, ref, colRef]);
2874
+ const isResizingRef = useRef5(false);
2875
+ const resizer = useMemo8(
2876
+ () => resizable ?? true ? Resizer(ref, colRef, (isResizing) => {
2877
+ isResizingRef.current = isResizing;
2878
+ }) : null,
2879
+ [resizable, ref, colRef]
2880
+ );
2872
2881
  const style = useMemo8(
2873
2882
  () => ({
2874
2883
  width,
@@ -2942,7 +2951,11 @@ var HeadCell = (props) => {
2942
2951
  key: field,
2943
2952
  style,
2944
2953
  onClick: useCallback9(
2945
- (e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
2954
+ (e) => {
2955
+ if (isResizingRef.current) return;
2956
+ if (!(e.target instanceof Element) || !e.currentTarget.contains(e.target)) return;
2957
+ sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey });
2958
+ },
2946
2959
  [field, onSortChange, sort, sortable]
2947
2960
  ),
2948
2961
  onMouseEnter: () => setIsHovered(true),
@@ -3908,9 +3921,15 @@ function Component(props, apiRef) {
3908
3921
  checkbox: RenderCheckbox = Checkbox_default,
3909
3922
  toolbar: Toolbar,
3910
3923
  footer: Footer,
3911
- loadingOverlay: LoadingOverlay = DefaultLoadingOverlay
3924
+ loadingOverlay: LoadingOverlay = DefaultLoadingOverlay,
3925
+ noRowsOverlay: NoRowsOverlay = DefaultNoRowsOverlay
3926
+ } = {},
3927
+ slotProps: {
3928
+ checkbox: checkboxProps = {},
3929
+ toolbar: toolbarProps,
3930
+ background: backgroundProps = {},
3931
+ noRowsOverlay: noRowsOverlayProps = {}
3912
3932
  } = {},
3913
- slotProps: { checkbox: checkboxProps = {}, toolbar: toolbarProps, background: backgroundProps = {} } = {},
3914
3933
  stripe,
3915
3934
  isTotalSelected: ___________,
3916
3935
  ...innerProps
@@ -3954,6 +3973,8 @@ function Component(props, apiRef) {
3954
3973
  const paginationModel = useMemo10(() => ({ page, pageSize }), [page, pageSize]);
3955
3974
  const totalSize = virtualizer.getTotalSize();
3956
3975
  const virtualizedItems = virtualizer.getVirtualItems();
3976
+ const showNoRowsOverlay = !loading && rowCount === 0;
3977
+ const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0));
3957
3978
  const getRowClickHandler = useCallback12(
3958
3979
  (row, rowId) => (e) => {
3959
3980
  onRowClick?.({ row, rowId }, e);
@@ -4245,6 +4266,18 @@ function Component(props, apiRef) {
4245
4266
  /* @__PURE__ */ React25.createElement(LoadingOverlay, null)
4246
4267
  )
4247
4268
  )),
4269
+ showNoRowsOverlay && /* @__PURE__ */ React25.createElement("tr", null, /* @__PURE__ */ React25.createElement("td", { colSpan: totalColCount, style: { border: "none" } }, /* @__PURE__ */ React25.createElement(
4270
+ Box_default,
4271
+ {
4272
+ sx: {
4273
+ display: "flex",
4274
+ alignItems: "center",
4275
+ justifyContent: "center",
4276
+ minHeight: "150px"
4277
+ }
4278
+ },
4279
+ /* @__PURE__ */ React25.createElement(NoRowsOverlay, { ...noRowsOverlayProps })
4280
+ ))),
4248
4281
  virtualizedItems.map((virtualizedRow, index) => {
4249
4282
  const rowIndex = virtualizedRow.index;
4250
4283
  const row = dataInPage[rowIndex];
@@ -5345,7 +5378,7 @@ CurrencyRange.displayName = "CurrencyRange";
5345
5378
 
5346
5379
  // src/components/FilterMenu/components/PercentageInput.tsx
5347
5380
  import React38 from "react";
5348
- import { Stack as Stack8, Typography as Typography4 } from "@mui/joy";
5381
+ import { Stack as Stack8, Typography as Typography5 } from "@mui/joy";
5349
5382
 
5350
5383
  // src/components/PercentageInput/PercentageInput.tsx
5351
5384
  import React37, { useCallback as useCallback21, useMemo as useMemo14, useState as useState13 } from "react";
@@ -5480,7 +5513,7 @@ var PercentageInput3 = ({
5480
5513
  if (hidden) {
5481
5514
  return null;
5482
5515
  }
5483
- return /* @__PURE__ */ React38.createElement(Stack8, { spacing: 3, role: "group", "aria-labelledby": id }, !!label && /* @__PURE__ */ React38.createElement(Typography4, { id, level: "title-sm", component: "label", textColor: "text.tertiary" }, label), /* @__PURE__ */ React38.createElement(
5516
+ return /* @__PURE__ */ React38.createElement(Stack8, { spacing: 3, role: "group", "aria-labelledby": id }, !!label && /* @__PURE__ */ React38.createElement(Typography5, { id, level: "title-sm", component: "label", textColor: "text.tertiary" }, label), /* @__PURE__ */ React38.createElement(
5484
5517
  PercentageInput,
5485
5518
  {
5486
5519
  value: _value,