elseware-ui 2.31.5 → 2.31.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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React$1, { HTMLAttributes, ReactNode, JSX, FC, MouseEvent, MutableRefObject } from 'react';
2
+ import React$1, { HTMLAttributes, ReactNode, JSX, FC, ComponentType, MouseEvent, MutableRefObject } from 'react';
3
3
  import { ChartData, ChartOptions } from 'chart.js';
4
4
  import * as d3 from 'd3';
5
5
  import * as formik from 'formik';
@@ -1435,16 +1435,85 @@ interface CommentDataSource {
1435
1435
  reportComment?(commentId: string, reason: string, description?: string): Promise<void>;
1436
1436
  }
1437
1437
 
1438
+ interface CommentHeaderProps {
1439
+ comment: CommentEntity;
1440
+ }
1441
+ interface CommentContentProps {
1442
+ comment: CommentEntity;
1443
+ }
1444
+ interface CommentActionsProps {
1445
+ comment: CommentEntity;
1446
+ onLike?: () => void;
1447
+ onDislike?: () => void;
1448
+ onReply?: () => void;
1449
+ }
1450
+ interface CommentMenuProps {
1451
+ comment: CommentEntity;
1452
+ open: boolean;
1453
+ setOpen: (open: boolean) => void;
1454
+ canEdit?: boolean;
1455
+ canDelete?: boolean;
1456
+ canReport?: boolean;
1457
+ onEdit?: () => void;
1458
+ onDelete?: () => void;
1459
+ onReport?: () => void;
1460
+ }
1461
+ interface CommentComposerProps {
1462
+ avatar?: string;
1463
+ onSubmit: (content: string) => Promise<void> | void;
1464
+ }
1465
+ interface ReplyComposerProps {
1466
+ avatar?: string;
1467
+ username?: string;
1468
+ onSubmit: (content: string) => Promise<void> | void;
1469
+ }
1470
+ interface CommentRepliesToggleProps {
1471
+ collapsed: boolean;
1472
+ repliesCount: number;
1473
+ onToggle: () => void;
1474
+ }
1475
+ interface CommentComponents {
1476
+ /**
1477
+ * Root comment composer
1478
+ */
1479
+ Composer?: ComponentType<CommentComposerProps>;
1480
+ /**
1481
+ * Comment header section
1482
+ */
1483
+ Header?: ComponentType<CommentHeaderProps>;
1484
+ /**
1485
+ * Comment content renderer
1486
+ */
1487
+ Content?: ComponentType<CommentContentProps>;
1488
+ /**
1489
+ * Like / Dislike / Reply actions
1490
+ */
1491
+ Actions?: ComponentType<CommentActionsProps>;
1492
+ /**
1493
+ * Comment menu (Edit/Delete/Report)
1494
+ */
1495
+ Menu?: ComponentType<CommentMenuProps>;
1496
+ /**
1497
+ * Reply composer shown below a comment
1498
+ */
1499
+ ReplyComposer?: ComponentType<ReplyComposerProps>;
1500
+ /**
1501
+ * Replies expand/collapse component
1502
+ */
1503
+ RepliesToggle?: ComponentType<CommentRepliesToggleProps>;
1504
+ }
1505
+
1438
1506
  interface CommentThreadProps {
1439
1507
  postId: string;
1440
1508
  currentUser: CommentAuthor;
1441
1509
  dataSource: CommentDataSource;
1442
1510
  loading?: boolean;
1511
+ components?: CommentComponents;
1443
1512
  onEdit?: (comment: CommentEntity) => void;
1444
1513
  onDelete?: (comment: CommentEntity) => void;
1445
1514
  onReport?: (comment: CommentEntity) => void;
1446
1515
  }
1447
- declare function CommentThread({ currentUser, dataSource, loading, onEdit, onDelete, onReport, }: CommentThreadProps): react_jsx_runtime.JSX.Element;
1516
+ declare function CommentThread({ currentUser, dataSource, loading, components, onEdit, onDelete, onReport, }: CommentThreadProps): react_jsx_runtime.JSX.Element;
1448
1517
 
