@womp/kookie-ui 0.14.3 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/components.css +12 -0
  2. package/dist/cjs/components/_internal/base-button.js +1 -1
  3. package/dist/cjs/components/_internal/base-button.js.map +2 -2
  4. package/dist/cjs/components/_internal/base-button.props.d.ts +1 -1
  5. package/dist/cjs/components/_internal/base-button.props.js +1 -1
  6. package/dist/cjs/components/_internal/base-button.props.js.map +2 -2
  7. package/dist/cjs/components/button.d.ts +2 -2
  8. package/dist/cjs/components/button.d.ts.map +1 -1
  9. package/dist/cjs/components/button.js +1 -1
  10. package/dist/cjs/components/button.js.map +2 -2
  11. package/dist/cjs/components/button.props.js +1 -1
  12. package/dist/cjs/components/button.props.js.map +2 -2
  13. package/dist/cjs/components/chatbar.d.ts +3 -28
  14. package/dist/cjs/components/chatbar.d.ts.map +1 -1
  15. package/dist/cjs/components/chatbar.js +2 -2
  16. package/dist/cjs/components/chatbar.js.map +3 -3
  17. package/dist/cjs/components/icon-button.d.ts +2 -1
  18. package/dist/cjs/components/icon-button.d.ts.map +1 -1
  19. package/dist/cjs/components/icon-button.js +2 -2
  20. package/dist/cjs/components/icon-button.js.map +2 -2
  21. package/dist/cjs/components/icon-button.props.js +1 -1
  22. package/dist/cjs/components/icon-button.props.js.map +2 -2
  23. package/dist/cjs/components/index.js +5 -5
  24. package/dist/cjs/components/index.js.map +3 -3
  25. package/dist/cjs/components/message-scroller.d.ts +3 -9
  26. package/dist/cjs/components/message-scroller.d.ts.map +1 -1
  27. package/dist/cjs/components/message-scroller.js +2 -2
  28. package/dist/cjs/components/message-scroller.js.map +3 -3
  29. package/dist/cjs/components/notice.js +2 -2
  30. package/dist/cjs/components/notice.js.map +2 -2
  31. package/dist/cjs/components/schemas/base-button.schema.js +1 -1
  32. package/dist/cjs/components/schemas/base-button.schema.js.map +2 -2
  33. package/dist/cjs/components/schemas/button.schema.js +1 -1
  34. package/dist/cjs/components/schemas/button.schema.js.map +2 -2
  35. package/dist/cjs/components/schemas/icon-button.schema.js +1 -1
  36. package/dist/cjs/components/schemas/icon-button.schema.js.map +2 -2
  37. package/dist/cjs/components/schemas/index.js +1 -1
  38. package/dist/cjs/components/schemas/index.js.map +2 -2
  39. package/dist/cjs/components/schemas/toggle-button.schema.js +1 -1
  40. package/dist/cjs/components/schemas/toggle-button.schema.js.map +2 -2
  41. package/dist/cjs/components/schemas/toggle-icon-button.schema.js +1 -1
  42. package/dist/cjs/components/schemas/toggle-icon-button.schema.js.map +2 -2
  43. package/dist/cjs/components/theme-panel.js +1 -1
  44. package/dist/cjs/components/theme-panel.js.map +2 -2
  45. package/dist/cjs/components/toggle-button.d.ts +3 -37
  46. package/dist/cjs/components/toggle-button.d.ts.map +1 -1
  47. package/dist/cjs/components/toggle-button.js +3 -3
  48. package/dist/cjs/components/toggle-button.js.map +2 -2
  49. package/dist/cjs/components/toggle-icon-button.d.ts +3 -2
  50. package/dist/cjs/components/toggle-icon-button.d.ts.map +1 -1
  51. package/dist/cjs/components/toggle-icon-button.js +3 -3
  52. package/dist/cjs/components/toggle-icon-button.js.map +2 -2
  53. package/dist/cjs/components/toolbar.d.ts +4 -3
  54. package/dist/cjs/components/toolbar.d.ts.map +1 -1
  55. package/dist/cjs/components/toolbar.js +2 -2
  56. package/dist/cjs/components/toolbar.js.map +2 -2
  57. package/dist/cjs/index.js +6 -6
  58. package/dist/cjs/index.js.map +3 -3
  59. package/dist/cjs/props/index.js +1 -1
  60. package/dist/cjs/props/index.js.map +2 -2
  61. package/dist/esm/chunk-5NARBZRI.js +2 -0
  62. package/dist/esm/chunk-5NARBZRI.js.map +7 -0
  63. package/dist/esm/{chunk-YEYM7QQZ.js → chunk-ADFUYK3U.js} +2 -2
  64. package/dist/esm/chunk-ADFUYK3U.js.map +7 -0
  65. package/dist/esm/chunk-ALG6R3ZX.js +2 -0
  66. package/dist/esm/chunk-ALG6R3ZX.js.map +7 -0
  67. package/dist/esm/chunk-ARDKQL7Q.js +2 -0
  68. package/dist/esm/chunk-ARDKQL7Q.js.map +7 -0
  69. package/dist/esm/{chunk-66GLO2EG.js → chunk-BBMENJM3.js} +2 -2
  70. package/dist/esm/{chunk-E7LJHM3S.js → chunk-BGVGSALM.js} +2 -2
  71. package/dist/esm/{chunk-E7LJHM3S.js.map → chunk-BGVGSALM.js.map} +2 -2
  72. package/dist/esm/{chunk-T6Z4JUH6.js → chunk-BWVYB64R.js} +2 -2
  73. package/dist/esm/{chunk-UCIIRQUE.js → chunk-BXX2NVQD.js} +3 -3
  74. package/dist/esm/{chunk-UCIIRQUE.js.map → chunk-BXX2NVQD.js.map} +1 -1
  75. package/dist/esm/{chunk-BJ2Q2WVV.js → chunk-EUH5MK4Q.js} +2 -2
  76. package/dist/esm/{chunk-TCEQ5VVE.js → chunk-JGR3L4SN.js} +2 -2
  77. package/dist/esm/chunk-LHGT24A5.js +2 -0
  78. package/dist/esm/chunk-LHGT24A5.js.map +7 -0
  79. package/dist/esm/{chunk-VJXHEDCE.js → chunk-LOLLL7AV.js} +2 -2
  80. package/dist/esm/chunk-P3KYZBOB.js +2 -0
  81. package/dist/esm/chunk-P3KYZBOB.js.map +7 -0
  82. package/dist/esm/{chunk-77TGP2LO.js → chunk-QXEQ2C6A.js} +2 -2
  83. package/dist/esm/{chunk-522UYMDA.js → chunk-TUKX2BRO.js} +2 -2
  84. package/dist/esm/chunk-TUKX2BRO.js.map +7 -0
  85. package/dist/esm/{chunk-BKES3M4Y.js → chunk-UGGAAL4V.js} +2 -2
  86. package/dist/esm/components/_internal/base-button.js +1 -1
  87. package/dist/esm/components/_internal/base-button.props.d.ts +1 -1
  88. package/dist/esm/components/_internal/base-button.props.js +1 -1
  89. package/dist/esm/components/button.d.ts +2 -2
  90. package/dist/esm/components/button.d.ts.map +1 -1
  91. package/dist/esm/components/button.js +1 -1
  92. package/dist/esm/components/button.props.js +1 -1
  93. package/dist/esm/components/chatbar.d.ts +3 -28
  94. package/dist/esm/components/chatbar.d.ts.map +1 -1
  95. package/dist/esm/components/chatbar.js +1 -1
  96. package/dist/esm/components/icon-button.d.ts +2 -1
  97. package/dist/esm/components/icon-button.d.ts.map +1 -1
  98. package/dist/esm/components/icon-button.js +1 -1
  99. package/dist/esm/components/icon-button.props.js +1 -1
  100. package/dist/esm/components/index.js +1 -1
  101. package/dist/esm/components/message-scroller.d.ts +3 -9
  102. package/dist/esm/components/message-scroller.d.ts.map +1 -1
  103. package/dist/esm/components/message-scroller.js +1 -1
  104. package/dist/esm/components/notice.js +1 -1
  105. package/dist/esm/components/schemas/base-button.schema.js +1 -1
  106. package/dist/esm/components/schemas/button.schema.js +1 -1
  107. package/dist/esm/components/schemas/icon-button.schema.js +1 -1
  108. package/dist/esm/components/schemas/index.js +1 -1
  109. package/dist/esm/components/schemas/toggle-button.schema.js +1 -1
  110. package/dist/esm/components/schemas/toggle-icon-button.schema.js +1 -1
  111. package/dist/esm/components/theme-panel.js +1 -1
  112. package/dist/esm/components/toggle-button.d.ts +3 -37
  113. package/dist/esm/components/toggle-button.d.ts.map +1 -1
  114. package/dist/esm/components/toggle-button.js +1 -1
  115. package/dist/esm/components/toggle-icon-button.d.ts +3 -2
  116. package/dist/esm/components/toggle-icon-button.d.ts.map +1 -1
  117. package/dist/esm/components/toggle-icon-button.js +1 -1
  118. package/dist/esm/components/toolbar.d.ts +4 -3
  119. package/dist/esm/components/toolbar.d.ts.map +1 -1
  120. package/dist/esm/components/toolbar.js +1 -1
  121. package/dist/esm/index.js +1 -1
  122. package/dist/esm/props/index.js +1 -1
  123. package/package.json +1 -1
  124. package/schemas/base-button.json +1 -1
  125. package/schemas/button.json +1 -1
  126. package/schemas/icon-button.json +1 -1
  127. package/schemas/index.json +5 -5
  128. package/schemas/toggle-button.json +1 -1
  129. package/schemas/toggle-icon-button.json +1 -1
  130. package/src/components/_internal/base-button.props.ts +3 -3
  131. package/src/components/button.tsx +2 -2
  132. package/src/components/chatbar.tsx +5 -2
  133. package/src/components/icon-button.tsx +2 -1
  134. package/src/components/message-scroller.tsx +5 -3
  135. package/src/components/schemas/base-button.schema.ts +2 -2
  136. package/src/components/sidebar.css +16 -0
  137. package/src/components/toggle-button.tsx +3 -1
  138. package/src/components/toggle-icon-button.tsx +4 -2
  139. package/src/components/toolbar.tsx +6 -3
  140. package/styles.css +12 -0
  141. package/dist/esm/chunk-2D5QJ6MX.js +0 -2
  142. package/dist/esm/chunk-2D5QJ6MX.js.map +0 -7
  143. package/dist/esm/chunk-522UYMDA.js.map +0 -7
  144. package/dist/esm/chunk-DAGHSWME.js +0 -2
  145. package/dist/esm/chunk-DAGHSWME.js.map +0 -7
  146. package/dist/esm/chunk-IICXZUIB.js +0 -2
  147. package/dist/esm/chunk-IICXZUIB.js.map +0 -7
  148. package/dist/esm/chunk-KDYHYQ4D.js +0 -2
  149. package/dist/esm/chunk-KDYHYQ4D.js.map +0 -7
  150. package/dist/esm/chunk-RJTWRLK4.js +0 -2
  151. package/dist/esm/chunk-RJTWRLK4.js.map +0 -7
  152. package/dist/esm/chunk-YEYM7QQZ.js.map +0 -7
  153. /package/dist/esm/{chunk-66GLO2EG.js.map → chunk-BBMENJM3.js.map} +0 -0
  154. /package/dist/esm/{chunk-T6Z4JUH6.js.map → chunk-BWVYB64R.js.map} +0 -0
  155. /package/dist/esm/{chunk-BJ2Q2WVV.js.map → chunk-EUH5MK4Q.js.map} +0 -0
  156. /package/dist/esm/{chunk-TCEQ5VVE.js.map → chunk-JGR3L4SN.js.map} +0 -0
  157. /package/dist/esm/{chunk-VJXHEDCE.js.map → chunk-LOLLL7AV.js.map} +0 -0
  158. /package/dist/esm/{chunk-77TGP2LO.js.map → chunk-QXEQ2C6A.js.map} +0 -0
  159. /package/dist/esm/{chunk-BKES3M4Y.js.map → chunk-UGGAAL4V.js.map} +0 -0
@@ -44,6 +44,7 @@ import { useComposedRefs } from 'radix-ui/internal';
44
44
 
45
45
  import { IconButton, type IconButtonProps } from './icon-button.js';
46
46
  import { useScrollEdges } from '../hooks/use-scroll-edges.js';
47
+ import type { ButtonRankProps } from './button.js';
47
48
 
