@womp/kookie-ui 0.14.2 → 0.14.4
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/components.css +12 -0
- package/dist/cjs/components/button.d.ts +16 -3
- package/dist/cjs/components/button.d.ts.map +1 -1
- package/dist/cjs/components/button.js +2 -2
- package/dist/cjs/components/button.js.map +3 -3
- package/dist/cjs/components/chatbar.d.ts +3 -28
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js +2 -2
- package/dist/cjs/components/chatbar.js.map +3 -3
- package/dist/cjs/components/icon-button.d.ts +2 -1
- package/dist/cjs/components/icon-button.d.ts.map +1 -1
- package/dist/cjs/components/icon-button.js +2 -2
- package/dist/cjs/components/icon-button.js.map +3 -3
- package/dist/cjs/components/index.js +5 -5
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/components/message-scroller.d.ts +3 -9
- package/dist/cjs/components/message-scroller.d.ts.map +1 -1
- package/dist/cjs/components/message-scroller.js +2 -2
- package/dist/cjs/components/message-scroller.js.map +3 -3
- package/dist/cjs/components/notice.js +2 -2
- package/dist/cjs/components/notice.js.map +3 -3
- package/dist/cjs/components/theme-panel.js +3 -3
- package/dist/cjs/components/theme-panel.js.map +3 -3
- package/dist/cjs/components/toggle-button.d.ts +4 -4
- package/dist/cjs/components/toggle-button.d.ts.map +1 -1
- package/dist/cjs/components/toggle-button.js +3 -3
- package/dist/cjs/components/toggle-button.js.map +3 -3
- package/dist/cjs/components/toggle-icon-button.d.ts +3 -2
- package/dist/cjs/components/toggle-icon-button.d.ts.map +1 -1
- package/dist/cjs/components/toggle-icon-button.js +3 -3
- package/dist/cjs/components/toggle-icon-button.js.map +3 -3
- package/dist/cjs/components/toolbar.d.ts +4 -3
- package/dist/cjs/components/toolbar.d.ts.map +1 -1
- package/dist/cjs/components/toolbar.js +2 -2
- package/dist/cjs/components/toolbar.js.map +3 -3
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/{chunk-RAVFUI7W.js → chunk-3OQM7SLQ.js} +2 -2
- package/dist/esm/chunk-57XCVY6J.js +2 -0
- package/dist/esm/chunk-57XCVY6J.js.map +7 -0
- package/dist/esm/chunk-6SVNBGZ6.js +5 -0
- package/dist/esm/chunk-6SVNBGZ6.js.map +7 -0
- package/dist/esm/chunk-7ZCQAMHZ.js +2 -0
- package/dist/esm/chunk-7ZCQAMHZ.js.map +7 -0
- package/dist/esm/chunk-CYSDGVKF.js +2 -0
- package/dist/esm/chunk-CYSDGVKF.js.map +7 -0
- package/dist/esm/{chunk-IQU6EELI.js → chunk-F7TOKXKZ.js} +2 -2
- package/dist/esm/chunk-FMMKOOS7.js +2 -0
- package/dist/esm/chunk-FMMKOOS7.js.map +7 -0
- package/dist/esm/chunk-RA2XCS3M.js +2 -0
- package/dist/esm/chunk-RA2XCS3M.js.map +7 -0
- package/dist/esm/{chunk-BOFVKXUV.js → chunk-T7Q6DQRD.js} +2 -2
- package/dist/esm/chunk-T7Q6DQRD.js.map +7 -0
- package/dist/esm/components/button.d.ts +16 -3
- package/dist/esm/components/button.d.ts.map +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/chatbar.d.ts +3 -28
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/icon-button.d.ts +2 -1
- package/dist/esm/components/icon-button.d.ts.map +1 -1
- package/dist/esm/components/icon-button.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/message-scroller.d.ts +3 -9
- package/dist/esm/components/message-scroller.d.ts.map +1 -1
- package/dist/esm/components/message-scroller.js +1 -1
- package/dist/esm/components/notice.js +1 -1
- package/dist/esm/components/theme-panel.js +1 -1
- package/dist/esm/components/toggle-button.d.ts +4 -4
- package/dist/esm/components/toggle-button.d.ts.map +1 -1
- package/dist/esm/components/toggle-button.js +1 -1
- package/dist/esm/components/toggle-icon-button.d.ts +3 -2
- package/dist/esm/components/toggle-icon-button.d.ts.map +1 -1
- package/dist/esm/components/toggle-icon-button.js +1 -1
- package/dist/esm/components/toolbar.d.ts +4 -3
- package/dist/esm/components/toolbar.d.ts.map +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/src/components/button.tsx +44 -4
- package/src/components/chatbar.tsx +5 -2
- package/src/components/icon-button.tsx +2 -1
- package/src/components/message-scroller.tsx +5 -3
- package/src/components/sidebar.css +16 -0
- package/src/components/toggle-button.tsx +4 -2
- package/src/components/toggle-icon-button.tsx +4 -2
- package/src/components/toolbar.tsx +14 -10
- package/styles.css +12 -0
- package/dist/esm/chunk-3DEZMXFF.js +0 -5
- package/dist/esm/chunk-3DEZMXFF.js.map +0 -7
- package/dist/esm/chunk-7B6CIVAF.js +0 -2
- package/dist/esm/chunk-7B6CIVAF.js.map +0 -7
- package/dist/esm/chunk-BOFVKXUV.js.map +0 -7
- package/dist/esm/chunk-TZ5MZQUB.js +0 -2
- package/dist/esm/chunk-TZ5MZQUB.js.map +0 -7
- package/dist/esm/chunk-VV67KTKA.js +0 -2
- package/dist/esm/chunk-VV67KTKA.js.map +0 -7
- package/dist/esm/chunk-WXBTPEFO.js +0 -2
- package/dist/esm/chunk-WXBTPEFO.js.map +0 -7
- package/dist/esm/chunk-YDPCJO5G.js +0 -2
- package/dist/esm/chunk-YDPCJO5G.js.map +0 -7
- /package/dist/esm/{chunk-RAVFUI7W.js.map → chunk-3OQM7SLQ.js.map} +0 -0
- /package/dist/esm/{chunk-IQU6EELI.js.map → chunk-F7TOKXKZ.js.map} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-2KZ4NI3X.js";import{a as No,b as Oo}from"./chunk-HT7RFHLW.js";import{a as Lo,b as Mo}from"./chunk-IUER6BNH.js";import"./chunk-C7EVYSWK.js";import{a as Ao}from"./chunk-
|
|
1
|
+
import"./chunk-2KZ4NI3X.js";import{a as No,b as Oo}from"./chunk-HT7RFHLW.js";import{a as Lo,b as Mo}from"./chunk-IUER6BNH.js";import"./chunk-C7EVYSWK.js";import{a as Ao}from"./chunk-CYSDGVKF.js";import{a as zo}from"./chunk-57XCVY6J.js";import{a as yo}from"./chunk-VK7RNXUO.js";import{a as wo}from"./chunk-EE54S7YV.js";import{b as Bo,c as Co,d as Do,e as Eo,f as Fo}from"./chunk-FMMKOOS7.js";import"./chunk-ZUOK3KFY.js";import{a as Go}from"./chunk-3M73GWN5.js";import"./chunk-ZVIWTYHE.js";import{a as qo}from"./chunk-ROGC7K5N.js";import{c as so}from"./chunk-CL6P54QT.js";import"./chunk-GRRV4I2I.js";import{a as uo,b as vo}from"./chunk-F7TOKXKZ.js";import{a as jo}from"./chunk-VBAXORVV.js";import{c as ko}from"./chunk-UE2OBZIS.js";import"./chunk-AUV6B4AH.js";import{h as lo}from"./chunk-RUPET4E7.js";import"./chunk-BALS3AVM.js";import{e as no}from"./chunk-SIBSXKFF.js";import"./chunk-TZTUPQYK.js";import"./chunk-OVGPUFRI.js";import{a as ho}from"./chunk-HJLBVNQE.js";import"./chunk-5G4WWJ4Z.js";import{a as io}from"./chunk-43A5GUSI.js";import"./chunk-XI5YXUCK.js";import"./chunk-3WCSLQNH.js";import{h as Io}from"./chunk-UTHTSYSL.js";import"./chunk-ADXZNG4F.js";import"./chunk-2EQWBT2S.js";import{p as Ho}from"./chunk-OUSDYZDE.js";import"./chunk-KJC32RWT.js";import{a as bo}from"./chunk-KXSMY4ZF.js";import{c as ao}from"./chunk-IHRLGR6J.js";import"./chunk-VJUFYYKP.js";import{h as co}from"./chunk-SURYYF7I.js";import"./chunk-PLTTQFRQ.js";import{a as go}from"./chunk-K7BWSYVP.js";import"./chunk-UBWRIE4C.js";import{g as Jo}from"./chunk-45AMHIBO.js";import"./chunk-NIX6Z3JG.js";import{c as mo}from"./chunk-IY3GKGDZ.js";import{c as po}from"./chunk-CIKDGYX3.js";import"./chunk-2DKLJMUU.js";import{a as to}from"./chunk-4JNHUPIM.js";import"./chunk-STPMPY3X.js";import{a as xo}from"./chunk-FHEHX7CE.js";import{a as ro}from"./chunk-XEZXKPLE.js";import{a as eo}from"./chunk-RUOOCYK4.js";import"./chunk-CMEKH4I5.js";import{a as fo}from"./chunk-GLERJXVS.js";import"./chunk-MCQCG6AS.js";import"./chunk-FNB47XDO.js";import{a as $}from"./chunk-O2WPAUQN.js";import"./chunk-ZK55O7TN.js";import{i as Ko}from"./chunk-7ZCQAMHZ.js";import{e as oo}from"./chunk-R2MQMCND.js";import"./chunk-7ZOGH5NT.js";import{a as Z}from"./chunk-VUKTURU4.js";import{a as Y}from"./chunk-IVBKTHDM.js";import"./chunk-IBF5U4QW.js";import"./chunk-L6UXAITB.js";import"./chunk-GFOSP3PZ.js";import{a as _}from"./chunk-N6Q3L64W.js";import"./chunk-JAMLW534.js";import{d as X}from"./chunk-34UMKY2L.js";import"./chunk-VJSZG35J.js";import{e as S}from"./chunk-JXVUTFQN.js";import"./chunk-OW4KAIWF.js";import{g as U}from"./chunk-DJA5MCJA.js";import{a as T}from"./chunk-MHANZINI.js";import{o as V}from"./chunk-4WLDX7WZ.js";import"./chunk-WOR3JCLX.js";import{a as W}from"./chunk-7FC7HF76.js";import"./chunk-4JQZUQY7.js";import{a as M}from"./chunk-SGUTNJUO.js";import"./chunk-YBS2IB7Z.js";import{l as O}from"./chunk-V3QVAXH3.js";import{g as N}from"./chunk-3TIO3EMN.js";import"./chunk-WHAKQCNV.js";import"./chunk-27SCVCQY.js";import{a as P}from"./chunk-3UZHKW6I.js";import"./chunk-PPNWGWN3.js";import{n as R}from"./chunk-H7LHGT44.js";import{a as Q}from"./chunk-YLLCCUC7.js";import"./chunk-OA7C34MJ.js";import{m as H}from"./chunk-RA2XCS3M.js";import{b as F,c as G}from"./chunk-3OQM7SLQ.js";import{a as A}from"./chunk-T7Q6DQRD.js";import{c as J}from"./chunk-4BPRLR6C.js";import{a as I}from"./chunk-C7UXUTUF.js";import"./chunk-2C5WLKEZ.js";import"./chunk-HAGKI7NA.js";import{c as K}from"./chunk-ZE2GWHPY.js";import"./chunk-V32EP3S7.js";import"./chunk-YL62I5SI.js";import{a as L}from"./chunk-GLKN32J3.js";import{a as B,b as C,c as D,d as E}from"./chunk-IX5HIHVI.js";import"./chunk-UICSVJ3B.js";import{a as v}from"./chunk-EUSMN3K7.js";import"./chunk-FGORMEAO.js";import{a as y}from"./chunk-6SVNBGZ6.js";import{a as w}from"./chunk-2N2AQNJH.js";import{d as z}from"./chunk-5JS7ADWX.js";import"./chunk-O2RISF37.js";import{f as k}from"./chunk-4D5LR4H6.js";import{a as j}from"./chunk-HNO4X33C.js";import"./chunk-CSUEZWN5.js";import{a as l}from"./chunk-Y7LT3F6R.js";import{a as n}from"./chunk-OB3MHLQL.js";import"./chunk-47CEZJM2.js";import{a as s}from"./chunk-S3GZZXQ7.js";import{a as q}from"./chunk-HIBX2EXV.js";import"./chunk-BPVVFHYD.js";import"./chunk-JTN3KTAS.js";import{a as u}from"./chunk-LJXP6K5Y.js";import"./chunk-OJSDBLP7.js";import{a as c}from"./chunk-ERNM3KVF.js";import{f as d}from"./chunk-6JP5PIOO.js";import"./chunk-2T74JEVN.js";import{h as i}from"./chunk-3Q3EOUGJ.js";import"./chunk-MJJ7XDIP.js";import{a as g}from"./chunk-HFVD7W6R.js";import"./chunk-IV4YJRVR.js";import{a as h}from"./chunk-KJTEZVOF.js";import"./chunk-3HGHPAH4.js";import"./chunk-G2CKYO2I.js";import"./chunk-AXUDFYLY.js";import"./chunk-KNQBAOMV.js";import"./chunk-FD2TR343.js";import"./chunk-ZWZGUBL4.js";import"./chunk-WYADYDPN.js";import"./chunk-ZE2KAVXW.js";import"./chunk-XKBLNVOD.js";import"./chunk-GCUGJXI2.js";import"./chunk-SQ4BU4GH.js";import{a as t,b as x,c as a}from"./chunk-FISGGGPC.js";import"./chunk-WAURCNAS.js";import"./chunk-F22ZRNWL.js";import"./chunk-7YIQV7VO.js";import"./chunk-SQZ5O7QS.js";import{a as b}from"./chunk-GONBMSRL.js";import"./chunk-5GXFBLBJ.js";import"./chunk-UBOOUDS4.js";import"./chunk-XPRPYCII.js";import"./chunk-5BWLY27A.js";import"./chunk-PS6NEG5A.js";import"./chunk-ZQVYY7UT.js";import"./chunk-62CJL5G7.js";import"./chunk-3J6AUDID.js";import"./chunk-HCNO7PX6.js";import"./chunk-GMHA5CFH.js";import"./chunk-A2XVR7GL.js";import"./chunk-BZZXXZ3O.js";import"./chunk-2LYX5S7H.js";import"./chunk-HWQ3NTJP.js";import"./chunk-BKES3M4Y.js";import{a as f}from"./chunk-PAEHH3WS.js";import"./chunk-3KB2XWBE.js";import{a as m}from"./chunk-AGAQC4HH.js";import"./chunk-5T6K7VPP.js";import{a as e}from"./chunk-PXUQEA77.js";import"./chunk-SMGDH54W.js";import"./chunk-SNR5VFWG.js";import{b as o,c as r}from"./chunk-FWB47YCH.js";import"./chunk-K53W3ELO.js";import"./chunk-TTFUM47A.js";import"./chunk-VX44UTQ5.js";import"./chunk-ERGJN7FJ.js";import"./chunk-5TXQLK4G.js";import"./chunk-E7LJHM3S.js";import"./chunk-KRJTW535.js";import"./chunk-RON6FXLO.js";import"./chunk-DVSXWSAT.js";import"./chunk-UK3BFTI2.js";import{a as p}from"./chunk-IPHKKZYE.js";import"./chunk-XILM2OMC.js";import"./chunk-3XSB7YIM.js";import"./chunk-YA5DF67M.js";import"./chunk-6FLLFCBU.js";import"./chunk-AX5S56DS.js";import"./chunk-GSTOGDAJ.js";import"./chunk-E23RKOQJ.js";import"./chunk-JUY7CBSL.js";import"./chunk-WRWNN2NW.js";import"./chunk-QM3RCK5P.js";import"./chunk-RZCX6IBE.js";import"./chunk-NZJGC6ZW.js";import"./chunk-WDNTAQ6G.js";import"./chunk-AVFGMLL4.js";import"./chunk-YIK4ACXS.js";import"./chunk-WTXQB2EV.js";import"./chunk-Z4DTHR2S.js";import"./chunk-JSW6J6RS.js";import"./chunk-OS3FCYZY.js";export{Lo as APPEARANCE_STORAGE_KEY,c as AccessibleIcon,d as Accordion,i as AlertDialog,k as AppBar,l as AspectRatio,n as Avatar,s as Badge,u as Blockquote,v as Box,y as Button,z as Callout,j as Card,H as Chatbar,L as Checkbox,J as CheckboxCards,K as CheckboxGroup,D as ChevronDownIcon,M as Code,O as Combobox,G as Confirmation,P as Container,R as ContextMenu,S as DataList,U as Dialog,V as DropdownMenu,W as Em,e as Flex,I as Grid,g as Heading,X as HoverCard,A as IconButton,Z as Image,_ as Inset,p as Kbd,$ as Link,Ko as MessageScroller,oo as Navbar,F as Notice,N as Popover,ro as Portal,eo as Progress,fo as Quote,to as Radio,mo as RadioCards,po as RadioGroup,xo as Reset,b as ScrollArea,bo as Section,ao as SegmentedControl,co as Select,go as Separator,Jo as Sheet,Io as Shell,Ho as Sidebar,Y as Skeleton,ho as Slider,o as Slot,r as Slottable,f as Spinner,io as Strong,jo as Switch,ko as TabNav,lo as Table,no as Tabs,h as Text,qo as TextArea,so as TextField,a as Theme,t as ThemeContext,uo as ThemePanel,vo as ThemePanelContent,C as ThickCheckIcon,E as ThickChevronRightIcon,B as ThickDividerHorizontalIcon,zo as ToggleButton,Ao as ToggleIconButton,Fo as Toolbar,Co as ToolbarButton,Bo as ToolbarGroup,Do as ToolbarSeparator,Eo as ToolbarTitle,q as Tooltip,Go as UserCard,Q as VirtualMenu,m as VisuallyHidden,Mo as appearanceScript,No as setAppearance,Oo as useAppearance,T as useBodyPointerEventsCleanup,wo as useLiveAnnouncer,x as useThemeContext,yo as useToggleState,w as useTooltipWrapper};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@ type ButtonElement = React.ElementRef<typeof BaseButton>;
|
|
|
47
47
|
* Tooltip configuration props that can be passed to Button
|
|
48
48
|
* These props are forwarded to the underlying Tooltip component
|
|
49
49
|
*/
|
|
50
|
-
interface ButtonTooltipProps {
|
|
50
|
+
export interface ButtonTooltipProps {
|
|
51
51
|
/** Content to display in the tooltip on hover/focus */
|
|
52
52
|
tooltip?: React.ReactNode;
|
|
53
53
|
/** Side of the button where the tooltip should appear */
|
|
@@ -64,7 +64,28 @@ interface ButtonTooltipProps {
|
|
|
64
64
|
* Core Button props excluding the 'as' prop for polymorphic behavior
|
|
65
65
|
* Combines BaseButton props with tooltip functionality
|
|
66
66
|
*/
|
|
67
|
-
type
|
|
67
|
+
type ButtonEmphasis = 'loud' | 'medium' | 'quiet';
|
|
68
|
+
|
|
69
|
+
/** `emphasis` is a button's rank: loud is `solid`, medium is `raised`, quiet is `ghost`. */
|
|
70
|
+
const EMPHASIS_VARIANT = { loud: 'solid', medium: 'raised', quiet: 'ghost' } as const;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A button states its rank with `emphasis` or its look with `variant`, never both.
|
|
74
|
+
*/
|
|
75
|
+
type ButtonRankProps =
|
|
76
|
+
| {
|
|
77
|
+
/** The button's look. `outline` and `surface` have no emphasis of their own. */
|
|
78
|
+
variant?: BaseButtonProps['variant'];
|
|
79
|
+
emphasis?: never;
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
/** The button's rank: `loud` (solid), `medium` (raised, the default) or `quiet` (ghost). */
|
|
83
|
+
emphasis?: ButtonEmphasis;
|
|
84
|
+
variant?: never;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type ButtonOwnProps = Omit<BaseButtonProps, 'as' | 'variant'> &
|
|
88
|
+
ButtonRankProps &
|
|
68
89
|
ButtonTooltipProps & {
|
|
69
90
|
/**
|
|
70
91
|
* When using variant="override", provide token-based styles per state.
|
|
@@ -132,7 +153,20 @@ function validateIconButtonName(props: Record<string, unknown>) {
|
|
|
132
153
|
*/
|
|
133
154
|
const Button = React.forwardRef(
|
|
134
155
|
(
|
|
135
|
-
{
|
|
156
|
+
{
|
|
157
|
+
className,
|
|
158
|
+
style,
|
|
159
|
+
tooltip,
|
|
160
|
+
tooltipSide = 'top',
|
|
161
|
+
tooltipAlign = 'center',
|
|
162
|
+
tooltipDelayDuration,
|
|
163
|
+
tooltipDisableHoverableContent,
|
|
164
|
+
overrideStyles,
|
|
165
|
+
iconOnly = false,
|
|
166
|
+
emphasis,
|
|
167
|
+
variant,
|
|
168
|
+
...props
|
|
169
|
+
}: ButtonProps,
|
|
136
170
|
forwardedRef: React.ForwardedRef<ButtonElement>,
|
|
137
171
|
) => {
|
|
138
172
|
// Use shared tooltip wrapper hook for accessibility props
|
|
@@ -183,9 +217,15 @@ const Button = React.forwardRef(
|
|
|
183
217
|
}
|
|
184
218
|
}
|
|
185
219
|
|
|
220
|
+
if (emphasis !== undefined && variant !== undefined) {
|
|
221
|
+
throw new Error('Button: pass `emphasis` or `variant`, not both. They set the same thing.');
|
|
222
|
+
}
|
|
223
|
+
const resolvedVariant = emphasis !== undefined ? EMPHASIS_VARIANT[emphasis] : variant;
|
|
224
|
+
|
|
186
225
|
const button = (
|
|
187
226
|
<BaseButton
|
|
188
227
|
{...props}
|
|
228
|
+
variant={resolvedVariant}
|
|
189
229
|
{...tooltipAccessibilityProps}
|
|
190
230
|
ref={forwardedRef}
|
|
191
231
|
className={classNames(iconOnly ? 'rt-IconButton' : 'rt-Button', className)}
|
|
@@ -211,4 +251,4 @@ const Button = React.forwardRef(
|
|
|
211
251
|
Button.displayName = 'Button';
|
|
212
252
|
|
|
213
253
|
export { Button };
|
|
214
|
-
export type { ButtonProps, ButtonOverrideStyles, ButtonOverrideStateStyles };
|
|
254
|
+
export type { ButtonProps, ButtonEmphasis, ButtonRankProps, ButtonOverrideStyles, ButtonOverrideStateStyles };
|
|
@@ -17,6 +17,7 @@ import { VisuallyHidden } from './visually-hidden.js';
|
|
|
17
17
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
18
18
|
import type { accentColors } from '../props/color.prop.js';
|
|
19
19
|
import type { radii } from '../props/radius.prop.js';
|
|
20
|
+
import type { ButtonRankProps } from './button.js';
|
|
20
21
|
|
|
21
22
|
// Avoid SSR warnings by using an isomorphic layout effect
|
|
22
23
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
@@ -1294,7 +1295,8 @@ RowEnd.displayName = 'Chatbar.RowEnd';
|
|
|
1294
1295
|
|
|
1295
1296
|
type SendStatus = 'ready' | 'submitted' | 'streaming' | 'error';
|
|
1296
1297
|
|
|
1297
|
-
type SendProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby'> &
|
|
1298
|
+
type SendProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby' | 'variant' | 'emphasis'> &
|
|
1299
|
+
ButtonRankProps & {
|
|
1298
1300
|
/** Optional override for accessible name. Defaults to "Send". */
|
|
1299
1301
|
'aria-label'?: string;
|
|
1300
1302
|
'aria-labelledby'?: string;
|
|
@@ -1332,6 +1334,7 @@ const Send = React.forwardRef<HTMLButtonElement, SendProps>((props, forwardedRef
|
|
|
1332
1334
|
className,
|
|
1333
1335
|
size: sizeProp,
|
|
1334
1336
|
variant: variantProp,
|
|
1337
|
+
emphasis,
|
|
1335
1338
|
tabIndex,
|
|
1336
1339
|
onClick,
|
|
1337
1340
|
status = 'ready',
|
|
@@ -1405,7 +1408,7 @@ const Send = React.forwardRef<HTMLButtonElement, SendProps>((props, forwardedRef
|
|
|
1405
1408
|
{...buttonProps}
|
|
1406
1409
|
ref={forwardedRef}
|
|
1407
1410
|
size={sizeProp ?? ctx.size}
|
|
1408
|
-
variant
|
|
1411
|
+
{...(emphasis ? { emphasis } : { variant: variantProp ?? (ctx.open || mode !== 'send' ? 'solid' : 'ghost') })}
|
|
1409
1412
|
disabled={inactive}
|
|
1410
1413
|
className={classNames('rt-ChatbarSend', className)}
|
|
1411
1414
|
style={{ opacity: visible ? 1 : 0, pointerEvents: visible ? undefined : 'none', ...style }}
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { BaseButton } from './_internal/base-button.js';
|
|
4
4
|
import { Button } from './button.js';
|
|
5
5
|
import type { BaseButtonProps } from './_internal/base-button.js';
|
|
6
|
+
import type { ButtonRankProps } from './button.js';
|
|
6
7
|
|
|
7
8
|
type IconButtonElement = React.ElementRef<typeof BaseButton>;
|
|
8
9
|
|
|
@@ -41,7 +42,7 @@ interface IconButtonTooltipProps {
|
|
|
41
42
|
* Core IconButton props excluding the 'as' prop for polymorphic behavior
|
|
42
43
|
* Combines BaseButton props with accessibility requirements and tooltip functionality
|
|
43
44
|
*/
|
|
44
|
-
type IconButtonOwnProps = Omit<BaseButtonProps, 'as'> & AccessibilityProps & IconButtonTooltipProps;
|
|
45
|
+
type IconButtonOwnProps = Omit<BaseButtonProps, 'as' | 'variant'> & ButtonRankProps & AccessibilityProps & IconButtonTooltipProps;
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* Polymorphic IconButton props that support rendering as different HTML elements
|
|
@@ -44,6 +44,7 @@ import { useComposedRefs } from 'radix-ui/internal';
|
|
|
44
44
|
|
|
45
45
|
import { IconButton, type IconButtonProps } from './icon-button.js';
|
|
46
46
|
import { useScrollEdges } from '../hooks/use-scroll-edges.js';
|
|
47
|
+
import type { ButtonRankProps } from './button.js';
|
|
47
48
|
|
|
48
49
|
interface RootProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
49
50
|
/**
|
|
@@ -128,7 +129,8 @@ const Item = React.forwardRef<HTMLDivElement, ItemProps>(({ className, ...props
|
|
|
128
129
|
));
|
|
129
130
|
Item.displayName = 'MessageScroller.Item';
|
|
130
131
|
|
|
131
|
-
type ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby'> &
|
|
132
|
+
type ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby' | 'variant' | 'emphasis'> &
|
|
133
|
+
ButtonRankProps & {
|
|
132
134
|
/** Accessible name, in your words. Default "Jump to the latest". */
|
|
133
135
|
'aria-label'?: string;
|
|
134
136
|
/** `end` jumps to the latest message (default); `start` to the first. */
|
|
@@ -142,7 +144,7 @@ type ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby'> & {
|
|
|
142
144
|
* Place it inside `Root`, after the viewport. It sits over the viewport's bottom edge.
|
|
143
145
|
*/
|
|
144
146
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
145
|
-
({ direction = 'end', behavior, className, children, size = '2', variant = 'surface', color = 'gray', radius = 'full', 'aria-label': label, ...props }, forwardedRef) => (
|
|
147
|
+
({ direction = 'end', behavior, className, children, size = '2', variant = 'surface', emphasis, color = 'gray', radius = 'full', 'aria-label': label, ...props }, forwardedRef) => (
|
|
146
148
|
<Primitive.Button
|
|
147
149
|
direction={direction}
|
|
148
150
|
{...(behavior ? { behavior } : {})}
|
|
@@ -151,7 +153,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
151
153
|
{...props}
|
|
152
154
|
ref={forwardedRef}
|
|
153
155
|
size={size}
|
|
154
|
-
|
|
156
|
+
{...(emphasis ? { emphasis } : { variant })}
|
|
155
157
|
color={color}
|
|
156
158
|
radius={radius}
|
|
157
159
|
aria-label={label ?? (direction === 'end' ? 'Jump to the latest' : 'Jump to the first')}
|
|
@@ -1466,3 +1466,19 @@
|
|
|
1466
1466
|
width: var(--content-icon-size-3);
|
|
1467
1467
|
height: var(--content-icon-size-3);
|
|
1468
1468
|
}
|
|
1469
|
+
|
|
1470
|
+
/* In a Rail the fill is the icon tile, not the row. Under more contrast the tile goes solid and its icon
|
|
1471
|
+
takes the solid ink, so the icon never sits in solid ink on a pale tile. */
|
|
1472
|
+
@media (prefers-contrast: more) {
|
|
1473
|
+
:where(.rt-ShellRailContent :is(.rt-SidebarMenuButton[data-active], .rt-SidebarMenuButton[data-highlighted]:not([data-disabled]))) .rt-SidebarMenuIconWrapper {
|
|
1474
|
+
background-color: var(--accent-solid);
|
|
1475
|
+
color: var(--accent-solid-contrast);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
@media (prefers-contrast: more) and (hover: hover) {
|
|
1480
|
+
:where(.rt-ShellRailContent .rt-SidebarMenuButton:hover:not([data-disabled])) .rt-SidebarMenuIconWrapper {
|
|
1481
|
+
background-color: var(--accent-solid);
|
|
1482
|
+
color: var(--accent-solid-contrast);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Toggle } from 'radix-ui';
|
|
3
3
|
import { Button } from './button.js';
|
|
4
4
|
import { useToggleState } from '../hooks/use-toggle-state.js';
|
|
5
|
+
import type { ButtonProps, ButtonRankProps } from './button.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* ToggleButton props that extend Button with toggle-specific functionality
|
|
@@ -9,14 +10,15 @@ import { useToggleState } from '../hooks/use-toggle-state.js';
|
|
|
9
10
|
* The ToggleButton component provides a button that can be pressed/unpressed
|
|
10
11
|
* with proper accessibility announcements and state management.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
type ToggleButtonProps = Omit<ButtonProps<'button'>, 'as' | 'variant' | 'emphasis'> &
|
|
14
|
+
ButtonRankProps & {
|
|
13
15
|
/** Controlled pressed state */
|
|
14
16
|
pressed?: boolean;
|
|
15
17
|
/** Callback when pressed state changes */
|
|
16
18
|
onPressedChange?: (pressed: boolean) => void;
|
|
17
19
|
/** Default pressed state for uncontrolled usage */
|
|
18
20
|
defaultPressed?: boolean;
|
|
19
|
-
}
|
|
21
|
+
};
|
|
20
22
|
|
|
21
23
|
type ToggleButtonElement = React.ElementRef<typeof Button>;
|
|
22
24
|
|
|
@@ -3,6 +3,7 @@ import { Toggle } from 'radix-ui';
|
|
|
3
3
|
import { ToggleButton } from './toggle-button.js';
|
|
4
4
|
import { BaseButton } from './_internal/base-button.js';
|
|
5
5
|
import type { IconButtonProps } from './icon-button.js';
|
|
6
|
+
import type { ButtonRankProps } from './button.js';
|
|
6
7
|
|
|
7
8
|
type ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;
|
|
8
9
|
|
|
@@ -30,14 +31,15 @@ type AccessibilityProps =
|
|
|
30
31
|
* Combine IconButton props with Toggle-specific props
|
|
31
32
|
* Includes tooltip props from IconButton for comprehensive functionality
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
type ToggleIconButtonProps = Omit<IconButtonProps, 'as' | 'variant' | 'emphasis'> &
|
|
35
|
+
ButtonRankProps & {
|
|
34
36
|
/** Controlled pressed state */
|
|
35
37
|
pressed?: ToggleProps['pressed'];
|
|
36
38
|
/** Callback when pressed state changes */
|
|
37
39
|
onPressedChange?: ToggleProps['onPressedChange'];
|
|
38
40
|
/** Default pressed state for uncontrolled usage */
|
|
39
41
|
defaultPressed?: ToggleProps['defaultPressed'];
|
|
40
|
-
}
|
|
42
|
+
};
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Intersection with accessibility props to ensure compliance
|
|
@@ -16,6 +16,7 @@ import type { TextProps } from './text.js';
|
|
|
16
16
|
import type { MarginProps } from '../props/margin.props.js';
|
|
17
17
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
18
18
|
import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
19
|
+
import type { ButtonRankProps } from './button.js';
|
|
19
20
|
|
|
20
21
|
/*
|
|
21
22
|
* Toolbar takes Kookie UI v2's contract (v2: components/toolbar), built on Radix instead of
|
|
@@ -143,15 +144,17 @@ ToolbarGroup.displayName = 'Toolbar.Group';
|
|
|
143
144
|
// ToolbarButton
|
|
144
145
|
// ============================================================================
|
|
145
146
|
|
|
146
|
-
type ToolbarButtonBaseProps = Omit<ButtonProps, 'as' | 'asChild'>;
|
|
147
|
+
type ToolbarButtonBaseProps = Omit<ButtonProps, 'as' | 'asChild' | 'variant' | 'emphasis'>;
|
|
147
148
|
|
|
148
149
|
/** A labelled button: takes every `Button` prop. */
|
|
149
|
-
type ToolbarTextButtonProps = ToolbarButtonBaseProps &
|
|
150
|
+
type ToolbarTextButtonProps = ToolbarButtonBaseProps &
|
|
151
|
+
ButtonRankProps & {
|
|
150
152
|
iconOnly?: false;
|
|
151
153
|
};
|
|
152
154
|
|
|
153
155
|
/** An icon-only button: renders an `IconButton`, and the type requires an `aria-label`. */
|
|
154
|
-
type ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-labelledby' | 'overrideStyles'> &
|
|
156
|
+
type ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-labelledby' | 'overrideStyles'> &
|
|
157
|
+
ButtonRankProps & {
|
|
155
158
|
iconOnly: true;
|
|
156
159
|
/** The control's accessible name. An icon has no words of its own, so this is required. */
|
|
157
160
|
'aria-label': string;
|
|
@@ -176,7 +179,7 @@ function isPressed(value: React.AriaAttributes['aria-pressed']) {
|
|
|
176
179
|
const ToolbarButton = React.forwardRef<HTMLButtonElement, ToolbarButtonProps>((props, forwardedRef) => {
|
|
177
180
|
const toolbar = useToolbarContext('ToolbarButton');
|
|
178
181
|
const group = React.useContext(ToolbarGroupContext);
|
|
179
|
-
const { iconOnly, size, variant, color, disabled, ...rest } = props;
|
|
182
|
+
const { iconOnly, size, variant, emphasis, color, disabled, ...rest } = props;
|
|
180
183
|
|
|
181
184
|
const pressed = isPressed(props['aria-pressed']);
|
|
182
185
|
const stateProps =
|
|
@@ -184,19 +187,20 @@ const ToolbarButton = React.forwardRef<HTMLButtonElement, ToolbarButtonProps>((p
|
|
|
184
187
|
|
|
185
188
|
const shared = {
|
|
186
189
|
size: size ?? toolbar.size,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
//
|
|
190
|
-
|
|
190
|
+
// A caller states the look by `variant` or the rank by `emphasis`, never both.
|
|
191
|
+
...(emphasis !== undefined ? { emphasis } : { variant: variant ?? (group ? 'ghost' : 'soft') }),
|
|
192
|
+
// The gray rest is a pair with the default variant: a caller who states a variant or an
|
|
193
|
+
// emphasis gets Button's own colour for it unless they state a colour too.
|
|
194
|
+
color: color ?? (variant || emphasis ? undefined : 'gray'),
|
|
191
195
|
...stateProps,
|
|
192
196
|
} as const;
|
|
193
197
|
|
|
194
198
|
return (
|
|
195
199
|
<ToolbarPrimitive.Button asChild ref={forwardedRef} disabled={disabled || group?.disabled || undefined}>
|
|
196
200
|
{iconOnly ? (
|
|
197
|
-
<IconButton {...(rest as Omit<ToolbarIconButtonProps, 'iconOnly'>)} {...shared} />
|
|
201
|
+
<IconButton {...(rest as Omit<ToolbarIconButtonProps, 'iconOnly' | 'variant' | 'emphasis'>)} {...shared} />
|
|
198
202
|
) : (
|
|
199
|
-
<Button {...(rest as Omit<ToolbarTextButtonProps, 'iconOnly'>)} {...shared} />
|
|
203
|
+
<Button {...(rest as Omit<ToolbarTextButtonProps, 'iconOnly' | 'variant' | 'emphasis'>)} {...shared} />
|
|
200
204
|
)}
|
|
201
205
|
</ToolbarPrimitive.Button>
|
|
202
206
|
);
|
package/styles.css
CHANGED
|
@@ -23894,6 +23894,18 @@
|
|
|
23894
23894
|
width: var(--content-icon-size-3);
|
|
23895
23895
|
height: var(--content-icon-size-3);
|
|
23896
23896
|
}
|
|
23897
|
+
@media (prefers-contrast: more) {
|
|
23898
|
+
:where(.rt-ShellRailContent :is(.rt-SidebarMenuButton[data-active], .rt-SidebarMenuButton[data-highlighted]:not([data-disabled]))) .rt-SidebarMenuIconWrapper {
|
|
23899
|
+
background-color: var(--accent-solid);
|
|
23900
|
+
color: var(--accent-solid-contrast);
|
|
23901
|
+
}
|
|
23902
|
+
}
|
|
23903
|
+
@media (prefers-contrast: more) and (hover: hover) {
|
|
23904
|
+
:where(.rt-ShellRailContent .rt-SidebarMenuButton:hover:not([data-disabled])) .rt-SidebarMenuIconWrapper {
|
|
23905
|
+
background-color: var(--accent-solid);
|
|
23906
|
+
color: var(--accent-solid-contrast);
|
|
23907
|
+
}
|
|
23908
|
+
}
|
|
23897
23909
|
.rt-ShellRoot {
|
|
23898
23910
|
--shell-inset-gap: var(--space-2);
|
|
23899
23911
|
--shell-rail-offset: 0px;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as B}from"./chunk-2N2AQNJH.js";import{a as m}from"./chunk-HIBX2EXV.js";import{a as f}from"./chunk-BKES3M4Y.js";import*as r from"react";import C from"classnames";function E(a){if(a["aria-label"]||a["aria-labelledby"]||a.children)return;console.error(`IconButton: Icon buttons must have an accessible name. Please provide either:
|
|
2
|
-
- aria-label prop with descriptive text
|
|
3
|
-
- aria-labelledby prop referencing a label element
|
|
4
|
-
- or visible text children`)}var k=r.forwardRef(({className:a,style:s,tooltip:c,tooltipSide:v="top",tooltipAlign:g="center",tooltipDelayDuration:y,tooltipDisableHoverableContent:O,overrideStyles:e,iconOnly:d=!1,...u},R)=>{let{tooltipId:S,hasTooltip:h,accessibilityProps:P}=B(c),l=r.useMemo(()=>{if(!e)return;let b={},o=(n,t)=>{t!==void 0&&(b[n]=t)},i=(n,t)=>{t&&(o(`--button-override-${n}color`,t.color),o(`--button-override-${n}background`,t.background),o(`--button-override-${n}background-color`,t.backgroundColor),o(`--button-override-${n}box-shadow`,t.boxShadow),o(`--button-override-${n}filter`,t.filter),o(`--button-override-${n}outline`,t.outline),o(`--button-override-${n}outline-offset`,t.outlineOffset),o(`--button-override-${n}opacity`,t.opacity))};return i("",e.normal),i("hover-",e.hover),i("active-",e.active),i("pressed-",e.pressed),i("open-",e.open),i("disabled-",e.disabled),e.focus&&(o("--button-override-focus-outline",e.focus.outline),o("--button-override-focus-outline-offset",e.focus.outlineOffset)),b},[e]),w=r.useMemo(()=>l?{...l,...s}:s,[l,s]);d&&(E(u),u.fullWidth&&void 0);let p=r.createElement(f,{...u,...P,ref:R,className:C(d?"rt-IconButton":"rt-Button",a),style:w});return h?r.createElement(m,{content:c,side:v,align:g,delayDuration:y,disableHoverableContent:O,id:S},p):p});k.displayName="Button";export{k as a};
|
|
5
|
-
//# sourceMappingURL=chunk-3DEZMXFF.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/button.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { BaseButton } from './_internal/base-button.js';\nimport { Tooltip } from './tooltip.js';\nimport { useTooltipWrapper } from '../hooks/use-tooltip-wrapper.js';\nimport { warnDeprecated } from '../helpers/warn-deprecated.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\n\n/**\n * Styles that can be overridden for a particular interaction state\n */\ninterface ButtonOverrideStateStyles {\n color?: string;\n background?: string;\n backgroundColor?: string;\n boxShadow?: string;\n filter?: string;\n outline?: string;\n outlineOffset?: string;\n opacity?: string | number;\n}\n\n/**\n * Full set of override styles keyed by interaction state\n */\ninterface ButtonOverrideStyles {\n /** Default/idle state styles */\n normal?: ButtonOverrideStateStyles;\n /** Hover state styles */\n hover?: ButtonOverrideStateStyles;\n /** Active (mouse down) state styles */\n active?: ButtonOverrideStateStyles;\n /** Toggle pressed state styles (data-state=\"on\") */\n pressed?: ButtonOverrideStateStyles;\n /** Open state styles (e.g., when used as a trigger) */\n open?: ButtonOverrideStateStyles;\n /** Disabled state styles */\n disabled?: ButtonOverrideStateStyles;\n /** Focus-visible outline styles */\n focus?: Pick<ButtonOverrideStateStyles, 'outline' | 'outlineOffset'>;\n}\n\ntype ButtonElement = React.ElementRef<typeof BaseButton>;\n\n/**\n * Tooltip configuration props that can be passed to Button\n * These props are forwarded to the underlying Tooltip component\n */\ninterface ButtonTooltipProps {\n /** Content to display in the tooltip on hover/focus */\n tooltip?: React.ReactNode;\n /** Side of the button where the tooltip should appear */\n tooltipSide?: 'top' | 'right' | 'bottom' | 'left';\n /** Alignment of the tooltip relative to the button */\n tooltipAlign?: 'start' | 'center' | 'end';\n /** Delay before showing the tooltip (in milliseconds) */\n tooltipDelayDuration?: number;\n /** Whether to disable hoverable content behavior */\n tooltipDisableHoverableContent?: boolean;\n}\n\n/**\n * Core Button props excluding the 'as' prop for polymorphic behavior\n * Combines BaseButton props with tooltip functionality\n */\ntype ButtonOwnProps = Omit<BaseButtonProps, 'as'> &\n ButtonTooltipProps & {\n /**\n * When using variant=\"override\", provide token-based styles per state.\n * We propagate these into CSS variables consumed by the override variant.\n */\n overrideStyles?: ButtonOverrideStyles;\n /**\n * A square button holding only an icon. It needs an accessible name: `aria-label`,\n * `aria-labelledby`, or visible text. `IconButton` is this button with `iconOnly` set.\n */\n iconOnly?: boolean;\n };\n\n/**\n * Polymorphic Button props that support rendering as different HTML elements\n * @template C - The element type to render as (defaults to 'button')\n */\ntype ButtonProps<C extends React.ElementType = 'button'> = ButtonOwnProps & {\n /** Element type to render as (e.g., 'a', 'span', etc.) */\n as?: C;\n} & Omit<React.ComponentPropsWithoutRef<C>, keyof ButtonOwnProps>;\n\n/**\n * Button component type that supports polymorphic rendering\n * @template C - The element type to render as\n */\ntype ButtonComponent = <C extends React.ElementType = 'button'>(props: ButtonProps<C> & { ref?: React.ForwardedRef<ButtonElement> }) => React.ReactElement | null;\n\n/**\n * An icon-only button must have an accessible name. Throws in development, logs otherwise.\n */\nfunction validateIconButtonName(props: Record<string, unknown>) {\n if (props['aria-label'] || props['aria-labelledby'] || props.children) return;\n const errorMessage =\n 'IconButton: Icon buttons must have an accessible name. Please provide either:' +\n '\\n- aria-label prop with descriptive text' +\n '\\n- aria-labelledby prop referencing a label element' +\n '\\n- or visible text children';\n if (process.env.NODE_ENV === 'development') throw new Error(errorMessage);\n console.error(errorMessage);\n}\n\n/**\n * Button component for triggering actions throughout your interface\n *\n * The Button component is the primary interactive element in the Kookie User Interface.\n * It provides six visual variants, four sizes, comprehensive color options, and built-in\n * tooltip support. The component automatically handles icon sizing, supports responsive\n * layouts, and provides accessibility compliance out of the box.\n *\n * @example\n * ```tsx\n * // Basic button\n * <Button>Click me</Button>\n *\n * // Button with variant and size\n * <Button variant=\"solid\" size=\"3\">Primary Action</Button>\n *\n * // Button with tooltip\n * <Button tooltip=\"Save your progress\">Save</Button>\n *\n * // Polymorphic button as link\n * <Button as=\"a\" href=\"/dashboard\">Go to Dashboard</Button>\n * ```\n */\nconst Button = React.forwardRef(\n (\n { className, style, tooltip, tooltipSide = 'top', tooltipAlign = 'center', tooltipDelayDuration, tooltipDisableHoverableContent, overrideStyles, iconOnly = false, ...props }: ButtonProps,\n forwardedRef: React.ForwardedRef<ButtonElement>,\n ) => {\n // Use shared tooltip wrapper hook for accessibility props\n const { tooltipId, hasTooltip, accessibilityProps: tooltipAccessibilityProps } = useTooltipWrapper(tooltip);\n\n // Create the base button element with tooltip accessibility props\n // Map overrideStyles to CSS variables consumed by the override variant rules\n const overrideVars = React.useMemo(() => {\n if (!overrideStyles) return undefined;\n const vars: Record<string, string | number> = {};\n const setVar = (key: string, value: string | number | undefined) => {\n if (value !== undefined) vars[key] = value;\n };\n const apply = (prefix: string, s?: ButtonOverrideStateStyles) => {\n if (!s) return;\n setVar(`--button-override-${prefix}color`, s.color);\n setVar(`--button-override-${prefix}background`, s.background);\n setVar(`--button-override-${prefix}background-color`, s.backgroundColor);\n setVar(`--button-override-${prefix}box-shadow`, s.boxShadow);\n setVar(`--button-override-${prefix}filter`, s.filter);\n setVar(`--button-override-${prefix}outline`, s.outline);\n setVar(`--button-override-${prefix}outline-offset`, s.outlineOffset);\n setVar(`--button-override-${prefix}opacity`, s.opacity);\n };\n\n apply('', overrideStyles.normal);\n apply('hover-', overrideStyles.hover);\n apply('active-', overrideStyles.active);\n apply('pressed-', overrideStyles.pressed);\n apply('open-', overrideStyles.open);\n apply('disabled-', overrideStyles.disabled);\n\n if (overrideStyles.focus) {\n setVar('--button-override-focus-outline', overrideStyles.focus.outline);\n setVar('--button-override-focus-outline-offset', overrideStyles.focus.outlineOffset);\n }\n\n return vars as React.CSSProperties;\n }, [overrideStyles]);\n\n // Combine override styles with user-provided styles\n const combinedStyle = React.useMemo(() => (overrideVars ? { ...overrideVars, ...style } : style), [overrideVars, style]);\n\n if (iconOnly) {\n validateIconButtonName(props);\n if (props.fullWidth) {\n warnDeprecated('`fullWidth` on an icon-only button is deprecated and will be removed in 0.15.0. An icon button is square.');\n }\n }\n\n const button = (\n <BaseButton\n {...props}\n {...tooltipAccessibilityProps}\n ref={forwardedRef}\n className={classNames(iconOnly ? 'rt-IconButton' : 'rt-Button', className)}\n style={combinedStyle}\n />\n );\n\n // If no tooltip is provided, return the button as-is for better performance\n if (!hasTooltip) {\n return button;\n }\n\n // Wrap with Tooltip when tooltip content is provided\n // This creates a compound component that handles both button and tooltip functionality\n return (\n <Tooltip content={tooltip} side={tooltipSide} align={tooltipAlign} delayDuration={tooltipDelayDuration} disableHoverableContent={tooltipDisableHoverableContent} id={tooltipId}>\n {button}\n </Tooltip>\n );\n },\n) as ButtonComponent & { displayName?: string };\n\nButton.displayName = 'Button';\n\nexport { Button };\nexport type { ButtonProps, ButtonOverrideStyles, ButtonOverrideStateStyles };\n"],
|
|
5
|
-
"mappings": "wHAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAiGvB,SAASC,EAAuBC,EAAgC,CAC9D,GAAIA,EAAM,YAAY,GAAKA,EAAM,iBAAiB,GAAKA,EAAM,SAAU,OAOvE,QAAQ,MALN;AAAA;AAAA;AAAA,2BAKwB,CAC5B,CAyBA,IAAMC,EAAe,aACnB,CACE,CAAE,UAAAC,EAAW,MAAAC,EAAO,QAAAC,EAAS,YAAAC,EAAc,MAAO,aAAAC,EAAe,SAAU,qBAAAC,EAAsB,+BAAAC,EAAgC,eAAAC,EAAgB,SAAAC,EAAW,GAAO,GAAGV,CAAM,EAC5KW,IACG,CAEH,GAAM,CAAE,UAAAC,EAAW,WAAAC,EAAY,mBAAoBC,CAA0B,EAAIC,EAAkBX,CAAO,EAIpGY,EAAqB,UAAQ,IAAM,CACvC,GAAI,CAACP,EAAgB,OACrB,IAAMQ,EAAwC,CAAC,EACzCC,EAAS,CAACC,EAAaC,IAAuC,CAC9DA,IAAU,SAAWH,EAAKE,CAAG,EAAIC,EACvC,EACMC,EAAQ,CAACC,EAAgBC,IAAkC,CAC1DA,IACLL,EAAO,qBAAqBI,CAAM,QAASC,EAAE,KAAK,EAClDL,EAAO,qBAAqBI,CAAM,aAAcC,EAAE,UAAU,EAC5DL,EAAO,qBAAqBI,CAAM,mBAAoBC,EAAE,eAAe,EACvEL,EAAO,qBAAqBI,CAAM,aAAcC,EAAE,SAAS,EAC3DL,EAAO,qBAAqBI,CAAM,SAAUC,EAAE,MAAM,EACpDL,EAAO,qBAAqBI,CAAM,UAAWC,EAAE,OAAO,EACtDL,EAAO,qBAAqBI,CAAM,iBAAkBC,EAAE,aAAa,EACnEL,EAAO,qBAAqBI,CAAM,UAAWC,EAAE,OAAO,EACxD,EAEA,OAAAF,EAAM,GAAIZ,EAAe,MAAM,EAC/BY,EAAM,SAAUZ,EAAe,KAAK,EACpCY,EAAM,UAAWZ,EAAe,MAAM,EACtCY,EAAM,WAAYZ,EAAe,OAAO,EACxCY,EAAM,QAASZ,EAAe,IAAI,EAClCY,EAAM,YAAaZ,EAAe,QAAQ,EAEtCA,EAAe,QACjBS,EAAO,kCAAmCT,EAAe,MAAM,OAAO,EACtES,EAAO,yCAA0CT,EAAe,MAAM,aAAa,GAG9EQ,CACT,EAAG,CAACR,CAAc,CAAC,EAGbe,EAAsB,UAAQ,IAAOR,EAAe,CAAE,GAAGA,EAAc,GAAGb,CAAM,EAAIA,EAAQ,CAACa,EAAcb,CAAK,CAAC,EAEnHO,IACFX,EAAuBC,CAAK,EACxBA,EAAM,WACR,QAIJ,IAAMyB,EACJ,gBAACC,EAAA,CACE,GAAG1B,EACH,GAAGc,EACJ,IAAKH,EACL,UAAWgB,EAAWjB,EAAW,gBAAkB,YAAaR,CAAS,EACzE,MAAOsB,EACT,EAIF,OAAKX,EAOH,gBAACe,EAAA,CAAQ,QAASxB,EAAS,KAAMC,EAAa,MAAOC,EAAc,cAAeC,EAAsB,wBAAyBC,EAAgC,GAAII,GAClKa,CACH,EAROA,CAUX,CACF,EAEAxB,EAAO,YAAc",
|
|
6
|
-
"names": ["React", "classNames", "validateIconButtonName", "props", "Button", "className", "style", "tooltip", "tooltipSide", "tooltipAlign", "tooltipDelayDuration", "tooltipDisableHoverableContent", "overrideStyles", "iconOnly", "forwardedRef", "tooltipId", "hasTooltip", "tooltipAccessibilityProps", "useTooltipWrapper", "overrideVars", "vars", "setVar", "key", "value", "apply", "prefix", "s", "combinedStyle", "button", "BaseButton", "classNames", "Tooltip"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as ot}from"./chunk-RAVFUI7W.js";import{a as Ve}from"./chunk-BOFVKXUV.js";import{g as nt,j as rt}from"./chunk-IX5HIHVI.js";import{a as we}from"./chunk-KJTEZVOF.js";import{a as at}from"./chunk-GONBMSRL.js";import{a as Be}from"./chunk-PAEHH3WS.js";import{a as je}from"./chunk-AGAQC4HH.js";import{a as De}from"./chunk-PXUQEA77.js";import{b as U}from"./chunk-FWB47YCH.js";import{a as tt}from"./chunk-AVFGMLL4.js";import{a as zt}from"./chunk-OS3FCYZY.js";var Gt={};zt(Gt,{AttachTrigger:()=>gt,Attachment:()=>Ue,AttachmentsRow:()=>ft,InlineEnd:()=>ht,InlineStart:()=>pt,Item:()=>Ct,Root:()=>ut,Row:()=>vt,RowEnd:()=>xt,RowStart:()=>yt,Send:()=>Pt,Textarea:()=>mt});import*as e from"react";import E from"classnames";import{LazyMotion as Dt,MotionConfig as Bt,domAnimation as jt,m as me}from"motion/react";import{useComposedRefs as ct}from"radix-ui/internal";import{useDropzone as Vt}from"react-dropzone";var We=typeof window<"u"?e.useLayoutEffect:e.useEffect;function st(a,o){let{placeholder:n}=a;if(!n){o();return}a.placeholder="";try{o()}finally{a.placeholder=n}}var pe={layout:{type:"spring",visualDuration:.15,bounce:.1}},lt=e.createContext(null),Ke=e.createContext(""),H=()=>{let a=e.useContext(lt);if(!a)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return a},ue=a=>Array.isArray(a)?a:typeof a=="string"?a.split(",").map(o=>o.trim()).filter(Boolean):[],Wt=(a,o)=>{if(o.length===0)return!0;let n=a.type.toLowerCase(),i=a.name.toLowerCase();for(let c of o){let l=c.toLowerCase();if(l.includes("/")){let[d,u]=l.split("/"),[f,b]=n.split("/");if(d==="*"||d===f&&(u==="*"||u===b))return!0}else if(l.startsWith(".")&&i.endsWith(l))return!0}return!1},$t=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i,dt=(a,o)=>(o||"").toLowerCase().startsWith("image/")||$t.test(a),$e=a=>a.trim().length>0,it=(a,o)=>`${a} ${o}${a===1?"":"s"}`,Kt=0,Ut=()=>`chatbar-attachment-${Date.now()}-${++Kt}`,ut=e.forwardRef((a,o)=>{let{className:n,style:i,children:c,value:l,defaultValue:d="",onValueChange:u,open:f,defaultOpen:b=!1,onOpenChange:C,expandOn:v="both",minLines:m=3,maxLines:N=6,sendMode:I="whenDirty",disabled:R,readOnly:S,onSubmit:j,size:A="2",variant:F,color:L,radius:z,panelBackground:y,material:k,width:V,maxWidth:re,attachments:x,defaultAttachments:D,onAttachmentsChange:_,accept:he,multiple:O=!0,maxAttachments:G,maxFileSize:q,paste:B=!0,pasteAccept:M,clearOnSubmit:Y=!0,onAttachmentReject:Se,dropzone:oe=!0,apiRef:Ee,onBlurCapture:fe,notices:be,context:Re,...Te}=a,t=k||y,g=l!=null,[w,se]=e.useState(d),W=g?l:w,X=f!=null,[Le,ie]=e.useState(b),Q=X?f:Le,Z="attachments"in a,[_e,At]=e.useState(()=>D??[]),ce=e.useMemo(()=>Z?x??[]:_e,[Z,x,_e]),[Ge,wt]=e.useState({text:"",id:0}),le=e.useCallback(r=>wt(s=>({text:r,id:s.id+1})),[]),qe=e.useRef(null),St=ct(o,qe),ke=e.useRef(null),Me=e.useRef(null),de=e.useRef(!1),Ce=e.useRef(!1),ge=e.useRef(void 0),Ne=e.useRef(null),Ye=ue(he).join(","),Oe=ue(M).join(","),He=e.useMemo(()=>ue(Ye),[Ye]),Et=e.useMemo(()=>Oe?ue(Oe):He,[Oe,He]),Xe={value:W,attachments:ce,accepts:He,pasteAccepts:Et,multiple:O,maxAttachments:G,maxFileSize:q,disabled:R,readOnly:S,expandOn:v,isValueControlled:g,isOpenControlled:X,isAttachmentsControlled:Z,onValueChange:u,onOpenChange:C,onAttachmentsChange:_,onAttachmentReject:Se,onSubmit:j},P=e.useRef(Xe);P.current=Xe;let Ie=e.useRef(null),$=e.useCallback(()=>Ie.current??P.current.attachments,[]),ee=e.useCallback(r=>{P.current.isOpenControlled||ie(r),P.current.onOpenChange?.(r)},[]),ve=e.useCallback(r=>{P.current.isValueControlled||se(r),P.current.onValueChange?.(r)},[]),te=e.useCallback(r=>{Ie.current=r,queueMicrotask(()=>{Ie.current=null}),P.current.isAttachmentsControlled||At(r),P.current.onAttachmentsChange?.(r)},[]),ye=e.useRef(new Set),ae=e.useCallback((r,s,p=P.current.multiple)=>{let h=P.current;if(h.disabled||h.readOnly||r.length===0)return 0;let K=$(),J=[],ne=[],It=typeof h.maxAttachments=="number"?Math.max(h.maxAttachments-K.length,0):1/0,Ft=p?1/0:1;for(let T of r){if(J.length>=It||J.length>=Ft){ne.push({file:T,reason:"count"});continue}if(typeof h.maxFileSize=="number"&&T.size>h.maxFileSize){ne.push({file:T,reason:"size"});continue}if(!Wt(T,s)){ne.push({file:T,reason:"type"});continue}let ze=dt(T.name,T.type)?URL.createObjectURL(T):void 0;ze&&ye.current.add(ze),J.push({id:Ut(),name:T.name,size:T.size,type:T.type,file:T,url:ze,status:"idle"})}let Ae=[];return J.length>0&&(te(K.concat(J)),h.expandOn!=="none"&&ee(!0),Ae.push(`${it(J.length,"file")} attached.`)),ne.length>0&&(h.onAttachmentReject?.(ne),Ae.push(`${it(ne.length,"file")} could not be attached.`)),Ae.length>0&&le(Ae.join(" ")),J.length},[$,te,ee,le]),xe=e.useCallback(r=>ae(r,P.current.accepts),[ae]),Je=e.useCallback(r=>ae(r,P.current.pasteAccepts),[ae]),Qe=e.useCallback(r=>{let s=$(),p=s.find(h=>h.id===r);p&&(te(s.filter(h=>h.id!==r)),le(`Removed ${p.name}.`))},[$,te,le]),Ze=e.useCallback(r=>{let s=P.current;if(s.disabled||s.readOnly)return!1;let p=$();if(!$e(s.value)&&p.length===0)return!1;let h={value:s.value,attachments:p};if(r&&s.onSubmit)for(let K of p)K.url&&ye.current.delete(K.url);return s.onSubmit?.(h),r&&(ve(""),te([])),!0},[$,ve,te]);e.useEffect(()=>{let r=ye.current;if(r.size===0)return;let s=new Set(ce.map(p=>p.url));for(let p of Array.from(r))s.has(p)||(URL.revokeObjectURL(p),r.delete(p))},[ce]),e.useEffect(()=>{let r=ye.current;return()=>{if(!P.current.isAttachmentsControlled){for(let s of Array.from(r))URL.revokeObjectURL(s);r.clear()}}},[]);let Pe=e.useCallback(r=>{let s=P.current,p=Me.current;if(clearTimeout(ge.current),Ce.current=!1,!p||s.disabled||s.readOnly)return;let h=r?.accept!=null?ue(r.accept):s.accepts,K=r?.multiple??s.multiple;Ne.current={patterns:h,multiple:K},p.accept=h.join(","),p.multiple=K,de.current=!0,p.click(),setTimeout(()=>{document.hasFocus()&&(de.current=!1)},1e3)},[]),et=e.useCallback(()=>{Ce.current=!0,clearTimeout(ge.current),ge.current=setTimeout(()=>{Ce.current=!1},800)},[]);e.useEffect(()=>()=>clearTimeout(ge.current),[]),e.useEffect(()=>{let r=Me.current,s=()=>{de.current=!1};return window.addEventListener("focus",s),r?.addEventListener("cancel",s),()=>{window.removeEventListener("focus",s),r?.removeEventListener("cancel",s)}},[]);let Tt=e.useCallback(r=>{let s=r.currentTarget,p=Array.from(s.files??[]),h=Ne.current;ae(p,h?.patterns??P.current.accepts,h?.multiple),de.current=!1,Ne.current=null,s.value=""},[ae]),Lt=e.useCallback(r=>{fe?.(r);let s=P.current,p=qe.current;if(!p||s.expandOn==="none")return;let h=r.relatedTarget;h&&p.contains(h)||de.current||Ce.current||!$e(s.value)&&$().length===0&&ee(!1)},[fe,ee,$]),kt=e.useCallback(r=>{xe(r)},[xe]),{getRootProps:Mt,isDragActive:Nt}=Vt({onDrop:kt,onDragEnter:()=>le(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!oe||R||S}),Fe=oe&&Nt;e.useImperativeHandle(Ee,()=>({focusTextarea:()=>ke.current?.focus({preventScroll:!0}),openFilePicker:()=>Pe()}),[Pe]);let Ot=e.useCallback(r=>{if(R||r.pointerType==="mouse"&&r.button!==0)return;let s=r.target;s instanceof Element&&s.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(r.preventDefault(),ke.current?.focus({preventScroll:!0}))},[R]),Ht=e.useMemo(()=>({open:Q,setOpen:ee,setValue:ve,size:A,expandOn:v,minLines:m,maxLines:N,sendMode:I,disabled:R,readOnly:S,paste:B,clearOnSubmit:Y,multiple:O,textareaRef:ke,attachments:ce,removeAttachment:Qe,submit:Ze,appendFiles:xe,appendFilesFromPaste:Je,openFilePicker:Pe,beginFilePickerPress:et}),[Q,ee,ve,A,v,m,N,I,R,S,B,Y,O,ce,Qe,Ze,xe,Je,Pe,et]);return e.createElement(lt.Provider,{value:Ht},e.createElement(Ke.Provider,{value:W},e.createElement(Dt,{features:jt},e.createElement(Bt,{reducedMotion:"user"},e.createElement("div",{...Te,ref:St,className:E("rt-ChatbarRoot",`rt-r-size-${A}`,n),style:{position:"relative",width:V,maxWidth:re,...i},"data-state":Q?"open":"closed","data-disabled":R?"":void 0,"data-readonly":S?"":void 0,"data-drop-active":Fe?"":void 0,"data-accent-color":L,"data-radius":z,"data-panel-background":t,"data-material":t,onBlurCapture:Lt},e.createElement("input",{ref:Me,type:"file",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:Tt}),be?e.createElement("div",{className:"rt-ChatbarNotices"},e.createElement(ot.Provider,{value:A},be)):null,e.createElement("div",{...oe?Mt():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Ot},e.createElement(me.div,{className:E("rt-ChatbarBox",`rt-variant-${tt(F??"raised")}`),style:{position:"relative"},"data-accent-color":L,"data-radius":z,"data-panel-background":t,"data-material":t,layout:!0,transition:pe},e.createElement(me.div,{className:"rt-ChatbarGrid",layout:"position",transition:pe},c),Fe&&e.createElement("div",{className:"rt-ChatbarDropOverlay","aria-hidden":!0},e.createElement("div",{className:"rt-ChatbarDropContent"},e.createElement(we,{emphasis:"medium",size:A,weight:"medium"},"Drop files here to attach"))))),Re?e.createElement(we,{as:"div",size:A==="3"?"2":"1",emphasis:"medium",className:"rt-ChatbarContext"},Re):null,e.createElement(je,{role:"status","aria-live":"polite"},Fe?"Drop files here to attach.":e.createElement("span",{key:Ge.id},Ge.text)))))))});ut.displayName="Chatbar.Root";var mt=e.forwardRef((a,o)=>{let{className:n,style:i,asChild:c,onFocus:l,onChange:d,onPaste:u,onKeyDown:f,onCompositionStart:b,onCompositionEnd:C,submitOnEnter:v=!1,...m}=a,N=H(),I=e.useContext(Ke),{open:R,minLines:S,maxLines:j,expandOn:A,disabled:F,readOnly:L,setOpen:z,setValue:y,textareaRef:k,paste:V,appendFilesFromPaste:re,size:x,submit:D,clearOnSubmit:_}=N,he=ct(o,k),O=e.useRef(0),G=e.useRef(0),q=e.useRef(!1),B=e.useRef({open:R,minLines:S,maxLines:j});We(()=>{B.current={open:R,minLines:S,maxLines:j}},[R,S,j]);let M=e.useCallback(()=>{let t=k.current;if(!t)return;let g=window.getComputedStyle(t);O.current=parseFloat(g.lineHeight)||20,G.current=(parseFloat(g.paddingTop)||0)+(parseFloat(g.paddingBottom)||0)},[k]),Y=e.useCallback((t,g)=>{let{minLines:w,maxLines:se}=B.current,W=O.current,X=G.current,Le=Math.ceil((g?w:1)*W)+X,ie=Math.ceil((g?se:1)*W)+X,Q=Math.max(t.scrollHeight,Le);t.style.height=`${Math.min(Q,ie)}px`;let Z=Q>ie;t.style.overflowY=Z?"auto":"hidden",t.style.maxHeight=Z?`${ie}px`:"none"},[]);We(()=>{M()},[M,x]),We(()=>{let t=k.current;t&&(O.current===0&&M(),st(t,()=>{t.style.height="auto";let g=R;if(!R&&(A==="overflow"||A==="both")){let w=Math.ceil(O.current)+G.current;t.scrollHeight>w+1&&(g=!0,z(!0))}Y(t,g)}))},[I,R,A,S,j,x,z,k,M,Y]),e.useEffect(()=>{let t=k.current;if(!t||typeof ResizeObserver>"u")return;let g=-1,w=new ResizeObserver(se=>{let W=se[0]?.contentRect.width??0;if(W===g)return;let X=g===-1;g=W,!X&&(M(),st(t,()=>{t.style.height="auto",Y(t,B.current.open)}))});return w.observe(t),()=>w.disconnect()},[k,M,Y]),e.useEffect(()=>{},[]);let Se=e.useCallback(t=>{l?.(t),!(F||L)&&(A==="focus"||A==="both")&&!R&&z(!0)},[F,L,A,R,z,l]),oe=e.useCallback(t=>{y(t.currentTarget.value),d?.(t)},[y,d]),Ee=e.useCallback(t=>{if(u?.(t),t.defaultPrevented||!V||F||L)return;let g=Array.from(t.clipboardData?.items??[]).filter(w=>w.kind==="file").map(w=>w.getAsFile()).filter(w=>!!w);g.length!==0&&re(g)>0&&t.preventDefault()},[V,F,L,u,re]),fe=e.useCallback(t=>{q.current=!0,b?.(t)},[b]),be=e.useCallback(t=>{q.current=!1,C?.(t)},[C]),Re=e.useCallback(t=>{f?.(t),!(t.defaultPrevented||!v)&&(t.key!=="Enter"||t.shiftKey||t.altKey||t.ctrlKey||t.metaKey||q.current||t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(t.preventDefault(),D(_)))},[v,f,D,_]),Te=c?U:"textarea";return e.createElement(me.div,{className:E("rt-ChatbarField","rt-ChatbarTextarea",n),layout:"position",transition:pe},e.createElement(Te,{...m,ref:he,className:"rt-ChatbarInput",value:I,onChange:oe,onFocus:Se,onPaste:Ee,onKeyDown:Re,onCompositionStart:fe,onCompositionEnd:be,disabled:F,readOnly:L,rows:R?S:1,spellCheck:m.spellCheck??!0,autoCorrect:m.autoCorrect??"on",style:i}))});mt.displayName="Chatbar.Textarea";var pt=e.forwardRef((a,o)=>{let{children:n,asChild:i,className:c,...l}=a;return H().open?null:e.createElement(i?U:"div",{...l,ref:o,className:E("rt-ChatbarInlineStart",c)},n)});pt.displayName="Chatbar.InlineStart";var ht=e.forwardRef((a,o)=>{let{children:n,asChild:i,className:c,...l}=a;return H().open?null:e.createElement(i?U:"div",{...l,ref:o,className:E("rt-ChatbarInlineEnd",c)},n)});ht.displayName="Chatbar.InlineEnd";var ft=e.forwardRef((a,o)=>{let{asChild:n,forceMount:i,renderAttachment:c,className:l,children:d,...u}=a,f=H(),b=e.Children.toArray(d).length>0;if(f.attachments.length===0&&!b&&!i)return null;let C=n?U:"div";return e.createElement(me.div,{layout:"position",transition:pe},e.createElement(C,{...u,ref:o,className:E("rt-ChatbarAttachmentsRow",l),role:"list","aria-label":u["aria-label"]??"Attachments"},e.createElement(at,{className:"rt-ChatbarScrollArea",scrollbars:"horizontal",size:"1"},e.createElement(De,{align:"center",gap:"2",minWidth:"fit-content"},f.attachments.map(v=>e.createElement(Ue,{key:v.id,attachment:v,asChild:!!c},c?.(v))),d))))});ft.displayName="Chatbar.AttachmentsRow";function bt(a,o){let n=a.closest('[role="listitem"]'),i=n?.parentElement?Array.from(n.parentElement.children):[],c=n?i.indexOf(n):-1,d=(i[c+1]??i[c-1])?.querySelector(".rt-ChatbarItemRemove");d?d.focus():o.current?.focus({preventScroll:!0})}var Rt=({lead:a,leadKind:o,label:n,detail:i,removeLabel:c,onRemove:l})=>{let d=H();return e.createElement(e.Fragment,null,e.createElement("span",{className:"rt-ChatbarItemLead","data-kind":o,"aria-hidden":!0},a),e.createElement(we,{className:"rt-ChatbarItemLabel",size:d.size,truncate:!0},n,i?e.createElement(je,null,", ",i):null),l&&e.createElement(Ve,{className:"rt-ChatbarItemRemove","aria-label":c,size:"1",variant:"ghost",color:"gray",onClick:l},e.createElement(nt,null)))},_t={uploading:"uploading",error:"failed to upload"},Ue=e.forwardRef((a,o)=>{let{attachment:n,asChild:i,className:c,children:l,...d}=a,u=H(),f=i?U:"div",b=!!n.url&&dt(n.name,n.type),C=`${Math.ceil(n.size/1024)} KB`,v=n.status?_t[n.status]:void 0,m=u.disabled||u.readOnly,N=R=>{bt(R.currentTarget,u.textareaRef),u.removeAttachment(n.id)},I=n.status==="uploading"?e.createElement(Be,{size:"1"}):b?e.createElement("img",{className:"rt-ChatbarAttachmentImage",src:n.url,alt:""}):e.createElement(rt,null);return e.createElement(f,{...d,ref:o,className:E(l?"rt-ChatbarAttachment":"rt-ChatbarAttachment rt-ChatbarItem",c),role:"listitem","data-kind":b?"image":"file","data-status":n.status,title:n.name},l??e.createElement(Rt,{lead:I,leadKind:b&&n.status!=="uploading"?"image":"icon",label:n.name,detail:v?`${C}, ${v}`:C,removeLabel:`Remove ${n.name}`,onRemove:m?void 0:N}))});Ue.displayName="Chatbar.Attachment";var Ct=e.forwardRef((a,o)=>{let{children:n,icon:i,image:c,color:l,onRemove:d,removeLabel:u,className:f,...b}=a,C=H(),v=C.disabled||C.readOnly,m=d?N=>{bt(N.currentTarget,C.textareaRef),d()}:void 0;return e.createElement("div",{...b,ref:o,className:E("rt-ChatbarItem",f),role:"listitem","data-accent-color":c?void 0:l??"gray",title:n},e.createElement(Rt,{lead:c?e.createElement("img",{className:"rt-ChatbarAttachmentImage",src:c,alt:""}):i,leadKind:c?"image":"icon",label:n,removeLabel:u??`Remove ${n}`,onRemove:v?void 0:m}))});Ct.displayName="Chatbar.Item";var gt=e.forwardRef((a,o)=>{let{asChild:n,accept:i,multiple:c,disabled:l,onPointerDown:d,onClick:u,...f}=a,b=H(),C=l||b.disabled||b.readOnly;return e.createElement(n?U:"button",{...f,ref:o,className:E("rt-ChatbarAttachTrigger",f.className),type:f.type??"button","aria-label":f["aria-label"]??"Add attachments",disabled:C,onPointerDown:m=>{d?.(m),!C&&!m.defaultPrevented&&b.beginFilePickerPress()},onClick:m=>{u?.(m),!(C||m.defaultPrevented)&&b.openFilePicker({accept:i,multiple:c})}})});gt.displayName="Chatbar.AttachTrigger";var vt=e.forwardRef((a,o)=>{let{asChild:n,children:i,className:c,...l}=a;if(!H().open)return null;let u=n?U:"div";return e.createElement(me.div,{layout:"position",transition:pe},e.createElement(u,{...l,ref:o,className:E("rt-ChatbarRow",c)},e.createElement(De,{align:"center",justify:"between",width:"100%"},i)))});vt.displayName="Chatbar.Row";var yt=e.forwardRef((a,o)=>{let{className:n,...i}=a;return e.createElement("div",{...i,ref:o,className:E("rt-ChatbarRowStart",n)})});yt.displayName="Chatbar.RowStart";var xt=e.forwardRef((a,o)=>{let{className:n,...i}=a;return e.createElement("div",{...i,ref:o,className:E("rt-ChatbarRowEnd",n)})});xt.displayName="Chatbar.RowEnd";var Pt=e.forwardRef((a,o)=>{let{asChild:n,clearOnSend:i,disabled:c,children:l,style:d,className:u,size:f,variant:b,tabIndex:C,onClick:v,status:m="ready",onStop:N,onRetry:I,stopLabel:R="Stop",retryLabel:S="Retry",stopIcon:j,retryIcon:A,"aria-label":F,"aria-labelledby":L,...z}=a,y=H(),k=e.useContext(Ke),V=$e(k)||y.attachments.length>0,x=V?"send":m==="submitted"||m==="streaming"?"stop":m==="error"?"retry":"send";if(y.sendMode==="never"&&x==="send")return null;let D=x!=="send"||y.sendMode==="always"||V,_=x==="send"?c||y.disabled||y.readOnly||!V:c||y.disabled,O=x==="stop"?{"aria-label":R}:x==="retry"?{"aria-label":S}:L?{"aria-labelledby":L}:{"aria-label":F??"Send"},G=B=>{if(v?.(B),B.defaultPrevented||_)return;if(x==="stop"){N?.();return}if(x==="retry"){I?.();return}let M=i??y.clearOnSubmit;y.submit(M)&&M&&y.textareaRef.current?.focus({preventScroll:!0})},q=x==="stop"?j??(m==="submitted"?e.createElement(Be,{size:y.size}):e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0},e.createElement("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"}))):x==="retry"?A??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),e.createElement("path",{d:"M3 3v5h5"})):l??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M5 12h14"}),e.createElement("path",{d:"m12 5 7 7-7 7"}));return e.createElement(Ve,{...z,ref:o,size:f??y.size,variant:b??(y.open||x!=="send"?"solid":"ghost"),disabled:_,className:E("rt-ChatbarSend",u),style:{opacity:D?1:0,pointerEvents:D?void 0:"none",...d},"aria-hidden":D?void 0:!0,tabIndex:D?C:-1,asChild:n,onClick:G,"data-status":m,"data-mode":x,...O},q)});Pt.displayName="Chatbar.Send";export{ut as a,mt as b,pt as c,ht as d,ft as e,Ue as f,Ct as g,gt as h,vt as i,yt as j,xt as k,Pt as l,Gt as m};
|
|
2
|
-
//# sourceMappingURL=chunk-7B6CIVAF.js.map
|