@bubble-design-system/ui 1.1.0 → 1.2.0
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/README.md +253 -1
- package/dist/index.cjs +343 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +340 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +338 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ComponentPropsWithoutRef, ReactNode, HTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
3
|
+
import { ComponentPropsWithoutRef, ReactNode, HTMLAttributes, TextareaHTMLAttributes, ChangeEvent } from 'react';
|
|
4
4
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
5
5
|
import { Input as Input$1 } from '@base-ui/react/input';
|
|
6
6
|
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
@@ -438,4 +438,39 @@ declare function useCommandPalette(): {
|
|
|
438
438
|
};
|
|
439
439
|
declare function CommandPalette({ open, onOpenChange, groups, placeholder, onSelect, className, }: CommandPaletteProps): react_jsx_runtime.JSX.Element;
|
|
440
440
|
|
|
441
|
-
|
|
441
|
+
type ChatMessageSide = "sent" | "received";
|
|
442
|
+
type ChatMessagePosition = "solo" | "first" | "middle" | "last";
|
|
443
|
+
type ChatMessageStatus = "sending" | "sent" | "delivered" | "read";
|
|
444
|
+
interface ChatReaction {
|
|
445
|
+
emoji: string;
|
|
446
|
+
count?: number;
|
|
447
|
+
mine?: boolean;
|
|
448
|
+
}
|
|
449
|
+
interface ChatThreadProps extends ComponentPropsWithoutRef<"div"> {
|
|
450
|
+
}
|
|
451
|
+
declare const ChatThread: react.ForwardRefExoticComponent<ChatThreadProps & react.RefAttributes<HTMLDivElement>>;
|
|
452
|
+
interface ChatDateDividerProps extends ComponentPropsWithoutRef<"div"> {
|
|
453
|
+
}
|
|
454
|
+
declare const ChatDateDivider: react.ForwardRefExoticComponent<ChatDateDividerProps & react.RefAttributes<HTMLDivElement>>;
|
|
455
|
+
interface ChatMessageProps extends ComponentPropsWithoutRef<"div"> {
|
|
456
|
+
side?: ChatMessageSide;
|
|
457
|
+
name?: string;
|
|
458
|
+
avatar?: ReactNode;
|
|
459
|
+
time?: string;
|
|
460
|
+
status?: ChatMessageStatus;
|
|
461
|
+
reactions?: ChatReaction[];
|
|
462
|
+
position?: ChatMessagePosition;
|
|
463
|
+
}
|
|
464
|
+
declare const ChatMessage: react.ForwardRefExoticComponent<ChatMessageProps & react.RefAttributes<HTMLDivElement>>;
|
|
465
|
+
interface ChatComposeProps {
|
|
466
|
+
value?: string;
|
|
467
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
468
|
+
onSend?: (value: string) => void;
|
|
469
|
+
placeholder?: string;
|
|
470
|
+
avatar?: ReactNode;
|
|
471
|
+
disabled?: boolean;
|
|
472
|
+
className?: string;
|
|
473
|
+
}
|
|
474
|
+
declare function ChatCompose({ value, onChange, onSend, placeholder, avatar, disabled, className, }: ChatComposeProps): react_jsx_runtime.JSX.Element;
|
|
475
|
+
|
|
476
|
+
export { Alert, type AlertProps, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardActionProps, type CardBodyProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardProps, type CardTitleProps, ChatCompose, type ChatComposeProps, ChatDateDivider, type ChatDateDividerProps, ChatMessage, type ChatMessagePosition, type ChatMessageProps, type ChatMessageSide, type ChatMessageStatus, type ChatReaction, ChatThread, type ChatThreadProps, Checkbox, type CheckboxProps, CommandPalette, type CommandPaletteGroup, type CommandPaletteItem, type CommandPaletteProps, Container, type ContainerProps, DataTable, type DataTableColumn, type DataTableProps, Divider, type DividerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRadioItemProps, type DropdownMenuSeparatorProps, Grid, type GridColProps, type GridRootProps, Input, type InputProps, Modal, type ModalContentProps, type ModalDescriptionProps, type ModalTitleProps, Popover, type PopoverBodyProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverFooterProps, type PopoverHeaderProps, type PopoverTitleProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Segmented, type SegmentedItemProps, type SegmentedProps, Select, type SelectContentProps, type SelectItemProps, type SelectTriggerProps, type SelectValueProps, Skeleton, type SkeletonProps, StatusPill, type StatusPillIndicatorProps, type StatusPillLabelProps, type StatusPillProps, Switch, type SwitchProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, Textarea, type TextareaProps, Toast, Tooltip, type TooltipContentProps, cn, useCommandPalette, useToastManager as useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ComponentPropsWithoutRef, ReactNode, HTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
3
|
+
import { ComponentPropsWithoutRef, ReactNode, HTMLAttributes, TextareaHTMLAttributes, ChangeEvent } from 'react';
|
|
4
4
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
5
5
|
import { Input as Input$1 } from '@base-ui/react/input';
|
|
6
6
|
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
@@ -438,4 +438,39 @@ declare function useCommandPalette(): {
|
|
|
438
438
|
};
|
|
439
439
|
declare function CommandPalette({ open, onOpenChange, groups, placeholder, onSelect, className, }: CommandPaletteProps): react_jsx_runtime.JSX.Element;
|
|
440
440
|
|
|
441
|
-
|
|
441
|
+
type ChatMessageSide = "sent" | "received";
|
|
442
|
+
type ChatMessagePosition = "solo" | "first" | "middle" | "last";
|
|
443
|
+
type ChatMessageStatus = "sending" | "sent" | "delivered" | "read";
|
|
444
|
+
interface ChatReaction {
|
|
445
|
+
emoji: string;
|
|
446
|
+
count?: number;
|
|
447
|
+
mine?: boolean;
|
|
448
|
+
}
|
|
449
|
+
interface ChatThreadProps extends ComponentPropsWithoutRef<"div"> {
|
|
450
|
+
}
|
|
451
|
+
declare const ChatThread: react.ForwardRefExoticComponent<ChatThreadProps & react.RefAttributes<HTMLDivElement>>;
|
|
452
|
+
interface ChatDateDividerProps extends ComponentPropsWithoutRef<"div"> {
|
|
453
|
+
}
|
|
454
|
+
declare const ChatDateDivider: react.ForwardRefExoticComponent<ChatDateDividerProps & react.RefAttributes<HTMLDivElement>>;
|
|
455
|
+
interface ChatMessageProps extends ComponentPropsWithoutRef<"div"> {
|
|
456
|
+
side?: ChatMessageSide;
|
|
457
|
+
name?: string;
|
|
458
|
+
avatar?: ReactNode;
|
|
459
|
+
time?: string;
|
|
460
|
+
status?: ChatMessageStatus;
|
|
461
|
+
reactions?: ChatReaction[];
|
|
462
|
+
position?: ChatMessagePosition;
|
|
463
|
+
}
|
|
464
|
+
declare const ChatMessage: react.ForwardRefExoticComponent<ChatMessageProps & react.RefAttributes<HTMLDivElement>>;
|
|
465
|
+
interface ChatComposeProps {
|
|
466
|
+
value?: string;
|
|
467
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
468
|
+
onSend?: (value: string) => void;
|
|
469
|
+
placeholder?: string;
|
|
470
|
+
avatar?: ReactNode;
|
|
471
|
+
disabled?: boolean;
|
|
472
|
+
className?: string;
|
|
473
|
+
}
|
|
474
|
+
declare function ChatCompose({ value, onChange, onSend, placeholder, avatar, disabled, className, }: ChatComposeProps): react_jsx_runtime.JSX.Element;
|
|
475
|
+
|
|
476
|
+
export { Alert, type AlertProps, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardActionProps, type CardBodyProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardProps, type CardTitleProps, ChatCompose, type ChatComposeProps, ChatDateDivider, type ChatDateDividerProps, ChatMessage, type ChatMessagePosition, type ChatMessageProps, type ChatMessageSide, type ChatMessageStatus, type ChatReaction, ChatThread, type ChatThreadProps, Checkbox, type CheckboxProps, CommandPalette, type CommandPaletteGroup, type CommandPaletteItem, type CommandPaletteProps, Container, type ContainerProps, DataTable, type DataTableColumn, type DataTableProps, Divider, type DividerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRadioItemProps, type DropdownMenuSeparatorProps, Grid, type GridColProps, type GridRootProps, Input, type InputProps, Modal, type ModalContentProps, type ModalDescriptionProps, type ModalTitleProps, Popover, type PopoverBodyProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverFooterProps, type PopoverHeaderProps, type PopoverTitleProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Segmented, type SegmentedItemProps, type SegmentedProps, Select, type SelectContentProps, type SelectItemProps, type SelectTriggerProps, type SelectValueProps, Skeleton, type SkeletonProps, StatusPill, type StatusPillIndicatorProps, type StatusPillLabelProps, type StatusPillProps, Switch, type SwitchProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, Textarea, type TextareaProps, Toast, Tooltip, type TooltipContentProps, cn, useCommandPalette, useToastManager as useToast };
|
package/dist/index.js
CHANGED
|
@@ -1491,7 +1491,7 @@ function CommandPalette({
|
|
|
1491
1491
|
open,
|
|
1492
1492
|
onOpenChange,
|
|
1493
1493
|
groups = [],
|
|
1494
|
-
placeholder = "
|
|
1494
|
+
placeholder = "Type to search",
|
|
1495
1495
|
onSelect,
|
|
1496
1496
|
className
|
|
1497
1497
|
}) {
|
|
@@ -1667,7 +1667,345 @@ function CommandPalette({
|
|
|
1667
1667
|
)
|
|
1668
1668
|
] }) });
|
|
1669
1669
|
}
|
|
1670
|
+
function ChatSendIcon() {
|
|
1671
|
+
return /* @__PURE__ */ jsx(
|
|
1672
|
+
"svg",
|
|
1673
|
+
{
|
|
1674
|
+
width: 16,
|
|
1675
|
+
height: 16,
|
|
1676
|
+
viewBox: "0 0 16 16",
|
|
1677
|
+
fill: "none",
|
|
1678
|
+
"aria-hidden": "true",
|
|
1679
|
+
children: /* @__PURE__ */ jsx(
|
|
1680
|
+
"path",
|
|
1681
|
+
{
|
|
1682
|
+
d: "M2.5 8h11M9 3.5L13.5 8 9 12.5",
|
|
1683
|
+
stroke: "currentColor",
|
|
1684
|
+
strokeWidth: "1.7",
|
|
1685
|
+
strokeLinecap: "round",
|
|
1686
|
+
strokeLinejoin: "round"
|
|
1687
|
+
}
|
|
1688
|
+
)
|
|
1689
|
+
}
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
function ChatPaperclipIcon() {
|
|
1693
|
+
return /* @__PURE__ */ jsx(
|
|
1694
|
+
"svg",
|
|
1695
|
+
{
|
|
1696
|
+
width: 16,
|
|
1697
|
+
height: 16,
|
|
1698
|
+
viewBox: "0 0 16 16",
|
|
1699
|
+
fill: "none",
|
|
1700
|
+
"aria-hidden": "true",
|
|
1701
|
+
children: /* @__PURE__ */ jsx(
|
|
1702
|
+
"path",
|
|
1703
|
+
{
|
|
1704
|
+
d: "M13.2 7.2L7.5 12.9a3.5 3.5 0 0 1-4.95-4.95l6.36-6.36a2.2 2.2 0 0 1 3.11 3.11L5.66 10.9a.88.88 0 0 1-1.24-1.24l5.3-5.3",
|
|
1705
|
+
stroke: "currentColor",
|
|
1706
|
+
strokeWidth: "1.4",
|
|
1707
|
+
strokeLinecap: "round",
|
|
1708
|
+
strokeLinejoin: "round"
|
|
1709
|
+
}
|
|
1710
|
+
)
|
|
1711
|
+
}
|
|
1712
|
+
);
|
|
1713
|
+
}
|
|
1714
|
+
function ChatSmileIcon() {
|
|
1715
|
+
return /* @__PURE__ */ jsxs(
|
|
1716
|
+
"svg",
|
|
1717
|
+
{
|
|
1718
|
+
width: 16,
|
|
1719
|
+
height: 16,
|
|
1720
|
+
viewBox: "0 0 16 16",
|
|
1721
|
+
fill: "none",
|
|
1722
|
+
"aria-hidden": "true",
|
|
1723
|
+
children: [
|
|
1724
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.2", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1725
|
+
/* @__PURE__ */ jsx(
|
|
1726
|
+
"path",
|
|
1727
|
+
{
|
|
1728
|
+
d: "M5.5 9.8c.4.9 2.6 1.4 3 0",
|
|
1729
|
+
stroke: "currentColor",
|
|
1730
|
+
strokeWidth: "1.4",
|
|
1731
|
+
strokeLinecap: "round"
|
|
1732
|
+
}
|
|
1733
|
+
),
|
|
1734
|
+
/* @__PURE__ */ jsx("circle", { cx: "6", cy: "6.8", r: "0.8", fill: "currentColor" }),
|
|
1735
|
+
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "6.8", r: "0.8", fill: "currentColor" })
|
|
1736
|
+
]
|
|
1737
|
+
}
|
|
1738
|
+
);
|
|
1739
|
+
}
|
|
1740
|
+
function ChatDeliveryIcon({ status }) {
|
|
1741
|
+
if (status === "sending") {
|
|
1742
|
+
return /* @__PURE__ */ jsx(
|
|
1743
|
+
"svg",
|
|
1744
|
+
{
|
|
1745
|
+
width: 14,
|
|
1746
|
+
height: 14,
|
|
1747
|
+
viewBox: "0 0 14 14",
|
|
1748
|
+
fill: "none",
|
|
1749
|
+
"aria-hidden": "true",
|
|
1750
|
+
children: /* @__PURE__ */ jsx(
|
|
1751
|
+
"circle",
|
|
1752
|
+
{
|
|
1753
|
+
cx: "7",
|
|
1754
|
+
cy: "7",
|
|
1755
|
+
r: "5.2",
|
|
1756
|
+
stroke: "currentColor",
|
|
1757
|
+
strokeWidth: "1.4",
|
|
1758
|
+
strokeDasharray: "2.5 2"
|
|
1759
|
+
}
|
|
1760
|
+
)
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
}
|
|
1764
|
+
if (status === "sent") {
|
|
1765
|
+
return /* @__PURE__ */ jsx(
|
|
1766
|
+
"svg",
|
|
1767
|
+
{
|
|
1768
|
+
width: 14,
|
|
1769
|
+
height: 14,
|
|
1770
|
+
viewBox: "0 0 14 14",
|
|
1771
|
+
fill: "none",
|
|
1772
|
+
"aria-hidden": "true",
|
|
1773
|
+
children: /* @__PURE__ */ jsx(
|
|
1774
|
+
"path",
|
|
1775
|
+
{
|
|
1776
|
+
d: "M3 7.2l2.4 2.4L11 4.6",
|
|
1777
|
+
stroke: "currentColor",
|
|
1778
|
+
strokeWidth: "1.6",
|
|
1779
|
+
strokeLinecap: "round",
|
|
1780
|
+
strokeLinejoin: "round"
|
|
1781
|
+
}
|
|
1782
|
+
)
|
|
1783
|
+
}
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
return /* @__PURE__ */ jsxs(
|
|
1787
|
+
"svg",
|
|
1788
|
+
{
|
|
1789
|
+
width: 18,
|
|
1790
|
+
height: 14,
|
|
1791
|
+
viewBox: "0 0 18 14",
|
|
1792
|
+
fill: "none",
|
|
1793
|
+
"aria-label": status === "read" ? "Read" : "Delivered",
|
|
1794
|
+
children: [
|
|
1795
|
+
/* @__PURE__ */ jsx(
|
|
1796
|
+
"path",
|
|
1797
|
+
{
|
|
1798
|
+
d: "M1.5 7.2l2.4 2.4L9.5 4.6",
|
|
1799
|
+
stroke: "currentColor",
|
|
1800
|
+
strokeWidth: "1.5",
|
|
1801
|
+
strokeLinecap: "round",
|
|
1802
|
+
strokeLinejoin: "round"
|
|
1803
|
+
}
|
|
1804
|
+
),
|
|
1805
|
+
/* @__PURE__ */ jsx(
|
|
1806
|
+
"path",
|
|
1807
|
+
{
|
|
1808
|
+
d: "M5.5 7.2l2.4 2.4 5.6-5",
|
|
1809
|
+
stroke: "currentColor",
|
|
1810
|
+
strokeWidth: "1.5",
|
|
1811
|
+
strokeLinecap: "round",
|
|
1812
|
+
strokeLinejoin: "round"
|
|
1813
|
+
}
|
|
1814
|
+
)
|
|
1815
|
+
]
|
|
1816
|
+
}
|
|
1817
|
+
);
|
|
1818
|
+
}
|
|
1819
|
+
var ChatThread = forwardRef(
|
|
1820
|
+
({ className, ...props }, ref) => {
|
|
1821
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("pds-chat-thread", className), ...props });
|
|
1822
|
+
}
|
|
1823
|
+
);
|
|
1824
|
+
ChatThread.displayName = "ChatThread";
|
|
1825
|
+
var ChatDateDivider = forwardRef(
|
|
1826
|
+
({ className, children, ...props }, ref) => {
|
|
1827
|
+
return /* @__PURE__ */ jsx(
|
|
1828
|
+
"div",
|
|
1829
|
+
{
|
|
1830
|
+
ref,
|
|
1831
|
+
role: "separator",
|
|
1832
|
+
className: cn("pds-chat-divider", className),
|
|
1833
|
+
...props,
|
|
1834
|
+
children: /* @__PURE__ */ jsx("span", { className: "pds-chat-divider__label", children })
|
|
1835
|
+
}
|
|
1836
|
+
);
|
|
1837
|
+
}
|
|
1838
|
+
);
|
|
1839
|
+
ChatDateDivider.displayName = "ChatDateDivider";
|
|
1840
|
+
var ChatMessage = forwardRef(
|
|
1841
|
+
({
|
|
1842
|
+
side = "received",
|
|
1843
|
+
name,
|
|
1844
|
+
avatar,
|
|
1845
|
+
time,
|
|
1846
|
+
status,
|
|
1847
|
+
reactions,
|
|
1848
|
+
position = "solo",
|
|
1849
|
+
className,
|
|
1850
|
+
children,
|
|
1851
|
+
...props
|
|
1852
|
+
}, ref) => {
|
|
1853
|
+
const isSent = side === "sent";
|
|
1854
|
+
const showMeta = position === "solo" || position === "first";
|
|
1855
|
+
const showAvatar = !isSent && avatar && (position === "solo" || position === "last");
|
|
1856
|
+
const showStatus = isSent && status && (position === "solo" || position === "last");
|
|
1857
|
+
return /* @__PURE__ */ jsxs(
|
|
1858
|
+
"div",
|
|
1859
|
+
{
|
|
1860
|
+
ref,
|
|
1861
|
+
className: cn(
|
|
1862
|
+
"pds-chat-msg",
|
|
1863
|
+
`pds-chat-msg--${side}`,
|
|
1864
|
+
`pds-chat-msg--${position}`,
|
|
1865
|
+
className
|
|
1866
|
+
),
|
|
1867
|
+
...props,
|
|
1868
|
+
children: [
|
|
1869
|
+
showMeta && /* @__PURE__ */ jsxs("div", { className: "pds-chat-msg__meta-row", children: [
|
|
1870
|
+
!isSent && name && /* @__PURE__ */ jsx("span", { className: "pds-chat-msg__name", children: name }),
|
|
1871
|
+
time && /* @__PURE__ */ jsx("span", { className: "pds-chat-msg__time", children: time })
|
|
1872
|
+
] }),
|
|
1873
|
+
/* @__PURE__ */ jsxs("div", { className: "pds-chat-msg__row", children: [
|
|
1874
|
+
!isSent && /* @__PURE__ */ jsx("div", { className: "pds-chat-msg__avatar-slot", children: showAvatar && avatar }),
|
|
1875
|
+
/* @__PURE__ */ jsxs("div", { className: "pds-chat-msg__bubble-col", children: [
|
|
1876
|
+
/* @__PURE__ */ jsx(
|
|
1877
|
+
"div",
|
|
1878
|
+
{
|
|
1879
|
+
className: cn(
|
|
1880
|
+
"pds-chat-bubble",
|
|
1881
|
+
`pds-chat-bubble--${side}`,
|
|
1882
|
+
`pds-chat-bubble--${position}`
|
|
1883
|
+
),
|
|
1884
|
+
children
|
|
1885
|
+
}
|
|
1886
|
+
),
|
|
1887
|
+
reactions && reactions.length > 0 && /* @__PURE__ */ jsx("div", { className: "pds-chat-reactions", children: reactions.map((reaction, index) => /* @__PURE__ */ jsxs(
|
|
1888
|
+
"button",
|
|
1889
|
+
{
|
|
1890
|
+
type: "button",
|
|
1891
|
+
className: cn(
|
|
1892
|
+
"pds-chat-reaction",
|
|
1893
|
+
reaction.mine && "pds-chat-reaction--mine"
|
|
1894
|
+
),
|
|
1895
|
+
children: [
|
|
1896
|
+
/* @__PURE__ */ jsx("span", { children: reaction.emoji }),
|
|
1897
|
+
reaction.count !== void 0 && reaction.count > 1 && /* @__PURE__ */ jsx("span", { className: "pds-chat-reaction__count", children: reaction.count })
|
|
1898
|
+
]
|
|
1899
|
+
},
|
|
1900
|
+
index
|
|
1901
|
+
)) })
|
|
1902
|
+
] })
|
|
1903
|
+
] }),
|
|
1904
|
+
showStatus && /* @__PURE__ */ jsxs(
|
|
1905
|
+
"div",
|
|
1906
|
+
{
|
|
1907
|
+
className: cn(
|
|
1908
|
+
"pds-chat-msg__status",
|
|
1909
|
+
status === "read" && "pds-chat-msg__status--read"
|
|
1910
|
+
),
|
|
1911
|
+
children: [
|
|
1912
|
+
/* @__PURE__ */ jsx(ChatDeliveryIcon, { status }),
|
|
1913
|
+
/* @__PURE__ */ jsx("span", { className: "pds-chat-msg__status-label", children: status })
|
|
1914
|
+
]
|
|
1915
|
+
}
|
|
1916
|
+
)
|
|
1917
|
+
]
|
|
1918
|
+
}
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
);
|
|
1922
|
+
ChatMessage.displayName = "ChatMessage";
|
|
1923
|
+
function ChatCompose({
|
|
1924
|
+
value,
|
|
1925
|
+
onChange,
|
|
1926
|
+
onSend,
|
|
1927
|
+
placeholder = "Write a message\u2026",
|
|
1928
|
+
avatar,
|
|
1929
|
+
disabled,
|
|
1930
|
+
className
|
|
1931
|
+
}) {
|
|
1932
|
+
const [internalValue, setInternalValue] = useState("");
|
|
1933
|
+
const textareaRef = useRef(null);
|
|
1934
|
+
const isControlled = value !== void 0;
|
|
1935
|
+
const text = isControlled ? value : internalValue;
|
|
1936
|
+
useEffect(() => {
|
|
1937
|
+
const textarea = textareaRef.current;
|
|
1938
|
+
if (!textarea) return;
|
|
1939
|
+
textarea.style.height = "auto";
|
|
1940
|
+
textarea.style.height = `${Math.min(textarea.scrollHeight, 120)}px`;
|
|
1941
|
+
}, [text]);
|
|
1942
|
+
function handleChange(event) {
|
|
1943
|
+
if (!isControlled) setInternalValue(event.target.value);
|
|
1944
|
+
onChange?.(event);
|
|
1945
|
+
}
|
|
1946
|
+
function send() {
|
|
1947
|
+
const trimmed = text.trim();
|
|
1948
|
+
if (!trimmed) return;
|
|
1949
|
+
onSend?.(trimmed);
|
|
1950
|
+
if (!isControlled) setInternalValue("");
|
|
1951
|
+
}
|
|
1952
|
+
function handleKeyDown(event) {
|
|
1953
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1954
|
+
event.preventDefault();
|
|
1955
|
+
send();
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
const canSend = text.trim().length > 0;
|
|
1959
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("pds-chat-compose", className), children: [
|
|
1960
|
+
avatar && /* @__PURE__ */ jsx("div", { className: "pds-chat-compose__avatar", children: avatar }),
|
|
1961
|
+
/* @__PURE__ */ jsxs("div", { className: "pds-chat-compose__field", children: [
|
|
1962
|
+
/* @__PURE__ */ jsx(
|
|
1963
|
+
"button",
|
|
1964
|
+
{
|
|
1965
|
+
type: "button",
|
|
1966
|
+
className: "pds-chat-compose__icon-btn",
|
|
1967
|
+
"aria-label": "Attach file",
|
|
1968
|
+
children: /* @__PURE__ */ jsx(ChatPaperclipIcon, {})
|
|
1969
|
+
}
|
|
1970
|
+
),
|
|
1971
|
+
/* @__PURE__ */ jsx(
|
|
1972
|
+
"textarea",
|
|
1973
|
+
{
|
|
1974
|
+
ref: textareaRef,
|
|
1975
|
+
className: "pds-chat-compose__textarea",
|
|
1976
|
+
value: text,
|
|
1977
|
+
onChange: handleChange,
|
|
1978
|
+
onKeyDown: handleKeyDown,
|
|
1979
|
+
placeholder,
|
|
1980
|
+
disabled,
|
|
1981
|
+
rows: 1,
|
|
1982
|
+
"aria-label": "Message"
|
|
1983
|
+
}
|
|
1984
|
+
),
|
|
1985
|
+
/* @__PURE__ */ jsx(
|
|
1986
|
+
"button",
|
|
1987
|
+
{
|
|
1988
|
+
type: "button",
|
|
1989
|
+
className: "pds-chat-compose__icon-btn",
|
|
1990
|
+
"aria-label": "Add emoji",
|
|
1991
|
+
children: /* @__PURE__ */ jsx(ChatSmileIcon, {})
|
|
1992
|
+
}
|
|
1993
|
+
)
|
|
1994
|
+
] }),
|
|
1995
|
+
/* @__PURE__ */ jsx(
|
|
1996
|
+
"button",
|
|
1997
|
+
{
|
|
1998
|
+
type: "button",
|
|
1999
|
+
className: cn("pds-chat-send", canSend && "pds-chat-send--active"),
|
|
2000
|
+
onClick: send,
|
|
2001
|
+
disabled: disabled || !canSend,
|
|
2002
|
+
"aria-label": "Send message",
|
|
2003
|
+
children: /* @__PURE__ */ jsx(ChatSendIcon, {})
|
|
2004
|
+
}
|
|
2005
|
+
)
|
|
2006
|
+
] });
|
|
2007
|
+
}
|
|
1670
2008
|
|
|
1671
|
-
export { Alert, Avatar, Badge, Button, Card, Checkbox, CommandPalette, Container, DataTable, Divider, DropdownMenu, Grid, Input, Modal, Popover, Radio, RadioGroup, Segmented, Select, Skeleton, StatusPill, Switch, Tabs, Textarea, Toast, Tooltip, cn, useCommandPalette, useToastManager as useToast };
|
|
2009
|
+
export { Alert, Avatar, Badge, Button, Card, ChatCompose, ChatDateDivider, ChatMessage, ChatThread, Checkbox, CommandPalette, Container, DataTable, Divider, DropdownMenu, Grid, Input, Modal, Popover, Radio, RadioGroup, Segmented, Select, Skeleton, StatusPill, Switch, Tabs, Textarea, Toast, Tooltip, cn, useCommandPalette, useToastManager as useToast };
|
|
1672
2010
|
//# sourceMappingURL=index.js.map
|
|
1673
2011
|
//# sourceMappingURL=index.js.map
|