@adea-ai/ui 0.155.1 → 0.157.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +3 -3
  2. package/dist/NOTICE +27 -0
  3. package/dist/components/composites/model-selector/model-selector.js +45 -53
  4. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  5. package/dist/components/composites/prompt-input/index.d.ts +2 -0
  6. package/dist/components/composites/prompt-input/index.d.ts.map +1 -0
  7. package/dist/components/composites/prompt-input/index.js +1 -0
  8. package/dist/components/composites/prompt-input/prompt-input.d.ts +71 -0
  9. package/dist/components/composites/prompt-input/prompt-input.d.ts.map +1 -0
  10. package/dist/components/composites/prompt-input/prompt-input.js +247 -0
  11. package/dist/components/composites/prompt-input/prompt-input.js.map +1 -0
  12. package/dist/components/conversation/chat-composer.d.ts.map +1 -1
  13. package/dist/components/conversation/chat-composer.js +43 -29
  14. package/dist/components/conversation/chat-composer.js.map +1 -1
  15. package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
  16. package/dist/components/conversation/internal/chat-composer-shell.js +155 -163
  17. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  18. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  19. package/dist/components/conversation/message-composer.js +186 -192
  20. package/dist/components/conversation/message-composer.js.map +1 -1
  21. package/dist/components/conversation/paste-token-editor.js +2 -2
  22. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  23. package/dist/components/theme/theme-document.d.ts +1 -1
  24. package/dist/components/theme/theme-document.js.map +1 -1
  25. package/dist/components/theme/theme-provider-value.d.ts +1 -1
  26. package/dist/components/theme/theme-provider-value.js.map +1 -1
  27. package/dist/components/ui/badge/badge.js +1 -1
  28. package/dist/components/ui/badge/badge.js.map +1 -1
  29. package/dist/components/ui/button/button.d.ts.map +1 -1
  30. package/dist/components/ui/button/button.js +3 -3
  31. package/dist/components/ui/button/button.js.map +1 -1
  32. package/dist/components/ui/input-group/index.d.ts +1 -1
  33. package/dist/components/ui/input-group/index.d.ts.map +1 -1
  34. package/dist/components/ui/input-group/index.js +2 -2
  35. package/dist/components/ui/input-group/input-group.d.ts +34 -9
  36. package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
  37. package/dist/components/ui/input-group/input-group.js +101 -28
  38. package/dist/components/ui/input-group/input-group.js.map +1 -1
  39. package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
  40. package/dist/components/ui/kbd/kbd.js +6 -1
  41. package/dist/components/ui/kbd/kbd.js.map +1 -1
  42. package/dist/components/ui/message/index.d.ts +1 -1
  43. package/dist/components/ui/message/index.d.ts.map +1 -1
  44. package/dist/components/ui/message/index.js +2 -2
  45. package/dist/components/ui/message/message.d.ts +16 -0
  46. package/dist/components/ui/message/message.d.ts.map +1 -1
  47. package/dist/components/ui/message/message.js +52 -1
  48. package/dist/components/ui/message/message.js.map +1 -1
  49. package/dist/components/ui/tooltip/tooltip.js +1 -1
  50. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  51. package/dist/index.d.ts +1 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +4 -3
  54. package/dist/lib/fast-icon.d.ts +2 -1
  55. package/dist/lib/fast-icon.d.ts.map +1 -1
  56. package/dist/lib/fast-icon.js +4 -3
  57. package/dist/lib/fast-icon.js.map +1 -1
  58. package/dist/lib/overlay.d.ts +5 -5
  59. package/dist/lib/overlay.d.ts.map +1 -1
  60. package/dist/lib/overlay.js +5 -5
  61. package/dist/lib/overlay.js.map +1 -1
  62. package/dist/lib/theme-defaults.generated.d.ts.map +1 -1
  63. package/dist/lib/theme-defaults.generated.js +88 -60
  64. package/dist/lib/theme-defaults.generated.js.map +1 -1
  65. package/dist/lib/theme-projection.d.ts +2 -0
  66. package/dist/lib/theme-projection.d.ts.map +1 -1
  67. package/dist/lib/theme-projection.js +2 -2
  68. package/dist/lib/theme-projection.js.map +1 -1
  69. package/dist/lib/theme-types.d.ts +7 -0
  70. package/dist/lib/theme-types.d.ts.map +1 -1
  71. package/dist/lib/theme-types.js +7 -0
  72. package/dist/lib/theme-types.js.map +1 -1
  73. package/dist/r/appearance-editor.json +1 -1
  74. package/dist/r/conversation.json +1 -2
  75. package/dist/r/input-group.json +1 -0
  76. package/dist/r/lib.json +1 -1
  77. package/dist/r/message.json +4 -1
  78. package/dist/r/model-selector.json +1 -1
  79. package/dist/r/prompt-input.json +28 -0
  80. package/dist/r/registry.json +38 -7
  81. package/dist/r/src/components/composites/model-selector/model-selector.tsx +19 -25
  82. package/dist/r/src/components/composites/prompt-input/index.ts +15 -0
  83. package/dist/r/src/components/composites/prompt-input/prompt-input.tsx +267 -0
  84. package/dist/r/src/components/conversation/chat-composer.tsx +4 -2
  85. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
  86. package/dist/r/src/components/conversation/message-composer.tsx +93 -97
  87. package/dist/r/src/components/conversation/paste-token-editor.tsx +2 -2
  88. package/dist/r/src/components/theme/theme-document.ts +1 -1
  89. package/dist/r/src/components/theme/theme-provider-value.ts +1 -1
  90. package/dist/r/src/components/ui/badge/badge.tsx +1 -1
  91. package/dist/r/src/components/ui/button/button.tsx +12 -3
  92. package/dist/r/src/components/ui/input-group/index.ts +3 -0
  93. package/dist/r/src/components/ui/input-group/input-group.tsx +121 -29
  94. package/dist/r/src/components/ui/kbd/kbd.tsx +3 -0
  95. package/dist/r/src/components/ui/message/index.ts +3 -0
  96. package/dist/r/src/components/ui/message/message.tsx +56 -0
  97. package/dist/r/src/components/ui/tooltip/tooltip.tsx +1 -1
  98. package/dist/r/src/lib/fast-icon.ts +11 -4
  99. package/dist/r/src/lib/overlay.ts +5 -6
  100. package/dist/r/src/lib/theme-defaults.generated.ts +88 -60
  101. package/dist/r/src/lib/theme-projection.ts +2 -0
  102. package/dist/r/src/lib/theme-types.ts +7 -0
  103. package/dist/r/src/styles/theme-variants.css +608 -370
  104. package/dist/r/src/styles/theme.css +4 -4
  105. package/dist/r/theming.json +1 -1
  106. package/package.json +2 -2
  107. package/registry.json +38 -7
  108. package/src/components/composites/model-selector/model-selector.tsx +19 -25
  109. package/src/components/composites/prompt-input/index.ts +15 -0
  110. package/src/components/composites/prompt-input/prompt-input.tsx +267 -0
  111. package/src/components/conversation/chat-composer.tsx +4 -2
  112. package/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
  113. package/src/components/conversation/message-composer.tsx +93 -97
  114. package/src/components/conversation/paste-token-editor.tsx +2 -2
  115. package/src/components/theme/theme-document.ts +1 -1
  116. package/src/components/theme/theme-provider-value.ts +1 -1
  117. package/src/components/ui/badge/badge.tsx +1 -1
  118. package/src/components/ui/button/button.tsx +12 -3
  119. package/src/components/ui/input-group/index.ts +3 -0
  120. package/src/components/ui/input-group/input-group.tsx +121 -29
  121. package/src/components/ui/kbd/kbd.tsx +3 -0
  122. package/src/components/ui/message/index.ts +3 -0
  123. package/src/components/ui/message/message.tsx +56 -0
  124. package/src/components/ui/tooltip/tooltip.tsx +1 -1
  125. package/src/index.ts +1 -0
  126. package/src/lib/fast-icon.ts +11 -4
  127. package/src/lib/overlay.ts +5 -6
  128. package/src/lib/theme-defaults.generated.ts +88 -60
  129. package/src/lib/theme-projection.ts +2 -0
  130. package/src/lib/theme-types.ts +7 -0
  131. package/src/styles/theme-variants.css +608 -370
  132. package/src/styles/theme.css +4 -4
  133. package/src/styles/themes/aardvark-blue.css +7 -0
  134. package/src/styles/themes/aardvark-ink.css +7 -0
  135. package/src/styles/themes/adea-dark-colorblind.css +22 -15
  136. package/src/styles/themes/adea-dark-high-contrast.css +22 -15
  137. package/src/styles/themes/adea-dark.css +22 -15
  138. package/src/styles/themes/adea-light-colorblind.css +21 -14
  139. package/src/styles/themes/adea-light-high-contrast.css +21 -14
  140. package/src/styles/themes/adea-light.css +22 -15
  141. package/src/styles/themes/ayu-light.css +20 -13
  142. package/src/styles/themes/ayu-mirage.css +21 -14
  143. package/src/styles/themes/ayu.css +22 -15
  144. package/src/styles/themes/catppuccin-frappe.css +16 -9
  145. package/src/styles/themes/catppuccin-latte.css +15 -8
  146. package/src/styles/themes/catppuccin-macchiato.css +16 -9
  147. package/src/styles/themes/catppuccin-mocha.css +16 -9
  148. package/src/styles/themes/dracula.css +16 -9
  149. package/src/styles/themes/everforest-dark.css +19 -12
  150. package/src/styles/themes/everforest-light.css +21 -14
  151. package/src/styles/themes/gruvbox-dark.css +21 -14
  152. package/src/styles/themes/gruvbox-light.css +20 -13
  153. package/src/styles/themes/kanagawa.css +18 -11
  154. package/src/styles/themes/monokai.css +19 -12
  155. package/src/styles/themes/nord-light.css +7 -0
  156. package/src/styles/themes/nord.css +19 -12
  157. package/src/styles/themes/one-dark.css +16 -9
  158. package/src/styles/themes/rosepine-dawn.css +19 -12
  159. package/src/styles/themes/rosepine-moon.css +20 -13
  160. package/src/styles/themes/rosepine.css +20 -13
  161. package/src/styles/themes/solarized-dark.css +19 -12
  162. package/src/styles/themes/solarized-light.css +19 -12
  163. package/src/styles/themes/tokyonight-day.css +7 -0
  164. package/src/styles/themes/tokyonight-night.css +18 -11
  165. package/src/styles/themes/tokyonight-storm.css +18 -11
  166. package/src/styles/themes/vesper.css +22 -15
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":["Polymorphic","mergeProps","Show","splitProps","isServer","spread","cva","controlInteractive","controlSize","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","toolbar","subtle","success","link","size","xs","sm","md","lg","xl","touchTarget","comfortable","defaultVariants","class","Button","props","local","rest","as","className","native","element","document","createElement","type","_$createComponent","when","undefined","fallback","_$mergeProps","children"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, mergeProps, Show, splitProps, type ValidComponent } from 'solid-js'\nimport { isServer, spread } from 'solid-js/web'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /**\n * A ghost that opens something: a sheet, menu or popover trigger in a\n * toolbar. While its surface is open it holds the accent's own tint,\n * the same treatment that drives the side rail's active destination,\n * so the open control never reads identical to its closed neighbours\n * and the app's pressed chrome reads as one accent chroma. The\n * compound hover keeps the tint when an open control is pointed at.\n */\n toolbar:\n 'text-foreground hover:bg-surface-hover data-[expanded]:bg-primary-subtle data-[expanded]:text-primary data-[expanded]:hover:bg-primary-subtle',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n '2xl': `${controlSize['2xl']} [&_svg]:size-6`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n 'icon-2xl': 'size-control-2xl p-0 [&_svg]:size-6',\n },\n /** Opt in to a stable touch target on devices with any coarse pointer. */\n touchTarget: {\n comfortable: 'touch-target-comfortable',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps & { as?: ValidComponent }, [\n 'as',\n 'variant',\n 'size',\n 'touchTarget',\n 'class',\n ])\n const className = () =>\n cn(\n buttonVariants({\n variant: local.variant,\n size: local.size,\n touchTarget: local.touchTarget,\n }),\n local.class\n )\n\n // A native button, the common case, is written directly: Polymorphic goes\n // through Dynamic, two prop proxies and a memo per button. It is built with\n // createElement and spread, which is what the compiled JSX would do, so the\n // module holds no template: `buttonVariants` stays importable in plain Node\n // (a server renderer reads the class contract from this entry). A server\n // render has no document, so it takes the Polymorphic path.\n const native = () => {\n const element = document.createElement('button')\n spread(\n element,\n mergeProps({ type: 'button', 'data-slot': 'button' }, rest as ComponentProps<'button'>, {\n get class() {\n return className()\n },\n }),\n false,\n false\n )\n return element\n }\n return (\n <Show\n when={!isServer && (local.as === undefined || local.as === 'button')}\n fallback={\n <Polymorphic\n as={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n class={className()}\n {...(rest as ComponentProps<'button'>)}\n />\n }\n >\n {native()}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAaU,iBAAiBJ,IAC5B,GAAGC,mBAAkB,sJACrB;CACEI,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;;;;;;;;GASPC,SACE;;GAEFC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GACrB,OAAO,GAAGnB,YAAY,OAAM;GAK5B,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,YAAY;EACd;;EAEAoB,aAAa,EACXC,aAAa,2BACf;CACF;CACAC,iBAAiB;EACflB,SAAS;EACTU,MAAM;CACR;AACF,CACF;AAWA,SAAgBU,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQhC,WAAW8B,OAAgD;EAC/E;EACA;EACA;EACA;EACA;CAAO,CACR;CACD,MAAMI,kBACJ5B,GACEC,eAAe;EACbE,SAASsB,MAAMtB;EACfU,MAAMY,MAAMZ;EACZM,aAAaM,MAAMN;CACrB,CAAC,GACDM,MAAMH,KACR;CAQF,MAAMO,eAAe;EACnB,MAAMC,UAAUC,SAASC,cAAc,QAAQ;EAC/CpC,OACEkC,SACAtC,aAAW;GAAEyC,MAAM;GAAU,aAAa;EAAS,GAAGP,MAAkC,EACtF,IAAIJ,QAAQ;GACV,OAAOM,UAAU;EACnB,EACF,CAAC,GACD,OACA,KACF;EACA,OAAOE;CACT;CACA,OAAAI,gBACGzC,MAAI;EAAA,IACH0C,OAAI;GAAA,OAAE,CAACxC,aAAa8B,MAAME,OAAOS,KAAAA,KAAaX,MAAME,OAAO;EAAS;EAAA,IACpEU,WAAQ;GAAA,OAAAH,gBACL3C,aAAW+C,WAAA;IAAA,IACVX,KAAE;KAAA,OAAEF,MAAME,MAAM;IAAQ;IACxBM,MAAI;IAAA,aAAA;IAAA,KAAA,WAAA;KAAA,OAEGL,UAAU;IAAC;GAAA,GACbF,IAAgC,CAAA;EAAA;EAAA,IAAAa,WAAA;GAAA,OAIxCV,OAAO;EAAC;CAAA,CAAA;AAGf"}
1
+ {"version":3,"file":"button.js","names":["Polymorphic","mergeProps","sharedConfig","Show","splitProps","isServer","spread","cva","controlInteractive","controlSize","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","toolbar","subtle","success","link","size","xs","sm","md","lg","xl","touchTarget","comfortable","defaultVariants","class","Button","props","local","rest","as","className","native","element","document","createElement","type","_$createComponent","when","_$memo","context","undefined","fallback","_$mergeProps","children"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport {\n type ComponentProps,\n mergeProps,\n sharedConfig,\n Show,\n splitProps,\n type ValidComponent,\n} from 'solid-js'\nimport { isServer, spread } from 'solid-js/web'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /**\n * A ghost that opens something: a sheet, menu or popover trigger in a\n * toolbar. While its surface is open it holds the accent's own tint,\n * the same treatment that drives the side rail's active destination,\n * so the open control never reads identical to its closed neighbours\n * and the app's pressed chrome reads as one accent chroma. The\n * compound hover keeps the tint when an open control is pointed at.\n */\n toolbar:\n 'text-foreground hover:bg-surface-hover data-[expanded]:bg-primary-subtle data-[expanded]:text-primary data-[expanded]:hover:bg-primary-subtle',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n '2xl': `${controlSize['2xl']} [&_svg]:size-6`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n 'icon-2xl': 'size-control-2xl p-0 [&_svg]:size-6',\n },\n /** Opt in to a stable touch target on devices with any coarse pointer. */\n touchTarget: {\n comfortable: 'touch-target-comfortable',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps & { as?: ValidComponent }, [\n 'as',\n 'variant',\n 'size',\n 'touchTarget',\n 'class',\n ])\n const className = () =>\n cn(\n buttonVariants({\n variant: local.variant,\n size: local.size,\n touchTarget: local.touchTarget,\n }),\n local.class\n )\n\n // A native button, the common case, is written directly: Polymorphic goes\n // through Dynamic, two prop proxies and a memo per button. It is built with\n // createElement and spread, which is what the compiled JSX would do, so the\n // module holds no template: `buttonVariants` stays importable in plain Node\n // (a server renderer reads the class contract from this entry). A server\n // render has no document, so it takes the Polymorphic path. So does a button\n // the client hydrates: a fresh element would not adopt the server's node, and\n // its children would look for server nodes that were never claimed.\n const native = () => {\n const element = document.createElement('button')\n spread(\n element,\n mergeProps({ type: 'button', 'data-slot': 'button' }, rest as ComponentProps<'button'>, {\n get class() {\n return className()\n },\n }),\n false,\n false\n )\n return element\n }\n return (\n <Show\n when={!isServer && !sharedConfig.context && (local.as === undefined || local.as === 'button')}\n fallback={\n <Polymorphic\n as={local.as ?? 'button'}\n type=\"button\"\n data-slot=\"button\"\n class={className()}\n {...(rest as ComponentProps<'button'>)}\n />\n }\n >\n {native()}\n </Show>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAaW,iBAAiBJ,IAC5B,GAAGC,mBAAkB,sJACrB;CACEI,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;;;;;;;;GASPC,SACE;;GAEFC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GACrB,OAAO,GAAGnB,YAAY,OAAM;GAK5B,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,YAAY;EACd;;EAEAoB,aAAa,EACXC,aAAa,2BACf;CACF;CACAC,iBAAiB;EACflB,SAAS;EACTU,MAAM;CACR;AACF,CACF;AAWA,SAAgBU,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQhC,WAAW8B,OAAgD;EAC/E;EACA;EACA;EACA;EACA;CAAO,CACR;CACD,MAAMI,kBACJ5B,GACEC,eAAe;EACbE,SAASsB,MAAMtB;EACfU,MAAMY,MAAMZ;EACZM,aAAaM,MAAMN;CACrB,CAAC,GACDM,MAAMH,KACR;CAUF,MAAMO,eAAe;EACnB,MAAMC,UAAUC,SAASC,cAAc,QAAQ;EAC/CpC,OACEkC,SACAvC,aAAW;GAAE0C,MAAM;GAAU,aAAa;EAAS,GAAGP,MAAkC,EACtF,IAAIJ,QAAQ;GACV,OAAOM,UAAU;EACnB,EACF,CAAC,GACD,OACA,KACF;EACA,OAAOE;CACT;CACA,OAAAI,gBACGzC,MAAI;EAAA,IACH0C,OAAI;GAAA,OAAEC,WAAA,CAAA,EAAA,CAACzC,YAAY,CAACH,aAAa6C,QAAO,CAAA,CAAA,MAAKZ,MAAME,OAAOW,KAAAA,KAAab,MAAME,OAAO;EAAS;EAAA,IAC7FY,WAAQ;GAAA,OAAAL,gBACL5C,aAAWkD,WAAA;IAAA,IACVb,KAAE;KAAA,OAAEF,MAAME,MAAM;IAAQ;IACxBM,MAAI;IAAA,aAAA;IAAA,KAAA,WAAA;KAAA,OAEGL,UAAU;IAAC;GAAA,GACbF,IAAgC,CAAA;EAAA;EAAA,IAAAe,WAAA;GAAA,OAIxCZ,OAAO;EAAC;CAAA,CAAA;AAGf"}
@@ -1,3 +1,3 @@
1
- export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, type InputGroupAddonProps, type InputGroupProps, } from './input-group';
1
+ export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputGroupAddonAlign, type InputGroupAddonProps, type InputGroupButtonProps, type InputGroupProps, } from './input-group';
2
2
  export { SecretInputGroup, type SecretInputGroupProps } from './secret-input-group';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,3 +1,3 @@