48
49
  interface RootProps extends React.ComponentPropsWithoutRef<'div'> {
49
50
  /**
@@ -128,7 +129,8 @@ const Item = React.forwardRef<HTMLDivElement, ItemProps>(({ className, ...props
128
129
  ));
129
130
  Item.displayName = 'MessageScroller.Item';
130
131
 
131
- type ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby'> & {
132
+ type ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby' | 'variant' | 'emphasis'> &
133
+ ButtonRankProps & {
132
134
  /** Accessible name, in your words. Default "Jump to the latest". */
133
135
  'aria-label'?: string;
134
136
  /** `end` jumps to the latest message (default); `start` to the first. */
@@ -142,7 +144,7 @@ type ButtonProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby'> & {
142
144
  * Place it inside `Root`, after the viewport. It sits over the viewport's bottom edge.
143
145
  */
144
146
  const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
145
- ({ direction = 'end', behavior, className, children, size = '2', variant = 'surface', color = 'gray', radius = 'full', 'aria-label': label, ...props }, forwardedRef) => (
147
+ ({ direction = 'end', behavior, className, children, size = '2', variant = 'surface', emphasis, color = 'gray', radius = 'full', 'aria-label': label, ...props }, forwardedRef) => (
146
148
  <Primitive.Button
147
149
  direction={direction}
148
150
  {...(behavior ? { behavior } : {})}
@@ -151,7 +153,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
151
153
  {...props}
152
154
  ref={forwardedRef}
153
155
  size={size}
154
- variant={variant}
156
+ {...(emphasis ? { emphasis } : { variant })}
155
157
  color={color}
156
158
  radius={radius}
157
159
  aria-label={label ?? (direction === 'end' ? 'Jump to the latest' : 'Jump to the first')}
@@ -57,11 +57,11 @@ export const BaseButtonSchema = z
57
57
 
58
58
  /**
59
59
  * Visual variant that determines the button's appearance and context
60
- * @default 'raised'
60
+ * @default 'solid'
61
61
  */
62
62
  variant: z
63
63
  .enum(['raised', 'solid', 'soft', 'surface', 'outline', 'ghost', 'override', 'classic'])
64
- .default('raised')
64
+ .default('solid')
65
65
  .describe("Visual variant that determines the button's appearance and context"),
66
66
 
67
67
  /**
@@ -1466,3 +1466,19 @@
1466
1466
  width: var(--content-icon-size-3);
1467
1467
  height: var(--content-icon-size-3);
1468
1468
  }
1469
+
1470
+ /* In a Rail the fill is the icon tile, not the row. Under more contrast the tile goes solid and its icon
1471
+ takes the solid ink, so the icon never sits in solid ink on a pale tile. */
1472
+ @media (prefers-contrast: more) {
1473
+ :where(.rt-ShellRailContent :is(.rt-SidebarMenuButton[data-active], .rt-SidebarMenuButton[data-highlighted]:not([data-disabled]))) .rt-SidebarMenuIconWrapper {
1474
+ background-color: var(--accent-solid);
1475
+ color: var(--accent-solid-contrast);
1476
+ }
1477
+ }
1478
+
1479
+ @media (prefers-contrast: more) and (hover: hover) {
1480
+ :where(.rt-ShellRailContent .rt-SidebarMenuButton:hover:not([data-disabled])) .rt-SidebarMenuIconWrapper {
1481
+ background-color: var(--accent-solid);
1482
+ color: var(--accent-solid-contrast);
1483
+ }
1484
+ }
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { Toggle } from 'radix-ui';
3
3
  import { Button } from './button.js';
4
4
  import { useToggleState } from '../hooks/use-toggle-state.js';
5
+ import type { ButtonProps, ButtonRankProps } from './button.js';
5
6
 
6
7
  /**
7
8
  * ToggleButton props that extend Button with toggle-specific functionality
@@ -9,7 +10,8 @@ import { useToggleState } from '../hooks/use-toggle-state.js';
9
10
  * The ToggleButton component provides a button that can be pressed/unpressed
10
11
  * with proper accessibility announcements and state management.
11
12
  */
12
- type ToggleButtonProps = React.ComponentPropsWithoutRef<typeof Button> & {
13
+ type ToggleButtonProps = Omit<ButtonProps<'button'>, 'as' | 'variant' | 'emphasis'> &
14
+ ButtonRankProps & {
13
15
  /** Controlled pressed state */
14
16
  pressed?: boolean;
15
17
  /** Callback when pressed state changes */
@@ -3,6 +3,7 @@ import { Toggle } from 'radix-ui';
3
3
  import { ToggleButton } from './toggle-button.js';
4
4
  import { BaseButton } from './_internal/base-button.js';
5
5
  import type { IconButtonProps } from './icon-button.js';
6
+ import type { ButtonRankProps } from './button.js';
6
7
 
7
8
  type ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;
8
9
 
@@ -30,14 +31,15 @@ type AccessibilityProps =
30
31
  * Combine IconButton props with Toggle-specific props
31
32
  * Includes tooltip props from IconButton for comprehensive functionality
32
33
  */
33
- interface ToggleIconButtonProps extends Omit<IconButtonProps, 'as'> {
34
+ type ToggleIconButtonProps = Omit<IconButtonProps, 'as' | 'variant' | 'emphasis'> &
35
+ ButtonRankProps & {
34
36
  /** Controlled pressed state */
35
37
  pressed?: ToggleProps['pressed'];
36
38
  /** Callback when pressed state changes */
37
39
  onPressedChange?: ToggleProps['onPressedChange'];
38
40
  /** Default pressed state for uncontrolled usage */
39
41
  defaultPressed?: ToggleProps['defaultPressed'];
40
- }
42
+ };
41
43
 
42
44
  /**
43
45
  * Intersection with accessibility props to ensure compliance
@@ -16,6 +16,7 @@ import type { TextProps } from './text.js';
16
16
  import type { MarginProps } from '../props/margin.props.js';
17
17
  import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
18
18
  import type { GetPropDefTypes } from '../props/prop-def.js';
19
+ import type { ButtonRankProps } from './button.js';
19
20
 
20
21
  /*
21
22
  * Toolbar takes Kookie UI v2's contract (v2: components/toolbar), built on Radix instead of
@@ -143,15 +144,17 @@ ToolbarGroup.displayName = 'Toolbar.Group';
143
144
  // ToolbarButton
144
145
  // ============================================================================
145
146
 
146
- type ToolbarButtonBaseProps = Omit<ButtonProps, 'as' | 'asChild'>;
147
+ type ToolbarButtonBaseProps = Omit<ButtonProps, 'as' | 'asChild' | 'variant' | 'emphasis'>;
147
148
 
148
149
  /** A labelled button: takes every `Button` prop. */
149
- type ToolbarTextButtonProps = ToolbarButtonBaseProps & {
150
+ type ToolbarTextButtonProps = ToolbarButtonBaseProps &
151
+ ButtonRankProps & {
150
152
  iconOnly?: false;
151
153
  };
152
154
 
153
155
  /** An icon-only button: renders an `IconButton`, and the type requires an `aria-label`. */
154
- type ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-labelledby' | 'overrideStyles'> & {
156
+ type ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-labelledby' | 'overrideStyles'> &
157
+ ButtonRankProps & {
155
158
  iconOnly: true;
156
159
  /** The control's accessible name. An icon has no words of its own, so this is required. */
157
160
  'aria-label': string;
package/styles.css CHANGED
@@ -23894,6 +23894,18 @@
23894
23894
  width: var(--content-icon-size-3);
23895
23895
  height: var(--content-icon-size-3);
23896
23896
  }
23897
+ @media (prefers-contrast: more) {
23898
+ :where(.rt-ShellRailContent :is(.rt-SidebarMenuButton[data-active], .rt-SidebarMenuButton[data-highlighted]:not([data-disabled]))) .rt-SidebarMenuIconWrapper {
23899
+ background-color: var(--accent-solid);
23900
+ color: var(--accent-solid-contrast);
23901
+ }
23902
+ }
23903
+ @media (prefers-contrast: more) and (hover: hover) {
23904
+ :where(.rt-ShellRailContent .rt-SidebarMenuButton:hover:not([data-disabled])) .rt-SidebarMenuIconWrapper {
23905
+ background-color: var(--accent-solid);
23906
+ color: var(--accent-solid-contrast);
23907
+ }
23908
+ }
23897
23909
  .rt-ShellRoot {
23898
23910
  --shell-inset-gap: var(--space-2);
23899
23911
  --shell-rail-offset: 0px;
@@ -1,2 +0,0 @@
1
- import{z as e}from"zod";var t=e.object({as:e.string().optional().describe("HTML element type to render as"),asChild:e.boolean().optional().describe("Merge props with child element instead of rendering wrapper"),size:e.union([e.enum(["1","2","3","4"]),e.object({initial:e.enum(["1","2","3","4"]).optional(),sm:e.enum(["1","2","3","4"]).optional(),md:e.enum(["1","2","3","4"]).optional(),lg:e.enum(["1","2","3","4"]).optional(),xl:e.enum(["1","2","3","4"]).optional()})]).default("2").describe("Button size for responsive design and interface density"),variant:e.enum(["raised","solid","soft","surface","outline","ghost","override","classic"]).default("raised").describe("Visual variant that determines the button's appearance and context"),color:e.enum(["tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","brown","orange","sky","mint","lime","yellow","amber","gold","bronze","gray"]).optional().describe("Accent color for the button"),radius:e.enum(["none","small","medium","large","full"]).optional().describe("Border radius for the button"),loading:e.boolean().optional().default(!1).describe("Loading state that shows a spinner and disables interaction"),fullWidth:e.boolean().optional().default(!1).describe("Full width mode that expands the button to fill its container"),material:e.enum(["solid","translucent"]).optional().describe("Material type for visual rendering and depth effects"),panelBackground:e.enum(["solid","translucent"]).optional().describe("Panel background type (deprecated - use material instead)"),flush:e.boolean().optional().default(!1).describe("Flush mode that removes visual padding for seamless text integration"),disabled:e.boolean().optional().default(!1).describe("Disabled state"),type:e.enum(["button","submit","reset"]).optional().describe("Type attribute for form buttons"),className:e.string().optional().describe("Additional CSS class name"),style:e.record(e.string(),e.union([e.string(),e.number()])).optional().describe("Inline styles"),onClick:e.function().optional().describe("Click handler"),onFocus:e.function().optional().describe("Focus handler"),onBlur:e.function().optional().describe("Blur handler"),onMouseEnter:e.function().optional().describe("Mouse enter handler"),onMouseLeave:e.function().optional().describe("Mouse leave handler"),onKeyDown:e.function().optional().describe("Key down handler"),onKeyUp:e.function().optional().describe("Key up handler"),onSubmit:e.function().optional().describe("Form submission handler"),tabIndex:e.number().optional().describe("Tab index for keyboard navigation"),"aria-label":e.string().optional().describe("ARIA label for accessibility"),"aria-labelledby":e.string().optional().describe("ARIA labelled by reference"),"aria-describedby":e.string().optional().describe("ARIA described by reference"),"aria-expanded":e.boolean().optional().describe("ARIA expanded state"),"aria-pressed":e.boolean().optional().describe("ARIA pressed state"),"aria-current":e.union([e.boolean(),e.enum(["page","step","location","date","time"])]).optional().describe("ARIA current state"),"aria-controls":e.string().optional().describe("ARIA controls reference"),"aria-owns":e.string().optional().describe("ARIA owns reference"),"data-*":e.record(e.string(),e.string()).optional().describe("Data attributes"),id:e.string().optional().describe("ID attribute"),title:e.string().optional().describe("Title attribute for tooltip"),role:e.string().optional().describe("Role attribute"),children:e.any().optional().describe("Children elements")}).strict();function i(n){return n}export{t as a,i as b};
2
- //# sourceMappingURL=chunk-2D5QJ6MX.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/schemas/base-button.schema.ts"],
4
- "sourcesContent": ["import { z } from 'zod';\n\n/**\n * BaseButton Zod schema - Single source of truth for all button component props\n *\n * This schema defines the core button functionality used by Button, IconButton,\n * ToggleButton, and ToggleIconButton components. It ensures consistency across\n * the design system and provides machine-readable validation.\n *\n * @example\n * ```tsx\n * // Basic validation\n * const props = BaseButtonSchema.parse({ size: '2', variant: 'solid' });\n *\n * // With responsive props\n * const responsiveProps = BaseButtonSchema.parse({\n * size: { initial: '1', sm: '2', md: '3' },\n * variant: 'solid'\n * });\n * ```\n */\nexport const BaseButtonSchema = z\n .object({\n /**\n * Polymorphic rendering - render as different HTML elements\n * @default 'button'\n */\n as: z.string().optional().describe('HTML element type to render as'),\n\n /**\n * Use asChild to merge props with child element\n * @default false\n */\n asChild: z\n .boolean()\n .optional()\n .describe('Merge props with child element instead of rendering wrapper'),\n\n /**\n * Button size for responsive design and interface density\n * Supports responsive objects: { initial: '1', sm: '2', md: '3', lg: '4' }\n * @default '2'\n */\n size: z\n .union([\n z.enum(['1', '2', '3', '4']),\n z.object({\n initial: z.enum(['1', '2', '3', '4']).optional(),\n sm: z.enum(['1', '2', '3', '4']).optional(),\n md: z.enum(['1', '2', '3', '4']).optional(),\n lg: z.enum(['1', '2', '3', '4']).optional(),\n xl: z.enum(['1', '2', '3', '4']).optional(),\n }),\n ])\n .default('2')\n .describe('Button size for responsive design and interface density'),\n\n /**\n * Visual variant that determines the button's appearance and context\n * @default 'raised'\n */\n variant: z\n .enum(['raised', 'solid', 'soft', 'surface', 'outline', 'ghost', 'override', 'classic'])\n .default('raised')\n .describe(\"Visual variant that determines the button's appearance and context\"),\n\n /**\n * Accent color for the button\n */\n color: z\n .enum([\n 'tomato',\n 'red',\n 'ruby',\n 'crimson',\n 'pink',\n 'plum',\n 'purple',\n 'violet',\n 'iris',\n 'indigo',\n 'blue',\n 'cyan',\n 'teal',\n 'jade',\n 'green',\n 'grass',\n 'brown',\n 'orange',\n 'sky',\n 'mint',\n 'lime',\n 'yellow',\n 'amber',\n 'gold',\n 'bronze',\n 'gray',\n ])\n .optional()\n .describe('Accent color for the button'),\n\n /**\n * Border radius for the button\n */\n radius: z\n .enum(['none', 'small', 'medium', 'large', 'full'])\n .optional()\n .describe('Border radius for the button'),\n\n /**\n * Loading state that shows a spinner and disables interaction\n * Automatically sets disabled=true and provides accessibility announcements\n * @default false\n */\n loading: z\n .boolean()\n .optional()\n .default(false)\n .describe('Loading state that shows a spinner and disables interaction'),\n\n /**\n * Full width mode that expands the button to fill its container\n * Useful for mobile layouts and form submissions\n * @default false\n */\n fullWidth: z\n .boolean()\n .optional()\n .default(false)\n .describe('Full width mode that expands the button to fill its container'),\n\n /**\n * Material type for visual rendering and depth effects\n * Controls how the button renders its visual elements\n */\n material: z\n .enum(['solid', 'translucent'])\n .optional()\n .describe('Material type for visual rendering and depth effects'),\n\n /**\n * Panel background type (deprecated)\n * @deprecated Use `material` prop instead. This prop will be removed in a future version.\n */\n panelBackground: z\n .enum(['solid', 'translucent'])\n .optional()\n .describe('Panel background type (deprecated - use material instead)'),\n\n /**\n * Flush mode that removes visual padding for seamless text integration\n * Only effective with ghost variant\n * @default false\n */\n flush: z\n .boolean()\n .optional()\n .default(false)\n .describe('Flush mode that removes visual padding for seamless text integration'),\n\n /**\n * Disabled state\n * @default false\n */\n disabled: z.boolean().optional().default(false).describe('Disabled state'),\n\n /**\n * Type attribute for form buttons\n * @default 'button'\n */\n type: z\n .enum(['button', 'submit', 'reset'])\n .optional()\n .describe('Type attribute for form buttons'),\n\n /**\n * Additional CSS class name\n */\n className: z.string().optional().describe('Additional CSS class name'),\n\n /**\n * Inline styles\n */\n style: z\n .record(z.string(), z.union([z.string(), z.number()]))\n .optional()\n .describe('Inline styles'),\n\n /**\n * Click handler\n */\n onClick: z.function().optional().describe('Click handler'),\n\n /**\n * Focus handler\n */\n onFocus: z.function().optional().describe('Focus handler'),\n\n /**\n * Blur handler\n */\n onBlur: z.function().optional().describe('Blur handler'),\n\n /**\n * Mouse enter handler\n */\n onMouseEnter: z.function().optional().describe('Mouse enter handler'),\n\n /**\n * Mouse leave handler\n */\n onMouseLeave: z.function().optional().describe('Mouse leave handler'),\n\n /**\n * Key down handler\n */\n onKeyDown: z.function().optional().describe('Key down handler'),\n\n /**\n * Key up handler\n */\n onKeyUp: z.function().optional().describe('Key up handler'),\n\n /**\n * Form submission handler\n */\n onSubmit: z.function().optional().describe('Form submission handler'),\n\n /**\n * Tab index for keyboard navigation\n */\n tabIndex: z.number().optional().describe('Tab index for keyboard navigation'),\n\n /**\n * ARIA label for accessibility\n */\n 'aria-label': z.string().optional().describe('ARIA label for accessibility'),\n\n /**\n * ARIA labelled by reference\n */\n 'aria-labelledby': z.string().optional().describe('ARIA labelled by reference'),\n\n /**\n * ARIA described by reference\n */\n 'aria-describedby': z.string().optional().describe('ARIA described by reference'),\n\n /**\n * ARIA expanded state\n */\n 'aria-expanded': z.boolean().optional().describe('ARIA expanded state'),\n\n /**\n * ARIA pressed state\n */\n 'aria-pressed': z.boolean().optional().describe('ARIA pressed state'),\n\n /**\n * ARIA current state\n */\n 'aria-current': z\n .union([z.boolean(), z.enum(['page', 'step', 'location', 'date', 'time'])])\n .optional()\n .describe('ARIA current state'),\n\n /**\n * ARIA controls reference\n */\n 'aria-controls': z.string().optional().describe('ARIA controls reference'),\n\n /**\n * ARIA owns reference\n */\n 'aria-owns': z.string().optional().describe('ARIA owns reference'),\n\n /**\n * Data attributes\n */\n 'data-*': z.record(z.string(), z.string()).optional().describe('Data attributes'),\n\n /**\n * ID attribute\n */\n id: z.string().optional().describe('ID attribute'),\n\n /**\n * Title attribute for tooltip\n */\n title: z.string().optional().describe('Title attribute for tooltip'),\n\n /**\n * Role attribute\n */\n role: z.string().optional().describe('Role attribute'),\n\n /**\n * Children elements\n */\n children: z.any().optional().describe('Children elements'),\n })\n .strict();\n\n/**\n * Type derived from BaseButton Zod schema\n * This ensures type safety and consistency with the schema\n */\nexport type BaseButtonProps = z.infer<typeof BaseButtonSchema>;\n\n/**\n * Development-only helper to validate and normalize props\n * This function should only be used in development mode\n *\n * @param props - Props to validate and normalize\n * @returns Validated and normalized props\n *\n * @example\n * ```tsx\n * // In development, this will validate props and show helpful errors\n * const validatedProps = parseBaseButtonProps({ size: 'invalid', variant: 'solid' });\n * // Throws: \"Invalid enum value. Expected '1' | '2' | '3' | '4', received 'invalid'\"\n * ```\n */\nexport function parseBaseButtonProps(props: unknown): BaseButtonProps {\n if (process.env.NODE_ENV === 'development') {\n return BaseButtonSchema.parse(props);\n }\n return props as BaseButtonProps;\n}\n"],
5
- "mappings": "AAAA,OAAS,KAAAA,MAAS,MAqBX,IAAMC,EAAmBD,EAC7B,OAAO,CAKN,GAAIA,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,gCAAgC,EAMnE,QAASA,EACN,QAAQ,EACR,SAAS,EACT,SAAS,6DAA6D,EAOzE,KAAMA,EACH,MAAM,CACLA,EAAE,KAAK,CAAC,IAAK,IAAK,IAAK,GAAG,CAAC,EAC3BA,EAAE,OAAO,CACP,QAASA,EAAE,KAAK,CAAC,IAAK,IAAK,IAAK,GAAG,CAAC,EAAE,SAAS,EAC/C,GAAIA,EAAE,KAAK,CAAC,IAAK,IAAK,IAAK,GAAG,CAAC,EAAE,SAAS,EAC1C,GAAIA,EAAE,KAAK,CAAC,IAAK,IAAK,IAAK,GAAG,CAAC,EAAE,SAAS,EAC1C,GAAIA,EAAE,KAAK,CAAC,IAAK,IAAK,IAAK,GAAG,CAAC,EAAE,SAAS,EAC1C,GAAIA,EAAE,KAAK,CAAC,IAAK,IAAK,IAAK,GAAG,CAAC,EAAE,SAAS,CAC5C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AAS,EAAE,SAAS,cAAc,EAKjD,MAAOA,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,6BAA6B,EAKnE,KAAMA,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,gBAAgB,EAKrD,SAAUA,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,mBAAmB,CAC3D,CAAC,EACA,OAAO,EAsBH,SAASE,EAAqBC,EAAiC,CAIpE,OAAOA,CACT",
6
- "names": ["z", "BaseButtonSchema", "parseBaseButtonProps", "props"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/toolbar.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Toolbar as ToolbarPrimitive } from 'radix-ui';\n\nimport { toolbarRootPropDefs } from './toolbar.props.js';\nimport { Button } from './button.js';\nimport { IconButton } from './icon-button.js';\nimport { Text } from './text.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { marginPropDefs } from '../props/margin.props.js';\n\nimport type { ButtonProps } from './button.js';\nimport type { TextProps } from './text.js';\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\n/*\n * Toolbar takes Kookie UI v2's contract (v2: components/toolbar), built on Radix instead of\n * Base UI. A toolbar is a row of controls with ONE tab stop: `role=\"toolbar\"`, and the arrow\n * keys move focus between its controls. That keyboard is the reason it is a component.\n *\n * Its `size` reaches every control inside it that does not state its own. The row itself paints\n * nothing; a `ToolbarGroup` draws a quiet well around controls that belong together, and a\n * `ToolbarSeparator` draws a gray hairline between clusters. Use a `Flex` to cluster controls\n * without a well: the row spaces the clusters with `space-between`.\n *\n * The band anchored to a pane's edge (Left / Center / Right / Title) that this name used to\n * mean is `AppBar` since 0.11.0.\n */\n\ntype ToolbarSize = NonNullable<GetPropDefTypes<typeof toolbarRootPropDefs>['size']>;\ntype ToolbarOrientation = NonNullable<GetPropDefTypes<typeof toolbarRootPropDefs>['orientation']>;\n\ninterface ToolbarContextValue {\n size: ToolbarSize;\n orientation: ToolbarOrientation;\n}\n\nconst ToolbarContext = React.createContext<ToolbarContextValue | null>(null);\n\n/** Set by a `ToolbarGroup`: its children rest quiet, and `disabled` turns them all off. */\nconst ToolbarGroupContext = React.createContext<{ disabled: boolean } | null>(null);\n\nfunction useToolbarContext(consumer: string): ToolbarContextValue {\n const context = React.useContext(ToolbarContext);\n if (!context) {\n throw new Error(`${consumer} must be rendered inside a Toolbar.`);\n }\n return context;\n}\n\n// ============================================================================\n// Toolbar (root)\n// ============================================================================\n\ntype ToolbarOwnProps = GetPropDefTypes<typeof toolbarRootPropDefs>;\n\ninterface ToolbarProps\n extends ComponentPropsWithout<typeof ToolbarPrimitive.Root, RemovedProps | 'orientation'>,\n ToolbarOwnProps,\n MarginProps {}\n\n/**\n * A row of controls with one keyboard tab stop. The arrow keys move focus between the controls.\n *\n * Give it an `aria-label` (or `aria-labelledby`) that says what the controls act on.\n *\n * @example\n * ```tsx\n * <Toolbar aria-label=\"Formatting\">\n * <ToolbarGroup>\n * <ToolbarButton iconOnly aria-label=\"Bold\" aria-pressed={bold} onClick={toggleBold}>\n * <HugeiconsIcon icon={TextBoldIcon} strokeWidth={1.75} />\n * </ToolbarButton>\n * </ToolbarGroup>\n * <ToolbarSeparator />\n * <ToolbarButton>Share</ToolbarButton>\n * </Toolbar>\n * ```\n */\nconst ToolbarRoot = React.forwardRef<HTMLDivElement, ToolbarProps>((props, forwardedRef) => {\n const size: ToolbarSize = props.size ?? toolbarRootPropDefs.size.default;\n const orientation: ToolbarOrientation = props.orientation ?? toolbarRootPropDefs.orientation.default;\n const { className, orientation: _orientation, children, ...rootProps } = extractProps(\n props,\n toolbarRootPropDefs,\n marginPropDefs,\n );\n\n const context = React.useMemo(() => ({ size, orientation }), [size, orientation]);\n\n return (\n <ToolbarPrimitive.Root\n {...rootProps}\n ref={forwardedRef}\n orientation={orientation}\n className={classNames('rt-Toolbar', className)}\n >\n <ToolbarContext.Provider value={context}>{children}</ToolbarContext.Provider>\n </ToolbarPrimitive.Root>\n );\n});\nToolbarRoot.displayName = 'Toolbar';\n\n// ============================================================================\n// ToolbarGroup\n// ============================================================================\n\ninterface ToolbarGroupProps extends ComponentPropsWithout<'div', RemovedProps> {\n /** Turns every control in the group off at once. */\n disabled?: boolean;\n}\n\n/**\n * Controls that belong together, drawn as one quiet well that stands level with a button\n * beside it. Buttons inside it rest as `ghost` unless they state a `variant`.\n * To cluster controls without a well, use a `Flex`.\n */\nconst ToolbarGroup = React.forwardRef<HTMLDivElement, ToolbarGroupProps>(\n ({ className, disabled = false, children, ...props }, forwardedRef) => {\n const { orientation } = useToolbarContext('ToolbarGroup');\n const group = React.useMemo(() => ({ disabled }), [disabled]);\n return (\n <div\n role=\"group\"\n data-orientation={orientation}\n data-disabled={disabled || undefined}\n {...props}\n ref={forwardedRef}\n className={classNames('rt-ToolbarGroup', className)}\n >\n <ToolbarGroupContext.Provider value={group}>{children}</ToolbarGroupContext.Provider>\n </div>\n );\n },\n);\nToolbarGroup.displayName = 'Toolbar.Group';\n\n// ============================================================================\n// ToolbarButton\n// ============================================================================\n\ntype ToolbarButtonBaseProps = Omit<ButtonProps, 'as' | 'asChild'>;\n\n/** A labelled button: takes every `Button` prop. */\ntype ToolbarTextButtonProps = ToolbarButtonBaseProps & {\n iconOnly?: false;\n};\n\n/** An icon-only button: renders an `IconButton`, and the type requires an `aria-label`. */\ntype ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-labelledby' | 'overrideStyles'> & {\n iconOnly: true;\n /** The control's accessible name. An icon has no words of its own, so this is required. */\n 'aria-label': string;\n};\n\ntype ToolbarButtonProps = ToolbarTextButtonProps | ToolbarIconButtonProps;\n\nfunction isPressed(value: React.AriaAttributes['aria-pressed']) {\n return value === true || value === 'true';\n}\n\n/**\n * A `Button` that joins the toolbar's keyboard navigation, so a row of them is one tab stop.\n *\n * Set `iconOnly` (with an `aria-label`) for a symbol-only control. Set `aria-pressed` for a\n * control that toggles; a pressed button wears Button's pressed look.\n *\n * It takes the toolbar's `size`, and rests as a gray `soft` button (gray `ghost` inside a\n * `ToolbarGroup`). A stated `size`, `variant` or `color` wins; a stated `variant` without a\n * `color` takes Button's own default colour. It throws outside a `Toolbar`.\n */\nconst ToolbarButton = React.forwardRef<HTMLButtonElement, ToolbarButtonProps>((props, forwardedRef) => {\n const toolbar = useToolbarContext('ToolbarButton');\n const group = React.useContext(ToolbarGroupContext);\n const { iconOnly, size, variant, emphasis, color, disabled, ...rest } = props;\n\n const pressed = isPressed(props['aria-pressed']);\n const stateProps =\n 'data-state' in props || props['aria-pressed'] === undefined ? {} : { 'data-state': pressed ? 'on' : 'off' };\n\n const shared = {\n size: size ?? toolbar.size,\n // A caller states the look by `variant` or the rank by `emphasis`, never both.\n ...(emphasis !== undefined ? { emphasis } : { variant: variant ?? (group ? 'ghost' : 'soft') }),\n // The gray rest is a pair with the default variant: a caller who states a variant or an\n // emphasis gets Button's own colour for it unless they state a colour too.\n color: color ?? (variant || emphasis ? undefined : 'gray'),\n ...stateProps,\n } as const;\n\n return (\n <ToolbarPrimitive.Button asChild ref={forwardedRef} disabled={disabled || group?.disabled || undefined}>\n {iconOnly ? (\n <IconButton {...(rest as Omit<ToolbarIconButtonProps, 'iconOnly' | 'variant' | 'emphasis'>)} {...shared} />\n ) : (\n <Button {...(rest as Omit<ToolbarTextButtonProps, 'iconOnly' | 'variant' | 'emphasis'>)} {...shared} />\n )}\n </ToolbarPrimitive.Button>\n );\n});\nToolbarButton.displayName = 'Toolbar.Button';\n\n// ============================================================================\n// ToolbarSeparator\n// ============================================================================\n\ntype ToolbarSeparatorProps = ComponentPropsWithout<typeof ToolbarPrimitive.Separator, RemovedProps | 'orientation'>;\n\n/**\n * A gray hairline between two clusters, announced as a separator. Its direction is always\n * opposite to the toolbar's.\n */\nconst ToolbarSeparator = React.forwardRef<HTMLDivElement, ToolbarSeparatorProps>(\n ({ className, ...props }, forwardedRef) => {\n useToolbarContext('ToolbarSeparator');\n return (\n <ToolbarPrimitive.Separator\n {...props}\n ref={forwardedRef}\n className={classNames('rt-ToolbarSeparator', className)}\n />\n );\n },\n);\nToolbarSeparator.displayName = 'Toolbar.Separator';\n\n// ============================================================================\n// ToolbarTitle\n// ============================================================================\n\n/** The title's text step: one step above the label of a button at the same size. */\nconst TITLE_SIZE = { '1': '2', '2': '3', '3': '4', '4': '5' } as const satisfies Record<ToolbarSize, TextProps['size']>;\n\ninterface ToolbarTitleProps {\n /** The title text. With none, the title renders nothing. */\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n /** The id of the title, so that the toolbar's `aria-labelledby` can point at it. */\n id?: string;\n}\n\n/**\n * What the row is about, at its leading edge. One line: it truncates rather than wrapping.\n * Its text step follows the toolbar's `size`, and it takes more air from the controls beside it\n * than they take from each other.\n */\nconst ToolbarTitle = React.forwardRef<HTMLSpanElement, ToolbarTitleProps>(\n ({ className, children, style, id }, forwardedRef) => {\n const { size } = useToolbarContext('ToolbarTitle');\n if (children === undefined || children === null || children === false) return null;\n return (\n <Text\n ref={forwardedRef}\n as=\"span\"\n size={TITLE_SIZE[size]}\n weight=\"medium\"\n truncate\n id={id}\n style={style}\n className={classNames('rt-ToolbarTitle', className)}\n >\n {children}\n </Text>\n );\n },\n);\nToolbarTitle.displayName = 'Toolbar.Title';\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst Toolbar = Object.assign(ToolbarRoot, {\n Root: ToolbarRoot,\n Group: ToolbarGroup,\n Button: ToolbarButton,\n Separator: ToolbarSeparator,\n Title: ToolbarTitle,\n});\n\nexport {\n Toolbar,\n ToolbarGroup,\n ToolbarButton,\n ToolbarSeparator,\n ToolbarTitle,\n ToolbarRoot as Root,\n ToolbarGroup as Group,\n ToolbarButton as Button,\n ToolbarSeparator as Separator,\n ToolbarTitle as Title,\n};\nexport type {\n ToolbarProps,\n ToolbarGroupProps,\n ToolbarButtonProps,\n ToolbarSeparatorProps,\n ToolbarTitleProps,\n ToolbarProps as RootProps,\n ToolbarGroupProps as GroupProps,\n ToolbarButtonProps as ButtonProps,\n ToolbarSeparatorProps as SeparatorProps,\n ToolbarTitleProps as TitleProps,\n};\n"],
5
- "mappings": "gPAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,WAAWC,MAAwB,WAqC5C,IAAMC,EAAuB,gBAA0C,IAAI,EAGrEC,EAA4B,gBAA4C,IAAI,EAElF,SAASC,EAAkBC,EAAuC,CAChE,IAAMC,EAAgB,aAAWJ,CAAc,EAC/C,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,GAAGD,CAAQ,qCAAqC,EAElE,OAAOC,CACT,CA+BA,IAAMC,EAAoB,aAAyC,CAACC,EAAOC,IAAiB,CAC1F,IAAMC,EAAoBF,EAAM,MAAQG,EAAoB,KAAK,QAC3DC,EAAkCJ,EAAM,aAAeG,EAAoB,YAAY,QACvF,CAAE,UAAAE,EAAW,YAAaC,EAAc,SAAAC,EAAU,GAAGC,CAAU,EAAIC,EACvET,EACAG,EACAO,CACF,EAEMZ,EAAgB,UAAQ,KAAO,CAAE,KAAAI,EAAM,YAAAE,CAAY,GAAI,CAACF,EAAME,CAAW,CAAC,EAEhF,OACE,gBAACO,EAAiB,KAAjB,CACE,GAAGH,EACJ,IAAKP,EACL,YAAaG,EACb,UAAWQ,EAAW,aAAcP,CAAS,GAE7C,gBAACX,EAAe,SAAf,CAAwB,MAAOI,GAAUS,CAAS,CACrD,CAEJ,CAAC,EACDR,EAAY,YAAc,UAgB1B,IAAMc,EAAqB,aACzB,CAAC,CAAE,UAAAR,EAAW,SAAAS,EAAW,GAAO,SAAAP,EAAU,GAAGP,CAAM,EAAGC,IAAiB,CACrE,GAAM,CAAE,YAAAG,CAAY,EAAIR,EAAkB,cAAc,EAClDmB,EAAc,UAAQ,KAAO,CAAE,SAAAD,CAAS,GAAI,CAACA,CAAQ,CAAC,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jB,CACE,GAAGX,EACJ,IAAKC,EACL,UAAWW,EAAW,sBAAuBP,CAAS,EACxD,EAGN,EACAyB,EAAiB,YAAc,oBAO/B,IAAMC,EAAa,CAAE,EAAK,IAAK,EAAK,IAAK,EAAK,IAAK,EAAK,GAAI,EAgBtDC,EAAqB,aACzB,CAAC,CAAE,UAAA3B,EAAW,SAAAE,EAAU,MAAA0B,EAAO,GAAAC,CAAG,EAAGjC,IAAiB,CACpD,GAAM,CAAE,KAAAC,CAAK,EAAIN,EAAkB,cAAc,EACjD,OAA8BW,GAAa,MAAQA,IAAa,GAAc,KAE5E,gBAAC4B,EAAA,CACC,IAAKlC,EACL,GAAG,OACH,KAAM8B,EAAW7B,CAAI,EACrB,OAAO,SACP,SAAQ,GACR,GAAIgC,EACJ,MAAOD,EACP,UAAWrB,EAAW,kBAAmBP,CAAS,GAEjDE,CACH,CAEJ,CACF,EACAyB,EAAa,YAAc,gBAM3B,IAAMI,EAAU,OAAO,OAAOrC,EAAa,CACzC,KAAMA,EACN,MAAOc,EACP,OAAQK,EACR,UAAWY,EACX,MAAOE,CACT,CAAC",
6
- "names": ["React", "classNames", "ToolbarPrimitive", "ToolbarContext", "ToolbarGroupContext", "useToolbarContext", "consumer", "context", "ToolbarRoot", "props", "forwardedRef", "size", "toolbarRootPropDefs", "orientation", "className", "_orientation", "children", "rootProps", "extractProps", "marginPropDefs", "ToolbarPrimitive", "classNames", "ToolbarGroup", "disabled", "group", "isPressed", "value", "ToolbarButton", "toolbar", "iconOnly", "variant", "emphasis", "color", "rest", "pressed", "stateProps", "shared", "IconButton", "Button", "ToolbarSeparator", "TITLE_SIZE", "ToolbarTitle", "style", "id", "Text", "Toolbar"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as o}from"./chunk-KDYHYQ4D.js";import*as e from"react";import"radix-ui";var r=e.forwardRef((t,n)=>e.createElement(o,{...t,iconOnly:!0,ref:n}));r.displayName="ToggleIconButton";export{r as a};
2
- //# sourceMappingURL=chunk-DAGHSWME.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/toggle-icon-button.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { ToggleButton } from './toggle-button.js';\nimport { BaseButton } from './_internal/base-button.js';\nimport type { IconButtonProps } from './icon-button.js';\n\ntype ToggleIconButtonElement = React.ElementRef<typeof BaseButton>;\n\n/**\n * Extract toggle-specific props from Radix Toggle\n * These props control the toggle state and behavior\n */\ntype ToggleProps = React.ComponentPropsWithoutRef<typeof Toggle.Root>;\n\n/**\n * Required accessibility props for icon buttons (same as IconButton)\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 * Combine IconButton props with Toggle-specific props\n * Includes tooltip props from IconButton for comprehensive functionality\n */\ninterface ToggleIconButtonProps extends Omit<IconButtonProps, 'as'> {\n /** Controlled pressed state */\n pressed?: ToggleProps['pressed'];\n /** Callback when pressed state changes */\n onPressedChange?: ToggleProps['onPressedChange'];\n /** Default pressed state for uncontrolled usage */\n defaultPressed?: ToggleProps['defaultPressed'];\n}\n\n/**\n * Intersection with accessibility props to ensure compliance\n * This type ensures all ToggleIconButton instances have proper accessibility\n */\ntype ToggleIconButtonPropsWithAccessibility = ToggleIconButtonProps & AccessibilityProps;\n\n/**\n * ToggleIconButton component for icon buttons that can be pressed/unpressed. It is\n * `ToggleButton` with `iconOnly` set, kept as its own name for its stricter type.\n *\n * The ToggleIconButton component extends IconButton with toggle functionality\n * using Radix UI's Toggle primitive. It provides proper accessibility announcements,\n * controlled/uncontrolled state management, and seamless integration with\n * the existing IconButton component.\n *\n * Key features:\n * - Controlled and uncontrolled state management\n * - Live accessibility announcements for screen readers\n * - Enforced accessibility requirements (aria-label, aria-labelledby, or children)\n * - Automatic state validation and warnings\n * - Seamless integration with IconButton props and styling\n * - Proper ARIA attributes for toggle functionality\n * - Built-in tooltip support from IconButton\n *\n * @example\n * ```tsx\n * // Uncontrolled toggle icon button\n * <ToggleIconButton defaultPressed={false} aria-label=\"Toggle notifications\">\n * <Bell />\n * </ToggleIconButton>\n *\n * // Controlled toggle icon button\n * const [pressed, setPressed] = React.useState(false);\n * <ToggleIconButton\n * pressed={pressed}\n * onPressedChange={setPressed}\n * aria-label=\"Toggle notifications\"\n * >\n * <Bell />\n * </ToggleIconButton>\n *\n * // Toggle icon button with tooltip\n * <ToggleIconButton\n * variant=\"solid\"\n * size=\"3\"\n * color=\"blue\"\n * pressed={isActive}\n * onPressedChange={setIsActive}\n * aria-label=\"Toggle feature\"\n * tooltip=\"Toggle this feature on/off\"\n * >\n * <Star />\n * </ToggleIconButton>\n *\n * // Toggle icon button with aria-labelledby\n * <ToggleIconButton\n * aria-labelledby=\"notifications-label\"\n * pressed={notificationsEnabled}\n * onPressedChange={setNotificationsEnabled}\n * >\n * <Bell />\n * </ToggleIconButton>\n * <span id=\"notifications-label\">Toggle notifications</span>\n * ```\n */\nconst ToggleIconButton = React.forwardRef<ToggleIconButtonElement, ToggleIconButtonPropsWithAccessibility>((props, forwardedRef) => (\n <ToggleButton {...(props as React.ComponentPropsWithoutRef<typeof ToggleButton>)} iconOnly ref={forwardedRef} />\n));\nToggleIconButton.displayName = 'ToggleIconButton';\n\nexport { ToggleIconButton };\nexport type { ToggleIconButtonPropsWithAccessibility as ToggleIconButtonProps };\n"],
5
- "mappings": "wCAAA,UAAYA,MAAW,QACvB,MAAuB,WAyGvB,IAAMC,EAAyB,aAA4E,CAACC,EAAOC,IACjH,gBAACC,EAAA,CAAc,GAAIF,EAA+D,SAAQ,GAAC,IAAKC,EAAc,CAC/G,EACDF,EAAiB,YAAc",
6
- "names": ["React", "ToggleIconButton", "props", "forwardedRef", "ToggleButton"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as ot}from"./chunk-BJ2Q2WVV.js";import{a as Ve}from"./chunk-YEYM7QQZ.js";import{g as nt,j as rt}from"./chunk-IX5HIHVI.js";import{a as we}from"./chunk-KJTEZVOF.js";import{a as at}from"./chunk-GONBMSRL.js";import{a as Be}from"./chunk-PAEHH3WS.js";import{a as je}from"./chunk-AGAQC4HH.js";import{a as De}from"./chunk-PXUQEA77.js";import{b as U}from"./chunk-FWB47YCH.js";import{a as tt}from"./chunk-AVFGMLL4.js";import{a as zt}from"./chunk-OS3FCYZY.js";var Gt={};zt(Gt,{AttachTrigger:()=>gt,Attachment:()=>Ue,AttachmentsRow:()=>ft,InlineEnd:()=>ht,InlineStart:()=>pt,Item:()=>Ct,Root:()=>ut,Row:()=>vt,RowEnd:()=>xt,RowStart:()=>yt,Send:()=>Pt,Textarea:()=>mt});import*as e from"react";import E from"classnames";import{LazyMotion as Dt,MotionConfig as Bt,domAnimation as jt,m as me}from"motion/react";import{useComposedRefs as ct}from"radix-ui/internal";import{useDropzone as Vt}from"react-dropzone";var We=typeof window<"u"?e.useLayoutEffect:e.useEffect;function st(a,o){let{placeholder:n}=a;if(!n){o();return}a.placeholder="";try{o()}finally{a.placeholder=n}}var pe={layout:{type:"spring",visualDuration:.15,bounce:.1}},lt=e.createContext(null),Ke=e.createContext(""),H=()=>{let a=e.useContext(lt);if(!a)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return a},ue=a=>Array.isArray(a)?a:typeof a=="string"?a.split(",").map(o=>o.trim()).filter(Boolean):[],Wt=(a,o)=>{if(o.length===0)return!0;let n=a.type.toLowerCase(),i=a.name.toLowerCase();for(let c of o){let l=c.toLowerCase();if(l.includes("/")){let[d,u]=l.split("/"),[f,b]=n.split("/");if(d==="*"||d===f&&(u==="*"||u===b))return!0}else if(l.startsWith(".")&&i.endsWith(l))return!0}return!1},$t=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i,dt=(a,o)=>(o||"").toLowerCase().startsWith("image/")||$t.test(a),$e=a=>a.trim().length>0,it=(a,o)=>`${a} ${o}${a===1?"":"s"}`,Kt=0,Ut=()=>`chatbar-attachment-${Date.now()}-${++Kt}`,ut=e.forwardRef((a,o)=>{let{className:n,style:i,children:c,value:l,defaultValue:d="",onValueChange:u,open:f,defaultOpen:b=!1,onOpenChange:C,expandOn:v="both",minLines:m=3,maxLines:N=6,sendMode:I="whenDirty",disabled:R,readOnly:S,onSubmit:j,size:A="2",variant:F,color:L,radius:z,panelBackground:y,material:k,width:V,maxWidth:re,attachments:x,defaultAttachments:D,onAttachmentsChange:_,accept:he,multiple:O=!0,maxAttachments:G,maxFileSize:q,paste:B=!0,pasteAccept:M,clearOnSubmit:Y=!0,onAttachmentReject:Se,dropzone:oe=!0,apiRef:Ee,onBlurCapture:fe,notices:be,context:Re,...Te}=a,t=k||y,g=l!=null,[w,se]=e.useState(d),W=g?l:w,X=f!=null,[Le,ie]=e.useState(b),Q=X?f:Le,Z="attachments"in a,[_e,At]=e.useState(()=>D??[]),ce=e.useMemo(()=>Z?x??[]:_e,[Z,x,_e]),[Ge,wt]=e.useState({text:"",id:0}),le=e.useCallback(r=>wt(s=>({text:r,id:s.id+1})),[]),qe=e.useRef(null),St=ct(o,qe),ke=e.useRef(null),Me=e.useRef(null),de=e.useRef(!1),Ce=e.useRef(!1),ge=e.useRef(void 0),Ne=e.useRef(null),Ye=ue(he).join(","),Oe=ue(M).join(","),He=e.useMemo(()=>ue(Ye),[Ye]),Et=e.useMemo(()=>Oe?ue(Oe):He,[Oe,He]),Xe={value:W,attachments:ce,accepts:He,pasteAccepts:Et,multiple:O,maxAttachments:G,maxFileSize:q,disabled:R,readOnly:S,expandOn:v,isValueControlled:g,isOpenControlled:X,isAttachmentsControlled:Z,onValueChange:u,onOpenChange:C,onAttachmentsChange:_,onAttachmentReject:Se,onSubmit:j},P=e.useRef(Xe);P.current=Xe;let Ie=e.useRef(null),$=e.useCallback(()=>Ie.current??P.current.attachments,[]),ee=e.useCallback(r=>{P.current.isOpenControlled||ie(r),P.current.onOpenChange?.(r)},[]),ve=e.useCallback(r=>{P.current.isValueControlled||se(r),P.current.onValueChange?.(r)},[]),te=e.useCallback(r=>{Ie.current=r,queueMicrotask(()=>{Ie.current=null}),P.current.isAttachmentsControlled||At(r),P.current.onAttachmentsChange?.(r)},[]),ye=e.useRef(new Set),ae=e.useCallback((r,s,p=P.current.multiple)=>{let h=P.current;if(h.disabled||h.readOnly||r.length===0)return 0;let K=$(),J=[],ne=[],It=typeof h.maxAttachments=="number"?Math.max(h.maxAttachments-K.length,0):1/0,Ft=p?1/0:1;for(let T of r){if(J.length>=It||J.length>=Ft){ne.push({file:T,reason:"count"});continue}if(typeof h.maxFileSize=="number"&&T.size>h.maxFileSize){ne.push({file:T,reason:"size"});continue}if(!Wt(T,s)){ne.push({file:T,reason:"type"});continue}let ze=dt(T.name,T.type)?URL.createObjectURL(T):void 0;ze&&ye.current.add(ze),J.push({id:Ut(),name:T.name,size:T.size,type:T.type,file:T,url:ze,status:"idle"})}let Ae=[];return J.length>0&&(te(K.concat(J)),h.expandOn!=="none"&&ee(!0),Ae.push(`${it(J.length,"file")} attached.`)),ne.length>0&&(h.onAttachmentReject?.(ne),Ae.push(`${it(ne.length,"file")} could not be attached.`)),Ae.length>0&&le(Ae.join(" ")),J.length},[$,te,ee,le]),xe=e.useCallback(r=>ae(r,P.current.accepts),[ae]),Je=e.useCallback(r=>ae(r,P.current.pasteAccepts),[ae]),Qe=e.useCallback(r=>{let s=$(),p=s.find(h=>h.id===r);p&&(te(s.filter(h=>h.id!==r)),le(`Removed ${p.name}.`))},[$,te,le]),Ze=e.useCallback(r=>{let s=P.current;if(s.disabled||s.readOnly)return!1;let p=$();if(!$e(s.value)&&p.length===0)return!1;let h={value:s.value,attachments:p};if(r&&s.onSubmit)for(let K of p)K.url&&ye.current.delete(K.url);return s.onSubmit?.(h),r&&(ve(""),te([])),!0},[$,ve,te]);e.useEffect(()=>{let r=ye.current;if(r.size===0)return;let s=new Set(ce.map(p=>p.url));for(let p of Array.from(r))s.has(p)||(URL.revokeObjectURL(p),r.delete(p))},[ce]),e.useEffect(()=>{let r=ye.current;return()=>{if(!P.current.isAttachmentsControlled){for(let s of Array.from(r))URL.revokeObjectURL(s);r.clear()}}},[]);let Pe=e.useCallback(r=>{let s=P.current,p=Me.current;if(clearTimeout(ge.current),Ce.current=!1,!p||s.disabled||s.readOnly)return;let h=r?.accept!=null?ue(r.accept):s.accepts,K=r?.multiple??s.multiple;Ne.current={patterns:h,multiple:K},p.accept=h.join(","),p.multiple=K,de.current=!0,p.click(),setTimeout(()=>{document.hasFocus()&&(de.current=!1)},1e3)},[]),et=e.useCallback(()=>{Ce.current=!0,clearTimeout(ge.current),ge.current=setTimeout(()=>{Ce.current=!1},800)},[]);e.useEffect(()=>()=>clearTimeout(ge.current),[]),e.useEffect(()=>{let r=Me.current,s=()=>{de.current=!1};return window.addEventListener("focus",s),r?.addEventListener("cancel",s),()=>{window.removeEventListener("focus",s),r?.removeEventListener("cancel",s)}},[]);let Tt=e.useCallback(r=>{let s=r.currentTarget,p=Array.from(s.files??[]),h=Ne.current;ae(p,h?.patterns??P.current.accepts,h?.multiple),de.current=!1,Ne.current=null,s.value=""},[ae]),Lt=e.useCallback(r=>{fe?.(r);let s=P.current,p=qe.current;if(!p||s.expandOn==="none")return;let h=r.relatedTarget;h&&p.contains(h)||de.current||Ce.current||!$e(s.value)&&$().length===0&&ee(!1)},[fe,ee,$]),kt=e.useCallback(r=>{xe(r)},[xe]),{getRootProps:Mt,isDragActive:Nt}=Vt({onDrop:kt,onDragEnter:()=>le(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!oe||R||S}),Fe=oe&&Nt;e.useImperativeHandle(Ee,()=>({focusTextarea:()=>ke.current?.focus({preventScroll:!0}),openFilePicker:()=>Pe()}),[Pe]);let Ot=e.useCallback(r=>{if(R||r.pointerType==="mouse"&&r.button!==0)return;let s=r.target;s instanceof Element&&s.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(r.preventDefault(),ke.current?.focus({preventScroll:!0}))},[R]),Ht=e.useMemo(()=>({open:Q,setOpen:ee,setValue:ve,size:A,expandOn:v,minLines:m,maxLines:N,sendMode:I,disabled:R,readOnly:S,paste:B,clearOnSubmit:Y,multiple:O,textareaRef:ke,attachments:ce,removeAttachment:Qe,submit:Ze,appendFiles:xe,appendFilesFromPaste:Je,openFilePicker:Pe,beginFilePickerPress:et}),[Q,ee,ve,A,v,m,N,I,R,S,B,Y,O,ce,Qe,Ze,xe,Je,Pe,et]);return e.createElement(lt.Provider,{value:Ht},e.createElement(Ke.Provider,{value:W},e.createElement(Dt,{features:jt},e.createElement(Bt,{reducedMotion:"user"},e.createElement("div",{...Te,ref:St,className:E("rt-ChatbarRoot",`rt-r-size-${A}`,n),style:{position:"relative",width:V,maxWidth:re,...i},"data-state":Q?"open":"closed","data-disabled":R?"":void 0,"data-readonly":S?"":void 0,"data-drop-active":Fe?"":void 0,"data-accent-color":L,"data-radius":z,"data-panel-background":t,"data-material":t,onBlurCapture:Lt},e.createElement("input",{ref:Me,type:"file",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:Tt}),be?e.createElement("div",{className:"rt-ChatbarNotices"},e.createElement(ot.Provider,{value:A},be)):null,e.createElement("div",{...oe?Mt():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Ot},e.createElement(me.div,{className:E("rt-ChatbarBox",`rt-variant-${tt(F??"raised")}`),style:{position:"relative"},"data-accent-color":L,"data-radius":z,"data-panel-background":t,"data-material":t,layout:!0,transition:pe},e.createElement(me.div,{className:"rt-ChatbarGrid",layout:"position",transition:pe},c),Fe&&e.createElement("div",{className:"rt-ChatbarDropOverlay","aria-hidden":!0},e.createElement("div",{className:"rt-ChatbarDropContent"},e.createElement(we,{emphasis:"medium",size:A,weight:"medium"},"Drop files here to attach"))))),Re?e.createElement(we,{as:"div",size:A==="3"?"2":"1",emphasis:"medium",className:"rt-ChatbarContext"},Re):null,e.createElement(je,{role:"status","aria-live":"polite"},Fe?"Drop files here to attach.":e.createElement("span",{key:Ge.id},Ge.text)))))))});ut.displayName="Chatbar.Root";var mt=e.forwardRef((a,o)=>{let{className:n,style:i,asChild:c,onFocus:l,onChange:d,onPaste:u,onKeyDown:f,onCompositionStart:b,onCompositionEnd:C,submitOnEnter:v=!1,...m}=a,N=H(),I=e.useContext(Ke),{open:R,minLines:S,maxLines:j,expandOn:A,disabled:F,readOnly:L,setOpen:z,setValue:y,textareaRef:k,paste:V,appendFilesFromPaste:re,size:x,submit:D,clearOnSubmit:_}=N,he=ct(o,k),O=e.useRef(0),G=e.useRef(0),q=e.useRef(!1),B=e.useRef({open:R,minLines:S,maxLines:j});We(()=>{B.current={open:R,minLines:S,maxLines:j}},[R,S,j]);let M=e.useCallback(()=>{let t=k.current;if(!t)return;let g=window.getComputedStyle(t);O.current=parseFloat(g.lineHeight)||20,G.current=(parseFloat(g.paddingTop)||0)+(parseFloat(g.paddingBottom)||0)},[k]),Y=e.useCallback((t,g)=>{let{minLines:w,maxLines:se}=B.current,W=O.current,X=G.current,Le=Math.ceil((g?w:1)*W)+X,ie=Math.ceil((g?se:1)*W)+X,Q=Math.max(t.scrollHeight,Le);t.style.height=`${Math.min(Q,ie)}px`;let Z=Q>ie;t.style.overflowY=Z?"auto":"hidden",t.style.maxHeight=Z?`${ie}px`:"none"},[]);We(()=>{M()},[M,x]),We(()=>{let t=k.current;t&&(O.current===0&&M(),st(t,()=>{t.style.height="auto";let g=R;if(!R&&(A==="overflow"||A==="both")){let w=Math.ceil(O.current)+G.current;t.scrollHeight>w+1&&(g=!0,z(!0))}Y(t,g)}))},[I,R,A,S,j,x,z,k,M,Y]),e.useEffect(()=>{let t=k.current;if(!t||typeof ResizeObserver>"u")return;let g=-1,w=new ResizeObserver(se=>{let W=se[0]?.contentRect.width??0;if(W===g)return;let X=g===-1;g=W,!X&&(M(),st(t,()=>{t.style.height="auto",Y(t,B.current.open)}))});return w.observe(t),()=>w.disconnect()},[k,M,Y]),e.useEffect(()=>{},[]);let Se=e.useCallback(t=>{l?.(t),!(F||L)&&(A==="focus"||A==="both")&&!R&&z(!0)},[F,L,A,R,z,l]),oe=e.useCallback(t=>{y(t.currentTarget.value),d?.(t)},[y,d]),Ee=e.useCallback(t=>{if(u?.(t),t.defaultPrevented||!V||F||L)return;let g=Array.from(t.clipboardData?.items??[]).filter(w=>w.kind==="file").map(w=>w.getAsFile()).filter(w=>!!w);g.length!==0&&re(g)>0&&t.preventDefault()},[V,F,L,u,re]),fe=e.useCallback(t=>{q.current=!0,b?.(t)},[b]),be=e.useCallback(t=>{q.current=!1,C?.(t)},[C]),Re=e.useCallback(t=>{f?.(t),!(t.defaultPrevented||!v)&&(t.key!=="Enter"||t.shiftKey||t.altKey||t.ctrlKey||t.metaKey||q.current||t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(t.preventDefault(),D(_)))},[v,f,D,_]),Te=c?U:"textarea";return e.createElement(me.div,{className:E("rt-ChatbarField","rt-ChatbarTextarea",n),layout:"position",transition:pe},e.createElement(Te,{...m,ref:he,className:"rt-ChatbarInput",value:I,onChange:oe,onFocus:Se,onPaste:Ee,onKeyDown:Re,onCompositionStart:fe,onCompositionEnd:be,disabled:F,readOnly:L,rows:R?S:1,spellCheck:m.spellCheck??!0,autoCorrect:m.autoCorrect??"on",style:i}))});mt.displayName="Chatbar.Textarea";var pt=e.forwardRef((a,o)=>{let{children:n,asChild:i,className:c,...l}=a;return H().open?null:e.createElement(i?U:"div",{...l,ref:o,className:E("rt-ChatbarInlineStart",c)},n)});pt.displayName="Chatbar.InlineStart";var ht=e.forwardRef((a,o)=>{let{children:n,asChild:i,className:c,...l}=a;return H().open?null:e.createElement(i?U:"div",{...l,ref:o,className:E("rt-ChatbarInlineEnd",c)},n)});ht.displayName="Chatbar.InlineEnd";var ft=e.forwardRef((a,o)=>{let{asChild:n,forceMount:i,renderAttachment:c,className:l,children:d,...u}=a,f=H(),b=e.Children.toArray(d).length>0;if(f.attachments.length===0&&!b&&!i)return null;let C=n?U:"div";return e.createElement(me.div,{layout:"position",transition:pe},e.createElement(C,{...u,ref:o,className:E("rt-ChatbarAttachmentsRow",l),role:"list","aria-label":u["aria-label"]??"Attachments"},e.createElement(at,{className:"rt-ChatbarScrollArea",scrollbars:"horizontal",size:"1"},e.createElement(De,{align:"center",gap:"2",minWidth:"fit-content"},f.attachments.map(v=>e.createElement(Ue,{key:v.id,attachment:v,asChild:!!c},c?.(v))),d))))});ft.displayName="Chatbar.AttachmentsRow";function bt(a,o){let n=a.closest('[role="listitem"]'),i=n?.parentElement?Array.from(n.parentElement.children):[],c=n?i.indexOf(n):-1,d=(i[c+1]??i[c-1])?.querySelector(".rt-ChatbarItemRemove");d?d.focus():o.current?.focus({preventScroll:!0})}var Rt=({lead:a,leadKind:o,label:n,detail:i,removeLabel:c,onRemove:l})=>{let d=H();return e.createElement(e.Fragment,null,e.createElement("span",{className:"rt-ChatbarItemLead","data-kind":o,"aria-hidden":!0},a),e.createElement(we,{className:"rt-ChatbarItemLabel",size:d.size,truncate:!0},n,i?e.createElement(je,null,", ",i):null),l&&e.createElement(Ve,{className:"rt-ChatbarItemRemove","aria-label":c,size:"1",variant:"ghost",color:"gray",onClick:l},e.createElement(nt,null)))},_t={uploading:"uploading",error:"failed to upload"},Ue=e.forwardRef((a,o)=>{let{attachment:n,asChild:i,className:c,children:l,...d}=a,u=H(),f=i?U:"div",b=!!n.url&&dt(n.name,n.type),C=`${Math.ceil(n.size/1024)} KB`,v=n.status?_t[n.status]:void 0,m=u.disabled||u.readOnly,N=R=>{bt(R.currentTarget,u.textareaRef),u.removeAttachment(n.id)},I=n.status==="uploading"?e.createElement(Be,{size:"1"}):b?e.createElement("img",{className:"rt-ChatbarAttachmentImage",src:n.url,alt:""}):e.createElement(rt,null);return e.createElement(f,{...d,ref:o,className:E(l?"rt-ChatbarAttachment":"rt-ChatbarAttachment rt-ChatbarItem",c),role:"listitem","data-kind":b?"image":"file","data-status":n.status,title:n.name},l??e.createElement(Rt,{lead:I,leadKind:b&&n.status!=="uploading"?"image":"icon",label:n.name,detail:v?`${C}, ${v}`:C,removeLabel:`Remove ${n.name}`,onRemove:m?void 0:N}))});Ue.displayName="Chatbar.Attachment";var Ct=e.forwardRef((a,o)=>{let{children:n,icon:i,image:c,color:l,onRemove:d,removeLabel:u,className:f,...b}=a,C=H(),v=C.disabled||C.readOnly,m=d?N=>{bt(N.currentTarget,C.textareaRef),d()}:void 0;return e.createElement("div",{...b,ref:o,className:E("rt-ChatbarItem",f),role:"listitem","data-accent-color":c?void 0:l??"gray",title:n},e.createElement(Rt,{lead:c?e.createElement("img",{className:"rt-ChatbarAttachmentImage",src:c,alt:""}):i,leadKind:c?"image":"icon",label:n,removeLabel:u??`Remove ${n}`,onRemove:v?void 0:m}))});Ct.displayName="Chatbar.Item";var gt=e.forwardRef((a,o)=>{let{asChild:n,accept:i,multiple:c,disabled:l,onPointerDown:d,onClick:u,...f}=a,b=H(),C=l||b.disabled||b.readOnly;return e.createElement(n?U:"button",{...f,ref:o,className:E("rt-ChatbarAttachTrigger",f.className),type:f.type??"button","aria-label":f["aria-label"]??"Add attachments",disabled:C,onPointerDown:m=>{d?.(m),!C&&!m.defaultPrevented&&b.beginFilePickerPress()},onClick:m=>{u?.(m),!(C||m.defaultPrevented)&&b.openFilePicker({accept:i,multiple:c})}})});gt.displayName="Chatbar.AttachTrigger";var vt=e.forwardRef((a,o)=>{let{asChild:n,children:i,className:c,...l}=a;if(!H().open)return null;let u=n?U:"div";return e.createElement(me.div,{layout:"position",transition:pe},e.createElement(u,{...l,ref:o,className:E("rt-ChatbarRow",c)},e.createElement(De,{align:"center",justify:"between",width:"100%"},i)))});vt.displayName="Chatbar.Row";var yt=e.forwardRef((a,o)=>{let{className:n,...i}=a;return e.createElement("div",{...i,ref:o,className:E("rt-ChatbarRowStart",n)})});yt.displayName="Chatbar.RowStart";var xt=e.forwardRef((a,o)=>{let{className:n,...i}=a;return e.createElement("div",{...i,ref:o,className:E("rt-ChatbarRowEnd",n)})});xt.displayName="Chatbar.RowEnd";var Pt=e.forwardRef((a,o)=>{let{asChild:n,clearOnSend:i,disabled:c,children:l,style:d,className:u,size:f,variant:b,tabIndex:C,onClick:v,status:m="ready",onStop:N,onRetry:I,stopLabel:R="Stop",retryLabel:S="Retry",stopIcon:j,retryIcon:A,"aria-label":F,"aria-labelledby":L,...z}=a,y=H(),k=e.useContext(Ke),V=$e(k)||y.attachments.length>0,x=V?"send":m==="submitted"||m==="streaming"?"stop":m==="error"?"retry":"send";if(y.sendMode==="never"&&x==="send")return null;let D=x!=="send"||y.sendMode==="always"||V,_=x==="send"?c||y.disabled||y.readOnly||!V:c||y.disabled,O=x==="stop"?{"aria-label":R}:x==="retry"?{"aria-label":S}:L?{"aria-labelledby":L}:{"aria-label":F??"Send"},G=B=>{if(v?.(B),B.defaultPrevented||_)return;if(x==="stop"){N?.();return}if(x==="retry"){I?.();return}let M=i??y.clearOnSubmit;y.submit(M)&&M&&y.textareaRef.current?.focus({preventScroll:!0})},q=x==="stop"?j??(m==="submitted"?e.createElement(Be,{size:y.size}):e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0},e.createElement("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"}))):x==="retry"?A??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),e.createElement("path",{d:"M3 3v5h5"})):l??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M5 12h14"}),e.createElement("path",{d:"m12 5 7 7-7 7"}));return e.createElement(Ve,{...z,ref:o,size:f??y.size,variant:b??(y.open||x!=="send"?"solid":"ghost"),disabled:_,className:E("rt-ChatbarSend",u),style:{opacity:D?1:0,pointerEvents:D?void 0:"none",...d},"aria-hidden":D?void 0:!0,tabIndex:D?C:-1,asChild:n,onClick:G,"data-status":m,"data-mode":x,...O},q)});Pt.displayName="Chatbar.Send";export{ut as a,mt as b,pt as c,ht as d,ft as e,Ue as f,Ct as g,gt as h,vt as i,yt as j,xt as k,Pt as l,Gt as m};
2
- //# sourceMappingURL=chunk-IICXZUIB.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/chatbar.tsx"],
4
- "sourcesContent": ["import { parseVariant } from '../helpers/parse-variant.js';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { LazyMotion, MotionConfig, domAnimation, m } from 'motion/react';\nimport { useComposedRefs } from 'radix-ui/internal';\nimport { useDropzone } from 'react-dropzone';\n\nimport { IconButton, type IconButtonProps } from './icon-button.js';\nimport { CloseIcon, FileTextIcon } from './icons.js';\nimport { Flex } from './flex.js';\nimport { ScrollArea } from './scroll-area.js';\nimport { Slot } from './slot.js';\nimport { NoticeSizeContext } from './notice.js';\nimport { Spinner } from './spinner.js';\nimport { Text } from './text.js';\nimport { VisuallyHidden } from './visually-hidden.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { accentColors } from '../props/color.prop.js';\nimport type { radii } from '../props/radius.prop.js';\n\n// Avoid SSR warnings by using an isomorphic layout effect\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n\n/**\n * Runs `measure` with the placeholder taken out of layout, so a height read\n * reflects the value alone.\n *\n * A textarea with an empty value lays its placeholder out as real text, so\n * `scrollHeight` reports the placeholder wrapped at whatever width the field\n * has at that instant. That sizes an empty bar to the suggestion showing in it\n * rather than to `minLines`, and when the read lands before the field has its\n * final width -- a panel still animating open, a flex parent whose basis is 0\n * -- it wraps that text at a fraction of the real width and opens the bar at\n * `maxLines`. The first keystroke takes the placeholder out of layout and the\n * height snaps back, which is what made the bug look intermittent rather than\n * simply wrong.\n *\n * The reset to 'auto' and the `scrollHeight` read sit in different functions\n * here, so the whole measurement window is wrapped rather than a single read.\n * Costs one extra style recalc on a path that is already forcing a reflow.\n */\nfunction withoutPlaceholder(el: HTMLTextAreaElement, measure: () => void): void {\n const { placeholder } = el;\n if (!placeholder) {\n measure();\n return;\n }\n el.placeholder = '';\n try {\n measure();\n } finally {\n el.placeholder = placeholder;\n }\n}\n\n// Shared layout spring; hoisted so every motion node receives the same object\nconst LAYOUT_TRANSITION = { layout: { type: 'spring', visualDuration: 0.15, bounce: 0.1 } } as const;\n\ntype ExpandOn = 'none' | 'focus' | 'overflow' | 'both';\ntype SendMode = 'always' | 'whenDirty' | 'never';\n\n// Attachments\n/** Status flag for attachment lifecycle. */\ntype AttachmentStatus = 'idle' | 'uploading' | 'error' | 'done';\n/**\n * Attachment data model used by Chatbar.\n * - `file` exposes the original File object for uploads and processing.\n * - `url` is an object URL used for image previews. Chatbar revokes it when the\n * attachment is removed; once an attachment is handed to `onSubmit`, the\n * consumer owns the URL and is responsible for revoking it.\n */\ninterface ChatbarAttachment {\n id: string;\n name: string;\n size: number;\n type: string;\n /** Original File object for uploads and processing */\n file: File;\n url?: string;\n status?: AttachmentStatus;\n progress?: number;\n meta?: Record<string, unknown>;\n}\n\ntype ChatbarRejectReason = 'type' | 'size' | 'count';\ninterface ChatbarAttachmentRejection {\n file: File;\n reason: ChatbarRejectReason;\n}\n\ninterface ChatbarSubmitPayload {\n value: string;\n attachments: ChatbarAttachment[];\n}\n\ninterface FilePickerOptions {\n accept?: string | string[];\n multiple?: boolean;\n}\n\ninterface ChatbarContextValue {\n open: boolean;\n setOpen(next: boolean): void;\n\n setValue(next: string): void;\n\n size: '1' | '2' | '3';\n expandOn: ExpandOn;\n minLines: number;\n maxLines: number;\n sendMode: SendMode;\n disabled?: boolean;\n readOnly?: boolean;\n paste: boolean;\n clearOnSubmit: boolean;\n multiple: boolean;\n\n textareaRef: React.RefObject<HTMLTextAreaElement | null>;\n\n attachments: ChatbarAttachment[];\n removeAttachment(id: string): void;\n\n /** Validates and submits; returns false when there was nothing to submit */\n submit(clear: boolean): boolean;\n appendFiles(files: File[]): number;\n appendFilesFromPaste(files: File[]): number;\n openFilePicker(options?: FilePickerOptions): void;\n /** Guards blur-collapse between pointerdown on a picker trigger and its click */\n beginFilePickerPress(): void;\n}\n\nconst ChatbarContext = React.createContext<ChatbarContextValue | null>(null);\n// Value lives in its own context so keystrokes only re-render parts that read it\nconst ChatbarValueContext = React.createContext<string>('');\n\nconst useChatbarContext = () => {\n const ctx = React.useContext(ChatbarContext);\n if (!ctx) throw new Error('Chatbar context not found. Wrap parts in <Chatbar.Root>.');\n return ctx;\n};\n\nconst toArray = (val: string | string[] | undefined) =>\n Array.isArray(val) ? val : typeof val === 'string' ? val.split(',').map((s) => s.trim()).filter(Boolean) : [];\n\nconst matchesAccept = (file: File, patterns: string[]) => {\n if (patterns.length === 0) return true;\n const mime = file.type.toLowerCase();\n const name = file.name.toLowerCase();\n for (const patRaw of patterns) {\n const pat = patRaw.toLowerCase();\n if (pat.includes('/')) {\n const [type, subtype] = pat.split('/');\n const [fmType, fmSubtype] = mime.split('/');\n if (type === '*' || (type === fmType && (subtype === '*' || subtype === fmSubtype))) return true;\n } else if (pat.startsWith('.')) {\n if (name.endsWith(pat)) return true;\n }\n }\n return false;\n};\n\nconst IMAGE_EXT_RE = /\\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i;\nconst isImageLike = (name: string, type: string) => (type || '').toLowerCase().startsWith('image/') || IMAGE_EXT_RE.test(name);\n\nconst hasText = (value: string) => value.trim().length > 0;\n\nconst plural = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`;\n\nlet attachmentCounter = 0;\nconst createAttachmentId = () => `chatbar-attachment-${Date.now()}-${++attachmentCounter}`;\n\n/**\n * Chatbar container and state provider.\n *\n * Value & Open\n * - Supports controlled/uncontrolled `value` and `open`.\n *\n * Attachments\n * - Controlled/uncontrolled attachments with client-side filtering.\n * - Filters by `accept`/`pasteAccept`, `multiple`, `maxAttachments`, and `maxFileSize`.\n * - Rejections are reported via `onAttachmentReject`.\n *\n * Submit\n * - `onSubmit({ value, attachments })` emits both message and attachments.\n * - Submitting requires text or at least one attachment.\n * - `clearOnSubmit` clears message and attachments by default.\n */\ninterface ChatbarRootBaseProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n /** When the chatbar expands on its own. `none` leaves open state entirely to the consumer. */\n expandOn?: ExpandOn;\n\n /** Minimum visible lines when expanded (default: 3). The compact state is always one line. */\n minLines?: number;\n /** Maximum number of lines before scrolling (default: 6) */\n maxLines?: number;\n\n /** Controls Send button visibility only. Enter-to-submit is controlled by `Textarea submitOnEnter`. */\n sendMode?: SendMode;\n\n /** Disables text input, submission and every way of adding attachments */\n disabled?: boolean;\n /** Prevents editing, submission and adding attachments */\n readOnly?: boolean;\n\n /** Combined submit payload */\n onSubmit?: (payload: ChatbarSubmitPayload) => void;\n\n size?: '1' | '2' | '3';\n /** `classic` is a deprecated alias of `raised`, removed in 0.15.0. */\n variant?: 'raised' | 'surface' | 'outline' | 'ghost' | 'soft' | 'classic';\n /** Accent color for the control (matches TextArea) */\n color?: (typeof accentColors)[number];\n /** Optional radius override (matches TextArea) */\n radius?: (typeof radii)[number];\n /** Panel/material translucency flags (matches TextArea) */\n panelBackground?: 'solid' | 'translucent';\n material?: 'solid' | 'translucent';\n\n width?: React.CSSProperties['width'];\n maxWidth?: React.CSSProperties['maxWidth'];\n\n // Attachments API\n attachments?: ChatbarAttachment[];\n defaultAttachments?: ChatbarAttachment[];\n onAttachmentsChange?: (attachments: ChatbarAttachment[]) => void;\n accept?: string | string[];\n /** Allow more than one file per pick, paste or drop */\n multiple?: boolean;\n maxAttachments?: number;\n maxFileSize?: number;\n paste?: boolean;\n /** Accepted types for pasted files. Replaces `accept` for paste when set. */\n pasteAccept?: string | string[];\n /** Clear message and attachments after submit */\n clearOnSubmit?: boolean;\n onAttachmentReject?: (rejections: ChatbarAttachmentRejection[]) => void;\n\n /**\n * Enables drag-and-drop file uploads when true.\n *\n * When enabled:\n * - Files can be dropped anywhere on the chatbar\n * - Same validation rules apply (accept, multiple, maxFileSize, maxAttachments)\n * - Visual feedback shows during drag operations\n * - Rejected files trigger onAttachmentReject\n *\n * @default true\n */\n dropzone?: boolean;\n\n /**\n * Optional API ref to control Chatbar imperatively without relying on DOM refs.\n * Provides methods to focus the textarea and open the file picker.\n */\n apiRef?: React.Ref<ChatbarApi>;\n\n /**\n * Messages that need an answer before the next message, such as `Notice` and `Confirmation`.\n * They stack in a column above the chatbar, in the order given, so put the one the next\n * message answers last, nearest the text. They sit outside the box: a button in a notice never\n * submits the message, and pressing one never collapses the chatbar.\n */\n notices?: React.ReactNode;\n /**\n * Short facts that stay true about the conversation, such as the model or the context left.\n * They sit below the chatbar, inset from its sides.\n */\n context?: React.ReactNode;\n}\n\ntype RootElement = React.ElementRef<'div'>;\n/** Imperative API for Chatbar.Root */\nexport interface ChatbarApi {\n /** Focus the textarea input */\n focusTextarea: () => void;\n /** Open the file picker dialog (respects accept/multiple). No-op when disabled or read-only. */\n openFilePicker: () => void;\n}\n/**\n * Chatbar container and state provider.\n *\n * Behavior\n * - Supports controlled and uncontrolled `value` and `open` states via props.\n * - Provides context to subcomponents like `Textarea`, `Row`, and `Send`.\n * - Exposes `data-state`, `data-disabled`, and `data-readonly` attributes for styling.\n *\n * Attachments\n * - Paste-to-attach: when `paste` is enabled, pasting files adds attachments.\n * - Additions and rejections are announced through a polite live region.\n *\n * Dropzone\n * - When `dropzone` is true, enables drag-and-drop file uploads.\n * - Visual feedback via `data-drop-active` attribute during drag operations.\n *\n * Accessibility\n * - Consumers should label the `Textarea` via `aria-label`/`aria-labelledby`.\n */\ninterface RootProps extends ComponentPropsWithout<'div', RemovedProps | 'onSubmit' | 'color'>, ChatbarRootBaseProps {}\n\nconst Root = React.forwardRef<RootElement, RootProps>((props, forwardedRef) => {\n const {\n className,\n style,\n children,\n value: valueProp,\n defaultValue = '',\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n expandOn = 'both',\n minLines = 3,\n maxLines = 6,\n sendMode = 'whenDirty',\n disabled,\n readOnly,\n onSubmit,\n size = '2',\n variant,\n color,\n radius,\n panelBackground,\n material,\n width,\n maxWidth,\n attachments: attachmentsProp,\n defaultAttachments,\n onAttachmentsChange,\n accept,\n multiple = true,\n maxAttachments,\n maxFileSize,\n paste = true,\n pasteAccept,\n clearOnSubmit = true,\n onAttachmentReject,\n dropzone = true,\n apiRef,\n onBlurCapture,\n notices,\n context,\n ...divProps\n } = props;\n const effectiveMaterial = material || panelBackground;\n\n const isValueControlled = valueProp != null;\n const [valueUncontrolled, setValueUncontrolled] = React.useState<string>(defaultValue);\n const value = isValueControlled ? valueProp : valueUncontrolled;\n\n const isOpenControlled = openProp != null;\n const [openUncontrolled, setOpenUncontrolled] = React.useState<boolean>(defaultOpen);\n const open = isOpenControlled ? openProp : openUncontrolled;\n\n // Treat `attachments` as controlled if the prop is provided, even if its value is `undefined`.\n // This avoids switching between controlled and uncontrolled when a consumer sets\n // `attachments={undefined}` to clear attachments. In that case we normalize to an empty array.\n const isAttachmentsControlled = 'attachments' in props;\n const [attachmentsUncontrolled, setAttachmentsUncontrolled] = React.useState<ChatbarAttachment[]>(() => defaultAttachments ?? []);\n const attachments = React.useMemo(\n () => (isAttachmentsControlled ? (attachmentsProp ?? []) : attachmentsUncontrolled),\n [isAttachmentsControlled, attachmentsProp, attachmentsUncontrolled],\n );\n\n // `id` changes on every announcement so identical messages still update the live region\n const [announcement, setAnnouncementState] = React.useState({ text: '', id: 0 });\n const announce = React.useCallback((text: string) => setAnnouncementState((prev) => ({ text, id: prev.id + 1 })), []);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n const composedRootRef = useComposedRefs(forwardedRef, rootRef);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const fileInputRef = React.useRef<HTMLInputElement>(null);\n\n // Blur-collapse guards: `pickerOpenRef` is true while the native dialog is open,\n // `pressGuardRef` covers the gap between pointerdown on a trigger and its click\n // (Safari blurs the textarea before the click fires).\n const pickerOpenRef = React.useRef(false);\n const pressGuardRef = React.useRef(false);\n const pressGuardTimerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const pickerRef = React.useRef<{ patterns: string[]; multiple: boolean } | null>(null);\n\n const acceptKey = toArray(accept).join(',');\n const pasteAcceptKey = toArray(pasteAccept).join(',');\n const accepts = React.useMemo(() => toArray(acceptKey), [acceptKey]);\n const pasteAccepts = React.useMemo(() => (pasteAcceptKey ? toArray(pasteAcceptKey) : accepts), [pasteAcceptKey, accepts]);\n\n // Latest props/state for stable callbacks. Synced during render (not in an effect) so\n // child layout effects that call setOpen/setValue see this render's handlers.\n const snapshot = {\n value,\n attachments,\n accepts,\n pasteAccepts,\n multiple,\n maxAttachments,\n maxFileSize,\n disabled,\n readOnly,\n expandOn,\n isValueControlled,\n isOpenControlled,\n isAttachmentsControlled,\n onValueChange,\n onOpenChange,\n onAttachmentsChange,\n onAttachmentReject,\n onSubmit,\n };\n const latest = React.useRef(snapshot);\n // eslint-disable-next-line react-hooks/refs -- read only in callbacks/effects; see comment above\n latest.current = snapshot;\n\n // Attachments set during the current event, before Root re-renders. Cleared at the end\n // of the task so a controlled parent that rejects the change is not overridden.\n const pendingAttachmentsRef = React.useRef<ChatbarAttachment[] | null>(null);\n const getAttachments = React.useCallback(() => pendingAttachmentsRef.current ?? latest.current.attachments, []);\n\n const setOpen = React.useCallback((next: boolean) => {\n if (!latest.current.isOpenControlled) setOpenUncontrolled(next);\n latest.current.onOpenChange?.(next);\n }, []);\n\n const setValue = React.useCallback((next: string) => {\n if (!latest.current.isValueControlled) setValueUncontrolled(next);\n latest.current.onValueChange?.(next);\n }, []);\n\n const setAttachments = React.useCallback((next: ChatbarAttachment[]) => {\n // Back-to-back updates in one event must see each other\n pendingAttachmentsRef.current = next;\n queueMicrotask(() => {\n pendingAttachmentsRef.current = null;\n });\n if (!latest.current.isAttachmentsControlled) setAttachmentsUncontrolled(next);\n latest.current.onAttachmentsChange?.(next);\n }, []);\n\n // Object URLs Chatbar created and still owns\n const ownedUrlsRef = React.useRef<Set<string>>(new Set());\n\n const addFiles = React.useCallback(\n (files: File[], patterns: string[], multiple: boolean = latest.current.multiple): number => {\n const cfg = latest.current;\n if (cfg.disabled || cfg.readOnly || files.length === 0) return 0;\n\n const current = getAttachments();\n const next: ChatbarAttachment[] = [];\n const rejected: ChatbarAttachmentRejection[] = [];\n const remainingSlots = typeof cfg.maxAttachments === 'number' ? Math.max(cfg.maxAttachments - current.length, 0) : Infinity;\n const perActionLimit = multiple ? Infinity : 1;\n\n for (const file of files) {\n if (next.length >= remainingSlots || next.length >= perActionLimit) {\n rejected.push({ file, reason: 'count' });\n continue;\n }\n if (typeof cfg.maxFileSize === 'number' && file.size > cfg.maxFileSize) {\n rejected.push({ file, reason: 'size' });\n continue;\n }\n if (!matchesAccept(file, patterns)) {\n rejected.push({ file, reason: 'type' });\n continue;\n }\n const url = isImageLike(file.name, file.type) ? URL.createObjectURL(file) : undefined;\n if (url) ownedUrlsRef.current.add(url);\n next.push({ id: createAttachmentId(), name: file.name, size: file.size, type: file.type, file, url, status: 'idle' });\n }\n\n const messages: string[] = [];\n if (next.length > 0) {\n setAttachments(current.concat(next));\n if (cfg.expandOn !== 'none') setOpen(true);\n messages.push(`${plural(next.length, 'file')} attached.`);\n }\n if (rejected.length > 0) {\n cfg.onAttachmentReject?.(rejected);\n messages.push(`${plural(rejected.length, 'file')} could not be attached.`);\n }\n if (messages.length > 0) announce(messages.join(' '));\n return next.length;\n },\n [getAttachments, setAttachments, setOpen, announce],\n );\n\n const appendFiles = React.useCallback((files: File[]) => addFiles(files, latest.current.accepts), [addFiles]);\n const appendFilesFromPaste = React.useCallback((files: File[]) => addFiles(files, latest.current.pasteAccepts), [addFiles]);\n\n const removeAttachment = React.useCallback(\n (id: string) => {\n const current = getAttachments();\n const removed = current.find((a) => a.id === id);\n if (!removed) return;\n setAttachments(current.filter((a) => a.id !== id));\n announce(`Removed ${removed.name}.`);\n },\n [getAttachments, setAttachments, announce],\n );\n\n const submit = React.useCallback(\n (clear: boolean) => {\n const cfg = latest.current;\n if (cfg.disabled || cfg.readOnly) return false;\n const current = getAttachments();\n if (!hasText(cfg.value) && current.length === 0) return false;\n const payload = { value: cfg.value, attachments: current };\n // Hand preview URLs to the consumer only when they leave the chatbar; URLs still\n // rendered here stay owned so removing them later revokes them\n if (clear && cfg.onSubmit) {\n for (const att of current) if (att.url) ownedUrlsRef.current.delete(att.url);\n }\n cfg.onSubmit?.(payload);\n if (clear) {\n setValue('');\n setAttachments([]);\n }\n return true;\n },\n [getAttachments, setValue, setAttachments],\n );\n\n // Revoke owned object URLs that are no longer referenced by current attachments\n React.useEffect(() => {\n const owned = ownedUrlsRef.current;\n if (owned.size === 0) return;\n const current = new Set(attachments.map((a) => a.url));\n for (const url of Array.from(owned)) {\n if (!current.has(url)) {\n URL.revokeObjectURL(url);\n owned.delete(url);\n }\n }\n }, [attachments]);\n\n // On unmount, revoke URLs only when Chatbar owns the attachment list;\n // controlled attachments may still be rendered by the parent.\n React.useEffect(() => {\n const owned = ownedUrlsRef.current;\n return () => {\n if (latest.current.isAttachmentsControlled) return;\n for (const url of Array.from(owned)) URL.revokeObjectURL(url);\n owned.clear();\n };\n }, []);\n\n const openFilePicker = React.useCallback((options?: FilePickerOptions) => {\n const cfg = latest.current;\n const input = fileInputRef.current;\n // The picker guard takes over from the press guard\n clearTimeout(pressGuardTimerRef.current);\n pressGuardRef.current = false;\n if (!input || cfg.disabled || cfg.readOnly) return;\n const patterns = options?.accept != null ? toArray(options.accept) : cfg.accepts;\n const multiple = options?.multiple ?? cfg.multiple;\n pickerRef.current = { patterns, multiple };\n input.accept = patterns.join(',');\n input.multiple = multiple;\n pickerOpenRef.current = true;\n input.click();\n // Browsers block the dialog outside a user gesture; if the window kept focus,\n // no dialog opened and no focus/cancel/change event will clear the guard\n setTimeout(() => {\n if (document.hasFocus()) pickerOpenRef.current = false;\n }, 1000);\n }, []);\n\n const beginFilePickerPress = React.useCallback(() => {\n // On touch (notably iOS), the compatibility mousedown, blur and click arrive in later\n // tasks than pointerup, so hold the guard until the click or a timeout\n pressGuardRef.current = true;\n clearTimeout(pressGuardTimerRef.current);\n pressGuardTimerRef.current = setTimeout(() => {\n pressGuardRef.current = false;\n }, 800);\n }, []);\n\n React.useEffect(() => () => clearTimeout(pressGuardTimerRef.current), []);\n\n // Clear the picker guard when the dialog closes, whichever way it closes\n React.useEffect(() => {\n const input = fileInputRef.current;\n const reset = () => {\n pickerOpenRef.current = false;\n };\n window.addEventListener('focus', reset);\n input?.addEventListener('cancel', reset);\n return () => {\n window.removeEventListener('focus', reset);\n input?.removeEventListener('cancel', reset);\n };\n }, []);\n\n const handleFileInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const input = event.currentTarget;\n const files = Array.from(input.files ?? []);\n const picker = pickerRef.current;\n addFiles(files, picker?.patterns ?? latest.current.accepts, picker?.multiple);\n pickerOpenRef.current = false;\n pickerRef.current = null;\n // Reset so selecting the same file again still fires change\n input.value = '';\n },\n [addFiles],\n );\n\n const handleBlurCapture = React.useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n onBlurCapture?.(event);\n const cfg = latest.current;\n const rootEl = rootRef.current;\n if (!rootEl || cfg.expandOn === 'none') return;\n const nextTarget = event.relatedTarget as Node | null;\n if (nextTarget && rootEl.contains(nextTarget)) return;\n if (pickerOpenRef.current || pressGuardRef.current) return;\n if (!hasText(cfg.value) && getAttachments().length === 0) setOpen(false);\n },\n [onBlurCapture, setOpen, getAttachments],\n );\n\n const handleDrop = React.useCallback((files: File[]) => {\n appendFiles(files);\n }, [appendFiles]);\n\n // Validation happens in addFiles so drop, paste and picker share one rule set\n const { getRootProps, isDragActive } = useDropzone({\n onDrop: handleDrop,\n // Drop any earlier message so it is not re-announced when the drag hint goes away\n onDragEnter: () => announce(''),\n noClick: true,\n noKeyboard: true,\n // Textarea handles paste itself; letting the dropzone see it attaches twice\n noPaste: true,\n disabled: !dropzone || disabled || readOnly,\n });\n const dragActive = dropzone && isDragActive;\n\n React.useImperativeHandle(\n apiRef,\n () => ({\n focusTextarea: () => textareaRef.current?.focus({ preventScroll: true }),\n openFilePicker: () => openFilePicker(),\n }),\n [openFilePicker],\n );\n\n // Click-to-focus: focus textarea when clicking non-interactive areas inside the container\n const handleContainerPointerDown = React.useCallback(\n (event: React.PointerEvent) => {\n if (disabled) return;\n if (event.pointerType === 'mouse' && event.button !== 0) return;\n const target = event.target;\n if (target instanceof Element && target.closest('button, [role=\"button\"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex=\"-1\"])')) return;\n event.preventDefault();\n textareaRef.current?.focus({ preventScroll: true });\n },\n [disabled],\n );\n\n const contextValue = React.useMemo<ChatbarContextValue>(\n () => ({\n open,\n setOpen,\n setValue,\n size,\n expandOn,\n minLines,\n maxLines,\n sendMode,\n disabled,\n readOnly,\n paste,\n clearOnSubmit,\n multiple,\n textareaRef,\n attachments,\n removeAttachment,\n submit,\n appendFiles,\n appendFilesFromPaste,\n openFilePicker,\n beginFilePickerPress,\n }),\n [\n open, setOpen, setValue, size, expandOn, minLines, maxLines, sendMode, disabled, readOnly, paste,\n clearOnSubmit, multiple, attachments, removeAttachment, submit, appendFiles, appendFilesFromPaste,\n openFilePicker, beginFilePickerPress,\n ],\n );\n\n return (\n <ChatbarContext.Provider value={contextValue}>\n <ChatbarValueContext.Provider value={value}>\n <LazyMotion features={domAnimation}>\n <MotionConfig reducedMotion=\"user\">\n <div\n {...divProps}\n ref={composedRootRef}\n className={classNames('rt-ChatbarRoot', `rt-r-size-${size}`, className)}\n style={{ position: 'relative', width, maxWidth, ...style }}\n data-state={open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n data-readonly={readOnly ? '' : undefined}\n data-drop-active={dragActive ? '' : undefined}\n data-accent-color={color}\n data-radius={radius}\n data-panel-background={effectiveMaterial}\n data-material={effectiveMaterial}\n onBlurCapture={handleBlurCapture}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n tabIndex={-1}\n aria-hidden\n style={{ display: 'none' }}\n onChange={handleFileInputChange}\n />\n {notices ? (\n <div className=\"rt-ChatbarNotices\">\n <NoticeSizeContext.Provider value={size}>{notices}</NoticeSizeContext.Provider>\n </div>\n ) : null}\n <div {...(dropzone ? getRootProps() : {})} style={{ width: '100%', flex: '1 1 auto', minHeight: 0 }} onPointerDown={handleContainerPointerDown}>\n <m.div\n className={classNames('rt-ChatbarBox', `rt-variant-${parseVariant(variant ?? 'raised')}`)}\n style={{ position: 'relative' }}\n data-accent-color={color}\n data-radius={radius}\n data-panel-background={effectiveMaterial}\n data-material={effectiveMaterial}\n layout\n transition={LAYOUT_TRANSITION}\n >\n <m.div className=\"rt-ChatbarGrid\" layout=\"position\" transition={LAYOUT_TRANSITION}>\n {children}\n </m.div>\n {dragActive && (\n <div className=\"rt-ChatbarDropOverlay\" aria-hidden>\n <div className=\"rt-ChatbarDropContent\">\n <Text emphasis=\"medium\" size={size} weight=\"medium\">\n Drop files here to attach\n </Text>\n </div>\n </div>\n )}\n </m.div>\n </div>\n {context ? (\n <Text as=\"div\" size={size === '3' ? '2' : '1'} emphasis=\"medium\" className=\"rt-ChatbarContext\">\n {context}\n </Text>\n ) : null}\n <VisuallyHidden role=\"status\" aria-live=\"polite\">\n {dragActive ? 'Drop files here to attach.' : <span key={announcement.id}>{announcement.text}</span>}\n </VisuallyHidden>\n </div>\n </MotionConfig>\n </LazyMotion>\n </ChatbarValueContext.Provider>\n </ChatbarContext.Provider>\n );\n});\nRoot.displayName = 'Chatbar.Root';\n\n/**\n * Multi-line text input for Chatbar.\n * - Uses onChange to control value and avoid duplicate updates.\n * - Auto-resizes between minLines and maxLines.\n * - Expands on focus/overflow per `expandOn`.\n * - Paste-to-attach: when `paste` is enabled on Root, pasting files adds attachments.\n * - Provide `aria-label` or `aria-labelledby` for an accessible name.\n */\ninterface TextareaProps extends Omit<React.ComponentPropsWithoutRef<'textarea'>, 'size' | 'rows' | 'value' | 'defaultValue'> {\n asChild?: boolean;\n /**\n * When true, pressing Enter submits (Shift+Enter inserts a newline).\n * Works with every `sendMode`. Defaults to false.\n */\n submitOnEnter?: boolean;\n}\n\n/**\n * Chatbar multi-line text input.\n *\n * Behavior\n * - Controls the Chatbar value via React onChange.\n * - Auto-resizes between minLines and maxLines in a single layout effect, which\n * also opens the Chatbar when content overflows the compact height and\n * `expandOn` is `overflow` or `both`.\n * - Consumer handlers run first; calling `preventDefault` in `onKeyDown` or\n * `onPaste` skips the built-in submit or attach behavior.\n *\n * Accessibility\n * - Consumers should provide labeling via aria-label or aria-labelledby\n * on this component, as no implicit label is rendered.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, forwardedRef) => {\n const {\n className,\n style,\n asChild,\n onFocus,\n onChange,\n onPaste,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n submitOnEnter = false,\n ...textareaProps\n } = props;\n const ctx = useChatbarContext();\n const value = React.useContext(ChatbarValueContext);\n const { open, minLines, maxLines, expandOn, disabled, readOnly, setOpen, setValue, textareaRef, paste, appendFilesFromPaste, size, submit, clearOnSubmit } = ctx;\n const composedRef = useComposedRefs(forwardedRef, textareaRef);\n\n // Cached metrics to avoid repeated getComputedStyle calls\n const lineHeightRef = React.useRef(0);\n const paddingRef = React.useRef(0);\n const composingRef = React.useRef(false);\n\n const sizingRef = React.useRef({ open, minLines, maxLines });\n // Declared before the sizing effect so it runs first in the same commit\n useIsomorphicLayoutEffect(() => {\n sizingRef.current = { open, minLines, maxLines };\n }, [open, minLines, maxLines]);\n\n const recomputeMetrics = React.useCallback(() => {\n const el = textareaRef.current;\n if (!el) return;\n const computedStyle = window.getComputedStyle(el);\n lineHeightRef.current = parseFloat(computedStyle.lineHeight) || 20;\n paddingRef.current = (parseFloat(computedStyle.paddingTop) || 0) + (parseFloat(computedStyle.paddingBottom) || 0);\n }, [textareaRef]);\n\n // Sizes `el` for the given open state; caller must have set height to 'auto' first\n const applyHeight = React.useCallback((el: HTMLTextAreaElement, isOpen: boolean) => {\n const { minLines: min, maxLines: max } = sizingRef.current;\n const lineHeight = lineHeightRef.current;\n const padding = paddingRef.current;\n const minHeight = Math.ceil((isOpen ? min : 1) * lineHeight) + padding;\n const maxHeight = Math.ceil((isOpen ? max : 1) * lineHeight) + padding;\n const contentHeight = Math.max(el.scrollHeight, minHeight);\n el.style.height = `${Math.min(contentHeight, maxHeight)}px`;\n const overflowing = contentHeight > maxHeight;\n el.style.overflowY = overflowing ? 'auto' : 'hidden';\n el.style.maxHeight = overflowing ? `${maxHeight}px` : 'none';\n }, []);\n\n // Typography depends on size\n useIsomorphicLayoutEffect(() => {\n recomputeMetrics();\n }, [recomputeMetrics, size]);\n\n // Single place for sizing and overflow auto-open: one height reset, one scrollHeight read\n useIsomorphicLayoutEffect(() => {\n const el = textareaRef.current;\n if (!el) return;\n if (lineHeightRef.current === 0) recomputeMetrics();\n withoutPlaceholder(el, () => {\n el.style.height = 'auto';\n let isOpen = open;\n if (!open && (expandOn === 'overflow' || expandOn === 'both')) {\n const compactHeight = Math.ceil(lineHeightRef.current) + paddingRef.current;\n if (el.scrollHeight > compactHeight + 1) {\n isOpen = true;\n setOpen(true);\n }\n }\n applyHeight(el, isOpen);\n });\n }, [value, open, expandOn, minLines, maxLines, size, setOpen, textareaRef, recomputeMetrics, applyHeight]);\n\n // Width changes re-wrap text; re-measure only when the width actually changes\n React.useEffect(() => {\n const el = textareaRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return;\n let prevWidth = -1;\n const ro = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width ?? 0;\n if (width === prevWidth) return;\n const first = prevWidth === -1;\n prevWidth = width;\n if (first) return;\n recomputeMetrics();\n withoutPlaceholder(el, () => {\n el.style.height = 'auto';\n applyHeight(el, sizingRef.current.open);\n });\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, [textareaRef, recomputeMetrics, applyHeight]);\n\n // Dev-only warning if no accessible name is provided\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n const hasLabel = textareaProps['aria-label'] != null || textareaProps['aria-labelledby'] != null;\n if (!hasLabel) {\n console.warn('[Chatbar.Textarea] Provide aria-label or aria-labelledby to ensure the control has an accessible name.');\n }\n // warn only on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleFocus = React.useCallback<React.FocusEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onFocus?.(event);\n if (disabled || readOnly) return;\n if ((expandOn === 'focus' || expandOn === 'both') && !open) setOpen(true);\n },\n [disabled, readOnly, expandOn, open, setOpen, onFocus],\n );\n\n const handleChange = React.useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n (event) => {\n setValue(event.currentTarget.value);\n onChange?.(event);\n },\n [setValue, onChange],\n );\n\n const handlePaste = React.useCallback<React.ClipboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onPaste?.(event);\n if (event.defaultPrevented || !paste || disabled || readOnly) return;\n const files = Array.from(event.clipboardData?.items ?? [])\n .filter((item) => item.kind === 'file')\n .map((item) => item.getAsFile())\n .filter((f): f is File => !!f);\n if (files.length === 0) return;\n // Suppress the filename/text representation only when a file was actually attached\n if (appendFilesFromPaste(files) > 0) event.preventDefault();\n },\n [paste, disabled, readOnly, onPaste, appendFilesFromPaste],\n );\n\n const handleCompositionStart = React.useCallback<React.CompositionEventHandler<HTMLTextAreaElement>>(\n (event) => {\n composingRef.current = true;\n onCompositionStart?.(event);\n },\n [onCompositionStart],\n );\n\n const handleCompositionEnd = React.useCallback<React.CompositionEventHandler<HTMLTextAreaElement>>(\n (event) => {\n composingRef.current = false;\n onCompositionEnd?.(event);\n },\n [onCompositionEnd],\n );\n\n const handleKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !submitOnEnter) return;\n if (event.key !== 'Enter' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return;\n // Safari fires the IME-confirming Enter after compositionend with keyCode 229\n if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;\n // Plain Enter never inserts a newline when submitOnEnter is on, even with nothing to send\n event.preventDefault();\n submit(clearOnSubmit);\n },\n [submitOnEnter, onKeyDown, submit, clearOnSubmit],\n );\n\n const Comp = asChild ? Slot : 'textarea';\n return (\n <m.div className={classNames('rt-ChatbarField', 'rt-ChatbarTextarea', className)} layout=\"position\" transition={LAYOUT_TRANSITION}>\n <Comp\n {...textareaProps}\n ref={composedRef}\n className=\"rt-ChatbarInput\"\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n disabled={disabled}\n readOnly={readOnly}\n rows={open ? minLines : 1}\n spellCheck={textareaProps.spellCheck ?? true}\n autoCorrect={textareaProps.autoCorrect ?? 'on'}\n style={style}\n />\n </m.div>\n );\n});\nTextarea.displayName = 'Chatbar.Textarea';\n\ninterface InlineSlotProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nconst InlineStart = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarInlineStart', className)}>\n {children}\n </Comp>\n );\n});\nInlineStart.displayName = 'Chatbar.InlineStart';\n\nconst InlineEnd = React.forwardRef<HTMLDivElement, InlineSlotProps>((props, forwardedRef) => {\n const { children, asChild, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarInlineEnd', className)}>\n {children}\n </Comp>\n );\n});\nInlineEnd.displayName = 'Chatbar.InlineEnd';\n\n/**\n * Renders a horizontally scrollable list of attachments above the inline row.\n * Hidden when empty unless `forceMount`. Override per-item with `renderAttachment`.\n * `Chatbar.Item`s passed as children follow the attachments in the same row.\n */\ninterface AttachmentsRowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n forceMount?: boolean;\n /** If provided, custom-render a tile; otherwise default tile is used */\n renderAttachment?: (attachment: ChatbarAttachment) => React.ReactNode;\n /** `Chatbar.Item`s: things the message refers to that are not files. */\n children?: React.ReactNode;\n}\n\nconst AttachmentsRow = React.forwardRef<HTMLDivElement, AttachmentsRowProps>((props, forwardedRef) => {\n const { asChild, forceMount, renderAttachment, className, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const hasItems = React.Children.toArray(children).length > 0;\n if (ctx.attachments.length === 0 && !hasItems && !forceMount) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <m.div layout=\"position\" transition={LAYOUT_TRANSITION}>\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarAttachmentsRow', className)} role=\"list\" aria-label={divProps['aria-label'] ?? 'Attachments'}>\n <ScrollArea className=\"rt-ChatbarScrollArea\" scrollbars=\"horizontal\" size=\"1\">\n <Flex align=\"center\" gap=\"2\" minWidth=\"fit-content\">\n {ctx.attachments.map((att) => (\n <Attachment key={att.id} attachment={att} asChild={!!renderAttachment}>\n {renderAttachment?.(att)}\n </Attachment>\n ))}\n {children}\n </Flex>\n </ScrollArea>\n </Comp>\n </m.div>\n );\n});\nAttachmentsRow.displayName = 'Chatbar.AttachmentsRow';\n\n/**\n * Moves focus off a pill that is about to unmount, to the next pill's remove\n * button, the previous one's, or the text, so keyboard users are not dropped\n * to <body>.\n */\nfunction moveFocusOffPill(button: HTMLButtonElement, textareaRef: React.RefObject<HTMLTextAreaElement | null>) {\n const pill = button.closest('[role=\"listitem\"]');\n const pills = pill?.parentElement ? Array.from(pill.parentElement.children) : [];\n const index = pill ? pills.indexOf(pill) : -1;\n const neighbour = pills[index + 1] ?? pills[index - 1];\n const nextButton = neighbour?.querySelector<HTMLButtonElement>('.rt-ChatbarItemRemove');\n if (nextButton) nextButton.focus();\n else textareaRef.current?.focus({ preventScroll: true });\n}\n\n/** The pill an attachment and an item share: a lead tile, a label and \u00D7. */\nconst Pill: React.FC<{\n lead: React.ReactNode;\n leadKind: 'image' | 'icon';\n label: React.ReactNode;\n /** Read after the label by screen readers only, e.g. a file's size. */\n detail?: string;\n removeLabel: string;\n onRemove?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n}> = ({ lead, leadKind, label, detail, removeLabel, onRemove }) => {\n const ctx = useChatbarContext();\n return (\n <>\n <span className=\"rt-ChatbarItemLead\" data-kind={leadKind} aria-hidden>\n {lead}\n </span>\n <Text className=\"rt-ChatbarItemLabel\" size={ctx.size} truncate>\n {label}\n {detail ? <VisuallyHidden>, {detail}</VisuallyHidden> : null}\n </Text>\n {onRemove && (\n <IconButton className=\"rt-ChatbarItemRemove\" aria-label={removeLabel} size=\"1\" variant=\"ghost\" color=\"gray\" onClick={onRemove}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\n/** Default tile renderer for a single attachment. */\ninterface AttachmentProps extends React.ComponentPropsWithoutRef<'div'> {\n attachment: ChatbarAttachment;\n asChild?: boolean;\n}\n\nconst STATUS_LABEL: Partial<Record<AttachmentStatus, string>> = { uploading: 'uploading', error: 'failed to upload' };\n\nconst Attachment = React.forwardRef<HTMLDivElement, AttachmentProps>((props, forwardedRef) => {\n const { attachment, asChild, className, children, ...divProps } = props;\n const ctx = useChatbarContext();\n const Comp = asChild ? Slot : 'div';\n const isImage = !!attachment.url && isImageLike(attachment.name, attachment.type);\n const sizeLabel = `${Math.ceil(attachment.size / 1024)} KB`;\n const statusLabel = attachment.status ? STATUS_LABEL[attachment.status] : undefined;\n const locked = ctx.disabled || ctx.readOnly;\n\n const handleRemove = (event: React.MouseEvent<HTMLButtonElement>) => {\n moveFocusOffPill(event.currentTarget, ctx.textareaRef);\n ctx.removeAttachment(attachment.id);\n };\n\n const lead =\n attachment.status === 'uploading' ? (\n <Spinner size=\"1\" />\n ) : isImage ? (\n <img className=\"rt-ChatbarAttachmentImage\" src={attachment.url} alt=\"\" />\n ) : (\n <FileTextIcon />\n );\n\n return (\n <Comp\n {...divProps}\n ref={forwardedRef}\n className={classNames(children ? 'rt-ChatbarAttachment' : 'rt-ChatbarAttachment rt-ChatbarItem', className)}\n role=\"listitem\"\n data-kind={isImage ? 'image' : 'file'}\n data-status={attachment.status}\n title={attachment.name}\n >\n {children ?? (\n <Pill\n lead={lead}\n leadKind={isImage && attachment.status !== 'uploading' ? 'image' : 'icon'}\n label={attachment.name}\n detail={statusLabel ? `${sizeLabel}, ${statusLabel}` : sizeLabel}\n removeLabel={`Remove ${attachment.name}`}\n onRemove={locked ? undefined : handleRemove}\n />\n )}\n </Comp>\n );\n});\nAttachment.displayName = 'Chatbar.Attachment';\n\n/**\n * Something the message refers to that is not a file: a scene object, a\n * picked mode, a selection. The same pill as an attachment, placed in\n * `Chatbar.AttachmentsRow` as a child. The app owns the list, so removing one\n * calls `onRemove` and nothing else; leave it out for a pill that cannot be\n * removed.\n */\ninterface ItemProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children' | 'color'> {\n /** The label. Also names the remove button: \"Remove {label}\". */\n children: string;\n /** Drawn in the lead tile, tinted with `color`. */\n icon?: React.ReactNode;\n /** A thumbnail for the lead tile, in place of the icon. */\n image?: string;\n /** Tint of the icon tile. Defaults to gray. */\n color?: (typeof accentColors)[number];\n onRemove?: () => void;\n /** Overrides the remove button's label. */\n removeLabel?: string;\n}\n\nconst Item = React.forwardRef<HTMLDivElement, ItemProps>((props, forwardedRef) => {\n const { children, icon, image, color, onRemove, removeLabel, className, ...divProps } = props;\n const ctx = useChatbarContext();\n const locked = ctx.disabled || ctx.readOnly;\n\n const handleRemove = onRemove\n ? (event: React.MouseEvent<HTMLButtonElement>) => {\n moveFocusOffPill(event.currentTarget, ctx.textareaRef);\n onRemove();\n }\n : undefined;\n\n return (\n <div\n {...divProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarItem', className)}\n role=\"listitem\"\n data-accent-color={image ? undefined : (color ?? 'gray')}\n title={children}\n >\n <Pill\n lead={image ? <img className=\"rt-ChatbarAttachmentImage\" src={image} alt=\"\" /> : icon}\n leadKind={image ? 'image' : 'icon'}\n label={children}\n removeLabel={removeLabel ?? `Remove ${children}`}\n onRemove={locked ? undefined : handleRemove}\n />\n </div>\n );\n});\nItem.displayName = 'Chatbar.Item';\n\ninterface AttachTriggerProps extends React.ComponentPropsWithoutRef<'button'> {\n asChild?: boolean;\n /** Overrides Root `accept` for files chosen through this trigger */\n accept?: string | string[];\n multiple?: boolean;\n}\n\nconst AttachTrigger = React.forwardRef<HTMLButtonElement, AttachTriggerProps>((props, forwardedRef) => {\n const { asChild, accept, multiple, disabled: disabledProp, onPointerDown, onClick, ...buttonProps } = props;\n const ctx = useChatbarContext();\n const disabled = disabledProp || ctx.disabled || ctx.readOnly;\n const Comp = asChild ? Slot : 'button';\n return (\n <Comp\n {...buttonProps}\n ref={forwardedRef}\n className={classNames('rt-ChatbarAttachTrigger', buttonProps.className)}\n type={buttonProps.type ?? 'button'}\n aria-label={buttonProps['aria-label'] ?? 'Add attachments'}\n disabled={disabled}\n onPointerDown={(event: React.PointerEvent<HTMLButtonElement>) => {\n onPointerDown?.(event);\n if (!disabled && !event.defaultPrevented) ctx.beginFilePickerPress();\n }}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (disabled || event.defaultPrevented) return;\n ctx.openFilePicker({ accept, multiple });\n }}\n />\n );\n});\nAttachTrigger.displayName = 'Chatbar.AttachTrigger';\n\ninterface RowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nconst Row = React.forwardRef<HTMLDivElement, RowProps>((props, forwardedRef) => {\n const { asChild, children, className, ...divProps } = props;\n const ctx = useChatbarContext();\n if (!ctx.open) return null;\n const Comp = asChild ? Slot : 'div';\n return (\n <m.div layout=\"position\" transition={LAYOUT_TRANSITION}>\n <Comp {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarRow', className)}>\n <Flex align=\"center\" justify=\"between\" width=\"100%\">\n {children}\n </Flex>\n </Comp>\n </m.div>\n );\n});\nRow.displayName = 'Chatbar.Row';\n\ntype RowSlotProps = React.ComponentPropsWithoutRef<'div'>;\n\nconst RowStart = React.forwardRef<HTMLDivElement, RowSlotProps>((props, forwardedRef) => {\n const { className, ...divProps } = props;\n return <div {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarRowStart', className)} />;\n});\nRowStart.displayName = 'Chatbar.RowStart';\n\nconst RowEnd = React.forwardRef<HTMLDivElement, RowSlotProps>((props, forwardedRef) => {\n const { className, ...divProps } = props;\n return <div {...divProps} ref={forwardedRef} className={classNames('rt-ChatbarRowEnd', className)} />;\n});\nRowEnd.displayName = 'Chatbar.RowEnd';\n\ntype SendStatus = 'ready' | 'submitted' | 'streaming' | 'error';\n\ntype SendProps = Omit<IconButtonProps, 'aria-label' | 'aria-labelledby'> & {\n /** Optional override for accessible name. Defaults to \"Send\". */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n asChild?: boolean;\n /** Clear message and attachments after sending. Defaults to Root `clearOnSubmit`. */\n clearOnSend?: boolean;\n /**\n * What the button means. `ready` sends. While a reply is `submitted` or `streaming` and the\n * box is empty, the button STOPS the reply (`onStop`); with a draft in the box it still sends,\n * and the app decides whether sending interrupts the reply. After an `error`, an empty box\n * makes it RETRY (`onRetry`). Default `ready`.\n */\n status?: SendStatus;\n /** Called when the button is pressed to stop a reply. */\n onStop?: () => void;\n /** Called when the button is pressed to retry after an error. */\n onRetry?: () => void;\n /** Accessible name while it stops. Default \"Stop\". */\n stopLabel?: string;\n /** Accessible name while it retries. Default \"Retry\". */\n retryLabel?: string;\n /** Glyph while it stops. Defaults to a square, or a spinner while `submitted`. */\n stopIcon?: React.ReactNode;\n /** Glyph while it retries. */\n retryIcon?: React.ReactNode;\n};\n\nconst Send = React.forwardRef<HTMLButtonElement, SendProps>((props, forwardedRef) => {\n const {\n asChild,\n clearOnSend,\n disabled,\n children,\n style,\n className,\n size: sizeProp,\n variant: variantProp,\n tabIndex,\n onClick,\n status = 'ready',\n onStop,\n onRetry,\n stopLabel = 'Stop',\n retryLabel = 'Retry',\n stopIcon,\n retryIcon,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...buttonProps\n } = props;\n const ctx = useChatbarContext();\n const value = React.useContext(ChatbarValueContext);\n\n const hasContent = hasText(value) || ctx.attachments.length > 0;\n const running = status === 'submitted' || status === 'streaming';\n const mode: 'send' | 'stop' | 'retry' = hasContent ? 'send' : running ? 'stop' : status === 'error' ? 'retry' : 'send';\n\n if (ctx.sendMode === 'never' && mode === 'send') return null;\n\n const visible = mode !== 'send' || ctx.sendMode === 'always' || hasContent;\n const inactive = mode === 'send' ? disabled || ctx.disabled || ctx.readOnly || !hasContent : disabled || ctx.disabled;\n\n const sendName = ariaLabel ?? 'Send';\n const labelProps: { 'aria-label': string } | { 'aria-labelledby': string } =\n mode === 'stop' ? { 'aria-label': stopLabel } : mode === 'retry' ? { 'aria-label': retryLabel } : ariaLabelledby ? { 'aria-labelledby': ariaLabelledby } : { 'aria-label': sendName };\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || inactive) return;\n if (mode === 'stop') {\n onStop?.();\n return;\n }\n if (mode === 'retry') {\n onRetry?.();\n return;\n }\n const clear = clearOnSend ?? ctx.clearOnSubmit;\n // Clearing hides and disables this button; keep keyboard focus in the composer\n if (ctx.submit(clear) && clear) ctx.textareaRef.current?.focus({ preventScroll: true });\n };\n\n const glyph =\n mode === 'stop' ? (\n stopIcon ?? (status === 'submitted' ? <Spinner size={ctx.size} /> : (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2\" />\n </svg>\n ))\n ) : mode === 'retry' ? (\n retryIcon ?? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M3 12a9 9 0 1 0 3-6.7L3 8\" />\n <path d=\"M3 3v5h5\" />\n </svg>\n )\n ) : (\n children ?? (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n )\n );\n\n return (\n <IconButton\n {...buttonProps}\n ref={forwardedRef}\n size={sizeProp ?? ctx.size}\n variant={variantProp ?? (ctx.open || mode !== 'send' ? 'solid' : 'ghost')}\n disabled={inactive}\n className={classNames('rt-ChatbarSend', className)}\n style={{ opacity: visible ? 1 : 0, pointerEvents: visible ? undefined : 'none', ...style }}\n // Hidden Send must not be reachable by keyboard or announced\n aria-hidden={visible ? undefined : true}\n tabIndex={visible ? tabIndex : -1}\n asChild={asChild}\n onClick={handleClick}\n data-status={status}\n data-mode={mode}\n {...labelProps}\n >\n {glyph}\n </IconButton>\n );\n});\nSend.displayName = 'Chatbar.Send';\n\nexport { Root, Textarea, InlineStart, InlineEnd, AttachmentsRow, Attachment, Item, AttachTrigger, Row, RowStart, RowEnd, Send };\nexport type {\n RootProps as ChatbarRootProps,\n TextareaProps as ChatbarTextareaProps,\n InlineSlotProps as ChatbarInlineSlotProps,\n AttachmentsRowProps as ChatbarAttachmentsRowProps,\n AttachmentProps as ChatbarAttachmentProps,\n ItemProps as ChatbarItemProps,\n AttachTriggerProps as ChatbarAttachTriggerProps,\n RowProps as ChatbarRowProps,\n RowSlotProps as ChatbarRowSlotProps,\n SendProps as ChatbarSendProps,\n ChatbarAttachment,\n ChatbarAttachmentRejection,\n ChatbarRejectReason,\n ChatbarSubmitPayload,\n AttachmentStatus as ChatbarAttachmentStatus,\n ExpandOn as ChatbarExpandOn,\n SendMode as ChatbarSendMode,\n SendStatus as ChatbarSendStatus,\n};\n"],
5
- "mappings": "0cAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,mBAAAE,GAAA,eAAAC,GAAA,mBAAAC,GAAA,cAAAC,GAAA,gBAAAC,GAAA,SAAAC,GAAA,SAAAC,GAAA,QAAAC,GAAA,WAAAC,GAAA,aAAAC,GAAA,SAAAC,GAAA,aAAAC,KACA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,cAAAC,GAAY,gBAAAC,GAAc,gBAAAC,GAAc,KAAAC,OAAS,eAC1D,OAAS,mBAAAC,OAAuB,oBAChC,OAAS,eAAAC,OAAmB,iBAgB5B,IAAMC,GAA4B,OAAO,OAAW,IAAoB,kBAAwB,YAoBhG,SAASC,GAAmBC,EAAyBC,EAA2B,CAC9E,GAAM,CAAE,YAAAC,CAAY,EAAIF,EACxB,GAAI,CAACE,EAAa,CAChBD,EAAQ,EACR,MACF,CACAD,EAAG,YAAc,GACjB,GAAI,CACFC,EAAQ,CACV,QAAE,CACAD,EAAG,YAAc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AC,QAAK,EAAE,IAAI,EAAE,IAAI,MAAM,KAAK,OAAO,KAAK,GAAG,IAAI,CAClD,GAEAgQ,IAAS,QACXJ,GACE,gBAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,OAAO,eAAe,YAAY,IAAI,cAAc,QAAQ,eAAe,QAAQ,cAAW,IAC3L,gBAAC,QAAK,EAAE,4BAA4B,EACpC,gBAAC,QAAK,EAAE,WAAW,CACrB,EAGF/N,GACE,gBAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,OAAO,eAAe,YAAY,IAAI,cAAc,QAAQ,eAAe,QAAQ,cAAW,IAC3L,gBAAC,QAAK,EAAE,WAAW,EACnB,gBAAC,QAAK,EAAE,gBAAgB,CAC1B,EAIN,OACE,gBAAC8L,GAAA,CACE,GAAGkB,EACJ,IAAKnN,EACL,KAAMyN,GAAYnP,EAAI,KACtB,QAASoP,IAAgBpP,EAAI,MAAQgQ,IAAS,OAAS,QAAU,SACjE,SAAUE,EACV,UAAW7G,EAAW,iBAAkB1H,CAAS,EACjD,MAAO,CAAE,QAASsO,EAAU,EAAI,EAAG,cAAeA,EAAU,OAAY,OAAQ,GAAGrO,CAAM,EAEzF,cAAaqO,EAAU,OAAY,GACnC,SAAUA,EAAUZ,EAAW,GAC/B,QAASzF,EACT,QAASwG,EACT,cAAad,EACb,YAAWU,EACV,GAAGG,GAEHE,CACH,CAEJ,CAAC,EACDpB,GAAK,YAAc",
6
- "names": ["chatbar_exports", "__export", "AttachTrigger", "Attachment", "AttachmentsRow", "InlineEnd", "InlineStart", "Item", "Root", "Row", "RowEnd", "RowStart", "Send", "Textarea", "React", "classNames", "LazyMotion", "MotionConfig", "domAnimation", "m", "useComposedRefs", "useDropzone", "useIsomorphicLayoutEffect", "withoutPlaceholder", "el", "measure", "placeholder", "LAYOUT_TRANSITION", "ChatbarContext", "ChatbarValueContext", "useChatbarContext", "ctx", "toArray", "val", "s", "matchesAccept", "file", "patterns", "mime", "name", "patRaw", "pat", "type", "subtype", "fmType", "fmSubtype", "IMAGE_EXT_RE", "isImageLike", "hasText", "value", "plural", "n", "word", "attachmentCounter", "createAttachmentId", "Root", "props", "forwardedRef", "className", "style", "children", "valueProp", "defaultValue", "onValueChange", "openProp", "defaultOpen", "onOpenChange", "expandOn", "minLines", "maxLines", "sendMode", "disabled", "readOnly", "onSubmit", "size", "variant", "color", "radius", "panelBackground", "material", "width", "maxWidth", "attachmentsProp", "defaultAttachments", "onAttachmentsChange", "accept", "multiple", "maxAttachments", "maxFileSize", "paste", "pasteAccept", "clearOnSubmit", "onAttachmentReject", "dropzone", "apiRef", "onBlurCapture", "notices", "context", "divProps", "effectiveMaterial", "isValueControlled", "valueUncontrolled", "setValueUncontrolled", "isOpenControlled", "openUncontrolled", "setOpenUncontrolled", "open", "isAttachmentsControlled", "attachmentsUncontrolled", "setAttachmentsUncontrolled", "attachments", "announcement", "setAnnouncementState", "announce", "text", "prev", "rootRef", "composedRootRef", "useComposedRefs", "textareaRef", "fileInputRef", "pickerOpenRef", "pressGuardRef", "pressGuardTimerRef", "pickerRef", "acceptKey", "pasteAcceptKey", "accepts", "pasteAccepts", "snapshot", "latest", "pendingAttachmentsRef", "getAttachments", "setOpen", "next", "setValue", "setAttachments", "ownedUrlsRef", "addFiles", "files", "cfg", "current", "rejected", "remainingSlots", "perActionLimit", "url", "messages", "appendFiles", "appendFilesFromPaste", "removeAttachment", "id", "removed", "a", "submit", "clear", "payload", "att", "owned", "openFilePicker", "options", "input", "beginFilePickerPress", "reset", "handleFileInputChange", "event", "picker", "handleBlurCapture", "rootEl", "nextTarget", "handleDrop", "getRootProps", "isDragActive", "useDropzone", "dragActive", "handleContainerPointerDown", "target", "contextValue", "LazyMotion", "domAnimation", "MotionConfig", "classNames", "NoticeSizeContext", "m", "parseVariant", "Text", "VisuallyHidden", "Textarea", "asChild", "onFocus", "onChange", "onPaste", "onKeyDown", "onCompositionStart", "onCompositionEnd", "submitOnEnter", "textareaProps", "composedRef", "lineHeightRef", "paddingRef", "composingRef", "sizingRef", "recomputeMetrics", "computedStyle", "applyHeight", "isOpen", "min", "max", "lineHeight", "padding", "minHeight", "maxHeight", "contentHeight", "overflowing", "compactHeight", "prevWidth", "ro", "entries", "first", "handleFocus", "handleChange", "handlePaste", "item", "f", "handleCompositionStart", "handleCompositionEnd", "handleKeyDown", "Comp", "Slot", "InlineStart", "InlineEnd", "AttachmentsRow", "forceMount", "renderAttachment", "hasItems", "ScrollArea", "Flex", "Attachment", "moveFocusOffPill", "button", "pill", "pills", "index", "nextButton", "Pill", "lead", "leadKind", "label", "detail", "removeLabel", "onRemove", "IconButton", "CloseIcon", "STATUS_LABEL", "attachment", "isImage", "sizeLabel", "statusLabel", "locked", "handleRemove", "Spinner", "FileTextIcon", "Item", "icon", "image", "AttachTrigger", "disabledProp", "onPointerDown", "onClick", "buttonProps", "Row", "RowStart", "RowEnd", "Send", "clearOnSend", "sizeProp", "variantProp", "tabIndex", "status", "onStop", "onRetry", "stopLabel", "retryLabel", "stopIcon", "retryIcon", "ariaLabel", "ariaLabelledby", "hasContent", "mode", "visible", "inactive", "labelProps", "handleClick", "glyph"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as g}from"./chunk-VK7RNXUO.js";import{a as s}from"./chunk-UCIIRQUE.js";import*as e from"react";import{Toggle as d}from"radix-ui";var B=e.forwardRef(({pressed:a,onPressedChange:u,defaultPressed:p,children:t,...l},f)=>{let{"aria-label":r,"aria-labelledby":o,iconOnly:c}=l,n=e.useRef(null);e.useEffect(()=>{n.current=null},[o]);let i=e.useCallback(()=>r||(o?(n.current===null&&(n.current=document.getElementById(o)?.textContent||"Toggle button"),n.current):typeof t=="string"?t:e.isValidElement(t)&&typeof t.props?.children=="string"?t.props.children:"Toggle button"),[r,o,t]),{handlePressedChange:m}=g({pressed:a,onPressedChange:u,getAccessibleName:i,componentName:c?"ToggleIconButton":"ToggleButton"});return e.createElement(d.Root,{pressed:a,onPressedChange:m,defaultPressed:p,asChild:!0},e.createElement(s,{...l,ref:f},t))});B.displayName="ToggleButton";export{B as a};
2
- //# sourceMappingURL=chunk-KDYHYQ4D.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/toggle-button.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { Toggle } from 'radix-ui';\nimport { Button } from './button.js';\nimport { useToggleState } from '../hooks/use-toggle-state.js';\n\n/**\n * ToggleButton props that extend Button with toggle-specific functionality\n *\n * The ToggleButton component provides a button that can be pressed/unpressed\n * with proper accessibility announcements and state management.\n */\ntype ToggleButtonProps = React.ComponentPropsWithoutRef<typeof Button> & {\n /** Controlled pressed state */\n pressed?: boolean;\n /** Callback when pressed state changes */\n onPressedChange?: (pressed: boolean) => void;\n /** Default pressed state for uncontrolled usage */\n defaultPressed?: boolean;\n};\n\ntype ToggleButtonElement = React.ElementRef<typeof Button>;\n\n/**\n * ToggleButton component for buttons that can be pressed/unpressed\n *\n * The ToggleButton component extends Button with toggle functionality using\n * Radix UI's Toggle primitive. It provides proper accessibility announcements,\n * controlled/uncontrolled state management, and seamless integration with\n * the existing Button component.\n *\n * Key features:\n * - Controlled and uncontrolled state management\n * - Live accessibility announcements for screen readers\n * - Automatic state validation and warnings\n * - Seamless integration with Button props and styling\n * - Proper ARIA attributes for toggle functionality\n *\n * @example\n * ```tsx\n * // Uncontrolled toggle button\n * <ToggleButton defaultPressed={false}>\n * Toggle Me\n * </ToggleButton>\n *\n * // Controlled toggle button\n * const [pressed, setPressed] = React.useState(false);\n * <ToggleButton\n * pressed={pressed}\n * onPressedChange={setPressed}\n * >\n * {pressed ? 'On' : 'Off'}\n * </ToggleButton>\n *\n * // Toggle button with all Button props\n * <ToggleButton\n * variant=\"solid\"\n * size=\"3\"\n * color=\"blue\"\n * pressed={isActive}\n * onPressedChange={setIsActive}\n * >\n * {isActive ? 'Active' : 'Inactive'}\n * </ToggleButton>\n * ```\n */\nconst ToggleButton = React.forwardRef<ToggleButtonElement, ToggleButtonProps>(({ pressed, onPressedChange, defaultPressed, children, ...buttonProps }, forwardedRef) => {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, iconOnly } = buttonProps;\n\n // The label behind aria-labelledby is read once per id, not on every press.\n const cachedLabelRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n cachedLabelRef.current = null;\n }, [ariaLabelledBy]);\n\n /**\n * The name announced when the pressed state changes: aria-label, then the label\n * aria-labelledby points at, then visible text.\n */\n const getAccessibleName = React.useCallback(() => {\n if (ariaLabel) return ariaLabel;\n if (ariaLabelledBy) {\n if (cachedLabelRef.current === null) {\n cachedLabelRef.current = document.getElementById(ariaLabelledBy)?.textContent || 'Toggle button';\n }\n return cachedLabelRef.current;\n }\n if (typeof children === 'string') return children;\n if (React.isValidElement(children) && typeof (children.props as any)?.children === 'string') {\n return (children.props as any).children;\n }\n return 'Toggle button';\n }, [ariaLabel, ariaLabelledBy, children]);\n\n // Use shared toggle state hook for accessibility announcements and warnings\n const { handlePressedChange } = useToggleState({\n pressed,\n onPressedChange,\n getAccessibleName,\n componentName: iconOnly ? 'ToggleIconButton' : 'ToggleButton',\n });\n\n // Render the toggle button using Radix UI's Toggle primitive\n // This provides proper ARIA attributes and keyboard navigation\n return (\n <Toggle.Root pressed={pressed} onPressedChange={handlePressedChange} defaultPressed={defaultPressed} asChild>\n <Button {...buttonProps} ref={forwardedRef}>\n {children}\n </Button>\n </Toggle.Root>\n );\n});\nToggleButton.displayName = 'ToggleButton';\n\nexport { ToggleButton };\nexport type { ToggleButtonProps };\n"],
5
- "mappings": "gFAAA,UAAYA,MAAW,QACvB,OAAS,UAAAC,MAAc,WAgEvB,IAAMC,EAAqB,aAAmD,CAAC,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,eAAAC,EAAgB,SAAAC,EAAU,GAAGC,CAAY,EAAGC,IAAiB,CACtK,GAAM,CAAE,aAAcC,EAAW,kBAAmBC,EAAgB,SAAAC,CAAS,EAAIJ,EAG3EK,EAAuB,SAAsB,IAAI,EACjD,YAAU,IAAM,CACpBA,EAAe,QAAU,IAC3B,EAAG,CAACF,CAAc,CAAC,EAMnB,IAAMG,EAA0B,cAAY,IACtCJ,IACAC,GACEE,EAAe,UAAY,OAC7BA,EAAe,QAAU,SAAS,eAAeF,CAAc,GAAG,aAAe,iBAE5EE,EAAe,SAEpB,OAAON,GAAa,SAAiBA,EAC/B,iBAAeA,CAAQ,GAAK,OAAQA,EAAS,OAAe,UAAa,SACzEA,EAAS,MAAc,SAE1B,iBACN,CAACG,EAAWC,EAAgBJ,CAAQ,CAAC,EAGlC,CAAE,oBAAAQ,CAAoB,EAAIC,EAAe,CAC7C,QAAAZ,EACA,gBAAAC,EACA,kBAAAS,EACA,cAAeF,EAAW,mBAAqB,cACjD,CAAC,EAID,OACE,gBAACK,EAAO,KAAP,CAAY,QAASb,EAAS,gBAAiBW,EAAqB,eAAgBT,EAAgB,QAAO,IAC1G,gBAACY,EAAA,CAAQ,GAAGV,EAAa,IAAKC,GAC3BF,CACH,CACF,CAEJ,CAAC,EACDJ,EAAa,YAAc",
6
- "names": ["React", "Toggle", "ToggleButton", "pressed", "onPressedChange", "defaultPressed", "children", "buttonProps", "forwardedRef", "ariaLabel", "ariaLabelledBy", "iconOnly", "cachedLabelRef", "getAccessibleName", "handlePressedChange", "useToggleState", "Toggle", "Button"]
7
- }
@@ -1,2 +0,0 @@
1
- import{a as d}from"./chunk-YEYM7QQZ.js";import{a as m}from"./chunk-5BWLY27A.js";import{a as v}from"./chunk-OS3FCYZY.js";var C={};v(C,{Button:()=>P,Content:()=>f,Item:()=>g,Root:()=>u,Viewport:()=>S,useMessageScroller:()=>y,useMessageScrollerScrollable:()=>w,useMessageScrollerVisibility:()=>B});import*as e from"react";import c from"classnames";import{MessageScroller as l,useMessageScroller as y,useMessageScrollerScrollable as w,useMessageScrollerVisibility as B}from"@shadcn/react/message-scroller";import{useComposedRefs as h}from"radix-ui/internal";var u=e.forwardRef(({autoScroll:o=!0,defaultScrollPosition:t="end",scrollEdgeThreshold:r,scrollMargin:s,className:a,children:n,...i},p)=>e.createElement(l.Provider,{autoScroll:o,defaultScrollPosition:t,...r!=null?{scrollEdgeThreshold:r}:{},...s!=null?{scrollMargin:s}:{}},e.createElement(l.Root,{...i,ref:p,className:c("rt-MessageScrollerRoot",a)},n)));u.displayName="MessageScroller.Root";var S=e.forwardRef(({className:o,"aria-label":t,fade:r=!0,...s},a)=>{let n=m(r),i=h(a,n);return e.createElement(l.Viewport,{"aria-label":t??"",...s,ref:i,"data-fade":r?"":void 0,className:c("rt-MessageScrollerViewport",o)})});S.displayName="MessageScroller.Viewport";var f=e.forwardRef(({className:o,...t},r)=>e.createElement(l.Content,{...t,ref:r,className:c("rt-MessageScrollerContent",o)}));f.displayName="MessageScroller.Content";var g=e.forwardRef(({className:o,...t},r)=>e.createElement(l.Item,{...t,ref:r,className:c("rt-MessageScrollerItem",o)}));g.displayName="MessageScroller.Item";var P=e.forwardRef(({direction:o="end",behavior:t,className:r,children:s,size:a="2",variant:n="surface",color:i="gray",radius:p="full","aria-label":M,...R},b)=>e.createElement(l.Button,{direction:o,...t?{behavior:t}:{},render:e.createElement(d,{...R,ref:b,size:a,variant:n,color:i,radius:p,"aria-label":M??(o==="end"?"Jump to the latest":"Jump to the first"),className:c("rt-MessageScrollerButton",r),"data-direction":o},s??e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none","aria-hidden":!0,style:o==="start"?{transform:"rotate(180deg)"}:void 0},e.createElement("path",{d:"M7.5 2.5v10M3.5 8.5l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})))}));P.displayName="MessageScroller.Button";export{y as a,w as b,B as c,u as d,S as e,f,g,P as h,C as i};
2
- //# sourceMappingURL=chunk-RJTWRLK4.js.map