@dashx/react 0.1.5 → 0.1.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/cjs/components/avatar.d.ts +5 -0
- package/dist/cjs/components/avatar.js +2 -0
- package/dist/cjs/components/avatar.js.map +7 -0
- package/dist/cjs/components/flex.d.ts +70 -0
- package/dist/cjs/components/flex.js +1 -1
- package/dist/cjs/components/flex.js.map +3 -3
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/components/markdown-renderer.d.ts +8 -0
- package/dist/cjs/components/markdown-renderer.js +2 -0
- package/dist/cjs/components/markdown-renderer.js.map +7 -0
- package/dist/cjs/components/popover copy.d.ts +47 -0
- package/dist/cjs/components/text-area.d.ts +1 -0
- package/dist/cjs/components/text-area.js +1 -1
- package/dist/cjs/components/text-area.js.map +3 -3
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/index.js +1 -1
- package/dist/cjs/hooks/index.js.map +3 -3
- package/dist/cjs/hooks/use-agent.d.ts +15 -0
- package/dist/cjs/hooks/use-agent.js +2 -0
- package/dist/cjs/hooks/use-agent.js.map +7 -0
- package/dist/cjs/hooks/use-animated-text.d.ts +11 -0
- package/dist/cjs/hooks/use-animated-text.js +2 -0
- package/dist/cjs/hooks/use-animated-text.js.map +7 -0
- package/dist/cjs/hooks/use-auto-scroll.d.ts +13 -0
- package/dist/cjs/hooks/use-auto-scroll.js +2 -0
- package/dist/cjs/hooks/use-auto-scroll.js.map +7 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/legacy.d.ts +2 -0
- package/dist/cjs/legacy.js +2 -0
- package/dist/cjs/legacy.js.map +7 -0
- package/dist/cjs/providers/DashXProvider.d.ts +2 -1
- package/dist/cjs/providers/DashXProvider.js +1 -1
- package/dist/cjs/providers/DashXProvider.js.map +2 -2
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/cjs/variants/avatar.d.ts +212 -0
- package/dist/cjs/variants/avatar.js +2 -0
- package/dist/cjs/variants/avatar.js.map +7 -0
- package/dist/cjs/variants/base-input.d.ts +1 -1
- package/dist/cjs/variants/base-input.js +1 -1
- package/dist/cjs/variants/base-input.js.map +2 -2
- package/dist/cjs/variants/button copy.d.ts +254 -0
- package/dist/cjs/variants/checkbox.d.ts +1 -1
- package/dist/cjs/widgets/Chat.d.ts +15 -0
- package/dist/cjs/widgets/Chat.js +2 -0
- package/dist/cjs/widgets/Chat.js.map +7 -0
- package/dist/cjs/widgets/ChatBody.d.ts +14 -0
- package/dist/cjs/widgets/ChatBody.js +2 -0
- package/dist/cjs/widgets/ChatBody.js.map +7 -0
- package/dist/cjs/widgets/ChatFooter.d.ts +7 -0
- package/dist/cjs/widgets/ChatFooter.js +2 -0
- package/dist/cjs/widgets/ChatFooter.js.map +7 -0
- package/dist/cjs/widgets/ChatHeader.d.ts +9 -0
- package/dist/cjs/widgets/ChatHeader.js +2 -0
- package/dist/cjs/widgets/ChatHeader.js.map +7 -0
- package/dist/cjs/widgets/ChatPopover.d.ts +3 -0
- package/dist/cjs/widgets/ChatPopover.js +2 -0
- package/dist/cjs/widgets/ChatPopover.js.map +7 -0
- package/dist/cjs/widgets/NotificationBell.js +1 -1
- package/dist/cjs/widgets/NotificationBell.js.map +2 -2
- package/dist/cjs/widgets/index.d.ts +2 -0
- package/dist/cjs/widgets/index.js +1 -1
- package/dist/cjs/widgets/index.js.map +3 -3
- package/dist/esm/components/avatar.d.ts +5 -0
- package/dist/esm/components/avatar.js +2 -0
- package/dist/esm/components/avatar.js.map +7 -0
- package/dist/esm/components/flex.d.ts +70 -0
- package/dist/esm/components/flex.js +1 -1
- package/dist/esm/components/flex.js.map +3 -3
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/markdown-renderer.d.ts +8 -0
- package/dist/esm/components/markdown-renderer.js +2 -0
- package/dist/esm/components/markdown-renderer.js.map +7 -0
- package/dist/esm/components/popover copy.d.ts +47 -0
- package/dist/esm/components/text-area.d.ts +1 -0
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-area.js.map +3 -3
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/index.js.map +3 -3
- package/dist/esm/hooks/use-agent.d.ts +15 -0
- package/dist/esm/hooks/use-agent.js +2 -0
- package/dist/esm/hooks/use-agent.js.map +7 -0
- package/dist/esm/hooks/use-animated-text.d.ts +11 -0
- package/dist/esm/hooks/use-animated-text.js +2 -0
- package/dist/esm/hooks/use-animated-text.js.map +7 -0
- package/dist/esm/hooks/use-auto-scroll.d.ts +13 -0
- package/dist/esm/hooks/use-auto-scroll.js +2 -0
- package/dist/esm/hooks/use-auto-scroll.js.map +7 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/legacy.d.ts +2 -0
- package/dist/esm/legacy.js +2 -0
- package/dist/esm/legacy.js.map +7 -0
- package/dist/esm/providers/DashXProvider.d.ts +2 -1
- package/dist/esm/providers/DashXProvider.js +1 -1
- package/dist/esm/providers/DashXProvider.js.map +2 -2
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/variants/avatar.d.ts +212 -0
- package/dist/esm/variants/avatar.js +2 -0
- package/dist/esm/variants/avatar.js.map +7 -0
- package/dist/esm/variants/base-input.d.ts +1 -1
- package/dist/esm/variants/base-input.js +1 -1
- package/dist/esm/variants/base-input.js.map +2 -2
- package/dist/esm/variants/button copy.d.ts +254 -0
- package/dist/esm/variants/checkbox.d.ts +1 -1
- package/dist/esm/widgets/Chat.d.ts +15 -0
- package/dist/esm/widgets/Chat.js +2 -0
- package/dist/esm/widgets/Chat.js.map +7 -0
- package/dist/esm/widgets/ChatBody.d.ts +14 -0
- package/dist/esm/widgets/ChatBody.js +2 -0
- package/dist/esm/widgets/ChatBody.js.map +7 -0
- package/dist/esm/widgets/ChatFooter.d.ts +7 -0
- package/dist/esm/widgets/ChatFooter.js +2 -0
- package/dist/esm/widgets/ChatFooter.js.map +7 -0
- package/dist/esm/widgets/ChatHeader.d.ts +9 -0
- package/dist/esm/widgets/ChatHeader.js +2 -0
- package/dist/esm/widgets/ChatHeader.js.map +7 -0
- package/dist/esm/widgets/ChatPopover.d.ts +3 -0
- package/dist/esm/widgets/ChatPopover.js +2 -0
- package/dist/esm/widgets/ChatPopover.js.map +7 -0
- package/dist/esm/widgets/NotificationBell.js +1 -1
- package/dist/esm/widgets/NotificationBell.js.map +2 -2
- package/dist/esm/widgets/index.d.ts +2 -0
- package/dist/esm/widgets/index.js +1 -1
- package/dist/esm/widgets/index.js.map +2 -2
- package/package.json +5 -3
- package/src/components/avatar.tsx +32 -0
- package/src/components/flex.tsx +7 -2
- package/src/components/index.ts +1 -0
- package/src/components/markdown-renderer.tsx +57 -0
- package/src/components/text-area.tsx +23 -11
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-agent.ts +89 -0
- package/src/hooks/use-animated-text.ts +67 -0
- package/src/hooks/use-auto-scroll.ts +65 -0
- package/src/index.ts +2 -1
- package/src/legacy.ts +2 -0
- package/src/providers/DashXProvider.tsx +4 -3
- package/src/variants/avatar.ts +31 -0
- package/src/variants/base-input.ts +1 -1
- package/src/widgets/Chat.tsx +96 -0
- package/src/widgets/ChatBody.tsx +171 -0
- package/src/widgets/ChatFooter.tsx +62 -0
- package/src/widgets/ChatHeader.tsx +26 -0
- package/src/widgets/ChatPopover.tsx +42 -0
- package/src/widgets/NotificationBell.tsx +1 -1
- package/src/widgets/index.ts +2 -0
- package/styles.css +122 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AiAgent } from '@dashx/browser';
|
|
3
|
+
type ChatHeaderProps = {
|
|
4
|
+
agent: AiAgent;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare const ChatHeader: ({ agent, children }: ChatHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export type { ChatHeaderProps };
|
|
9
|
+
export default ChatHeader;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var a in e)d(r,a,{get:e[a],enumerable:!0})},b=(r,e,a,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!g.call(r,t)&&t!==a&&d(r,t,{get:()=>e[t],enumerable:!(n=i(e,t))||n.enumerable});return r};var c=r=>b(d({},"__esModule",{value:!0}),r);var y={};m(y,{default:()=>l});module.exports=c(y);var p=require("react/jsx-runtime"),f=require("react"),o=require("../components");const h=({agent:r,children:e})=>(0,p.jsxs)(o.Flex,{align:"center",className:"border-b border-b-gray-400/40 px-6 py-4",justify:"between",children:[(0,p.jsx)(o.Heading,{size:3,children:r.name}),e]});var l=h;
|
|
2
|
+
//# sourceMappingURL=ChatHeader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/widgets/ChatHeader.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { AiAgent } from '@dashx/browser';\n\nimport { Flex, Heading } from '../components';\n\ntype ChatHeaderProps = {\n agent: AiAgent;\n children?: React.ReactNode;\n};\n\nconst ChatHeader = ({ agent, children }: ChatHeaderProps) => {\n return (\n <Flex\n align=\"center\"\n className=\"border-b border-b-gray-400/40 px-6 py-4\"\n justify=\"between\"\n >\n <Heading size={3}>{agent.name}</Heading>\n {children}\n </Flex>\n );\n};\n\nexport type { ChatHeaderProps }\n\nexport default ChatHeader;\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAYI,IAAAI,EAAA,6BAZJC,EAAkB,iBAGlBC,EAA8B,yBAO9B,MAAMC,EAAa,CAAC,CAAE,MAAAC,EAAO,SAAAC,CAAS,OAElC,QAAC,QACC,MAAM,SACN,UAAU,0CACV,QAAQ,UAER,oBAAC,WAAQ,KAAM,EAAI,SAAAD,EAAM,KAAK,EAC7BC,GACH,EAMJ,IAAOP,EAAQK",
|
|
6
|
+
"names": ["ChatHeader_exports", "__export", "ChatHeader_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "ChatHeader", "agent", "children"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var C=Object.create;var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var O=(e,o)=>{for(var r in o)p(e,r,{get:o[r],enumerable:!0})},i=(e,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of T(o))!I.call(e,n)&&n!==r&&p(e,n,{get:()=>o[n],enumerable:!(a=c(o,n))||a.enumerable});return e};var w=(e,o,r)=>(r=e!=null?C(x(e)):{},i(o||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e)),B=e=>i(p({},"__esModule",{value:!0}),e);var b={};O(b,{default:()=>R});module.exports=B(b);var t=require("react/jsx-runtime"),g=require("react"),h=require("./Chat.js"),s=require("../components"),m=require("../icons/index.js"),l=w(require("../hooks/use-agent.js"));const M=({publicEmbedKey:e,...o})=>{const{agent:r,messages:a,isThinking:n,error:v,sendMessage:P,conversationId:d}=(0,l.default)({publicEmbedKey:e}),[f,u]=(0,g.useState)(!1);return(0,t.jsx)(s.Theme,{children:(0,t.jsx)(s.Flex,{className:"fixed right-4 bottom-4 z-50",children:(0,t.jsxs)(s.Popover.Root,{onOpenChange:u,children:[(0,t.jsx)(s.Popover.Trigger,{children:(0,t.jsx)(s.Button,{shape:"square",roundness:"full",variant:"fill",size:"large",children:(0,t.jsx)(m.BotMessageSquareIcon,{})})}),(0,t.jsx)(s.Popover.Content,{spacing:"large",width:"350px",height:"450px",children:(0,t.jsx)(h.Chat,{agent:r,conversationId:d,messages:a,isThinking:n,error:v,sendMessage:P,borderless:!0,withChatHeader:!0,withPopoverClose:!0,isPopoverOpen:f,...o})})]})})})};var R=M;
|
|
2
|
+
//# sourceMappingURL=ChatPopover.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/widgets/ChatPopover.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useState } from 'react';\n\nimport { Chat, type ChatWrapperProps } from './Chat.js';\nimport { Button, Flex, Popover, Theme } from '../components';\nimport { BotMessageSquareIcon } from '../icons/index.js';\nimport useAgent from '../hooks/use-agent.js';\n\nconst ChatPopup = ({ publicEmbedKey, ...props }: ChatWrapperProps) => {\n const { agent, messages, isThinking, error, sendMessage, conversationId } = useAgent({ publicEmbedKey });\n const [isPopoverOpen, setIsPopoverOpen] = useState(false);\n\n return (\n <Theme>\n <Flex className=\"fixed right-4 bottom-4 z-50\">\n <Popover.Root onOpenChange={setIsPopoverOpen}>\n <Popover.Trigger>\n <Button shape=\"square\" roundness=\"full\" variant=\"fill\" size=\"large\">\n <BotMessageSquareIcon />\n </Button>\n </Popover.Trigger>\n <Popover.Content spacing=\"large\" width=\"350px\" height=\"450px\">\n <Chat\n agent={agent}\n conversationId={conversationId}\n messages={messages}\n isThinking={isThinking}\n error={error}\n sendMessage={sendMessage}\n borderless\n withChatHeader\n withPopoverClose\n isPopoverOpen={isPopoverOpen}\n {...props}\n />\n </Popover.Content>\n </Popover.Root>\n </Flex>\n </Theme>\n );\n};\n\nexport default ChatPopup;\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAcQ,IAAAI,EAAA,6BAdRC,EAAgC,iBAEhCC,EAA4C,qBAC5CC,EAA6C,yBAC7CC,EAAqC,6BACrCC,EAAqB,oCAErB,MAAMC,EAAY,CAAC,CAAE,eAAAC,EAAgB,GAAGC,CAAM,IAAwB,CACpE,KAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,WAAAC,EAAY,MAAAC,EAAO,YAAAC,EAAa,eAAAC,CAAe,KAAI,EAAAC,SAAS,CAAE,eAAAR,CAAe,CAAC,EACjG,CAACS,EAAeC,CAAgB,KAAI,YAAS,EAAK,EAExD,SACE,OAAC,SACC,mBAAC,QAAK,UAAU,8BACd,oBAAC,UAAQ,KAAR,CAAa,aAAcA,EAC1B,oBAAC,UAAQ,QAAR,CACC,mBAAC,UAAO,MAAM,SAAS,UAAU,OAAO,QAAQ,OAAO,KAAK,QAC1D,mBAAC,yBAAqB,EACxB,EACF,KACA,OAAC,UAAQ,QAAR,CAAgB,QAAQ,QAAQ,MAAM,QAAQ,OAAO,QACpD,mBAAC,QACC,MAAOR,EACP,eAAgBK,EAChB,SAAUJ,EACV,WAAYC,EACZ,MAAOC,EACP,YAAaC,EACb,WAAU,GACV,eAAc,GACd,iBAAgB,GAChB,cAAeG,EACd,GAAGR,EACN,EACF,GACF,EACF,EACF,CAEJ,EAEA,IAAOV,EAAQQ",
|
|
6
|
+
"names": ["ChatPopover_exports", "__export", "ChatPopover_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_Chat", "import_components", "import_icons", "import_use_agent", "ChatPopup", "publicEmbedKey", "props", "agent", "messages", "isThinking", "error", "sendMessage", "conversationId", "useAgent", "isPopoverOpen", "setIsPopoverOpen"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var m=(a,r)=>{for(var n in r)l(a,n,{get:r[n],enumerable:!0})},T=(a,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of u(r))!c.call(a,o)&&o!==n&&l(a,o,{get:()=>r[o],enumerable:!(s=g(r,o))||s.enumerable});return a};var h=a=>T(l({},"__esModule",{value:!0}),a);var f={};m(f,{default:()=>x});module.exports=h(f);var t=require("react/jsx-runtime"),d=require("date-fns"),p=require("../hooks/index.js"),e=require("../components"),i=require("../icons/index.js");const v=()=>{let{markNotificationAsRead:a,markNotificationAsUnread:r,notifications:n,unreadNotificationsCount:s}=(0,p.useInApp)();return(0,t.jsx)(e.Theme,{children:(0,t.jsxs)(e.Popover.Root,{children:[(0,t.jsxs)(e.Tooltip.Root,{children:[(0,t.jsx)(e.Tooltip.Trigger,{children:(0,t.jsx)(e.Popover.Trigger,{children:(0,t.jsx)(e.Button,{shape:"square",roundness:"full",variant:s?"fill":"ghost",children:(0,t.jsx)(i.Inbox,{})})})}),(0,t.jsx)(e.Tooltip.Content,{content:"Notification"})]}),(0,t.jsxs)(e.Popover.Content,{spacing:"large",width:"350px",height:"450px",children:[(0,t.jsx)(e.Popover.Header,{asChild:!0,children:(0,t.jsxs)(e.Flex,{justify:"between",align:"center",children:[(0,t.jsx)(e.Heading,{size:3,children:"Notifications"}),(0,t.jsx)(e.Popover.Close,{children:(0,t.jsx)(e.Button,{shape:"square",roundness:"full",variant:"ghost",mode:"subtle",inset:"right",children:(0,t.jsx)(i.X,{})})})]})}),(0,t.jsx)(e.Popover.Body,{children:(0,t.jsxs)(e.Flex,{direction:"column",gap:1,children:[n.length
|
|
1
|
+
"use strict";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var m=(a,r)=>{for(var n in r)l(a,n,{get:r[n],enumerable:!0})},T=(a,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of u(r))!c.call(a,o)&&o!==n&&l(a,o,{get:()=>r[o],enumerable:!(s=g(r,o))||s.enumerable});return a};var h=a=>T(l({},"__esModule",{value:!0}),a);var f={};m(f,{default:()=>x});module.exports=h(f);var t=require("react/jsx-runtime"),d=require("date-fns"),p=require("../hooks/index.js"),e=require("../components"),i=require("../icons/index.js");const v=()=>{let{markNotificationAsRead:a,markNotificationAsUnread:r,notifications:n,unreadNotificationsCount:s}=(0,p.useInApp)();return(0,t.jsx)(e.Theme,{children:(0,t.jsxs)(e.Popover.Root,{children:[(0,t.jsxs)(e.Tooltip.Root,{children:[(0,t.jsx)(e.Tooltip.Trigger,{children:(0,t.jsx)(e.Popover.Trigger,{children:(0,t.jsx)(e.Button,{shape:"square",roundness:"full",variant:s?"fill":"ghost",children:(0,t.jsx)(i.Inbox,{})})})}),(0,t.jsx)(e.Tooltip.Content,{content:"Notification"})]}),(0,t.jsxs)(e.Popover.Content,{spacing:"large",width:"350px",height:"450px",children:[(0,t.jsx)(e.Popover.Header,{asChild:!0,children:(0,t.jsxs)(e.Flex,{justify:"between",align:"center",children:[(0,t.jsx)(e.Heading,{size:3,children:"Notifications"}),(0,t.jsx)(e.Popover.Close,{children:(0,t.jsx)(e.Button,{shape:"square",roundness:"full",variant:"ghost",mode:"subtle",inset:"right",children:(0,t.jsx)(i.X,{})})})]})}),(0,t.jsx)(e.Popover.Body,{children:(0,t.jsxs)(e.Flex,{direction:"column",gap:1,children:[n.length===0&&(0,t.jsx)(e.Flex,{justify:"center",align:"center",children:(0,t.jsx)(e.Text,{variant:"tertiary",size:2,children:"No notifications yet."})}),n.map(o=>(0,t.jsx)(e.Card,{children:(0,t.jsxs)(e.Flex,{align:"center",gap:4,justify:"between",children:[(0,t.jsxs)(e.Flex,{direction:"column",gap:1,children:[(0,t.jsx)(e.Text,{as:"p",variant:"secondary",weight:"semibold",size:2,children:o.renderedContent.body}),(0,t.jsx)(e.Text,{size:1,variant:"tertiary",children:(0,d.intlFormatDistance)(o.sentAt,new Date)})]}),(0,t.jsxs)(e.Tooltip.Root,{children:[(0,t.jsx)(e.Tooltip.Trigger,{children:(0,t.jsx)(e.Button,{shape:"square",variant:"ghost",roundness:"full",mode:o.readAt?"subtle":"distinct",onPress:()=>{o.readAt?r(o.id):a(o.id)},children:o.readAt?(0,t.jsx)(i.MailOpen,{}):(0,t.jsx)(i.Mail,{})})}),(0,t.jsx)(e.Tooltip.Content,{content:o.readAt?"Mark as unread":"Mark as read"})]})]})},o.id))]})}),(0,t.jsx)(e.Popover.Footer,{asChild:!0,children:(0,t.jsx)(e.Text,{as:"p",align:"center",color:"accent",variant:"tertiary",size:1,children:"Powered by DashX"})})]})]})})};var x=v;
|
|
2
2
|
//# sourceMappingURL=NotificationBell.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/widgets/NotificationBell.tsx"],
|
|
4
|
-
"sourcesContent": ["import { intlFormatDistance } from 'date-fns';\n\nimport { useInApp } from '../hooks/index.js';\nimport { Button, Card, Flex, Heading, Popover, Text, Theme, Tooltip } from '../components';\nimport { Inbox, Mail, MailOpen, X } from '../icons/index.js';\n\nconst NotificationBell = () => {\n let {\n markNotificationAsRead,\n markNotificationAsUnread,\n notifications,\n unreadNotificationsCount,\n } = useInApp();\n\n return (\n <Theme>\n <Popover.Root>\n <Tooltip.Root>\n <Tooltip.Trigger>\n <Popover.Trigger>\n <Button\n shape=\"square\"\n roundness=\"full\"\n variant={unreadNotificationsCount ? 'fill' : 'ghost'}\n >\n <Inbox />\n </Button>\n </Popover.Trigger>\n </Tooltip.Trigger>\n <Tooltip.Content content=\"Notification\" />\n </Tooltip.Root>\n <Popover.Content spacing=\"large\" width=\"350px\" height=\"450px\">\n <Popover.Header asChild>\n <Flex justify=\"between\" align=\"center\">\n <Heading size={3}>Notifications</Heading>\n <Popover.Close>\n <Button shape=\"square\" roundness=\"full\" variant=\"ghost\" mode=\"subtle\" inset=\"right\">\n <X />\n </Button>\n </Popover.Close>\n </Flex>\n </Popover.Header>\n <Popover.Body>\n <Flex direction=\"column\" gap={1}>\n {notifications.length
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAiBQ,IAAAI,EAAA,6BAjBRC,EAAmC,oBAEnCC,EAAyB,6BACzBC,EAA2E,yBAC3EC,EAAyC,6BAEzC,MAAMC,EAAmB,IAAM,CAC7B,GAAI,CACF,uBAAAC,EACA,yBAAAC,EACA,cAAAC,EACA,yBAAAC,CACF,KAAI,YAAS,EAEb,SACE,OAAC,SACC,oBAAC,UAAQ,KAAR,CACC,qBAAC,UAAQ,KAAR,CACC,oBAAC,UAAQ,QAAR,CACC,mBAAC,UAAQ,QAAR,CACC,mBAAC,UACC,MAAM,SACN,UAAU,OACV,QAASA,EAA2B,OAAS,QAE7C,mBAAC,UAAM,EACT,EACF,EACF,KACA,OAAC,UAAQ,QAAR,CAAgB,QAAQ,eAAe,GAC1C,KACA,QAAC,UAAQ,QAAR,CAAgB,QAAQ,QAAQ,MAAM,QAAQ,OAAO,QACpD,oBAAC,UAAQ,OAAR,CAAe,QAAO,GACrB,oBAAC,QAAK,QAAQ,UAAU,MAAM,SAC5B,oBAAC,WAAQ,KAAM,EAAG,yBAAa,KAC/B,OAAC,UAAQ,MAAR,CACC,mBAAC,UAAO,MAAM,SAAS,UAAU,OAAO,QAAQ,QAAQ,KAAK,SAAS,MAAM,QAC1E,mBAAC,MAAE,EACL,EACF,GACF,EACF,KACA,OAAC,UAAQ,KAAR,CACC,oBAAC,QAAK,UAAU,SAAS,IAAK,EAC3B,UAAAD,EAAc,
|
|
4
|
+
"sourcesContent": ["import { intlFormatDistance } from 'date-fns';\n\nimport { useInApp } from '../hooks/index.js';\nimport { Button, Card, Flex, Heading, Popover, Text, Theme, Tooltip } from '../components';\nimport { Inbox, Mail, MailOpen, X } from '../icons/index.js';\n\nconst NotificationBell = () => {\n let {\n markNotificationAsRead,\n markNotificationAsUnread,\n notifications,\n unreadNotificationsCount,\n } = useInApp();\n\n return (\n <Theme>\n <Popover.Root>\n <Tooltip.Root>\n <Tooltip.Trigger>\n <Popover.Trigger>\n <Button\n shape=\"square\"\n roundness=\"full\"\n variant={unreadNotificationsCount ? 'fill' : 'ghost'}\n >\n <Inbox />\n </Button>\n </Popover.Trigger>\n </Tooltip.Trigger>\n <Tooltip.Content content=\"Notification\" />\n </Tooltip.Root>\n <Popover.Content spacing=\"large\" width=\"350px\" height=\"450px\">\n <Popover.Header asChild>\n <Flex justify=\"between\" align=\"center\">\n <Heading size={3}>Notifications</Heading>\n <Popover.Close>\n <Button shape=\"square\" roundness=\"full\" variant=\"ghost\" mode=\"subtle\" inset=\"right\">\n <X />\n </Button>\n </Popover.Close>\n </Flex>\n </Popover.Header>\n <Popover.Body>\n <Flex direction=\"column\" gap={1}>\n {notifications.length === 0 && (\n <Flex justify=\"center\" align=\"center\">\n <Text variant=\"tertiary\" size={2}>\n No notifications yet.\n </Text>\n </Flex>\n )}\n {notifications.map((notification) => (\n <Card key={notification.id}>\n <Flex align=\"center\" gap={4} justify=\"between\">\n <Flex direction=\"column\" gap={1}>\n <Text as=\"p\" variant=\"secondary\" weight=\"semibold\" size={2}>\n {notification.renderedContent.body}\n </Text>\n <Text size={1} variant=\"tertiary\">\n {intlFormatDistance(notification.sentAt, new Date())}\n </Text>\n </Flex>\n <Tooltip.Root>\n <Tooltip.Trigger>\n <Button\n shape=\"square\"\n variant=\"ghost\"\n roundness=\"full\"\n mode={notification.readAt ? 'subtle' : 'distinct'}\n onPress={() => {\n if (notification.readAt) {\n markNotificationAsUnread(notification.id);\n } else {\n markNotificationAsRead(notification.id);\n }\n }}\n >\n {notification.readAt ? <MailOpen /> : <Mail />}\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Content\n content={notification.readAt ? 'Mark as unread' : 'Mark as read'}\n />\n </Tooltip.Root>\n </Flex>\n </Card>\n ))}\n </Flex>\n </Popover.Body>\n <Popover.Footer asChild>\n <Text as=\"p\" align=\"center\" color=\"accent\" variant=\"tertiary\" size={1}>\n Powered by DashX\n </Text>\n </Popover.Footer>\n </Popover.Content>\n </Popover.Root>\n </Theme>\n );\n};\n\nexport default NotificationBell;\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAiBQ,IAAAI,EAAA,6BAjBRC,EAAmC,oBAEnCC,EAAyB,6BACzBC,EAA2E,yBAC3EC,EAAyC,6BAEzC,MAAMC,EAAmB,IAAM,CAC7B,GAAI,CACF,uBAAAC,EACA,yBAAAC,EACA,cAAAC,EACA,yBAAAC,CACF,KAAI,YAAS,EAEb,SACE,OAAC,SACC,oBAAC,UAAQ,KAAR,CACC,qBAAC,UAAQ,KAAR,CACC,oBAAC,UAAQ,QAAR,CACC,mBAAC,UAAQ,QAAR,CACC,mBAAC,UACC,MAAM,SACN,UAAU,OACV,QAASA,EAA2B,OAAS,QAE7C,mBAAC,UAAM,EACT,EACF,EACF,KACA,OAAC,UAAQ,QAAR,CAAgB,QAAQ,eAAe,GAC1C,KACA,QAAC,UAAQ,QAAR,CAAgB,QAAQ,QAAQ,MAAM,QAAQ,OAAO,QACpD,oBAAC,UAAQ,OAAR,CAAe,QAAO,GACrB,oBAAC,QAAK,QAAQ,UAAU,MAAM,SAC5B,oBAAC,WAAQ,KAAM,EAAG,yBAAa,KAC/B,OAAC,UAAQ,MAAR,CACC,mBAAC,UAAO,MAAM,SAAS,UAAU,OAAO,QAAQ,QAAQ,KAAK,SAAS,MAAM,QAC1E,mBAAC,MAAE,EACL,EACF,GACF,EACF,KACA,OAAC,UAAQ,KAAR,CACC,oBAAC,QAAK,UAAU,SAAS,IAAK,EAC3B,UAAAD,EAAc,SAAW,MACxB,OAAC,QAAK,QAAQ,SAAS,MAAM,SAC3B,mBAAC,QAAK,QAAQ,WAAW,KAAM,EAAG,iCAElC,EACF,EAEDA,EAAc,IAAKE,MAClB,OAAC,QACC,oBAAC,QAAK,MAAM,SAAS,IAAK,EAAG,QAAQ,UACnC,qBAAC,QAAK,UAAU,SAAS,IAAK,EAC5B,oBAAC,QAAK,GAAG,IAAI,QAAQ,YAAY,OAAO,WAAW,KAAM,EACtD,SAAAA,EAAa,gBAAgB,KAChC,KACA,OAAC,QAAK,KAAM,EAAG,QAAQ,WACpB,kCAAmBA,EAAa,OAAQ,IAAI,IAAM,EACrD,GACF,KACA,QAAC,UAAQ,KAAR,CACC,oBAAC,UAAQ,QAAR,CACC,mBAAC,UACC,MAAM,SACN,QAAQ,QACR,UAAU,OACV,KAAMA,EAAa,OAAS,SAAW,WACvC,QAAS,IAAM,CACTA,EAAa,OACfH,EAAyBG,EAAa,EAAE,EAExCJ,EAAuBI,EAAa,EAAE,CAE1C,EAEC,SAAAA,EAAa,UAAS,OAAC,aAAS,KAAK,OAAC,SAAK,EAC9C,EACF,KACA,OAAC,UAAQ,QAAR,CACC,QAASA,EAAa,OAAS,iBAAmB,eACpD,GACF,GACF,GAhCSA,EAAa,EAiCxB,CACD,GACH,EACF,KACA,OAAC,UAAQ,OAAR,CAAe,QAAO,GACrB,mBAAC,QAAK,GAAG,IAAI,MAAM,SAAS,MAAM,SAAS,QAAQ,WAAW,KAAM,EAAG,4BAEvE,EACF,GACF,GACF,EACF,CAEJ,EAEA,IAAOZ,EAAQO",
|
|
6
6
|
"names": ["NotificationBell_exports", "__export", "NotificationBell_default", "__toCommonJS", "import_jsx_runtime", "import_date_fns", "import_hooks", "import_components", "import_icons", "NotificationBell", "markNotificationAsRead", "markNotificationAsUnread", "notifications", "unreadNotificationsCount", "notification"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { default as Chat } from './Chat.js';
|
|
2
|
+
export { default as ChatPopover } from './ChatPopover.js';
|
|
1
3
|
export { default as NotificationBell } from './NotificationBell.js';
|
|
2
4
|
export { default as Preference } from './Preference.js';
|
|
3
5
|
export { default as Preferences } from './Preferences.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.create;var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var o in r)f(e,o,{get:r[o],enumerable:!0})},p=(e,r,o,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of n(r))!h.call(e,t)&&t!==o&&f(e,t,{get:()=>r[t],enumerable:!(l=i(r,t))||l.enumerable});return e};var a=(e,r,o)=>(o=e!=null?c(P(e)):{},p(r||!e||!e.__esModule?f(o,"default",{value:e,enumerable:!0}):o,e)),v=e=>p(f({},"__esModule",{value:!0}),e);var B={};C(B,{Chat:()=>s.default,ChatPopover:()=>d.default,NotificationBell:()=>m.default,Preference:()=>u.default,Preferences:()=>x.default});module.exports=v(B);var s=a(require("./Chat.js")),d=a(require("./ChatPopover.js")),m=a(require("./NotificationBell.js")),u=a(require("./Preference.js")),x=a(require("./Preferences.js"));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/widgets/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as NotificationBell } from './NotificationBell.js';\nexport { default as Preference } from './Preference.js';\nexport { default as Preferences } from './Preferences.js';\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
6
|
-
"names": ["widgets_exports", "__export", "__toCommonJS", "import_NotificationBell", "import_Preference", "import_Preferences"]
|
|
4
|
+
"sourcesContent": ["export { default as Chat } from './Chat.js';\nexport { default as ChatPopover } from './ChatPopover.js';\nexport { default as NotificationBell } from './NotificationBell.js';\nexport { default as Preference } from './Preference.js';\nexport { default as Preferences } from './Preferences.js';\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iJAAAE,EAAAF,GAAA,IAAAG,EAAgC,wBAChCC,EAAuC,+BACvCC,EAA4C,oCAC5CC,EAAsC,8BACtCC,EAAuC",
|
|
6
|
+
"names": ["widgets_exports", "__export", "__toCommonJS", "import_Chat", "import_ChatPopover", "import_NotificationBell", "import_Preference", "import_Preferences"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
+
import type { AvatarVariantProps } from '../variants/avatar.js';
|
|
4
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarPrimitive.AvatarImageProps & AvatarPrimitive.AvatarFallbackProps & AvatarVariantProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export { Avatar };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as d}from"react/jsx-runtime";import*as c from"react";import*as a from"@radix-ui/react-avatar";import"@radix-ui/react-slot";import{cn as n}from"../utils/cn.js";import{avatar as p}from"../variants/avatar.js";function f(i,o){const{size:e,roundness:r,src:m,alt:v,delayMs:s,children:l}=i;return d(a.Root,{ref:o,children:[t(a.Image,{className:n("dx",p({size:e,roundness:r})),src:m,alt:v,"data-radius":r}),t(a.Fallback,{delayMs:s,children:l})]})}const A=c.forwardRef(f);export{A as Avatar};
|
|
2
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/avatar.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { cn } from '../utils/cn.js';\nimport { avatar } from '../variants/avatar.js';\n\nimport type { AvatarVariantProps } from '../variants/avatar.js';\n\nfunction _Avatar(\n props: AvatarPrimitive.AvatarImageProps &\n AvatarPrimitive.AvatarFallbackProps &\n AvatarVariantProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) {\n const { size, roundness, src, alt, delayMs, children } = props;\n return (\n <AvatarPrimitive.Root ref={ref}>\n <AvatarPrimitive.Image\n className={cn('dx', avatar({ size, roundness }))}\n src={src}\n alt={alt}\n data-radius={roundness}\n />\n <AvatarPrimitive.Fallback delayMs={delayMs}>{children}</AvatarPrimitive.Fallback>\n </AvatarPrimitive.Root>\n );\n}\n\nconst Avatar = React.forwardRef(_Avatar);\n\nexport { Avatar };\n"],
|
|
5
|
+
"mappings": "AAiBI,OACE,OAAAA,EADF,QAAAC,MAAA,oBAjBJ,UAAYC,MAAW,QACvB,UAAYC,MAAqB,yBACjC,MAAqB,uBAErB,OAAS,MAAAC,MAAU,iBACnB,OAAS,UAAAC,MAAc,wBAIvB,SAASC,EACPC,EAGAC,EACA,CACA,KAAM,CAAE,KAAAC,EAAM,UAAAC,EAAW,IAAAC,EAAK,IAAAC,EAAK,QAAAC,EAAS,SAAAC,CAAS,EAAIP,EACzD,OACEN,EAACE,EAAgB,KAAhB,CAAqB,IAAKK,EACzB,UAAAR,EAACG,EAAgB,MAAhB,CACC,UAAWC,EAAG,KAAMC,EAAO,CAAE,KAAAI,EAAM,UAAAC,CAAU,CAAC,CAAC,EAC/C,IAAKC,EACL,IAAKC,EACL,cAAaF,EACf,EACAV,EAACG,EAAgB,SAAhB,CAAyB,QAASU,EAAU,SAAAC,EAAS,GACxD,CAEJ,CAEA,MAAMC,EAASb,EAAM,WAAWI,CAAO",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "AvatarPrimitive", "cn", "avatar", "_Avatar", "props", "ref", "size", "roundness", "src", "alt", "delayMs", "children", "Avatar"]
|
|
7
|
+
}
|
|
@@ -36,6 +36,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
36
36
|
start: string;
|
|
37
37
|
end: string;
|
|
38
38
|
};
|
|
39
|
+
wrap: {
|
|
40
|
+
nowrap: string;
|
|
41
|
+
wrap: string;
|
|
42
|
+
'wrap-reverse': string;
|
|
43
|
+
};
|
|
39
44
|
}, undefined, "flex", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
40
45
|
direction: {
|
|
41
46
|
column: string;
|
|
@@ -72,6 +77,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
72
77
|
start: string;
|
|
73
78
|
end: string;
|
|
74
79
|
};
|
|
80
|
+
wrap: {
|
|
81
|
+
nowrap: string;
|
|
82
|
+
wrap: string;
|
|
83
|
+
'wrap-reverse': string;
|
|
84
|
+
};
|
|
75
85
|
}, {
|
|
76
86
|
direction: {
|
|
77
87
|
column: string;
|
|
@@ -108,6 +118,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
108
118
|
start: string;
|
|
109
119
|
end: string;
|
|
110
120
|
};
|
|
121
|
+
wrap: {
|
|
122
|
+
nowrap: string;
|
|
123
|
+
wrap: string;
|
|
124
|
+
'wrap-reverse': string;
|
|
125
|
+
};
|
|
111
126
|
}>, {
|
|
112
127
|
direction: {
|
|
113
128
|
column: string;
|
|
@@ -144,6 +159,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
144
159
|
start: string;
|
|
145
160
|
end: string;
|
|
146
161
|
};
|
|
162
|
+
wrap: {
|
|
163
|
+
nowrap: string;
|
|
164
|
+
wrap: string;
|
|
165
|
+
'wrap-reverse': string;
|
|
166
|
+
};
|
|
147
167
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
148
168
|
direction: {
|
|
149
169
|
column: string;
|
|
@@ -180,6 +200,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
180
200
|
start: string;
|
|
181
201
|
end: string;
|
|
182
202
|
};
|
|
203
|
+
wrap: {
|
|
204
|
+
nowrap: string;
|
|
205
|
+
wrap: string;
|
|
206
|
+
'wrap-reverse': string;
|
|
207
|
+
};
|
|
183
208
|
}, undefined, "flex", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
184
209
|
direction: {
|
|
185
210
|
column: string;
|
|
@@ -216,6 +241,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
216
241
|
start: string;
|
|
217
242
|
end: string;
|
|
218
243
|
};
|
|
244
|
+
wrap: {
|
|
245
|
+
nowrap: string;
|
|
246
|
+
wrap: string;
|
|
247
|
+
'wrap-reverse': string;
|
|
248
|
+
};
|
|
219
249
|
}, {
|
|
220
250
|
direction: {
|
|
221
251
|
column: string;
|
|
@@ -252,6 +282,11 @@ declare const flexVariants: import("tailwind-variants").TVReturnType<{
|
|
|
252
282
|
start: string;
|
|
253
283
|
end: string;
|
|
254
284
|
};
|
|
285
|
+
wrap: {
|
|
286
|
+
nowrap: string;
|
|
287
|
+
wrap: string;
|
|
288
|
+
'wrap-reverse': string;
|
|
289
|
+
};
|
|
255
290
|
}>, unknown, unknown, undefined>>;
|
|
256
291
|
type FlexProps = VariantProps<typeof flexVariants> & {
|
|
257
292
|
asChild?: boolean;
|
|
@@ -292,6 +327,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
292
327
|
start: string;
|
|
293
328
|
end: string;
|
|
294
329
|
};
|
|
330
|
+
wrap: {
|
|
331
|
+
nowrap: string;
|
|
332
|
+
wrap: string;
|
|
333
|
+
'wrap-reverse': string;
|
|
334
|
+
};
|
|
295
335
|
}, undefined, "flex", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
296
336
|
direction: {
|
|
297
337
|
column: string;
|
|
@@ -328,6 +368,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
328
368
|
start: string;
|
|
329
369
|
end: string;
|
|
330
370
|
};
|
|
371
|
+
wrap: {
|
|
372
|
+
nowrap: string;
|
|
373
|
+
wrap: string;
|
|
374
|
+
'wrap-reverse': string;
|
|
375
|
+
};
|
|
331
376
|
}, {
|
|
332
377
|
direction: {
|
|
333
378
|
column: string;
|
|
@@ -364,6 +409,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
364
409
|
start: string;
|
|
365
410
|
end: string;
|
|
366
411
|
};
|
|
412
|
+
wrap: {
|
|
413
|
+
nowrap: string;
|
|
414
|
+
wrap: string;
|
|
415
|
+
'wrap-reverse': string;
|
|
416
|
+
};
|
|
367
417
|
}>, {
|
|
368
418
|
direction: {
|
|
369
419
|
column: string;
|
|
@@ -400,6 +450,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
400
450
|
start: string;
|
|
401
451
|
end: string;
|
|
402
452
|
};
|
|
453
|
+
wrap: {
|
|
454
|
+
nowrap: string;
|
|
455
|
+
wrap: string;
|
|
456
|
+
'wrap-reverse': string;
|
|
457
|
+
};
|
|
403
458
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
404
459
|
direction: {
|
|
405
460
|
column: string;
|
|
@@ -436,6 +491,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
436
491
|
start: string;
|
|
437
492
|
end: string;
|
|
438
493
|
};
|
|
494
|
+
wrap: {
|
|
495
|
+
nowrap: string;
|
|
496
|
+
wrap: string;
|
|
497
|
+
'wrap-reverse': string;
|
|
498
|
+
};
|
|
439
499
|
}, undefined, "flex", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
440
500
|
direction: {
|
|
441
501
|
column: string;
|
|
@@ -472,6 +532,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
472
532
|
start: string;
|
|
473
533
|
end: string;
|
|
474
534
|
};
|
|
535
|
+
wrap: {
|
|
536
|
+
nowrap: string;
|
|
537
|
+
wrap: string;
|
|
538
|
+
'wrap-reverse': string;
|
|
539
|
+
};
|
|
475
540
|
}, {
|
|
476
541
|
direction: {
|
|
477
542
|
column: string;
|
|
@@ -508,6 +573,11 @@ declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDiv
|
|
|
508
573
|
start: string;
|
|
509
574
|
end: string;
|
|
510
575
|
};
|
|
576
|
+
wrap: {
|
|
577
|
+
nowrap: string;
|
|
578
|
+
wrap: string;
|
|
579
|
+
'wrap-reverse': string;
|
|
580
|
+
};
|
|
511
581
|
}>, unknown, unknown, undefined>>> & {
|
|
512
582
|
asChild?: boolean;
|
|
513
583
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as x}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as x}from"react/jsx-runtime";import m from"react";import{tv as c}from"tailwind-variants";import{Slot as g}from"@radix-ui/react-slot";import"../utils/cn.js";const w=c({base:"flex",variants:{direction:{column:"flex-col",row:"flex-row","column-reverse":"flex-col-reverse","row-reverse":"flex-row-reverse"},gap:{1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8",10:"gap-10",12:"gap-12",14:"gap-14",16:"gap-16",18:"gap-18",24:"gap-24",28:"gap-28",32:"gap-32"},justify:{baseline:"justify-baseline",center:"justify-center",between:"justify-between",start:"justify-start",end:"justify-end"},align:{baseline:"items-baseline",center:"items-center",start:"items-start",end:"items-end"},wrap:{nowrap:"flex-nowrap",wrap:"flex-wrap","wrap-reverse":"flex-wrap-reverse"}}}),e=m.forwardRef((r,a)=>{const{className:t,direction:s,gap:p,justify:i,align:o,wrap:n,asChild:l,...f}=r;return x(l?g:"div",{className:w({direction:s,gap:p,justify:i,align:o,wrap:n,className:t}),ref:a,...f})});e.displayName="Flex";export{e as Flex};
|
|
2
2
|
//# sourceMappingURL=flex.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/flex.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { tv } from 'tailwind-variants';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { cn } from '../utils/cn.js';\n\nimport type { VariantProps } from 'tailwind-variants';\n\nconst flexVariants = tv({\n base: 'flex',\n variants: {\n direction: {\n column: 'flex-col',\n row: 'flex-row',\n 'column-reverse': 'flex-col-reverse',\n 'row-reverse': 'flex-row-reverse',\n },\n gap: {\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n 14: 'gap-14',\n 16: 'gap-16',\n 18: 'gap-18',\n 24: 'gap-24',\n 28: 'gap-28',\n 32: 'gap-32',\n },\n justify: {\n baseline: 'justify-baseline',\n center: 'justify-center',\n between: 'justify-between',\n start: 'justify-start',\n end: 'justify-end',\n },\n align: {\n baseline: 'items-baseline',\n center: 'items-center',\n start: 'items-start',\n end: 'items-end',\n },\n },\n});\n\ntype FlexProps = VariantProps<typeof flexVariants> & {\n asChild?: boolean;\n};\n\nconst Flex = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & FlexProps>(\n (props, ref) => {\n const { className, direction, gap, justify, align, asChild, ...rest } = props;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n className={flexVariants({ direction, gap, justify, align, className })}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFlex.displayName = 'Flex';\n\nexport type { FlexProps };\nexport { Flex };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "React", "tv", "Slot", "flexVariants", "Flex", "props", "ref", "className", "direction", "gap", "justify", "align", "asChild", "rest"]
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { tv } from 'tailwind-variants';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { cn } from '../utils/cn.js';\n\nimport type { VariantProps } from 'tailwind-variants';\n\nconst flexVariants = tv({\n base: 'flex',\n variants: {\n direction: {\n column: 'flex-col',\n row: 'flex-row',\n 'column-reverse': 'flex-col-reverse',\n 'row-reverse': 'flex-row-reverse',\n },\n gap: {\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n 14: 'gap-14',\n 16: 'gap-16',\n 18: 'gap-18',\n 24: 'gap-24',\n 28: 'gap-28',\n 32: 'gap-32',\n },\n justify: {\n baseline: 'justify-baseline',\n center: 'justify-center',\n between: 'justify-between',\n start: 'justify-start',\n end: 'justify-end',\n },\n align: {\n baseline: 'items-baseline',\n center: 'items-center',\n start: 'items-start',\n end: 'items-end',\n },\n wrap: {\n nowrap: 'flex-nowrap',\n wrap: 'flex-wrap',\n 'wrap-reverse': 'flex-wrap-reverse',\n },\n },\n});\n\ntype FlexProps = VariantProps<typeof flexVariants> & {\n asChild?: boolean;\n};\n\nconst Flex = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & FlexProps>(\n (props, ref) => {\n const { className, direction, gap, justify, align, wrap, asChild, ...rest } = props;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n className={flexVariants({ direction, gap, justify, align, wrap, className })}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFlex.displayName = 'Flex';\n\nexport type { FlexProps };\nexport { Flex };\n"],
|
|
5
|
+
"mappings": "AA+DM,cAAAA,MAAA,oBA/DN,OAAOC,MAAW,QAClB,OAAS,MAAAC,MAAU,oBACnB,OAAS,QAAAC,MAAY,uBAErB,MAAmB,iBAInB,MAAMC,EAAeF,EAAG,CACtB,KAAM,OACN,SAAU,CACR,UAAW,CACT,OAAQ,WACR,IAAK,WACL,iBAAkB,mBAClB,cAAe,kBACjB,EACA,IAAK,CACH,EAAG,QACH,EAAG,QACH,EAAG,QACH,EAAG,QACH,EAAG,QACH,EAAG,QACH,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,QACN,EACA,QAAS,CACP,SAAU,mBACV,OAAQ,iBACR,QAAS,kBACT,MAAO,gBACP,IAAK,aACP,EACA,MAAO,CACL,SAAU,iBACV,OAAQ,eACR,MAAO,cACP,IAAK,WACP,EACA,KAAM,CACJ,OAAQ,cACR,KAAM,YACN,eAAgB,mBAClB,CACF,CACF,CAAC,EAMKG,EAAOJ,EAAM,WACjB,CAACK,EAAOC,IAAQ,CACd,KAAM,CAAE,UAAAC,EAAW,UAAAC,EAAW,IAAAC,EAAK,QAAAC,EAAS,MAAAC,EAAO,KAAAC,EAAM,QAAAC,EAAS,GAAGC,CAAK,EAAIT,EAE9E,OACEN,EAFWc,EAAUX,EAAO,MAE3B,CACC,UAAWC,EAAa,CAAE,UAAAK,EAAW,IAAAC,EAAK,QAAAC,EAAS,MAAAC,EAAO,KAAAC,EAAM,UAAAL,CAAU,CAAC,EAC3E,IAAKD,EACJ,GAAGQ,EACN,CAEJ,CACF,EAEAV,EAAK,YAAc",
|
|
6
|
+
"names": ["jsx", "React", "tv", "Slot", "flexVariants", "Flex", "props", "ref", "className", "direction", "gap", "justify", "align", "wrap", "asChild", "rest"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./button.js";export*from"./card.js";export*from"./checkbox.js";export*from"./flex.js";export*from"./form.js";export*from"./heading.js";export*from"./icon-button.js";export*from"./link.js";export*from"./number-field.js";import*as
|
|
1
|
+
export*from"./avatar.js";export*from"./button.js";export*from"./card.js";export*from"./checkbox.js";export*from"./flex.js";export*from"./form.js";export*from"./heading.js";export*from"./icon-button.js";export*from"./link.js";export*from"./number-field.js";import*as l from"./popover.js";export*from"./toast.js";export*from"./text.js";export*from"./text-area.js";export*from"./text-field.js";export*from"./theme.js";import*as d from"./tooltip.js";export{l as Popover,d as Tooltip};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './button.js';\nexport * from './card.js';\nexport * from './checkbox.js';\nexport * from './flex.js';\nexport * from './form.js';\nexport * from './heading.js';\nexport * from './icon-button.js';\nexport * from './link.js';\nexport * from './number-field.js';\nexport * as Popover from './popover.js';\nexport * from './toast.js';\nexport * from './text.js';\nexport * from './text-area.js';\nexport * from './text-field.js';\nexport * from './theme.js';\nexport * as Tooltip from './tooltip.js';\n"],
|
|
5
|
-
"mappings": "AAAA,WAAc,cACd,WAAc,YACd,WAAc,gBACd,WAAc,YACd,WAAc,YACd,WAAc,eACd,WAAc,mBACd,WAAc,YACd,WAAc,oBACd,UAAYA,MAAa,eACzB,WAAc,aACd,WAAc,YACd,WAAc,iBACd,WAAc,kBACd,WAAc,aACd,UAAYC,MAAa",
|
|
4
|
+
"sourcesContent": ["export * from './avatar.js';\nexport * from './button.js';\nexport * from './card.js';\nexport * from './checkbox.js';\nexport * from './flex.js';\nexport * from './form.js';\nexport * from './heading.js';\nexport * from './icon-button.js';\nexport * from './link.js';\nexport * from './number-field.js';\nexport * as Popover from './popover.js';\nexport * from './toast.js';\nexport * from './text.js';\nexport * from './text-area.js';\nexport * from './text-field.js';\nexport * from './theme.js';\nexport * as Tooltip from './tooltip.js';\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,cACd,WAAc,cACd,WAAc,YACd,WAAc,gBACd,WAAc,YACd,WAAc,YACd,WAAc,eACd,WAAc,mBACd,WAAc,YACd,WAAc,oBACd,UAAYA,MAAa,eACzB,WAAc,aACd,WAAc,YACd,WAAc,iBACd,WAAc,kBACd,WAAc,aACd,UAAYC,MAAa",
|
|
6
6
|
"names": ["Popover", "Tooltip"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type MarkdownRendererProps = {
|
|
2
|
+
children: string;
|
|
3
|
+
animate?: boolean;
|
|
4
|
+
animationSpeed?: number;
|
|
5
|
+
onAnimationComplete?: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare function MarkdownRenderer({ children, animate, animationSpeed, onAnimationComplete }: MarkdownRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { MarkdownRenderer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import"react";import m from"react-markdown";import{Heading as t}from"./heading.js";import{Link as d}from"./link.js";import{Text as p}from"./text.js";import c from"../hooks/use-animated-text.js";function u({children:a,animate:n=!1,animationSpeed:i=8,onAnimationComplete:o}){const{displayedText:s}=c({text:a,speed:i,onComplete:o,enabled:n});return r("div",{className:"space-y-6",children:r(m,{components:{h1({children:e}){return r(t,{as:"h1",size:4,className:"text-gray-900",children:e})},h2({children:e}){return r(t,{as:"h2",size:3,className:"text-gray-900",children:e})},p({children:e}){return r(p,{as:"p",className:"text-gray-900",children:e})},ul({children:e}){return r("ul",{className:"list-disc list-inside",children:e})},ol({children:e}){return r("ol",{className:"list-decimal list-inside",children:e})},li({children:e}){return r("li",{className:"text-gray-900",children:e})},a({children:e,href:l}){return r(d,{href:l,children:e})}},children:s})})}export{u as MarkdownRenderer};
|
|
2
|
+
//# sourceMappingURL=markdown-renderer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/markdown-renderer.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\nimport ReactMarkdown from 'react-markdown'\n\nimport { Heading } from './heading.js'\nimport { Link } from './link.js'\nimport { Text } from './text.js'\nimport useAnimatedText from '../hooks/use-animated-text.js'\n\ntype MarkdownRendererProps = {\n children: string,\n animate?: boolean\n animationSpeed?: number\n onAnimationComplete?: () => void\n}\n\nfunction MarkdownRenderer({ children, animate = false, animationSpeed = 8, onAnimationComplete }: MarkdownRendererProps) {\n const { displayedText } = useAnimatedText({\n text: children,\n speed: animationSpeed,\n onComplete: onAnimationComplete,\n enabled: animate\n });\n\n return (\n <div className=\"space-y-6\">\n <ReactMarkdown\n components={{\n h1({ children }) {\n return <Heading as=\"h1\" size={4} className=\"text-gray-900\">{children}</Heading>\n },\n h2({ children }) {\n return <Heading as=\"h2\" size={3} className=\"text-gray-900\">{children}</Heading>\n },\n p({ children }) {\n return <Text as=\"p\" className=\"text-gray-900\">{children}</Text>\n },\n ul({ children }) {\n return <ul className=\"list-disc list-inside\">{children}</ul>\n },\n ol({ children }) {\n return <ol className=\"list-decimal list-inside\">{children}</ol>\n },\n li({ children }) {\n return <li className=\"text-gray-900\">{children}</li>\n },\n a({ children, href }) {\n return <Link href={href}>{children}</Link>\n },\n }}\n >\n {displayedText}\n </ReactMarkdown>\n </div>\n )\n}\n\nexport { MarkdownRenderer }\n"],
|
|
5
|
+
"mappings": "AA4BmB,cAAAA,MAAA,oBA5BnB,MAAkB,QAClB,OAAOC,MAAmB,iBAE1B,OAAS,WAAAC,MAAe,eACxB,OAAS,QAAAC,MAAY,YACrB,OAAS,QAAAC,MAAY,YACrB,OAAOC,MAAqB,gCAS5B,SAASC,EAAiB,CAAE,SAAAC,EAAU,QAAAC,EAAU,GAAO,eAAAC,EAAiB,EAAG,oBAAAC,CAAoB,EAA0B,CACvH,KAAM,CAAE,cAAAC,CAAc,EAAIN,EAAgB,CACxC,KAAME,EACN,MAAOE,EACP,WAAYC,EACZ,QAASF,CACX,CAAC,EAED,OACER,EAAC,OAAI,UAAU,YACb,SAAAA,EAACC,EAAA,CACC,WAAY,CACV,GAAG,CAAE,SAAAM,CAAS,EAAG,CACf,OAAOP,EAACE,EAAA,CAAQ,GAAG,KAAK,KAAM,EAAG,UAAU,gBAAiB,SAAAK,EAAS,CACvE,EACA,GAAG,CAAE,SAAAA,CAAS,EAAG,CACf,OAAOP,EAACE,EAAA,CAAQ,GAAG,KAAK,KAAM,EAAG,UAAU,gBAAiB,SAAAK,EAAS,CACvE,EACA,EAAE,CAAE,SAAAA,CAAS,EAAG,CACd,OAAOP,EAACI,EAAA,CAAK,GAAG,IAAI,UAAU,gBAAiB,SAAAG,EAAS,CAC1D,EACA,GAAG,CAAE,SAAAA,CAAS,EAAG,CACf,OAAOP,EAAC,MAAG,UAAU,wBAAyB,SAAAO,EAAS,CACzD,EACA,GAAG,CAAE,SAAAA,CAAS,EAAG,CACf,OAAOP,EAAC,MAAG,UAAU,2BAA4B,SAAAO,EAAS,CAC5D,EACA,GAAG,CAAE,SAAAA,CAAS,EAAG,CACf,OAAOP,EAAC,MAAG,UAAU,gBAAiB,SAAAO,EAAS,CACjD,EACA,EAAE,CAAE,SAAAA,EAAU,KAAAK,CAAK,EAAG,CACpB,OAAOZ,EAACG,EAAA,CAAK,KAAMS,EAAO,SAAAL,EAAS,CACrC,CACF,EAEC,SAAAI,EACH,EACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "ReactMarkdown", "Heading", "Link", "Text", "useAnimatedText", "MarkdownRenderer", "children", "animate", "animationSpeed", "onAnimationComplete", "displayedText", "href"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
import type { PopoverVariantProps } from '../variants/popover.js';
|
|
4
|
+
interface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {
|
|
5
|
+
}
|
|
6
|
+
declare const PopoverRoot: React.FC<PopoverRootProps>;
|
|
7
|
+
interface PopoverTriggerProps extends React.PropsWithChildren<{}> {
|
|
8
|
+
}
|
|
9
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
interface PopoverContentProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>, PopoverVariantProps {
|
|
11
|
+
maxWidth?: number | string;
|
|
12
|
+
minWidth?: number | string;
|
|
13
|
+
width?: number | string;
|
|
14
|
+
maxHeight?: number | string;
|
|
15
|
+
minHeight?: number | string;
|
|
16
|
+
height?: number | string;
|
|
17
|
+
}
|
|
18
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
type PopoverBodyProps = React.PropsWithChildren<{
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
declare const PopoverBody: React.ForwardRefExoticComponent<{
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
} & {
|
|
25
|
+
children?: React.ReactNode | undefined;
|
|
26
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
type PopoverHeaderProps = React.PropsWithChildren<{
|
|
28
|
+
asChild?: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
declare const PopoverHeader: React.ForwardRefExoticComponent<{
|
|
31
|
+
asChild?: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
children?: React.ReactNode | undefined;
|
|
34
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
type PopoverFooterProps = React.PropsWithChildren<{
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
declare const PopoverFooter: React.ForwardRefExoticComponent<{
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
} & {
|
|
41
|
+
children?: React.ReactNode | undefined;
|
|
42
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
interface PopoverCloseProps extends React.PropsWithChildren<{}> {
|
|
44
|
+
}
|
|
45
|
+
declare const PopoverClose: React.ForwardRefExoticComponent<PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
export { PopoverRoot as Root, PopoverContent as Content, PopoverBody as Body, PopoverHeader as Header, PopoverFooter as Footer, PopoverTrigger as Trigger, PopoverClose as Close, };
|
|
47
|
+
export type { PopoverRootProps as RootProps, PopoverContentProps as ContentProps, PopoverBodyProps as BodyProps, PopoverHeaderProps as HeaderProps, PopoverFooterProps as FooterProps, PopoverTriggerProps as TriggerProps, PopoverCloseProps as CloseProps, };
|
|
@@ -6,6 +6,7 @@ interface TextAreaProps extends TextFieldProps, TextAreaVariantProps {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
description?: string | ReactNode;
|
|
8
8
|
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
9
|
+
autogrow?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const TextArea: import("react").ForwardRefExoticComponent<TextAreaProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
12
|
export { TextArea };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as T}from"react/jsx-runtime";import{filterDOMProps as P}from"@react-aria/utils";import{forwardRef as h,useRef as A,useEffect as E}from"react";import{useContextProps as F,TextFieldContext as b}from"react-aria-components";import{useTextField as H}from"react-aria";import{cn as c}from"../utils/cn.js";import{fieldError as w}from"../variants/field-error.js";import{Flex as p,Text as s}from"./index.js";import{removeDataAttributes as D}from"../utils/helpers.js";import{textArea as N}from"../variants/text-area.js";const q=180;function I({label:d,description:m,errorMessage:a,size:u="medium",roundness:n="medium",elevation:o="medium",autogrow:f=!1,...e},l){[e,l]=F(e,l,b);let t=A(null),{labelProps:y,inputProps:x,descriptionProps:g,errorMessageProps:v,...i}=H({...D(e),inputElementType:"text-area",label:d},t);return E(()=>{if(f&&t.current){t.current.style.height="0px";const R=t.current.scrollHeight;t.current.style.height=Math.min(R,q)+"px"}},[f,t,x.value]),T(p,{...P(e),gap:2,direction:"column",ref:l,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":i.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,children:[d&&r(s,{...y,size:1,transform:"uppercase",weight:"semibold",variant:"tertiary",color:"gray",children:d}),T(p,{role:"group",className:"relative","data-radius":n,"data-shadow":o,children:[r("textarea",{...x,ref:t,className:c("dx","w-full resize-none",N({size:u,roundness:n,elevation:o})),"data-disabled":e.isDisabled||void 0,"data-invalid":i.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0}),i.isInvalid&&r(s,{...v,size:1,className:c("dx",w({size:u,roundness:n,elevation:o})),children:a?typeof a=="string"?a:a(i):i.validationErrors.length===0?void 0:i.validationErrors.join(" ")})]}),m&&r(s,{size:1,variant:"tertiary",...g,children:m})]})}const M=h(I);export{M as TextArea};
|
|
2
2
|
//# sourceMappingURL=text-area.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/text-area.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "
|
|
4
|
+
"sourcesContent": ["import { filterDOMProps } from '@react-aria/utils';\nimport { forwardRef, useRef, type ReactNode, useEffect } from 'react';\nimport { useContextProps, TextFieldContext } from 'react-aria-components';\nimport { useTextField } from 'react-aria';\nimport type { TextFieldProps, ValidationResult } from 'react-aria-components';\n\nimport { cn } from '../utils/cn.js';\nimport { fieldError } from '../variants/field-error.js';\nimport { Flex, Text } from './index.js';\nimport { removeDataAttributes } from '../utils/helpers.js';\nimport { textArea, type TextAreaVariantProps } from '../variants/text-area.js';\n\nconst MAX_HEIGHT = 180;\n\ninterface TextAreaProps extends TextFieldProps, TextAreaVariantProps {\n placeholder?: string;\n label?: string;\n description?: string | ReactNode;\n errorMessage?: string | ((validation: ValidationResult) => string);\n autogrow?: boolean;\n}\n\nfunction _TextArea(\n {\n label,\n description,\n errorMessage,\n size = 'medium',\n roundness = 'medium',\n elevation = 'medium',\n autogrow = false,\n ...props\n }: TextAreaProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TextFieldContext);\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n let { labelProps, inputProps, descriptionProps, errorMessageProps, ...validation } =\n useTextField<any>(\n {\n ...removeDataAttributes(props),\n inputElementType: 'text-area',\n label,\n },\n inputRef,\n );\n\n useEffect(() => {\n if (autogrow && inputRef.current) {\n inputRef.current.style.height = \"0px\";\n const scrollHeight = inputRef.current.scrollHeight;\n\n inputRef.current.style.height = Math.min(scrollHeight, MAX_HEIGHT) + \"px\";\n }\n }, [autogrow, inputRef, inputProps.value]);\n\n return (\n <Flex\n {...filterDOMProps(props)}\n gap={2}\n direction=\"column\"\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n >\n {label && (\n <Text\n {...labelProps}\n size={1}\n transform=\"uppercase\"\n weight=\"semibold\"\n variant=\"tertiary\"\n color=\"gray\"\n >\n {label}\n </Text>\n )}\n <Flex role=\"group\" className=\"relative\" data-radius={roundness} data-shadow={elevation}>\n <textarea\n {...inputProps}\n ref={inputRef}\n className={cn('dx', 'w-full resize-none', textArea({ size, roundness, elevation }))}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n />\n {validation.isInvalid && (\n <Text\n {...errorMessageProps}\n size={1}\n className={cn('dx', fieldError({ size, roundness, elevation }))}\n >\n {errorMessage\n ? typeof errorMessage === 'string'\n ? errorMessage\n : errorMessage(validation)\n : validation.validationErrors.length === 0\n ? undefined\n : validation.validationErrors.join(' ')}\n </Text>\n )}\n </Flex>\n {description && (\n <Text size={1} variant=\"tertiary\" {...descriptionProps}>\n {description}\n </Text>\n )}\n </Flex>\n );\n}\n\nconst TextArea = forwardRef(_TextArea);\n\nexport { TextArea };\n"],
|
|
5
|
+
"mappings": "AAsEQ,cAAAA,EAWF,QAAAC,MAXE,oBAtER,OAAS,kBAAAC,MAAsB,oBAC/B,OAAS,cAAAC,EAAY,UAAAC,EAAwB,aAAAC,MAAiB,QAC9D,OAAS,mBAAAC,EAAiB,oBAAAC,MAAwB,wBAClD,OAAS,gBAAAC,MAAoB,aAG7B,OAAS,MAAAC,MAAU,iBACnB,OAAS,cAAAC,MAAkB,6BAC3B,OAAS,QAAAC,EAAM,QAAAC,MAAY,aAC3B,OAAS,wBAAAC,MAA4B,sBACrC,OAAS,YAAAC,MAA2C,2BAEpD,MAAMC,EAAa,IAUnB,SAASC,EACP,CACE,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,SACP,UAAAC,EAAY,SACZ,UAAAC,EAAY,SACZ,SAAAC,EAAW,GACX,GAAGC,CACL,EACAC,EACA,CACA,CAACD,EAAOC,CAAG,EAAInB,EAAgBkB,EAAOC,EAAKlB,CAAgB,EAC3D,IAAImB,EAAWtB,EAA4B,IAAI,EAE3C,CAAE,WAAAuB,EAAY,WAAAC,EAAY,iBAAAC,EAAkB,kBAAAC,EAAmB,GAAGC,CAAW,EAC/EvB,EACE,CACE,GAAGK,EAAqBW,CAAK,EAC7B,iBAAkB,YAClB,MAAAP,CACF,EACAS,CACF,EAEF,OAAArB,EAAU,IAAM,CACd,GAAIkB,GAAYG,EAAS,QAAS,CAChCA,EAAS,QAAQ,MAAM,OAAS,MAChC,MAAMM,EAAeN,EAAS,QAAQ,aAEtCA,EAAS,QAAQ,MAAM,OAAS,KAAK,IAAIM,EAAcjB,CAAU,EAAI,IACvE,CACF,EAAG,CAACQ,EAAUG,EAAUE,EAAW,KAAK,CAAC,EAGvC3B,EAACU,EAAA,CACE,GAAGT,EAAesB,CAAK,EACxB,IAAK,EACL,UAAU,SACV,IAAKC,EACL,KAAMD,EAAM,MAAQ,OACpB,gBAAeA,EAAM,YAAc,OACnC,eAAcO,EAAW,WAAa,OACtC,gBAAeP,EAAM,YAAc,OACnC,gBAAeA,EAAM,YAAc,OAElC,UAAAP,GACCjB,EAACY,EAAA,CACE,GAAGe,EACJ,KAAM,EACN,UAAU,YACV,OAAO,WACP,QAAQ,WACR,MAAM,OAEL,SAAAV,EACH,EAEFhB,EAACU,EAAA,CAAK,KAAK,QAAQ,UAAU,WAAW,cAAaU,EAAW,cAAaC,EAC3E,UAAAtB,EAAC,YACE,GAAG4B,EACJ,IAAKF,EACL,UAAWjB,EAAG,KAAM,qBAAsBK,EAAS,CAAE,KAAAM,EAAM,UAAAC,EAAW,UAAAC,CAAU,CAAC,CAAC,EAClF,gBAAeE,EAAM,YAAc,OACnC,eAAcO,EAAW,WAAa,OACtC,gBAAeP,EAAM,YAAc,OACnC,gBAAeA,EAAM,YAAc,OACrC,EACCO,EAAW,WACV/B,EAACY,EAAA,CACE,GAAGkB,EACJ,KAAM,EACN,UAAWrB,EAAG,KAAMC,EAAW,CAAE,KAAAU,EAAM,UAAAC,EAAW,UAAAC,CAAU,CAAC,CAAC,EAE7D,SAAAH,EACG,OAAOA,GAAiB,SACtBA,EACAA,EAAaY,CAAU,EACzBA,EAAW,iBAAiB,SAAW,EACrC,OACAA,EAAW,iBAAiB,KAAK,GAAG,EAC5C,GAEJ,EACCb,GACClB,EAACY,EAAA,CAAK,KAAM,EAAG,QAAQ,WAAY,GAAGiB,EACnC,SAAAX,EACH,GAEJ,CAEJ,CAEA,MAAMe,EAAW9B,EAAWa,CAAS",
|
|
6
|
+
"names": ["jsx", "jsxs", "filterDOMProps", "forwardRef", "useRef", "useEffect", "useContextProps", "TextFieldContext", "useTextField", "cn", "fieldError", "Flex", "Text", "removeDataAttributes", "textArea", "MAX_HEIGHT", "_TextArea", "label", "description", "errorMessage", "size", "roundness", "elevation", "autogrow", "props", "ref", "inputRef", "labelProps", "inputProps", "descriptionProps", "errorMessageProps", "validation", "scrollHeight", "TextArea"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { useWebSocket } from '../providers/DashXProvider.js';
|
|
2
|
+
export { default as useAgent } from './use-agent.js';
|
|
1
3
|
export { default as useDashXProvider } from './use-dashx-provider.js';
|
|
2
4
|
export { default as useInApp } from './use-in-app.js';
|
|
3
5
|
export { default as useProductRelease } from './use-product-release.js';
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as
|
|
1
|
+
import{useWebSocket as r}from"../providers/DashXProvider.js";import{default as s}from"./use-agent.js";import{default as u}from"./use-dashx-provider.js";import{default as p}from"./use-in-app.js";import{default as l}from"./use-product-release.js";export{s as useAgent,u as useDashXProvider,p as useInApp,l as useProductRelease,r as useWebSocket};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as useDashXProvider } from './use-dashx-provider.js';\nexport { default as useInApp } from './use-in-app.js';\nexport { default as useProductRelease } from './use-product-release.js';\n"],
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,MAAmC,0BAC5C,OAAoB,WAAXA,MAA2B,kBACpC,OAAoB,WAAXA,MAAoC",
|
|
6
|
-
"names": ["default"]
|
|
4
|
+
"sourcesContent": ["export { useWebSocket } from '../providers/DashXProvider.js';\nexport { default as useAgent } from './use-agent.js';\nexport { default as useDashXProvider } from './use-dashx-provider.js';\nexport { default as useInApp } from './use-in-app.js';\nexport { default as useProductRelease } from './use-product-release.js';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,MAAoB,gCAC7B,OAAoB,WAAXC,MAA2B,iBACpC,OAAoB,WAAXA,MAAmC,0BAC5C,OAAoB,WAAXA,MAA2B,kBACpC,OAAoB,WAAXA,MAAoC",
|
|
6
|
+
"names": ["useWebSocket", "default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AiAgent, AiMessage } from '@dashx/browser';
|
|
2
|
+
type UseAgentHookProps = {
|
|
3
|
+
publicEmbedKey: string;
|
|
4
|
+
};
|
|
5
|
+
type UseAgentHookResponse = {
|
|
6
|
+
agent?: AiAgent;
|
|
7
|
+
conversationId: string | null;
|
|
8
|
+
messages: AiMessage[];
|
|
9
|
+
isThinking: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
sendMessage: (text: string) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
declare const useAgent: ({ publicEmbedKey }: UseAgentHookProps) => UseAgentHookResponse;
|
|
14
|
+
export type { UseAgentHookProps, UseAgentHookResponse };
|
|
15
|
+
export default useAgent;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import k from"uuid-random";import{useState as s,useEffect as h,useCallback as v}from"react";import M from"./use-dashx-provider.js";const H=({publicEmbedKey:n})=>{const t=M(),[a,c]=s(),[o,u]=s(null),[p,l]=s([]),[d,A]=s(!1),[f,r]=s(null);h(()=>{t.loadAiAgent({publicEmbedKey:n}).then(e=>{c(e),r(null)}).catch(e=>{r(e)})},[t,n]);const m=v(async e=>{if(!(!e.trim()||!a))try{l(g=>[...g,{id:k(),role:"user",content:e}]),A(!0),r(null);const i=await t.invokeAiAgent({conversationId:o,prompt:e,publicEmbedKey:n});i.conversationId&&!o&&u(i.conversationId),l(g=>[...g,i])}catch{r("Failed to send message")}finally{A(!1)}},[t,a,n,o]);return{agent:a,conversationId:o,messages:p,isThinking:d,error:f,sendMessage:m}};var P=H;export{P as default};
|
|
2
|
+
//# sourceMappingURL=use-agent.js.map
|