1
- import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "./input-group.js";
1
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea } from "./input-group.js";
2
2
  import { SecretInputGroup } from "./secret-input-group.js";
3
- export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, SecretInputGroup };
3
+ export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, SecretInputGroup };
@@ -1,4 +1,5 @@
1
1
  import type { ComponentProps, JSX } from 'solid-js';
2
+ import { type ButtonProps } from '../button';
2
3
  /**
3
4
  * InputGroup.
4
5
  *
@@ -15,25 +16,49 @@ import type { ComponentProps, JSX } from 'solid-js';
15
16
  * `size` is the control rung, matching `Input`: `sm` for a toolbar search beside
16
17
  * `icon-sm` actions, `md` (the default) everywhere else. The group's input and
17
18
  * text follow it.
19
+ *
20
+ * The part list and alignments follow shadcn's InputGroup: an addon aligned
21
+ * `block-start` or `block-end` turns the group into a column (a header or a
22
+ * footer row around a field), and an `InputGroupTextarea` lets the group grow
23
+ * with its content. That column form is what a prompt input is, so the chat
24
+ * composers are built from these parts instead of their own box.
18
25
  */
19
26
  export type InputGroupProps = ComponentProps<'div'> & {
20
27
  size?: 'sm' | 'md' | 'lg';
21
28
  };
