smartsell-ui-kit 0.1.6 → 0.1.7

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
@@ -3831,7 +3831,7 @@ var import_react12 = require("react");
3831
3831
 
3832
3832
  // src/componentsBase/table/utils.ts
3833
3833
  var import_react11 = require("react");
3834
- var DEFAULT_COLLAPSE_BELOW = 420;
3834
+ var DEFAULT_COLLAPSE_BELOW = 768;
3835
3835
  var DEFAULT_MAX_INLINE_ACTIONS = 2;
3836
3836
  var DEFAULT_PAGE_SIZE = 10;
3837
3837
  var DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50];
@@ -4354,7 +4354,7 @@ function TableBase({
4354
4354
  const alternateSurfaceColor = theme.colors.background;
4355
4355
  const scrollRegionId = (0, import_react12.useId)().replace(/:/g, "");
4356
4356
  const containerRef = (0, import_react12.useRef)(null);
4357
- const [containerWidth, setContainerWidth] = (0, import_react12.useState)(null);
4357
+ const [viewportWidth, setViewportWidth] = (0, import_react12.useState)(null);
4358
4358
  const [isSettingsModalOpen, setIsSettingsModalOpen] = (0, import_react12.useState)(false);
4359
4359
  const resolvedLabels = mergeTableLabels({
4360
4360
  ...labels != null ? labels : {},
@@ -4362,8 +4362,8 @@ function TableBase({
4362
4362
  });
4363
4363
  const normalizedPage = clampPage(page, totalPages);
4364
4364
  const normalizedPageSizeOptions = sanitizePageSizeOptions(pageSizeOptions, pageSize);
4365
- const isCollapsed = containerWidth !== null ? containerWidth < collapseBelow : false;
4366
- const mobileGridColumnCount = containerWidth !== null && containerWidth < 520 ? 1 : 2;
4365
+ const isCollapsed = viewportWidth !== null ? viewportWidth < collapseBelow : false;
4366
+ const mobileGridColumnCount = viewportWidth !== null && viewportWidth < 520 ? 1 : 2;
4367
4367
  const canGoToPreviousPage = normalizedPage > 1;
4368
4368
  const canGoToNextPage = normalizedPage < Math.max(1, totalPages);
4369
4369
  const canGoToFirstPage = canGoToPreviousPage;
@@ -4398,31 +4398,16 @@ function TableBase({
4398
4398
  borderLeft: `1px solid ${softBorderColor}`
4399
4399
  });
4400
4400
  (0, import_react12.useEffect)(() => {
4401
- const element = containerRef.current;
4402
- if (!element) {
4401
+ if (typeof window === "undefined") {
4403
4402
  return;
4404
4403
  }
4405
- const setWidthFromElement = (nextWidth) => {
4406
- const measuredWidth = nextWidth != null ? nextWidth : element.getBoundingClientRect().width;
4407
- setContainerWidth(measuredWidth > 0 ? measuredWidth : null);
4404
+ const updateViewportWidth = () => {
4405
+ setViewportWidth(window.innerWidth);
4408
4406
  };
4409
- setWidthFromElement();
4410
- if (typeof ResizeObserver === "undefined") {
4411
- const handleResize = () => {
4412
- setWidthFromElement(window.innerWidth);
4413
- };
4414
- window.addEventListener("resize", handleResize);
4415
- return () => {
4416
- window.removeEventListener("resize", handleResize);
4417
- };
4418
- }
4419
- const observer = new ResizeObserver((entries) => {
4420
- const [entry] = entries;
4421
- setWidthFromElement(entry == null ? void 0 : entry.contentRect.width);
4422
- });
4423
- observer.observe(element);
4407
+ updateViewportWidth();
4408
+ window.addEventListener("resize", updateViewportWidth);
4424
4409
  return () => {
4425
- observer.disconnect();
4410
+ window.removeEventListener("resize", updateViewportWidth);
4426
4411
  };
4427
4412
  }, []);
4428
4413
  const actionButtonBaseStyle = (tone, disabled, iconOnly) => ({
@@ -4679,7 +4664,7 @@ function TableBase({
4679
4664
  !hasRows && (!loading || error) ? renderEmptyState() : null,
4680
4665
  hasRows ? isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "list", "aria-label": ariaLabel, className: "flex flex-col gap-3.5", children: items.map((item, rowIndex) => {
4681
4666
  const rowActions = renderActions(item, rowIndex);
4682
- const rowBackgroundColor = rowIndex % 2 === 0 ? theme.colors.surface : alternateSurfaceColor;
4667
+ const rowBackgroundColor = theme.colors.surface;
4683
4668
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4684
4669
  "article",
4685
4670
  {
@@ -4851,7 +4836,7 @@ function TableBase({
4851
4836
  width: column.width,
4852
4837
  minWidth: column.minWidth
4853
4838
  },
4854
- children: column.label
4839
+ children: !column.hideLabel ? column.label : null
4855
4840
  },
4856
4841
  getColumnKey(column, columnIndex)
4857
4842
  );