@kushagradhawan/kookie-ui 0.1.32 → 0.1.34

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.
Files changed (120) hide show
  1. package/components.css +937 -458
  2. package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
  3. package/dist/cjs/components/_internal/base-button.js +1 -1
  4. package/dist/cjs/components/_internal/base-button.js.map +3 -3
  5. package/dist/cjs/components/chatbar.d.ts +202 -0
  6. package/dist/cjs/components/chatbar.d.ts.map +1 -0
  7. package/dist/cjs/components/chatbar.js +2 -0
  8. package/dist/cjs/components/chatbar.js.map +7 -0
  9. package/dist/cjs/components/icon-button.d.ts.map +1 -1
  10. package/dist/cjs/components/icon-button.js +2 -2
  11. package/dist/cjs/components/icon-button.js.map +3 -3
  12. package/dist/cjs/components/icons.d.ts +6 -1
  13. package/dist/cjs/components/icons.d.ts.map +1 -1
  14. package/dist/cjs/components/icons.js +1 -1
  15. package/dist/cjs/components/icons.js.map +3 -3
  16. package/dist/cjs/components/index.d.ts +3 -0
  17. package/dist/cjs/components/index.d.ts.map +1 -1
  18. package/dist/cjs/components/index.js +1 -1
  19. package/dist/cjs/components/index.js.map +3 -3
  20. package/dist/cjs/components/popover.d.ts +13 -1
  21. package/dist/cjs/components/popover.d.ts.map +1 -1
  22. package/dist/cjs/components/popover.js +1 -1
  23. package/dist/cjs/components/popover.js.map +3 -3
  24. package/dist/cjs/components/sheet.d.ts +82 -0
  25. package/dist/cjs/components/sheet.d.ts.map +1 -0
  26. package/dist/cjs/components/sheet.js +2 -0
  27. package/dist/cjs/components/sheet.js.map +7 -0
  28. package/dist/cjs/components/shell.d.ts +180 -0
  29. package/dist/cjs/components/shell.d.ts.map +1 -0
  30. package/dist/cjs/components/shell.js +2 -0
  31. package/dist/cjs/components/shell.js.map +7 -0
  32. package/dist/cjs/components/sidebar.d.ts +4 -33
  33. package/dist/cjs/components/sidebar.d.ts.map +1 -1
  34. package/dist/cjs/components/sidebar.js +1 -1
  35. package/dist/cjs/components/sidebar.js.map +3 -3
  36. package/dist/cjs/components/skeleton.d.ts.map +1 -1
  37. package/dist/cjs/components/skeleton.js +1 -1
  38. package/dist/cjs/components/skeleton.js.map +2 -2
  39. package/dist/cjs/helpers/inert.d.ts +1 -1
  40. package/dist/cjs/helpers/inert.d.ts.map +1 -1
  41. package/dist/cjs/helpers/inert.js +1 -1
  42. package/dist/cjs/helpers/inert.js.map +2 -2
  43. package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
  44. package/dist/esm/components/_internal/base-button.js +1 -1
  45. package/dist/esm/components/_internal/base-button.js.map +3 -3
  46. package/dist/esm/components/chatbar.d.ts +202 -0
  47. package/dist/esm/components/chatbar.d.ts.map +1 -0
  48. package/dist/esm/components/chatbar.js +2 -0
  49. package/dist/esm/components/chatbar.js.map +7 -0
  50. package/dist/esm/components/icon-button.d.ts.map +1 -1
  51. package/dist/esm/components/icon-button.js +2 -2
  52. package/dist/esm/components/icon-button.js.map +3 -3
  53. package/dist/esm/components/icons.d.ts +6 -1
  54. package/dist/esm/components/icons.d.ts.map +1 -1
  55. package/dist/esm/components/icons.js +1 -1
  56. package/dist/esm/components/icons.js.map +3 -3
  57. package/dist/esm/components/index.d.ts +3 -0
  58. package/dist/esm/components/index.d.ts.map +1 -1
  59. package/dist/esm/components/index.js +1 -1
  60. package/dist/esm/components/index.js.map +3 -3
  61. package/dist/esm/components/popover.d.ts +13 -1
  62. package/dist/esm/components/popover.d.ts.map +1 -1
  63. package/dist/esm/components/popover.js +1 -1
  64. package/dist/esm/components/popover.js.map +3 -3
  65. package/dist/esm/components/sheet.d.ts +82 -0
  66. package/dist/esm/components/sheet.d.ts.map +1 -0
  67. package/dist/esm/components/sheet.js +2 -0
  68. package/dist/esm/components/sheet.js.map +7 -0
  69. package/dist/esm/components/shell.d.ts +180 -0
  70. package/dist/esm/components/shell.d.ts.map +1 -0
  71. package/dist/esm/components/shell.js +2 -0
  72. package/dist/esm/components/shell.js.map +7 -0
  73. package/dist/esm/components/sidebar.d.ts +4 -33
  74. package/dist/esm/components/sidebar.d.ts.map +1 -1
  75. package/dist/esm/components/sidebar.js +1 -1
  76. package/dist/esm/components/sidebar.js.map +3 -3
  77. package/dist/esm/components/skeleton.d.ts.map +1 -1
  78. package/dist/esm/components/skeleton.js.map +2 -2
  79. package/dist/esm/helpers/inert.d.ts +1 -1
  80. package/dist/esm/helpers/inert.d.ts.map +1 -1
  81. package/dist/esm/helpers/inert.js +1 -1
  82. package/dist/esm/helpers/inert.js.map +2 -2
  83. package/package.json +2 -1
  84. package/src/components/_internal/base-button.tsx +8 -0
  85. package/src/components/_internal/base-card.css +18 -18
  86. package/src/components/_internal/base-dialog.css +11 -49
  87. package/src/components/_internal/base-menu.css +2 -2
  88. package/src/components/_internal/base-sidebar-menu.css +3 -3
  89. package/src/components/accordion.css +6 -6
  90. package/src/components/animations.css +65 -81
  91. package/src/components/callout.css +3 -3
  92. package/src/components/chatbar.css +214 -0
  93. package/src/components/chatbar.tsx +1181 -0
  94. package/src/components/icon-button.tsx +11 -0
  95. package/src/components/icons.tsx +97 -2
  96. package/src/components/image.css +3 -3
  97. package/src/components/index.css +3 -0
  98. package/src/components/index.tsx +3 -0
  99. package/src/components/popover.css +53 -8
  100. package/src/components/popover.tsx +180 -2
  101. package/src/components/scroll-area.css +3 -3
  102. package/src/components/segmented-control.css +3 -3
  103. package/src/components/sheet.css +90 -0
  104. package/src/components/sheet.tsx +247 -0
  105. package/src/components/shell.css +137 -0
  106. package/src/components/shell.tsx +1032 -0
  107. package/src/components/sidebar.css +55 -268
  108. package/src/components/sidebar.tsx +40 -262
  109. package/src/components/skeleton.tsx +1 -2
  110. package/src/components/text-area.css +6 -5
  111. package/src/components/tooltip.css +2 -2
  112. package/src/helpers/inert.ts +3 -3
  113. package/src/styles/tokens/constants.css +6 -3
  114. package/src/styles/tokens/index.css +1 -0
  115. package/src/styles/tokens/radius.css +7 -2
  116. package/src/styles/tokens/space.css +6 -0
  117. package/src/styles/tokens/transition.css +91 -46
  118. package/styles.css +998 -496
  119. package/tokens/base.css +57 -35
  120. package/tokens.css +61 -38