22
29
  export declare function InputGroup(props: InputGroupProps): JSX.Element;
23
30
  export declare function InputGroupInput(props: ComponentProps<'input'>): JSX.Element;
24
- export type InputGroupAddonProps = ComponentProps<'span'> & {
25
- /** Which edge the adornment sits on; also sets the pointer-events rule. */
26
- align?: 'start' | 'end';
31
+ /**
32
+ * The multi-line field of a group. It grows with its content up to the
33
+ * group's cap (`max-h-48`, the comfortable textarea ceiling) and then scrolls,
34
+ * so a long draft never pushes the footer row off screen.
35
+ */
36
+ export declare function InputGroupTextarea(props: ComponentProps<'textarea'>): JSX.Element;
37
+ export type InputGroupAddonAlign = 'inline-start' | 'inline-end' | 'block-start' | 'block-end'
38
+ /** @deprecated Use `inline-start`. */
39
+ | 'start'
40
+ /** @deprecated Use `inline-end`. */
41
+ | 'end';
42
+ export type InputGroupAddonProps = ComponentProps<'div'> & {
43
+ /** Which edge the adornment sits on. Block edges make the group a column. */
44
+ align?: InputGroupAddonAlign;
27
45
  };
28
46
  /**
29
- * A non-interactive adornment. `pointer-events-none` by default, because an
30
- * adornment that swallows a click makes the whole control feel dead just to
31
- * the left of the caret — the most annoying possible bug. Pass `align="end"`
32
- * and a real element when the adornment must be clickable.
47
+ * An adornment: an icon, a unit, a row of actions. A press on the addon
48
+ * itself, outside a control it holds, moves focus to the group's field, as in
49
+ * shadcn, so the whole group behaves as one control instead of having a dead
50
+ * strip beside the caret.
33
51
  */
34
52
  export declare function InputGroupAddon(props: InputGroupAddonProps): JSX.Element;
35
- /** A clickable trailing button, sized to the group's height. */
36
- export declare function InputGroupButton(props: ComponentProps<'button'>): JSX.Element;
53
+ export type InputGroupButtonProps = Omit<ButtonProps, 'size'> & {
54
+ /** shadcn's four InputGroupButton sizes, mapped onto the control ladder. */
55
+ size?: 'xs' | 'sm' | 'icon-xs' | 'icon-sm';
56
+ };
57
+ /**
58
+ * A button inside the group. It is a `Button` (ghost by default), so it shares
59
+ * the system's pressed, focus and disabled states rather than drawing its own.
60
+ */
61
+ export declare function InputGroupButton(props: InputGroupButtonProps): JSX.Element;
37
62
  /** Text that reads as a value but is not an input, e.g. a unit or a suffix. */
38
63
  export declare function InputGroupText(props: ComponentProps<'span'> & {
39
64
  children?: JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuBhD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,eA8B7D;AAED,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IAC1D,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACxB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAkB1D;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,eAoB/D;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,eAWxF"}
1
+ {"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAKnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eA8BhD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,eA+B7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,eAgCnE;AAED,MAAM,MAAM,oBAAoB,GAC5B,cAAc,GACd,YAAY,GACZ,aAAa,GACb,WAAW;AACb,sCAAsC;GACpC,OAAO;AACT,oCAAoC;GAClC,KAAK,CAAA;AAET,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,6EAA6E;IAC7E,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAQD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAsC1D;AAED,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IAC9D,4EAA4E;IAC5E,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAA;CAC3C,CAAA;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAY5D;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAE,eAYxF"}
@@ -1,13 +1,15 @@
1
+ import { callHandler } from "../../../lib/events.js";
1
2
  import { useFormFieldControl } from "../../../lib/form-field.js";
2
3
  import { cn } from "../../../lib/utils.js";
3
- import { insert, mergeProps, spread, template } from "solid-js/web";
4
+ import { Button } from "../button/button.js";
5
+ import { createComponent, delegateEvents, insert, mergeProps, spread, template } from "solid-js/web";
4
6
  import { splitProps } from "solid-js";
5
7
  // src/components/ui/input-group/input-group.tsx
6
- var _tmpl$ = /*#__PURE__*/ template(`<div data-slot=input-group>`);
7
- var _tmpl$2 = /*#__PURE__*/ template(`<input data-slot=input-group-input>`);
8
- var _tmpl$3 = /*#__PURE__*/ template(`<span data-slot=input-group-addon>`);
9
- var _tmpl$4 = /*#__PURE__*/ template(`<button type=button data-slot=input-group-button>`);
10
- var _tmpl$5 = /*#__PURE__*/ template(`<span>`);
8
+ var _tmpl$ = /*#__PURE__*/ template(`<div role=group data-slot=input-group>`);
9
+ var _tmpl$2 = /*#__PURE__*/ template(`<input data-slot=input-group-input data-input-group-control>`);
10
+ var _tmpl$3 = /*#__PURE__*/ template(`<textarea data-slot=input-group-textarea data-input-group-control rows=1>`);
11
+ var _tmpl$4 = /*#__PURE__*/ template(`<div role=group data-slot=input-group-addon>`);
12
+ var _tmpl$5 = /*#__PURE__*/ template(`<span data-slot=input-group-text>`);
11
13
  function InputGroup(props) {
12
14
  const [local, rest] = splitProps(props, ["class", "size"]);
13
15
  return (() => {
@@ -21,7 +23,7 @@ function InputGroup(props) {
21
23
  "h-control-sm px-control-xs": local.size === "sm",
22
24
  "h-control-md px-control-sm": local.size === "md" || local.size === void 0,
23
25
  "h-control-lg px-control-md": local.size === "lg"
24
- }, "transition-[color,box-shadow,border-color] ease-out", "focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle", "has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50", local.class);
26
+ }, "has-[>textarea]:h-auto", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:items-stretch", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:items-stretch", "transition-[color,box-shadow,border-color] ease-out", "focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle", "has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50", "has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50", local.class);
25
27
  }
26
28
  }, rest), false, false);
