@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.d.cts CHANGED
@@ -2968,13 +2968,17 @@ declare function sourceCategory(source: PostSource): PostSourceCategory;
2968
2968
  */
2969
2969
  type PostPlatform = SocialPlatform;
2970
2970
  /**
2971
- * `view` is the canonical PostList render mode. `compact` and `comfortable` are the
2972
- * pre-existing densities; `grid` is the new magazine/visual layout.
2971
+ * Canonical render mode for `<PostList>` and `<PostCard>`:
2972
+ * - `compact` dense list row with side thumbnail and 1-line preview
2973
+ * - `comfortable` — full vertical card with header, body, media, metrics, signals
2974
+ * - `grid` — magazine/visual layout (aspect-square media-dominant tile)
2973
2975
  */
2974
2976
  type PostView = 'compact' | 'comfortable' | 'grid';
2975
2977
  /**
2976
- * @deprecated Use {@link PostView} instead. `density` is the legacy two-value alias
2977
- * (compact | comfortable) kept for backward compatibility with PostCard / PostList.
2978
+ * Two-mode subset used by sub-components that don't ship a `grid` layout
2979
+ * (`<PostHeader>`, `<PostHeaderBroadcast>`, `<PostHeaderEditorial>`,
2980
+ * `<PostMetadata>`, `<PostSignals>`). `<PostCard>` internally narrows its
2981
+ * `view` down to this when rendering those sub-components.
2978
2982
  */
2979
2983
  type PostDensity = 'compact' | 'comfortable';
2980
2984
  type PostSentiment = 'positive' | 'negative' | 'neutral' | 'mixed';
@@ -3517,10 +3521,8 @@ declare const postCardVariants: (props?: ({
3517
3521
  } & class_variance_authority_types.ClassProp) | undefined) => string;
