@parto-system-design/ui 1.1.9 → 1.1.11

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
@@ -11603,8 +11603,7 @@ var HeaderDispatcher = ({ post, density, onAuthorAnalytics, onAuthorProfile }) =
11603
11603
  var PostCard = React98__namespace.forwardRef(
11604
11604
  ({
11605
11605
  post,
11606
- view,
11607
- density,
11606
+ view = "comfortable",
11608
11607
  selected = false,
11609
11608
  active = false,
11610
11609
  read = false,
@@ -11625,7 +11624,7 @@ var PostCard = React98__namespace.forwardRef(
11625
11624
  onClick,
11626
11625
  ...props
11627
11626
  }, ref) => {
11628
- const resolvedView = view ?? density ?? "comfortable";
11627
+ const resolvedView = view;
11629
11628
  const headerDensity = resolvedView === "grid" ? "compact" : resolvedView;
11630
11629
  const effectiveActions = React98__namespace.useMemo(() => actions ?? defaultActions({ onOpenDetails }), [actions, onOpenDetails]);
11631
11630
  const config = getPostSourceConfig(post.source);
@@ -11660,7 +11659,6 @@ var PostCard = React98__namespace.forwardRef(
11660
11659
  tabIndex: 0,
11661
11660
  "data-slot": "post-card",
11662
11661
  "data-view": "compact",
11663
- "data-density": "compact",
11664
11662
  "data-source": post.source,
11665
11663
  "data-source-category": sourceCategory(post.source),
11666
11664
  "data-selected": selected || void 0,
@@ -11755,7 +11753,6 @@ var PostCard = React98__namespace.forwardRef(
11755
11753
  tabIndex: 0,
11756
11754
  "data-slot": "post-card",
11757
11755
  "data-view": "grid",
11758
- "data-density": "grid",
11759
11756
  "data-source": post.source,
11760
11757
  "data-source-category": sourceCategory(post.source),
11761
11758
  "data-selected": selected || void 0,
@@ -11840,7 +11837,6 @@ var PostCard = React98__namespace.forwardRef(
11840
11837
  tabIndex: onOpen ? 0 : void 0,
11841
11838
  "data-slot": "post-card",
11842
11839
  "data-view": "comfortable",
11843
- "data-density": "comfortable",
11844
11840
  "data-source": post.source,
11845
11841
  "data-source-category": sourceCategory(post.source),
11846
11842
  "data-selected": selected || void 0,
@@ -12619,8 +12615,6 @@ function readStoredView() {
12619
12615
  if (typeof window === "undefined") return null;
12620
12616
  const stored = window.localStorage.getItem(VIEW_STORAGE_KEY);
12621
12617
  if (stored === "compact" || stored === "comfortable" || stored === "grid") return stored;
12622
- const legacy = window.localStorage.getItem("parto-post-list-density");
12623
- if (legacy === "compact" || legacy === "comfortable") return legacy;
12624
12618
  return null;
12625
12619
  }
12626
12620
  function ts(d) {
@@ -12724,8 +12718,6 @@ var PostList = React98__namespace.forwardRef(
12724
12718
  posts,
12725
12719
  view: controlledView,
12726
12720
  onViewChange,
12727
- density: legacyDensity,
12728
- onDensityChange: legacyOnDensityChange,
12729
12721
  activeId,
12730
12722
  readIds,
12731
12723
  selectedIds,
@@ -12756,18 +12748,17 @@ var PostList = React98__namespace.forwardRef(
12756
12748
  }, ref) => {
12757
12749
  const [internalView, setInternalView] = React98__namespace.useState("comfortable");
12758
12750
  React98__namespace.useEffect(() => {
12759
- if (controlledView !== void 0 || legacyDensity !== void 0) return;
12751
+ if (controlledView !== void 0) return;
12760
12752
  const stored = readStoredView();
12761
12753
  if (stored) setInternalView(stored);
12762
- }, [controlledView, legacyDensity]);
12763
- const view = controlledView ?? legacyDensity ?? internalView;
12754
+ }, [controlledView]);
12755
+ const view = controlledView ?? internalView;
12764
12756
  const handleView = (next) => {
12765
- if (controlledView === void 0 && legacyDensity === void 0) {
12757
+ if (controlledView === void 0) {
12766
12758
  setInternalView(next);
12767
12759
  if (typeof window !== "undefined") window.localStorage.setItem(VIEW_STORAGE_KEY, next);
12768
12760
  }
12769
12761
  onViewChange?.(next);
12770
- if (next !== "grid") legacyOnDensityChange?.(next);
12771
12762
  };
12772
12763
  const readSet = React98__namespace.useMemo(() => toSet(readIds), [readIds]);
12773
12764
  const selectedSet = React98__namespace.useMemo(() => toSet(selectedIds), [selectedIds]);
@@ -12822,9 +12813,13 @@ var PostList = React98__namespace.forwardRef(
12822
12813
  onSelect: handleSelect,
12823
12814
  actions
12824
12815
  },
12825
- post.id
12816
+ `${post.id}:${view}`
12826
12817
  );
12827
- const containerCls = view === "grid" ? "grid grid-cols-2 lg:grid-cols-3 gap-3 p-4" : view === "comfortable" ? "flex flex-col gap-3 p-4" : "flex flex-col";
12818
+ const containerCls = React98__namespace.useMemo(() => {
12819
+ if (view === "grid") return "grid grid-cols-2 lg:grid-cols-3 gap-3 p-4";
12820
+ if (view === "comfortable") return "flex flex-col gap-3 p-4";
12821
+ return "flex flex-col";
12822
+ }, [view]);
12828
12823
  let body;
12829
12824
  if (isLoading) {
12830
12825
  body = loadingState ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultLoading, { view });
@@ -18415,7 +18410,7 @@ var FlowDistributionSection = React98__namespace.forwardRef(
18415
18410
  );
18416
18411
  }
18417
18412
  );
18418
- var TopPostsSection = React98__namespace.forwardRef(function TopPostsSection2({ title, description, posts, topN = 5, density = "compact", locale = "fa", ...sectionProps }, ref) {
18413
+ var TopPostsSection = React98__namespace.forwardRef(function TopPostsSection2({ title, description, posts, topN = 5, view = "compact", locale = "fa", ...sectionProps }, ref) {
18419
18414
  const visible = posts.slice(0, topN);
18420
18415
  return /* @__PURE__ */ jsxRuntime.jsx(
18421
18416
  ReportSection,
@@ -18424,7 +18419,7 @@ var TopPostsSection = React98__namespace.forwardRef(function TopPostsSection2({
18424
18419
  title: title ?? defaultTitle("topPosts", locale),
18425
18420
  description,
18426
18421
  ...sectionProps,
18427
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "report-section-top-posts", children: /* @__PURE__ */ jsxRuntime.jsx(PostList, { posts: visible, density }) })
18422
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "report-section-top-posts", children: /* @__PURE__ */ jsxRuntime.jsx(PostList, { posts: visible, view }) })
18428
18423
  }
18429
18424
  );
18430
18425
  });