27
29
  return _el$;
@@ -67,41 +69,111 @@ function InputGroupInput(props) {
67
69
  })();
68
70
  }
69
71
  /**
70
- * A non-interactive adornment. `pointer-events-none` by default, because an
71
- * adornment that swallows a click makes the whole control feel dead just to
72
- * the left of the caret — the most annoying possible bug. Pass `align="end"`
73
- * and a real element when the adornment must be clickable.
72
+ * The multi-line field of a group. It grows with its content up to the
73
+ * group's cap (`max-h-48`, the comfortable textarea ceiling) and then scrolls,
74
+ * so a long draft never pushes the footer row off screen.
74
75
  */
75
- function InputGroupAddon(props) {
76
+ function InputGroupTextarea(props) {
76
77
  const [local, rest] = splitProps(props, [
77
78
  "class",
78
- "align",
79
- "children"
79
+ "id",
80
+ "aria-label",
81
+ "aria-labelledby",
82
+ "aria-describedby",
83
+ "aria-invalid",
84
+ "aria-errormessage"
80
85
  ]);
86
+ const field = useFormFieldControl("control", local);
81
87
  return (() => {
82
88
  var _el$3 = _tmpl$3();
83
- spread(_el$3, mergeProps({ get ["class"]() {
84
- return cn("text-muted-foreground flex shrink-0 items-center gap-1.5 text-sm select-none", "[&_svg]:pointer-events-none [&_svg]:size-4", "group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&_svg]:size-3.5", {
85
- "order-first": local.align !== "end",
86
- "order-last": local.align === "end"
87
- }, local.class);
88
- } }, rest), false, true);
89
- insert(_el$3, () => local.children);
89
+ spread(_el$3, mergeProps({
90
+ get id() {
91
+ return field?.id ?? local.id;
92
+ },
93
+ get ["aria-label"]() {
94
+ return local["aria-label"];
95
+ },
96
+ get ["aria-labelledby"]() {
97
+ return field?.["aria-labelledby"] ?? local["aria-labelledby"];
98
+ },
99
+ get ["aria-describedby"]() {
100
+ return field?.["aria-describedby"] ?? local["aria-describedby"];
101
+ },
102
+ get ["aria-invalid"]() {
103
+ return field?.["aria-invalid"] ?? local["aria-invalid"];
104
+ },
105
+ get ["aria-errormessage"]() {
106
+ return field?.["aria-errormessage"] ?? local["aria-errormessage"];
107
+ },
108
+ get ["class"]() {
109
+ return cn("field-sizing-content max-h-48 min-h-10 w-full min-w-0 flex-1 resize-none bg-transparent py-2 text-sm outline-none", "placeholder:text-muted-foreground", "disabled:cursor-not-allowed", local.class);
110
+ }
111
+ }, rest), false, false);
90
112
  return _el$3;
91
113
  })();
92
114
  }
93
- /** A clickable trailing button, sized to the group's height. */
94
- function InputGroupButton(props) {
95
- const [local, rest] = splitProps(props, ["class", "children"]);
115
+ function addonAlign(align) {
116
+ if (align === "end") return "inline-end";
117
+ if (align === "start" || align === void 0) return "inline-start";
118
+ return align;
119
+ }
120
+ /**
121
+ * An adornment: an icon, a unit, a row of actions. A press on the addon
122
+ * itself, outside a control it holds, moves focus to the group's field, as in
123
+ * shadcn, so the whole group behaves as one control instead of having a dead
124
+ * strip beside the caret.
125
+ */
126
+ function InputGroupAddon(props) {
127
+ const [local, rest] = splitProps(props, [
128
+ "class",
129
+ "align",
130
+ "children",
131
+ "onClick"
132
+ ]);
133
+ const align = () => addonAlign(local.align);
96
134
  return (() => {
97
135
  var _el$4 = _tmpl$4();
98
- spread(_el$4, mergeProps({ get ["class"]() {
99
- return cn("text-muted-foreground -me-1 flex size-6 shrink-0 items-center justify-center rounded-sm", "transition-colors ease-out outline-none hover:bg-surface-hover hover:text-foreground", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle", "disabled:pointer-events-none disabled:opacity-50", "[&_svg]:size-3.5", local.class);
100
- } }, rest), false, true);
136
+ _el$4.$$click = (event) => {
137
+ callHandler(local.onClick, event);
138
+ if (event.defaultPrevented) return;
139
+ if (event.target.closest("button, a, input, textarea, select, [role=button], [role=combobox]")) return;
140
+ (event.currentTarget.parentElement?.querySelector("[data-input-group-control]"))?.focus();
141
+ };
142
+ spread(_el$4, mergeProps({
143
+ get ["data-align"]() {
144
+ return align();
145
+ },
146
+ get ["class"]() {
147
+ return cn("text-muted-foreground flex shrink-0 cursor-text items-center gap-1.5 text-sm select-none", "[&_svg]:pointer-events-none [&>svg]:size-4", "group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&>svg]:size-3.5", {
148
+ "order-first": align() === "inline-start" || align() === "block-start",
149
+ "order-last": align() === "inline-end" || align() === "block-end",
150
+ "w-full justify-start gap-1": align() === "block-start" || align() === "block-end",
151
+ "pt-2": align() === "block-start",
152
+ "pb-2": align() === "block-end"
153
+ }, local.class);
154
+ }
155
+ }, rest), false, true);
101
156
  insert(_el$4, () => local.children);
102
157
  return _el$4;
103
158
  })();
104
159
  }
160
+ /**
161
+ * A button inside the group. It is a `Button` (ghost by default), so it shares
162
+ * the system's pressed, focus and disabled states rather than drawing its own.
163
+ */
164
+ function InputGroupButton(props) {
165
+ const [local, rest] = splitProps(props, ["size", "variant"]);
166
+ return createComponent(Button, mergeProps({
167
+ type: "button",
168
+ "data-slot": "input-group-button",
169
+ get variant() {
170
+ return local.variant ?? "ghost";
171
+ },
172
+ get size() {
173
+ return local.size ?? "icon-xs";
174
+ }
175
+ }, rest));
176
+ }
105
177
  /** Text that reads as a value but is not an input, e.g. a unit or a suffix. */
106
178
  function InputGroupText(props) {
107
179
  const [local, rest] = splitProps(props, ["class"]);
@@ -113,6 +185,7 @@ function InputGroupText(props) {
113
185
  return _el$5;
114
186
  })();
115
187
  }
116
- export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText };
188
+ delegateEvents(["click"]);
189
+ export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
117
190
 
118
191
  //# sourceMappingURL=input-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.js","names":["splitProps","useFormFieldControl","cn","size","InputGroup","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","undefined","InputGroupInput","field","_el$2","_tmpl$2","id","align","InputGroupAddon","_el$3","_tmpl$3","_$insert","children","InputGroupButton","_el$4","_tmpl$4","InputGroupText","_el$5","_tmpl$5"],"sources":["../../../../src/components/ui/input-group/input-group.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\n/**\n * InputGroup.\n *\n * A field with attached chrome: a leading icon, a unit, a trailing button, a\n * clear affordance. The point of the component is that the adornments and the\n * input share *one* border and *one* focus ring, so the group reads as a single\n * control. Two separate elements side by side always drift, the ring appears\n * on the wrong box, or the border doubles where they meet.\n *\n * The focus ring therefore lives on the group and follows `focus-within`. A\n * group containing several focusable things still reads as focused once, which\n * is the correct affordance: the user is somewhere inside it.\n *\n * `size` is the control rung, matching `Input`: `sm` for a toolbar search beside\n * `icon-sm` actions, `md` (the default) everywhere else. The group's input and\n * text follow it.\n */\nexport type InputGroupProps = ComponentProps<'div'> & {\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport function InputGroup(props: InputGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n\n return (\n <div\n data-slot=\"input-group\"\n data-size={local.size}\n class={cn(\n 'group/input-group border-input flex w-full min-w-0 items-center gap-1.5 rounded-md border bg-transparent',\n {\n 'h-control-sm px-control-xs': local.size === 'sm',\n 'h-control-md px-control-sm': local.size === 'md' || local.size === undefined,\n 'h-control-lg px-control-md': local.size === 'lg',\n },\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle',\n 'has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function InputGroupInput(props: ComponentProps<'input'>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', local)\n\n return (\n <input\n data-slot=\"input-group-input\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full min-w-0 flex-1 bg-transparent text-sm outline-none group-data-[size=sm]/input-group:text-xs',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type InputGroupAddonProps = ComponentProps<'span'> & {\n /** Which edge the adornment sits on; also sets the pointer-events rule. */\n align?: 'start' | 'end'\n}\n\n/**\n * A non-interactive adornment. `pointer-events-none` by default, because an\n * adornment that swallows a click makes the whole control feel dead just to\n * the left of the caret — the most annoying possible bug. Pass `align=\"end\"`\n * and a real element when the adornment must be clickable.\n */\nexport function InputGroupAddon(props: InputGroupAddonProps) {\n const [local, rest] = splitProps(props, ['class', 'align', 'children'])\n\n return (\n <span\n data-slot=\"input-group-addon\"\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center gap-1.5 text-sm select-none',\n '[&_svg]:pointer-events-none [&_svg]:size-4',\n 'group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&_svg]:size-3.5',\n { 'order-first': local.align !== 'end', 'order-last': local.align === 'end' },\n local.class\n )}\n {...rest}\n >\n {local.children}\n </span>\n )\n}\n\n/** A clickable trailing button, sized to the group's height. */\nexport function InputGroupButton(props: ComponentProps<'button'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <button\n type=\"button\"\n data-slot=\"input-group-button\"\n class={cn(\n 'text-muted-foreground -me-1 flex size-6 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:bg-surface-hover hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n '[&_svg]:size-3.5',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </button>\n )\n}\n\n/** Text that reads as a value but is not an input, e.g. a unit or a suffix. */\nexport function InputGroupText(props: ComponentProps<'span'> & { children?: JSX.Element }) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n class={cn(\n 'text-muted-foreground text-sm group-data-[size=sm]/input-group:text-xs',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgBI,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQP,WAAWK,OAAO,CAAC,SAAS,MAAM,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,eAAA;IAAA,OAGeL,MAAMH;GAAI;GAAA,KAAA,WAAA;IAAA,OACdD,GACL,4GACA;KACE,8BAA8BI,MAAMH,SAAS;KAC7C,8BAA8BG,MAAMH,SAAS,QAAQG,MAAMH,SAASU,KAAAA;KACpE,8BAA8BP,MAAMH,SAAS;IAC/C,GACA,uDACA,iFACA,mIACA,2EACAG,MAAMM,KACR;GAAC;EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBM,gBAAgBT,OAAgC;CAC9D,MAAM,CAACC,OAAOC,QAAQP,WAAWK,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAmB,CACpB;CACD,MAAMU,QAAQd,oBAAoB,WAAWK,KAAK;CAElD,cAAA;EAAA,IAAAU,QAAAC,QAAA;EAAAP,OAAAM,OAAAL,WAAA;GAA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AA;EAAAgB,OAAAG,aAEPpB,MAAMkB,QAAQ;EAAA,OAAAE;CAAA,EAAA,CAAA;AAGrB;;AAGA,SAAgBE,eAAevB,OAA4D;CACzF,MAAM,CAACC,OAAOC,QAAQP,WAAWK,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAwB,QAAAC,QAAA;EAAApB,OAAAmB,OAAAlB,WAAA,EAAA,KAAA,WAAA;GAAA,OAEWT,GACL,0EACAI,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAsB;CAAA,EAAA,CAAA;AAGd"}
1
+ {"version":3,"file":"input-group.js","names":["splitProps","callHandler","useFormFieldControl","cn","Button","size","InputGroup","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","undefined","InputGroupInput","field","_el$2","_tmpl$2","id","InputGroupTextarea","_el$3","_tmpl$3","align","addonAlign","InputGroupAddon","_el$4","_tmpl$4","$$click","event","onClick","defaultPrevented","target","closest","control","currentTarget","parentElement","querySelector","focus","_$insert","children","InputGroupButton","_$createComponent","type","variant","InputGroupText","_el$5","_tmpl$5","_$delegateEvents"],"sources":["../../../../src/components/ui/input-group/input-group.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { Button, type ButtonProps } from '../button'\n\n/**\n * InputGroup.\n *\n * A field with attached chrome: a leading icon, a unit, a trailing button, a\n * clear affordance. The point of the component is that the adornments and the\n * input share *one* border and *one* focus ring, so the group reads as a single\n * control. Two separate elements side by side always drift, the ring appears\n * on the wrong box, or the border doubles where they meet.\n *\n * The focus ring therefore lives on the group and follows `focus-within`. A\n * group containing several focusable things still reads as focused once, which\n * is the correct affordance: the user is somewhere inside it.\n *\n * `size` is the control rung, matching `Input`: `sm` for a toolbar search beside\n * `icon-sm` actions, `md` (the default) everywhere else. The group's input and\n * text follow it.\n *\n * The part list and alignments follow shadcn's InputGroup: an addon aligned\n * `block-start` or `block-end` turns the group into a column (a header or a\n * footer row around a field), and an `InputGroupTextarea` lets the group grow\n * with its content. That column form is what a prompt input is, so the chat\n * composers are built from these parts instead of their own box.\n */\nexport type InputGroupProps = ComponentProps<'div'> & {\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport function InputGroup(props: InputGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n\n return (\n <div\n role=\"group\"\n data-slot=\"input-group\"\n data-size={local.size}\n class={cn(\n 'group/input-group border-input flex w-full min-w-0 items-center gap-1.5 rounded-md border bg-transparent',\n {\n 'h-control-sm px-control-xs': local.size === 'sm',\n 'h-control-md px-control-sm': local.size === 'md' || local.size === undefined,\n 'h-control-lg px-control-md': local.size === 'lg',\n },\n // A textarea, or an addon on a block edge, makes the group a column\n // that grows with its content: shadcn's prompt-input form.\n 'has-[>textarea]:h-auto',\n 'has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:items-stretch',\n 'has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:items-stretch',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle',\n 'has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50',\n 'has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function InputGroupInput(props: ComponentProps<'input'>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', local)\n\n return (\n <input\n data-slot=\"input-group-input\"\n data-input-group-control=\"\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full min-w-0 flex-1 bg-transparent text-sm outline-none group-data-[size=sm]/input-group:text-xs',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * The multi-line field of a group. It grows with its content up to the\n * group's cap (`max-h-48`, the comfortable textarea ceiling) and then scrolls,\n * so a long draft never pushes the footer row off screen.\n */\nexport function InputGroupTextarea(props: ComponentProps<'textarea'>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', local)\n\n return (\n <textarea\n data-slot=\"input-group-textarea\"\n data-input-group-control=\"\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n rows={1}\n class={cn(\n 'field-sizing-content max-h-48 min-h-10 w-full min-w-0 flex-1 resize-none bg-transparent py-2 text-sm outline-none',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type InputGroupAddonAlign =\n | 'inline-start'\n | 'inline-end'\n | 'block-start'\n | 'block-end'\n /** @deprecated Use `inline-start`. */\n | 'start'\n /** @deprecated Use `inline-end`. */\n | 'end'\n\nexport type InputGroupAddonProps = ComponentProps<'div'> & {\n /** Which edge the adornment sits on. Block edges make the group a column. */\n align?: InputGroupAddonAlign\n}\n\nfunction addonAlign(align: InputGroupAddonAlign | undefined) {\n if (align === 'end') return 'inline-end'\n if (align === 'start' || align === undefined) return 'inline-start'\n return align\n}\n\n/**\n * An adornment: an icon, a unit, a row of actions. A press on the addon\n * itself, outside a control it holds, moves focus to the group's field, as in\n * shadcn, so the whole group behaves as one control instead of having a dead\n * strip beside the caret.\n */\nexport function InputGroupAddon(props: InputGroupAddonProps) {\n const [local, rest] = splitProps(props, ['class', 'align', 'children', 'onClick'])\n const align = () => addonAlign(local.align)\n\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align()}\n class={cn(\n 'text-muted-foreground flex shrink-0 cursor-text items-center gap-1.5 text-sm select-none',\n '[&_svg]:pointer-events-none [&>svg]:size-4',\n 'group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&>svg]:size-3.5',\n {\n 'order-first': align() === 'inline-start' || align() === 'block-start',\n 'order-last': align() === 'inline-end' || align() === 'block-end',\n 'w-full justify-start gap-1': align() === 'block-start' || align() === 'block-end',\n 'pt-2': align() === 'block-start',\n 'pb-2': align() === 'block-end',\n },\n local.class\n )}\n onClick={(event) => {\n callHandler(local.onClick, event)\n if (event.defaultPrevented) return\n const target = event.target as Element\n if (target.closest('button, a, input, textarea, select, [role=button], [role=combobox]'))\n return\n const control = event.currentTarget.parentElement?.querySelector<HTMLElement>(\n '[data-input-group-control]'\n )\n control?.focus()\n }}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\nexport type InputGroupButtonProps = Omit<ButtonProps, 'size'> & {\n /** shadcn's four InputGroupButton sizes, mapped onto the control ladder. */\n size?: 'xs' | 'sm' | 'icon-xs' | 'icon-sm'\n}\n\n/**\n * A button inside the group. It is a `Button` (ghost by default), so it shares\n * the system's pressed, focus and disabled states rather than drawing its own.\n */\nexport function InputGroupButton(props: InputGroupButtonProps) {\n const [local, rest] = splitProps(props, ['size', 'variant'])\n\n return (\n <Button\n type=\"button\"\n data-slot=\"input-group-button\"\n variant={local.variant ?? 'ghost'}\n size={local.size ?? 'icon-xs'}\n {...rest}\n />\n )\n}\n\n/** Text that reads as a value but is not an input, e.g. a unit or a suffix. */\nexport function InputGroupText(props: ComponentProps<'span'> & { children?: JSX.Element }) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot=\"input-group-text\"\n class={cn(\n 'text-muted-foreground text-sm group-data-[size=sm]/input-group:text-xs',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgBM,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO,CAAC,SAAS,MAAM,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,eAAA;IAAA,OAIeL,MAAMH;GAAI;GAAA,KAAA,WAAA;IAAA,OACdF,GACL,4GACA;KACE,8BAA8BK,MAAMH,SAAS;KAC7C,8BAA8BG,MAAMH,SAAS,QAAQG,MAAMH,SAASU,KAAAA;KACpE,8BAA8BP,MAAMH,SAAS;IAC/C,GAGA,0BACA,iIACA,2HACA,uDACA,iFACA,mIACA,2EACA,iFACAG,MAAMM,KACR;GAAC;EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBM,gBAAgBT,OAAgC;CAC9D,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAmB,CACpB;CACD,MAAMU,QAAQf,oBAAoB,WAAWM,KAAK;CAElD,cAAA;EAAA,IAAAU,QAAAC,QAAA;EAAAP,OAAAM,OAAAL,WAAA;GAAA,IAIIO,KAAE;IAAA,OAAEH,OAAOG,MAAMZ,MAAMY;GAAE;GAAA,KAAA,gBAAA;IAAA,OACbZ,MAAM;GAAa;GAAA,KAAA,qBAA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,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kCAQ5C"}
1
+ {"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/kbd/kbd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW;;8EAmBvB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE3E,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAMpE;AAED,eAAO,MAAM,gBAAgB;;8EAW3B,CAAA;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAU1E;AAMD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBnD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kCAQ5C"}
@@ -25,7 +25,12 @@ var _tmpl$2 = /*#__PURE__*/ template(`<span data-slot=kbd-group>`);
25
25
  * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`
26
26
  * needs a gap between them that is a layout concern, not punctuation.
27
27
  */
28
- var kbdVariants = cva(["bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none", "[&_svg:not([class*='size-'])]:size-3"], {
28
+ var kbdVariants = cva([
29
+ "bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
30
+ "[&_svg:not([class*='size-'])]:size-3",
31
+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background",
32
+ "[[data-slot=side-rail-tip]_&]:bg-background/20 [[data-slot=side-rail-tip]_&]:text-background"
33
+ ], {
29
34
  variants: { size: {
30
35
  default: "",
31
36
  compact: "min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none"
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.js","names":["For","splitProps","cva","cn","kbdVariants","variants","size","default","compact","defaultVariants","Kbd","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","kbdGroupVariants","KbdGroup","_el$2","_tmpl$2","NAMED_KEY","kbdChordKeys","keys","caps","separated","length","first","slice","named","exec","cap","test","charAt","String","fromCodePoint","codePointAt","push","KbdChord","_$createComponent","children","each","key"],"sources":["../../../../src/components/ui/kbd/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Kbd.\n *\n * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element\n * is a real `<kbd>` so the semantics survive copy-paste.\n *\n * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the\n * code face. Monospace faces carry letters but rarely the modifier glyphs, so\n * a mono `⌘` fell back to another font and sat visibly smaller than the mono\n * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so\n * every cap in a chord reads at the same size.\n *\n * `size=\"compact\"` exists for the dense rows a default cap would outweigh, a\n * rail search row, a sidebar shortcut hint. It drops a height rung, and it\n * lightens the fill and weight with it because at that size a solid muted cap\n * reads heavier than the row text it sits in.\n *\n * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`\n * needs a gap between them that is a layout concern, not punctuation.\n */\nexport const kbdVariants = cva(\n [\n 'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',\n \"[&_svg:not([class*='size-'])]:size-3\",\n ],\n {\n variants: {\n size: {\n default: '',\n compact: 'min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>['size']>\n\nexport function Kbd(props: ComponentProps<'kbd'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <kbd data-slot=\"kbd\" class={cn(kbdVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\nexport const kbdGroupVariants = cva('inline-flex items-center gap-1', {\n variants: {\n size: {\n default: '',\n /** The gap is what separates caps, so it tightens with them. */\n compact: 'gap-0.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n\n/**\n * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a\n * `kbd` selector still finds exactly the caps, which hosts and tests count.\n */\nexport function KbdGroup(props: ComponentProps<'span'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <span\n data-slot=\"kbd-group\"\n class={cn(kbdGroupVariants({ size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n\n/** Key names that are drawn as one word on one cap. */\nconst NAMED_KEY =\n /^(?:Ctrl|Control|Alt|Option|Opt|Shift|Cmd|Command|Meta|Super|Win|Fn|Enter|Return|Escape|Esc|Tab|Space|Backspace|Delete|Del|Insert|Home|End|PageUp|PageDown|PgUp|PgDn|Up|Down|Left|Right|F(?:1\\d|2[0-4]|[1-9]))/\n\n/**\n * Split a written chord into one entry per key cap.\n *\n * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`\n * stays three caps wide, which matches how the system draws chords in menus.\n * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is\n * `⇧` + `Enter`.\n * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),\n * except a `+` that is itself the key (`Ctrl++`, `⌘+`).\n */\nexport function kbdChordKeys(keys: string): string[] {\n const caps: string[] = []\n let rest = keys\n let separated = true\n while (rest.length > 0) {\n const first = rest[0]!\n if (first === ' ' || (first === '+' && !separated && rest.length > 1)) {\n rest = rest.slice(1)\n separated = true\n continue\n }\n const named = NAMED_KEY.exec(rest)?.[0]\n // A name only counts when a lowercase letter does not continue it: `Tab`\n // in `Table` is not a key, so a caller's literal text is drawn as written.\n const cap =\n named && !/^[a-z]/.test(rest.charAt(named.length))\n ? named\n : String.fromCodePoint(rest.codePointAt(0)!)\n caps.push(cap)\n rest = rest.slice(cap.length)\n separated = false\n }\n return caps\n}\n\nexport type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {\n /** The chord as it is drawn, e.g. `\"⌘K\"`, `\"⇧⌘P\"` or `\"Ctrl+K\"`. See `kbdChordKeys`. */\n keys: string\n size?: KbdSize\n}\n\n/**\n * KbdChord.\n *\n * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the\n * composition renders `aria-hidden`, so the accessible name and the parseable\n * `aria-keyshortcuts` stay on the control the chord belongs to. That is why\n * there is no children, the chord says what was drawn, nothing more.\n */\nexport function KbdChord(props: KbdChordProps) {\n const [local, rest] = splitProps(props, ['keys', 'size', 'class'])\n\n return (\n <KbdGroup {...rest} size={local.size} class={local.class} aria-hidden=\"true\">\n <For each={kbdChordKeys(local.keys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ChB,OAAOd,KAAKe,SAAS,GAAG;EACtB,MAAMC,QAAQhB,KAAK;EACnB,IAAIgB,UAAU,OAAQA,UAAU,OAAO,CAACF,aAAad,KAAKe,SAAS,GAAI;GACrEf,OAAOA,KAAKiB,MAAM,CAAC;GACnBH,YAAY;GACZ;EACF;EACA,MAAMI,QAAQR,UAAUS,KAAKnB,IAAI,CAAC,GAAG;EAGrC,MAAMoB,MACJF,SAAS,CAAC,SAASG,KAAKrB,KAAKsB,OAAOJ,MAAMH,MAAM,CAAC,IAC7CG,QACAK,OAAOC,cAAcxB,KAAKyB,YAAY,CAAC,CAAE;EAC/CZ,KAAKa,KAAKN,GAAG;EACbpB,OAAOA,KAAKiB,MAAMG,IAAIL,MAAM;EAC5BD,YAAY;CACd;CACA,OAAOD;AACT;;;;;;;;;AAgBA,SAAgBc,SAAS7B,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO;EAAC;EAAQ;EAAQ;CAAO,CAAC;CAEjE,OAAA8B,gBACGrB,UAAQH,WAAKJ,MAAI;EAAA,IAAEP,OAAI;GAAA,OAAEM,MAAMN;EAAI;EAAA,KAAA,WAAA;GAAA,OAASM,MAAMM;EAAK;EAAA,eAAA;EAAA,IAAAwB,WAAA;GAAA,OAAAD,gBACrDzC,KAAG;IAAA,IAAC2C,OAAI;KAAA,OAAEnB,aAAaZ,MAAMa,IAAI;IAAC;IAAAiB,WAAIE,QAAGH,gBAAM/B,KAAG;KAAA,IAACJ,OAAI;MAAA,OAAEM,MAAMN;KAAI;KAAAoC,UAAGE;IAAG,CAAA;GAAO,CAAA;EAAA;CAAA,CAAA,CAAA;AAGvF"}
1
+ {"version":3,"file":"kbd.js","names":["For","splitProps","cva","cn","kbdVariants","variants","size","default","compact","defaultVariants","Kbd","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","kbdGroupVariants","KbdGroup","_el$2","_tmpl$2","NAMED_KEY","kbdChordKeys","keys","caps","separated","length","first","slice","named","exec","cap","test","charAt","String","fromCodePoint","codePointAt","push","KbdChord","_$createComponent","children","each","key"],"sources":["../../../../src/components/ui/kbd/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Kbd.\n *\n * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element\n * is a real `<kbd>` so the semantics survive copy-paste.\n *\n * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the\n * code face. Monospace faces carry letters but rarely the modifier glyphs, so\n * a mono `⌘` fell back to another font and sat visibly smaller than the mono\n * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so\n * every cap in a chord reads at the same size.\n *\n * `size=\"compact\"` exists for the dense rows a default cap would outweigh, a\n * rail search row, a sidebar shortcut hint. It drops a height rung, and it\n * lightens the fill and weight with it because at that size a solid muted cap\n * reads heavier than the row text it sits in.\n *\n * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`\n * needs a gap between them that is a layout concern, not punctuation.\n */\nexport const kbdVariants = cva(\n [\n 'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',\n \"[&_svg:not([class*='size-'])]:size-3\",\n // Inside the inverted tooltip chip the cap inverts with it, as in shadcn.\n '[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background',\n '[[data-slot=side-rail-tip]_&]:bg-background/20 [[data-slot=side-rail-tip]_&]:text-background',\n ],\n {\n variants: {\n size: {\n default: '',\n compact: 'min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>['size']>\n\nexport function Kbd(props: ComponentProps<'kbd'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <kbd data-slot=\"kbd\" class={cn(kbdVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\nexport const kbdGroupVariants = cva('inline-flex items-center gap-1', {\n variants: {\n size: {\n default: '',\n /** The gap is what separates caps, so it tightens with them. */\n compact: 'gap-0.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n\n/**\n * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a\n * `kbd` selector still finds exactly the caps, which hosts and tests count.\n */\nexport function KbdGroup(props: ComponentProps<'span'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <span\n data-slot=\"kbd-group\"\n class={cn(kbdGroupVariants({ size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n\n/** Key names that are drawn as one word on one cap. */\nconst NAMED_KEY =\n /^(?:Ctrl|Control|Alt|Option|Opt|Shift|Cmd|Command|Meta|Super|Win|Fn|Enter|Return|Escape|Esc|Tab|Space|Backspace|Delete|Del|Insert|Home|End|PageUp|PageDown|PgUp|PgDn|Up|Down|Left|Right|F(?:1\\d|2[0-4]|[1-9]))/\n\n/**\n * Split a written chord into one entry per key cap.\n *\n * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`\n * stays three caps wide, which matches how the system draws chords in menus.\n * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is\n * `⇧` + `Enter`.\n * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),\n * except a `+` that is itself the key (`Ctrl++`, `⌘+`).\n */\nexport function kbdChordKeys(keys: string): string[] {\n const caps: string[] = []\n let rest = keys\n let separated = true\n while (rest.length > 0) {\n const first = rest[0]!\n if (first === ' ' || (first === '+' && !separated && rest.length > 1)) {\n rest = rest.slice(1)\n separated = true\n continue\n }\n const named = NAMED_KEY.exec(rest)?.[0]\n // A name only counts when a lowercase letter does not continue it: `Tab`\n // in `Table` is not a key, so a caller's literal text is drawn as written.\n const cap =\n named && !/^[a-z]/.test(rest.charAt(named.length))\n ? named\n : String.fromCodePoint(rest.codePointAt(0)!)\n caps.push(cap)\n rest = rest.slice(cap.length)\n separated = false\n }\n return caps\n}\n\nexport type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {\n /** The chord as it is drawn, e.g. `\"⌘K\"`, `\"⇧⌘P\"` or `\"Ctrl+K\"`. See `kbdChordKeys`. */\n keys: string\n size?: KbdSize\n}\n\n/**\n * KbdChord.\n *\n * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the\n * composition renders `aria-hidden`, so the accessible name and the parseable\n * `aria-keyshortcuts` stay on the control the chord belongs to. That is why\n * there is no children, the chord says what was drawn, nothing more.\n */\nexport function KbdChord(props: KbdChordProps) {\n const [local, rest] = splitProps(props, ['keys', 'size', 'class'])\n\n return (\n <KbdGroup {...rest} size={local.size} class={local.class} aria-hidden=\"true\">\n <For each={kbdChordKeys(local.keys)}>{(key) => <Kbd size={local.size}>{key}</Kbd>}</For>\n </KbdGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAaI,cAAcF,IACzB;CACE;CACA;CAEA;CACA;AAA8F,GAEhG;CACEG,UAAU,EACRC,MAAM;EACJC,SAAS;EACTC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CACF;AAIA,SAAgBI,IAAIC,OAAmD;CACrE,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO,CAAC,QAAQ,OAAO,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAC8Bd,GAAGC,YAAY,EAAEE,MAAMM,MAAMN,KAAK,CAAC,GAAGM,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAE5F;AAEA,IAAaK,mB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OAAA8B,gBACGrB,UAAQH,WAAKJ,MAAI;EAAA,IAAEP,OAAI;GAAA,OAAEM,MAAMN;EAAI;EAAA,KAAA,WAAA;GAAA,OAASM,MAAMM;EAAK;EAAA,eAAA;EAAA,IAAAwB,WAAA;GAAA,OAAAD,gBACrDzC,KAAG;IAAA,IAAC2C,OAAI;KAAA,OAAEnB,aAAaZ,MAAMa,IAAI;IAAC;IAAAiB,WAAIE,QAAGH,gBAAM/B,KAAG;KAAA,IAACJ,OAAI;MAAA,OAAEM,MAAMN;KAAI;KAAAoC,UAAGE;IAAG,CAAA;GAAO,CAAA;EAAA;CAAA,CAAA,CAAA;AAGvF"}
@@ -1,4 +1,4 @@
1
- export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText, type MessageCitations, type MessageCodeBlockInfo, type MessageCodeBlockProps, type MessageProps, type MessageRole, type MessageTextProps, } from './message';
1
+ export { Message, MessageAction, MessageActions, MessageCopyAction, MessageContent, MessageFooter, MessageHeader, MessageText, type MessageCitations, type MessageCodeBlockInfo, type MessageCodeBlockProps, type MessageActionProps, type MessageProps, type MessageRole, type MessageTextProps, } from './message';
2
2
  export { placeCitationMarkers, type CitationPlacement, type PlacedCitations } from './cite-ranges';
3
3
  export { parseInline, parseMessageText, parseMessageTextIncremental, safeHref, type MessageBlock, type MessageInline, type MessageParse, type MessageParseOptions, type ParseInlineOptions, } from './parse-message-text';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAClG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAClG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { safeHref } from "../../../lib/url.js";
2
- import { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText } from "./message.js";
2
+ import { Message, MessageAction, MessageActions, MessageContent, MessageCopyAction, MessageFooter, MessageHeader, MessageText } from "./message.js";
3
3
  import { placeCitationMarkers } from "./cite-ranges.js";
4
4
  import { parseInline, parseMessageText, parseMessageTextIncremental } from "./parse-message-text.js";
5
- export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText, parseInline, parseMessageText, parseMessageTextIncremental, placeCitationMarkers, safeHref };
5
+ export { Message, MessageAction, MessageActions, MessageContent, MessageCopyAction, MessageFooter, MessageHeader, MessageText, parseInline, parseMessageText, parseMessageTextIncremental, placeCitationMarkers, safeHref };
@@ -1,4 +1,5 @@
1
1
  import { type ComponentProps, type JSX } from 'solid-js';
