@womp/kookie-ui 0.14.3 → 0.14.5
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/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +2 -2
- package/dist/cjs/components/_internal/base-button.props.d.ts +1 -1
- package/dist/cjs/components/_internal/base-button.props.js +1 -1
- package/dist/cjs/components/_internal/base-button.props.js.map +2 -2
- package/dist/cjs/components/button.d.ts +2 -2
- package/dist/cjs/components/button.d.ts.map +1 -1
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/components/button.props.js +1 -1
- package/dist/cjs/components/button.props.js.map +2 -2
- 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 +2 -2
- package/dist/cjs/components/icon-button.props.js +1 -1
- package/dist/cjs/components/icon-button.props.js.map +2 -2
- 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 +2 -2
- package/dist/cjs/components/schemas/base-button.schema.js +1 -1
- package/dist/cjs/components/schemas/base-button.schema.js.map +2 -2
- package/dist/cjs/components/schemas/button.schema.js +1 -1
- package/dist/cjs/components/schemas/button.schema.js.map +2 -2
- package/dist/cjs/components/schemas/icon-button.schema.js +1 -1
- package/dist/cjs/components/schemas/icon-button.schema.js.map +2 -2
- package/dist/cjs/components/schemas/index.js +1 -1
- package/dist/cjs/components/schemas/index.js.map +2 -2
- package/dist/cjs/components/schemas/toggle-button.schema.js +1 -1
- package/dist/cjs/components/schemas/toggle-button.schema.js.map +2 -2
- package/dist/cjs/components/schemas/toggle-icon-button.schema.js +1 -1
- package/dist/cjs/components/schemas/toggle-icon-button.schema.js.map +2 -2
- package/dist/cjs/components/theme-panel.js +1 -1
- package/dist/cjs/components/theme-panel.js.map +2 -2
- package/dist/cjs/components/toggle-button.d.ts +3 -37
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +2 -2
- package/dist/esm/chunk-5NARBZRI.js +2 -0
- package/dist/esm/chunk-5NARBZRI.js.map +7 -0
- package/dist/esm/{chunk-YEYM7QQZ.js → chunk-ADFUYK3U.js} +2 -2
- package/dist/esm/chunk-ADFUYK3U.js.map +7 -0
- package/dist/esm/chunk-ALG6R3ZX.js +2 -0
- package/dist/esm/chunk-ALG6R3ZX.js.map +7 -0
- package/dist/esm/chunk-ARDKQL7Q.js +2 -0
- package/dist/esm/chunk-ARDKQL7Q.js.map +7 -0
- package/dist/esm/{chunk-66GLO2EG.js → chunk-BBMENJM3.js} +2 -2
- package/dist/esm/{chunk-E7LJHM3S.js → chunk-BGVGSALM.js} +2 -2
- package/dist/esm/{chunk-E7LJHM3S.js.map → chunk-BGVGSALM.js.map} +2 -2
- package/dist/esm/{chunk-T6Z4JUH6.js → chunk-BWVYB64R.js} +2 -2
- package/dist/esm/{chunk-UCIIRQUE.js → chunk-BXX2NVQD.js} +3 -3
- package/dist/esm/{chunk-UCIIRQUE.js.map → chunk-BXX2NVQD.js.map} +1 -1
- package/dist/esm/{chunk-BJ2Q2WVV.js → chunk-EUH5MK4Q.js} +2 -2
- package/dist/esm/{chunk-TCEQ5VVE.js → chunk-JGR3L4SN.js} +2 -2
- package/dist/esm/chunk-LHGT24A5.js +2 -0
- package/dist/esm/chunk-LHGT24A5.js.map +7 -0
- package/dist/esm/{chunk-VJXHEDCE.js → chunk-LOLLL7AV.js} +2 -2
- package/dist/esm/chunk-P3KYZBOB.js +2 -0
- package/dist/esm/chunk-P3KYZBOB.js.map +7 -0
- package/dist/esm/{chunk-77TGP2LO.js → chunk-QXEQ2C6A.js} +2 -2
- package/dist/esm/{chunk-522UYMDA.js → chunk-TUKX2BRO.js} +2 -2
- package/dist/esm/chunk-TUKX2BRO.js.map +7 -0
- package/dist/esm/{chunk-BKES3M4Y.js → chunk-UGGAAL4V.js} +2 -2
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/base-button.props.d.ts +1 -1
- package/dist/esm/components/_internal/base-button.props.js +1 -1
- package/dist/esm/components/button.d.ts +2 -2
- package/dist/esm/components/button.d.ts.map +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.props.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/icon-button.props.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/schemas/base-button.schema.js +1 -1
- package/dist/esm/components/schemas/button.schema.js +1 -1
- package/dist/esm/components/schemas/icon-button.schema.js +1 -1
- package/dist/esm/components/schemas/index.js +1 -1
- package/dist/esm/components/schemas/toggle-button.schema.js +1 -1
- package/dist/esm/components/schemas/toggle-icon-button.schema.js +1 -1
- package/dist/esm/components/theme-panel.js +1 -1
- package/dist/esm/components/toggle-button.d.ts +3 -37
- 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/dist/esm/props/index.js +1 -1
- package/package.json +1 -1
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +5 -5
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/base-button.props.ts +3 -3
- package/src/components/button.tsx +2 -2
- 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/schemas/base-button.schema.ts +2 -2
- package/src/components/sidebar.css +16 -0
- package/src/components/toggle-button.tsx +3 -1
- package/src/components/toggle-icon-button.tsx +4 -2
- package/src/components/toolbar.tsx +6 -3
- package/styles.css +12 -0
- package/dist/esm/chunk-2D5QJ6MX.js +0 -2
- package/dist/esm/chunk-2D5QJ6MX.js.map +0 -7
- package/dist/esm/chunk-522UYMDA.js.map +0 -7
- package/dist/esm/chunk-DAGHSWME.js +0 -2
- package/dist/esm/chunk-DAGHSWME.js.map +0 -7
- package/dist/esm/chunk-IICXZUIB.js +0 -2
- package/dist/esm/chunk-IICXZUIB.js.map +0 -7
- package/dist/esm/chunk-KDYHYQ4D.js +0 -2
- package/dist/esm/chunk-KDYHYQ4D.js.map +0 -7
- package/dist/esm/chunk-RJTWRLK4.js +0 -2
- package/dist/esm/chunk-RJTWRLK4.js.map +0 -7
- package/dist/esm/chunk-YEYM7QQZ.js.map +0 -7
- /package/dist/esm/{chunk-66GLO2EG.js.map → chunk-BBMENJM3.js.map} +0 -0
- /package/dist/esm/{chunk-T6Z4JUH6.js.map → chunk-BWVYB64R.js.map} +0 -0
- /package/dist/esm/{chunk-BJ2Q2WVV.js.map → chunk-EUH5MK4Q.js.map} +0 -0
- /package/dist/esm/{chunk-TCEQ5VVE.js.map → chunk-JGR3L4SN.js.map} +0 -0
- /package/dist/esm/{chunk-VJXHEDCE.js.map → chunk-LOLLL7AV.js.map} +0 -0
- /package/dist/esm/{chunk-77TGP2LO.js.map → chunk-QXEQ2C6A.js.map} +0 -0
- /package/dist/esm/{chunk-BKES3M4Y.js.map → chunk-UGGAAL4V.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u}from"./chunk-VK7RNXUO.js";import{a as l}from"./chunk-BXX2NVQD.js";import*as e from"react";import{Toggle as B}from"radix-ui";var d=e.forwardRef(({pressed:a,onPressedChange:g,defaultPressed:p,children:t,...s},f)=>{let{"aria-label":r,"aria-labelledby":o,iconOnly:i}=s,n=e.useRef(null);e.useEffect(()=>{n.current=null},[o]);let c=e.useCallback(()=>r||(o?(n.current===null&&(n.current=document.getElementById(o)?.textContent||"Toggle button"),n.current):typeof t=="string"?t:e.isValidElement(t)&&typeof t.props?.children=="string"?t.props.children:"Toggle button"),[r,o,t]),{handlePressedChange:m}=u({pressed:a,onPressedChange:g,getAccessibleName:c,componentName:i?"ToggleIconButton":"ToggleButton"});return e.createElement(B.Root,{pressed:a,onPressedChange:m,defaultPressed:p,asChild:!0},e.createElement(l,{...s,ref:f},t))});d.displayName="ToggleButton";export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5NARBZRI.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/toggle-button.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { Button } from './button.js';\nimport { useToggleState } from '../hooks/use-toggle-state.js';\nimport type { ButtonProps, ButtonRankProps } from './button.js';\n\n/**\n * ToggleButton props that extend Button with toggle-specific functionality\n *\n * The ToggleButton component provides a button that can be pressed/unpressed\n * with proper accessibility announcements and state management.\n */\ntype ToggleButtonProps = Omit<ButtonProps<'button'>, 'as' | 'variant' | 'emphasis'> &\n ButtonRankProps & {\n /** Controlled pressed state */\n pressed?: boolean;\n /** Callback when pressed state changes */\n onPressedChange?: (pressed: boolean) => void;\n /** Default pressed state for uncontrolled usage */\n defaultPressed?: boolean;\n};\n\ntype ToggleButtonElement = React.ElementRef<typeof Button>;\n\n/**\n * ToggleButton component for buttons that can be pressed/unpressed\n *\n * The ToggleButton component extends Button with toggle functionality using\n * Radix UI's Toggle primitive. It provides proper accessibility announcements,\n * controlled/uncontrolled state management, and seamless integration with\n * the existing Button component.\n *\n * Key features:\n * - Controlled and uncontrolled state management\n * - Live accessibility announcements for screen readers\n * - Automatic state validation and warnings\n * - Seamless integration with Button props and styling\n * - Proper ARIA attributes for toggle functionality\n *\n * @example\n * ```tsx\n * // Uncontrolled toggle button\n * <ToggleButton defaultPressed={false}>\n * Toggle Me\n * </ToggleButton>\n *\n * // Controlled toggle button\n * const [pressed, setPressed] = React.useState(false);\n * <ToggleButton\n * pressed={pressed}\n * onPressedChange={setPressed}\n * >\n * {pressed ? 'On' : 'Off'}\n * </ToggleButton>\n *\n * // Toggle button with all Button props\n * <ToggleButton\n * variant=\"solid\"\n * size=\"3\"\n * color=\"blue\"\n * pressed={isActive}\n * onPressedChange={setIsActive}\n * >\n * {isActive ? 'Active' : 'Inactive'}\n * </ToggleButton>\n * ```\n */\nconst ToggleButton = React.forwardRef<ToggleButtonElement, ToggleButtonProps>(({ pressed, onPressedChange, defaultPressed, children, ...buttonProps }, forwardedRef) => {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, iconOnly } = buttonProps;\n\n // The label behind aria-labelledby is read once per id, not on every press.\n const cachedLabelRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n cachedLabelRef.current = null;\n }, [ariaLabelledBy]);\n\n /**\n * The name announced when the pressed state changes: aria-label, then the label\n * aria-labelledby points at, then visible text.\n */\n const getAccessibleName = React.useCallback(() => {\n if (ariaLabel) return ariaLabel;\n if (ariaLabelledBy) {\n if (cachedLabelRef.current === null) {\n cachedLabelRef.current = document.getElementById(ariaLabelledBy)?.textContent || 'Toggle button';\n }\n return cachedLabelRef.current;\n }\n if (typeof children === 'string') return children;\n if (React.isValidElement(children) && typeof (children.props as any)?.children === 'string') {\n return (children.props as any).children;\n }\n return 'Toggle button';\n }, [ariaLabel, ariaLabelledBy, children]);\n\n // Use shared toggle state hook for accessibility announcements and warnings\n const { handlePressedChange } = useToggleState({\n pressed,\n onPressedChange,\n getAccessibleName,\n componentName: iconOnly ? 'ToggleIconButton' : 'ToggleButton',\n });\n\n // Render the toggle button using Radix UI's Toggle primitive\n // This provides proper ARIA attributes and keyboard navigation\n return (\n <Toggle.Root pressed={pressed} onPressedChange={handlePressedChange} defaultPressed={defaultPressed} asChild>\n <Button {...buttonProps} ref={forwardedRef}>\n {children}\n </Button>\n </Toggle.Root>\n );\n});\nToggleButton.displayName = 'ToggleButton';\n\nexport { ToggleButton };\nexport type { ToggleButtonProps };\n"],
|
|
5
|
+
"mappings": "gFAAA,UAAYA,MAAW,QACvB,OAAS,UAAAC,MAAc,WAkEvB,IAAMC,EAAqB,aAAmD,CAAC,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,SAAAC,EAAU,GAAGC,CAAY,EAAGC,IAAiB,CACtK,GAAM,CAAE,aAAcC,EAAW,kBAAmBC,EAAgB,SAAAC,CAAS,EAAIJ,EAG3EK,EAAuB,SAAsB,IAAI,EACjD,YAAU,IAAM,CACpBA,EAAe,QAAU,IAC3B,EAAG,CAACF,CAAc,CAAC,EAMnB,IAAMG,EAA0B,cAAY,IACtCJ,IACAC,GACEE,EAAe,UAAY,OAC7BA,EAAe,QAAU,SAAS,eAAeF,CAAc,GAAG,aAAe,iBAE5EE,EAAe,SAEpB,OAAON,GAAa,SAAiBA,EAC/B,iBAAeA,CAAQ,GAAK,OAAQA,EAAS,OAAe,UAAa,SACzEA,EAAS,MAAc,SAE1B,iBACN,CAACG,EAAWC,EAAgBJ,CAAQ,CAAC,EAGlC,CAAE,oBAAAQ,CAAoB,EAAIC,EAAe,CAC7C,QAAAZ,EACA,gBAAAC,EACA,kBAAAS,EACA,cAAeF,EAAW,mBAAqB,cACjD,CAAC,EAID,OACE,gBAACK,EAAO,KAAP,CAAY,QAASb,EAAS,gBAAiBW,EAAqB,eAAgBT,EAAgB,QAAO,IAC1G,gBAACY,EAAA,CAAQ,GAAGV,EAAa,IAAKC,GAC3BF,CACH,CACF,CAEJ,CAAC,EACDJ,EAAa,YAAc",
|
|
6
|
+
"names": ["React", "Toggle", "ToggleButton", "pressed", "onPressedChange", "defaultPressed", "children", "buttonProps", "forwardedRef", "ariaLabel", "ariaLabelledBy", "iconOnly", "cachedLabelRef", "getAccessibleName", "handlePressedChange", "useToggleState", "Toggle", "Button"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-BXX2NVQD.js";import*as t from"react";var a=t.forwardRef((e,n)=>t.createElement(o,{...e,iconOnly:!0,ref:n}));a.displayName="IconButton";export{a};
|
|
2
|
+
//# sourceMappingURL=chunk-ADFUYK3U.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/icon-button.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\n\nimport { BaseButton } from './_internal/base-button.js';\nimport { Button } from './button.js';\nimport type { BaseButtonProps } from './_internal/base-button.js';\nimport type { ButtonRankProps } from './button.js';\n\ntype IconButtonElement = React.ElementRef<typeof BaseButton>;\n\n/**\n * Required accessibility props for icon buttons\n * Icon buttons must have an accessible name to meet WCAG guidelines\n *\n * Three ways to provide accessibility:\n * 1. aria-label: Direct descriptive text\n * 2. aria-labelledby: Reference to a label element\n * 3. children: Visible text content (fallback)\n */\ntype AccessibilityProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string }\n | { 'aria-label'?: never; 'aria-labelledby'?: never; children: React.ReactNode };\n\n/**\n * Tooltip configuration props that can be passed to IconButton\n * These props are forwarded to the underlying Tooltip component\n */\ninterface IconButtonTooltipProps {\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 IconButton props excluding the 'as' prop for polymorphic behavior\n * Combines BaseButton props with accessibility requirements and tooltip functionality\n */\ntype IconButtonOwnProps = Omit<BaseButtonProps, 'as' | 'variant'> & ButtonRankProps & AccessibilityProps & IconButtonTooltipProps;\n\n/**\n * Polymorphic IconButton props that support rendering as different HTML elements\n * @template C - The element type to render as (defaults to 'button')\n */\ntype IconButtonProps<C extends React.ElementType = 'button'> = IconButtonOwnProps & {\n /** Element type to render as (e.g., 'a', 'span', etc.) */\n as?: C;\n} & Omit<React.ComponentPropsWithoutRef<C>, keyof IconButtonOwnProps>;\n\n/**\n * IconButton component type that supports polymorphic rendering\n * @template C - The element type to render as\n */\ntype IconButtonComponent = <C extends React.ElementType = 'button'>(props: IconButtonProps<C> & { ref?: React.ForwardedRef<IconButtonElement> }) => React.ReactElement | null;\n\n/**\n * IconButton component for compact, accessible icon-only interactions. It is `Button` with\n * `iconOnly` set, kept as its own name for its stricter type: an accessible name is required.\n *\n * The IconButton component extends Button with specialized behavior for visual symbols.\n * It enforces accessibility requirements, provides automatic square sizing, and includes\n * built-in tooltip integration. Icon buttons are essential for space-efficient interfaces\n * while maintaining accessibility compliance.\n *\n * Key features:\n * - Enforced accessibility requirements (aria-label, aria-labelledby, or children)\n * - Automatic square aspect ratios for consistent visual alignment\n * - Built-in tooltip support for context and guidance\n * - Same variant and size system as Button for consistency\n * - Runtime validation for accessibility compliance\n *\n * @example\n * ```tsx\n * // Basic icon button with aria-label\n * <IconButton aria-label=\"Settings\">\n * <Settings />\n * </IconButton>\n *\n * // Icon button with tooltip\n * <IconButton aria-label=\"Save\" tooltip=\"Save your progress\">\n * <Save />\n * </IconButton>\n *\n * // Icon button with aria-labelledby\n * <IconButton aria-labelledby=\"settings-label\">\n * <Settings />\n * </IconButton>\n * <span id=\"settings-label\">Open settings panel</span>\n *\n * // Icon button with visible text (fallback)\n * <IconButton>\n * <Settings />\n * Settings\n * </IconButton>\n * ```\n */\nconst IconButton = React.forwardRef(\n (props: IconButtonProps, forwardedRef: React.ForwardedRef<IconButtonElement>) => <Button {...props} iconOnly ref={forwardedRef} />,\n) as IconButtonComponent & { displayName?: string };\n\nIconButton.displayName = 'IconButton';\n\nexport { IconButton };\nexport type { IconButtonProps };\n"],
|
|
5
|
+
"mappings": "wCAAA,UAAYA,MAAW,QAsGvB,IAAMC,EAAmB,aACvB,CAACC,EAAwBC,IAAwD,gBAACC,EAAA,CAAQ,GAAGF,EAAO,SAAQ,GAAC,IAAKC,EAAc,CAClI,EAEAF,EAAW,YAAc",
|
|
6
|
+
"names": ["React", "IconButton", "props", "forwardedRef", "Button"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u}from"./chunk-ADFUYK3U.js";import{a as m}from"./chunk-5BWLY27A.js";import{a as y}from"./chunk-OS3FCYZY.js";var I={};y(I,{Button:()=>P,Content:()=>f,Item:()=>g,Root:()=>d,Viewport:()=>S,useMessageScroller:()=>B,useMessageScrollerScrollable:()=>w,useMessageScrollerVisibility:()=>h});import*as e from"react";import c from"classnames";import{MessageScroller as a,useMessageScroller as B,useMessageScrollerScrollable as w,useMessageScrollerVisibility as h}from"@shadcn/react/message-scroller";import{useComposedRefs as C}from"radix-ui/internal";var d=e.forwardRef(({autoScroll:o=!0,defaultScrollPosition:t="end",scrollEdgeThreshold:r,scrollMargin:s,className:n,children:i,...l},p)=>e.createElement(a.Provider,{autoScroll:o,defaultScrollPosition:t,...r!=null?{scrollEdgeThreshold:r}:{},...s!=null?{scrollMargin:s}:{}},e.createElement(a.Root,{...l,ref:p,className:c("rt-MessageScrollerRoot",n)},i)));d.displayName="MessageScroller.Root";var S=e.forwardRef(({className:o,"aria-label":t,fade:r=!0,...s},n)=>{let i=m(r),l=C(n,i);return e.createElement(a.Viewport,{"aria-label":t??"",...s,ref:l,"data-fade":r?"":void 0,className:c("rt-MessageScrollerViewport",o)})});S.displayName="MessageScroller.Viewport";var f=e.forwardRef(({className:o,...t},r)=>e.createElement(a.Content,{...t,ref:r,className:c("rt-MessageScrollerContent",o)}));f.displayName="MessageScroller.Content";var g=e.forwardRef(({className:o,...t},r)=>e.createElement(a.Item,{...t,ref:r,className:c("rt-MessageScrollerItem",o)}));g.displayName="MessageScroller.Item";var P=e.forwardRef(({direction:o="end",behavior:t,className:r,children:s,size:n="2",variant:i="surface",emphasis:l,color:p="gray",radius:M="full","aria-label":R,...b},v)=>e.createElement(a.Button,{direction:o,...t?{behavior:t}:{},render:e.createElement(u,{...b,ref:v,size:n,...l?{emphasis:l}:{variant:i},color:p,radius:M,"aria-label":R??(o==="end"?"Jump to the latest":"Jump to the first"),className:c("rt-MessageScrollerButton",r),"data-direction":o},s??e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none","aria-hidden":!0,style:o==="start"?{transform:"rotate(180deg)"}:void 0},e.createElement("path",{d:"M7.5 2.5v10M3.5 8.5l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})))}));P.displayName="MessageScroller.Button";export{B as a,w as b,h as c,d,S as e,f,g,P as h,I as i};
|
|
2
|
+
//# sourceMappingURL=chunk-ALG6R3ZX.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/message-scroller.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * MessageScroller \u2014 a transcript that follows a conversation.\n *\n * The behaviour is shadcn/ui's Message Scroller primitive (`@shadcn/react/message-scroller`,\n * MIT, https://ui.shadcn.com). Streaming, anchoring a new turn, keeping your place when history\n * loads above, and jumping back to the latest are a body of edge cases nobody should rewrite, so\n * Kookie takes the primitive and adds only the surface: the parts, the class names, the button.\n *\n * Anatomy\n * ```tsx\n * <MessageScroller.Root>\n * <MessageScroller.Viewport aria-label=\"Conversation\">\n * <MessageScroller.Content>\n * <MessageScroller.Item messageId=\"u1\" scrollAnchor>\u2026</MessageScroller.Item>\n * <MessageScroller.Item messageId=\"a1\">\u2026</MessageScroller.Item>\n * </MessageScroller.Content>\n * </MessageScroller.Viewport>\n * <MessageScroller.Button aria-label=\"Jump to the latest\" />\n * </MessageScroller.Root>\n * ```\n *\n * The viewport is its own scroller. Kookie's `ScrollArea` is Radix's, and Radix cannot hand its\n * viewport element to another library, so the transcript scrolls natively with a thin scrollbar.\n *\n * Requires React 19, which the primitive needs.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport {\n MessageScroller as Primitive,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n type MessageScrollerDefaultScrollPosition,\n type MessageScrollerScrollOptions,\n type MessageScrollerScrollable,\n type MessageScrollerVisibilityState,\n} from '@shadcn/react/message-scroller';\n\nimport { useComposedRefs } from 'radix-ui/internal';\n\nimport { IconButton, type IconButtonProps } from './icon-button.js';\nimport { useScrollEdges } from '../hooks/use-scroll-edges.js';\nimport type { ButtonRankProps } from './button.js';\n\ninterface RootProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Keeps the newest content in view while the reader is at the end. Default `true`.\n * Once the reader scrolls up, the transcript stays where they are until they return.\n */\n autoScroll?: boolean;\n /** Where the transcript opens: `end` (default), `start`, or the last anchored message. */\n defaultScrollPosition?: MessageScrollerDefaultScrollPosition;\n /** Distance in pixels from the end that still counts as \"at the end\". */\n scrollEdgeThreshold?: number;\n /** Space in pixels kept above a message when one is scrolled to or anchored. */\n scrollMargin?: number;\n}\n\n/** Holds the scroll state. Everything else goes inside it. */\nconst Root = React.forwardRef<HTMLDivElement, RootProps>(\n ({ autoScroll = true, defaultScrollPosition = 'end', scrollEdgeThreshold, scrollMargin, className, children, ...props }, forwardedRef) => (\n <Primitive.Provider\n autoScroll={autoScroll}\n defaultScrollPosition={defaultScrollPosition}\n {...(scrollEdgeThreshold != null ? { scrollEdgeThreshold } : {})}\n {...(scrollMargin != null ? { scrollMargin } : {})}\n >\n <Primitive.Root {...props} ref={forwardedRef} className={classNames('rt-MessageScrollerRoot', className)}>\n {children}\n </Primitive.Root>\n </Primitive.Provider>\n ),\n);\nRoot.displayName = 'MessageScroller.Root';\n\ninterface ViewportProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Name of the transcript region, e.g. \"Conversation\". */\n 'aria-label'?: string;\n /** Keep the reader's place when older messages are added above. Default `true`. */\n preserveScrollOnPrepend?: boolean;\n /**\n * Fades messages toward the top and bottom edges while there is more past them. A floating\n * band over an edge (a toolbar, a goal tray, a composer) can set `--scroll-fade-start` or\n * `--scroll-fade-end` to its height, so messages fade as they pass under it. Default `true`.\n */\n fade?: boolean;\n}\n\n/** The scrolling element. */\nconst Viewport = React.forwardRef<HTMLDivElement, ViewportProps>(({ className, 'aria-label': label, fade = true, ...props }, forwardedRef) => {\n const setEdgesElement = useScrollEdges<HTMLDivElement>(fade);\n const ref = useComposedRefs(forwardedRef, setEdgesElement);\n return (\n // The primitive names an unnamed viewport \"Messages\", in English. An empty name is skipped by\n // accessible-name computation, so a transcript is only named when the app names it.\n <Primitive.Viewport\n aria-label={label ?? ''}\n {...props}\n ref={ref}\n data-fade={fade ? '' : undefined}\n className={classNames('rt-MessageScrollerViewport', className)}\n />\n );\n});\nViewport.displayName = 'MessageScroller.Viewport';\n\ntype ContentProps = React.ComponentPropsWithoutRef<'div'>;\n\n/** The list of messages, inside the viewport. */\nconst Content = React.forwardRef<HTMLDivElement, ContentProps>(({ className, ...props }, forwardedRef) => (\n <Primitive.Content {...props} ref={forwardedRef} className={classNames('rt-MessageScrollerContent', className)} />\n));\nContent.displayName = 'MessageScroller.Content';\n\ninterface ItemProps extends React.ComponentPropsWithoutRef<'div'> {\n /** A stable id, so the row can be scrolled to with `useMessageScroller().scrollToMessage`. */\n messageId?: string;\n /** Anchor this row near the top when it arrives. Set it on the person's own messages. */\n scrollAnchor?: boolean;\n}\n\n/** One row of the transcript. */\nconst Item = React.forwardRef<HTMLDivElement, ItemProps>(({ className, ...props }, forwardedRef) => (\n <Primitive.Item {...props} ref={forwardedRef} className={classNames('rt-MessageScrollerItem', className)} />\n));\nItem.displayName = 'MessageScroller.Item';\n\ntype ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby' | 'variant' | 'emphasis'> &\n ButtonRankProps & {\n /** Accessible name, in your words. Default \"Jump to the latest\". */\n 'aria-label'?: string;\n /** `end` jumps to the latest message (default); `start` to the first. */\n direction?: 'start' | 'end';\n /** Scroll behaviour of the jump. Default `smooth`. */\n behavior?: ScrollBehavior;\n};\n\n/**\n * Jumps back to the latest message. It renders only while the reader is away from the end.\n * Place it inside `Root`, after the viewport. It sits over the viewport's bottom edge.\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ direction = 'end', behavior, className, children, size = '2', variant = 'surface', emphasis, color = 'gray', radius = 'full', 'aria-label': label, ...props }, forwardedRef) => (\n <Primitive.Button\n direction={direction}\n {...(behavior ? { behavior } : {})}\n render={\n <IconButton\n {...props}\n ref={forwardedRef}\n size={size}\n {...(emphasis ? { emphasis } : { variant })}\n color={color}\n radius={radius}\n aria-label={label ?? (direction === 'end' ? 'Jump to the latest' : 'Jump to the first')}\n className={classNames('rt-MessageScrollerButton', className)}\n data-direction={direction}\n >\n {children ?? (\n <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden style={direction === 'start' ? { transform: 'rotate(180deg)' } : undefined}>\n <path d=\"M7.5 2.5v10M3.5 8.5l4 4 4-4\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )}\n </IconButton>\n }\n />\n ),\n);\nButton.displayName = 'MessageScroller.Button';\n\nexport { Root, Viewport, Content, Item, Button, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility };\nexport type {\n RootProps as MessageScrollerRootProps,\n ViewportProps as MessageScrollerViewportProps,\n ContentProps as MessageScrollerContentProps,\n ItemProps as MessageScrollerItemProps,\n ButtonProps as MessageScrollerButtonProps,\n MessageScrollerDefaultScrollPosition,\n MessageScrollerScrollOptions,\n MessageScrollerScrollable,\n MessageScrollerVisibilityState,\n};\n"],
|
|
5
|
+
"mappings": "wHAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,YAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,aAAAC,EAAA,uBAAAC,EAAA,iCAAAC,EAAA,iCAAAC,IA6BA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aAC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,IAAKC,EAAc,UAAWE,EAAW,yBAA0BL,CAAS,EAAG,CAC3G,EACDc,EAAK,YAAc,uBAgBnB,IAAMC,EAAe,aACnB,CAAC,CAAE,UAAAC,EAAY,MAAO,SAAAC,EAAU,UAAAjB,EAAW,SAAAC,EAAU,KAAAiB,EAAO,IAAK,QAAAC,EAAU,UAAW,SAAAC,EAAU,MAAAC,EAAQ,OAAQ,OAAAC,EAAS,OAAQ,aAAcf,EAAO,GAAGL,CAAM,EAAGC,IAChK,gBAACC,EAAU,OAAV,CACC,UAAWY,EACV,GAAIC,EAAW,CAAE,SAAAA,CAAS,EAAI,CAAC,EAChC,OACE,gBAACM,EAAA,CACE,GAAGrB,EACJ,IAAKC,EACL,KAAMe,EACL,GAAIE,EAAW,CAAE,SAAAA,CAAS,EAAI,CAAE,QAAAD,CAAQ,EACzC,MAAOE,EACP,OAAQC,EACR,aAAYf,IAAUS,IAAc,MAAQ,qBAAuB,qBACnE,UAAWX,EAAW,2BAA4BL,CAAS,EAC3D,iBAAgBgB,GAEff,GACC,gBAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,cAAW,GAAC,MAAOe,IAAc,QAAU,CAAE,UAAW,gBAAiB,EAAI,QACvI,gBAAC,QAAK,EAAE,8BAA8B,OAAO,eAAe,YAAY,MAAM,cAAc,QAAQ,eAAe,QAAQ,CAC7H,CAEJ,EAEJ,CAEJ,EACAD,EAAO,YAAc",
|
|
6
|
+
"names": ["message_scroller_exports", "__export", "Button", "Content", "Item", "Root", "Viewport", "useMessageScroller", "useMessageScrollerScrollable", "useMessageScrollerVisibility", "React", "classNames", "Primitive", "useComposedRefs", "Root", "autoScroll", "defaultScrollPosition", "scrollEdgeThreshold", "scrollMargin", "className", "children", "props", "forwardedRef", "Primitive", "classNames", "Viewport", "label", "fade", "setEdgesElement", "useScrollEdges", "ref", "useComposedRefs", "Content", "Item", "Button", "direction", "behavior", "size", "variant", "emphasis", "color", "radius", "IconButton"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as rt}from"./chunk-EUH5MK4Q.js";import{a as Ve}from"./chunk-ADFUYK3U.js";import{g as nt,j as ot}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 T from"classnames";import{LazyMotion as Dt,MotionConfig as Bt,domAnimation as jt,m as pe}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,r){let{placeholder:n}=a;if(!n){r();return}a.placeholder="";try{r()}finally{a.placeholder=n}}var he={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},me=a=>Array.isArray(a)?a:typeof a=="string"?a.split(",").map(r=>r.trim()).filter(Boolean):[],Wt=(a,r)=>{if(r.length===0)return!0;let n=a.type.toLowerCase(),i=a.name.toLowerCase();for(let c of r){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,r)=>(r||"").toLowerCase().startsWith("image/")||$t.test(a),$e=a=>a.trim().length>0,it=(a,r)=>`${a} ${r}${a===1?"":"s"}`,Kt=0,Ut=()=>`chatbar-attachment-${Date.now()}-${++Kt}`,ut=e.forwardRef((a,r)=>{let{className:n,style:i,children:c,value:l,defaultValue:d="",onValueChange:u,open:f,defaultOpen:b=!1,onOpenChange:C,expandOn:y="both",minLines:g=3,maxLines:w=6,sendMode:I="whenDirty",disabled:R,readOnly:E,onSubmit:B,size:A="2",variant:F,color:M,radius:N,panelBackground:X,material:h,width:J,maxWidth:j,attachments:Q,defaultAttachments:P,onAttachmentsChange:z,accept:Z,multiple:D=!0,maxAttachments:_,maxFileSize:G,paste:V=!0,pasteAccept:k,clearOnSubmit:O=!0,onAttachmentReject:Se,dropzone:se=!0,apiRef:Ee,onBlurCapture:fe,notices:be,context:Re,...Te}=a,t=h||X,v=l!=null,[S,ie]=e.useState(d),W=v?l:S,q=f!=null,[Le,ce]=e.useState(b),ee=q?f:Le,te="attachments"in a,[_e,At]=e.useState(()=>P??[]),le=e.useMemo(()=>te?Q??[]:_e,[te,Q,_e]),[Ge,wt]=e.useState({text:"",id:0}),de=e.useCallback(o=>wt(s=>({text:o,id:s.id+1})),[]),qe=e.useRef(null),St=ct(r,qe),ke=e.useRef(null),Me=e.useRef(null),ue=e.useRef(!1),Ce=e.useRef(!1),ge=e.useRef(void 0),Ne=e.useRef(null),Ye=me(Z).join(","),Oe=me(k).join(","),He=e.useMemo(()=>me(Ye),[Ye]),Et=e.useMemo(()=>Oe?me(Oe):He,[Oe,He]),Xe={value:W,attachments:le,accepts:He,pasteAccepts:Et,multiple:D,maxAttachments:_,maxFileSize:G,disabled:R,readOnly:E,expandOn:y,isValueControlled:v,isOpenControlled:q,isAttachmentsControlled:te,onValueChange:u,onOpenChange:C,onAttachmentsChange:z,onAttachmentReject:Se,onSubmit:B},x=e.useRef(Xe);x.current=Xe;let Ie=e.useRef(null),$=e.useCallback(()=>Ie.current??x.current.attachments,[]),ae=e.useCallback(o=>{x.current.isOpenControlled||ce(o),x.current.onOpenChange?.(o)},[]),ve=e.useCallback(o=>{x.current.isValueControlled||ie(o),x.current.onValueChange?.(o)},[]),ne=e.useCallback(o=>{Ie.current=o,queueMicrotask(()=>{Ie.current=null}),x.current.isAttachmentsControlled||At(o),x.current.onAttachmentsChange?.(o)},[]),ye=e.useRef(new Set),oe=e.useCallback((o,s,m=x.current.multiple)=>{let p=x.current;if(p.disabled||p.readOnly||o.length===0)return 0;let K=$(),Y=[],re=[],It=typeof p.maxAttachments=="number"?Math.max(p.maxAttachments-K.length,0):1/0,Ft=m?1/0:1;for(let L of o){if(Y.length>=It||Y.length>=Ft){re.push({file:L,reason:"count"});continue}if(typeof p.maxFileSize=="number"&&L.size>p.maxFileSize){re.push({file:L,reason:"size"});continue}if(!Wt(L,s)){re.push({file:L,reason:"type"});continue}let ze=dt(L.name,L.type)?URL.createObjectURL(L):void 0;ze&&ye.current.add(ze),Y.push({id:Ut(),name:L.name,size:L.size,type:L.type,file:L,url:ze,status:"idle"})}let Ae=[];return Y.length>0&&(ne(K.concat(Y)),p.expandOn!=="none"&&ae(!0),Ae.push(`${it(Y.length,"file")} attached.`)),re.length>0&&(p.onAttachmentReject?.(re),Ae.push(`${it(re.length,"file")} could not be attached.`)),Ae.length>0&&de(Ae.join(" ")),Y.length},[$,ne,ae,de]),xe=e.useCallback(o=>oe(o,x.current.accepts),[oe]),Je=e.useCallback(o=>oe(o,x.current.pasteAccepts),[oe]),Qe=e.useCallback(o=>{let s=$(),m=s.find(p=>p.id===o);m&&(ne(s.filter(p=>p.id!==o)),de(`Removed ${m.name}.`))},[$,ne,de]),Ze=e.useCallback(o=>{let s=x.current;if(s.disabled||s.readOnly)return!1;let m=$();if(!$e(s.value)&&m.length===0)return!1;let p={value:s.value,attachments:m};if(o&&s.onSubmit)for(let K of m)K.url&&ye.current.delete(K.url);return s.onSubmit?.(p),o&&(ve(""),ne([])),!0},[$,ve,ne]);e.useEffect(()=>{let o=ye.current;if(o.size===0)return;let s=new Set(le.map(m=>m.url));for(let m of Array.from(o))s.has(m)||(URL.revokeObjectURL(m),o.delete(m))},[le]),e.useEffect(()=>{let o=ye.current;return()=>{if(!x.current.isAttachmentsControlled){for(let s of Array.from(o))URL.revokeObjectURL(s);o.clear()}}},[]);let Pe=e.useCallback(o=>{let s=x.current,m=Me.current;if(clearTimeout(ge.current),Ce.current=!1,!m||s.disabled||s.readOnly)return;let p=o?.accept!=null?me(o.accept):s.accepts,K=o?.multiple??s.multiple;Ne.current={patterns:p,multiple:K},m.accept=p.join(","),m.multiple=K,ue.current=!0,m.click(),setTimeout(()=>{document.hasFocus()&&(ue.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 o=Me.current,s=()=>{ue.current=!1};return window.addEventListener("focus",s),o?.addEventListener("cancel",s),()=>{window.removeEventListener("focus",s),o?.removeEventListener("cancel",s)}},[]);let Tt=e.useCallback(o=>{let s=o.currentTarget,m=Array.from(s.files??[]),p=Ne.current;oe(m,p?.patterns??x.current.accepts,p?.multiple),ue.current=!1,Ne.current=null,s.value=""},[oe]),Lt=e.useCallback(o=>{fe?.(o);let s=x.current,m=qe.current;if(!m||s.expandOn==="none")return;let p=o.relatedTarget;p&&m.contains(p)||ue.current||Ce.current||!$e(s.value)&&$().length===0&&ae(!1)},[fe,ae,$]),kt=e.useCallback(o=>{xe(o)},[xe]),{getRootProps:Mt,isDragActive:Nt}=Vt({onDrop:kt,onDragEnter:()=>de(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!se||R||E}),Fe=se&&Nt;e.useImperativeHandle(Ee,()=>({focusTextarea:()=>ke.current?.focus({preventScroll:!0}),openFilePicker:()=>Pe()}),[Pe]);let Ot=e.useCallback(o=>{if(R||o.pointerType==="mouse"&&o.button!==0)return;let s=o.target;s instanceof Element&&s.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(o.preventDefault(),ke.current?.focus({preventScroll:!0}))},[R]),Ht=e.useMemo(()=>({open:ee,setOpen:ae,setValue:ve,size:A,expandOn:y,minLines:g,maxLines:w,sendMode:I,disabled:R,readOnly:E,paste:V,clearOnSubmit:O,multiple:D,textareaRef:ke,attachments:le,removeAttachment:Qe,submit:Ze,appendFiles:xe,appendFilesFromPaste:Je,openFilePicker:Pe,beginFilePickerPress:et}),[ee,ae,ve,A,y,g,w,I,R,E,V,O,D,le,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:T("rt-ChatbarRoot",`rt-r-size-${A}`,n),style:{position:"relative",width:J,maxWidth:j,...i},"data-state":ee?"open":"closed","data-disabled":R?"":void 0,"data-readonly":E?"":void 0,"data-drop-active":Fe?"":void 0,"data-accent-color":M,"data-radius":N,"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(rt.Provider,{value:A},be)):null,e.createElement("div",{...se?Mt():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Ot},e.createElement(pe.div,{className:T("rt-ChatbarBox",`rt-variant-${tt(F??"raised")}`),style:{position:"relative"},"data-accent-color":M,"data-radius":N,"data-panel-background":t,"data-material":t,layout:!0,transition:he},e.createElement(pe.div,{className:"rt-ChatbarGrid",layout:"position",transition:he},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,r)=>{let{className:n,style:i,asChild:c,onFocus:l,onChange:d,onPaste:u,onKeyDown:f,onCompositionStart:b,onCompositionEnd:C,submitOnEnter:y=!1,...g}=a,w=H(),I=e.useContext(Ke),{open:R,minLines:E,maxLines:B,expandOn:A,disabled:F,readOnly:M,setOpen:N,setValue:X,textareaRef:h,paste:J,appendFilesFromPaste:j,size:Q,submit:P,clearOnSubmit:z}=w,Z=ct(r,h),D=e.useRef(0),_=e.useRef(0),G=e.useRef(!1),V=e.useRef({open:R,minLines:E,maxLines:B});We(()=>{V.current={open:R,minLines:E,maxLines:B}},[R,E,B]);let k=e.useCallback(()=>{let t=h.current;if(!t)return;let v=window.getComputedStyle(t);D.current=parseFloat(v.lineHeight)||20,_.current=(parseFloat(v.paddingTop)||0)+(parseFloat(v.paddingBottom)||0)},[h]),O=e.useCallback((t,v)=>{let{minLines:S,maxLines:ie}=V.current,W=D.current,q=_.current,Le=Math.ceil((v?S:1)*W)+q,ce=Math.ceil((v?ie:1)*W)+q,ee=Math.max(t.scrollHeight,Le);t.style.height=`${Math.min(ee,ce)}px`;let te=ee>ce;t.style.overflowY=te?"auto":"hidden",t.style.maxHeight=te?`${ce}px`:"none"},[]);We(()=>{k()},[k,Q]),We(()=>{let t=h.current;t&&(D.current===0&&k(),st(t,()=>{t.style.height="auto";let v=R;if(!R&&(A==="overflow"||A==="both")){let S=Math.ceil(D.current)+_.current;t.scrollHeight>S+1&&(v=!0,N(!0))}O(t,v)}))},[I,R,A,E,B,Q,N,h,k,O]),e.useEffect(()=>{let t=h.current;if(!t||typeof ResizeObserver>"u")return;let v=-1,S=new ResizeObserver(ie=>{let W=ie[0]?.contentRect.width??0;if(W===v)return;let q=v===-1;v=W,!q&&(k(),st(t,()=>{t.style.height="auto",O(t,V.current.open)}))});return S.observe(t),()=>S.disconnect()},[h,k,O]),e.useEffect(()=>{},[]);let Se=e.useCallback(t=>{l?.(t),!(F||M)&&(A==="focus"||A==="both")&&!R&&N(!0)},[F,M,A,R,N,l]),se=e.useCallback(t=>{X(t.currentTarget.value),d?.(t)},[X,d]),Ee=e.useCallback(t=>{if(u?.(t),t.defaultPrevented||!J||F||M)return;let v=Array.from(t.clipboardData?.items??[]).filter(S=>S.kind==="file").map(S=>S.getAsFile()).filter(S=>!!S);v.length!==0&&j(v)>0&&t.preventDefault()},[J,F,M,u,j]),fe=e.useCallback(t=>{G.current=!0,b?.(t)},[b]),be=e.useCallback(t=>{G.current=!1,C?.(t)},[C]),Re=e.useCallback(t=>{f?.(t),!(t.defaultPrevented||!y)&&(t.key!=="Enter"||t.shiftKey||t.altKey||t.ctrlKey||t.metaKey||G.current||t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(t.preventDefault(),P(z)))},[y,f,P,z]),Te=c?U:"textarea";return e.createElement(pe.div,{className:T("rt-ChatbarField","rt-ChatbarTextarea",n),layout:"position",transition:he},e.createElement(Te,{...g,ref:Z,className:"rt-ChatbarInput",value:I,onChange:se,onFocus:Se,onPaste:Ee,onKeyDown:Re,onCompositionStart:fe,onCompositionEnd:be,disabled:F,readOnly:M,rows:R?E:1,spellCheck:g.spellCheck??!0,autoCorrect:g.autoCorrect??"on",style:i}))});mt.displayName="Chatbar.Textarea";var pt=e.forwardRef((a,r)=>{let{children:n,asChild:i,className:c,...l}=a;return H().open?null:e.createElement(i?U:"div",{...l,ref:r,className:T("rt-ChatbarInlineStart",c)},n)});pt.displayName="Chatbar.InlineStart";var ht=e.forwardRef((a,r)=>{let{children:n,asChild:i,className:c,...l}=a;return H().open?null:e.createElement(i?U:"div",{...l,ref:r,className:T("rt-ChatbarInlineEnd",c)},n)});ht.displayName="Chatbar.InlineEnd";var ft=e.forwardRef((a,r)=>{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(pe.div,{layout:"position",transition:he},e.createElement(C,{...u,ref:r,className:T("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(y=>e.createElement(Ue,{key:y.id,attachment:y,asChild:!!c},c?.(y))),d))))});ft.displayName="Chatbar.AttachmentsRow";function bt(a,r){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():r.current?.focus({preventScroll:!0})}var Rt=({lead:a,leadKind:r,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":r,"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,r)=>{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`,y=n.status?_t[n.status]:void 0,g=u.disabled||u.readOnly,w=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(ot,null);return e.createElement(f,{...d,ref:r,className:T(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:y?`${C}, ${y}`:C,removeLabel:`Remove ${n.name}`,onRemove:g?void 0:w}))});Ue.displayName="Chatbar.Attachment";var Ct=e.forwardRef((a,r)=>{let{children:n,icon:i,image:c,color:l,onRemove:d,removeLabel:u,className:f,...b}=a,C=H(),y=C.disabled||C.readOnly,g=d?w=>{bt(w.currentTarget,C.textareaRef),d()}:void 0;return e.createElement("div",{...b,ref:r,className:T("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:y?void 0:g}))});Ct.displayName="Chatbar.Item";var gt=e.forwardRef((a,r)=>{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:r,className:T("rt-ChatbarAttachTrigger",f.className),type:f.type??"button","aria-label":f["aria-label"]??"Add attachments",disabled:C,onPointerDown:g=>{d?.(g),!C&&!g.defaultPrevented&&b.beginFilePickerPress()},onClick:g=>{u?.(g),!(C||g.defaultPrevented)&&b.openFilePicker({accept:i,multiple:c})}})});gt.displayName="Chatbar.AttachTrigger";var vt=e.forwardRef((a,r)=>{let{asChild:n,children:i,className:c,...l}=a;if(!H().open)return null;let u=n?U:"div";return e.createElement(pe.div,{layout:"position",transition:he},e.createElement(u,{...l,ref:r,className:T("rt-ChatbarRow",c)},e.createElement(De,{align:"center",justify:"between",width:"100%"},i)))});vt.displayName="Chatbar.Row";var yt=e.forwardRef((a,r)=>{let{className:n,...i}=a;return e.createElement("div",{...i,ref:r,className:T("rt-ChatbarRowStart",n)})});yt.displayName="Chatbar.RowStart";var xt=e.forwardRef((a,r)=>{let{className:n,...i}=a;return e.createElement("div",{...i,ref:r,className:T("rt-ChatbarRowEnd",n)})});xt.displayName="Chatbar.RowEnd";var Pt=e.forwardRef((a,r)=>{let{asChild:n,clearOnSend:i,disabled:c,children:l,style:d,className:u,size:f,variant:b,emphasis:C,tabIndex:y,onClick:g,status:w="ready",onStop:I,onRetry:R,stopLabel:E="Stop",retryLabel:B="Retry",stopIcon:A,retryIcon:F,"aria-label":M,"aria-labelledby":N,...X}=a,h=H(),J=e.useContext(Ke),j=$e(J)||h.attachments.length>0,P=j?"send":w==="submitted"||w==="streaming"?"stop":w==="error"?"retry":"send";if(h.sendMode==="never"&&P==="send")return null;let z=P!=="send"||h.sendMode==="always"||j,Z=P==="send"?c||h.disabled||h.readOnly||!j:c||h.disabled,_=P==="stop"?{"aria-label":E}:P==="retry"?{"aria-label":B}:N?{"aria-labelledby":N}:{"aria-label":M??"Send"},G=k=>{if(g?.(k),k.defaultPrevented||Z)return;if(P==="stop"){I?.();return}if(P==="retry"){R?.();return}let O=i??h.clearOnSubmit;h.submit(O)&&O&&h.textareaRef.current?.focus({preventScroll:!0})},V=P==="stop"?A??(w==="submitted"?e.createElement(Be,{size:h.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"}))):P==="retry"?F??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,{...X,ref:r,size:f??h.size,...C?{emphasis:C}:{variant:b??(h.open||P!=="send"?"solid":"ghost")},disabled:Z,className:T("rt-ChatbarSend",u),style:{opacity:z?1:0,pointerEvents:z?void 0:"none",...d},"aria-hidden":z?void 0:!0,tabIndex:z?y:-1,asChild:n,onClick:G,"data-status":w,"data-mode":P,..._},V)});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-ARDKQL7Q.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/chatbar.tsx"],
|
|
4
|
+
"sourcesContent": ["import { parseVariant } from '../helpers/parse-variant.js';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { LazyMotion, MotionConfig, domAnimation, m } from 'motion/react';\nimport { useComposedRefs } from 'radix-ui/internal';\nimport { useDropzone } from 'react-dropzone';\n\nimport { IconButton, type IconButtonProps } from './icon-button.js';\nimport { CloseIcon, FileTextIcon } from './icons.js';\nimport { Flex } from './flex.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Slot } from './slot.js';\nimport { NoticeSizeContext } from './notice.js';\nimport { Spinner } from './spinner.js';\nimport { Text } from './text.js';\nimport { VisuallyHidden } from './visually-hidden.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { accentColors } from '../props/color.prop.js';\nimport type { radii } from '../props/radius.prop.js';\nimport type { ButtonRankProps } from './button.js';\n\n// Avoid SSR warnings by using an isomorphic layout effect\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n\n/**\n * Runs `measure` with the placeholder taken out of layout, so a height read\n * reflects the value alone.\n *\n * A textarea with an empty value lays its placeholder out as real text, so\n * `scrollHeight` reports the placeholder wrapped at whatever width the field\n * has at that instant. That sizes an empty bar to the suggestion showing in it\n * rather than to `minLines`, and when the read lands before the field has its\n * final width -- a panel still animating open, a flex parent whose basis is 0\n * -- it wraps that text at a fraction of the real width and opens the bar at\n * `maxLines`. The first keystroke takes the placeholder out of layout and the\n * height snaps back, which is what made the bug look intermittent rather than\n * simply wrong.\n *\n * The reset to 'auto' and the `scrollHeight` read sit in different functions\n * here, so the whole measurement window is wrapped rather than a single read.\n * Costs one extra style recalc on a path that is already forcing a reflow.\n */\nfunction withoutPlaceholder(el: HTMLTextAreaElement, measure: () => void): void {\n const { placeholder } = el;\n if (!placeholder) {\n measure();\n return;\n }\n el.placeholder = '';\n try {\n measure();\n } finally {\n el.placeholder = placeholder;\n }\n}\n\n// Shared layout spring; hoisted so every motion node receives the same object\nconst LAYOUT_TRANSITION = { layout: { type: 'spring', visualDuration: 0.15, bounce: 0.1 } } as const;\n\ntype ExpandOn = 'none' | 'focus' | 'overflow' | 'both';\ntype SendMode = 'always' | 'whenDirty' | 'never';\n\n// Attachments\n/** Status flag for attachment lifecycle. */\ntype AttachmentStatus = 'idle' | 'uploading' | 'error' | 'done';\n/**\n * Attachment data model used by Chatbar.\n * - `file` exposes the original File object for uploads and processing.\n * - `url` is an object URL used for image previews. Chatbar revokes it when the\n * attachment is removed; once an attachment is handed to `onSubmit`, the\n * consumer owns the URL and is responsible for revoking it.\n */\ninterface ChatbarAttachment {\n id: string;\n name: string;\n size: number;\n type: string;\n /** Original File object for uploads and processing */\n file: File;\n url?: string;\n status?: AttachmentStatus;\n progress?: number;\n meta?: Record<string, unknown>;\n}\n\ntype ChatbarRejectReason = 'type' | 'size' | 'count';\ninterface ChatbarAttachmentRejection {\n file: File;\n reason: ChatbarRejectReason;\n}\n\ninterface ChatbarSubmitPayload {\n value: string;\n attachments: ChatbarAttachment[];\n}\n\ninterface FilePickerOptions {\n accept?: string | string[];\n multiple?: boolean;\n}\n\ninterface ChatbarContextValue {\n open: boolean;\n setOpen(next: boolean): void;\n\n setValue(next: string): void;\n\n size: '1' | '2' | '3';\n expandOn: ExpandOn;\n minLines: number;\n maxLines: number;\n sendMode: SendMode;\n disabled?: boolean;\n readOnly?: boolean;\n paste: boolean;\n clearOnSubmit: boolean;\n multiple: boolean;\n\n textareaRef: React.RefObject<HTMLTextAreaElement | null>;\n\n attachments: ChatbarAttachment[];\n removeAttachment(id: string): void;\n\n /** Validates and submits; returns false when there was nothing to submit */\n submit(clear: boolean): boolean;\n appendFiles(files: File[]): number;\n appendFilesFromPaste(files: File[]): number;\n openFilePicker(options?: FilePickerOptions): void;\n /** Guards blur-collapse between pointerdown on a picker trigger and its click */\n beginFilePickerPress(): void;\n}\n\nconst ChatbarContext = React.createContext<ChatbarContextValue | null>(null);\n// Value lives in its own context so keystrokes only re-render parts that read it\nconst ChatbarValueContext = React.createContext<string>('');\n\nconst useChatbarContext = () => {\n const ctx = React.useContext(ChatbarContext);\n if (!ctx) throw new Error('Chatbar context not found. Wrap parts in <Chatbar.Root>.');\n return ctx;\n};\n\nconst toArray = (val: string | string[] | undefined) =>\n Array.isArray(val) ? val : typeof val === 'string' ? val.split(',').map((s) => s.trim()).filter(Boolean) : [];\n\nconst matchesAccept = (file: File, patterns: string[]) => {\n if (patterns.length === 0) return true;\n const mime = file.type.toLowerCase();\n const name = file.name.toLowerCase();\n for (const patRaw of patterns) {\n const pat = patRaw.toLowerCase();\n if (pat.includes('/')) {\n const [type, subtype] = pat.split('/');\n const [fmType, fmSubtype] = mime.split('/');\n if (type === '*' || (type === fmType && (subtype === '*' || subtype === fmSubtype))) return true;\n } else if (pat.startsWith('.')) {\n if (name.endsWith(pat)) return true;\n }\n }\n return false;\n};\n\nconst IMAGE_EXT_RE = /\\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i;\nconst isImageLike = (name: string, type: string) => (type || '').toLowerCase().startsWith('image/') || IMAGE_EXT_RE.test(name);\n\nconst hasText = (value: string) => value.trim().length > 0;\n\nconst plural = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`;\n\nlet attachmentCounter = 0;\nconst createAttachmentId = () => `chatbar-attachment-${Date.now()}-${++attachmentCounter}`;\n\n/**\n * Chatbar container and state provider.\n *\n * Value & Open\n * - Supports controlled/uncontrolled `value` and `open`.\n *\n * Attachments\n * - Controlled/uncontrolled attachments with client-side filtering.\n * - Filters by `accept`/`pasteAccept`, `multiple`, `maxAttachments`, and `maxFileSize`.\n * - Rejections are reported via `onAttachmentReject`.\n *\n * Submit\n * - `onSubmit({ value, attachments })` emits both message and attachments.\n * - Submitting requires text or at least one attachment.\n * - `clearOnSubmit` clears message and attachments by default.\n */\ninterface ChatbarRootBaseProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n /** When the chatbar expands on its own. `none` leaves open state entirely to the consumer. */\n expandOn?: ExpandOn;\n\n /** Minimum visible lines when expanded (default: 3). The compact state is always one line. */\n minLines?: number;\n /** Maximum number of lines before scrolling (default: 6) */\n maxLines?: number;\n\n /** Controls Send button visibility only. Enter-to-submit is controlled by `Textarea submitOnEnter`. */\n sendMode?: SendMode;\n\n /** Disables text input, submission and every way of adding attachments */\n disabled?: boolean;\n /** Prevents editing, submission and adding attachments */\n readOnly?: boolean;\n\n /** Combined submit payload */\n onSubmit?: (payload: ChatbarSubmitPayload) => void;\n\n size?: '1' | '2' | '3';\n /** `classic` is a deprecated alias of `raised`, removed in 0.15.0. */\n variant?: 'raised' | 'surface' | 'outline' | 'ghost' | 'soft' | 'classic';\n /** Accent color for the control (matches TextArea) */\n color?: (typeof accentColors)[number];\n /** Optional radius override (matches TextArea) */\n radius?: (typeof radii)[number];\n /** Panel/material translucency flags (matches TextArea) */\n panelBackground?: 'solid' | 'translucent';\n material?: 'solid' | 'translucent';\n\n width?: React.CSSProperties['width'];\n maxWidth?: React.CSSProperties['maxWidth'];\n\n // Attachments API\n attachments?: ChatbarAttachment[];\n defaultAttachments?: ChatbarAttachment[];\n onAttachmentsChange?: (attachments: ChatbarAttachment[]) => void;\n accept?: string | string[];\n /** Allow more than one file per pick, paste or drop */\n multiple?: boolean;\n maxAttachments?: number;\n maxFileSize?: number;\n paste?: boolean;\n /** Accepted types for pasted files. Replaces `accept` for paste when set. */\n pasteAccept?: string | string[];\n /** Clear message and attachments after submit */\n clearOnSubmit?: boolean;\n onAttachmentReject?: (rejections: ChatbarAttachmentRejection[]) => void;\n\n /**\n * Enables drag-and-drop file uploads when true.\n *\n * When enabled:\n * - Files can be dropped anywhere on the chatbar\n * - Same validation rules apply (accept, multiple, maxFileSize, maxAttachments)\n * - Visual feedback shows during drag operations\n * - Rejected files trigger onAttachmentReject\n *\n * @default true\n */\n dropzone?: boolean;\n\n /**\n * Optional API ref to control Chatbar imperatively without relying on DOM refs.\n * Provides methods to focus the textarea and open the file picker.\n */\n apiRef?: React.Ref<ChatbarApi>;\n\n /**\n * Messages that need an answer before the next message, such as `Notice` and `Confirmation`.\n * They stack in a column above the chatbar, in the order given, so put the one the next\n * message answers last, nearest the text. They sit outside the box: a button in a notice never\n * submits the message, and pressing one never collapses the chatbar.\n */\n notices?: React.ReactNode;\n /**\n * Short facts that stay true about the conversation, such as the model or the context left.\n * They sit below the chatbar, inset from its sides.\n */\n context?: React.ReactNode;\n}\n\ntype RootElement = React.ElementRef<'div'>;\n/** Imperative API for Chatbar.Root */\nexport interface ChatbarApi {\n /** Focus the textarea input */\n focusTextarea: () => void;\n /** Open the file picker dialog (respects accept/multiple). No-op when disabled or read-only. */\n openFilePicker: () => void;\n}\n/**\n * Chatbar container and state provider.\n *\n * Behavior\n * - Supports controlled and uncontrolled `value` and `open` states via props.\n * - Provides context to subcomponents like `Textarea`, `Row`, and `Send`.\n * - Exposes `data-state`, `data-disabled`, and `data-readonly` attributes for styling.\n *\n * Attachments\n * - Paste-to-attach: when `paste` is enabled, pasting files adds attachments.\n * - Additions and rejections are announced through a polite live region.\n *\n * Dropzone\n * - When `dropzone` is true, enables drag-and-drop file uploads.\n * - Visual feedback via `data-drop-active` attribute during drag operations.\n *\n * Accessibility\n * - Consumers should label the `Textarea` via `aria-label`/`aria-labelledby`.\n */\ninterface RootProps extends ComponentPropsWithout<'div', RemovedProps | 'onSubmit' | 'color'>, ChatbarRootBaseProps {}\n\nconst Root = React.forwardRef<RootElement, RootProps>((props, forwardedRef) => {\n const {\n className,\n style,\n children,\n value: valueProp,\n defaultValue = '',\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n expandOn = 'both',\n minLines = 3,\n maxLines = 6,\n sendMode = 'whenDirty',\n disabled,\n readOnly,\n onSubmit,\n size = '2',\n variant,\n color,\n radius,\n panelBackground,\n material,\n width,\n maxWidth,\n attachments: attachmentsProp,\n defaultAttachments,\n onAttachmentsChange,\n accept,\n multiple = true,\n maxAttachments,\n maxFileSize,\n paste = true,\n pasteAccept,\n clearOnSubmit = true,\n onAttachmentReject,\n dropzone = true,\n apiRef,\n onBlurCapture,\n notices,\n context,\n ...divProps\n } = props;\n const effectiveMaterial = material || panelBackground;\n\n const isValueControlled = valueProp != null;\n const [valueUncontrolled, setValueUncontrolled] = React.useState<string>(defaultValue);\n const value = isValueControlled ? valueProp : valueUncontrolled;\n\n const isOpenControlled = openProp != null;\n const [openUncontrolled, setOpenUncontrolled] = React.useState<boolean>(defaultOpen);\n const open = isOpenControlled ? openProp : openUncontrolled;\n\n // Treat `attachments` as controlled if the prop is provided, even if its value is `undefined`.\n // This avoids switching between controlled and uncontrolled when a consumer sets\n // `attachments={undefined}` to clear attachments. In that case we normalize to an empty array.\n const isAttachmentsControlled = 'attachments' in props;\n const [attachmentsUncontrolled, setAttachmentsUncontrolled] = React.useState<ChatbarAttachment[]>(() => defaultAttachments ?? []);\n const attachments = React.useMemo(\n () => (isAttachmentsControlled ? (attachmentsProp ?? []) : attachmentsUncontrolled),\n [isAttachmentsControlled, attachmentsProp, attachmentsUncontrolled],\n );\n\n // `id` changes on every announcement so identical messages still update the live region\n const [announcement, setAnnouncementState] = React.useState({ text: '', id: 0 });\n const announce = React.useCallback((text: string) => setAnnouncementState((prev) => ({ text, id: prev.id + 1 })), []);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const composedRootRef = useComposedRefs(forwardedRef, rootRef);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const fileInputRef = React.useRef<HTMLInputElement>(null);\n\n // Blur-collapse guards: `pickerOpenRef` is true while the native dialog is open,\n // `pressGuardRef` covers the gap between pointerdown on a trigger and its click\n // (Safari blurs the textarea before the click fires).\n const pickerOpenRef = React.useRef(false);\n const pressGuardRef = React.useRef(false);\n const pressGuardTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const pickerRef = React.useRef<{ patterns: string[]; multiple: boolean } | null>(null);\n\n const acceptKey = toArray(accept).join(',');\n const pasteAcceptKey = toArray(pasteAccept).join(',');\n const accepts = React.useMemo(() => toArray(acceptKey), [acceptKey]);\n const pasteAccepts = React.useMemo(() => (pasteAcceptKey ? toArray(pasteAcceptKey) : accepts), [pasteAcceptKey, accepts]);\n\n // Latest props/state for stable callbacks. Synced during render (not in an effect) so\n // child layout effects that call setOpen/setValue see this render's handlers.\n const snapshot = {\n value,\n attachments,\n accepts,\n pasteAccepts,\n multiple,\n maxAttachments,\n maxFileSize,\n disabled,\n readOnly,\n expandOn,\n isValueControlled,\n isOpenControlled,\n isAttachmentsControlled,\n onValueChange,\n onOpenChange,\n onAttachmentsChange,\n onAttachmentReject,\n onSubmit,\n };\n const latest = React.useRef(snapshot);\n // eslint-disable-next-line react-hooks/refs -- read only in callbacks/effects; see comment above\n latest.current = snapshot;\n\n // Attachments set during the current event, before Root re-renders. Cleared at the end\n // of the task so a controlled parent that rejects the change is not overridden.\n const pendingAttachmentsRef = React.useRef<ChatbarAttachment[] | null>(null);\n const getAttachments = React.useCallback(() => pendingAttachmentsRef.current ?? latest.current.attachments, []);\n\n const setOpen = React.useCallback((next: boolean) => {\n if (!latest.current.isOpenControlled) setOpenUncontrolled(next);\n latest.current.onOpenChange?.(next);\n }, []);\n\n const setValue = React.useCallback((next: string) => {\n if (!latest.current.isValueControlled) setValueUncontrolled(next);\n latest.current.onValueChange?.(next);\n }, []);\n\n const setAttachments = React.useCallback((next: ChatbarAttachment[]) => {\n // Back-to-back updates in one event must see each other\n pendingAttachmentsRef.current = next;\n queueMicrotask(() => {\n pendingAttachmentsRef.current = null;\n });\n if (!latest.current.isAttachmentsControlled) setAttachmentsUncontrolled(next);\n latest.current.onAttachmentsChange?.(next);\n }, []);\n\n // Object URLs Chatbar created and still owns\n const ownedUrlsRef = React.useRef<Set<string>>(new Set());\n\n const addFiles = React.useCallback(\n (files: File[], patterns: string[], multiple: boolean = latest.current.multiple): number => {\n const cfg = latest.current;\n if (cfg.disabled || cfg.readOnly || files.length === 0) return 0;\n\n const current = getAttachments();\n const next: ChatbarAttachment[] = [];\n const rejected: ChatbarAttachmentRejection[] = [];\n const remainingSlots = typeof cfg.maxAttachments === 'number' ? Math.max(cfg.maxAttachments - current.length, 0) : Infinity;\n const perActionLimit = multiple ? Infinity : 1;\n\n for (const file of files) {\n if (next.length >= remainingSlots || next.length >= perActionLimit) {\n rejected.push({ file, reason: 'count' });\n continue;\n }\n if (typeof cfg.maxFileSize === 'number' && file.size > cfg.maxFileSize) {\n rejected.push({ file, reason: 'size' });\n continue;\n }\n if (!matchesAccept(file, patterns)) {\n rejected.push({ file, reason: 'type' });\n continue;\n }\n const url = isImageLike(file.name, file.type) ? URL.createObjectURL(file) : undefined;\n if (url) ownedUrlsRef.current.add(url);\n next.push({ id: createAttachmentId(), name: file.name, size: file.size, type: file.type, file, url, status: 'idle' });\n }\n\n const messages: string[] = [];\n if (next.length > 0) {\n setAttachments(current.concat(next));\n if (cfg.expandOn !== 'none') setOpen(true);\n messages.push(`${plural(next.length, 'file')} attached.`);\n }\n if (rejected.length > 0) {\n cfg.onAttachmentReject?.(rejected);\n messages.push(`${plural(rejected.length, 'file')} could not be attached.`);\n }\n if (messages.length > 0) announce(messages.join(' '));\n return next.length;\n },\n [getAttachments, setAttachments, setOpen, announce],\n );\n\n const appendFiles = React.useCallback((files: File[]) => addFiles(files, latest.current.accepts), [addFiles]);\n const appendFilesFromPaste = React.useCallback((files: File[]) => addFiles(files, latest.current.pasteAccepts), [addFiles]);\n\n const removeAttachment = React.useCallback(\n (id: string) => {\n const current = getAttachments();\n const removed = current.find((a) => a.id === id);\n if (!removed) return;\n setAttachments(current.filter((a) => a.id !== id));\n announce(`Removed ${removed.name}.`);\n },\n [getAttachments, setAttachments, announce],\n );\n\n const submit = React.useCallback(\n (clear: boolean) => {\n const cfg = latest.current;\n if (cfg.disabled || cfg.readOnly) return false;\n const current = getAttachments();\n if (!hasText(cfg.value) && current.length === 0) return false;\n const payload = { value: cfg.value, attachments: current };\n // Hand preview URLs to the consumer only when they leave the chatbar; URLs still\n // rendered here stay owned so removing them later revokes them\n if (clear && cfg.onSubmit) {\n for (const att of current) if (att.url) ownedUrlsRef.current.delete(att.url);\n }\n cfg.onSubmit?.(payload);\n if (clear) {\n setValue('');\n setAttachments([]);\n }\n return true;\n },\n [getAttachments, setValue, setAttachments],\n );\n\n // Revoke owned object URLs that are no longer referenced by current attachments\n React.useEffect(() => {\n const owned = ownedUrlsRef.current;\n if (owned.size === 0) return;\n const current = new Set(attachments.map((a) => a.url));\n for (const url of Array.from(owned)) {\n if (!current.has(url)) {\n URL.revokeObjectURL(url);\n owned.delete(url);\n }\n }\n }, [attachments]);\n\n // On unmount, revoke URLs only when Chatbar owns the attachment list;\n // controlled attachments may still be rendered by the parent.\n React.useEffect(() => {\n const owned = ownedUrlsRef.current;\n return () => {\n if (latest.current.isAttachmentsControlled) return;\n for (const url of Array.from(owned)) URL.revokeObjectURL(url);\n owned.clear();\n };\n }, []);\n\n const openFilePicker = React.useCallback((options?: FilePickerOptions) => {\n const cfg = latest.current;\n const input = fileInputRef.current;\n // The picker guard takes over from the press guard\n clearTimeout(pressGuardTimerRef.current);\n pressGuardRef.current = false;\n if (!input || cfg.disabled || cfg.readOnly) return;\n const patterns = options?.accept != null ? toArray(options.accept) : cfg.accepts;\n const multiple = options?.multiple ?? cfg.multiple;\n pickerRef.current = { patterns, multiple };\n input.accept = patterns.join(',');\n input.multiple = multiple;\n pickerOpenRef.current = true;\n input.click();\n // Browsers block the dialog outside a user gesture; if the window kept focus,\n // no dialog opened and no focus/cancel/change event will clear the guard\n setTimeout(() => {\n if (document.hasFocus()) pickerOpenRef.current = false;\n }, 1000);\n }, []);\n\n const beginFilePickerPress = React.useCallback(() => {\n // On touch (notably iOS), the compatibility mousedown, blur and click arrive in later\n // tasks than pointerup, so hold the guard until the click or a timeout\n pressGuardRef.current = true;\n clearTimeout(pressGuardTimerRef.current);\n pressGuardTimerRef.current = setTimeout(() => {\n pressGuardRef.current = false;\n }, 800);\n }, []);\n\n React.useEffect(() => () => clearTimeout(pressGuardTimerRef.current), []);\n\n // Clear the picker guard when the dialog closes, whichever way it closes\n React.useEffect(() => {\n const input = fileInputRef.current;\n const reset = () => {\n pickerOpenRef.current = false;\n };\n window.addEventListener('focus', reset);\n input?.addEventListener('cancel', reset);\n return () => {\n window.removeEventListener('focus', reset);\n input?.removeEventListener('cancel', reset);\n };\n }, []);\n\n const handleFileInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const input = event.currentTarget;\n const files = Array.from(input.files ?? []);\n const picker = pickerRef.current;\n addFiles(files, picker?.patterns ?? latest.current.accepts, picker?.multiple);\n pickerOpenRef.current = false;\n pickerRef.current = null;\n // Reset so selecting the same file again still fires change\n input.value = '';\n },\n [addFiles],\n );\n\n const handleBlurCapture = React.useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n onBlurCapture?.(event);\n const cfg = latest.current;\n const rootEl = rootRef.current;\n if (!rootEl || cfg.expandOn === 'none') return;\n const nextTarget = event.relatedTarget as Node | null;\n if (nextTarget && rootEl.contains(nextTarget)) return;\n if (pickerOpenRef.current || pressGuardRef.current) return;\n if (!hasText(cfg.value) && getAttachments().length === 0) setOpen(false);\n },\n [onBlurCapture, setOpen, getAttachments],\n );\n\n const handleDrop = React.useCallback((files: File[]) => {\n appendFiles(files);\n }, [appendFiles]);\n\n // Validation happens in addFiles so drop, paste and picker share one rule set\n const { getRootProps, isDragActive } = useDropzone({\n onDrop: handleDrop,\n // Drop any earlier message so it is not re-announced when the drag hint goes away\n onDragEnter: () => announce(''),\n noClick: true,\n noKeyboard: true,\n // Textarea handles paste itself; letting the dropzone see it attaches twice\n noPaste: true,\n disabled: !dropzone || disabled || readOnly,\n });\n const dragActive = dropzone && isDragActive;\n\n React.useImperativeHandle(\n apiRef,\n () => ({\n focusTextarea: () => textareaRef.current?.focus({ preventScroll: true }),\n openFilePicker: () => openFilePicker(),\n }),\n [openFilePicker],\n );\n\n // Click-to-focus: focus textarea when clicking non-interactive areas inside the container\n const handleContainerPointerDown = React.useCallback(\n (event: React.PointerEvent) => {\n if (disabled) return;\n if (event.pointerType === 'mouse' && event.button !== 0) return;\n const target = event.target;\n if (target instanceof Element && target.closest('button, [role=\"button\"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex=\"-1\"])')) return;\n event.preventDefault();\n textareaRef.current?.focus({ preventScroll: true });\n },\n [disabled],\n );\n\n const contextValue = React.useMemo<ChatbarContextValue>(\n () => ({\n open,\n setOpen,\n setValue,\n size,\n expandOn,\n minLines,\n maxLines,\n sendMode,\n disabled,\n readOnly,\n paste,\n clearOnSubmit,\n multiple,\n textareaRef,\n attachments,\n removeAttachment,\n submit,\n appendFiles,\n appendFilesFromPaste,\n openFilePicker,\n beginFilePickerPress,\n }),\n [\n open, setOpen, setValue, size, expandOn, minLines, maxLines, sendMode, disabled, readOnly, paste,\n clearOnSubmit, multiple, attachments, removeAttachment, submit, appendFiles, appendFilesFromPaste,\n openFilePicker, beginFilePickerPress,\n ],\n );\n\n return (\n <ChatbarContext.Provider value={contextValue}>\n <ChatbarValueContext.Provider value={value}>\n <LazyMotion features={domAnimation}>\n <MotionConfig reducedMotion=\"user\">\n <div\n {...divProps}\n ref={composedRootRef}\n className={classNames('rt-ChatbarRoot', `rt-r-size-${size}`, className)}\n style={{ position: 'relative', width, maxWidth, ...style }}\n data-state={open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n data-readonly={readOnly ? '' : undefined}\n data-drop-active={dragActive ? '' : undefined}\n data-accent-color={color}\n data-radius={radius}\n data-panel-background={effectiveMaterial}\n data-material={effectiveMaterial}\n onBlurCapture={handleBlurCapture}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n tabIndex={-1}\n aria-hidden\n style={{ display: 'none' }}\n onChange={handleFileInputChange}\n />\n {notices ? (\n <div className=\"rt-ChatbarNotices\">\n <NoticeSizeContext.Provider value={size}>{notices}</NoticeSizeContext.Provider>\n </div>\n ) : null}\n <div {...(dropzone ? getRootProps() : {})} style={{ width: '100%', flex: '1 1 auto', minHeight: 0 }} onPointerDown={handleContainerPointerDown}>\n <m.div\n className={classNames('rt-ChatbarBox', `rt-variant-${parseVariant(variant ?? 'raised')}`)}\n style={{ position: 'relative' }}\n data-accent-color={color}\n data-radius={radius}\n data-panel-background={effectiveMaterial}\n data-material={effectiveMaterial}\n layout\n transition={LAYOUT_TRANSITION}\n >\n <m.div className=\"rt-ChatbarGrid\" layout=\"position\" transition={LAYOUT_TRANSITION}>\n {children}\n </m.div>\n {dragActive && (\n <div className=\"rt-ChatbarDropOverlay\" aria-hidden>\n <div className=\"rt-ChatbarDropContent\">\n <Text emphasis=\"medium\" size={size} weight=\"medium\">\n Drop files here to attach\n </Text>\n </div>\n </div>\n )}\n </m.div>\n </div>\n {context ? (\n <Text as=\"div\" size={size === '3' ? '2' : '1'} emphasis=\"medium\" className=\"rt-ChatbarContext\">\n {context}\n </Text>\n ) : null}\n <VisuallyHidden role=\"status\" aria-live=\"polite\">\n {dragActive ? 'Drop files here to attach.' : <span key={announcement.id}>{announcement.text}</span>}\n </VisuallyHidden>\n </div>\n </MotionConfig>\n </LazyMotion>\n </ChatbarValueContext.Provider>\n </ChatbarContext.Provider>\n );\n});\nRoot.displayName = 'Chatbar.Root';\n\n/**\n * Multi-line text input for Chatbar.\n * - Uses onChange to control value and avoid duplicate updates.\n * - Auto-resizes between minLines and maxLines.\n * - Expands on focus/overflow per `expandOn`.\n * - Paste-to-attach: when `paste` is enabled on Root, pasting files adds attachments.\n * - Provide `aria-label` or `aria-labelledby` for an accessible name.\n */\ninterface TextareaProps extends Omit<React.ComponentPropsWithoutRef<'textarea'>, 'size' | 'rows' | 'value' | 'defaultValue'> {\n asChild?: boolean;\n /**\n * When true, pressing Enter submits (Shift+Enter inserts a newline).\n * Works with every `sendMode`. Defaults to false.\n */\n submitOnEnter?: boolean;\n}\n\n/**\n * Chatbar multi-line text input.\n *\n * Behavior\n * - Controls the Chatbar value via React onChange.\n * - Auto-resizes between minLines and maxLines in a single layout effect, which\n * also opens the Chatbar when content overflows the compact height and\n * `expandOn` is `overflow` or `both`.\n * - Consumer handlers run first; calling `preventDefault` in `onKeyDown` or\n * `onPaste` skips the built-in submit or attach behavior.\n *\n * Accessibility\n * - Consumers should provide labeling via aria-label or aria-labelledby\n * on this component, as no implicit label is rendered.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, forwardedRef) => {\n const {\n className,\n style,\n asChild,\n onFocus,\n onChange,\n onPaste,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n submitOnEnter = false,\n ...textareaProps\n } = props;\n const ctx = useChatbarContext();\n const value = React.useContext(ChatbarValueContext);\n const { open, minLines, maxLines, expandOn, disabled, readOnly, setOpen, setValue, textareaRef, paste, appendFilesFromPaste, size, submit, clearOnSubmit } = ctx;\n const composedRef = useComposedRefs(forwardedRef, textareaRef);\n\n // Cached metrics to avoid repeated getComputedStyle calls\n const lineHeightRef = React.useRef(0);\n const paddingRef = React.useRef(0);\n const composingRef = React.useRef(false);\n\n const sizingRef = React.useRef({ open, minLines, maxLines });\n // Declared before the sizing effect so it runs first in the same commit\n useIsomorphicLayoutEffect(() => {\n sizingRef.current = { open, minLines, maxLines };\n }, [open, minLines, maxLines]);\n\n const recomputeMetrics = React.useCallback(() => {\n const el = textareaRef.current;\n if (!el) return;\n const computedStyle = window.getComputedStyle(el);\n lineHeightRef.current = parseFloat(computedStyle.lineHeight) || 20;\n paddingRef.current = (parseFloat(computedStyle.paddingTop) || 0) + (parseFloat(computedStyle.paddingBottom) || 0);\n }, [textareaRef]);\n\n // Sizes `el` for the given open state; caller must have set height to 'auto' first\n const applyHeight = React.useCallback((el: HTMLTextAreaElement, isOpen: boolean) => {\n const { minLines: min, maxLines: max } = sizingRef.current;\n const lineHeight = lineHeightRef.current;\n const padding = paddingRef.current;\n const minHeight = Math.ceil((isOpen ? min : 1) * lineHeight) + padding;\n const maxHeight = Math.ceil((isOpen ? max : 1) * lineHeight) + padding;\n const contentHeight = Math.max(el.scrollHeight, minHeight);\n el.style.height = `${Math.min(contentHeight, maxHeight)}px`;\n const overflowing = contentHeight > maxHeight;\n el.style.overflowY = overflowing ? 'auto' : 'hidden';\n el.style.maxHeight = overflowing ? `${maxHeight}px` : 'none';\n }, []);\n\n // Typography depends on size\n useIsomorphicLayoutEffect(() => {\n recomputeMetrics();\n }, [recomputeMetrics, size]);\n\n // Single place for sizing and overflow auto-open: one height reset, one scrollHeight read\n useIsomorphicLayoutEffect(() => {\n const el = textareaRef.current;\n if (!el) return;\n if (lineHeightRef.current === 0) recomputeMetrics();\n withoutPlaceholder(el, () => {\n el.style.height = 'auto';\n let isOpen = open;\n if (!open && (expandOn === 'overflow' || expandOn === 'both')) {\n const compactHeight = Math.ceil(lineHeightRef.current) + paddingRef.current;\n if (el.scrollHeight > compactHeight + 1) {\n isOpen = true;\n setOpen(true);\n }\n }\n applyHeight(el, isOpen);\n });\n }, [value, open, expandOn, minLines, maxLines, size, setOpen, textareaRef, recomputeMetrics, applyHeight]);\n\n // Width changes re-wrap text; re-measure only when the width actually changes\n React.useEffect(() => {\n const el = textareaRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return;\n let prevWidth = -1;\n const ro = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width ?? 0;\n if (width === prevWidth) return;\n const first = prevWidth === -1;\n prevWidth = width;\n if (first) return;\n recomputeMetrics();\n withoutPlaceholder(el, () => {\n el.style.height = 'auto';\n applyHeight(el, sizingRef.current.open);\n });\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, [textareaRef, recomputeMetrics, applyHeight]);\n\n // Dev-only warning if no accessible name is provided\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n const hasLabel = textareaProps['aria-label'] != null || textareaProps['aria-labelledby'] != null;\n if (!hasLabel) {\n console.warn('[Chatbar.Textarea] Provide aria-label or aria-labelledby to ensure the control has an accessible name.');\n }\n // warn only on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleFocus = React.useCallback<React.FocusEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onFocus?.(event);\n if (disabled || readOnly) return;\n if ((expandOn === 'focus' || expandOn === 'both') && !open) setOpen(true);\n },\n [disabled, readOnly, expandOn, open, setOpen, onFocus],\n );\n\n const handleChange = React.useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n (event) => {\n setValue(event.currentTarget.value);\n onChange?.(event);\n },\n [setValue, onChange],\n );\n\n const handlePaste = React.useCallback<React.ClipboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onPaste?.(event);\n if (event.defaultPrevented || !paste || disabled || readOnly) return;\n const files = Array.from(event.clipboardData?.items ?? [])\n .filter((item) => item.kind === 'file')\n .map((item) => item.getAsFile())\n .filter((f): f is File => !!f);\n if (files.length === 0) return;\n // Suppress the filename/text representation only when a file was actually attached\n if (appendFilesFromPaste(files) > 0) event.preventDefault();\n },\n [paste, disabled, readOnly, onPaste, appendFilesFromPaste],\n );\n\n const handleCompositionStart = React.useCallback<React.CompositionEventHandler<HTMLTextAreaElement>>(\n (event) => {\n composingRef.current = true;\n onCompositionStart?.(event);\n },\n [onCompositionStart],\n );\n\n const handleCompositionEnd = React.useCallback<React.CompositionEventHandler<HTMLTextAreaElement>>(\n (event) => {\n composingRef.current = false;\n onCompositionEnd?.(event);\n },\n [onCompositionEnd],\n );\n\n const handleKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !submitOnEnter) return;\n if (event.key !== 'Enter' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;\n // Safari fires the IME-confirming Enter after compositionend with keyCode 229\n if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n // Plain Enter never inserts a newline when submitOnEnter is on, even with nothing to send\n event.preventDefault();\n submit(clearOnSubmit);\n },\n [submitOnEnter, onKeyDown, submit, clearOnSubmit],\n );\n\n const Comp = asChild ? Slot : 'textarea';\n return (\n <m.div className={classNames('rt-ChatbarField', 'rt-ChatbarTextarea', className)} layout=\"position\" transition={LAYOUT_TRANSITION}>\n <Comp\n {...textareaProps}\n ref={composedRef}\n className=\"rt-ChatbarInput\"\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n disabled={disabled}\n readOnly={readOnly}\n rows={open ? minLines : 1}\n spellCheck={textareaProps.spellCheck ?? true}\n autoCorrect={textareaProps.autoCorrect ?? 'on'}\n style={style}\n />\n </m.div>\n );\n});\nTextarea.displayName = 'Chatbar.Textarea';\n\ninterface InlineSlotProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nconst InlineStart = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarInlineStart', className)}>\n {children}\n </Comp>\n );\n});\nInlineStart.displayName = 'Chatbar.InlineStart';\n\nconst InlineEnd = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarInlineEnd', className)}>\n {children}\n </Comp>\n );\n});\nInlineEnd.displayName = 'Chatbar.InlineEnd';\n\n/**\n * Renders a horizontally scrollable list of attachments above the inline row.\n * Hidden when empty unless `forceMount`. Override per-item with `renderAttachment`.\n * `Chatbar.Item`s passed as children follow the attachments in the same row.\n */\ninterface AttachmentsRowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n forceMount?: boolean;\n /** If provided, custom-render a tile; otherwise default tile is used */\n renderAttachment?: (attachment: ChatbarAttachment) => React.ReactNode;\n /** `Chatbar.Item`s: things the message refers to that are not files. */\n children?: React.ReactNode;\n}\n\nconst AttachmentsRow = React.forwardRef<HTMLDivElement, AttachmentsRowProps>((props, forwardedRef) => {\n const { asChild, forceMount, renderAttachment, className, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const hasItems = React.Children.toArray(children).length > 0;\n if (ctx.attachments.length === 0 && !hasItems && !forceMount) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <m.div layout=\"position\" transition={LAYOUT_TRANSITION}>\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarAttachmentsRow', className)} role=\"list\" aria-label={divProps['aria-label'] ?? 'Attachments'}>\n <ScrollArea className=\"rt-ChatbarScrollArea\" scrollbars=\"horizontal\" size=\"1\">\n <Flex align=\"center\" gap=\"2\" minWidth=\"fit-content\">\n {ctx.attachments.map((att) => (\n <Attachment key={att.id} attachment={att} asChild={!!renderAttachment}>\n {renderAttachment?.(att)}\n </Attachment>\n ))}\n {children}\n </Flex>\n </ScrollArea>\n </Comp>\n </m.div>\n );\n});\nAttachmentsRow.displayName = 'Chatbar.AttachmentsRow';\n\n/**\n * Moves focus off a pill that is about to unmount, to the next pill's remove\n * button, the previous one's, or the text, so keyboard users are not dropped\n * to <body>.\n */\nfunction moveFocusOffPill(button: HTMLButtonElement, textareaRef: React.RefObject<HTMLTextAreaElement | null>) {\n const pill = button.closest('[role=\"listitem\"]');\n const pills = pill?.parentElement ? Array.from(pill.parentElement.children) : [];\n const index = pill ? pills.indexOf(pill) : -1;\n const neighbour = pills[index + 1] ?? pills[index - 1];\n const nextButton = neighbour?.querySelector<HTMLButtonElement>('.rt-ChatbarItemRemove');\n if (nextButton) nextButton.focus();\n else textareaRef.current?.focus({ preventScroll: true });\n}\n\n/** The pill an attachment and an item share: a lead tile, a label and \u00D7. */\nconst Pill: React.FC<{\n lead: React.ReactNode;\n leadKind: 'image' | 'icon';\n label: React.ReactNode;\n /** Read after the label by screen readers only, e.g. a file's size. */\n detail?: string;\n removeLabel: string;\n onRemove?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n}> = ({ lead, leadKind, label, detail, removeLabel, onRemove }) => {\n const ctx = useChatbarContext();\n return (\n <>\n <span className=\"rt-ChatbarItemLead\" data-kind={leadKind} aria-hidden>\n {lead}\n </span>\n <Text className=\"rt-ChatbarItemLabel\" size={ctx.size} truncate>\n {label}\n {detail ? <VisuallyHidden>, {detail}</VisuallyHidden> : null}\n </Text>\n {onRemove && (\n <IconButton className=\"rt-ChatbarItemRemove\" aria-label={removeLabel} size=\"1\" variant=\"ghost\" color=\"gray\" onClick={onRemove}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\n/** Default tile renderer for a single attachment. */\ninterface AttachmentProps extends React.ComponentPropsWithoutRef<'div'> {\n attachment: ChatbarAttachment;\n asChild?: boolean;\n}\n\nconst STATUS_LABEL: Partial<Record<AttachmentStatus, string>> = { uploading: 'uploading', error: 'failed to upload' };\n\nconst Attachment = React.forwardRef<HTMLDivElement, AttachmentProps>((props, forwardedRef) => {\n const { attachment, asChild, className, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const Comp = asChild ? Slot : 'div';\n const isImage = !!attachment.url && isImageLike(attachment.name, attachment.type);\n const sizeLabel = `${Math.ceil(attachment.size / 1024)} KB`;\n const statusLabel = attachment.status ? STATUS_LABEL[attachment.status] : undefined;\n const locked = ctx.disabled || ctx.readOnly;\n\n const handleRemove = (event: React.MouseEvent<HTMLButtonElement>) => {\n moveFocusOffPill(event.currentTarget, ctx.textareaRef);\n ctx.removeAttachment(attachment.id);\n };\n\n const lead =\n attachment.status === 'uploading' ? (\n <Spinner size=\"1\" />\n ) : isImage ? (\n <img className=\"rt-ChatbarAttachmentImage\" src={attachment.url} alt=\"\" />\n ) : (\n <FileTextIcon />\n );\n\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames(children ? 'rt-ChatbarAttachment' : 'rt-ChatbarAttachment rt-ChatbarItem', className)}\n role=\"listitem\"\n data-kind={isImage ? 'image' : 'file'}\n data-status={attachment.status}\n title={attachment.name}\n >\n {children ?? (\n <Pill\n lead={lead}\n leadKind={isImage && attachment.status !== 'uploading' ? 'image' : 'icon'}\n label={attachment.name}\n detail={statusLabel ? `${sizeLabel}, ${statusLabel}` : sizeLabel}\n removeLabel={`Remove ${attachment.name}`}\n onRemove={locked ? undefined : handleRemove}\n />\n )}\n </Comp>\n );\n});\nAttachment.displayName = 'Chatbar.Attachment';\n\n/**\n * Something the message refers to that is not a file: a scene object, a\n * picked mode, a selection. The same pill as an attachment, placed in\n * `Chatbar.AttachmentsRow` as a child. The app owns the list, so removing one\n * calls `onRemove` and nothing else; leave it out for a pill that cannot be\n * removed.\n */\ninterface ItemProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children' | 'color'> {\n /** The label. Also names the remove button: \"Remove {label}\". */\n children: string;\n /** Drawn in the lead tile, tinted with `color`. */\n icon?: React.ReactNode;\n /** A thumbnail for the lead tile, in place of the icon. */\n image?: string;\n /** Tint of the icon tile. Defaults to gray. */\n color?: (typeof accentColors)[number];\n onRemove?: () => void;\n /** Overrides the remove button's label. */\n removeLabel?: string;\n}\n\nconst Item = React.forwardRef<HTMLDivElement, ItemProps>((props, forwardedRef) => {\n const { children, icon, image, color, onRemove, removeLabel, className, ...divProps } = props;\n const ctx = useChatbarContext();\n const locked = ctx.disabled || ctx.readOnly;\n\n const handleRemove = onRemove\n ? (event: React.MouseEvent<HTMLButtonElement>) => {\n moveFocusOffPill(event.currentTarget, ctx.textareaRef);\n onRemove();\n }\n : undefined;\n\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarItem', className)}\n role=\"listitem\"\n data-accent-color={image ? undefined : (color ?? 'gray')}\n title={children}\n >\n <Pill\n lead={image ? <img className=\"rt-ChatbarAttachmentImage\" src={image} alt=\"\" /> : icon}\n leadKind={image ? 'image' : 'icon'}\n label={children}\n removeLabel={removeLabel ?? `Remove ${children}`}\n onRemove={locked ? undefined : handleRemove}\n />\n </div>\n );\n});\nItem.displayName = 'Chatbar.Item';\n\ninterface AttachTriggerProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n /** Overrides Root `accept` for files chosen through this trigger */\n accept?: string | string[];\n multiple?: boolean;\n}\n\nconst AttachTrigger = React.forwardRef<HTMLButtonElement, AttachTriggerProps>((props, forwardedRef) => {\n const { asChild, accept, multiple, disabled: disabledProp, onPointerDown, onClick, ...buttonProps } = props;\n const ctx = useChatbarContext();\n const disabled = disabledProp || ctx.disabled || ctx.readOnly;\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n {...buttonProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarAttachTrigger', buttonProps.className)}\n type={buttonProps.type ?? 'button'}\n aria-label={buttonProps['aria-label'] ?? 'Add attachments'}\n disabled={disabled}\n onPointerDown={(event: React.PointerEvent<HTMLButtonElement>) => {\n onPointerDown?.(event);\n if (!disabled && !event.defaultPrevented) ctx.beginFilePickerPress();\n }}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (disabled || event.defaultPrevented) return;\n ctx.openFilePicker({ accept, multiple });\n }}\n />\n );\n});\nAttachTrigger.displayName = 'Chatbar.AttachTrigger';\n\ninterface RowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nconst Row = React.forwardRef<HTMLDivElement, RowProps>((props, forwardedRef) => {\n const { asChild, children, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (!ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <m.div layout=\"position\" transition={LAYOUT_TRANSITION}>\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarRow', className)}>\n <Flex align=\"center\" justify=\"between\" width=\"100%\">\n {children}\n </Flex>\n </Comp>\n </m.div>\n );\n});\nRow.displayName = 'Chatbar.Row';\n\ntype RowSlotProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst RowStart = React.forwardRef<HTMLDivElement, RowSlotProps>((props, forwardedRef) => {\n const { className, ...divProps } = props;\n return <div {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarRowStart', className)} />;\n});\nRowStart.displayName = 'Chatbar.RowStart';\n\nconst RowEnd = React.forwardRef<HTMLDivElement, RowSlotProps>((props, forwardedRef) => {\n const { className, ...divProps } = props;\n return <div {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarRowEnd', className)} />;\n});\nRowEnd.displayName = 'Chatbar.RowEnd';\n\ntype SendStatus = 'ready' | 'submitted' | 'streaming' | 'error';\n\ntype SendProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby' | 'variant' | 'emphasis'> &\n ButtonRankProps & {\n /** Optional override for accessible name. Defaults to \"Send\". */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n asChild?: boolean;\n /** Clear message and attachments after sending. Defaults to Root `clearOnSubmit`. */\n clearOnSend?: boolean;\n /**\n * What the button means. `ready` sends. While a reply is `submitted` or `streaming` and the\n * box is empty, the button STOPS the reply (`onStop`); with a draft in the box it still sends,\n * and the app decides whether sending interrupts the reply. After an `error`, an empty box\n * makes it RETRY (`onRetry`). Default `ready`.\n */\n status?: SendStatus;\n /** Called when the button is pressed to stop a reply. */\n onStop?: () => void;\n /** Called when the button is pressed to retry after an error. */\n onRetry?: () => void;\n /** Accessible name while it stops. Default \"Stop\". */\n stopLabel?: string;\n /** Accessible name while it retries. Default \"Retry\". */\n retryLabel?: string;\n /** Glyph while it stops. Defaults to a square, or a spinner while `submitted`. */\n stopIcon?: React.ReactNode;\n /** Glyph while it retries. */\n retryIcon?: React.ReactNode;\n};\n\nconst Send = React.forwardRef<HTMLButtonElement, SendProps>((props, forwardedRef) => {\n const {\n asChild,\n clearOnSend,\n disabled,\n children,\n style,\n className,\n size: sizeProp,\n variant: variantProp,\n emphasis,\n tabIndex,\n onClick,\n status = 'ready',\n onStop,\n onRetry,\n stopLabel = 'Stop',\n retryLabel = 'Retry',\n stopIcon,\n retryIcon,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...buttonProps\n } = props;\n const ctx = useChatbarContext();\n const value = React.useContext(ChatbarValueContext);\n\n const hasContent = hasText(value) || ctx.attachments.length > 0;\n const running = status === 'submitted' || status === 'streaming';\n const mode: 'send' | 'stop' | 'retry' = hasContent ? 'send' : running ? 'stop' : status === 'error' ? 'retry' : 'send';\n\n if (ctx.sendMode === 'never' && mode === 'send') return null;\n\n const visible = mode !== 'send' || ctx.sendMode === 'always' || hasContent;\n const inactive = mode === 'send' ? disabled || ctx.disabled || ctx.readOnly || !hasContent : disabled || ctx.disabled;\n\n const sendName = ariaLabel ?? 'Send';\n const labelProps: { 'aria-label': string } | { 'aria-labelledby': string } =\n mode === 'stop' ? { 'aria-label': stopLabel } : mode === 'retry' ? { 'aria-label': retryLabel } : ariaLabelledby ? { 'aria-labelledby': ariaLabelledby } : { 'aria-label': sendName };\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || inactive) return;\n if (mode === 'stop') {\n onStop?.();\n return;\n }\n if (mode === 'retry') {\n onRetry?.();\n return;\n }\n const clear = clearOnSend ?? ctx.clearOnSubmit;\n // Clearing hides and disables this button; keep keyboard focus in the composer\n if (ctx.submit(clear) && clear) ctx.textareaRef.current?.focus({ preventScroll: true });\n };\n\n const glyph =\n mode === 'stop' ? (\n stopIcon ?? (status === 'submitted' ? <Spinner size={ctx.size} /> : (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2\" />\n </svg>\n ))\n ) : mode === 'retry' ? (\n retryIcon ?? (\n <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>\n <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n )\n ) : (\n children ?? (\n <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>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n )\n );\n\n return (\n <IconButton\n {...buttonProps}\n ref={forwardedRef}\n size={sizeProp ?? ctx.size}\n {...(emphasis ? { emphasis } : { variant: variantProp ?? (ctx.open || mode !== 'send' ? 'solid' : 'ghost') })}\n disabled={inactive}\n className={classNames('rt-ChatbarSend', className)}\n style={{ opacity: visible ? 1 : 0, pointerEvents: visible ? undefined : 'none', ...style }}\n // Hidden Send must not be reachable by keyboard or announced\n aria-hidden={visible ? undefined : true}\n tabIndex={visible ? tabIndex : -1}\n asChild={asChild}\n onClick={handleClick}\n data-status={status}\n data-mode={mode}\n {...labelProps}\n >\n {glyph}\n </IconButton>\n );\n});\nSend.displayName = 'Chatbar.Send';\n\nexport { Root, Textarea, InlineStart, InlineEnd, AttachmentsRow, Attachment, Item, AttachTrigger, Row, RowStart, RowEnd, Send };\nexport type {\n RootProps as ChatbarRootProps,\n TextareaProps as ChatbarTextareaProps,\n InlineSlotProps as ChatbarInlineSlotProps,\n AttachmentsRowProps as ChatbarAttachmentsRowProps,\n AttachmentProps as ChatbarAttachmentProps,\n ItemProps as ChatbarItemProps,\n AttachTriggerProps as ChatbarAttachTriggerProps,\n RowProps as ChatbarRowProps,\n RowSlotProps as ChatbarRowSlotProps,\n SendProps as ChatbarSendProps,\n ChatbarAttachment,\n ChatbarAttachmentRejection,\n ChatbarRejectReason,\n ChatbarSubmitPayload,\n AttachmentStatus as ChatbarAttachmentStatus,\n ExpandOn as ChatbarExpandOn,\n SendMode as ChatbarSendMode,\n SendStatus as ChatbarSendStatus,\n};\n"],
|
|
5
|
+
"mappings": "0cAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,mBAAAE,GAAA,eAAAC,GAAA,mBAAAC,GAAA,cAAAC,GAAA,gBAAAC,GAAA,SAAAC,GAAA,SAAAC,GAAA,QAAAC,GAAA,WAAAC,GAAA,aAAAC,GAAA,SAAAC,GAAA,aAAAC,KACA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,cAAAC,GAAY,gBAAAC,GAAc,gBAAAC,GAAc,KAAAC,OAAS,eAC1D,OAAS,mBAAAC,OAAuB,oBAChC,OAAS,eAAAC,OAAmB,iBAiB5B,IAAMC,GAA4B,OAAO,OAAW,IAAoB,kBAAwB,YAoBhG,SAASC,GAAmBC,EAAyBC,EAA2B,CAC9E,GAAM,C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sRow", "InlineEnd", "InlineStart", "Item", "Root", "Row", "RowEnd", "RowStart", "Send", "Textarea", "React", "classNames", "LazyMotion", "MotionConfig", "domAnimation", "m", "useComposedRefs", "useDropzone", "useIsomorphicLayoutEffect", "withoutPlaceholder", "el", "measure", "placeholder", "LAYOUT_TRANSITION", "ChatbarContext", "ChatbarValueContext", "useChatbarContext", "ctx", "toArray", "val", "s", "matchesAccept", "file", "patterns", "mime", "name", "patRaw", "pat", "type", "subtype", "fmType", "fmSubtype", "IMAGE_EXT_RE", "isImageLike", "hasText", "value", "plural", "n", "word", "attachmentCounter", "createAttachmentId", "Root", "props", "forwardedRef", "className", "style", "children", "valueProp", "defaultValue", "onValueChange", "openProp", "defaultOpen", "onOpenChange", "expandOn", "minLines", "maxLines", "sendMode", "disabled", "readOnly", "onSubmit", "size", "variant", "color", "radius", "panelBackground", "material", "width", "maxWidth", "attachmentsProp", "defaultAttachments", "onAttachmentsChange", "accept", "multiple", "maxAttachments", "maxFileSize", "paste", "pasteAccept", "clearOnSubmit", "onAttachmentReject", "dropzone", "apiRef", "onBlurCapture", "notices", "context", "divProps", "effectiveMaterial", "isValueControlled", "valueUncontrolled", "setValueUncontrolled", "isOpenControlled", "openUncontrolled", "setOpenUncontrolled", "open", "isAttachmentsControlled", "attachmentsUncontrolled", "setAttachmentsUncontrolled", "attachments", "announcement", "setAnnouncementState", "announce", "text", "prev", "rootRef", "composedRootRef", "useComposedRefs", "textareaRef", "fileInputRef", "pickerOpenRef", "pressGuardRef", "pressGuardTimerRef", "pickerRef", "acceptKey", "pasteAcceptKey", "accepts", "pasteAccepts", "snapshot", "latest", "pendingAttachmentsRef", "getAttachments", "setOpen", "next", "setValue", "setAttachments", "ownedUrlsRef", "addFiles", "files", "cfg", "current", "rejected", "remainingSlots", "perActionLimit", "url", "messages", "appendFiles", "appendFilesFromPaste", "removeAttachment", "id", "removed", "a", "submit", "clear", "payload", "att", "owned", "openFilePicker", "options", "input", "beginFilePickerPress", "reset", "handleFileInputChange", "event", "picker", "handleBlurCapture", "rootEl", "nextTarget", "handleDrop", "getRootProps", "isDragActive", "useDropzone", "dragActive", "handleContainerPointerDown", "target", "contextValue", "LazyMotion", "domAnimation", "MotionConfig", "classNames", "NoticeSizeContext", "m", "parseVariant", "Text", "VisuallyHidden", "Textarea", "asChild", "onFocus", "onChange", "onPaste", "onKeyDown", "onCompositionStart", "onCompositionEnd", "submitOnEnter", "textareaProps", "composedRef", "lineHeightRef", "paddingRef", "composingRef", "sizingRef", "recomputeMetrics", "computedStyle", "applyHeight", "isOpen", "min", "max", "lineHeight", "padding", "minHeight", "maxHeight", "contentHeight", "overflowing", "compactHeight", "prevWidth", "ro", "entries", "first", "handleFocus", "handleChange", "handlePaste", "item", "f", "handleCompositionStart", "handleCompositionEnd", "handleKeyDown", "Comp", "Slot", "InlineStart", "InlineEnd", "AttachmentsRow", "forceMount", "renderAttachment", "hasItems", "ScrollArea", "Flex", "Attachment", "moveFocusOffPill", "button", "pill", "pills", "index", "nextButton", "Pill", "lead", "leadKind", "label", "detail", "removeLabel", "onRemove", "IconButton", "CloseIcon", "STATUS_LABEL", "attachment", "isImage", "sizeLabel", "statusLabel", "locked", "handleRemove", "Spinner", "FileTextIcon", "Item", "icon", "image", "AttachTrigger", "disabledProp", "onPointerDown", "onClick", "buttonProps", "Row", "RowStart", "RowEnd", "Send", "clearOnSend", "sizeProp", "variantProp", "emphasis", "tabIndex", "status", "onStop", "onRetry", "stopLabel", "retryLabel", "stopIcon", "retryIcon", "ariaLabel", "ariaLabelledby", "hasContent", "mode", "visible", "inactive", "labelProps", "handleClick", "glyph"]
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Q}from"./chunk-IBF5U4QW.js";import{a as X,b as q,c as J}from"./chunk-3TIO3EMN.js";import{a as U}from"./chunk-
|
|
1
|
+
import{a as Q}from"./chunk-IBF5U4QW.js";import{a as X,b as q,c as J}from"./chunk-3TIO3EMN.js";import{a as U}from"./chunk-ADFUYK3U.js";import{a as w}from"./chunk-C7UXUTUF.js";import{a as T}from"./chunk-EUSMN3K7.js";import{a as W}from"./chunk-BXX2NVQD.js";import{a as R}from"./chunk-HIBX2EXV.js";import{a as j}from"./chunk-ERNM3KVF.js";import{a as F}from"./chunk-HFVD7W6R.js";import{a as v}from"./chunk-KJTEZVOF.js";import{b as V,c as x}from"./chunk-FISGGGPC.js";import{a as O}from"./chunk-F22ZRNWL.js";import{a as s}from"./chunk-7YIQV7VO.js";import{a as D}from"./chunk-GONBMSRL.js";import{a as i}from"./chunk-PXUQEA77.js";import{a as G}from"./chunk-IPHKKZYE.js";import*as e from"react";import{useCallbackRef as ie}from"radix-ui/internal";import{flushSync as re}from"react-dom";var Y=`
|
|
2
2
|
[contenteditable],
|
|
3
3
|
[role="combobox"],
|
|
4
4
|
[role="listbox"],
|
|
@@ -7,4 +7,4 @@ import{a as Q}from"./chunk-IBF5U4QW.js";import{a as X,b as q,c as J}from"./chunk
|
|
|
7
7
|
select,
|
|
8
8
|
textarea
|
|
9
9
|
`,se=e.forwardRef(({defaultOpen:n=!0,...o},r)=>{let[u,d]=e.useState(n),h=e.useRef(null),l=e.useRef(null);return e.useEffect(()=>{function C(c){let k=c.altKey||c.ctrlKey||c.shiftKey||c.metaKey,g=document.activeElement?.closest(Y);if(c.key?.toUpperCase()==="T"&&!k&&!g){let f=!1;re(()=>{d(H=>(f=!H,f))}),f?(l.current=document.activeElement,h.current?.focus()):l.current?.focus()}}return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[]),e.createElement(_,{...o,ref:r,triggerRef:h,open:u,shortcut:e.createElement(R,{content:"Press T to show/hide the Theme Panel",side:"bottom",sideOffset:6},e.createElement(G,{asChild:!0,size:"3",tabIndex:0,className:"rt-ThemePanelShortcut"},e.createElement("button",{type:"button",onClick:()=>d(C=>!C),ref:h,"aria-label":"Toggle the Theme Panel"},"T")))})});se.displayName="ThemePanel";var _=e.forwardRef((n,o)=>{let{open:r,onAppearanceChange:u,shortcut:d,triggerRef:h,...l}=n,C=V();return e.createElement(x,{asChild:!0,radius:"medium",scaling:"100%"},e.createElement(i,{direction:"column",position:"fixed",top:"0",right:"0",mr:{initial:"2",sm:"4"},mt:{initial:"2",sm:"4"},width:{initial:"360px"},maxHeight:{initial:"calc(100svh - var(--space-2) - var(--space-2))",sm:"calc(100svh - var(--space-4) - var(--space-4))"},maxWidth:{initial:"calc(100svw - var(--space-2) - var(--space-2))",sm:"calc(100svw - var(--space-4) - var(--space-4))"},inert:r?void 0:Q,...l,ref:o,style:{zIndex:999999999,overflow:"hidden",borderRadius:"var(--radius-4)",backgroundColor:"var(--color-panel-solid)",transformOrigin:"top center",transitionProperty:"transform, box-shadow",transitionDuration:"200ms",transitionTimingFunction:r?"ease-out":"ease-in",transform:r?"none":"translateX(105%)",boxShadow:r?"var(--shadow-5)":"var(--shadow-2)",...n.style}},e.createElement(D,null,e.createElement(T,{flexGrow:"1",p:{initial:"4",xs:"5"},position:"relative"},!!d&&e.createElement(T,{position:"absolute",top:"0",right:"0",m:"2"},d),e.createElement(ee,{onAppearanceChange:u,context:C})))))});_.displayName="ThemePanelImpl";var ee=e.forwardRef((n,o)=>{let{onAppearanceChange:r,context:u,...d}=n,h=V(),{appearance:l,onAppearanceChange:C,accentColor:c,onAccentColorChange:k,grayColor:g,onGrayColorChange:K,panelBackground:f,onPanelBackgroundChange:H,radius:M,onRadiusChange:te,scaling:Z,onScalingChange:ae}=u??h,[E,S]=e.useState(l==="inherit"?null:l),N=r!==void 0,$=ie(r),A=e.useCallback(t=>{let a=ce();if(l!=="inherit"){C(t);return}N?$(t):(S(t),de(t)),a()},[l,C,N,$]),I=O(c),z=g==="auto"?I:g,[ne,B]=e.useState("idle");async function oe(){let t={appearance:l===s.appearance.default?void 0:l,accentColor:c===s.accentColor.default?void 0:c,grayColor:g===s.grayColor.default?void 0:g,panelBackground:f===s.panelBackground.default?void 0:f,radius:M===s.radius.default?void 0:M,scaling:Z===s.scaling.default?void 0:Z},a=Object.keys(t).filter(p=>t[p]!==void 0).map(p=>`${p}="${t[p]}"`).join(" "),y=a?`<Theme ${a}>`:"<Theme>";B("copying"),await navigator.clipboard.writeText(y),B("copied"),setTimeout(()=>B("idle"),2e3)}return e.useEffect(()=>{function t(a){let y=a.altKey||a.ctrlKey||a.shiftKey||a.metaKey,p=document.activeElement?.closest(Y);a.key?.toUpperCase()==="D"&&!y&&!p&&A(E==="light"?"dark":"light")}return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[A,E]),e.useEffect(()=>{let t=document.documentElement,a=document.body;function y(){let L=t.classList.contains("dark")||t.classList.contains("dark-theme")||a.classList.contains("dark")||a.classList.contains("dark-theme");S(l==="inherit"?L?"dark":"light":l)}let p=new MutationObserver(function(L){L.forEach(function(le){le.attributeName==="class"&&y()})});return y(),l==="inherit"&&(p.observe(t,{attributes:!0}),p.observe(a,{attributes:!0})),()=>p.disconnect()},[l]),e.createElement(i,{direction:"column",gap:"5",...d,ref:o},e.createElement(F,{size:{initial:"3",sm:"5"},trim:"both",as:"h2"},"Theme"),e.createElement(i,{direction:"column",gap:"5"},e.createElement(P,null,e.createElement(b,{id:"accent-color-title"},"Accent color"),e.createElement(i,{wrap:"wrap",gap:"2",role:"group","aria-labelledby":"accent-color-title"},s.accentColor.values.map(t=>e.createElement(T,{asChild:!0,key:t},e.createElement("label",{className:"rt-ThemePanelSwatch","aria-label":m(t),style:{backgroundColor:`var(--${t}-9)`}},e.createElement(R,{content:`${m(t)}${c==="gray"&&z!=="gray"?` (${m(z)})`:""}`},e.createElement("input",{className:"rt-ThemePanelSwatchInput",type:"radio",name:"accentColor",value:t,checked:c===t,onChange:a=>k(a.target.value)}))))))),e.createElement(P,null,e.createElement(b,{id:"gray-color-title"},"Gray color"),e.createElement(i,{wrap:"wrap",gap:"2",role:"group","aria-labelledby":"gray-color-title"},s.grayColor.values.map(t=>e.createElement(i,{key:t,asChild:!0,align:"center",justify:"center"},e.createElement("label",{className:"rt-ThemePanelSwatch","aria-label":m(t),style:{backgroundColor:t==="auto"?`var(--${I}-9)`:t==="gray"?"var(--gray-9)":`var(--${t}-9)`,filter:t==="gray"?"saturate(0)":void 0}},e.createElement(R,{content:`${m(t)}${t==="auto"?` (${m(I)})`:""}`},e.createElement("input",{className:"rt-ThemePanelSwatchInput",type:"radio",name:"grayColor",value:t,checked:g===t,onChange:a=>K(a.target.value)}))))))),e.createElement(P,null,e.createElement(b,{id:"appearance-title"},"Appearance"),e.createElement(w,{columns:"2",gap:"2",role:"group","aria-labelledby":"appearance-title"},["light","dark"].map(t=>e.createElement("label",{key:t,className:"rt-ThemePanelRadioCard"},e.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"appearance",value:t,checked:E===t,onChange:a=>A(a.target.value)}),e.createElement(i,{align:"center",justify:"center",height:"32px",gap:"2"},t==="light"?e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -1px"}},e.createElement("path",{d:"M7.5 0C7.77614 0 8 0.223858 8 0.5V2.5C8 2.77614 7.77614 3 7.5 3C7.22386 3 7 2.77614 7 2.5V0.5C7 0.223858 7.22386 0 7.5 0ZM2.1967 2.1967C2.39196 2.00144 2.70854 2.00144 2.90381 2.1967L4.31802 3.61091C4.51328 3.80617 4.51328 4.12276 4.31802 4.31802C4.12276 4.51328 3.80617 4.51328 3.61091 4.31802L2.1967 2.90381C2.00144 2.70854 2.00144 2.39196 2.1967 2.1967ZM0.5 7C0.223858 7 0 7.22386 0 7.5C0 7.77614 0.223858 8 0.5 8H2.5C2.77614 8 3 7.77614 3 7.5C3 7.22386 2.77614 7 2.5 7H0.5ZM2.1967 12.8033C2.00144 12.608 2.00144 12.2915 2.1967 12.0962L3.61091 10.682C3.80617 10.4867 4.12276 10.4867 4.31802 10.682C4.51328 10.8772 4.51328 11.1938 4.31802 11.3891L2.90381 12.8033C2.70854 12.9986 2.39196 12.9986 2.1967 12.8033ZM12.5 7C12.2239 7 12 7.22386 12 7.5C12 7.77614 12.2239 8 12.5 8H14.5C14.7761 8 15 7.77614 15 7.5C15 7.22386 14.7761 7 14.5 7H12.5ZM10.682 4.31802C10.4867 4.12276 10.4867 3.80617 10.682 3.61091L12.0962 2.1967C12.2915 2.00144 12.608 2.00144 12.8033 2.1967C12.9986 2.39196 12.9986 2.70854 12.8033 2.90381L11.3891 4.31802C11.1938 4.51328 10.8772 4.51328 10.682 4.31802ZM8 12.5C8 12.2239 7.77614 12 7.5 12C7.22386 12 7 12.2239 7 12.5V14.5C7 14.7761 7.22386 15 7.5 15C7.77614 15 8 14.7761 8 14.5V12.5ZM10.682 10.682C10.8772 10.4867 11.1938 10.4867 11.3891 10.682L12.8033 12.0962C12.9986 12.2915 12.9986 12.608 12.8033 12.8033C12.608 12.9986 12.2915 12.9986 12.0962 12.8033L10.682 11.3891C10.4867 11.1938 10.4867 10.8772 10.682 10.682ZM5.5 7.5C5.5 6.39543 6.39543 5.5 7.5 5.5C8.60457 5.5 9.5 6.39543 9.5 7.5C9.5 8.60457 8.60457 9.5 7.5 9.5C6.39543 9.5 5.5 8.60457 5.5 7.5ZM7.5 4.5C5.84315 4.5 4.5 5.84315 4.5 7.5C4.5 9.15685 5.84315 10.5 7.5 10.5C9.15685 10.5 10.5 9.15685 10.5 7.5C10.5 5.84315 9.15685 4.5 7.5 4.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})):e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -1px"}},e.createElement("path",{d:"M2.89998 0.499976C2.89998 0.279062 2.72089 0.0999756 2.49998 0.0999756C2.27906 0.0999756 2.09998 0.279062 2.09998 0.499976V1.09998H1.49998C1.27906 1.09998 1.09998 1.27906 1.09998 1.49998C1.09998 1.72089 1.27906 1.89998 1.49998 1.89998H2.09998V2.49998C2.09998 2.72089 2.27906 2.89998 2.49998 2.89998C2.72089 2.89998 2.89998 2.72089 2.89998 2.49998V1.89998H3.49998C3.72089 1.89998 3.89998 1.72089 3.89998 1.49998C3.89998 1.27906 3.72089 1.09998 3.49998 1.09998H2.89998V0.499976ZM5.89998 3.49998C5.89998 3.27906 5.72089 3.09998 5.49998 3.09998C5.27906 3.09998 5.09998 3.27906 5.09998 3.49998V4.09998H4.49998C4.27906 4.09998 4.09998 4.27906 4.09998 4.49998C4.09998 4.72089 4.27906 4.89998 4.49998 4.89998H5.09998V5.49998C5.09998 5.72089 5.27906 5.89998 5.49998 5.89998C5.72089 5.89998 5.89998 5.72089 5.89998 5.49998V4.89998H6.49998C6.72089 4.89998 6.89998 4.72089 6.89998 4.49998C6.89998 4.27906 6.72089 4.09998 6.49998 4.09998H5.89998V3.49998ZM1.89998 6.49998C1.89998 6.27906 1.72089 6.09998 1.49998 6.09998C1.27906 6.09998 1.09998 6.27906 1.09998 6.49998V7.09998H0.499976C0.279062 7.09998 0.0999756 7.27906 0.0999756 7.49998C0.0999756 7.72089 0.279062 7.89998 0.499976 7.89998H1.09998V8.49998C1.09998 8.72089 1.27906 8.89997 1.49998 8.89997C1.72089 8.89997 1.89998 8.72089 1.89998 8.49998V7.89998H2.49998C2.72089 7.89998 2.89998 7.72089 2.89998 7.49998C2.89998 7.27906 2.72089 7.09998 2.49998 7.09998H1.89998V6.49998ZM8.54406 0.98184L8.24618 0.941586C8.03275 0.917676 7.90692 1.1655 8.02936 1.34194C8.17013 1.54479 8.29981 1.75592 8.41754 1.97445C8.91878 2.90485 9.20322 3.96932 9.20322 5.10022C9.20322 8.37201 6.82247 11.0878 3.69887 11.6097C3.45736 11.65 3.20988 11.6772 2.96008 11.6906C2.74563 11.702 2.62729 11.9535 2.77721 12.1072C2.84551 12.1773 2.91535 12.2458 2.98667 12.3128L3.05883 12.3795L3.31883 12.6045L3.50684 12.7532L3.62796 12.8433L3.81491 12.9742L3.99079 13.089C4.11175 13.1651 4.23536 13.2375 4.36157 13.3059L4.62496 13.4412L4.88553 13.5607L5.18837 13.6828L5.43169 13.7686C5.56564 13.8128 5.70149 13.8529 5.83857 13.8885C5.94262 13.9155 6.04767 13.9401 6.15405 13.9622C6.27993 13.9883 6.40713 14.0109 6.53544 14.0298L6.85241 14.0685L7.11934 14.0892C7.24637 14.0965 7.37436 14.1002 7.50322 14.1002C11.1483 14.1002 14.1032 11.1453 14.1032 7.50023C14.1032 7.25044 14.0893 7.00389 14.0623 6.76131L14.0255 6.48407C13.991 6.26083 13.9453 6.04129 13.8891 5.82642C13.8213 5.56709 13.7382 5.31398 13.6409 5.06881L13.5279 4.80132L13.4507 4.63542L13.3766 4.48666C13.2178 4.17773 13.0353 3.88295 12.8312 3.60423L12.6782 3.40352L12.4793 3.16432L12.3157 2.98361L12.1961 2.85951L12.0355 2.70246L11.8134 2.50184L11.4925 2.24191L11.2483 2.06498L10.9562 1.87446L10.6346 1.68894L10.3073 1.52378L10.1938 1.47176L9.95488 1.3706L9.67791 1.2669L9.42566 1.1846L9.10075 1.09489L8.83599 1.03486L8.54406 0.98184ZM10.4032 5.30023C10.4032 4.27588 10.2002 3.29829 9.83244 2.40604C11.7623 3.28995 13.1032 5.23862 13.1032 7.50023C13.1032 10.593 10.596 13.1002 7.50322 13.1002C6.63646 13.1002 5.81597 12.9036 5.08355 12.5522C6.5419 12.0941 7.81081 11.2082 8.74322 10.0416C8.87963 10.2284 9.10028 10.3497 9.34928 10.3497C9.76349 10.3497 10.0993 10.0139 10.0993 9.59971C10.0993 9.24256 9.84965 8.94373 9.51535 8.86816C9.57741 8.75165 9.63653 8.63334 9.6926 8.51332C9.88358 8.63163 10.1088 8.69993 10.35 8.69993C11.0403 8.69993 11.6 8.14028 11.6 7.44993C11.6 6.75976 11.0406 6.20024 10.3505 6.19993C10.3853 5.90487 10.4032 5.60464 10.4032 5.30023Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})),e.createElement(v,{size:"1",weight:"medium"},m(t))))))),e.createElement(P,null,e.createElement(b,{id:"radius-title"},"Radius"),e.createElement(i,{gap:"2",role:"group","aria-labelledby":"radius-title",wrap:"wrap"},s.radius.values.map(t=>e.createElement(i,{key:t,direction:"column",align:"center"},e.createElement("label",{className:"rt-ThemePanelRadioCard"},e.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"radius",id:`theme-panel-radius-${t}`,value:t,checked:M===t,onChange:a=>te(a.target.value)}),e.createElement(x,{asChild:!0,radius:t},e.createElement(T,{m:"3",width:{initial:"24px",sm:"32px"},height:{initial:"24px",sm:"32px"},style:{borderTopLeftRadius:t==="full"?"80%":"var(--radius-5)",backgroundImage:"linear-gradient(to bottom right, var(--accent-3), var(--accent-4))",borderTop:"2px solid var(--accent-a8)",borderLeft:"2px solid var(--accent-a8)"}}))),e.createElement(T,{asChild:!0,pt:"2"},e.createElement(v,{asChild:!0,size:"1",emphasis:"medium"},e.createElement("label",{htmlFor:`theme-panel-radius-${t}`},m(t)))))))),e.createElement(P,null,e.createElement(b,{id:"scaling-title"},"Scaling"),e.createElement(w,{columns:{initial:"repeat(3, 1fr)",sm:"5"},gap:"2",role:"group","aria-labelledby":"scaling-title"},s.scaling.values.map(t=>e.createElement("label",{key:t,className:"rt-ThemePanelRadioCard","aria-label":`Scaling ${t}`},e.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"scaling",value:t,checked:Z===t,onChange:a=>ae(a.target.value)}),e.createElement(i,{align:"center",justify:"center",height:"32px"},e.createElement(x,{asChild:!0,scaling:t},e.createElement(i,{align:"center",justify:"center"},e.createElement(v,{size:"1",weight:"medium"},m(t))))))))),e.createElement(P,null,e.createElement(i,{align:"center",gap:"2"},e.createElement(b,{id:"panel-background-title"},"Panel background"),e.createElement(X,null,e.createElement(q,null,e.createElement(U,{size:"1",variant:"ghost",color:"gray"},e.createElement(j,{label:"Learn more about panel background options"},e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fillRule:"evenodd",clipRule:"evenodd"}))))),e.createElement(J,{size:"1",width:"220px",maxWidth:"90svw",minWidth:"0",side:"top",align:"center"},e.createElement(v,{as:"p",size:"1"},"Whether Card and Table panels are translucent, showing some of the background behind them.")))),e.createElement(w,{columns:{initial:"1",sm:"2"},rows:{initial:"2",sm:"1"},gap:"2",role:"group","aria-labelledby":"panel-background-title"},s.panelBackground.values.map(t=>e.createElement("label",{key:t,className:"rt-ThemePanelRadioCard"},e.createElement("input",{className:"rt-ThemePanelRadioCardInput",type:"radio",name:"panelBackground",value:t,checked:f===t,onChange:a=>H(a.target.value)}),e.createElement(i,{align:"center",justify:"center",height:"32px",gap:"2"},t==="solid"?e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -2px"}},e.createElement("path",{d:"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})):e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{margin:"0 -2px"}},e.createElement("path",{opacity:".05",d:"M6.78296 13.376C8.73904 9.95284 8.73904 5.04719 6.78296 1.62405L7.21708 1.37598C9.261 4.95283 9.261 10.0472 7.21708 13.624L6.78296 13.376Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".1",d:"M7.28204 13.4775C9.23929 9.99523 9.23929 5.00475 7.28204 1.52248L7.71791 1.2775C9.76067 4.9119 9.76067 10.0881 7.71791 13.7225L7.28204 13.4775Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".15",d:"M7.82098 13.5064C9.72502 9.99523 9.72636 5.01411 7.82492 1.50084L8.26465 1.26285C10.2465 4.92466 10.2451 10.085 8.26052 13.7448L7.82098 13.5064Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".2",d:"M8.41284 13.429C10.1952 9.92842 10.1957 5.07537 8.41435 1.57402L8.85999 1.34729C10.7139 4.99113 10.7133 10.0128 8.85841 13.6559L8.41284 13.429Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".25",d:"M9.02441 13.2956C10.6567 9.8379 10.6586 5.17715 9.03005 1.71656L9.48245 1.50366C11.1745 5.09919 11.1726 9.91629 9.47657 13.5091L9.02441 13.2956Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".3",d:"M9.66809 13.0655C11.1097 9.69572 11.1107 5.3121 9.67088 1.94095L10.1307 1.74457C11.6241 5.24121 11.6231 9.76683 10.1278 13.2622L9.66809 13.0655Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".35",d:"M10.331 12.7456C11.5551 9.52073 11.5564 5.49103 10.3347 2.26444L10.8024 2.0874C12.0672 5.42815 12.0659 9.58394 10.7985 12.9231L10.331 12.7456Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".4",d:"M11.0155 12.2986C11.9938 9.29744 11.9948 5.71296 11.0184 2.71067L11.4939 2.55603C12.503 5.6589 12.502 9.35178 11.4909 12.4535L11.0155 12.2986Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".45",d:"M11.7214 11.668C12.4254 9.01303 12.4262 5.99691 11.7237 3.34116L12.2071 3.21329C12.9318 5.95292 12.931 9.05728 12.2047 11.7961L11.7214 11.668Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{opacity:".5",d:"M12.4432 10.752C12.8524 8.63762 12.8523 6.36089 12.4429 4.2466L12.9338 4.15155C13.3553 6.32861 13.3554 8.66985 12.9341 10.847L12.4432 10.752Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}),e.createElement("path",{d:"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})),e.createElement(v,{size:"1",weight:"medium"},m(t)))))))),e.createElement(W,{style:{width:"100%"},onClick:oe},ne==="copied"?"Copied":"Copy Theme"))});ee.displayName="ThemePanelContent";function P(n){return e.createElement(i,{direction:"column",gap:"3",asChild:!0,...n},e.createElement("section",null,n.children))}function b(n){return e.createElement(F,{as:"h3",size:{initial:"1",sm:"2"},...n})}function ce(){let n=document.createElement("style");return n.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(n),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(n)},1)}}function m(n){return n.charAt(0).toUpperCase()+n.slice(1)}function de(n){let o=document.documentElement,r=o.classList.contains("light-theme"),u=o.classList.contains("dark-theme"),d=o.classList.contains("light"),h=o.classList.contains("dark");(r||u)&&(o.classList.remove("light-theme","dark-theme"),o.style.colorScheme=n,o.classList.add(`${n}-theme`)),(d||h)&&(o.classList.remove("light","dark"),o.style.colorScheme=n,o.classList.add(n)),!r&&!u&&!d&&!h&&(o.style.colorScheme=n,o.classList.add(n))}export{se as a,ee as b};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-BBMENJM3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as s}from"./chunk-KRJTW535.js";import{a}from"./chunk-NZJGC6ZW.js";import{a as e}from"./chunk-AVFGMLL4.js";import{d as o}from"./chunk-Z4DTHR2S.js";var t=["1","2","3","4"],r=["raised","solid","soft","surface","outline","ghost","override","classic"],n=["solid","translucent"],l=["solid","translucent"],d={...a,size:{type:"enum",className:"rt-r-size",values:t,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:r,default:"
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as s}from"./chunk-KRJTW535.js";import{a}from"./chunk-NZJGC6ZW.js";import{a as e}from"./chunk-AVFGMLL4.js";import{d as o}from"./chunk-Z4DTHR2S.js";var t=["1","2","3","4"],r=["raised","solid","soft","surface","outline","ghost","override","classic"],n=["solid","translucent"],l=["solid","translucent"],d={...a,size:{type:"enum",className:"rt-r-size",values:t,default:"2",responsive:!0},variant:{type:"enum",className:"rt-variant",values:r,default:"solid",parseValue:e},...o,...s,loading:{type:"boolean",className:"rt-loading",default:!1},fullWidth:{type:"boolean",className:"rt-full-width",default:!1},material:{type:"enum",values:l,default:void 0},panelBackground:{type:"enum",values:n,default:void 0},flush:{type:"boolean",default:!1}};export{d as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BGVGSALM.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/_internal/base-button.props.ts"],
|
|
4
|
-
"sourcesContent": ["import { parseVariant } from '../../helpers/parse-variant.js';\nimport { asChildPropDef } from '../../props/as-child.prop.js';\nimport { accentColorPropDef } from '../../props/color.prop.js';\nimport { radiusPropDef } from '../../props/radius.prop.js';\n\nimport type { PropDef } from '../../props/prop-def.js';\n\n/**\n * Available button sizes for responsive design\n * Size 1: 24px - Compact for toolbars and dense interfaces\n * Size 2: 32px - Standard for most interface contexts\n * Size 3: 40px - Large for important actions and mobile touch targets\n * Size 4: 48px - Extra large for hero sections and maximum impact\n */\nconst sizes = ['1', '2', '3', '4'] as const;\n\n/**\n * Available button variants for different visual contexts\n * - raised: lifted off its ground, with an edge and a shadow
|
|
5
|
-
"mappings": "2JAcA,IAAMA,EAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAW3BC,EAAW,CAAC,SAAU,QAAS,OAAQ,UAAW,UAAW,QAAS,WAAY,SAAS,EAM3FC,EAAmB,CAAC,QAAS,aAAa,EAO1CC,EAAY,CAAC,QAAS,aAAa,EA+BnCC,EAAqB,CACzB,GAAGC,EAKH,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQL,EAAO,QAAS,IAAK,WAAY,EAAK,EAI5F,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQC,EAAU,QAAS,
|
|
4
|
+
"sourcesContent": ["import { parseVariant } from '../../helpers/parse-variant.js';\nimport { asChildPropDef } from '../../props/as-child.prop.js';\nimport { accentColorPropDef } from '../../props/color.prop.js';\nimport { radiusPropDef } from '../../props/radius.prop.js';\n\nimport type { PropDef } from '../../props/prop-def.js';\n\n/**\n * Available button sizes for responsive design\n * Size 1: 24px - Compact for toolbars and dense interfaces\n * Size 2: 32px - Standard for most interface contexts\n * Size 3: 40px - Large for important actions and mobile touch targets\n * Size 4: 48px - Extra large for hero sections and maximum impact\n */\nconst sizes = ['1', '2', '3', '4'] as const;\n\n/**\n * Available button variants for different visual contexts\n * - raised: lifted off its ground, with an edge and a shadow\n * - solid: Primary actions that should be noticed first (the default)\n * - soft: Content-heavy interfaces, natural integration\n * - surface: Elevated appearance with subtle depth\n * - outline: Secondary actions that support primary actions\n * - ghost: Utility functions that don't compete for attention\n */\nconst variants = ['raised', 'solid', 'soft', 'surface', 'outline', 'ghost', 'override', 'classic'] as const;\n\n/**\n * Available panel background options (deprecated)\n * @deprecated Use `materials` instead\n */\nconst panelBackgrounds = ['solid', 'translucent'] as const;\n\n/**\n * Available material options for visual rendering\n * - solid: Opaque backgrounds and borders\n * - translucent: Elevated effects with depth and visual separation\n */\nconst materials = ['solid', 'translucent'] as const;\n\n/**\n * Base button prop definitions that define the component's API\n * \n * These props are used by all button variants (Button, IconButton, etc.)\n * to ensure consistent behavior and styling across the design system.\n * \n * Key features:\n * - Responsive sizing with mobile-first approach\n * - Six visual variants for different interface contexts\n * - Comprehensive color system with semantic meanings\n * - Loading states with automatic accessibility\n * - Material system for visual depth and elevation\n * - Polymorphic rendering support via asChild\n * \n * @example\n * ```tsx\n * // Basic button with default props\n * <BaseButton>Click me</BaseButton>\n * \n * // Button with custom size and variant\n * <BaseButton size=\"3\" variant=\"solid\">Primary Action</BaseButton>\n * \n * // Button with loading state\n * <BaseButton loading>Processing...</BaseButton>\n * \n * // Button with translucent material\n * <BaseButton material=\"translucent\">Elevated Button</BaseButton>\n * ```\n */\nconst baseButtonPropDefs = {\n ...asChildPropDef,\n /**\n * Button size for responsive design and interface density\n * Supports responsive objects: { initial: '1', sm: '2', md: '3', lg: '4' }\n */\n size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2', responsive: true },\n /**\n * Visual variant that determines the button's appearance and context\n */\n variant: { type: 'enum', className: 'rt-variant', values: variants, default: 'solid', parseValue: parseVariant },\n ...accentColorPropDef,\n ...radiusPropDef,\n /**\n * Loading state that shows a spinner and disables interaction\n * Automatically sets disabled=true and provides accessibility announcements\n */\n loading: { type: 'boolean', className: 'rt-loading', default: false },\n /**\n * Full width mode that expands the button to fill its container\n * Useful for mobile layouts and form submissions\n */\n fullWidth: { type: 'boolean', className: 'rt-full-width', default: false },\n /**\n * Material type for visual rendering and depth effects\n * Controls how the button renders its visual elements\n */\n material: { type: 'enum', values: materials, default: undefined },\n /**\n * Panel background type (deprecated)\n * @deprecated Use `material` prop instead. This prop will be removed in a future version.\n */\n panelBackground: { type: 'enum', values: panelBackgrounds, default: undefined },\n /**\n * Flush mode that removes visual padding for seamless text integration\n * Only effective with ghost variant\n */\n flush: { type: 'boolean', default: false },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n loading: PropDef<boolean>;\n fullWidth: PropDef<boolean>;\n material: PropDef<(typeof materials)[number] | undefined>;\n panelBackground: PropDef<(typeof panelBackgrounds)[number] | undefined>;\n flush: PropDef<boolean>;\n};\n\nexport { baseButtonPropDefs };\n"],
|
|
5
|
+
"mappings": "2JAcA,IAAMA,EAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAW3BC,EAAW,CAAC,SAAU,QAAS,OAAQ,UAAW,UAAW,QAAS,WAAY,SAAS,EAM3FC,EAAmB,CAAC,QAAS,aAAa,EAO1CC,EAAY,CAAC,QAAS,aAAa,EA+BnCC,EAAqB,CACzB,GAAGC,EAKH,KAAM,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQL,EAAO,QAAS,IAAK,WAAY,EAAK,EAI5F,QAAS,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQC,EAAU,QAAS,QAAS,WAAYK,CAAa,EAC/G,GAAGC,EACH,GAAGC,EAKH,QAAS,CAAE,KAAM,UAAW,UAAW,aAAc,QAAS,EAAM,EAKpE,UAAW,CAAE,KAAM,UAAW,UAAW,gBAAiB,QAAS,EAAM,EAKzE,SAAU,CAAE,KAAM,OAAQ,OAAQL,EAAW,QAAS,MAAU,EAKhE,gBAAiB,CAAE,KAAM,OAAQ,OAAQD,EAAkB,QAAS,MAAU,EAK9E,MAAO,CAAE,KAAM,UAAW,QAAS,EAAM,CAC3C",
|
|
6
6
|
"names": ["sizes", "variants", "panelBackgrounds", "materials", "baseButtonPropDefs", "asChildPropDef", "parseVariant", "accentColorPropDef", "radiusPropDef"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as s}from"./chunk-QXEQ2C6A.js";import{z as o}from"zod";var t=s.extend({pressed:o.boolean().optional().describe("Controlled pressed state"),onPressedChange:o.function().optional().describe("Callback when pressed state changes"),defaultPressed:o.boolean().optional().describe("Default pressed state for uncontrolled usage")}).refine(e=>!(e.pressed!==void 0&&e.onPressedChange===void 0),{message:"When using controlled mode (pressed prop), onPressedChange must also be provided",path:["onPressedChange"]}).refine(e=>!(e.pressed!==void 0&&e.defaultPressed!==void 0),{message:"Cannot use both controlled (pressed) and uncontrolled (defaultPressed) props together",path:["pressed","defaultPressed"]});function d(e){return e}export{t as a,d as b};
|
|
2
|
+
//# sourceMappingURL=chunk-BWVYB64R.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as g}from"./chunk-2N2AQNJH.js";import{a as v}from"./chunk-HIBX2EXV.js";import{a as B}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-2N2AQNJH.js";import{a as v}from"./chunk-HIBX2EXV.js";import{a as B}from"./chunk-UGGAAL4V.js";import*as r from"react";import T from"classnames";var N={loud:"solid",medium:"raised",quiet:"ghost"};function $(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
2
|
- aria-label prop with descriptive text
|
|
3
3
|
- aria-labelledby prop referencing a label element
|
|
4
|
-
- or visible text children`)}var I=r.forwardRef(({className:a,style:s,tooltip:c,tooltipSide:y="top",tooltipAlign:h="center",tooltipDelayDuration:R,tooltipDisableHoverableContent:O,overrideStyles:e,iconOnly:p=!1,emphasis:u,variant:f,...l},
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
- or visible text children`)}var I=r.forwardRef(({className:a,style:s,tooltip:c,tooltipSide:y="top",tooltipAlign:h="center",tooltipDelayDuration:R,tooltipDisableHoverableContent:O,overrideStyles:e,iconOnly:p=!1,emphasis:u,variant:f,...l},P)=>{let{tooltipId:S,hasTooltip:w,accessibilityProps:E}=g(c),d=r.useMemo(()=>{if(!e)return;let m={},o=(n,t)=>{t!==void 0&&(m[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)),m},[e]),C=r.useMemo(()=>d?{...d,...s}:s,[d,s]);if(p&&($(l),l.fullWidth&&void 0),u!==void 0&&f!==void 0)throw new Error("Button: pass `emphasis` or `variant`, not both. They set the same thing.");let k=u!==void 0?N[u]:f,b=r.createElement(B,{...l,variant:k,...E,ref:P,className:T(p?"rt-IconButton":"rt-Button",a),style:C});return w?r.createElement(v,{content:c,side:y,align:h,delayDuration:R,disableHoverableContent:O,id:S},b):b});I.displayName="Button";export{I as a};
|
|
5
|
+
//# sourceMappingURL=chunk-BXX2NVQD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 */\nexport interface 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 ButtonEmphasis = 'loud' | 'medium' | 'quiet';\n\n/** `emphasis` is a button's rank: loud is `solid`, medium is `raised`, quiet is `ghost`. */\nconst EMPHASIS_VARIANT = { loud: 'solid', medium: 'raised', quiet: 'ghost' } as const;\n\n/**\n * A button states its rank with `emphasis` or its look with `variant`, never both.\n */\ntype ButtonRankProps =\n | {\n /** The button's look. `outline` and `surface` have no emphasis of their own. */\n variant?: BaseButtonProps['variant'];\n emphasis?: never;\n }\n | {\n /** The button's rank: `loud` (solid), `medium` (raised
|
|
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 */\nexport interface 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 ButtonEmphasis = 'loud' | 'medium' | 'quiet';\n\n/** `emphasis` is a button's rank: loud is `solid`, medium is `raised`, quiet is `ghost`. */\nconst EMPHASIS_VARIANT = { loud: 'solid', medium: 'raised', quiet: 'ghost' } as const;\n\n/**\n * A button states its rank with `emphasis` or its look with `variant`, never both.\n */\ntype ButtonRankProps =\n | {\n /** The button's look. `outline` and `surface` have no emphasis of their own. */\n variant?: BaseButtonProps['variant'];\n emphasis?: never;\n }\n | {\n /** The button's rank: `loud` (solid, the default), `medium` (raised) or `quiet` (ghost). */\n emphasis?: ButtonEmphasis;\n variant?: never;\n };\n\ntype ButtonOwnProps = Omit<BaseButtonProps, 'as' | 'variant'> &\n ButtonRankProps &\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 {\n className,\n style,\n tooltip,\n tooltipSide = 'top',\n tooltipAlign = 'center',\n tooltipDelayDuration,\n tooltipDisableHoverableContent,\n overrideStyles,\n iconOnly = false,\n emphasis,\n variant,\n ...props\n }: 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 if (emphasis !== undefined && variant !== undefined) {\n throw new Error('Button: pass `emphasis` or `variant`, not both. They set the same thing.');\n }\n const resolvedVariant = emphasis !== undefined ? EMPHASIS_VARIANT[emphasis] : variant;\n\n const button = (\n <BaseButton\n {...props}\n variant={resolvedVariant}\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, ButtonEmphasis, ButtonRankProps, ButtonOverrideStyles, ButtonOverrideStateStyles };\n"],
|
|
5
5
|
"mappings": "wHAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAoEvB,IAAMC,EAAmB,CAAE,KAAM,QAAS,OAAQ,SAAU,MAAO,OAAQ,EAkD3E,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,CACE,UAAAC,EACA,MAAAC,EACA,QAAAC,EACA,YAAAC,EAAc,MACd,aAAAC,EAAe,SACf,qBAAAC,EACA,+BAAAC,EACA,eAAAC,EACA,SAAAC,EAAW,GACX,SAAAC,EACA,QAAAC,EACA,GAAGZ,CACL,EACAa,IACG,CAEH,GAAM,CAAE,UAAAC,EAAW,WAAAC,EAAY,mBAAoBC,CAA0B,EAAIC,EAAkBb,CAAO,EAIpGc,EAAqB,UAAQ,IAAM,CACvC,GAAI,CAACT,EAAgB,OACrB,IAAMU,EAAwC,CAAC,EACzCC,EAAS,CAACC,EAAaC,IAAuC,CAC9DA,IAAU,SAAWH,EAAKE,CAAG,EAAIC,EACvC,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AA,CAAQ,QAAS3B,EAAS,KAAMC,EAAa,MAAOC,EAAc,cAAeC,EAAsB,wBAAyBC,EAAgC,GAAIM,GAClKc,CACH,EAROA,CAUX,CACF,EAEA3B,EAAO,YAAc",
|
|
6
6
|
"names": ["React", "classNames", "EMPHASIS_VARIANT", "validateIconButtonName", "props", "Button", "className", "style", "tooltip", "tooltipSide", "tooltipAlign", "tooltipDelayDuration", "tooltipDisableHoverableContent", "overrideStyles", "iconOnly", "emphasis", "variant", "forwardedRef", "tooltipId", "hasTooltip", "tooltipAccessibilityProps", "useTooltipWrapper", "overrideVars", "vars", "setVar", "key", "value", "apply", "prefix", "s", "combinedStyle", "resolvedVariant", "button", "BaseButton", "classNames", "Tooltip"]
|
|
7
7
|
}
|