1449
1518
  type SortOption = {
1450
1519
  value: string;
@@ -1706,4 +1775,4 @@ interface ResolveAppearanceStylesProps {
1706
1775
  }
1707
1776
  declare function resolveAppearanceStyles({ appearance, variant, solid, lite, ghost, }: ResolveAppearanceStylesProps): string;
1708
1777
 
1709
- export { Accordion, type AnimationComponentProps, type AnimationVariant, type Appearance, AsyncComponentWrapper, Avatar, Backdrop, Badge, BarChart, type BaseAnimationConfig, type BaseComponentProps, type BaseMenuNode, type BaseOverlayConfig, type BaseTopNavNode, type BlobAnimationConfig, Block, BlockGroup, BoxNav, BoxNavItem, Brand, Breadcrumb, BreadcrumbItem, Button, Caption, Card, CardContent, CardFooter, CardHeader, type CardinalPosition, Chapter, Checkbox, Chip, type CloudinaryConfig, CloudinaryImage, CloudinaryProvider, type CloudinaryProviderProps, CloudinaryVideo, Code, type CommentAuthor, type CommentDataSource, type CommentEntity, type CommentPermissions, CommentThread, Content, ContentArea, type CornerPosition, type CreateCommentInput, type CurrencyCode, DataView, DataViewTable, DateSelector, DefaultLayout, type DefaultMenuElements, Display, DocumentationPanel, Drawer, DrawerToggler, type EUIComponentDefaults, type EUIConfigs, EUIDevLayout, EUIProvider, type EUIRoute, Flag, Flex, FlexCol, FlexRow, Footer, FooterNav, FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse, GenericLayout, GlowWrapper, type GradientAnimationConfig, Graph, type GraphData, GraphEdge, type GraphEdgeType, type GraphLayoutType, GraphNode, type GraphNodeType, type GraphProps, GraphRenderer, Grid, Header, HeaderNav, HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout, type HorizontalPosition, type HyperRefTarget, Image, ImageInput, Info, Input, InputFile, InputLabel, InputList, InputListGroup, InputResponse, Label, Layout, type LayoutContext, type LayoutExecutor, Lead, LineChart, Link, List, type ListAlign, type ListBulletType, type ListDirection, ListItem, type ListItemData, MarkdownEditor, MarkdownProvider, MarkdownTOC, MarkdownViewer, Menu, type MenuElementType, MenuGroup, type MenuGroupNode, MenuItem, type MenuItemNode, MenuItemTitle, type MenuNode, type MenuProps, type MenuTitleNode, type MeshAnimationConfig, Modal, MotionSurface, MultiImageInput, type NavItem, NumericRating, type OctilePosition, type OverlayVariant, Overline, Paragraph, PieChart, PriceTag, ProgressBar, type ProgressBarProps, ProgressBarRating, Quote, Radio, RouteTab, type RouteTabMode, RouteTabs, ScrollToTop, Section, Select, type Shape$1 as Shape, ShapeSwitch, ShowMore, Sidebar, SidebarLayout, SidemenuLayout, type Size$1 as Size, Skeleton, Slider, StarRating, StarRatingDistribution, StarRatingInput, Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table, Tag, Tags, TextArea, type TextDecoration, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, type TitleBannerLevel, Toast, type ToggleReactionResult, Tooltip, TopNav, type TopNavComponents, type TopNavGroupNode, type TopNavItemNode, type TopNavNode, type TopNavProps, type TopNavTitleNode, Transition, TransitionDropdown, TransitionFadeIn, Typography, UnderConstructionBanner, type UpdateCommentInput, ValueBadge, type Variant$1 as Variant, type VerticalPosition, WorldMap, WorldMapCountryTable, YoutubeVideo as YoutubeVideoPlayer, cn, createForceLayout, createGridLayout, createTreeLayout, enumValues, getCurrencySymbol, getLayout, isMatch, isRenderFn, normalize, registerLayout, resolveAppearanceStyles, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme, useDrawer, useEUIConfig, useIsMobile, useModal, useTheme };
1778
+ export { Accordion, type AnimationComponentProps, type AnimationVariant, type Appearance, AsyncComponentWrapper, Avatar, Backdrop, Badge, BarChart, type BaseAnimationConfig, type BaseComponentProps, type BaseMenuNode, type BaseOverlayConfig, type BaseTopNavNode, type BlobAnimationConfig, Block, BlockGroup, BoxNav, BoxNavItem, Brand, Breadcrumb, BreadcrumbItem, Button, Caption, Card, CardContent, CardFooter, CardHeader, type CardinalPosition, Chapter, Checkbox, Chip, type CloudinaryConfig, CloudinaryImage, CloudinaryProvider, type CloudinaryProviderProps, CloudinaryVideo, Code, type CommentActionsProps, type CommentAuthor, type CommentComponents, type CommentComposerProps, type CommentContentProps, type CommentDataSource, type CommentEntity, type CommentHeaderProps, type CommentMenuProps, type CommentPermissions, type CommentRepliesToggleProps, CommentThread, Content, ContentArea, type CornerPosition, type CreateCommentInput, type CurrencyCode, DataView, DataViewTable, DateSelector, DefaultLayout, type DefaultMenuElements, Display, DocumentationPanel, Drawer, DrawerToggler, type EUIComponentDefaults, type EUIConfigs, EUIDevLayout, EUIProvider, type EUIRoute, Flag, Flex, FlexCol, FlexRow, Footer, FooterNav, FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse, GenericLayout, GlowWrapper, type GradientAnimationConfig, Graph, type GraphData, GraphEdge, type GraphEdgeType, type GraphLayoutType, GraphNode, type GraphNodeType, type GraphProps, GraphRenderer, Grid, Header, HeaderNav, HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout, type HorizontalPosition, type HyperRefTarget, Image, ImageInput, Info, Input, InputFile, InputLabel, InputList, InputListGroup, InputResponse, Label, Layout, type LayoutContext, type LayoutExecutor, Lead, LineChart, Link, List, type ListAlign, type ListBulletType, type ListDirection, ListItem, type ListItemData, MarkdownEditor, MarkdownProvider, MarkdownTOC, MarkdownViewer, Menu, type MenuElementType, MenuGroup, type MenuGroupNode, MenuItem, type MenuItemNode, MenuItemTitle, type MenuNode, type MenuProps, type MenuTitleNode, type MeshAnimationConfig, Modal, MotionSurface, MultiImageInput, type NavItem, NumericRating, type OctilePosition, type OverlayVariant, Overline, Paragraph, PieChart, PriceTag, ProgressBar, type ProgressBarProps, ProgressBarRating, Quote, Radio, type ReplyComposerProps, RouteTab, type RouteTabMode, RouteTabs, ScrollToTop, Section, Select, type Shape$1 as Shape, ShapeSwitch, ShowMore, Sidebar, SidebarLayout, SidemenuLayout, type Size$1 as Size, Skeleton, Slider, StarRating, StarRatingDistribution, StarRatingInput, Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table, Tag, Tags, TextArea, type TextDecoration, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, type TitleBannerLevel, Toast, type ToggleReactionResult, Tooltip, TopNav, type TopNavComponents, type TopNavGroupNode, type TopNavItemNode, type TopNavNode, type TopNavProps, type TopNavTitleNode, Transition, TransitionDropdown, TransitionFadeIn, Typography, UnderConstructionBanner, type UpdateCommentInput, ValueBadge, type Variant$1 as Variant, type VerticalPosition, WorldMap, WorldMapCountryTable, YoutubeVideo as YoutubeVideoPlayer, cn, createForceLayout, createGridLayout, createTreeLayout, enumValues, getCurrencySymbol, getLayout, isMatch, isRenderFn, normalize, registerLayout, resolveAppearanceStyles, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme, useDrawer, useEUIConfig, useIsMobile, useModal, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React$1, { HTMLAttributes, ReactNode, JSX, FC, MouseEvent, MutableRefObject } from 'react';
2
+ import React$1, { HTMLAttributes, ReactNode, JSX, FC, ComponentType, MouseEvent, MutableRefObject } from 'react';
3
3
  import { ChartData, ChartOptions } from 'chart.js';
4
4
  import * as d3 from 'd3';
5
5
  import * as formik from 'formik';
@@ -1435,16 +1435,85 @@ interface CommentDataSource {
1435
1435
  reportComment?(commentId: string, reason: string, description?: string): Promise<void>;
1436
1436
  }
1437
1437
 
1438
+ interface CommentHeaderProps {
1439
+ comment: CommentEntity;
1440
+ }
1441
+ interface CommentContentProps {
1442
+ comment: CommentEntity;
1443
+ }
1444
+ interface CommentActionsProps {
1445
+ comment: CommentEntity;
1446
+ onLike?: () => void;
1447
+ onDislike?: () => void;
1448
+ onReply?: () => void;
1449
+ }
1450
+ interface CommentMenuProps {
1451
+ comment: CommentEntity;
1452
+ open: boolean;
1453
+ setOpen: (open: boolean) => void;
1454
+ canEdit?: boolean;
1455
+ canDelete?: boolean;
1456
+ canReport?: boolean;
1457
+ onEdit?: () => void;
1458
+ onDelete?: () => void;
1459
+ onReport?: () => void;
1460
+ }
1461
+ interface CommentComposerProps {
1462
+ avatar?: string;
1463
+ onSubmit: (content: string) => Promise<void> | void;
1464
+ }
1465
+ interface ReplyComposerProps {
1466
+ avatar?: string;
1467
+ username?: string;
1468
+ onSubmit: (content: string) => Promise<void> | void;
1469
+ }
1470
+ interface CommentRepliesToggleProps {
1471
+ collapsed: boolean;
1472
+ repliesCount: number;
1473
+ onToggle: () => void;
1474
+ }
1475
+ interface CommentComponents {
1476
+ /**
1477
+ * Root comment composer
1478
+ */
1479
+ Composer?: ComponentType<CommentComposerProps>;
1480
+ /**
1481
+ * Comment header section
1482
+ */
1483
+ Header?: ComponentType<CommentHeaderProps>;
1484
+ /**
1485
+ * Comment content renderer
1486
+ */
1487
+ Content?: ComponentType<CommentContentProps>;
1488
+ /**
1489
+ * Like / Dislike / Reply actions
1490
+ */
1491
+ Actions?: ComponentType<CommentActionsProps>;
1492
+ /**
1493
+ * Comment menu (Edit/Delete/Report)
1494
+ */
1495
+ Menu?: ComponentType<CommentMenuProps>;
1496
+ /**
1497
+ * Reply composer shown below a comment
1498
+ */
1499
+ ReplyComposer?: ComponentType<ReplyComposerProps>;
1500
+ /**
1501
+ * Replies expand/collapse component
1502
+ */
1503
+ RepliesToggle?: ComponentType<CommentRepliesToggleProps>;
1504
+ }
1505
+
1438
1506
  interface CommentThreadProps {
1439
1507
  postId: string;
1440
1508
  currentUser: CommentAuthor;
1441
1509
  dataSource: CommentDataSource;
1442
1510
  loading?: boolean;
1511
+ components?: CommentComponents;
1443
1512
  onEdit?: (comment: CommentEntity) => void;
1444
1513
  onDelete?: (comment: CommentEntity) => void;
1445
1514
  onReport?: (comment: CommentEntity) => void;
1446
1515
  }
1447
- declare function CommentThread({ currentUser, dataSource, loading, onEdit, onDelete, onReport, }: CommentThreadProps): react_jsx_runtime.JSX.Element;
1516
+ declare function CommentThread({ currentUser, dataSource, loading, components, onEdit, onDelete, onReport, }: CommentThreadProps): react_jsx_runtime.JSX.Element;
1448
1517
 
1449
1518
  type SortOption = {
1450
1519
  value: string;
@@ -1706,4 +1775,4 @@ interface ResolveAppearanceStylesProps {
1706
1775
  }
1707
1776
  declare function resolveAppearanceStyles({ appearance, variant, solid, lite, ghost, }: ResolveAppearanceStylesProps): string;
1708
1777
 
1709
- export { Accordion, type AnimationComponentProps, type AnimationVariant, type Appearance, AsyncComponentWrapper, Avatar, Backdrop, Badge, BarChart, type BaseAnimationConfig, type BaseComponentProps, type BaseMenuNode, type BaseOverlayConfig, type BaseTopNavNode, type BlobAnimationConfig, Block, BlockGroup, BoxNav, BoxNavItem, Brand, Breadcrumb, BreadcrumbItem, Button, Caption, Card, CardContent, CardFooter, CardHeader, type CardinalPosition, Chapter, Checkbox, Chip, type CloudinaryConfig, CloudinaryImage, CloudinaryProvider, type CloudinaryProviderProps, CloudinaryVideo, Code, type CommentAuthor, type CommentDataSource, type CommentEntity, type CommentPermissions, CommentThread, Content, ContentArea, type CornerPosition, type CreateCommentInput, type CurrencyCode, DataView, DataViewTable, DateSelector, DefaultLayout, type DefaultMenuElements, Display, DocumentationPanel, Drawer, DrawerToggler, type EUIComponentDefaults, type EUIConfigs, EUIDevLayout, EUIProvider, type EUIRoute, Flag, Flex, FlexCol, FlexRow, Footer, FooterNav, FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse, GenericLayout, GlowWrapper, type GradientAnimationConfig, Graph, type GraphData, GraphEdge, type GraphEdgeType, type GraphLayoutType, GraphNode, type GraphNodeType, type GraphProps, GraphRenderer, Grid, Header, HeaderNav, HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout, type HorizontalPosition, type HyperRefTarget, Image, ImageInput, Info, Input, InputFile, InputLabel, InputList, InputListGroup, InputResponse, Label, Layout, type LayoutContext, type LayoutExecutor, Lead, LineChart, Link, List, type ListAlign, type ListBulletType, type ListDirection, ListItem, type ListItemData, MarkdownEditor, MarkdownProvider, MarkdownTOC, MarkdownViewer, Menu, type MenuElementType, MenuGroup, type MenuGroupNode, MenuItem, type MenuItemNode, MenuItemTitle, type MenuNode, type MenuProps, type MenuTitleNode, type MeshAnimationConfig, Modal, MotionSurface, MultiImageInput, type NavItem, NumericRating, type OctilePosition, type OverlayVariant, Overline, Paragraph, PieChart, PriceTag, ProgressBar, type ProgressBarProps, ProgressBarRating, Quote, Radio, RouteTab, type RouteTabMode, RouteTabs, ScrollToTop, Section, Select, type Shape$1 as Shape, ShapeSwitch, ShowMore, Sidebar, SidebarLayout, SidemenuLayout, type Size$1 as Size, Skeleton, Slider, StarRating, StarRatingDistribution, StarRatingInput, Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table, Tag, Tags, TextArea, type TextDecoration, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, type TitleBannerLevel, Toast, type ToggleReactionResult, Tooltip, TopNav, type TopNavComponents, type TopNavGroupNode, type TopNavItemNode, type TopNavNode, type TopNavProps, type TopNavTitleNode, Transition, TransitionDropdown, TransitionFadeIn, Typography, UnderConstructionBanner, type UpdateCommentInput, ValueBadge, type Variant$1 as Variant, type VerticalPosition, WorldMap, WorldMapCountryTable, YoutubeVideo as YoutubeVideoPlayer, cn, createForceLayout, createGridLayout, createTreeLayout, enumValues, getCurrencySymbol, getLayout, isMatch, isRenderFn, normalize, registerLayout, resolveAppearanceStyles, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme, useDrawer, useEUIConfig, useIsMobile, useModal, useTheme };
1778
+ export { Accordion, type AnimationComponentProps, type AnimationVariant, type Appearance, AsyncComponentWrapper, Avatar, Backdrop, Badge, BarChart, type BaseAnimationConfig, type BaseComponentProps, type BaseMenuNode, type BaseOverlayConfig, type BaseTopNavNode, type BlobAnimationConfig, Block, BlockGroup, BoxNav, BoxNavItem, Brand, Breadcrumb, BreadcrumbItem, Button, Caption, Card, CardContent, CardFooter, CardHeader, type CardinalPosition, Chapter, Checkbox, Chip, type CloudinaryConfig, CloudinaryImage, CloudinaryProvider, type CloudinaryProviderProps, CloudinaryVideo, Code, type CommentActionsProps, type CommentAuthor, type CommentComponents, type CommentComposerProps, type CommentContentProps, type CommentDataSource, type CommentEntity, type CommentHeaderProps, type CommentMenuProps, type CommentPermissions, type CommentRepliesToggleProps, CommentThread, Content, ContentArea, type CornerPosition, type CreateCommentInput, type CurrencyCode, DataView, DataViewTable, DateSelector, DefaultLayout, type DefaultMenuElements, Display, DocumentationPanel, Drawer, DrawerToggler, type EUIComponentDefaults, type EUIConfigs, EUIDevLayout, EUIProvider, type EUIRoute, Flag, Flex, FlexCol, FlexRow, Footer, FooterNav, FooterNavGroup, FooterNavItem, FooterNavItemContext, FooterNavItemTitle, Form, FormResponse, GenericLayout, GlowWrapper, type GradientAnimationConfig, Graph, type GraphData, GraphEdge, type GraphEdgeType, type GraphLayoutType, GraphNode, type GraphNodeType, type GraphProps, GraphRenderer, Grid, Header, HeaderNav, HeaderNavGroup, HeaderNavItem, HeaderNavItemContext, HeaderNavItemTitle, HomeLayout, type HorizontalPosition, type HyperRefTarget, Image, ImageInput, Info, Input, InputFile, InputLabel, InputList, InputListGroup, InputResponse, Label, Layout, type LayoutContext, type LayoutExecutor, Lead, LineChart, Link, List, type ListAlign, type ListBulletType, type ListDirection, ListItem, type ListItemData, MarkdownEditor, MarkdownProvider, MarkdownTOC, MarkdownViewer, Menu, type MenuElementType, MenuGroup, type MenuGroupNode, MenuItem, type MenuItemNode, MenuItemTitle, type MenuNode, type MenuProps, type MenuTitleNode, type MeshAnimationConfig, Modal, MotionSurface, MultiImageInput, type NavItem, NumericRating, type OctilePosition, type OverlayVariant, Overline, Paragraph, PieChart, PriceTag, ProgressBar, type ProgressBarProps, ProgressBarRating, Quote, Radio, type ReplyComposerProps, RouteTab, type RouteTabMode, RouteTabs, ScrollToTop, Section, Select, type Shape$1 as Shape, ShapeSwitch, ShowMore, Sidebar, SidebarLayout, SidemenuLayout, type Size$1 as Size, Skeleton, Slider, StarRating, StarRatingDistribution, StarRatingInput, Switch, TNDropdown, TNDropdownItem, TNDropdownTitle, TNGroup, Table, Tag, Tags, TextArea, type TextDecoration, ThemeContext, ThemeProvider, ThemeSwitch, TitleBanner, type TitleBannerLevel, Toast, type ToggleReactionResult, Tooltip, TopNav, type TopNavComponents, type TopNavGroupNode, type TopNavItemNode, type TopNavNode, type TopNavProps, type TopNavTitleNode, Transition, TransitionDropdown, TransitionFadeIn, Typography, UnderConstructionBanner, type UpdateCommentInput, ValueBadge, type Variant$1 as Variant, type VerticalPosition, WorldMap, WorldMapCountryTable, YoutubeVideo as YoutubeVideoPlayer, cn, createForceLayout, createGridLayout, createTreeLayout, enumValues, getCurrencySymbol, getLayout, isMatch, isRenderFn, normalize, registerLayout, resolveAppearanceStyles, resolveWithGlobal, sendToast, useClickOutside, useCloudinaryConfig, useCurrentTheme, useDrawer, useEUIConfig, useIsMobile, useModal, useTheme };
package/dist/index.js CHANGED
@@ -17550,15 +17550,16 @@ function CommentComposer({
17550
17550
  }
17551
17551
  var CommentComposer_default = CommentComposer;
17552
17552
  function CommentActions({
17553
- likes = 0,
17554
- dislikes = 0,
17555
- liked = false,
17556
- disliked = false,
17557
- canReply = true,
17553
+ comment,
17558
17554
  onLike,
17559
17555
  onDislike,
17560
17556
  onReply
17561
17557
  }) {
17558
+ const likes = comment.likes ?? 0;
17559
+ const dislikes = comment.dislikes ?? 0;
17560
+ const liked = comment.liked ?? false;
17561
+ const disliked = comment.disliked ?? false;
17562
+ const canReply = comment.permissions?.canReply ?? true;
17562
17563
  return /* @__PURE__ */ jsxRuntime.jsxs(
17563
17564
  "div",
17564
17565
  {
@@ -17611,14 +17612,8 @@ function CommentActions({
17611
17612
  );
17612
17613
  }
17613
17614
  var CommentActions_default = CommentActions;
17614
- function CommentContent({ content }) {
17615
- return /* @__PURE__ */ jsxRuntime.jsx(
17616
- "div",
17617
- {
17618
- className: "\n text-sm\n leading-relaxed\n whitespace-pre-wrap\n break-words\n text-gray-700\n dark:text-gray-300\n ",
17619
- children: content
17620
- }
17621
- );
17615
+ function CommentContent({ comment }) {
17616
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap break-words text-sm text-gray-700 dark:text-gray-300", children: comment.content });
17622
17617
  }
17623
17618
  var CommentContent_default = CommentContent;
17624
17619
 
@@ -17657,31 +17652,29 @@ function formatCommentDate(date) {
17657
17652
  }
17658
17653
  return "Just now";
17659
17654
  }
17660
- function CommentHeader({
17661
- avatar,
17662
- username,
17663
- firstName,
17664
- lastName,
17665
- createdAt,
17666
- edited
17667
- }) {
17668
- const displayName = firstName || lastName ? `${firstName ?? ""} ${lastName ?? ""}`.trim() : username;
17655
+ function CommentHeader({ comment }) {
17656
+ const author = comment.author;
17657
+ const displayName = author?.firstName || author?.lastName ? `${author?.firstName ?? ""} ${author?.lastName ?? ""}`.trim() : author?.username ?? "Unknown";
17669
17658
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [
17670
- /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatar, size: "sm" }),
17659
+ /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: author?.avatar, size: "sm" }),
17671
17660
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-wrap min-w-0", children: [
17672
17661
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-sm text-gray-900 dark:text-gray-100", children: displayName }),
17673
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
17674
- "@",
17675
- username
17662
+ author?.username && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17663
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
17664
+ "@",
17665
+ author.username
17666
+ ] }),
17667
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "\xB7" })
17676
17668
  ] }),