2
+ import { type ActionButtonProps } from '../../composites/action-button';
2
3
  import { type CodeBlockProps } from '../code-block';
3
4
  /**
4
5
  * Message.
@@ -45,6 +46,21 @@ export declare function MessageContent(props: ComponentProps<'div'>): JSX.Elemen
45
46
  * and on a touch screen there is no hover, so coarse pointers always see them.
46
47
  */
47
48
  export declare function MessageActions(props: ComponentProps<'div'>): JSX.Element;
49
+ export type MessageActionProps = Omit<ActionButtonProps, 'tooltip' | 'aria-label'> & {
50
+ /** The action's name: its accessible name and its tooltip. */
51
+ label: string;
52
+ };
53
+ /**
54
+ * One action on a turn: an icon button whose name is also its tooltip, as in
55
+ * AI Elements' MessageAction. Turn actions are icons, never words, so a row of
56
+ * them stays one line under any message.
57
+ */
58
+ export declare function MessageAction(props: MessageActionProps): JSX.Element;
59
+ /** Copies the turn's text and shows a check for a moment once the clipboard took it. */
60
+ export declare function MessageCopyAction(props: Omit<MessageActionProps, 'label' | 'children' | 'onClick'> & {
61
+ text: string | (() => string);
62
+ label?: string;
63
+ }): JSX.Element;
48
64
  export declare function MessageFooter(props: ComponentProps<'footer'>): JSX.Element;
