@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.cjs
CHANGED
|
@@ -1493,7 +1493,7 @@ function CommandPalette({
|
|
|
1493
1493
|
open,
|
|
1494
1494
|
onOpenChange,
|
|
1495
1495
|
groups = [],
|
|
1496
|
-
placeholder = "
|
|
1496
|
+
placeholder = "Type to search",
|
|
1497
1497
|
onSelect,
|
|
1498
1498
|
className
|
|
1499
1499
|
}) {
|
|
@@ -1669,12 +1669,354 @@ function CommandPalette({
|
|
|
1669
1669
|
)
|
|
1670
1670
|
] }) });
|
|
1671
1671
|
}
|
|
1672
|
+
function ChatSendIcon() {
|
|
1673
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1674
|
+
"svg",
|
|
1675
|
+
{
|
|
1676
|
+
width: 16,
|
|
1677
|
+
height: 16,
|
|
1678
|
+
viewBox: "0 0 16 16",
|
|
1679
|
+
fill: "none",
|
|
1680
|
+
"aria-hidden": "true",
|
|
1681
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1682
|
+
"path",
|
|
1683
|
+
{
|
|
1684
|
+
d: "M2.5 8h11M9 3.5L13.5 8 9 12.5",
|
|
1685
|
+
stroke: "currentColor",
|
|
1686
|
+
strokeWidth: "1.7",
|
|
1687
|
+
strokeLinecap: "round",
|
|
1688
|
+
strokeLinejoin: "round"
|
|
1689
|
+
}
|
|
1690
|
+
)
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
function ChatPaperclipIcon() {
|
|
1695
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1696
|
+
"svg",
|
|
1697
|
+
{
|
|
1698
|
+
width: 16,
|
|
1699
|
+
height: 16,
|
|
1700
|
+
viewBox: "0 0 16 16",
|
|
1701
|
+
fill: "none",
|
|
1702
|
+
"aria-hidden": "true",
|
|
1703
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1704
|
+
"path",
|
|
1705
|
+
{
|
|
1706
|
+
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",
|
|
1707
|
+
stroke: "currentColor",
|
|
1708
|
+
strokeWidth: "1.4",
|
|
1709
|
+
strokeLinecap: "round",
|
|
1710
|
+
strokeLinejoin: "round"
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1713
|
+
}
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
function ChatSmileIcon() {
|
|
1717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1718
|
+
"svg",
|
|
1719
|
+
{
|
|
1720
|
+
width: 16,
|
|
1721
|
+
height: 16,
|
|
1722
|
+
viewBox: "0 0 16 16",
|
|
1723
|
+
fill: "none",
|
|
1724
|
+
"aria-hidden": "true",
|
|
1725
|
+
children: [
|
|
1726
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "6.2", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1727
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1728
|
+
"path",
|
|
1729
|
+
{
|
|
1730
|
+
d: "M5.5 9.8c.4.9 2.6 1.4 3 0",
|
|
1731
|
+
stroke: "currentColor",
|
|
1732
|
+
strokeWidth: "1.4",
|
|
1733
|
+
strokeLinecap: "round"
|
|
1734
|
+
}
|
|
1735
|
+
),
|
|
1736
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "6.8", r: "0.8", fill: "currentColor" }),
|
|
1737
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "6.8", r: "0.8", fill: "currentColor" })
|
|
1738
|
+
]
|
|
1739
|
+
}
|
|
1740
|
+
);
|
|
1741
|
+
}
|
|
1742
|
+
function ChatDeliveryIcon({ status }) {
|
|
1743
|
+
if (status === "sending") {
|
|
1744
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1745
|
+
"svg",
|
|
1746
|
+
{
|
|
1747
|
+
width: 14,
|
|
1748
|
+
height: 14,
|
|
1749
|
+
viewBox: "0 0 14 14",
|
|
1750
|
+
fill: "none",
|
|
1751
|
+
"aria-hidden": "true",
|
|
1752
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1753
|
+
"circle",
|
|
1754
|
+
{
|
|
1755
|
+
cx: "7",
|
|
1756
|
+
cy: "7",
|
|
1757
|
+
r: "5.2",
|
|
1758
|
+
stroke: "currentColor",
|
|
1759
|
+
strokeWidth: "1.4",
|
|
1760
|
+
strokeDasharray: "2.5 2"
|
|
1761
|
+
}
|
|
1762
|
+
)
|
|
1763
|
+
}
|
|
1764
|
+
);
|
|
1765
|
+
}
|
|
1766
|
+
if (status === "sent") {
|
|
1767
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1768
|
+
"svg",
|
|
1769
|
+
{
|
|
1770
|
+
width: 14,
|
|
1771
|
+
height: 14,
|
|
1772
|
+
viewBox: "0 0 14 14",
|
|
1773
|
+
fill: "none",
|
|
1774
|
+
"aria-hidden": "true",
|
|
1775
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1776
|
+
"path",
|
|
1777
|
+
{
|
|
1778
|
+
d: "M3 7.2l2.4 2.4L11 4.6",
|
|
1779
|
+
stroke: "currentColor",
|
|
1780
|
+
strokeWidth: "1.6",
|
|
1781
|
+
strokeLinecap: "round",
|
|
1782
|
+
strokeLinejoin: "round"
|
|
1783
|
+
}
|
|
1784
|
+
)
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1787
|
+
}
|
|
1788
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1789
|
+
"svg",
|
|
1790
|
+
{
|
|
1791
|
+
width: 18,
|
|
1792
|
+
height: 14,
|
|
1793
|
+
viewBox: "0 0 18 14",
|
|
1794
|
+
fill: "none",
|
|
1795
|
+
"aria-label": status === "read" ? "Read" : "Delivered",
|
|
1796
|
+
children: [
|
|
1797
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1798
|
+
"path",
|
|
1799
|
+
{
|
|
1800
|
+
d: "M1.5 7.2l2.4 2.4L9.5 4.6",
|
|
1801
|
+
stroke: "currentColor",
|
|
1802
|
+
strokeWidth: "1.5",
|
|
1803
|
+
strokeLinecap: "round",
|
|
1804
|
+
strokeLinejoin: "round"
|
|
1805
|
+
}
|
|
1806
|
+
),
|
|
1807
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1808
|
+
"path",
|
|
1809
|
+
{
|
|
1810
|
+
d: "M5.5 7.2l2.4 2.4 5.6-5",
|
|
1811
|
+
stroke: "currentColor",
|
|
1812
|
+
strokeWidth: "1.5",
|
|
1813
|
+
strokeLinecap: "round",
|
|
1814
|
+
strokeLinejoin: "round"
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
]
|
|
1818
|
+
}
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
var ChatThread = react.forwardRef(
|
|
1822
|
+
({ className, ...props }, ref) => {
|
|
1823
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("pds-chat-thread", className), ...props });
|
|
1824
|
+
}
|
|
1825
|
+
);
|
|
1826
|
+
ChatThread.displayName = "ChatThread";
|
|
1827
|
+
var ChatDateDivider = react.forwardRef(
|
|
1828
|
+
({ className, children, ...props }, ref) => {
|
|
1829
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1830
|
+
"div",
|
|
1831
|
+
{
|
|
1832
|
+
ref,
|
|
1833
|
+
role: "separator",
|
|
1834
|
+
className: cn("pds-chat-divider", className),
|
|
1835
|
+
...props,
|
|
1836
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-divider__label", children })
|
|
1837
|
+
}
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
);
|
|
1841
|
+
ChatDateDivider.displayName = "ChatDateDivider";
|
|
1842
|
+
var ChatMessage = react.forwardRef(
|
|
1843
|
+
({
|
|
1844
|
+
side = "received",
|
|
1845
|
+
name,
|
|
1846
|
+
avatar,
|
|
1847
|
+
time,
|
|
1848
|
+
status,
|
|
1849
|
+
reactions,
|
|
1850
|
+
position = "solo",
|
|
1851
|
+
className,
|
|
1852
|
+
children,
|
|
1853
|
+
...props
|
|
1854
|
+
}, ref) => {
|
|
1855
|
+
const isSent = side === "sent";
|
|
1856
|
+
const showMeta = position === "solo" || position === "first";
|
|
1857
|
+
const showAvatar = !isSent && avatar && (position === "solo" || position === "last");
|
|
1858
|
+
const showStatus = isSent && status && (position === "solo" || position === "last");
|
|
1859
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1860
|
+
"div",
|
|
1861
|
+
{
|
|
1862
|
+
ref,
|
|
1863
|
+
className: cn(
|
|
1864
|
+
"pds-chat-msg",
|
|
1865
|
+
`pds-chat-msg--${side}`,
|
|
1866
|
+
`pds-chat-msg--${position}`,
|
|
1867
|
+
className
|
|
1868
|
+
),
|
|
1869
|
+
...props,
|
|
1870
|
+
children: [
|
|
1871
|
+
showMeta && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-msg__meta-row", children: [
|
|
1872
|
+
!isSent && name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-msg__name", children: name }),
|
|
1873
|
+
time && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-msg__time", children: time })
|
|
1874
|
+
] }),
|
|
1875
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-msg__row", children: [
|
|
1876
|
+
!isSent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-chat-msg__avatar-slot", children: showAvatar && avatar }),
|
|
1877
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-msg__bubble-col", children: [
|
|
1878
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1879
|
+
"div",
|
|
1880
|
+
{
|
|
1881
|
+
className: cn(
|
|
1882
|
+
"pds-chat-bubble",
|
|
1883
|
+
`pds-chat-bubble--${side}`,
|
|
1884
|
+
`pds-chat-bubble--${position}`
|
|
1885
|
+
),
|
|
1886
|
+
children
|
|
1887
|
+
}
|
|
1888
|
+
),
|
|
1889
|
+
reactions && reactions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-chat-reactions", children: reactions.map((reaction, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1890
|
+
"button",
|
|
1891
|
+
{
|
|
1892
|
+
type: "button",
|
|
1893
|
+
className: cn(
|
|
1894
|
+
"pds-chat-reaction",
|
|
1895
|
+
reaction.mine && "pds-chat-reaction--mine"
|
|
1896
|
+
),
|
|
1897
|
+
children: [
|
|
1898
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: reaction.emoji }),
|
|
1899
|
+
reaction.count !== void 0 && reaction.count > 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-reaction__count", children: reaction.count })
|
|
1900
|
+
]
|
|
1901
|
+
},
|
|
1902
|
+
index
|
|
1903
|
+
)) })
|
|
1904
|
+
] })
|
|
1905
|
+
] }),
|
|
1906
|
+
showStatus && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1907
|
+
"div",
|
|
1908
|
+
{
|
|
1909
|
+
className: cn(
|
|
1910
|
+
"pds-chat-msg__status",
|
|
1911
|
+
status === "read" && "pds-chat-msg__status--read"
|
|
1912
|
+
),
|
|
1913
|
+
children: [
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChatDeliveryIcon, { status }),
|
|
1915
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-msg__status-label", children: status })
|
|
1916
|
+
]
|
|
1917
|
+
}
|
|
1918
|
+
)
|
|
1919
|
+
]
|
|
1920
|
+
}
|
|
1921
|
+
);
|
|
1922
|
+
}
|
|
1923
|
+
);
|
|
1924
|
+
ChatMessage.displayName = "ChatMessage";
|
|
1925
|
+
function ChatCompose({
|
|
1926
|
+
value,
|
|
1927
|
+
onChange,
|
|
1928
|
+
onSend,
|
|
1929
|
+
placeholder = "Write a message\u2026",
|
|
1930
|
+
avatar,
|
|
1931
|
+
disabled,
|
|
1932
|
+
className
|
|
1933
|
+
}) {
|
|
1934
|
+
const [internalValue, setInternalValue] = react.useState("");
|
|
1935
|
+
const textareaRef = react.useRef(null);
|
|
1936
|
+
const isControlled = value !== void 0;
|
|
1937
|
+
const text = isControlled ? value : internalValue;
|
|
1938
|
+
react.useEffect(() => {
|
|
1939
|
+
const textarea = textareaRef.current;
|
|
1940
|
+
if (!textarea) return;
|
|
1941
|
+
textarea.style.height = "auto";
|
|
1942
|
+
textarea.style.height = `${Math.min(textarea.scrollHeight, 120)}px`;
|
|
1943
|
+
}, [text]);
|
|
1944
|
+
function handleChange(event) {
|
|
1945
|
+
if (!isControlled) setInternalValue(event.target.value);
|
|
1946
|
+
onChange?.(event);
|
|
1947
|
+
}
|
|
1948
|
+
function send() {
|
|
1949
|
+
const trimmed = text.trim();
|
|
1950
|
+
if (!trimmed) return;
|
|
1951
|
+
onSend?.(trimmed);
|
|
1952
|
+
if (!isControlled) setInternalValue("");
|
|
1953
|
+
}
|
|
1954
|
+
function handleKeyDown(event) {
|
|
1955
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1956
|
+
event.preventDefault();
|
|
1957
|
+
send();
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
const canSend = text.trim().length > 0;
|
|
1961
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("pds-chat-compose", className), children: [
|
|
1962
|
+
avatar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-chat-compose__avatar", children: avatar }),
|
|
1963
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-compose__field", children: [
|
|
1964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1965
|
+
"button",
|
|
1966
|
+
{
|
|
1967
|
+
type: "button",
|
|
1968
|
+
className: "pds-chat-compose__icon-btn",
|
|
1969
|
+
"aria-label": "Attach file",
|
|
1970
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatPaperclipIcon, {})
|
|
1971
|
+
}
|
|
1972
|
+
),
|
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1974
|
+
"textarea",
|
|
1975
|
+
{
|
|
1976
|
+
ref: textareaRef,
|
|
1977
|
+
className: "pds-chat-compose__textarea",
|
|
1978
|
+
value: text,
|
|
1979
|
+
onChange: handleChange,
|
|
1980
|
+
onKeyDown: handleKeyDown,
|
|
1981
|
+
placeholder,
|
|
1982
|
+
disabled,
|
|
1983
|
+
rows: 1,
|
|
1984
|
+
"aria-label": "Message"
|
|
1985
|
+
}
|
|
1986
|
+
),
|
|
1987
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1988
|
+
"button",
|
|
1989
|
+
{
|
|
1990
|
+
type: "button",
|
|
1991
|
+
className: "pds-chat-compose__icon-btn",
|
|
1992
|
+
"aria-label": "Add emoji",
|
|
1993
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatSmileIcon, {})
|
|
1994
|
+
}
|
|
1995
|
+
)
|
|
1996
|
+
] }),
|
|
1997
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
+
"button",
|
|
1999
|
+
{
|
|
2000
|
+
type: "button",
|
|
2001
|
+
className: cn("pds-chat-send", canSend && "pds-chat-send--active"),
|
|
2002
|
+
onClick: send,
|
|
2003
|
+
disabled: disabled || !canSend,
|
|
2004
|
+
"aria-label": "Send message",
|
|
2005
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatSendIcon, {})
|
|
2006
|
+
}
|
|
2007
|
+
)
|
|
2008
|
+
] });
|
|
2009
|
+
}
|
|
1672
2010
|
|
|
1673
2011
|
exports.Alert = Alert;
|
|
1674
2012
|
exports.Avatar = Avatar;
|
|
1675
2013
|
exports.Badge = Badge;
|
|
1676
2014
|
exports.Button = Button;
|
|
1677
2015
|
exports.Card = Card;
|
|
2016
|
+
exports.ChatCompose = ChatCompose;
|
|
2017
|
+
exports.ChatDateDivider = ChatDateDivider;
|
|
2018
|
+
exports.ChatMessage = ChatMessage;
|
|
2019
|
+
exports.ChatThread = ChatThread;
|
|
1678
2020
|
exports.Checkbox = Checkbox;
|
|
1679
2021
|
exports.CommandPalette = CommandPalette;
|
|
1680
2022
|
exports.Container = Container;
|