17677
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: "\xB7" }),
17678
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: formatCommentDate(createdAt) }),
17679
- edited && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-400 dark:text-gray-500", children: "(edited)" })
17669
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: formatCommentDate(comment.createdAt) }),
17670
+ comment.edited && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-400 dark:text-gray-500", children: "(edited)" })
17680
17671
  ] })
17681
17672
  ] });
17682
17673
  }
17683
17674
  var CommentHeader_default = CommentHeader;
17684
17675
  function CommentMenu({
17676
+ open,
17677
+ setOpen,
17685
17678
  canEdit,
17686
17679
  canDelete,
17687
17680
  canReport,
@@ -17689,7 +17682,6 @@ function CommentMenu({
17689
17682
  onDelete,
17690
17683
  onReport
17691
17684
  }) {
17692
- const [open, setOpen] = React4.useState(false);
17693
17685
  const ref = React4.useRef(null);
17694
17686
  React4.useEffect(() => {
17695
17687
  function handleOutsideClick(event) {
@@ -17699,7 +17691,7 @@ function CommentMenu({
17699
17691
  }
17700
17692
  document.addEventListener("mousedown", handleOutsideClick);
17701
17693
  return () => document.removeEventListener("mousedown", handleOutsideClick);
17702
- }, []);
17694
+ }, [setOpen]);
17703
17695
  const hasActions = canEdit || canDelete || canReport;
17704
17696
  if (!hasActions) {
17705
17697
  return null;
@@ -17709,7 +17701,7 @@ function CommentMenu({
17709
17701
  "button",
17710
17702
  {
17711
17703
  type: "button",
17712
- onClick: () => setOpen((prev) => !prev),
17704
+ onClick: () => setOpen(!open),
17713
17705
  className: "\n text-gray-500\n hover:text-gray-900\n dark:hover:text-gray-100\n transition-colors\n ",
17714
17706
  children: /* @__PURE__ */ jsxRuntime.jsx(bi.BiDotsVerticalRounded, { size: 18 })
17715
17707
  }
@@ -17818,6 +17810,7 @@ var COMMENT_INDENTATION = 24;
17818
17810
  function CommentItem({
17819
17811
  comment,
17820
17812
  depth = 0,
17813
+ components,
17821
17814
  onLike,
17822
17815
  onDislike,
17823
17816
  onReply,
@@ -17828,10 +17821,19 @@ function CommentItem({
17828
17821
  const [collapsed, setCollapsed] = React4.useState(false);
17829
17822
  const [isReplying, setIsReplying] = React4.useState(false);
17830
17823
  const resolvedDepth = Math.min(depth, MAX_COMMENT_DEPTH);
17824
+ const {
17825
+ Header: HeaderComponent = CommentHeader_default,
17826
+ Content: ContentComponent = CommentContent_default,
17827
+ Actions: ActionsComponent = CommentActions_default,
17828
+ Menu: MenuComponent = CommentMenu_default,
17829
+ ReplyComposer: ReplyComposerComponent = ReplyComposer_default,
17830
+ RepliesToggle: RepliesToggleComponent = CommentRepliesToggle_default
17831
+ } = components ?? {};
17831
17832
  async function handleReply(content) {
17832
17833
  await onReply?.(comment, content);
17833
17834
  setIsReplying(false);
17834
17835
  }
17836
+ const [menuOpen, setMenuOpen] = React4.useState(false);
17835
17837
  return /* @__PURE__ */ jsxRuntime.jsxs(
17836
17838
  "div",
17837
17839
  {
@@ -17842,20 +17844,13 @@ function CommentItem({
17842
17844
  children: [
17843
17845
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col gap-3 min-w-0", children: [
17844
17846
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
17847
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderComponent, { comment }),
17845
17848
  /* @__PURE__ */ jsxRuntime.jsx(
17846
- CommentHeader_default,
17847
- {
17848
- avatar: comment.author?.avatar,
17849
- username: comment.author?.username ?? "unknown",
17850
- firstName: comment.author?.firstName,
17851
- lastName: comment.author?.lastName,
17852
- createdAt: comment.createdAt,
17853
- edited: comment.edited
17854
- }
17855
- ),
17856
- /* @__PURE__ */ jsxRuntime.jsx(
17857
- CommentMenu_default,
17849
+ MenuComponent,
17858
17850
  {
17851
+ comment,
17852
+ open: menuOpen,
17853
+ setOpen: setMenuOpen,
17859
17854
  canEdit: comment.permissions?.canEdit,
17860
17855
  canDelete: comment.permissions?.canDelete,
17861
17856
  canReport: comment.permissions?.canReport,
@@ -17865,22 +17860,18 @@ function CommentItem({
17865
17860
  }
17866
17861
  )
17867
17862
  ] }),
17868
- /* @__PURE__ */ jsxRuntime.jsx(CommentContent_default, { content: comment.content }),
17863
+ /* @__PURE__ */ jsxRuntime.jsx(ContentComponent, { comment }),
17869
17864
  /* @__PURE__ */ jsxRuntime.jsx(
17870
- CommentActions_default,
17865
+ ActionsComponent,
17871
17866
  {
17872
- likes: comment.likes,
17873
- dislikes: comment.dislikes,
17874
- liked: comment.liked,
17875
- disliked: comment.disliked,
17876
- canReply: comment.permissions?.canReply,
17867
+ comment,
17877
17868
  onLike: () => onLike?.(comment),
17878
17869
  onDislike: () => onDislike?.(comment),
17879
17870
  onReply: () => setIsReplying((prev) => !prev)
17880
17871
  }
17881
17872
  ),
17882
17873
  isReplying && /* @__PURE__ */ jsxRuntime.jsx(
17883
- ReplyComposer_default,
17874
+ ReplyComposerComponent,
17884
17875
  {
17885
17876
  avatar: comment.author?.avatar,
17886
17877
  username: comment.author?.username,
@@ -17888,7 +17879,7 @@ function CommentItem({
17888
17879
  }
17889
17880
  ),
17890
17881
  !!comment.replies?.length && /* @__PURE__ */ jsxRuntime.jsx(
17891
- CommentRepliesToggle_default,
17882
+ RepliesToggleComponent,
17892
17883
  {
17893
17884
  collapsed,
17894
17885
  repliesCount: comment.replies.length,
@@ -17908,6 +17899,7 @@ function CommentItem({
17908
17899
  {
17909
17900
  comments: comment.replies,
17910
17901
  depth: depth + 1,
17902
+ components,
17911
17903
  onLike,
17912
17904
  onDislike,
17913
17905
  onReply,
@@ -17926,6 +17918,7 @@ var CommentItem_default = CommentItem;
17926
17918
  function CommentList({
17927
17919
  comments,
17928
17920
  depth = 0,
17921
+ components,
17929
17922
  onLike,
17930
17923
  onDislike,
17931
17924
  onReply,
@@ -17941,6 +17934,7 @@ function CommentList({
17941
17934
  {
17942
17935
  comment,
17943
17936
  depth,
17937
+ components,
17944
17938
  onLike,
17945
17939
  onDislike,
17946
17940
  onReply,
@@ -18009,12 +18003,14 @@ function CommentThread({
18009
18003
  currentUser,
18010
18004
  dataSource,
18011
18005
  loading = false,
18006
+ components,
18012
18007
  onEdit,
18013
18008
  onDelete,
18014
18009
  onReport
18015
18010
  }) {
18016
18011
  const [comments, setComments] = React4.useState([]);
18017
18012
  const [isLoadingComments, setIsLoadingComments] = React4.useState(true);
18013
+ const ComposerComponent = components?.ReplyComposer ?? CommentComposer_default;
18018
18014
  React4.useEffect(() => {
18019
18015
  async function loadComments() {
18020
18016
  try {
@@ -18044,7 +18040,7 @@ function CommentThread({
18044
18040
  const optimistic = {
18045
18041
  liked: !comment.liked,
18046
18042
  disliked: false,
18047
- likes: comment.liked ? comment.likes - 1 : comment.likes + 1,
18043
+ likes: comment.liked ? Math.max(comment.likes - 1, 0) : comment.likes + 1,
18048
18044
  dislikes: comment.disliked ? Math.max(comment.dislikes - 1, 0) : comment.dislikes
18049
18045
  };
18050
18046
  setComments(
@@ -18067,7 +18063,7 @@ function CommentThread({
18067
18063
  liked: false,
18068
18064
  disliked: !comment.disliked,
18069
18065
  likes: comment.liked ? Math.max(comment.likes - 1, 0) : comment.likes,
18070
- dislikes: comment.disliked ? comment.dislikes - 1 : comment.dislikes + 1
18066
+ dislikes: comment.disliked ? Math.max(comment.dislikes - 1, 0) : comment.dislikes + 1
18071
18067
  };
18072
18068
  setComments(
18073
18069
  (prev) => updateComment(prev, comment.id, (item) => ({
@@ -18089,7 +18085,7 @@ function CommentThread({
18089
18085
  }
18090
18086
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-8", children: [
18091
18087
  /* @__PURE__ */ jsxRuntime.jsx(
18092
- CommentComposer_default,
18088
+ ComposerComponent,
18093
18089
  {
18094
18090
  avatar: currentUser.avatar,
18095
18091
  onSubmit: handleCreateComment
@@ -18099,6 +18095,7 @@ function CommentThread({
18099
18095
  CommentList_default,
18100
18096
  {
18101
18097
  comments,
18098
+ components,
18102
18099
  onLike: handleLike,
18103
18100
  onDislike: handleDislike,
18104
18101
  onReply: handleReply,