@@ -1 +1 @@
1
- {"version":3,"file":"base-button.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAErE;;;;GAIG;AACH,KAAK,0BAA0B,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACxE,0DAA0D;IAC1D,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,kBAAkB,GACpB,WAAW,GACX,qBAAqB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,kBAAkB,GAAG,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC;AAE/F;;GAEG;AACH,UAAU,eAAgB,SAAQ,0BAA0B;CAAG;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,UAAU,2FAoKd,CAAC;AAGH,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"base-button.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/base-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,KAAK,kBAAkB,GAAG,eAAe,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAErE;;;;GAIG;AACH,KAAK,0BAA0B,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IACxE,0DAA0D;IAC1D,EAAE,CAAC,EAAE,CAAC,CAAC;CACR,GAAG,kBAAkB,GACpB,WAAW,GACX,qBAAqB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,kBAAkB,GAAG,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC;AAE/F;;GAEG;AACH,UAAU,eAAgB,SAAQ,0BAA0B;CAAG;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,UAAU,2FA4Kd,CAAC;AAGH,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var $=Object.create;var l=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var J=(e,n)=>{for(var r in n)l(e,r,{get:n[r],enumerable:!0})},g=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of U(n))!A.call(e,o)&&o!==r&&l(e,o,{get:()=>n[o],enumerable:!(i=L(n,o))||i.enumerable});return e};var h=(e,n,r)=>(r=e!=null?$(q(e)):{},g(n||!e||!e.__esModule?l(r,"default",{value:e,enumerable:!0}):r,e)),K=e=>g(l({},"__esModule",{value:!0}),e);var Q={};J(Q,{BaseButton:()=>f});module.exports=K(Q);var t=h(require("react")),C=h(require("classnames")),T=require("radix-ui"),m=require("./base-button.props.js"),v=require("../flex.js"),w=require("../spinner.js"),M=require("../visually-hidden.js"),x=require("../../helpers/extract-props.js"),p=require("../../helpers/map-prop-values.js"),k=require("../../props/margin.props.js");const f=t.forwardRef((e,n)=>{const{size:r=m.baseButtonPropDefs.size.default}=e,{className:i,children:o,asChild:y,as:u,color:E,radius:D,material:S,panelBackground:z,flush:j,disabled:B=e.loading,...I}=(0,x.extractProps)(e,m.baseButtonPropDefs,k.marginPropDefs);t.useEffect(()=>{e.panelBackground!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.")},[e.panelBackground]);const a=S??z,b=t.useRef(null);t.useEffect(()=>{const s=b.current;if(!s)return;if(a==="translucent"){s.style.setProperty("will-change","backdrop-filter");const H=()=>{const W=getComputedStyle(s).getPropertyValue("--duration-2")||"75ms",G=parseInt(W)||75;setTimeout(()=>{s&&a!=="translucent"&&s.style.setProperty("will-change","auto")},G)},P=new MutationObserver(H);return P.observe(s,{attributes:!0,attributeFilter:["data-material"]}),()=>{P.disconnect(),s.style.setProperty("will-change","auto")}}else s.style.setProperty("will-change","auto")},[a]);const N=y?T.Slot.Root:u||"button",O=y||!u||["button","input","textarea","select"].includes(u),V=t.useId(),d=e.loading?`${V}-loading`:void 0,c=t.useMemo(()=>typeof o=="string"?o:t.isValidElement(o)&&typeof o.props?.children=="string"?o.props.children:"button",[o]),F=t.useMemo(()=>e.loading?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":d,"aria-label":`${c} (loading)`}:{},[e.loading,d,c]);return t.createElement(N,{"data-disabled":B||void 0,"data-accent-color":E,"data-radius":D,"data-material":a,"data-panel-background":a,"data-flush":j?"true":void 0,...I,...F,ref:s=>{typeof n=="function"?n(s):n&&(n.current=s),b.current=s},className:(0,C.default)("rt-reset","rt-BaseButton",i),...O&&{disabled:B}},e.loading?t.createElement(t.Fragment,null,t.createElement("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0},o),t.createElement(M.VisuallyHidden,null,t.createElement("span",{id:d},c," is loading, please wait..."),o),t.createElement(v.Flex,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},t.createElement("span",null,t.createElement(w.Spinner,{size:(0,p.mapResponsiveProp)(r,p.mapButtonSizeToSpinnerSize),"aria-hidden":"true"})))):o)});f.displayName="BaseButton";
1
+ "use strict";var L=Object.create;var u=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Q=(t,n)=>{for(var r in n)u(t,r,{get:n[r],enumerable:!0})},h=(t,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of q(n))!K.call(t,o)&&o!==r&&u(t,o,{get:()=>n[o],enumerable:!(l=U(n,o))||l.enumerable});return t};var T=(t,n,r)=>(r=t!=null?L(J(t)):{},h(n||!t||!t.__esModule?u(r,"default",{value:t,enumerable:!0}):r,t)),R=t=>h(u({},"__esModule",{value:!0}),t);var X={};Q(X,{BaseButton:()=>y});module.exports=R(X);var e=T(require("react")),v=T(require("classnames")),w=require("radix-ui"),f=require("./base-button.props.js"),C=require("../flex.js"),x=require("../spinner.js"),E=require("../visually-hidden.js"),M=require("../../helpers/extract-props.js"),p=require("../../helpers/map-prop-values.js"),k=require("../../props/margin.props.js");const y=e.forwardRef((t,n)=>{const{size:r=f.baseButtonPropDefs.size.default}=t,{className:l,children:o,asChild:d,as:a,color:D,radius:S,material:z,panelBackground:N,flush:j,disabled:b=t.loading,...B}=(0,M.extractProps)(t,f.baseButtonPropDefs,k.marginPropDefs);e.useEffect(()=>{t.panelBackground!==void 0&&console.warn("Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.")},[t.panelBackground]);const i=z??N,P=e.useRef(null);e.useEffect(()=>{const s=P.current;if(!s)return;if(i==="translucent"){s.style.setProperty("will-change","backdrop-filter");const G=()=>{const $=getComputedStyle(s).getPropertyValue("--duration-2")||"75ms",A=parseInt($)||75;setTimeout(()=>{s&&i!=="translucent"&&s.style.setProperty("will-change","auto")},A)},g=new MutationObserver(G);return g.observe(s,{attributes:!0,attributeFilter:["data-material"]}),()=>{g.disconnect(),s.style.setProperty("will-change","auto")}}else s.style.setProperty("will-change","auto")},[i]);const I=d?w.Slot.Root:a||"button",O=d||!a||["button","input","textarea","select"].includes(a),V=!d&&(!a||a==="button"),F="type"in B,H=e.useId(),c=t.loading?`${H}-loading`:void 0,m=e.useMemo(()=>typeof o=="string"?o:e.isValidElement(o)&&typeof o.props?.children=="string"?o.props.children:"button",[o]),W=e.useMemo(()=>t.loading?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":c,"aria-label":`${m} (loading)`}:{},[t.loading,c,m]);return e.createElement(I,{"data-disabled":b||void 0,"data-accent-color":D,"data-radius":S,"data-material":i,"data-panel-background":i,"data-flush":j?"true":void 0,...B,...W,ref:s=>{typeof n=="function"?n(s):n&&(n.current=s),P.current=s},className:(0,v.default)("rt-reset","rt-BaseButton",l),...O&&{disabled:b},...V&&!F?{type:"button"}:{}},t.loading?e.createElement(e.Fragment,null,e.createElement("span",{style:{display:"contents",visibility:"hidden"},"aria-hidden":!0},o),e.createElement(E.VisuallyHidden,null,e.createElement("span",{id:c},m," is loading, please wait..."),o),e.createElement(C.Flex,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},e.createElement("span",null,e.createElement(x.Spinner,{size:(0,p.mapResponsiveProp)(r,p.mapButtonSizeToSpinnerSize),"aria-hidden":"true"})))):o)});y.displayName="BaseButton";
2
2
  //# sourceMappingURL=base-button.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/_internal/base-button.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { baseButtonPropDefs } from './base-button.props.js';\nimport { Flex } from '../flex.js';\nimport { Spinner } from '../spinner.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { extractProps } from '../../helpers/extract-props.js';\nimport { mapResponsiveProp, mapButtonSizeToSpinnerSize } from '../../helpers/map-prop-values.js';\nimport { marginPropDefs } from '../../props/margin.props.js';\n\nimport type { MarginProps } from '../../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../../props/prop-def.js';\n\ntype BaseButtonElement = React.ElementRef<'button'>;\ntype BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;\n\n/**\n * Polymorphic BaseButton props that support rendering as different HTML elements\n * Uses the proper ComponentPropsWithout pattern for type safety\n * @template C - The element type to render as (defaults to 'button')\n */\ntype PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {\n /** Element type to render as (e.g., 'a', 'span', etc.) */\n as?: C;\n} & BaseButtonOwnProps &\n MarginProps &\n ComponentPropsWithout<C, RemovedProps | keyof BaseButtonOwnProps | keyof MarginProps | 'as'>;\n\n/**\n * BaseButton props interface that combines all available props\n */\ninterface BaseButtonProps extends PolymorphicBaseButtonProps {}\n\n/**\n * BaseButton component that provides the core button functionality\n *\n * This is the foundational button component that handles all the complex logic\n * including loading states, accessibility, performance optimizations, and\n * polymorphic rendering. It's used by Button, IconButton, and other button\n * variants to ensure consistent behavior across the design system.\n *\n * Key features:\n * - Loading state with spinner and accessibility announcements\n * - Performance optimizations for backdrop-filter effects\n * - Comprehensive accessibility support\n * - Polymorphic rendering support\n * - Material/panel background handling\n *\n * @example\n * ```tsx\n * // Basic usage\n * <BaseButton>Click me</BaseButton>\n *\n * // With loading state\n * <BaseButton loading>Processing...</BaseButton>\n *\n * // Polymorphic rendering\n * <BaseButton as=\"a\" href=\"/link\">Link Button</BaseButton>\n * ```\n */\nconst BaseButton = React.forwardRef<BaseButtonElement, BaseButtonProps>((props, forwardedRef) => {\n const { size = baseButtonPropDefs.size.default } = props;\n\n // Extract button-specific props from the combined props object\n const {\n className,\n children,\n asChild,\n as,\n color,\n radius,\n material,\n panelBackground,\n flush,\n disabled = props.loading, // Loading state automatically disables the button\n ...baseButtonProps\n } = extractProps(props, baseButtonPropDefs, marginPropDefs);\n\n // Show deprecation warning for panelBackground when used\n // This helps developers migrate to the new material prop\n React.useEffect(() => {\n if (props.panelBackground !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n }, [props.panelBackground]);\n\n // Material takes precedence over panelBackground for backward compatibility\n const effectiveMaterial = material ?? panelBackground;\n\n // Will-change cleanup for backdrop-filter performance optimization\n // This prevents layout thrashing when using translucent materials\n const buttonRef = React.useRef<HTMLElement>(null);\n\n React.useEffect(() => {\n const button = buttonRef.current;\n if (!button) return;\n\n const hasTranslucentMaterial = effectiveMaterial === 'translucent';\n\n if (hasTranslucentMaterial) {\n // Add will-change when material is translucent to optimize rendering\n button.style.setProperty('will-change', 'backdrop-filter');\n\n // Clean up will-change after transition completes to prevent memory leaks\n const cleanup = () => {\n const transitionDuration =\n getComputedStyle(button).getPropertyValue('--duration-2') || '75ms';\n const duration = parseInt(transitionDuration) || 75;\n\n setTimeout(() => {\n if (button && effectiveMaterial !== 'translucent') {\n button.style.setProperty('will-change', 'auto');\n }\n }, duration);\n };\n\n // Listen for material changes to clean up will-change property\n const observer = new MutationObserver(cleanup);\n observer.observe(button, { attributes: true, attributeFilter: ['data-material'] });\n\n return () => {\n observer.disconnect();\n button.style.setProperty('will-change', 'auto');\n };\n } else {\n // Remove will-change when material is not translucent\n button.style.setProperty('will-change', 'auto');\n }\n }, [effectiveMaterial]);\n\n // asChild takes precedence over as prop for Radix Slot integration\n const Comp = asChild ? Slot.Root : as || 'button';\n\n // Only pass disabled for elements that support it\n // This prevents invalid HTML attributes on unsupported elements\n const shouldPassDisabled =\n asChild || !as || ['button', 'input', 'textarea', 'select'].includes(as);\n\n // Generate unique ID for loading announcements\n const loadingId = React.useId();\n const describedById = props.loading ? `${loadingId}-loading` : undefined;\n\n // Extract button text for accessibility announcements\n const buttonText = React.useMemo(() => {\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 'button';\n }, [children]);\n\n // Enhanced accessibility props for loading state\n // These ensure screen readers announce the loading state properly\n const accessibilityProps = React.useMemo(() => {\n if (props.loading) {\n return {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'aria-describedby': describedById,\n 'aria-label': `${buttonText} (loading)`,\n };\n }\n return {};\n }, [props.loading, describedById, buttonText]);\n\n return (\n <Comp\n // The `data-disabled` attribute enables correct styles when doing `<Button asChild disabled>`\n data-disabled={disabled || undefined}\n data-accent-color={color}\n data-radius={radius}\n data-material={effectiveMaterial}\n data-panel-background={effectiveMaterial}\n data-flush={flush ? 'true' : undefined}\n {...baseButtonProps}\n {...accessibilityProps}\n ref={(node) => {\n // Handle both forwarded ref and internal ref for performance optimization\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n buttonRef.current = node;\n }}\n className={classNames('rt-reset', 'rt-BaseButton', className)}\n {...(shouldPassDisabled && { disabled })}\n >\n {props.loading ? (\n <>\n {/**\n * We need a wrapper to set `visibility: hidden` to hide the button content whilst we show the `Spinner`.\n * The button is a flex container with a `gap`, so we use `display: contents` to ensure the correct flex layout.\n *\n * However, `display: contents` removes the content from the accessibility tree in some browsers,\n * so we force remove it with `aria-hidden` and re-add it in the tree with `VisuallyHidden`\n */}\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n\n {/* Enhanced accessibility for loading state */}\n <VisuallyHidden>\n <span id={describedById}>{buttonText} is loading, please wait...</span>\n {children}\n </VisuallyHidden>\n\n {/* Centered spinner overlay during loading state */}\n <Flex asChild align=\"center\" justify=\"center\" position=\"absolute\" inset=\"0\">\n <span>\n <Spinner\n size={mapResponsiveProp(size, mapButtonSizeToSpinnerSize)}\n aria-hidden=\"true\"\n />\n </span>\n </Flex>\n </>\n ) : (\n children\n )}\n </Comp>\n );\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Y,WAAY,QAAS,EAAG,cAAW,IACpEc,CACH,EAGAd,EAAA,cAAC,sBACCA,EAAA,cAAC,QAAK,GAAIkC,GAAgBC,EAAW,6BAA2B,EAC/DrB,CACH,EAGAd,EAAA,cAAC,QAAK,QAAO,GAAC,MAAM,SAAS,QAAQ,SAAS,SAAS,WAAW,MAAM,KACtEA,EAAA,cAAC,YACCA,EAAA,cAAC,WACC,QAAM,qBAAkBY,EAAM,4BAA0B,EACxD,cAAY,OACd,CACF,CACF,CACF,EAEAE,CAEJ,CAEJ,CAAC,EACDhB,EAAW,YAAc",
6
- "names": ["base_button_exports", "__export", "BaseButton", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "import_base_button_props", "import_flex", "import_spinner", "import_visually_hidden", "import_extract_props", "import_map_prop_values", "import_margin_props", "props", "forwardedRef", "size", "className", "children", "asChild", "as", "color", "radius", "material", "panelBackground", "flush", "disabled", "baseButtonProps", "effectiveMaterial", "buttonRef", "button", "cleanup", "transitionDuration", "duration", "observer", "Comp", "shouldPassDisabled", "loadingId", "describedById", "buttonText", "accessibilityProps", "node", "classNames"]
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { baseButtonPropDefs } from './base-button.props.js';\nimport { Flex } from '../flex.js';\nimport { Spinner } from '../spinner.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { extractProps } from '../../helpers/extract-props.js';\nimport { mapResponsiveProp, mapButtonSizeToSpinnerSize } from '../../helpers/map-prop-values.js';\nimport { marginPropDefs } from '../../props/margin.props.js';\n\nimport type { MarginProps } from '../../props/margin.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../../props/prop-def.js';\n\ntype BaseButtonElement = React.ElementRef<'button'>;\ntype BaseButtonOwnProps = GetPropDefTypes<typeof baseButtonPropDefs>;\n\n/**\n * Polymorphic BaseButton props that support rendering as different HTML elements\n * Uses the proper ComponentPropsWithout pattern for type safety\n * @template C - The element type to render as (defaults to 'button')\n */\ntype PolymorphicBaseButtonProps<C extends React.ElementType = 'button'> = {\n /** Element type to render as (e.g., 'a', 'span', etc.) */\n as?: C;\n} & BaseButtonOwnProps &\n MarginProps &\n ComponentPropsWithout<C, RemovedProps | keyof BaseButtonOwnProps | keyof MarginProps | 'as'>;\n\n/**\n * BaseButton props interface that combines all available props\n */\ninterface BaseButtonProps extends PolymorphicBaseButtonProps {}\n\n/**\n * BaseButton component that provides the core button functionality\n *\n * This is the foundational button component that handles all the complex logic\n * including loading states, accessibility, performance optimizations, and\n * polymorphic rendering. It's used by Button, IconButton, and other button\n * variants to ensure consistent behavior across the design system.\n *\n * Key features:\n * - Loading state with spinner and accessibility announcements\n * - Performance optimizations for backdrop-filter effects\n * - Comprehensive accessibility support\n * - Polymorphic rendering support\n * - Material/panel background handling\n *\n * @example\n * ```tsx\n * // Basic usage\n * <BaseButton>Click me</BaseButton>\n *\n * // With loading state\n * <BaseButton loading>Processing...</BaseButton>\n *\n * // Polymorphic rendering\n * <BaseButton as=\"a\" href=\"/link\">Link Button</BaseButton>\n * ```\n */\nconst BaseButton = React.forwardRef<BaseButtonElement, BaseButtonProps>((props, forwardedRef) => {\n const { size = baseButtonPropDefs.size.default } = props;\n\n // Extract button-specific props from the combined props object\n const {\n className,\n children,\n asChild,\n as,\n color,\n radius,\n material,\n panelBackground,\n flush,\n disabled = props.loading, // Loading state automatically disables the button\n ...baseButtonProps\n } = extractProps(props, baseButtonPropDefs, marginPropDefs);\n\n // Show deprecation warning for panelBackground when used\n // This helps developers migrate to the new material prop\n React.useEffect(() => {\n if (props.panelBackground !== undefined) {\n console.warn(\n 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',\n );\n }\n }, [props.panelBackground]);\n\n // Material takes precedence over panelBackground for backward compatibility\n const effectiveMaterial = material ?? panelBackground;\n\n // Will-change cleanup for backdrop-filter performance optimization\n // This prevents layout thrashing when using translucent materials\n const buttonRef = React.useRef<HTMLElement>(null);\n\n React.useEffect(() => {\n const button = buttonRef.current;\n if (!button) return;\n\n const hasTranslucentMaterial = effectiveMaterial === 'translucent';\n\n if (hasTranslucentMaterial) {\n // Add will-change when material is translucent to optimize rendering\n button.style.setProperty('will-change', 'backdrop-filter');\n\n // Clean up will-change after transition completes to prevent memory leaks\n const cleanup = () => {\n const transitionDuration =\n getComputedStyle(button).getPropertyValue('--duration-2') || '75ms';\n const duration = parseInt(transitionDuration) || 75;\n\n setTimeout(() => {\n if (button && effectiveMaterial !== 'translucent') {\n button.style.setProperty('will-change', 'auto');\n }\n }, duration);\n };\n\n // Listen for material changes to clean up will-change property\n const observer = new MutationObserver(cleanup);\n observer.observe(button, { attributes: true, attributeFilter: ['data-material'] });\n\n return () => {\n observer.disconnect();\n button.style.setProperty('will-change', 'auto');\n };\n } else {\n // Remove will-change when material is not translucent\n button.style.setProperty('will-change', 'auto');\n }\n }, [effectiveMaterial]);\n\n // asChild takes precedence over as prop for Radix Slot integration\n const Comp = asChild ? Slot.Root : as || 'button';\n\n // Only pass disabled for elements that support it\n // This prevents invalid HTML attributes on unsupported elements\n const shouldPassDisabled =\n asChild || !as || ['button', 'input', 'textarea', 'select'].includes(as);\n\n // Determine if we are rendering a real <button> element so we can set a safe\n // default type. Native <button> defaults to type=\"submit\" which can cause\n // accidental form submissions. We default to type=\"button\" unless the user\n // explicitly provided a type or we're using asChild (unknown underlying node).\n const isNativeButtonElement = !asChild && (!as || as === 'button');\n const hasExplicitTypeAttribute = 'type' in (baseButtonProps as Record<string, unknown>);\n\n // Generate unique ID for loading announcements\n const loadingId = React.useId();\n const describedById = props.loading ? `${loadingId}-loading` : undefined;\n\n // Extract button text for accessibility announcements\n const buttonText = React.useMemo(() => {\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 'button';\n }, [children]);\n\n // Enhanced accessibility props for loading state\n // These ensure screen readers announce the loading state properly\n const accessibilityProps = React.useMemo(() => {\n if (props.loading) {\n return {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'aria-describedby': describedById,\n 'aria-label': `${buttonText} (loading)`,\n };\n }\n return {};\n }, [props.loading, describedById, buttonText]);\n\n return (\n <Comp\n // The `data-disabled` attribute enables correct styles when doing `<Button asChild disabled>`\n data-disabled={disabled || undefined}\n data-accent-color={color}\n data-radius={radius}\n data-material={effectiveMaterial}\n data-panel-background={effectiveMaterial}\n data-flush={flush ? 'true' : undefined}\n {...baseButtonProps}\n {...accessibilityProps}\n ref={(node) => {\n // Handle both forwarded ref and internal ref for performance optimization\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n buttonRef.current = node;\n }}\n className={classNames('rt-reset', 'rt-BaseButton', className)}\n {...(shouldPassDisabled && { disabled })}\n {...(isNativeButtonElement && !hasExplicitTypeAttribute ? { type: 'button' } : {})}\n >\n {props.loading ? (\n <>\n {/**\n * We need a wrapper to set `visibility: hidden` to hide the button content whilst we show the `Spinner`.\n * The button is a flex container with a `gap`, so we use `display: contents` to ensure the correct flex layout.\n *\n * However, `display: contents` removes the content from the accessibility tree in some browsers,\n * so we force remove it with `aria-hidden` and re-add it in the tree with `VisuallyHidden`\n */}\n <span style={{ display: 'contents', visibility: 'hidden' }} aria-hidden>\n {children}\n </span>\n\n {/* Enhanced accessibility for loading state */}\n <VisuallyHidden>\n <span id={describedById}>{buttonText} is loading, please wait...</span>\n {children}\n </VisuallyHidden>\n\n {/* Centered spinner overlay during loading state */}\n <Flex asChild align=\"center\" justify=\"center\" position=\"absolute\" inset=\"0\">\n <span>\n <Spinner\n size={mapResponsiveProp(size, mapButtonSizeToSpinnerSize)}\n aria-hidden=\"true\"\n />\n </span>\n </Flex>\n </>\n ) : (\n children\n )}\n </Comp>\n );\n});\nBaseButton.displayName = 'BaseButton';\n\nexport { BaseButton };\nexport type { BaseButtonProps };\n"],
5
+ "mappings": "0jBAAA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AAA,cAQEA,EAAA,cAAC,QAAK,MAAO,CAAE,QAAS,WAAY,WAAY,QAAS,EAAG,cAAW,IACpEc,CACH,EAGAd,EAAA,cAAC,sBACCA,EAAA,cAAC,QAAK,GAAIoC,GAAgBC,EAAW,6BAA2B,EAC/DvB,CACH,EAGAd,EAAA,cAAC,QAAK,QAAO,GAAC,MAAM,SAAS,QAAQ,SAAS,SAAS,WAAW,MAAM,KACtEA,EAAA,cAAC,YACCA,EAAA,cAAC,WACC,QAAM,qBAAkBY,EAAM,4BAA0B,EACxD,cAAY,OACd,CACF,CACF,CACF,EAEAE,CAEJ,CAEJ,CAAC,EACDhB,EAAW,YAAc",
6
+ "names": ["base_button_exports", "__export", "BaseButton", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "import_base_button_props", "import_flex", "import_spinner", "import_visually_hidden", "import_extract_props", "import_map_prop_values", "import_margin_props", "props", "forwardedRef", "size", "className", "children", "asChild", "as", "color", "radius", "material", "panelBackground", "flush", "disabled", "baseButtonProps", "effectiveMaterial", "buttonRef", "button", "cleanup", "transitionDuration", "duration", "observer", "Comp", "shouldPassDisabled", "isNativeButtonElement", "hasExplicitTypeAttribute", "loadingId", "describedById", "buttonText", "accessibilityProps", "node", "classNames"]
7
7
  }
@@ -0,0 +1,202 @@
1
+ import * as React from 'react';
2
+ import { type IconButtonProps } from './icon-button.js';
3
+ import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
4
+ type ExpandOn = 'none' | 'focus' | 'overflow' | 'both';
5
+ type SendMode = 'always' | 'whenDirty' | 'never';
6
+ /** Status flag for attachment lifecycle. */
7
+ type AttachmentStatus = 'idle' | 'uploading' | 'error' | 'done';
8
+ /**
9
+ * Attachment data model used by Chatbar.
10
+ * - `url` is an object URL used for image previews and is revoked on removal.
11
+ */
12
+ interface ChatbarAttachment {
13
+ id: string;
14
+ name: string;
15
+ size: number;
16
+ type: string;
17
+ url?: string;
18
+ status?: AttachmentStatus;
19
+ progress?: number;
20
+ meta?: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Chatbar container and state provider.
24
+ *
25
+ * Value & Open
26
+ * - Supports controlled/uncontrolled `value` and `open`.
27
+ *
28
+ * Attachments
29
+ * - Controlled/uncontrolled attachments with client-side filtering.
30
+ * - Filters by `accept`/`pasteAccept`, `maxAttachments`, and `maxFileSize`.
31
+ * - Rejections are reported via `onAttachmentReject`.
32
+ *
33
+ * Submit
34
+ * - `onSubmit({ value, attachments })` emits both message and attachments.
35
+ * - `clearOnSubmit` clears message and attachments by default.
36
+ */
37
+ interface ChatbarRootBaseProps {
38
+ value?: string;
39
+ defaultValue?: string;
40
+ onValueChange?: (value: string) => void;
41
+ open?: boolean;
42
+ defaultOpen?: boolean;
43
+ onOpenChange?: (open: boolean) => void;
44
+ expandOn?: ExpandOn;
45
+ /** Minimum number of lines in compact state (default: 1) */
46
+ minLines?: number;
47
+ /** Maximum number of lines before scrolling (default: 6) */
48
+ maxLines?: number;
49
+ sendMode?: SendMode;
50
+ disabled?: boolean;
51
+ readOnly?: boolean;
52
+ /** Combined submit payload */
53
+ onSubmit?: (payload: {
54
+ value: string;
55
+ attachments: ChatbarAttachment[];
56
+ }) => void;
57
+ size?: '1' | '2' | '3';
58
+ variant?: 'surface' | 'outline' | 'classic' | 'ghost' | 'soft';
59
+ width?: React.CSSProperties['width'];
60
+ maxWidth?: React.CSSProperties['maxWidth'];
61
+ asChild?: boolean;
62
+ attachments?: ChatbarAttachment[];
63
+ defaultAttachments?: ChatbarAttachment[];
64
+ onAttachmentsChange?: (attachments: ChatbarAttachment[]) => void;
65
+ accept?: string | string[];
66
+ multiple?: boolean;
67
+ maxAttachments?: number;
68
+ maxFileSize?: number;
69
+ paste?: boolean;
70
+ pasteAccept?: string | string[];
71
+ clearOnSubmit?: boolean;
72
+ onAttachmentReject?: (rejections: {
73
+ file: File;
74
+ reason: 'type' | 'size' | 'count';
75
+ }[]) => void;
76
+ /**
77
+ * Enables drag-and-drop file uploads when true.
78
+ *
79
+ * When enabled:
80
+ * - Files can be dropped anywhere on the chatbar
81
+ * - Same validation rules apply (accept, maxFileSize, maxAttachments)
82
+ * - Visual feedback shows during drag operations
83
+ * - Rejected files trigger onAttachmentReject
84
+ *
85
+ * @default true
86
+ */
87
+ dropzone?: boolean;
88
+ }
89
+ /**
90
+ * Chatbar container and state provider.
91
+ *
92
+ * Behavior
93
+ * - Supports controlled and uncontrolled `value` and `open` states via props.
94
+ * - Provides context to subcomponents like `Textarea`, `Row`, and `Send`.
95
+ * - Exposes `data-state`, `data-disabled`, and `data-readonly` attributes for styling.
96
+ * - Sets `aria-expanded` to reflect open/closed state for assistive technologies.
97
+ *
98
+ * Attachments
99
+ * - Controlled/uncontrolled attachments with client-side filtering.
100
+ * - Filters by `accept`/`pasteAccept`, `maxAttachments`, and `maxFileSize`.
101
+ * - Rejections are reported via `onAttachmentReject`.
102
+ * - Paste-to-attach: when `paste` is enabled, pasting files adds attachments.
103
+ *
104
+ * Dropzone
105
+ * - When `dropzone` is true, enables drag-and-drop file uploads.
106
+ * - Files are validated using the same rules as paste and file picker.
107
+ * - Visual feedback via `data-drop-active` attribute during drag operations.
108
+ * - Rejected files trigger `onAttachmentReject` with appropriate reasons.
109
+ *
110
+ * Submit
111
+ * - `onSubmit` receives both message text and attachments array.
112
+ * - `clearOnSubmit` controls whether attachments are cleared after submission.
113
+ *
114
+ * Accessibility
115
+ * - Consumers should label the `Textarea` via `aria-label`/`aria-labelledby`.
116
+ * - `aria-expanded` on the root reflects the disclosure state of the input area.
117
+ * - Dropzone provides proper ARIA attributes for drag and drop operations.
118
+ */
119
+ interface RootProps extends ComponentPropsWithout<'div', RemovedProps | 'onSubmit'>, ChatbarRootBaseProps {
120
+ }
121
+ declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLDivElement>>;
122
+ /**
123
+ * Multi-line text input for Chatbar.
124
+ * - Uses onChange to control value and avoid duplicate updates.
125
+ * - Auto-resizes between minLines and maxLines.
126
+ * - Expands on focus/overflow per `expandOn`.
127
+ * - Paste-to-attach: when `paste` is enabled on Root, pasting files adds attachments.
128
+ * - Provide `aria-label` or `aria-labelledby` for an accessible name.
129
+ */
130
+ interface TextareaProps extends Omit<React.ComponentPropsWithoutRef<'textarea'>, 'size'> {
131
+ asChild?: boolean;
132
+ /**
133
+ * Handler for paste events. This is forwarded to the underlying <textarea>.
134
+ */
135
+ onPaste?: React.ClipboardEventHandler<HTMLTextAreaElement>;
136
+ /**
137
+ * When true, pressing Enter submits via onSend (Shift+Enter inserts newline).
138
+ * Defaults to false.
139
+ */
140
+ submitOnEnter?: boolean;
141
+ }
142
+ /**
143
+ * Chatbar multi-line text input.
144
+ *
145
+ * Behavior
146
+ * - Controls the Chatbar value via React onChange. We intentionally do not
147
+ * update state in onInput to avoid duplicate updates per keystroke.
148
+ * - Auto-resizes between minLines and maxLines using layout measurements.
149
+ * - When expandOn is `overflow` or `both`, the Chatbar opens as soon as the
150
+ * content exceeds the compact height.
151
+ * - Height recalculations occur on change, paste, and whenever `value` or `open`
152
+ * changes via an isomorphic layout effect to avoid SSR warnings.
153
+ *
154
+ * Accessibility
155
+ * - Consumers should provide labeling via aria-label or aria-labelledby
156
+ * on this component, as no implicit label is rendered.
157
+ */
158
+ declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
159
+ interface InlineSlotProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
160
+ asChild?: boolean;
161
+ children?: React.ReactNode;
162
+ }
163
+ declare const InlineStart: React.ForwardRefExoticComponent<InlineSlotProps & React.RefAttributes<HTMLDivElement>>;
164
+ declare const InlineEnd: React.ForwardRefExoticComponent<InlineSlotProps & React.RefAttributes<HTMLDivElement>>;
165
+ /**
166
+ * Renders a horizontally scrollable list of attachments above the inline row.
167
+ * Hidden when empty unless `forceMount`. Override per-item with `renderAttachment`.
168
+ */
169
+ interface AttachmentsRowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
170
+ asChild?: boolean;
171
+ forceMount?: boolean;
172
+ /** If provided, custom-render a tile; otherwise default tile is used */
173
+ renderAttachment?: (attachment: ChatbarAttachment) => React.ReactNode;
174
+ }
175
+ declare const AttachmentsRow: React.ForwardRefExoticComponent<AttachmentsRowProps & React.RefAttributes<HTMLDivElement>>;
176
+ /** Default tile renderer for a single attachment. */
177
+ interface AttachmentProps extends React.ComponentPropsWithoutRef<'div'> {
178
+ attachment: ChatbarAttachment;
179
+ asChild?: boolean;
180
+ }
181
+ declare const Attachment: React.ForwardRefExoticComponent<AttachmentProps & React.RefAttributes<HTMLDivElement>>;
182
+ interface AttachTriggerProps extends React.ComponentPropsWithoutRef<'button'> {
183
+ asChild?: boolean;
184
+ accept?: string | string[];
185
+ multiple?: boolean;
186
+ }
187
+ declare const AttachTrigger: React.ForwardRefExoticComponent<AttachTriggerProps & React.RefAttributes<HTMLButtonElement>>;
188
+ interface RowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
189
+ asChild?: boolean;
190
+ children?: React.ReactNode;
191
+ }
192
+ declare const Row: React.ForwardRefExoticComponent<RowProps & React.RefAttributes<HTMLDivElement>>;
193
+ declare const RowStart: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
194
+ declare const RowEnd: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
195
+ interface SendProps extends Omit<IconButtonProps, 'size'> {
196
+ asChild?: boolean;
197
+ clearOnSend?: boolean;
198
+ }
199
+ declare const Send: React.ForwardRefExoticComponent<SendProps & React.RefAttributes<HTMLButtonElement>>;
200
+ export { Root, Textarea, InlineStart, InlineEnd, AttachmentsRow, Attachment, AttachTrigger, Row, RowStart, RowEnd, Send, };
201
+ export type { RootProps as ChatbarRootProps, TextareaProps as ChatbarTextareaProps, RowProps as ChatbarRowProps, SendProps as ChatbarSendProps, };
202
+ //# sourceMappingURL=chatbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatbar.d.ts","sourceRoot":"","sources":["../../../src/components/chatbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAMzF,KAAK,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AACvD,KAAK,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAGjD,4CAA4C;AAC5C,KAAK,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAChE;;;GAGG;AACH,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAyDD;;;;;;;;;;;;;;GAcG;AACH,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC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,gBAAgB,GAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";var qe=Object.create;var ie=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var Qe=(t,n)=>{for(var s in n)ie(t,s,{get:n[s],enumerable:!0})},He=(t,n,s,m)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of Ge(n))!Je.call(t,l)&&l!==s&&ie(t,l,{get:()=>n[l],enumerable:!(m=Ye(n,l))||m.enumerable});return t};var ze=(t,n,s)=>(s=t!=null?qe(_e(t)):{},He(n||!t||!t.__esModule?ie(s,"default",{value:t,enumerable:!0}):s,t)),Xe=t=>He(ie({},"__esModule",{value:!0}),t);var Ze={};Qe(Ze,{AttachTrigger:()=>Te,Attachment:()=>ce,AttachmentsRow:()=>we,InlineEnd:()=>Pe,InlineStart:()=>Re,Root:()=>xe,Row:()=>Ee,RowEnd:()=>Me,RowStart:()=>Se,Send:()=>Oe,Textarea:()=>Ae});module.exports=Xe(Ze);var e=ze(require("react")),S=ze(require("classnames")),ge=require("./icon-button.js"),me=require("./icons.js"),ae=require("./flex.js"),De=require("./scroll-area.js"),H=require("./slot.js"),ve=require("./card.js"),le=require("./text.js"),ke=require("react-dropzone");const Fe=typeof window<"u"?e.useLayoutEffect:e.useEffect,Ie=e.createContext(null),k=()=>{const t=e.useContext(Ie);if(!t)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return t},xe=e.forwardRef((t,n)=>{const{className:s,style:m,children:l,value:u,defaultValue:y="",onValueChange:p,open:d,defaultOpen:r=!1,onOpenChange:v,expandOn:P="both",minLines:A=1,maxLines:w=6,sendMode:T="whenDirty",disabled:j,readOnly:Y,onSubmit:z,size:O="2",variant:W,width:U,maxWidth:K,asChild:N,attachments:F,defaultAttachments:oe=[],onAttachmentsChange:$,accept:G,multiple:_=!0,maxAttachments:V,maxFileSize:M,paste:se=!0,pasteAccept:B,clearOnSubmit:L=!0,onAttachmentReject:h,dropzone:I=!0,...de}=t,J=u!=null,[ue,pe]=e.useState(y),a=J?u:ue,c=d!=null,[x,g]=e.useState(r),E=c?d:x,Q=e.useRef(null),he=e.useRef(null),q=F!=null,[X,Z]=e.useState(oe),D=q?F:X,ee=e.useRef(new Set),fe=o=>Array.isArray(o)?o:typeof o=="string"?o.split(",").map(i=>i.trim()):[],te=fe(G),Le=fe(B).length>0?fe(B):te,be=(o,i)=>{if(i.length===0)return!0;const f=o.type.toLowerCase(),R=o.name.toLowerCase();for(const b of i){const C=b.toLowerCase();if(C.includes("/")){const[re,ye]=C.split("/"),[ne,$e]=f.split("/");if(re==="*"||re===ne&&(ye==="*"||ye===$e))return!0}else if(C.startsWith(".")&&R.endsWith(C))return!0}return!1},je=o=>{const i=[],f=[],R=typeof V=="number"?Math.max(V-D.length,0):1/0;for(const b of o){if(i.length>=R){f.push({file:b,reason:"count"});continue}if(typeof M=="number"&&b.size>M){f.push({file:b,reason:"size"});continue}if(!be(b,te)){f.push({file:b,reason:"type"});continue}const C=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,re=/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(b.name),ne=(b.type||"").toLowerCase().startsWith("image/")||re?URL.createObjectURL(b):void 0;ne&&ee.current.add(ne),i.push({id:C,name:b.name,size:b.size,type:b.type,url:ne,status:"idle"})}return{accepted:i,rejected:f}},Ce=o=>{const{accepted:i,rejected:f}=je(o);if(i.length>0){const R=D.concat(i);q||Z(R),$?.(R)}f.length>0&&h?.(f)},We=o=>{const i=C=>Le.length===0?be(C,te):be(C,Le),f=[],R=[],b=typeof V=="number"?Math.max(V-D.length,0):1/0;for(const C of o){if(f.length>=b){R.push({file:C,reason:"count"});continue}if(typeof M=="number"&&C.size>M){R.push({file:C,reason:"size"});continue}if(!i(C)){R.push({file:C,reason:"type"});continue}f.push(C)}f.length>0&&Ce(f),R.length>0&&h?.(R)};e.useEffect(()=>{const o=new Set(D.map(i=>i.url).filter(Boolean));for(const i of Array.from(ee.current))o.has(i)||(URL.revokeObjectURL(i),ee.current.delete(i))},[D]),e.useEffect(()=>()=>{for(const o of Array.from(ee.current))URL.revokeObjectURL(o);ee.current.clear()},[]);const Ve=N?H.Slot:"div",Be=e.useCallback(o=>{const i=o.relatedTarget,f=Q.current;f&&(i&&f.contains(i)||(a?.trim?.()??"").length===0&&(c||g(!1),v?.(!1)))},[c,v,a]),{getRootProps:Ue,getInputProps:Ke,isDragActive:Ne}=(0,ke.useDropzone)({onDrop:(o,i)=>{if(o.length>0&&Ce(o),i.length>0&&h){const f=i.map(({file:R,errors:b})=>{const C=b[0]?.code==="file-too-large"?"size":b[0]?.code==="file-invalid-type"?"type":"count";return{file:R,reason:C}});h(f)}},accept:te.length>0?te.reduce((o,i)=>(i.includes("/")?o[i]=[]:i.startsWith(".")&&(o[i]=[]),o),{}):void 0,multiple:_,maxSize:M,noClick:!0,noKeyboard:!0,disabled:!I||j});return e.createElement(Ie.Provider,{value:{open:E,setOpen:o=>{c||g(o),v?.(o)},isOpenControlled:c,value:a,setValue:o=>{J||pe(o),p?.(o)},isValueControlled:J,size:O,expandOn:P,minLines:A,maxLines:w,sendMode:T,disabled:j,readOnly:Y,onSubmit:z,rootRef:Q,textareaRef:he,attachments:D,setAttachments:o=>{q||Z(o),$?.(o)},isAttachmentsControlled:q,accept:G,multiple:_,maxAttachments:V,maxFileSize:M,paste:se,pasteAccept:B,clearOnSubmit:L,onAttachmentReject:h,dropzone:I,appendFiles:Ce,appendFilesFromPaste:We}},e.createElement(Ve,{...de,ref:o=>{typeof n=="function"?n(o):n&&(n.current=o),Q.current=o},className:(0,S.default)("rt-ChatbarRoot",`rt-r-size-${O}`,s),style:{position:"relative",width:U,maxWidth:K,...m},"data-state":E?"open":"closed","data-disabled":j?"":void 0,"data-readonly":Y?"":void 0,"data-drop-active":I&&Ne?"":void 0,"aria-expanded":E,onBlurCapture:Be},I&&e.createElement("input",{...Ke()}),e.createElement("div",{...I?Ue():{},style:{width:"100%",height:"100%"}},e.createElement(ve.Card,{className:"rt-ChatbarCard",size:Math.min(3,Number(O)+1).toString(),variant:W,style:{position:"relative"}},e.createElement("div",{className:"rt-ChatbarGrid"},l),I&&Ne&&e.createElement("div",{className:"rt-ChatbarDropOverlay"},e.createElement("div",{className:"rt-ChatbarDropContent"},e.createElement(le.Text,{color:"gray",size:O,weight:"medium"},"Drop files here to attach")))))))});xe.displayName="Chatbar.Root";const Ae=e.forwardRef((t,n)=>{const{className:s,style:m,asChild:l,onFocus:u,onInput:y,onChange:p,onPaste:d,onKeyDown:r,submitOnEnter:v=!1,rows:P,...A}=t,w=k(),{open:T,minLines:j,maxLines:Y,expandOn:z,disabled:O,readOnly:W,setOpen:U,setValue:K,textareaRef:N,value:F,isValueControlled:oe,sendMode:$,paste:G,appendFilesFromPaste:_,size:V}=w,M=e.useRef(0),se=e.useRef(0),B=e.useRef(0),L=e.useCallback(()=>{const a=N.current;if(!a)return;const c=window.getComputedStyle(a),x=parseFloat(c.lineHeight)||20,g=parseFloat(c.paddingTop)||0,E=parseFloat(c.paddingBottom)||0;M.current=x,se.current=g+E,B.current=Math.ceil(1*x)+g+E},[N]),h=e.useCallback(a=>{const c=N.current;if(!c)return;c.style.height="auto",M.current===0&&L();const x=M.current,g=se.current,E=a??T,Q=E?j:1,he=E?Y:1,q=Math.ceil(Q*x)+g,X=Math.ceil(he*x)+g,Z=Math.max(c.scrollHeight,q),D=Math.min(Z,X);c.style.height=`${D}px`,Z>X?(c.style.overflowY="auto",c.style.maxHeight=`${X}px`):(c.style.overflowY="hidden",c.style.maxHeight="none")},[T,j,Y,N,L]);Fe(()=>{h()},[h,F,T]),Fe(()=>{L(),h()},[L,h,V]),e.useEffect(()=>{const a=N.current;if(!a||typeof ResizeObserver>"u")return;let c=M.current;const x=new ResizeObserver(()=>{const g=window.getComputedStyle(a),E=parseFloat(g.lineHeight)||20;E!==c&&(c=E,L(),requestAnimationFrame(()=>h()))});return x.observe(a),()=>x.disconnect()},[N,L,h]),e.useEffect(()=>{},[]);const I=e.useCallback(a=>{O||W||((z==="focus"||z==="both")&&!T&&U(!0),u?.(a))},[O,W,z,T,U,u]),de=e.useCallback(a=>{const c=a.currentTarget,x=c.value;K(x),(z==="overflow"||z==="both")&&!T&&(c.style.height="auto",B.current===0&&L(),c.scrollHeight>B.current+1&&(U(!0),h(!0),requestAnimationFrame(()=>h(!0)))),requestAnimationFrame(()=>h()),p?.(a)},[z,T,U,K,p,h,L]),J=e.useCallback(a=>{if(G){const x=Array.from(a.clipboardData?.items??[]).filter(g=>g.kind==="file").map(g=>g.getAsFile()).filter(g=>!!g);x.length>0&&_(x)}setTimeout(()=>{T?h():h(!0)},0),d?.(a)},[G,T,h,d,_]),ue=e.useCallback(a=>{if(!v){r?.(a);return}if(a.key==="Enter"&&!a.shiftKey&&!a.altKey&&!a.ctrlKey&&!a.metaKey&&!a.nativeEvent.isComposing){if(O||W){r?.(a);return}if($==="never"){r?.(a);return}const c=F.trim();if($==="whenDirty"&&c.length===0){r?.(a);return}a.preventDefault(),w.onSubmit?.({value:F,attachments:w.attachments}),w.clearOnSubmit&&(oe||K(""),w.setAttachments([]))}r?.(a)},[v,O,W,$,F,oe,K,w,r]),pe=l?H.Slot:"textarea";return e.createElement("div",{className:(0,S.default)("rt-ChatbarField","rt-ChatbarTextarea",s)},e.createElement(pe,{...A,ref:a=>{typeof n=="function"?n(a):n&&(n.current=a),N.current=a},className:"rt-ChatbarInput",value:F,onInput:y,onChange:de,onFocus:I,onPaste:J,onKeyDown:ue,disabled:O,readOnly:W,rows:T?j:1,spellCheck:A.spellCheck??!0,autoCorrect:A.autoCorrect??"on",style:m}))});Ae.displayName="Chatbar.Textarea";const Re=e.forwardRef((t,n)=>{const{children:s,asChild:m,style:l,className:u,...y}=t;return k().open?null:e.createElement(m?H.Slot:"div",{...y,ref:n,className:(0,S.default)("rt-ChatbarInlineStart",u),style:l},s)});Re.displayName="Chatbar.InlineStart";const Pe=e.forwardRef((t,n)=>{const{children:s,asChild:m,style:l,className:u,...y}=t;return k().open?null:e.createElement(m?H.Slot:"div",{...y,ref:n,className:(0,S.default)("rt-ChatbarInlineEnd",u),style:l},s)});Pe.displayName="Chatbar.InlineEnd";const we=e.forwardRef((t,n)=>{const{asChild:s,forceMount:m,renderAttachment:l,className:u,style:y,...p}=t,d=k();return!(d.attachments.length>0)&&!m?null:e.createElement(s?H.Slot:"div",{...p,ref:n,className:(0,S.default)("rt-ChatbarAttachmentsRow",u),style:y,role:"list","aria-label":p["aria-label"]??"Attachments"},e.createElement(De.ScrollArea,{className:"rt-ChatbarScrollArea",scrollbars:"horizontal",size:"1"},e.createElement(ae.Flex,{align:"center",gap:"2",style:{minWidth:"fit-content"}},d.attachments.map(P=>e.createElement(ce,{key:P.id,attachment:P,asChild:!!l},l?.(P))))))});we.displayName="Chatbar.AttachmentsRow";const ce=e.forwardRef((t,n)=>{const{attachment:s,asChild:m,className:l,style:u,children:y,...p}=t,d=k(),r=m?H.Slot:"div",v=!!s.url&&s.type.startsWith("image/");return e.createElement(r,{...p,ref:n,className:(0,S.default)("rt-ChatbarAttachment",l),style:u,role:"listitem","data-kind":v?"image":"file",title:s.name},y??e.createElement(ve.Card,{size:d.size,variant:"soft"},e.createElement(ae.Flex,{align:"center",gap:"3",pr:v?void 0:"6"},e.createElement("div",{className:"rt-ChatbarAttachmentPreview","aria-hidden":!0},v?e.createElement("img",{className:"rt-ChatbarAttachmentImage",src:s.url,alt:""}):e.createElement(me.FileTextIcon,null)),!v&&e.createElement(ae.Flex,{direction:"column",gap:"0",style:{minWidth:0}},e.createElement(le.Text,{size:d.size,weight:"medium",style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},s.name),e.createElement(le.Text,{size:"1",color:"gray"},Math.ceil(s.size/1024)," KB")),e.createElement(ge.IconButton,{className:"rt-ChatbarAttachmentRemove","aria-label":`Remove ${s.name}`,size:"1",variant:"classic",highContrast:!0,color:"gray",onClick:()=>d.setAttachments(d.attachments.filter(P=>P.id!==s.id))},e.createElement(me.CloseIcon,null)))))});ce.displayName="Chatbar.Attachment";const Te=e.forwardRef((t,n)=>{const{asChild:s,accept:m,multiple:l,className:u,style:y,...p}=t,d=k(),r=e.useRef(null),v=s?H.Slot:"button",P=(Array.isArray(m)?m:m?.split(",")??[]).join(",");return e.createElement(e.Fragment,null,e.createElement(v,{...p,ref:n,className:(0,S.default)("rt-ChatbarAttachTrigger",u),style:y,type:p.type??"button","aria-label":p["aria-label"]??"Add attachments",onClick:A=>{r.current&&r.current.click(),p.onClick?.(A)}}),e.createElement("input",{ref:r,type:"file",accept:P,multiple:l??d.multiple,tabIndex:-1,style:{display:"none"},onChange:A=>{const w=Array.from(A.currentTarget.files??[]);w.length>0&&d.appendFiles(w),A.currentTarget.value=""}}))});Te.displayName="Chatbar.AttachTrigger";const Ee=e.forwardRef((t,n)=>{const{asChild:s,children:m,className:l,style:u,...y}=t;return k().open?e.createElement(s?H.Slot:"div",{...y,ref:n,className:(0,S.default)("rt-ChatbarRow",l),style:u},e.createElement(ae.Flex,{align:"center",justify:"between",width:"100%"},m)):null});Ee.displayName="Chatbar.Row";const Se=e.forwardRef((t,n)=>{const{className:s,style:m,...l}=t;return e.createElement("div",{...l,ref:n,className:(0,S.default)("rt-ChatbarRowStart",s),style:m})});Se.displayName="Chatbar.RowStart";const Me=e.forwardRef((t,n)=>{const{className:s,style:m,...l}=t;return e.createElement("div",{...l,ref:n,className:(0,S.default)("rt-ChatbarRowEnd",s),style:m})});Me.displayName="Chatbar.RowEnd";const Oe=e.forwardRef((t,n)=>{const{asChild:s,clearOnSend:m=!0,disabled:l,children:u,className:y,style:p,...d}=t,r=k(),v=r.value.trim(),P=r.sendMode==="always"||r.sendMode==="whenDirty"&&v.length>0;if(r.sendMode==="never")return null;const A=w=>{r.disabled||r.readOnly||(r.onSubmit?.({value:r.value,attachments:r.attachments}),m&&(r.isValueControlled||r.setValue(""),r.clearOnSubmit&&r.setAttachments([])),d.onClick?.(w))};return e.createElement(ge.IconButton,{...d,ref:n,size:r.size,variant:r.open?"solid":"ghost",disabled:l||r.disabled||r.readOnly,className:(0,S.default)("rt-ChatbarSend",y),style:{opacity:P?1:0,pointerEvents:P?"auto":"none",...p},asChild:s,onClick:A,"aria-label":d["aria-label"]??"Send"},u??"Send")});Oe.displayName="Chatbar.Send";
2
+ //# sourceMappingURL=chatbar.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/chatbar.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { IconButton, type IconButtonProps } from './icon-button.js';\nimport { CloseIcon, FileTextIcon } from './icons.js';\nimport { Flex } from './flex.js';\n\nimport { ScrollArea } from './scroll-area.js';\nimport { Slot } from './slot.js';\nimport { Card } from './card.js';\nimport { Text } from './text.js';\nimport { useDropzone } from 'react-dropzone';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\n// Avoid SSR warnings by using an isomorphic layout effect\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\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 * - `url` is an object URL used for image previews and is revoked on removal.\n */\ninterface ChatbarAttachment {\n id: string;\n name: string;\n size: number;\n type: string;\n url?: string;\n status?: AttachmentStatus;\n progress?: number;\n meta?: Record<string, unknown>;\n}\n\ninterface ChatbarContextValue {\n open: boolean;\n setOpen(next: boolean): void;\n isOpenControlled: boolean;\n\n value: string;\n setValue(next: string): void;\n isValueControlled: boolean;\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\n // Submit returns both message and attachments\n onSubmit?: (payload: { value: string; attachments: ChatbarAttachment[] }) => void;\n\n rootRef: React.RefObject<HTMLDivElement | null>;\n textareaRef: React.RefObject<HTMLTextAreaElement | null>;\n\n // Attachments state\n attachments: ChatbarAttachment[];\n setAttachments(next: ChatbarAttachment[]): void;\n isAttachmentsControlled: boolean;\n\n // Config\n accept?: string | string[];\n multiple: boolean;\n maxAttachments?: number;\n maxFileSize?: number;\n paste: boolean;\n pasteAccept?: string | string[];\n clearOnSubmit: boolean;\n\n // Dropzone\n dropzone: boolean;\n\n // Events\n onAttachmentReject?: (rejections: { file: File; reason: 'type' | 'size' | 'count' }[]) => void;\n\n // Helpers\n appendFiles(files: File[]): void;\n appendFilesFromPaste(files: File[]): void;\n}\n\nconst ChatbarContext = React.createContext<ChatbarContextValue | null>(null);\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\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`, `maxAttachments`, and `maxFileSize`.\n * - Rejections are reported via `onAttachmentReject`.\n *\n * Submit\n * - `onSubmit({ value, attachments })` emits both message and attachments.\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 expandOn?: ExpandOn;\n\n /** Minimum number of lines in compact state (default: 1) */\n minLines?: number;\n /** Maximum number of lines before scrolling (default: 6) */\n maxLines?: number;\n\n sendMode?: SendMode;\n\n disabled?: boolean;\n readOnly?: boolean;\n\n /** Combined submit payload */\n onSubmit?: (payload: { value: string; attachments: ChatbarAttachment[] }) => void;\n\n size?: '1' | '2' | '3';\n variant?: 'surface' | 'outline' | 'classic' | 'ghost' | 'soft';\n\n width?: React.CSSProperties['width'];\n maxWidth?: React.CSSProperties['maxWidth'];\n asChild?: boolean;\n\n // Attachments API\n attachments?: ChatbarAttachment[];\n defaultAttachments?: ChatbarAttachment[];\n onAttachmentsChange?: (attachments: ChatbarAttachment[]) => void;\n accept?: string | string[];\n multiple?: boolean;\n maxAttachments?: number;\n maxFileSize?: number;\n paste?: boolean;\n pasteAccept?: string | string[];\n clearOnSubmit?: boolean;\n onAttachmentReject?: (rejections: { file: File; reason: 'type' | 'size' | 'count' }[]) => 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, maxFileSize, maxAttachments)\n * - Visual feedback shows during drag operations\n * - Rejected files trigger onAttachmentReject\n *\n * @default true\n */\n dropzone?: boolean;\n}\n\ntype RootElement = React.ElementRef<'div'>;\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 * - Sets `aria-expanded` to reflect open/closed state for assistive technologies.\n *\n * Attachments\n * - Controlled/uncontrolled attachments with client-side filtering.\n * - Filters by `accept`/`pasteAccept`, `maxAttachments`, and `maxFileSize`.\n * - Rejections are reported via `onAttachmentReject`.\n * - Paste-to-attach: when `paste` is enabled, pasting files adds attachments.\n *\n * Dropzone\n * - When `dropzone` is true, enables drag-and-drop file uploads.\n * - Files are validated using the same rules as paste and file picker.\n * - Visual feedback via `data-drop-active` attribute during drag operations.\n * - Rejected files trigger `onAttachmentReject` with appropriate reasons.\n *\n * Submit\n * - `onSubmit` receives both message text and attachments array.\n * - `clearOnSubmit` controls whether attachments are cleared after submission.\n *\n * Accessibility\n * - Consumers should label the `Textarea` via `aria-label`/`aria-labelledby`.\n * - `aria-expanded` on the root reflects the disclosure state of the input area.\n * - Dropzone provides proper ARIA attributes for drag and drop operations.\n */\ninterface RootProps\n extends ComponentPropsWithout<'div', RemovedProps | 'onSubmit'>,\n 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: onValueChangeProp,\n open: openProp,\n defaultOpen = false,\n onOpenChange: onOpenChangeProp,\n expandOn = 'both',\n minLines = 1,\n maxLines = 6,\n sendMode = 'whenDirty',\n disabled,\n readOnly,\n onSubmit,\n size = '2',\n variant,\n width,\n maxWidth,\n asChild,\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 ...divProps\n } = props;\n\n const isValueControlled = valueProp != null;\n const [valueUncontrolled, setValueUncontrolled] = React.useState<string>(defaultValue);\n const value = isValueControlled ? (valueProp as string) : valueUncontrolled;\n\n const isOpenControlled = openProp != null;\n const [openUncontrolled, setOpenUncontrolled] = React.useState<boolean>(defaultOpen);\n const open = isOpenControlled ? (openProp as boolean) : openUncontrolled;\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n\n // Attachments state\n const isAttachmentsControlled = attachmentsProp != null;\n const [attachmentsUncontrolled, setAttachmentsUncontrolled] =\n React.useState<ChatbarAttachment[]>(defaultAttachments);\n const attachments = isAttachmentsControlled\n ? (attachmentsProp as ChatbarAttachment[])\n : attachmentsUncontrolled;\n\n // Track generated object URLs for cleanup\n const generatedUrlSetRef = React.useRef<Set<string>>(new Set());\n\n const toArray = (val: string | string[] | undefined) =>\n Array.isArray(val) ? val : typeof val === 'string' ? val.split(',').map((s) => s.trim()) : [];\n\n const accepts = toArray(accept);\n const pasteAccepts = toArray(pasteAccept).length > 0 ? toArray(pasteAccept) : accepts;\n\n const 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 // MIME pattern\n const [type, subtype] = pat.split('/');\n const [fmType, fmSubtype] = mime.split('/');\n if (type === '*' || (type === fmType && (subtype === '*' || subtype === fmSubtype)))\n return true;\n } else if (pat.startsWith('.')) {\n if (name.endsWith(pat)) return true;\n }\n }\n return false;\n };\n\n /**\n * Maps File objects to attachments with validation and preview URL generation.\n */\n const mapFilesToAttachments = (\n files: File[],\n ): {\n accepted: ChatbarAttachment[];\n rejected: { file: File; reason: 'type' | 'size' | 'count' }[];\n } => {\n const next: ChatbarAttachment[] = [];\n const rejected: { file: File; reason: 'type' | 'size' | 'count' }[] = [];\n\n const remainingSlots =\n typeof maxAttachments === 'number'\n ? Math.max(maxAttachments - attachments.length, 0)\n : Infinity;\n\n for (const file of files) {\n if (next.length >= remainingSlots) {\n rejected.push({ file, reason: 'count' });\n continue;\n }\n if (typeof maxFileSize === 'number' && file.size > maxFileSize) {\n rejected.push({ file, reason: 'size' });\n continue;\n }\n if (!matchesAccept(file, accepts)) {\n rejected.push({ file, reason: 'type' });\n continue;\n }\n const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n const looksLikeImageByExt = /\\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(file.name);\n const isImageType = (file.type || '').toLowerCase().startsWith('image/');\n const url = isImageType || looksLikeImageByExt ? URL.createObjectURL(file) : undefined;\n if (url) generatedUrlSetRef.current.add(url);\n next.push({ id, name: file.name, size: file.size, type: file.type, url, status: 'idle' });\n }\n return { accepted: next, rejected };\n };\n\n const appendFiles = (files: File[]) => {\n const { accepted, rejected } = mapFilesToAttachments(files);\n if (accepted.length > 0) {\n const merged = attachments.concat(accepted);\n if (!isAttachmentsControlled) setAttachmentsUncontrolled(merged);\n onAttachmentsChange?.(merged);\n }\n if (rejected.length > 0) onAttachmentReject?.(rejected);\n };\n\n const appendFilesFromPaste = (files: File[]) => {\n // Use pasteAccepts for type filtering\n const matches = (file: File) => {\n if (pasteAccepts.length === 0) return matchesAccept(file, accepts);\n return matchesAccept(file, pasteAccepts);\n };\n const acceptedFiles: File[] = [];\n const rejected: { file: File; reason: 'type' | 'size' | 'count' }[] = [];\n\n // Enforce maxAttachments and maxFileSize\n const remainingSlots =\n typeof maxAttachments === 'number'\n ? Math.max(maxAttachments - attachments.length, 0)\n : Infinity;\n for (const file of files) {\n if (acceptedFiles.length >= remainingSlots) {\n rejected.push({ file, reason: 'count' });\n continue;\n }\n if (typeof maxFileSize === 'number' && file.size > maxFileSize) {\n rejected.push({ file, reason: 'size' });\n continue;\n }\n if (!matches(file)) {\n rejected.push({ file, reason: 'type' });\n continue;\n }\n acceptedFiles.push(file);\n }\n if (acceptedFiles.length > 0) appendFiles(acceptedFiles);\n if (rejected.length > 0) onAttachmentReject?.(rejected);\n };\n\n // Revoke object URLs that are no longer referenced by current attachments\n React.useEffect(() => {\n const currentUrls = new Set(attachments.map((a) => a.url).filter(Boolean) as string[]);\n for (const url of Array.from(generatedUrlSetRef.current)) {\n if (!currentUrls.has(url)) {\n URL.revokeObjectURL(url);\n generatedUrlSetRef.current.delete(url);\n }\n }\n }, [attachments]);\n\n // Revoke any remaining generated URLs on unmount\n React.useEffect(() => {\n return () => {\n for (const url of Array.from(generatedUrlSetRef.current)) {\n URL.revokeObjectURL(url);\n }\n generatedUrlSetRef.current.clear();\n };\n }, []);\n\n const Comp = asChild ? Slot : ('div' as any);\n\n const handleBlurCapture = React.useCallback(\n (event: React.FocusEvent) => {\n const nextTarget = event.relatedTarget as Node | null;\n const rootEl = rootRef.current;\n if (!rootEl) return;\n // If focus remains within root, ignore\n if (nextTarget && rootEl.contains(nextTarget)) return;\n // Collapse when leaving the root if the value is empty\n if ((value?.trim?.() ?? '').length === 0) {\n if (!isOpenControlled) setOpenUncontrolled(false);\n onOpenChangeProp?.(false);\n }\n },\n [isOpenControlled, onOpenChangeProp, value],\n );\n\n // Dropzone functionality\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop: (acceptedFiles, rejectedFiles) => {\n if (acceptedFiles.length > 0) {\n appendFiles(acceptedFiles);\n }\n if (rejectedFiles.length > 0 && onAttachmentReject) {\n const rejections = rejectedFiles.map(({ file, errors }) => {\n const reason =\n errors[0]?.code === 'file-too-large'\n ? 'size'\n : errors[0]?.code === 'file-invalid-type'\n ? 'type'\n : 'count';\n return { file, reason: reason as 'type' | 'size' | 'count' };\n });\n onAttachmentReject(rejections);\n }\n },\n accept:\n accepts.length > 0\n ? accepts.reduce(\n (acc, pattern) => {\n if (pattern.includes('/')) {\n // MIME type pattern\n acc[pattern] = [];\n } else if (pattern.startsWith('.')) {\n // File extension pattern\n acc[pattern] = [];\n }\n return acc;\n },\n {} as Record<string, string[]>,\n )\n : undefined,\n multiple,\n maxSize: maxFileSize,\n noClick: true,\n noKeyboard: true,\n disabled: !dropzone || disabled,\n });\n\n return (\n <ChatbarContext.Provider\n value={{\n open,\n setOpen: (next) => {\n if (!isOpenControlled) setOpenUncontrolled(next);\n onOpenChangeProp?.(next);\n },\n isOpenControlled,\n value,\n setValue: (next) => {\n if (!isValueControlled) setValueUncontrolled(next);\n onValueChangeProp?.(next);\n },\n isValueControlled,\n size,\n expandOn,\n minLines,\n maxLines,\n sendMode,\n disabled,\n readOnly,\n onSubmit,\n rootRef,\n textareaRef,\n attachments,\n setAttachments: (next) => {\n if (!isAttachmentsControlled) setAttachmentsUncontrolled(next);\n onAttachmentsChange?.(next);\n },\n isAttachmentsControlled,\n accept,\n multiple,\n maxAttachments,\n maxFileSize,\n paste,\n pasteAccept,\n clearOnSubmit,\n onAttachmentReject,\n dropzone,\n appendFiles,\n appendFilesFromPaste,\n }}\n >\n <Comp\n {...divProps}\n ref={(node: HTMLDivElement) => {\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n (rootRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }}\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={dropzone && isDragActive ? '' : undefined}\n aria-expanded={open}\n onBlurCapture={handleBlurCapture}\n >\n {dropzone && <input {...getInputProps()} />}\n <div {...(dropzone ? getRootProps() : {})} style={{ width: '100%', height: '100%' }}>\n <Card\n className=\"rt-ChatbarCard\"\n size={Math.min(3, Number(size) + 1).toString() as '1' | '2' | '3'}\n variant={variant as any}\n style={{ position: 'relative' }}\n >\n <div className=\"rt-ChatbarGrid\">{children}</div>\n {dropzone && isDragActive && (\n <div className=\"rt-ChatbarDropOverlay\">\n <div className=\"rt-ChatbarDropContent\">\n <Text color=\"gray\" size={size} weight=\"medium\">\n Drop files here to attach\n </Text>\n </div>\n </div>\n )}\n </Card>\n </div>\n </Comp>\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'> {\n asChild?: boolean;\n /**\n * Handler for paste events. This is forwarded to the underlying <textarea>.\n */\n onPaste?: React.ClipboardEventHandler<HTMLTextAreaElement>;\n /**\n * When true, pressing Enter submits via onSend (Shift+Enter inserts newline).\n * 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. We intentionally do not\n * update state in onInput to avoid duplicate updates per keystroke.\n * - Auto-resizes between minLines and maxLines using layout measurements.\n * - When expandOn is `overflow` or `both`, the Chatbar opens as soon as the\n * content exceeds the compact height.\n * - Height recalculations occur on change, paste, and whenever `value` or `open`\n * changes via an isomorphic layout effect to avoid SSR warnings.\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 onInput,\n onChange,\n onPaste,\n onKeyDown,\n submitOnEnter = false,\n rows,\n ...textareaProps\n } = props;\n const ctx = useChatbarContext();\n const {\n open,\n minLines,\n maxLines,\n expandOn,\n disabled,\n readOnly,\n setOpen,\n setValue,\n textareaRef,\n value,\n isValueControlled,\n sendMode,\n paste,\n appendFilesFromPaste,\n size,\n } = ctx;\n\n // Cached metrics to avoid repeated getComputedStyle calls\n const lineHeightRef = React.useRef<number>(0);\n const paddingRef = React.useRef<number>(0);\n const compactHeightRef = React.useRef<number>(0);\n\n const recomputeMetrics = React.useCallback(() => {\n const el = textareaRef.current;\n if (!el) return;\n const computedStyle = window.getComputedStyle(el);\n const lineHeight = parseFloat(computedStyle.lineHeight) || 20;\n const paddingTop = parseFloat(computedStyle.paddingTop) || 0;\n const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;\n lineHeightRef.current = lineHeight;\n paddingRef.current = paddingTop + paddingBottom;\n compactHeightRef.current = Math.ceil(1 * lineHeight) + paddingTop + paddingBottom;\n }, [textareaRef]);\n\n // Auto-resize logic - optimized for fixed widths\n const updateHeight = React.useCallback(\n (forceOpen?: boolean) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n\n textarea.style.height = 'auto';\n\n if (lineHeightRef.current === 0) {\n recomputeMetrics();\n }\n const lineHeight = lineHeightRef.current;\n const padding = paddingRef.current;\n\n const isOpen = forceOpen ?? open;\n const effectiveMinLines = isOpen ? minLines : 1;\n const effectiveMaxLines = isOpen ? maxLines : 1;\n\n const minHeight = Math.ceil(effectiveMinLines * lineHeight) + padding;\n const maxHeight = Math.ceil(effectiveMaxLines * lineHeight) + padding;\n\n const contentHeight = Math.max(textarea.scrollHeight, minHeight);\n const finalHeight = Math.min(contentHeight, maxHeight);\n\n textarea.style.height = `${finalHeight}px`;\n\n if (contentHeight > maxHeight) {\n textarea.style.overflowY = 'auto';\n textarea.style.maxHeight = `${maxHeight}px`;\n } else {\n textarea.style.overflowY = 'hidden';\n textarea.style.maxHeight = 'none';\n }\n },\n [open, minLines, maxLines, textareaRef, recomputeMetrics],\n );\n\n // Update height when value or open state changes\n useIsomorphicLayoutEffect(() => {\n updateHeight();\n }, [updateHeight, value, open]);\n\n // Recompute metrics on mount and when size changes may affect typography\n useIsomorphicLayoutEffect(() => {\n recomputeMetrics();\n updateHeight();\n }, [recomputeMetrics, updateHeight, size]);\n\n // Observe responsive changes that alter line-height\n React.useEffect(() => {\n const el = textareaRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return;\n let prevLineHeight = lineHeightRef.current;\n const ro = new ResizeObserver(() => {\n const computedStyle = window.getComputedStyle(el);\n const lh = parseFloat(computedStyle.lineHeight) || 20;\n if (lh !== prevLineHeight) {\n prevLineHeight = lh;\n recomputeMetrics();\n requestAnimationFrame(() => updateHeight());\n }\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, [textareaRef, recomputeMetrics, updateHeight]);\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 =\n textareaProps['aria-label'] != null || textareaProps['aria-labelledby'] != null;\n if (!hasLabel) {\n // eslint-disable-next-line no-console\n console.warn(\n '[Chatbar.Textarea] Provide aria-label or aria-labelledby to ensure the control has an accessible name.',\n );\n }\n // warn only on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Note: No MutationObserver is used because <textarea> value changes are not\n // reflected in DOM text nodes. Height updates are handled by effects and events.\n\n const handleFocus = React.useCallback<React.FocusEventHandler<HTMLTextAreaElement>>(\n (event) => {\n if (disabled || readOnly) return;\n if ((expandOn === 'focus' || expandOn === 'both') && !open) setOpen(true);\n onFocus?.(event);\n },\n [disabled, readOnly, expandOn, open, setOpen, onFocus],\n );\n\n const handleChange = React.useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n (event) => {\n const el = event.currentTarget;\n const nextValue = el.value;\n setValue(nextValue);\n\n if ((expandOn === 'overflow' || expandOn === 'both') && !open) {\n el.style.height = 'auto';\n\n if (compactHeightRef.current === 0) {\n recomputeMetrics();\n }\n const shouldExpand = el.scrollHeight > compactHeightRef.current + 1;\n if (shouldExpand) {\n setOpen(true);\n // Immediately size for open state to avoid 1-line + scrollbar flash\n updateHeight(true);\n requestAnimationFrame(() => updateHeight(true));\n }\n }\n\n // Always recalc after any input\n requestAnimationFrame(() => updateHeight());\n onChange?.(event);\n },\n [expandOn, open, setOpen, setValue, onChange, updateHeight, recomputeMetrics],\n );\n\n const handlePaste = React.useCallback<React.ClipboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n // Attach files from clipboard if enabled\n if (paste) {\n const items = Array.from(event.clipboardData?.items ?? []);\n const files = items\n .filter((i) => i.kind === 'file')\n .map((i) => i.getAsFile())\n .filter((f): f is File => !!f);\n if (files.length > 0) {\n appendFilesFromPaste(files);\n }\n }\n setTimeout(() => {\n // If pasting in compact mode, force sizing as open if content overflowed\n if (!open) {\n updateHeight(true);\n } else {\n updateHeight();\n }\n }, 0);\n onPaste?.(event);\n },\n [paste, open, updateHeight, onPaste, appendFilesFromPaste],\n );\n\n const handleKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n if (!submitOnEnter) {\n onKeyDown?.(event);\n return;\n }\n if (\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.nativeEvent.isComposing\n ) {\n if (disabled || readOnly) {\n onKeyDown?.(event);\n return;\n }\n if (sendMode === 'never') {\n onKeyDown?.(event);\n return;\n }\n const trimmed = value.trim();\n if (sendMode === 'whenDirty' && trimmed.length === 0) {\n onKeyDown?.(event);\n return;\n }\n event.preventDefault();\n ctx.onSubmit?.({ value, attachments: ctx.attachments });\n if (ctx.clearOnSubmit) {\n if (!isValueControlled) setValue('');\n ctx.setAttachments([]);\n }\n }\n onKeyDown?.(event);\n },\n [\n submitOnEnter,\n disabled,\n readOnly,\n sendMode,\n value,\n isValueControlled,\n setValue,\n ctx,\n onKeyDown,\n ],\n );\n\n const Comp = asChild ? Slot : ('textarea' as any);\n return (\n <div className={classNames('rt-ChatbarField', 'rt-ChatbarTextarea', className)}>\n <Comp\n {...textareaProps}\n ref={(node: HTMLTextAreaElement) => {\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node;\n (textareaRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node;\n }}\n className=\"rt-ChatbarInput\"\n value={value}\n onInput={onInput}\n onChange={handleChange}\n onFocus={handleFocus}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\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 </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, style, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : ('div' as any);\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarInlineStart', className)}\n style={style}\n >\n {children}\n </Comp>\n );\n});\nInlineStart.displayName = 'Chatbar.InlineStart';\n\nconst InlineEnd = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, style, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : ('div' as any);\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarInlineEnd', className)}\n style={style}\n >\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 */\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}\n\nconst AttachmentsRow = React.forwardRef<HTMLDivElement, AttachmentsRowProps>(\n (props, forwardedRef) => {\n const { asChild, forceMount, renderAttachment, className, style, ...divProps } = props;\n const ctx = useChatbarContext();\n const hasItems = ctx.attachments.length > 0;\n if (!hasItems && !forceMount) return null;\n const Comp = asChild ? Slot : ('div' as any);\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarAttachmentsRow', className)}\n style={style}\n role=\"list\"\n aria-label={divProps['aria-label'] ?? 'Attachments'}\n >\n <ScrollArea className=\"rt-ChatbarScrollArea\" scrollbars=\"horizontal\" size=\"1\">\n <Flex align=\"center\" gap=\"2\" style={{ minWidth: 'fit-content' }}>\n {ctx.attachments.map((att) => (\n <Attachment key={att.id} attachment={att} asChild={!!renderAttachment}>\n {renderAttachment?.(att)}\n </Attachment>\n ))}\n </Flex>\n </ScrollArea>\n </Comp>\n );\n },\n);\nAttachmentsRow.displayName = 'Chatbar.AttachmentsRow';\n\n/** Default tile renderer for a single attachment. */\ninterface AttachmentProps extends React.ComponentPropsWithoutRef<'div'> {\n attachment: ChatbarAttachment;\n asChild?: boolean;\n}\n\nconst Attachment = React.forwardRef<HTMLDivElement, AttachmentProps>((props, forwardedRef) => {\n const { attachment, asChild, className, style, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const Comp = asChild ? Slot : ('div' as any);\n const isImage = !!attachment.url && attachment.type.startsWith('image/');\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarAttachment', className)}\n style={style}\n role=\"listitem\"\n data-kind={isImage ? 'image' : 'file'}\n title={attachment.name}\n >\n {children ?? (\n <Card size={ctx.size} variant=\"soft\">\n <Flex align=\"center\" gap=\"3\" pr={!isImage ? '6' : undefined}>\n <div className=\"rt-ChatbarAttachmentPreview\" aria-hidden>\n {isImage ? (\n <img className=\"rt-ChatbarAttachmentImage\" src={attachment.url} alt=\"\" />\n ) : (\n <FileTextIcon />\n )}\n </div>\n {!isImage && (\n <Flex direction=\"column\" gap=\"0\" style={{ minWidth: 0 }}>\n <Text\n size={ctx.size}\n weight=\"medium\"\n style={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}\n >\n {attachment.name}\n </Text>\n <Text size=\"1\" color=\"gray\">\n {Math.ceil(attachment.size / 1024)} KB\n </Text>\n </Flex>\n )}\n <IconButton\n className=\"rt-ChatbarAttachmentRemove\"\n aria-label={`Remove ${attachment.name}`}\n size=\"1\"\n // size={ctx.size}\n variant=\"classic\"\n highContrast\n color=\"gray\"\n onClick={() =>\n ctx.setAttachments(ctx.attachments.filter((a) => a.id !== attachment.id))\n }\n >\n <CloseIcon />\n </IconButton>\n </Flex>\n </Card>\n )}\n </Comp>\n );\n});\nAttachment.displayName = 'Chatbar.Attachment';\n\ninterface AttachTriggerProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n accept?: string | string[];\n multiple?: boolean;\n}\n\nconst AttachTrigger = React.forwardRef<HTMLButtonElement, AttachTriggerProps>(\n (props, forwardedRef) => {\n const { asChild, accept, multiple, className, style, ...buttonProps } = props;\n const ctx = useChatbarContext();\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const Comp = asChild ? Slot : ('button' as any);\n const actualAccept = (Array.isArray(accept) ? accept : (accept?.split(',') ?? [])).join(',');\n return (\n <>\n <Comp\n {...(buttonProps as any)}\n ref={forwardedRef as any}\n className={classNames('rt-ChatbarAttachTrigger', className)}\n style={style}\n type={buttonProps.type ?? 'button'}\n aria-label={buttonProps['aria-label'] ?? 'Add attachments'}\n onClick={(e: any) => {\n // Ensure file input opens reliably by clicking it first\n if (inputRef.current) {\n inputRef.current.click();\n }\n // Then call user's onClick if provided\n buttonProps.onClick?.(e);\n }}\n />\n <input\n ref={inputRef}\n type=\"file\"\n accept={actualAccept}\n multiple={multiple ?? ctx.multiple}\n tabIndex={-1}\n style={{ display: 'none' }}\n onChange={(e) => {\n const files = Array.from(e.currentTarget.files ?? []);\n if (files.length > 0) {\n ctx.appendFiles(files);\n }\n // Reset input value to allow selecting the same file again\n e.currentTarget.value = '';\n }}\n />\n </>\n );\n },\n);\nAttachTrigger.displayName = 'Chatbar.AttachTrigger';\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, style, ...divProps } = props;\n const ctx = useChatbarContext();\n if (!ctx.open) return null;\n const Comp = asChild ? Slot : ('div' as any);\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarRow', className)}\n style={style}\n >\n <Flex align=\"center\" justify=\"between\" width=\"100%\">\n {children}\n </Flex>\n </Comp>\n );\n});\nRow.displayName = 'Chatbar.Row';\n\nconst RowStart = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n (props, forwardedRef) => {\n const { className, style, ...divProps } = props;\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarRowStart', className)}\n style={style}\n />\n );\n },\n);\nRowStart.displayName = 'Chatbar.RowStart';\n\nconst RowEnd = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n (props, forwardedRef) => {\n const { className, style, ...divProps } = props;\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarRowEnd', className)}\n style={style}\n />\n );\n },\n);\nRowEnd.displayName = 'Chatbar.RowEnd';\n\ninterface SendProps extends Omit<IconButtonProps, 'size'> {\n asChild?: boolean;\n clearOnSend?: boolean;\n}\n\nconst Send = React.forwardRef<HTMLButtonElement, SendProps>((props, forwardedRef) => {\n const {\n asChild,\n clearOnSend = true,\n disabled,\n children,\n className,\n style,\n ...buttonProps\n } = props;\n const ctx = useChatbarContext();\n\n const trimmed = ctx.value.trim();\n const visible = ctx.sendMode === 'always' || (ctx.sendMode === 'whenDirty' && trimmed.length > 0);\n if (ctx.sendMode === 'never') return null;\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (ctx.disabled || ctx.readOnly) return;\n ctx.onSubmit?.({ value: ctx.value, attachments: ctx.attachments });\n if (clearOnSend) {\n if (!ctx.isValueControlled) ctx.setValue('');\n if (ctx.clearOnSubmit) ctx.setAttachments([]);\n }\n buttonProps.onClick?.(event);\n };\n\n return (\n <IconButton\n {...(buttonProps as any)}\n ref={forwardedRef as any}\n size={ctx.size}\n variant={ctx.open ? 'solid' : 'ghost'}\n disabled={disabled || ctx.disabled || ctx.readOnly}\n className={classNames('rt-ChatbarSend', className)}\n style={{\n opacity: visible ? 1 : 0,\n pointerEvents: visible ? 'auto' : 'none',\n ...style,\n }}\n asChild={asChild}\n onClick={handleClick}\n aria-label={buttonProps['aria-label'] ?? 'Send'}\n >\n {children ?? 'Send'}\n </IconButton>\n );\n});\nSend.displayName = 'Chatbar.Send';\n\nexport {\n Root,\n Textarea,\n InlineStart,\n InlineEnd,\n AttachmentsRow,\n Attachment,\n AttachTrigger,\n Row,\n RowStart,\n RowEnd,\n Send,\n};\nexport type {\n RootProps as ChatbarRootProps,\n TextareaProps as ChatbarTextareaProps,\n RowProps as ChatbarRowProps,\n SendProps as ChatbarSendProps,\n};\n"],
5
+ "mappings": "+kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,mBAAAE,GAAA,eAAAC,GAAA,mBAAAC,GAAA,cAAAC,GAAA,gBAAAC,GAAA,SAAAC,GAAA,QAAAC,GAAA,WAAAC,GAAA,aAAAC,GAAA,SAAAC,GAAA,aAAAC,KAAA,eAAAC,GAAAb,IAAA,IAAAc,EAAuB,qBACvBC,EAAuB,0BAEvBC,GAAiD,4BACjDC,GAAwC,sBACxCC,GAAqB,qBAErBC,GAA2B,4BAC3BC,EAAqB,qBACrBC,GAAqB,qBACrBC,GAAqB,qBACrBC,GAA4B,0BAI5B,MAAMC,GACJ,OAAO,OAAW,IAAcV,EAAM,gBAAkBA,EAAM,UAuE1DW,GAAiBX,EAAM,cAA0C,IAAI,EACrEY,EAAoB,IAAM,CAC9B,MAAMC,EAAMb,EAAM,WAAWW,EAAc,EAC3C,GAAI,CAACE,EAAK,MAAM,IAAI,MAAM,0DAA0D,EACpF,OAAOA,CACT,EA8GMpB,GAAOO,EAAM,WAAmC,CAACc,EAAOC,IAAiB,CAC7E,KAAM,CACJ,UAAAC,EACA,MAAAC,EACA,SAAAC,EACA,MAAOC,EACP,aAAAC,EAAe,GACf,cAAeC,EACf,KAAMC,EACN,YAAAC,EAAc,GACd,aAAcC,EACd,SAAAC,EAAW,OACX,SAAAC,EAAW,EACX,SAAAC,EAAW,EACX,SAAAC,EAAW,YACX,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,KAAAC,EAAO,IACP,QAAAC,EACA,MAAAC,EACA,SAAAC,EACA,QAAAC,EACA,YAAaC,EACb,mBAAAC,GAAqB,CAAC,EACtB,oBAAAC,EACA,OAAAC,EACA,SAAAC,EAAW,GACX,eAAAC,EACA,YAAAC,EACA,MAAAC,GAAQ,GACR,YAAAC,EACA,cAAAC,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AAM,CACJ,QAAAqB,EACA,YAAA+H,EAAc,GACd,SAAAtI,EACA,SAAAX,EACA,UAAAF,EACA,MAAAC,EACA,GAAG8I,CACL,EAAIjJ,EACED,EAAMD,EAAkB,EAExB6I,EAAU5I,EAAI,MAAM,KAAK,EACzBuJ,EAAUvJ,EAAI,WAAa,UAAaA,EAAI,WAAa,aAAe4I,EAAQ,OAAS,EAC/F,GAAI5I,EAAI,WAAa,QAAS,OAAO,KAErC,MAAMwJ,EAAelE,GAA+C,CAC9DtF,EAAI,UAAYA,EAAI,WACxBA,EAAI,WAAW,CAAE,MAAOA,EAAI,MAAO,YAAaA,EAAI,WAAY,CAAC,EAC7DsJ,IACGtJ,EAAI,mBAAmBA,EAAI,SAAS,EAAE,EACvCA,EAAI,eAAeA,EAAI,eAAe,CAAC,CAAC,GAE9CkJ,EAAY,UAAU5D,CAAK,EAC7B,EAEA,OACEnG,EAAA,cAAC,eACE,GAAI+J,EACL,IAAKhJ,EACL,KAAMF,EAAI,KACV,QAASA,EAAI,KAAO,QAAU,QAC9B,SAAUgB,GAAYhB,EAAI,UAAYA,EAAI,SAC1C,aAAW,EAAAmG,SAAW,iBAAkBhG,CAAS,EACjD,MAAO,CACL,QAASoJ,EAAU,EAAI,EACvB,cAAeA,EAAU,OAAS,OAClC,GAAGnJ,CACL,EACA,QAASmB,EACT,QAASiI,EACT,aAAYN,EAAY,YAAY,GAAK,QAExC7I,GAAY,MACf,CAEJ,CAAC,EACDrB,GAAK,YAAc",
6
+ "names": ["chatbar_exports", "__export", "AttachTrigger", "Attachment", "AttachmentsRow", "InlineEnd", "InlineStart", "Root", "Row", "RowEnd", "RowStart", "Send", "Textarea", "__toCommonJS", "React", "import_classnames", "import_icon_button", "import_icons", "import_flex", "import_scroll_area", "import_slot", "import_card", "import_text", "import_react_dropzone", "useIsomorphicLayoutEffect", "ChatbarContext", "useChatbarContext", "ctx", "props", "forwardedRef", "className", "style", "children", "valueProp", "defaultValue", "onValueChangeProp", "openProp", "defaultOpen", "onOpenChangeProp", "expandOn", "minLines", "maxLines", "sendMode", "disabled", "readOnly", "onSubmit", "size", "variant", "width", "maxWidth", "asChild", "attachmentsProp", "defaultAttachments", "onAttachmentsChange", "accept", "multiple", "maxAttachments", "maxFileSize", "paste", "pasteAccept", "clearOnSubmit", "onAttachmentReject", "dropzone", "divProps", "isValueControlled", "valueUncontrolled", "setValueUncontrolled", "value", "isOpenControlled", "openUncontrolled", "setOpenUncontrolled", "open", "rootRef", "textareaRef", "isAttachmentsControlled", "attachmentsUncontrolled", "setAttachmentsUncontrolled", "attachments", "generatedUrlSetRef", "toArray", "val", "s", "accepts", "pasteAccepts", "matchesAccept", "file", "patterns", "mime", "name", "patRaw", "pat", "type", "subtype", "fmType", "fmSubtype", "mapFilesToAttachments", "files", "next", "rejected", "remainingSlots", "id", "looksLikeImageByExt", "url", "appendFiles", "accepted", "merged", "appendFilesFromPaste", "matches", "acceptedFiles", "currentUrls", "a", "Comp", "handleBlurCapture", "event", "nextTarget", "rootEl", "getRootProps", "getInputProps", "isDragActive", "rejectedFiles", "rejections", "errors", "reason", "acc", "pattern", "node", "classNames", "onFocus", "onInput", "onChange", "onPaste", "onKeyDown", "submitOnEnter", "rows", "textareaProps", "setOpen", "setValue", "lineHeightRef", "paddingRef", "compactHeightRef", "recomputeMetrics", "el", "computedStyle", "lineHeight", "paddingTop", "paddingBottom", "updateHeight", "forceOpen", "textarea", "padding", "isOpen", "effectiveMinLines", "effectiveMaxLines", "minHeight", "maxHeight", "contentHeight", "finalHeight", "prevLineHeight", "ro", "lh", "handleFocus", "handleChange", "nextValue", "handlePaste", "i", "f", "handleKeyDown", "trimmed", "forceMount", "renderAttachment", "att", "attachment", "isImage", "buttonProps", "inputRef", "actualAccept", "e", "clearOnSend", "visible", "handleClick"]
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MA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C=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var E=(t,e)=>{for(var o in e)l(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!w.call(t,n)&&n!==o&&l(t,n,{get:()=>e[n],enumerable:!(r=h(e,n))||r.enumerable});return t};var b=(t,e,o)=>(o=t!=null?P(v(t)):{},p(e||!t||!t.__esModule?l(o,"default",{value:t,enumerable:!0}):o,t)),g=t=>p(l({},"__esModule",{value:!0}),t);var x={};E(x,{IconButton:()=>c});module.exports=g(x);var i=b(require("react")),u=b(require("classnames")),m=require("./_internal/base-button.js"),d=require("./tooltip.js");const c=i.forwardRef(({className:t,tooltip:e,tooltipSide:o="top",tooltipAlign:r="center",tooltipDelayDuration:n,tooltipDisableHoverableContent:B,...a},y)=>{const f="aria-label"in a&&a["aria-label"],I="aria-labelledby"in a&&a["aria-labelledby"],R="children"in a&&a.children;if(!f&&!I&&!R)throw new Error(`IconButton: Icon buttons must have an accessible name. Please provide either:
1
+ "use strict";var v=Object.create;var i=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var o in e)i(t,o,{get:e[o],enumerable:!0})},u=(t,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of E(e))!T.call(t,n)&&n!==o&&i(t,n,{get:()=>e[n],enumerable:!(l=w(e,n))||l.enumerable});return t};var d=(t,e,o)=>(o=t!=null?v(g(t)):{},u(e||!t||!t.__esModule?i(o,"default",{value:t,enumerable:!0}):o,t)),A=t=>u(i({},"__esModule",{value:!0}),t);var N={};x(N,{IconButton:()=>c});module.exports=A(N);var r=d(require("react")),m=d(require("classnames")),B=require("./_internal/base-button.js"),y=require("./tooltip.js");const c=r.forwardRef(({className:t,tooltip:e,tooltipSide:o="top",tooltipAlign:l="center",tooltipDelayDuration:n,tooltipDisableHoverableContent:I,...a},f)=>{const s=r.useId(),P="aria-label"in a&&a["aria-label"],R="aria-labelledby"in a&&a["aria-labelledby"],h="children"in a&&a.children;if(!P&&!R&&!h)throw new 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`);const s=i.createElement(m.BaseButton,{...a,ref:y,className:(0,u.default)("rt-IconButton",t)});return e?i.createElement(d.Tooltip,{content:e,side:o,align:r,delayDuration:n,disableHoverableContent:B},s):s});c.displayName="IconButton";
4
+ - or visible text children`);const p=!!e,C=r.useMemo(()=>p?{"aria-describedby":s}:{},[p,s]),b=r.createElement(B.BaseButton,{...a,...C,ref:f,className:(0,m.default)("rt-IconButton",t)});return e?r.createElement(y.Tooltip,{content:e,side:o,align:l,delayDuration:n,disableHoverableContent:I,id:s},b):b});c.displayName="IconButton";
5
5
  //# sourceMappingURL=icon-button.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/icon-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 type { BaseButtonProps } from './_internal/base-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'> & 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'>(\n props: IconButtonProps<C> & { ref?: React.ForwardedRef<IconButtonElement> },\n) => React.ReactElement | null;\n\n/**\n * IconButton component for compact, accessible icon-only interactions\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 (\n {\n className,\n tooltip,\n tooltipSide = 'top',\n tooltipAlign = 'center',\n tooltipDelayDuration,\n tooltipDisableHoverableContent,\n ...props\n }: IconButtonProps,\n forwardedRef: React.ForwardedRef<IconButtonElement>,\n ) => {\n // Runtime accessibility validation to ensure WCAG compliance\n // This helps catch accessibility issues during development\n const hasAriaLabel = 'aria-label' in props && props['aria-label'];\n const hasAriaLabelledBy = 'aria-labelledby' in props && props['aria-labelledby'];\n const hasChildren = 'children' in props && props.children;\n\n // Throw descriptive error if no accessible name is provided\n if (!hasAriaLabel && !hasAriaLabelledBy && !hasChildren) {\n throw new Error(\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 );\n }\n\n // Create the base icon button element with accessibility props\n const iconButton = (\n <BaseButton\n {...props}\n ref={forwardedRef}\n className={classNames('rt-IconButton', className)}\n />\n );\n\n // If no tooltip is provided, return the icon button as-is for better performance\n if (!tooltip) {\n return iconButton;\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\n content={tooltip}\n side={tooltipSide}\n align={tooltipAlign}\n delayDuration={tooltipDelayDuration}\n disableHoverableContent={tooltipDisableHoverableContent}\n >\n {iconButton}\n </Tooltip>\n );\n },\n) as IconButtonComponent & { displayName?: string };\n\nIconButton.displayName = 'IconButton';\n\nexport { IconButton };\nexport type { IconButtonProps };\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBAEvBC,EAA2B,sCAC3BC,EAAwB,wBAmGxB,MAAML,EAAaE,EAAM,WACvB,CACE,CACE,UAAAI,EACA,QAAAC,EACA,YAAAC,EAAc,MACd,aAAAC,EAAe,SACf,qBAAAC,EACA,+BAAAC,EACA,GAAGC,CACL,EACAC,IACG,CAGH,MAAMC,EAAe,eAAgBF,GAASA,EAAM,YAAY,EAC1DG,EAAoB,oBAAqBH,GAASA,EAAM,iBAAiB,EACzEI,EAAc,aAAcJ,GAASA,EAAM,SAGjD,GAAI,CAACE,GAAgB,CAACC,GAAqB,CAACC,EAC1C,MAAM,IAAI,MACR;AAAA;AAAA;AAAA,2BAIF,EAIF,MAAMC,EACJf,EAAA,cAAC,cACE,GAAGU,EACJ,IAAKC,EACL,aAAW,EAAAK,SAAW,gBAAiBZ,CAAS,EAClD,EAIF,OAAKC,EAOHL,EAAA,cAAC,WACC,QAASK,EACT,KAAMC,EACN,MAAOC,EACP,cAAeC,EACf,wBAAyBC,GAExBM,CACH,EAdOA,CAgBX,CACF,EAEAjB,EAAW,YAAc",
6
- "names": ["icon_button_exports", "__export", "IconButton", "__toCommonJS", "React", "import_classnames", "import_base_button", "import_tooltip", "className", "tooltip", "tooltipSide", "tooltipAlign", "tooltipDelayDuration", "tooltipDisableHoverableContent", "props", "forwardedRef", "hasAriaLabel", "hasAriaLabelledBy", "hasChildren", "iconButton", "classNames"]
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 type { BaseButtonProps } from './_internal/base-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'> & 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'>(\n props: IconButtonProps<C> & { ref?: React.ForwardedRef<IconButtonElement> },\n) => React.ReactElement | null;\n\n/**\n * IconButton component for compact, accessible icon-only interactions\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 (\n {\n className,\n tooltip,\n tooltipSide = 'top',\n tooltipAlign = 'center',\n tooltipDelayDuration,\n tooltipDisableHoverableContent,\n ...props\n }: IconButtonProps,\n forwardedRef: React.ForwardedRef<IconButtonElement>,\n ) => {\n // Generate unique ID for tooltip accessibility\n const tooltipId = React.useId();\n // Runtime accessibility validation to ensure WCAG compliance\n // This helps catch accessibility issues during development\n const hasAriaLabel = 'aria-label' in props && props['aria-label'];\n const hasAriaLabelledBy = 'aria-labelledby' in props && props['aria-labelledby'];\n const hasChildren = 'children' in props && props.children;\n\n // Throw descriptive error if no accessible name is provided\n if (!hasAriaLabel && !hasAriaLabelledBy && !hasChildren) {\n throw new Error(\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 );\n }\n\n // Prepare accessibility props for tooltip integration\n const hasTooltip = Boolean(tooltip);\n const tooltipAccessibilityProps = React.useMemo(\n () => (hasTooltip ? { 'aria-describedby': tooltipId } : {}),\n [hasTooltip, tooltipId],\n );\n\n // Create the base icon button element with accessibility props\n const iconButton = (\n <BaseButton\n {...props}\n {...tooltipAccessibilityProps}\n ref={forwardedRef}\n className={classNames('rt-IconButton', className)}\n />\n );\n\n // If no tooltip is provided, return the icon button as-is for better performance\n if (!tooltip) {\n return iconButton;\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\n content={tooltip}\n side={tooltipSide}\n align={tooltipAlign}\n delayDuration={tooltipDelayDuration}\n disableHoverableContent={tooltipDisableHoverableContent}\n id={tooltipId}\n >\n {iconButton}\n </Tooltip>\n );\n },\n) as IconButtonComponent & { displayName?: string };\n\nIconButton.displayName = 'IconButton';\n\nexport { IconButton };\nexport type { IconButtonProps };\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBAEvBC,EAA2B,sCAC3BC,EAAwB,wBAmGxB,MAAML,EAAaE,EAAM,WACvB,CACE,CACE,UAAAI,EACA,QAAAC,EACA,YAAAC,EAAc,MACd,aAAAC,EAAe,SACf,qBAAAC,EACA,+BAAAC,EACA,GAAGC,CACL,EACAC,IACG,CAEH,MAAMC,EAAYZ,EAAM,MAAM,EAGxBa,EAAe,eAAgBH,GAASA,EAAM,YAAY,EAC1DI,EAAoB,oBAAqBJ,GAASA,EAAM,iBAAiB,EACzEK,EAAc,aAAcL,GAASA,EAAM,SAGjD,GAAI,CAACG,GAAgB,CAACC,GAAqB,CAACC,EAC1C,MAAM,IAAI,MACR;AAAA;AAAA;AAAA,2BAIF,EAIF,MAAMC,EAAa,EAAQX,EACrBY,EAA4BjB,EAAM,QACtC,IAAOgB,EAAa,CAAE,mBAAoBJ,CAAU,EAAI,CAAC,EACzD,CAACI,EAAYJ,CAAS,CACxB,EAGMM,EACJlB,EAAA,cAAC,cACE,GAAGU,EACH,GAAGO,EACJ,IAAKN,EACL,aAAW,EAAAQ,SAAW,gBAAiBf,CAAS,EAClD,EAIF,OAAKC,EAOHL,EAAA,cAAC,WACC,QAASK,EACT,KAAMC,EACN,MAAOC,EACP,cAAeC,EACf,wBAAyBC,EACzB,GAAIG,GAEHM,CACH,EAfOA,CAiBX,CACF,EAEApB,EAAW,YAAc",
6
+ "names": ["icon_button_exports", "__export", "IconButton", "__toCommonJS", "React", "import_classnames", "import_base_button", "import_tooltip", "className", "tooltip", "tooltipSide", "tooltipAlign", "tooltipDelayDuration", "tooltipDisableHoverableContent", "props", "forwardedRef", "tooltipId", "hasAriaLabel", "hasAriaLabelledBy", "hasChildren", "hasTooltip", "tooltipAccessibilityProps", "iconButton", "classNames"]
7
7
  }
@@ -7,6 +7,11 @@ declare const ThickCheckIcon: React.ForwardRefExoticComponent<IconProps & React.
7
7
  declare const ChevronDownIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
8
8
  declare const ThickChevronRightIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
9
9
  declare const ThickDotIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
10
- export { ChevronDownIcon, ThickCheckIcon, ThickChevronRightIcon, ThickDividerHorizontalIcon, ThickDotIcon };
10
+ export { ChevronDownIcon, ThickCheckIcon, ThickChevronRightIcon, ThickDividerHorizontalIcon, ThickDotIcon, };
11
11
  export type { IconProps };
12
+ declare const CloseIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
13
+ declare const PaperclipIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
14
+ declare const FileIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
15
+ declare const FileTextIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
16
+ export { CloseIcon, PaperclipIcon, FileIcon, FileTextIcon };
12
17
  //# sourceMappingURL=icons.d.ts.map