49
65
  /** The props of a fenced block the host may set. */
50
66
  export type MessageCodeBlockProps = Pick<CodeBlockProps, 'loadHighlight' | 'maxHeight' | 'wrap' | 'showLineNumbers' | 'lineMarks' | 'lineLimit'>;
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAQ1E;;;;;;;;;;;;;;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B,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,KAAK,GAAG,CAAC,OAAO,CAAA;CACpD,CAAC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,qBAAqB,GAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,qBAAqB,CAAC,CAAA;IACjG,mEAAmE;IACnE,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAWD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eA0DlD"}
@@ -1,7 +1,10 @@
1
+ import { createCopyFeedback } from "../../../lib/clipboard.js";
1
2
  import { cn } from "../../../lib/utils.js";
3
+ import { ActionButton } from "../../composites/action-button/action-button.js";
2
4
  import { CodeBlock, InlineCode } from "../code-block/code-block.js";
3
5
  import { parseMessageTextIncremental } from "./parse-message-text.js";
4
6
  import { createComponent, effect, insert, memo, mergeProps, setAttribute, spread, template } from "solid-js/web";
7
+ import { Check, Copy } from "lucide-solid";
5
8
  import { For, Index, Match, Show, Switch, createMemo, splitProps } from "solid-js";
6
9
  // src/components/ui/message/message.tsx