3518
3522
  interface PostCardProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'onSelect'>, VariantProps<typeof postCardVariants> {
3519
3523
  post: PostData;
3520
- /** Layout mode. Replaces the legacy `density` prop. */
3524
+ /** Layout mode `compact` (dense row) · `comfortable` (full card) · `grid` (media tile). */
3521
3525
  view?: PostView;
3522
- /** @deprecated Use `view` instead. */
3523
- density?: PostDensity;
3524
3526
  selected?: boolean;
3525
3527
  /** True when the card represents the post currently open in the details drawer. */
3526
3528
  active?: boolean;
@@ -3829,10 +3831,6 @@ interface PostListProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'on
3829
3831
  /** Controlled view. If omitted, the list manages its own state (persisted to localStorage). */
3830
3832
  view?: PostView;
3831
3833
  onViewChange?: (view: PostView) => void;
3832
- /** @deprecated Use `view` instead. */
3833
- density?: PostDensity;
3834
- /** @deprecated Use `onViewChange` instead. */
3835
- onDensityChange?: (density: PostDensity) => void;
3836
3834
  /** ID of the currently open/selected post (for URL deep-linking). */
3837
3835
  activeId?: string;
3838
3836
  /** IDs of posts that have been visited (visual "read" state). */
@@ -5575,8 +5573,8 @@ interface TopPostsSectionProps extends ReportSectionShellProps {
5575
5573
  posts: PostData[];
5576
5574
  /** Render only the first N posts. @default 5 */
5577
5575
  topN?: number;
5578
- /** Density passed through to PostList. @default 'compact' */
5579
- density?: 'compact' | 'comfortable';
5576
+ /** View mode passed through to PostList. @default 'compact' */
5577
+ view?: 'compact' | 'comfortable' | 'grid';
5580
5578
  locale?: SupportedLocale;
5581
5579
  }
5582
5580
  declare const TopPostsSection: React$1.ForwardRefExoticComponent<TopPostsSectionProps & React$1.RefAttributes<HTMLDivElement>>;
package/dist/index.d.ts CHANGED
@@ -2968,13 +2968,17 @@ declare function sourceCategory(source: PostSource): PostSourceCategory;
2968
2968
  */
2969
2969
  type PostPlatform = SocialPlatform;
2970
2970
  /**
2971
- * `view` is the canonical PostList render mode. `compact` and `comfortable` are the
2972
- * pre-existing densities; `grid` is the new magazine/visual layout.
2971
+ * Canonical render mode for `<PostList>` and `<PostCard>`:
2972
+ * - `compact` dense list row with side thumbnail and 1-line preview
2973
+ * - `comfortable` — full vertical card with header, body, media, metrics, signals
2974
+ * - `grid` — magazine/visual layout (aspect-square media-dominant tile)
2973
2975
  */
2974
2976
  type PostView = 'compact' | 'comfortable' | 'grid';
2975
2977
  /**
2976
- * @deprecated Use {@link PostView} instead. `density` is the legacy two-value alias
2977
- * (compact | comfortable) kept for backward compatibility with PostCard / PostList.
2978
+ * Two-mode subset used by sub-components that don't ship a `grid` layout
2979
+ * (`<PostHeader>`, `<PostHeaderBroadcast>`, `<PostHeaderEditorial>`,
2980
+ * `<PostMetadata>`, `<PostSignals>`). `<PostCard>` internally narrows its
2981
+ * `view` down to this when rendering those sub-components.
2978
2982
  */
2979
2983
  type PostDensity = 'compact' | 'comfortable';
2980
2984
  type PostSentiment = 'positive' | 'negative' | 'neutral' | 'mixed';
@@ -3517,10 +3521,8 @@ declare const postCardVariants: (props?: ({
3517
3521
  } & class_variance_authority_types.ClassProp) | undefined) => string;
3518
3522
  interface PostCardProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'onSelect'>, VariantProps<typeof postCardVariants> {
3519
3523
  post: PostData;
3520
- /** Layout mode. Replaces the legacy `density` prop. */
3524
+ /** Layout mode `compact` (dense row) · `comfortable` (full card) · `grid` (media tile). */
3521
3525
  view?: PostView;
3522
- /** @deprecated Use `view` instead. */
3523
- density?: PostDensity;
3524
3526
  selected?: boolean;
3525
3527
  /** True when the card represents the post currently open in the details drawer. */
3526
3528
  active?: boolean;
@@ -3829,10 +3831,6 @@ interface PostListProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'on
3829
3831
  /** Controlled view. If omitted, the list manages its own state (persisted to localStorage). */
3830
3832
  view?: PostView;
3831
3833
  onViewChange?: (view: PostView) => void;
3832
- /** @deprecated Use `view` instead. */
3833
- density?: PostDensity;
3834
- /** @deprecated Use `onViewChange` instead. */
3835
- onDensityChange?: (density: PostDensity) => void;
3836
3834
  /** ID of the currently open/selected post (for URL deep-linking). */
3837
3835
  activeId?: string;
3838
3836
  /** IDs of posts that have been visited (visual "read" state). */
@@ -5575,8 +5573,8 @@ interface TopPostsSectionProps extends ReportSectionShellProps {
5575
5573
  posts: PostData[];
5576
5574
  /** Render only the first N posts. @default 5 */
5577
5575
  topN?: number;
5578
- /** Density passed through to PostList. @default 'compact' */
5579
- density?: 'compact' | 'comfortable';
5576
+ /** View mode passed through to PostList. @default 'compact' */
5577
+ view?: 'compact' | 'comfortable' | 'grid';
5580
5578
  locale?: SupportedLocale;
5581
5579
  }
5582
5580
  declare const TopPostsSection: React$1.ForwardRefExoticComponent<TopPostsSectionProps & React$1.RefAttributes<HTMLDivElement>>;
package/dist/index.js CHANGED
@@ -11589,8 +11589,7 @@ var HeaderDispatcher = ({ post, density, onAuthorAnalytics, onAuthorProfile }) =
11589
11589
  var PostCard = React98.forwardRef(
11590
11590
  ({
11591
11591
  post,
11592
- view,
11593
- density,
11592
+ view = "comfortable",
11594
11593
  selected = false,
11595
11594
  active = false,
11596
11595
  read = false,
@@ -11611,7 +11610,7 @@ var PostCard = React98.forwardRef(
11611
11610
  onClick,
11612
11611
  ...props
11613
11612
  }, ref) => {
11614
- const resolvedView = view ?? density ?? "comfortable";
11613
+ const resolvedView = view;
11615
11614
  const headerDensity = resolvedView === "grid" ? "compact" : resolvedView;
11616
11615
  const effectiveActions = React98.useMemo(() => actions ?? defaultActions({ onOpenDetails }), [actions, onOpenDetails]);
11617
11616
  const config = getPostSourceConfig(post.source);
@@ -11646,7 +11645,6 @@ var PostCard = React98.forwardRef(
11646
11645
  tabIndex: 0,
11647
11646
  "data-slot": "post-card",
11648
11647
  "data-view": "compact",
11649
- "data-density": "compact",
11650
11648
  "data-source": post.source,
11651
11649
  "data-source-category": sourceCategory(post.source),
11652
11650
  "data-selected": selected || void 0,
@@ -11741,7 +11739,6 @@ var PostCard = React98.forwardRef(
11741
11739
  tabIndex: 0,
11742
11740
  "data-slot": "post-card",
11743
11741
  "data-view": "grid",
11744
- "data-density": "grid",
11745
11742
  "data-source": post.source,
11746
11743
  "data-source-category": sourceCategory(post.source),
11747
11744
  "data-selected": selected || void 0,
@@ -11826,7 +11823,6 @@ var PostCard = React98.forwardRef(
11826
11823
  tabIndex: onOpen ? 0 : void 0,
11827
11824
  "data-slot": "post-card",
11828
11825
  "data-view": "comfortable",
11829
- "data-density": "comfortable",
11830
11826
  "data-source": post.source,
11831
11827
  "data-source-category": sourceCategory(post.source),
11832
11828
  "data-selected": selected || void 0,
@@ -12605,8 +12601,6 @@ function readStoredView() {
12605
12601
  if (typeof window === "undefined") return null;
12606
12602
  const stored = window.localStorage.getItem(VIEW_STORAGE_KEY);
12607
12603
  if (stored === "compact" || stored === "comfortable" || stored === "grid") return stored;
12608
- const legacy = window.localStorage.getItem("parto-post-list-density");
12609
- if (legacy === "compact" || legacy === "comfortable") return legacy;
12610
12604
  return null;
12611
12605
  }
12612
12606
  function ts(d) {
@@ -12710,8 +12704,6 @@ var PostList = React98.forwardRef(
12710
12704
  posts,
12711
12705
  view: controlledView,
12712
12706
  onViewChange,
12713
- density: legacyDensity,
12714
- onDensityChange: legacyOnDensityChange,
12715
12707
  activeId,
12716
12708
  readIds,
12717
12709
  selectedIds,
@@ -12742,18 +12734,17 @@ var PostList = React98.forwardRef(
12742
12734
  }, ref) => {
12743
12735
  const [internalView, setInternalView] = React98.useState("comfortable");
12744
12736
  React98.useEffect(() => {
12745
- if (controlledView !== void 0 || legacyDensity !== void 0) return;
12737
+ if (controlledView !== void 0) return;
12746
12738
  const stored = readStoredView();
12747
12739
  if (stored) setInternalView(stored);
12748
- }, [controlledView, legacyDensity]);
12749
- const view = controlledView ?? legacyDensity ?? internalView;
12740
+ }, [controlledView]);
12741
+ const view = controlledView ?? internalView;
12750
12742
  const handleView = (next) => {
12751
- if (controlledView === void 0 && legacyDensity === void 0) {
12743
+ if (controlledView === void 0) {
12752
12744
  setInternalView(next);
12753
12745
  if (typeof window !== "undefined") window.localStorage.setItem(VIEW_STORAGE_KEY, next);
12754
12746
  }
12755
12747
  onViewChange?.(next);
12756
- if (next !== "grid") legacyOnDensityChange?.(next);
12757
12748
  };
12758
12749
  const readSet = React98.useMemo(() => toSet(readIds), [readIds]);
12759
12750
  const selectedSet = React98.useMemo(() => toSet(selectedIds), [selectedIds]);
@@ -12808,9 +12799,13 @@ var PostList = React98.forwardRef(
12808
12799
  onSelect: handleSelect,
12809
12800
  actions
12810
12801
  },
12811
- post.id
12802
+ `${post.id}:${view}`
12812
12803
  );
12813
- 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";
12804
+ const containerCls = React98.useMemo(() => {
12805
+ if (view === "grid") return "grid grid-cols-2 lg:grid-cols-3 gap-3 p-4";
12806
+ if (view === "comfortable") return "flex flex-col gap-3 p-4";
12807
+ return "flex flex-col";
12808
+ }, [view]);
12814
12809
  let body;
12815
12810
  if (isLoading) {
12816
12811
  body = loadingState ?? /* @__PURE__ */ jsx(DefaultLoading, { view });
@@ -18401,7 +18396,7 @@ var FlowDistributionSection = React98.forwardRef(
18401
18396
  );
18402
18397
  }
18403
18398
  );
18404
- var TopPostsSection = React98.forwardRef(function TopPostsSection2({ title, description, posts, topN = 5, density = "compact", locale = "fa", ...sectionProps }, ref) {
18399
+ var TopPostsSection = React98.forwardRef(function TopPostsSection2({ title, description, posts, topN = 5, view = "compact", locale = "fa", ...sectionProps }, ref) {
18405
18400
  const visible = posts.slice(0, topN);
18406
18401
  return /* @__PURE__ */ jsx(
18407
18402
  ReportSection,
@@ -18410,7 +18405,7 @@ var TopPostsSection = React98.forwardRef(function TopPostsSection2({ title, desc
18410
18405
  title: title ?? defaultTitle("topPosts", locale),
18411
18406
  description,
18412
18407
  ...sectionProps,
18413
- children: /* @__PURE__ */ jsx("div", { "data-slot": "report-section-top-posts", children: /* @__PURE__ */ jsx(PostList, { posts: visible, density }) })
18408
+ children: /* @__PURE__ */ jsx("div", { "data-slot": "report-section-top-posts", children: /* @__PURE__ */ jsx(PostList, { posts: visible, view }) })
18414
18409
  }
18415
18410
  );
18416
18411
  });