7
10
  var _tmpl$ = /*#__PURE__*/ template(`<article data-slot=message>`);
@@ -118,6 +121,54 @@ function MessageActions(props) {
118
121
  return _el$6;
119
122
  })();
120
123
  }
124
+ /**
125
+ * One action on a turn: an icon button whose name is also its tooltip, as in
126
+ * AI Elements' MessageAction. Turn actions are icons, never words, so a row of
127
+ * them stays one line under any message.
128
+ */
129
+ function MessageAction(props) {
130
+ const [local, rest] = splitProps(props, ["label"]);
131
+ return createComponent(ActionButton, mergeProps({
132
+ type: "button",
133
+ variant: "ghost",
134
+ size: "icon-xs",
135
+ "data-slot": "message-action",
136
+ get ["aria-label"]() {
137
+ return local.label;
138
+ },
139
+ get tooltip() {
140
+ return local.label;
141
+ },
142
+ tooltipSide: "bottom"
143
+ }, rest));
144
+ }
145
+ /** Copies the turn's text and shows a check for a moment once the clipboard took it. */
146
+ function MessageCopyAction(props) {
147
+ const [local, rest] = splitProps(props, ["text", "label"]);
148
+ const feedback = createCopyFeedback();
149
+ const label = () => feedback.copied() ? "Copied" : feedback.failed() ? "Copy failed" : local.label ?? "Copy";
150
+ return createComponent(MessageAction, mergeProps({
151
+ get label() {
152
+ return label();
153
+ },
154
+ onClick: () => {
155
+ const text = typeof local.text === "function" ? local.text() : local.text;
156
+ feedback.copy(text);
157
+ }
158
+ }, rest, { get children() {
159
+ return createComponent(Show, {
160
+ get when() {
161
+ return feedback.copied();
162
+ },
163
+ get fallback() {
164
+ return createComponent(Copy, {});
165
+ },
166
+ get children() {
167
+ return createComponent(Check, {});
168
+ }
169
+ });
170
+ } }));
171
+ }
121
172
  function MessageFooter(props) {
122
173
  const [local, rest] = splitProps(props, ["class", "children"]);
123
174
  return (() => {
@@ -437,6 +488,6 @@ function Inline(props) {
437
488
  } })
438
489
  });
439
490
  }
440
- export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText };
491
+ export { Message, MessageAction, MessageActions, MessageContent, MessageCopyAction, MessageFooter, MessageHeader, MessageText };
441
492
 
442
493
  //# sourceMappingURL=message.js.map