@refraction-ui/react 0.20.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/dist/{chunk-ZF3OHCGV.js → chunk-2Q6HHFAN.js} +1 -1
  2. package/dist/chunk-2Q6HHFAN.js.map +7 -0
  3. package/dist/{chunk-533MCMSU.js → chunk-3I3DYDHR.js} +2 -2
  4. package/dist/{chunk-F7B64KT3.js → chunk-3Y2T26QD.js} +13 -7
  5. package/dist/chunk-3Y2T26QD.js.map +7 -0
  6. package/dist/{chunk-H54FLNAF.js → chunk-63N4PZUJ.js} +2 -2
  7. package/dist/{chunk-Y2FNNAIL.js → chunk-EGVPAMQU.js} +2 -2
  8. package/dist/chunk-EGVPAMQU.js.map +1 -0
  9. package/dist/{chunk-WK2IIUFO.js → chunk-QDMLIDYN.js} +2 -2
  10. package/dist/{chunk-BOLFYVI6.js → chunk-QPCKJ2YR.js} +2 -2
  11. package/dist/{chunk-TOZBR4GL.js → chunk-RSWOLRIC.js} +4 -4
  12. package/dist/{chunk-TOZBR4GL.js.map → chunk-RSWOLRIC.js.map} +1 -1
  13. package/dist/{chunk-UNEM2TRI.js → chunk-SDAJVXD4.js} +2 -2
  14. package/dist/{chunk-VK3EQ34F.js → chunk-V24GDHUX.js} +2 -2
  15. package/dist/{chunk-AMK4VCBG.js → chunk-WYKPPK3W.js} +2 -2
  16. package/dist/{chunk-ONACRMG4.js → chunk-XMFNBOPO.js} +2 -2
  17. package/dist/form.cjs.map +1 -1
  18. package/dist/form.js +1 -1
  19. package/dist/index.cjs +632 -47
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +4 -0
  22. package/dist/index.d.ts +4 -0
  23. package/dist/index.js +4 -0
  24. package/dist/internal/action-list/index.d.ts +39 -0
  25. package/dist/internal/badge/index.d.cts +2 -2
  26. package/dist/internal/badge/index.d.ts +2 -2
  27. package/dist/internal/button/index.d.cts +4 -4
  28. package/dist/internal/button/index.d.ts +4 -4
  29. package/dist/internal/card/index.d.cts +14 -2
  30. package/dist/internal/card/index.d.ts +14 -2
  31. package/dist/internal/funnel-chart/index.d.ts +60 -0
  32. package/dist/internal/line-chart/index.d.ts +110 -0
  33. package/dist/internal/page-header/index.d.ts +35 -0
  34. package/dist/internal/react-action-list/index.d.ts +28 -0
  35. package/dist/internal/react-card/index.d.cts +12 -3
  36. package/dist/internal/react-card/index.d.ts +12 -3
  37. package/dist/internal/react-funnel-chart/index.d.ts +28 -0
  38. package/dist/internal/react-line-chart/index.d.ts +33 -0
  39. package/dist/internal/react-page-header/index.d.ts +23 -0
  40. package/dist/internal/react-select/index.d.cts +21 -3
  41. package/dist/internal/react-select/index.d.ts +21 -3
  42. package/dist/internal/react-separator/index.d.cts +6 -1
  43. package/dist/internal/react-separator/index.d.ts +6 -1
  44. package/dist/internal/select/index.d.cts +14 -1
  45. package/dist/internal/select/index.d.ts +14 -1
  46. package/dist/internal/separator/index.d.cts +6 -1
  47. package/dist/internal/separator/index.d.ts +6 -1
  48. package/dist/internal/shared/index.d.cts +6 -3
  49. package/dist/internal/shared/index.d.ts +6 -3
  50. package/dist/internal/tabs/index.d.cts +8 -1
  51. package/dist/internal/tabs/index.d.ts +8 -1
  52. package/dist/react-accordion.js +1 -1
  53. package/dist/react-action-list.js +74 -0
  54. package/dist/react-action-list.js.map +7 -0
  55. package/dist/react-ai.js +1 -1
  56. package/dist/react-analytics.js +1 -1
  57. package/dist/react-animated-text.js +1 -1
  58. package/dist/react-app-shell.js +1 -1
  59. package/dist/react-audience-feature-card.js +1 -1
  60. package/dist/react-audio-room.js +1 -1
  61. package/dist/react-auth.js +1 -1
  62. package/dist/react-avatar-group.js +1 -1
  63. package/dist/react-avatar.js +1 -1
  64. package/dist/react-badge.js +16 -4
  65. package/dist/react-badge.js.map +2 -2
  66. package/dist/react-bottom-nav.js +1 -1
  67. package/dist/react-brand-network-cell.js +1 -1
  68. package/dist/react-breadcrumbs.js +1 -1
  69. package/dist/react-browser-chrome-mock.js +1 -1
  70. package/dist/react-browser-chrome-mock.js.map +2 -2
  71. package/dist/react-button.js +3 -3
  72. package/dist/react-calendar.js +1 -1
  73. package/dist/react-call-controls.js +1 -1
  74. package/dist/react-callout.js +8 -3
  75. package/dist/react-callout.js.map +2 -2
  76. package/dist/react-card-grid.js +1 -1
  77. package/dist/react-card.js +15 -6
  78. package/dist/react-card.js.map +2 -2
  79. package/dist/react-carousel.js +1 -1
  80. package/dist/react-charts.js +1 -1
  81. package/dist/react-checkbox.js +1 -1
  82. package/dist/react-checklist.js +1 -1
  83. package/dist/react-code-block.js +1 -1
  84. package/dist/react-code-editor.js +1 -1
  85. package/dist/react-collapsible.js +1 -1
  86. package/dist/react-combobox.js +1 -1
  87. package/dist/react-command-input.js +1 -1
  88. package/dist/react-command.js +1 -1
  89. package/dist/react-composer.js +3 -3
  90. package/dist/react-content-protection.js +1 -1
  91. package/dist/react-conversation.js +5 -5
  92. package/dist/react-cookie-consent.js +1 -1
  93. package/dist/react-data-table.js +1 -1
  94. package/dist/react-date-picker.js +1 -1
  95. package/dist/react-device-frame.js +1 -1
  96. package/dist/react-dialog.js +2 -2
  97. package/dist/react-diff-viewer.js +4 -1
  98. package/dist/react-diff-viewer.js.map +2 -2
  99. package/dist/react-dropdown-menu.js +1 -1
  100. package/dist/react-editor-status-bar.js +1 -1
  101. package/dist/react-editor-tabs.js +1 -1
  102. package/dist/react-emoji-picker.js +2 -2
  103. package/dist/react-empty-state.js +1 -1
  104. package/dist/react-feedback-dialog.js +2 -2
  105. package/dist/react-file-tree.js +1 -1
  106. package/dist/react-file-upload.js +1 -1
  107. package/dist/react-floating-reactions.js +1 -1
  108. package/dist/react-flow-editor.js +2 -2
  109. package/dist/react-footer.js +1 -1
  110. package/dist/react-funnel-chart.js +105 -0
  111. package/dist/react-funnel-chart.js.map +7 -0
  112. package/dist/react-graph-view.js +2 -2
  113. package/dist/react-infinite-canvas.js +2 -2
  114. package/dist/react-inline-editor.js +1 -1
  115. package/dist/react-input-group.js +1 -1
  116. package/dist/react-input.js +2 -2
  117. package/dist/react-install-prompt.js +1 -1
  118. package/dist/react-kanban-board.js +1 -1
  119. package/dist/react-keyboard-shortcut.js +2 -2
  120. package/dist/react-language-selector.js +1 -1
  121. package/dist/react-line-chart.js +242 -0
  122. package/dist/react-line-chart.js.map +7 -0
  123. package/dist/react-link-card.js +1 -1
  124. package/dist/react-live-captions.js +1 -1
  125. package/dist/react-live-cursors.js +1 -1
  126. package/dist/react-live-transcript.js +1 -1
  127. package/dist/react-location-selector.js +1 -1
  128. package/dist/react-logger.js +1 -1
  129. package/dist/react-markdown-renderer.js +2 -2
  130. package/dist/react-marquee-strip.js +1 -1
  131. package/dist/react-mascot.js +1 -1
  132. package/dist/react-mastery-bar.js +1 -1
  133. package/dist/react-mini-map.js +1 -1
  134. package/dist/react-mobile-nav.js +1 -1
  135. package/dist/react-navbar.js +1 -1
  136. package/dist/react-numbered-steps.js +1 -1
  137. package/dist/react-otp-input.js +1 -1
  138. package/dist/react-page-header.js +40 -0
  139. package/dist/react-page-header.js.map +7 -0
  140. package/dist/react-pagination.js +1 -1
  141. package/dist/react-password-input.js +2 -2
  142. package/dist/react-payment.js +1 -1
  143. package/dist/react-popover.js +1 -1
  144. package/dist/react-pre-call-lobby.js +1 -1
  145. package/dist/react-presence-indicator.js +1 -1
  146. package/dist/react-pricing-card.js +1 -1
  147. package/dist/react-progress-display.js +2 -2
  148. package/dist/react-progress-display.js.map +1 -1
  149. package/dist/react-radial-gauge.js +1 -1
  150. package/dist/react-radio.js +1 -1
  151. package/dist/react-rating-scale.js +1 -1
  152. package/dist/react-reaction-bar.js +1 -1
  153. package/dist/react-resizable-layout.js +1 -1
  154. package/dist/react-search-bar.js +1 -1
  155. package/dist/react-section-head.js +1 -1
  156. package/dist/react-segmented-control.js +1 -1
  157. package/dist/react-select.js +94 -20
  158. package/dist/react-select.js.map +3 -3
  159. package/dist/react-separator.js +19 -7
  160. package/dist/react-separator.js.map +2 -2
  161. package/dist/react-sheet.js +1 -1
  162. package/dist/react-sidebar.js +1 -1
  163. package/dist/react-skeleton.js +1 -1
  164. package/dist/react-skip-to-content.js +1 -1
  165. package/dist/react-slide-viewer.js +3 -1
  166. package/dist/react-slide-viewer.js.map +2 -2
  167. package/dist/react-slider.js +1 -1
  168. package/dist/react-slot-picker.js +1 -1
  169. package/dist/react-social-auth-button.js +3 -3
  170. package/dist/react-sortable-list.js +1 -1
  171. package/dist/react-stat-grid.js +1 -1
  172. package/dist/react-status-indicator.js +1 -1
  173. package/dist/react-steps.js +1 -1
  174. package/dist/react-sticky-note.js +3 -1
  175. package/dist/react-sticky-note.js.map +2 -2
  176. package/dist/react-switch.js +1 -1
  177. package/dist/react-table-of-contents.js +1 -1
  178. package/dist/react-tabs.js +50 -2
  179. package/dist/react-tabs.js.map +2 -2
  180. package/dist/react-terminal.js +1 -1
  181. package/dist/react-test-results.js +1 -1
  182. package/dist/react-textarea.js +3 -3
  183. package/dist/react-textarea.js.map +1 -1
  184. package/dist/react-thread-view.js +2 -2
  185. package/dist/react-timeline.js +1 -1
  186. package/dist/react-toast.js +1 -1
  187. package/dist/react-tooltip.js +1 -1
  188. package/dist/react-version-selector.js +1 -1
  189. package/dist/react-video-grid.js +2 -2
  190. package/dist/react-video-player.js +1 -1
  191. package/dist/react-video-tile.js +2 -2
  192. package/dist/react-voice-pill.js +1 -1
  193. package/dist/react-waveform.js +1 -1
  194. package/dist/react-wizard.js +1 -1
  195. package/dist/styles.css +48 -0
  196. package/dist/theme.js +1 -1
  197. package/package.json +5 -1
  198. package/dist/chunk-F7B64KT3.js.map +0 -7
  199. package/dist/chunk-Y2FNNAIL.js.map +0 -1
  200. package/dist/chunk-ZF3OHCGV.js.map +0 -7
  201. /package/dist/{chunk-533MCMSU.js.map → chunk-3I3DYDHR.js.map} +0 -0
  202. /package/dist/{chunk-H54FLNAF.js.map → chunk-63N4PZUJ.js.map} +0 -0
  203. /package/dist/{chunk-WK2IIUFO.js.map → chunk-QDMLIDYN.js.map} +0 -0
  204. /package/dist/{chunk-BOLFYVI6.js.map → chunk-QPCKJ2YR.js.map} +0 -0
  205. /package/dist/{chunk-UNEM2TRI.js.map → chunk-SDAJVXD4.js.map} +0 -0
  206. /package/dist/{chunk-VK3EQ34F.js.map → chunk-V24GDHUX.js.map} +0 -0
  207. /package/dist/{chunk-AMK4VCBG.js.map → chunk-WYKPPK3W.js.map} +0 -0
  208. /package/dist/{chunk-ONACRMG4.js.map → chunk-XMFNBOPO.js.map} +0 -0
@@ -161,4 +161,4 @@ export {
161
161
  prefersReducedMotion,
162
162
  devWarn
163
163
  };
164
- //# sourceMappingURL=chunk-ZF3OHCGV.js.map
164
+ //# sourceMappingURL=chunk-2Q6HHFAN.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../shared/src/aria.ts", "../../shared/src/keyboard.ts", "../../shared/src/state-machine.ts", "../../shared/src/cn.ts", "../../shared/src/cva.ts", "../../shared/src/focus-trap.ts", "../../shared/src/live-region.ts", "../../shared/src/motion.ts", "../../shared/src/skip-link.ts", "../../shared/src/dev-feedback.ts", "../../shared/src/library-origin-error.ts"],
4
+ "sourcesContent": ["/** Merge multiple ARIA prop objects, later values override earlier ones */\nexport function mergeAriaProps(\n ...propSets: Array<Record<string, unknown>>\n): Record<string, unknown> {\n const result: Record<string, unknown> = {}\n for (const props of propSets) {\n for (const [key, value] of Object.entries(props)) {\n if (value !== undefined) {\n result[key] = value\n }\n }\n }\n return result\n}\n\nlet idCounter = 0\n\n/**\n * Generate a unique ID, safe for SSR (deterministic within a render pass).\n * In browsers, uses crypto.randomUUID when available.\n */\nexport function generateId(prefix = 'rfr'): string {\n idCounter++\n return `${prefix}-${idCounter}`\n}\n\n/** Reset the ID counter (useful for tests) */\nexport function resetIdCounter(): void {\n idCounter = 0\n}\n", "/** Standard keyboard key constants */\nexport const Keys = {\n Enter: 'Enter',\n Space: ' ',\n Escape: 'Escape',\n Tab: 'Tab',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n Backspace: 'Backspace',\n Delete: 'Delete',\n} as const\n\nexport type KeyboardKey = (typeof Keys)[keyof typeof Keys]\n\n/** Map of key → handler function */\nexport type KeyboardHandlerMap = Partial<\n Record<string, (event: KeyboardEvent) => void>\n>\n\n/** Create a keyboard event handler from a handler map */\nexport function createKeyboardHandler(\n handlers: KeyboardHandlerMap,\n): (event: KeyboardEvent) => void {\n return (event: KeyboardEvent) => {\n const handler = handlers[event.key]\n if (handler) {\n handler(event)\n }\n }\n}\n", "/**\n * Minimal state machine — zero dependencies, < 1KB.\n * Inspired by XState concepts but dramatically simpler.\n */\n\nexport interface MachineConfig<TState extends string, TEvent extends string> {\n initial: TState\n states: Record<TState, {\n on?: Partial<Record<TEvent, TState>>\n }>\n}\n\nexport interface Machine<TState extends string, TEvent extends string> {\n /** Current state */\n state: TState\n /** Send an event to transition */\n send(event: TEvent): void\n /** Subscribe to state changes. Returns unsubscribe function. */\n subscribe(fn: (state: TState) => void): () => void\n /** Check if machine is in a given state */\n matches(state: TState): boolean\n}\n\nexport function createMachine<TState extends string, TEvent extends string>(\n config: MachineConfig<TState, TEvent>,\n): Machine<TState, TEvent> {\n let current = config.initial\n const listeners = new Set<(state: TState) => void>()\n\n return {\n get state() {\n return current\n },\n\n send(event: TEvent) {\n const stateConfig = config.states[current]\n const next = stateConfig?.on?.[event]\n if (next && next !== current) {\n current = next\n for (const fn of listeners) {\n fn(current)\n }\n }\n },\n\n subscribe(fn: (state: TState) => void) {\n listeners.add(fn)\n return () => {\n listeners.delete(fn)\n }\n },\n\n matches(state: TState) {\n return current === state\n },\n }\n}\n", "/**\n * Lightweight class name utility — our own implementation.\n * Handles conditional classes, arrays, and falsy values.\n * No external dependencies (no clsx, no tailwind-merge).\n *\n * It does NOT resolve Tailwind conflicts: `cn('p-2', 'p-4')` keeps both and\n * the stylesheet order decides. Components therefore keep size-owned\n * utilities (height, text size, padding) out of their cva `base` and only in\n * the matching variant, so a variant prop always wins; a consumer `className`\n * that must beat a component utility can use Tailwind's `!` important\n * modifier (e.g. `!h-7`).\n */\n\ntype ClassValue = string | number | boolean | undefined | null | ClassValue[]\ntype ClassRecord = Record<string, boolean | undefined | null>\n\nexport function cn(...inputs: Array<ClassValue | ClassRecord>): string {\n const classes: string[] = []\n\n for (const input of inputs) {\n if (!input) continue\n\n if (typeof input === 'string') {\n classes.push(input)\n } else if (typeof input === 'number') {\n classes.push(String(input))\n } else if (Array.isArray(input)) {\n const nested = cn(...input)\n if (nested) classes.push(nested)\n } else if (typeof input === 'object') {\n for (const [key, value] of Object.entries(input)) {\n if (value) classes.push(key)\n }\n }\n }\n\n return classes.join(' ')\n}\n", "/**\n * Lightweight class-variance-authority alternative — zero dependencies.\n * Creates variant-driven class name functions for components.\n */\n\ninterface VariantConfig {\n [variant: string]: Record<string, string>\n}\n\ninterface CVAConfig<V extends VariantConfig> {\n base?: string\n variants?: V\n defaultVariants?: {\n [K in keyof V]?: keyof V[K]\n }\n compoundVariants?: Array<\n {\n [K in keyof V]?: keyof V[K]\n } & { class: string }\n >\n}\n\ntype VariantProps<V extends VariantConfig> = {\n [K in keyof V]?: keyof V[K]\n}\n\nexport function cva<V extends VariantConfig>(config: CVAConfig<V>) {\n return (props?: VariantProps<V> & { className?: string }): string => {\n const classes: string[] = []\n\n if (config.base) {\n classes.push(config.base)\n }\n\n if (config.variants) {\n for (const [variantKey, variantOptions] of Object.entries(config.variants)) {\n const selectedValue =\n (props as Record<string, unknown> | undefined)?.[variantKey] ??\n config.defaultVariants?.[variantKey]\n\n if (selectedValue != null) {\n const variantClass = (variantOptions as Record<string, string>)[\n selectedValue as string\n ]\n if (variantClass) {\n classes.push(variantClass)\n }\n }\n }\n }\n\n if (config.compoundVariants) {\n for (const compound of config.compoundVariants) {\n const { class: compoundClass, ...conditions } = compound\n let matches = true\n\n for (const [key, value] of Object.entries(conditions)) {\n const propValue =\n (props as Record<string, unknown>)?.[key] ??\n config.defaultVariants?.[key]\n if (propValue !== value) {\n matches = false\n break\n }\n }\n\n if (matches) {\n classes.push(compoundClass as string)\n }\n }\n }\n\n if (props?.className) {\n classes.push(props.className)\n }\n\n return classes.filter(Boolean).join(' ')\n }\n}\n", "/**\n * Focus trap utilities — keeps keyboard focus within a container.\n * Used by Dialog, DropdownMenu, and other overlay components.\n * Pure TypeScript, no DOM dependency (accepts element via parameter).\n */\n\n/** Selector for all natively focusable elements */\nexport const FOCUSABLE_SELECTOR =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\n/** Get all focusable elements within a container */\nexport function getFocusableElements(container: Element): Element[] {\n return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR))\n}\n\n/** Configuration for creating a focus trap */\nexport interface FocusTrapConfig {\n /** The container element */\n container: Element\n /** Called to get the initial focus target */\n initialFocus?: () => Element | null\n /** Called when Escape is pressed */\n onEscape?: () => void\n /** Whether to return focus to trigger on deactivate */\n returnFocusOnDeactivate?: boolean\n}\n\n/** A focus trap instance */\nexport interface FocusTrap {\n activate(): void\n deactivate(): void\n isActive(): boolean\n}\n\n/** Create a focus trap that keeps Tab/Shift+Tab within a container */\nexport function createFocusTrap(config: FocusTrapConfig): FocusTrap {\n let active = false\n let previouslyFocused: Element | null = null\n\n function handleKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape' && config.onEscape) {\n event.preventDefault()\n config.onEscape()\n return\n }\n\n if (event.key !== 'Tab') return\n\n const focusable = getFocusableElements(config.container)\n if (focusable.length === 0) return\n\n const first = focusable[0] as HTMLElement\n const last = focusable[focusable.length - 1] as HTMLElement\n\n if (event.shiftKey) {\n // Shift+Tab: if on first element, wrap to last\n if (document.activeElement === first) {\n event.preventDefault()\n last.focus()\n }\n } else {\n // Tab: if on last element, wrap to first\n if (document.activeElement === last) {\n event.preventDefault()\n first.focus()\n }\n }\n }\n\n return {\n activate() {\n if (active) return\n active = true\n\n // Remember the currently focused element so we can restore it later\n if (typeof document !== 'undefined') {\n previouslyFocused = document.activeElement\n }\n\n // Set initial focus\n if (config.initialFocus) {\n const target = config.initialFocus()\n if (target && 'focus' in target) {\n (target as HTMLElement).focus()\n }\n } else {\n const focusable = getFocusableElements(config.container)\n if (focusable.length > 0) {\n (focusable[0] as HTMLElement).focus()\n }\n }\n\n // Attach keydown listener to the container\n config.container.addEventListener(\n 'keydown',\n handleKeyDown as EventListener,\n )\n },\n\n deactivate() {\n if (!active) return\n active = false\n\n config.container.removeEventListener(\n 'keydown',\n handleKeyDown as EventListener,\n )\n\n // Restore focus to the previously focused element\n if (\n config.returnFocusOnDeactivate !== false &&\n previouslyFocused &&\n 'focus' in previouslyFocused\n ) {\n (previouslyFocused as HTMLElement).focus()\n }\n },\n\n isActive() {\n return active\n },\n }\n}\n", "/**\n * Screen reader announcement utility.\n * Creates and manages an aria-live region for dynamic content updates.\n */\n\nexport interface LiveRegionConfig {\n /** 'polite' (default) or 'assertive' */\n politeness?: 'polite' | 'assertive'\n /** Clear the announcement after this many ms. Default: 5000 */\n clearAfterMs?: number\n}\n\nexport interface LiveRegion {\n announce(message: string): void\n clear(): void\n destroy(): void\n}\n\n/** Create a live region that announces messages to screen readers */\nexport function createLiveRegion(config: LiveRegionConfig = {}): LiveRegion {\n const { politeness = 'polite', clearAfterMs = 5000 } = config\n let element: HTMLElement | null = null\n let clearTimeout: ReturnType<typeof setTimeout> | null = null\n\n function getElement(): HTMLElement {\n if (!element && typeof document !== 'undefined') {\n element = document.createElement('div')\n element.setAttribute('role', 'status')\n element.setAttribute('aria-live', politeness)\n element.setAttribute('aria-atomic', 'true')\n // Visually hidden but accessible to screen readers\n Object.assign(element.style, {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: '0',\n })\n document.body.appendChild(element)\n }\n return element!\n }\n\n return {\n announce(message: string): void {\n const el = getElement()\n if (!el) return\n\n // Clear any pending timeout\n if (clearTimeout !== null) {\n globalThis.clearTimeout(clearTimeout)\n }\n\n // Set text content — screen readers will detect the change via aria-live\n el.textContent = message\n\n if (clearAfterMs > 0) {\n clearTimeout = globalThis.setTimeout(() => {\n el.textContent = ''\n clearTimeout = null\n }, clearAfterMs)\n }\n },\n\n clear(): void {\n if (clearTimeout !== null) {\n globalThis.clearTimeout(clearTimeout)\n clearTimeout = null\n }\n if (element) {\n element.textContent = ''\n }\n },\n\n destroy(): void {\n if (clearTimeout !== null) {\n globalThis.clearTimeout(clearTimeout)\n clearTimeout = null\n }\n if (element && element.parentNode) {\n element.parentNode.removeChild(element)\n element = null\n }\n },\n }\n}\n", "/**\n * Reduced motion utilities.\n * Respects user preferences for reduced motion.\n */\n\n/** Check if user prefers reduced motion */\nexport function prefersReducedMotion(): boolean {\n if (typeof window === 'undefined') return false\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n}\n\n/** Get animation duration — returns '0ms' if reduced motion preferred */\nexport function getAnimationDuration(normalDuration: string): string {\n return prefersReducedMotion() ? '0ms' : normalDuration\n}\n", "/**\n * Skip-to-content link utility.\n * Provides a keyboard-accessible link that is visually hidden until focused.\n */\n\n/** Props for a skip-to-content link */\nexport interface SkipLinkProps {\n /** ID of the target element. Default: 'main-content' */\n targetId?: string\n /** Label text for the link. Default: 'Skip to main content' */\n label?: string\n}\n\n/** Create props for a skip-to-content link */\nexport function createSkipLink(props: SkipLinkProps = {}): {\n ariaProps: Record<string, string>\n href: string\n label: string\n /** CSS classes — visually hidden until focused */\n className: string\n} {\n const targetId = props.targetId ?? 'main-content'\n const label = props.label ?? 'Skip to main content'\n\n return {\n ariaProps: {\n role: 'link',\n 'aria-label': label,\n },\n href: `#${targetId}`,\n label,\n className:\n 'sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4 focus:bg-white focus:text-black focus:underline',\n }\n}\n", "/**\n * dev-feedback — zero-dependency `devWarn` / `devError` primitives.\n *\n * Design constraints (epic #247, issue #248):\n * - Guarded by `process.env.NODE_ENV !== 'production'` so production bundlers\n * dead-code-strip every call (the guard is a static string compare that\n * minifiers fold to `false` in prod builds).\n * - Warn-once dedupe per `code` — a footgun is reported once, not on every\n * render.\n * - NO import of `@refraction-ui/logger` (no hard dependency on the telemetry\n * lib). Forwarding to a telemetry sink happens ONLY if the consumer\n * explicitly injects one (dependency inversion, never an import).\n */\n\n/**\n * Minimal structural shape of the record a telemetry sink consumes. This is a\n * deliberate structural mirror of `@refraction-ui/logger`'s `LogRecord` — it is\n * NOT imported, so `@refraction-ui/shared` keeps zero dependency on the\n * telemetry lib. A consumer that wires the real logger sink satisfies this\n * shape structurally.\n */\nexport interface DevFeedbackRecord {\n level: 'warn' | 'error'\n message: string\n timestamp: number\n /** Structured detail — the library-origin envelope lives here. */\n context: Record<string, unknown>\n}\n\n/**\n * The narrow contract a consumer-injected telemetry sink must satisfy. Kept\n * intentionally minimal and structural so the real `TelemetrySink` from\n * `@refraction-ui/logger` is assignable WITHOUT shared importing the logger.\n */\nexport interface DevFeedbackSink {\n /** Receive a single dev-feedback record. Must never throw to the caller. */\n log(record: DevFeedbackRecord): void\n}\n\n/**\n * Minimal ambient view of `process.env` so we can read `NODE_ENV` WITHOUT\n * pulling `@types/node` into this zero-dependency package. Accessed defensively\n * (the `typeof process === 'undefined'` guard) so this is safe in browsers too.\n */\ndeclare const process:\n | { env?: { NODE_ENV?: string } }\n | undefined\n\n/** Per-code dedupe set — module-scoped so it survives across calls. */\nconst seen = new Set<string>()\n\n/**\n * Optional, consumer-injected sink. `null` until a consumer explicitly wires\n * one via {@link setDevFeedbackSink}. Nothing phones home implicitly.\n */\nlet injectedSink: DevFeedbackSink | null = null\n\n/**\n * Wire an optional telemetry sink that {@link devWarn} / {@link devError}\n * forward to (in addition to the console). Inversion of control: the consumer\n * owns the sink; this package never imports it. Pass `null` to unwire.\n *\n * Forwarding still only happens in non-production (the calls themselves are\n * stripped in prod), and still respects warn-once dedupe.\n */\nexport function setDevFeedbackSink(sink: DevFeedbackSink | null): void {\n injectedSink = sink\n}\n\n/** Test-only / consumer-only escape hatch to reset warn-once dedupe state. */\nexport function resetDevFeedback(): void {\n seen.clear()\n}\n\nfunction isDev(): boolean {\n // String compare (not a negated truthiness) so bundlers can statically fold\n // `process.env.NODE_ENV` and strip the whole branch in production builds.\n return (\n typeof process === 'undefined' ||\n process.env?.NODE_ENV !== 'production'\n )\n}\n\nfunction emit(\n level: 'warn' | 'error',\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n if (!isDev()) return\n\n // Warn-once dedupe, keyed by (level, code) so an error and a warning sharing\n // a code are not collapsed into one.\n const key = `${level}:${code}`\n if (seen.has(key)) return\n seen.add(key)\n\n const text = `[refraction-ui] ${code}: ${message}`\n\n if (level === 'error') {\n console.error(text, detail ?? '')\n } else {\n console.warn(text, detail ?? '')\n }\n\n // Forward to the consumer-injected sink ONLY if one was explicitly wired.\n if (injectedSink) {\n const record: DevFeedbackRecord = {\n level,\n message: `${code}: ${message}`,\n timestamp: Date.now(),\n context: { code, ...(detail ?? {}) },\n }\n try {\n injectedSink.log(record)\n } catch {\n // A broken sink must never break the consumer app.\n }\n }\n}\n\n/**\n * Emit a development-only warning for a refraction-ui footgun.\n *\n * @param code Stable, greppable identifier (e.g. `'react/no-controlled-prop'`).\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Warned at most once per `code`.\n */\nexport function devWarn(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('warn', code, message, detail)\n}\n\n/**\n * Emit a development-only error for a refraction-ui misuse / invariant break.\n *\n * @param code Stable, greppable identifier.\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Reported at most once per `code`.\n */\nexport function devError(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('error', code, message, detail)\n}\n", "/**\n * library-origin-error — builds the **library-origin error envelope** for\n * errors that originate inside a `@refraction-ui/*` package.\n *\n * The envelope is expressed THROUGH the existing telemetry record contract\n * (`@refraction-ui/logger`'s `LogRecord`) — the contract is reused, NOT\n * redefined. To keep `@refraction-ui/shared` zero-dependency, the record is\n * mirrored structurally (see {@link DevFeedbackRecord}) rather than imported;\n * a consumer wiring the real logger sink satisfies it structurally.\n *\n * Aggressive redaction (epic #247 guardrails): the payload is package,\n * componentName, version, a normalized stack **fingerprint hash**, and\n * framework only. Never app state, props values, user data, PII, or full app\n * stack frames.\n */\n\nimport type { DevFeedbackRecord, DevFeedbackSink } from './dev-feedback.js'\n\n/** Matches any stack frame that references a `@refraction-ui/*` package. */\nconst REFRACTION_FRAME = /@refraction-ui\\//\n\n/** Frameworks a refraction-ui adapter can run under. */\nexport type LibraryFramework =\n | 'react'\n | 'astro'\n | 'vue'\n | 'svelte'\n | 'vanilla'\n | 'unknown'\n\n/** Inputs describing where a library-origin error came from. */\nexport interface LibraryOriginErrorInput {\n /** Originating package, e.g. `@refraction-ui/react`. */\n package: string\n /** refraction-ui component the error originated in, e.g. `Dialog`. */\n componentName: string\n /** Originating package version, e.g. `0.1.5`. */\n version: string\n /** Host framework the component was running under. */\n framework: LibraryFramework\n /** The thrown error (or its stack string). Used ONLY to derive a hash. */\n error?: unknown\n}\n\n/**\n * The redacted, library-origin payload carried in `LogRecord.context`. Contains\n * NO app data — only the five identifying fields plus a stack fingerprint hash.\n */\nexport interface LibraryOriginEnvelope {\n /** Marks this record as a library-origin error (for downstream routing). */\n origin: 'refraction-ui'\n package: string\n componentName: string\n version: string\n framework: LibraryFramework\n /** Stable, app-data-free hash of the normalized stack. */\n fingerprint: string\n}\n\n/**\n * Normalize a stack trace into a deterministic, app-data-free string before\n * hashing:\n * - keep only frames that reference a `@refraction-ui/*` package (drop the\n * app's own frames — library-origin only),\n * - strip absolute paths, line/column numbers, query strings, and hashes,\n * - sort-free (preserve call order) but whitespace-collapsed.\n *\n * If no refraction-ui frames are present the function returns an empty string,\n * which yields a stable \"no-frames\" fingerprint rather than leaking app frames.\n */\nfunction normalizeStack(stack: string): string {\n const frames = stack\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.startsWith('at ') || line.includes('@'))\n .filter((line) => REFRACTION_FRAME.test(line))\n .map((line) =>\n line\n // drop everything from the path/url onward, keep the symbol\n .replace(/\\((?:.*?)(@refraction-ui\\/[^):]+)[^)]*\\)/, '($1)')\n .replace(/(@refraction-ui\\/[^\\s:?#]+)[^\\s)]*/g, '$1')\n // strip :line:col\n .replace(/:\\d+:\\d+/g, '')\n // strip line:col without colon prefix\n .replace(/:\\d+\\b/g, '')\n // strip query/hash\n .replace(/[?#][^\\s)]*/g, '')\n .replace(/\\s+/g, ' ')\n .trim(),\n )\n\n return frames.join('\\n')\n}\n\n/**\n * Deterministic, dependency-free 53-bit string hash (cyrb53). Stable across\n * runs and processes for the same input — required so the intake can dedupe by\n * fingerprint. NOT cryptographic; it only needs to be collision-resistant\n * enough to group identical normalized stacks.\n */\nfunction cyrb53(str: string, seed = 0): string {\n let h1 = 0xdeadbeef ^ seed\n let h2 = 0x41c6ce57 ^ seed\n for (let i = 0; i < str.length; i++) {\n const ch = str.charCodeAt(i)\n h1 = Math.imul(h1 ^ ch, 2654435761)\n h2 = Math.imul(h2 ^ ch, 1597334677)\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507)\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909)\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507)\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909)\n const out = 4294967296 * (2097151 & h2) + (h1 >>> 0)\n return out.toString(16).padStart(14, '0')\n}\n\nfunction stackOf(error: unknown): string {\n if (typeof error === 'string') return error\n if (\n error &&\n typeof error === 'object' &&\n 'stack' in error &&\n typeof (error as { stack?: unknown }).stack === 'string'\n ) {\n return (error as { stack: string }).stack\n }\n return ''\n}\n\n/**\n * Compute the stable stack fingerprint for a library-origin error. Exposed\n * separately so capture seams / tests can assert fingerprint stability without\n * building the whole record.\n */\nexport function stackFingerprint(error: unknown): string {\n const normalized = normalizeStack(stackOf(error))\n return cyrb53(normalized)\n}\n\n/**\n * Build the redacted library-origin envelope for an error.\n */\nexport function libraryOriginEnvelope(\n input: LibraryOriginErrorInput,\n): LibraryOriginEnvelope {\n return {\n origin: 'refraction-ui',\n package: input.package,\n componentName: input.componentName,\n version: input.version,\n framework: input.framework,\n fingerprint: stackFingerprint(input.error),\n }\n}\n\n/**\n * Build the full library-origin error record, expressed THROUGH the existing\n * telemetry record contract (`LogRecord`, mirrored as {@link DevFeedbackRecord}\n * to avoid a hard logger dependency). The redacted envelope rides in\n * `context`; no app data, props, PII, or app stack frames are included.\n *\n * This record is exactly what a consumer-wired telemetry sink (or the\n * `devWarn`/`devError` injected sink) consumes.\n */\nexport function libraryOriginError(\n input: LibraryOriginErrorInput,\n): DevFeedbackRecord {\n const envelope = libraryOriginEnvelope(input)\n return {\n level: 'error',\n message: `${input.package}/${input.componentName}: library-origin error`,\n timestamp: Date.now(),\n context: { ...envelope },\n }\n}\n\n/**\n * Library-origin predicate — `true` iff the error's stack contains at least\n * one frame that references a `@refraction-ui/*` package. This is the gate\n * every per-framework capture seam uses: only library-origin errors are\n * eligible; the app's own errors return `false` and pass through untouched.\n *\n * Mirrors exactly the frame-detection rule {@link stackFingerprint} normalizes\n * by — no new contract, just the companion predicate the seams need. Never\n * throws for a missing/odd error (returns `false`).\n */\nexport function isLibraryOriginError(error: unknown): boolean {\n const stack = stackOf(error)\n if (!stack) return false\n return REFRACTION_FRAME.test(stack)\n}\n\n/**\n * The fixed identity of the refraction-ui package/component a seam tags an\n * error with. The seam supplies this; the stack itself supplies the\n * fingerprint. Never carries app data.\n */\nexport type LibraryOriginIdentity = Pick<\n LibraryOriginErrorInput,\n 'package' | 'componentName' | 'version' | 'framework'\n>\n\n/**\n * The single capture primitive shared by every per-framework seam (React error\n * boundary, Astro middleware). It performs the entire\n * guarded flow in one place so the seams stay thin and identical in behavior:\n *\n * 1. **Library-origin filter** — if the error's stack has no\n * `@refraction-ui/*` frame it is the app's own error: return `null` and do\n * NOT touch, capture, or forward it.\n * 2. **Tag** — build the redacted {@link libraryOriginError} record\n * (package/componentName/version/framework + app-data-free fingerprint).\n * 3. **Route to the optional sink** — forward the record to the\n * consumer-injected sink ONLY if one was wired; a broken sink can never\n * break the consumer app. With no sink this is a no-op beyond returning\n * the record (so a seam can still surface it locally).\n *\n * @returns the tagged record for a library-origin error, or `null` when the\n * error is app-origin (the \"pass through untouched\" signal).\n */\nexport function captureLibraryOriginError(\n error: unknown,\n identity: LibraryOriginIdentity,\n sink: DevFeedbackSink | null | undefined,\n): DevFeedbackRecord | null {\n if (!isLibraryOriginError(error)) return null\n\n const record = libraryOriginError({ ...identity, error })\n\n if (sink) {\n try {\n sink.log(record)\n } catch {\n // A broken sink must never break the consumer app.\n }\n }\n\n return record\n}\n"],
5
+ "mappings": ";AAeA,IAAI,YAAY;AAMT,SAAS,WAAW,SAAS,OAAe;AACjD;AACA,SAAO,GAAG,MAAM,IAAI,SAAS;AAC/B;ACvBO,IAAM,OAAO;EAClB,OAAO;EACP,OAAO;EACP,QAAQ;EACR,KAAK;EACL,SAAS;EACT,WAAW;EACX,WAAW;EACX,YAAY;EACZ,MAAM;EACN,KAAK;EACL,QAAQ;EACR,UAAU;EACV,WAAW;EACX,QAAQ;AACV;AAUO,SAAS,sBACd,UACgC;AAChC,SAAO,CAAC,UAAyB;AAC/B,UAAM,UAAU,SAAS,MAAM,GAAG;AAClC,QAAI,SAAS;AACX,cAAQ,KAAK;IACf;EACF;AACF;ACZO,SAAS,cACd,QACyB;AACzB,MAAI,UAAU,OAAO;AACrB,QAAM,YAAA,oBAAgB,IAAA;AAEtB,SAAO;IACL,IAAI,QA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AE,MAAM,GAAI,UAAU,CAAA,EAAC;IAAG;AAErC,QAAI;AACF,mBAAa,IAAI,MAAM;IACzB,QAAQ;IAER;EACF;AACF;AAWO,SAAS,QACd,MACA,SACA,QACM;AACN,OAAK,QAAQ,MAAM,SAAS,MAAM;AACpC;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cva,
3
3
  generateId
4
- } from "./chunk-ZF3OHCGV.js";
4
+ } from "./chunk-2Q6HHFAN.js";
5
5
 
6
6
  // ../emoji-picker/dist/index.js
7
7
  var CATEGORY_ORDER = ["smileys", "people", "nature", "food", "travel", "activities", "objects", "symbols", "flags"];
@@ -2352,4 +2352,4 @@ export {
2352
2352
  emojiPickerPanelStyles,
2353
2353
  emojiPickerStickerButtonStyles
2354
2354
  };
2355
- //# sourceMappingURL=chunk-533MCMSU.js.map
2355
+ //# sourceMappingURL=chunk-3I3DYDHR.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ShortcutHint,
3
3
  useShortcut
4
- } from "./chunk-WK2IIUFO.js";
4
+ } from "./chunk-QDMLIDYN.js";
5
5
  import {
6
6
  Keys,
7
7
  cn,
8
8
  cva
9
- } from "./chunk-ZF3OHCGV.js";
9
+ } from "./chunk-2Q6HHFAN.js";
10
10
 
11
11
  // ../react-button/dist/index.js
12
12
  import * as React from "react";
@@ -63,7 +63,7 @@ var buttonTokens = {
63
63
  }
64
64
  };
65
65
  var buttonVariants = cva({
66
- base: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
66
+ base: "inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
67
67
  variants: {
68
68
  variant: {
69
69
  default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
@@ -74,15 +74,21 @@ var buttonVariants = cva({
74
74
  destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
75
75
  outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
76
76
  secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
77
+ // Soft tinted brand fill — lower-emphasis primary action (issue #485).
78
+ soft: "bg-primary-soft text-primary-soft-foreground shadow-sm hover:bg-primary-soft/80",
79
+ // Second brand accent (issue #485).
80
+ tertiary: "bg-tertiary text-tertiary-foreground shadow-sm hover:bg-tertiary/90",
77
81
  ghost: "hover:bg-accent hover:text-accent-foreground",
78
82
  link: "text-primary underline-offset-4 hover:underline"
79
83
  },
80
84
  size: {
81
85
  xs: "h-7 rounded px-2 text-xs",
82
86
  sm: "h-8 rounded-md px-3 text-xs",
83
- default: "h-9 px-4 py-2",
84
- lg: "h-10 rounded-md px-8",
85
- icon: "h-9 w-9"
87
+ default: "h-9 rounded-md px-4 py-2 text-sm",
88
+ lg: "h-10 rounded-md px-8 text-sm",
89
+ icon: "h-9 w-9 rounded-md text-sm",
90
+ "icon-sm": "h-8 w-8 rounded-md text-xs",
91
+ "icon-xs": "h-7 w-7 rounded text-xs"
86
92
  }
87
93
  },
88
94
  defaultVariants: {
@@ -184,4 +190,4 @@ export {
184
190
  buttonVariants,
185
191
  Button
186
192
  };
187
- //# sourceMappingURL=chunk-F7B64KT3.js.map
193
+ //# sourceMappingURL=chunk-3Y2T26QD.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../button/src/button.ts", "../../button/src/button.styles.ts", "../../react-button/src/button.tsx"],
4
+ "sourcesContent": ["import type { AccessibilityProps, KeyboardHandlerMap } from '@refraction-ui/shared'\nimport { Keys } from '@refraction-ui/shared'\n\n/**\n * `primary` is an alias of `default` — included so the universal React-ecosystem\n * muscle-memory (`<Button variant=\"primary\">`) renders as the most-emphasized\n * button instead of falling through to the unstyled base. See issue #201.\n */\nexport type ButtonVariant =\n | 'default'\n | 'primary'\n | 'destructive'\n | 'outline'\n | 'secondary'\n | 'ghost'\n | 'link'\n // Issue #485 — soft tinted brand fill + a real second brand accent.\n | 'soft'\n | 'tertiary'\n\n/** Variants that map to the same visual style as `default`. */\nexport const BUTTON_VARIANT_ALIASES: Partial<Record<ButtonVariant, ButtonVariant>> = {\n primary: 'default',\n}\n\n/** Resolve an alias to its canonical variant. Pass-through for unknown/undefined. */\nexport function resolveButtonVariant(variant: ButtonVariant | undefined): ButtonVariant | undefined {\n if (!variant) return variant\n return BUTTON_VARIANT_ALIASES[variant] ?? variant\n}\nexport type ButtonSize = 'xs' | 'sm' | 'default' | 'lg' | 'icon' | 'icon-sm' | 'icon-xs'\n\nexport interface ButtonProps {\n variant?: ButtonVariant\n size?: ButtonSize\n disabled?: boolean\n loading?: boolean\n asChild?: boolean\n type?: 'button' | 'submit' | 'reset'\n}\n\nexport interface ButtonAPI {\n /** ARIA attributes to spread on the element */\n ariaProps: Partial<AccessibilityProps>\n /** Keyboard handlers to attach */\n keyboardHandlers: KeyboardHandlerMap\n /** Whether interaction should be blocked */\n isInteractive: boolean\n /** Data attributes for CSS styling hooks */\n dataAttributes: Record<string, string>\n}\n\nexport function createButton(props: ButtonProps = {}): ButtonAPI {\n const { disabled = false, loading = false } = props\n const isInteractive = !disabled && !loading\n\n const ariaProps: Partial<AccessibilityProps> = {}\n if (disabled) {\n ariaProps['aria-disabled'] = true\n }\n if (loading) {\n ariaProps['aria-disabled'] = true\n ariaProps['aria-label'] = ariaProps['aria-label'] ?? undefined\n }\n\n const dataAttributes: Record<string, string> = {}\n if (loading) {\n dataAttributes['data-loading'] = ''\n }\n if (disabled) {\n dataAttributes['data-disabled'] = ''\n }\n\n const keyboardHandlers: KeyboardHandlerMap = {}\n if (!isInteractive) {\n keyboardHandlers[Keys.Enter] = (e) => e.preventDefault()\n keyboardHandlers[Keys.Space] = (e) => e.preventDefault()\n }\n\n return {\n ariaProps,\n keyboardHandlers,\n isInteractive,\n dataAttributes,\n }\n}\n\nexport function getButtonType(props: ButtonProps): string {\n return props.type ?? 'button'\n}\n", "import { cva } from '@refraction-ui/shared'\nimport type { TokenContract } from '@refraction-ui/shared'\n\nexport const buttonTokens: TokenContract = {\n name: 'button',\n tokens: {\n bg: { variable: '--rfr-button-bg', fallback: 'hsl(var(--primary))' },\n fg: { variable: '--rfr-button-fg', fallback: 'hsl(var(--primary-foreground))' },\n border: { variable: '--rfr-button-border', fallback: 'hsl(var(--border))' },\n radius: { variable: '--rfr-button-radius', fallback: 'var(--radius)' },\n ring: { variable: '--rfr-button-ring', fallback: 'hsl(var(--ring))' },\n },\n}\n\nexport const buttonVariants = cva({\n base: 'inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',\n // Alias for `default` — see resolveButtonVariant + issue #201. Same classes\n // so styling stays identical even if a consumer reaches into `buttonVariants`\n // directly without going through resolveButtonVariant.\n primary: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',\n destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',\n outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',\n secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',\n // Soft tinted brand fill — lower-emphasis primary action (issue #485).\n soft: 'bg-primary-soft text-primary-soft-foreground shadow-sm hover:bg-primary-soft/80',\n // Second brand accent (issue #485).\n tertiary: 'bg-tertiary text-tertiary-foreground shadow-sm hover:bg-tertiary/90',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n xs: 'h-7 rounded px-2 text-xs',\n sm: 'h-8 rounded-md px-3 text-xs',\n default: 'h-9 rounded-md px-4 py-2 text-sm',\n lg: 'h-10 rounded-md px-8 text-sm',\n icon: 'h-9 w-9 rounded-md text-sm',\n 'icon-sm': 'h-8 w-8 rounded-md text-xs',\n 'icon-xs': 'h-7 w-7 rounded text-xs',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n})\n", "import * as React from 'react'\nimport {\n createButton,\n buttonVariants,\n getButtonType,\n resolveButtonVariant,\n type ButtonVariant,\n type ButtonSize,\n} from '@refraction-ui/button'\nimport { useShortcut, ShortcutHint } from '@refraction-ui/react-keyboard-shortcut'\nimport { cn } from '@refraction-ui/shared'\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant\n size?: ButtonSize\n loading?: boolean\n asChild?: boolean\n shortcut?: string\n action?: string\n}\n\n/**\n * Button component — renders a styled button with variant and size support.\n *\n * Uses the headless @refraction-ui/button core for state, ARIA, and keyboard handling.\n * Styling via Tailwind utility classes (no external CSS-in-JS).\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function Button({ variant, size, loading, asChild, className, disabled, children, shortcut, action, ...props }, ref) {\n // `primary` is an ecosystem-muscle-memory alias for `default` — resolve it\n // here so styling, aria, and data attributes all see the canonical variant.\n // See issue #201.\n const resolvedVariant = resolveButtonVariant(variant)\n const api = createButton({ variant: resolvedVariant, size, disabled, loading, asChild, type: props.type })\n const classes = cn(buttonVariants({ variant: resolvedVariant, size }), className)\n \n const internalRef = React.useRef<HTMLButtonElement>(null)\n const mergedRef = React.useCallback(\n (node: HTMLButtonElement | null) => {\n internalRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref]\n )\n\n useShortcut({\n shortcut,\n action,\n enabled: !disabled && !loading && (!!shortcut || !!action),\n onTrigger: () => {\n internalRef.current?.click()\n },\n })\n\n // When asChild, render the child element directly with button props merged in.\n // This allows <Button asChild><a href=\"/\">Link</a></Button>\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children as React.ReactElement<Record<string, unknown>>, {\n ref: mergedRef,\n className: cn(classes, (children.props as Record<string, unknown>).className as string, 'relative'),\n type: getButtonType({ type: props.type }),\n ...api.ariaProps,\n ...api.dataAttributes,\n ...props,\n children: (\n <>\n {(shortcut || action) && <ShortcutHint shortcut={shortcut} action={action} className=\"right-4\" />}\n {(children.props as Record<string, unknown>).children}\n </>\n )\n })\n }\n\n return (\n <button\n ref={mergedRef}\n type={getButtonType({ type: props.type }) as 'button' | 'submit' | 'reset'}\n className={cn(classes, 'relative')}\n disabled={disabled || loading}\n {...api.ariaProps}\n {...api.dataAttributes}\n {...props}\n >\n {(shortcut || action) && <ShortcutHint shortcut={shortcut} action={action} className=\"right-4\" />}\n {loading && (\n <svg\n className=\"animate-spin h-4 w-4\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n )}\n {children}\n </button>\n )\n },\n)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAqBO,IAAM,yBAAwE;EACnF,SAAS;AACX;AAGO,SAAS,qBAAqB,SAA+D;AAClG,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,uBAAuB,OAAO,KAAK;AAC5C;AAuBO,SAAS,aAAa,QAAqB,CAAA,GAAe;AAC/D,QAAM,EAAE,WAAW,OAAO,UAAU,MAAA,IAAU;AAC9C,QAAM,gBAAgB,CAAC,YAAY,CAAC;AAEpC,QAAM,YAAyC,CAAA;AAC/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WACC;YAAC;YAAA;cACC,WAAU;cACV,OAAM;cACN,MAAK;cACL,SAAQ;cACR,eAAY;cAEZ,UAAA;gBAAA;kBAAC;kBAAA;oBACC,WAAU;oBACV,IAAG;oBACH,IAAG;oBACH,GAAE;oBACF,QAAO;oBACP,aAAY;kBAAA;gBAAA;gBAEd;kBAAC;kBAAA;oBACC,WAAU;oBACV,MAAK;oBACL,GAAE;kBAAA;gBAAA;cACJ;YAAA;UAAA;UAGH;QAAA;MAAA;IAAA;EAGP;AACF;",
6
+ "names": ["Button"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cn,
3
3
  cva
4
- } from "./chunk-ZF3OHCGV.js";
4
+ } from "./chunk-2Q6HHFAN.js";
5
5
 
6
6
  // ../react-video-tile/dist/index.js
7
7
  import * as React from "react";
@@ -129,4 +129,4 @@ var VideoTile = React.forwardRef(
129
129
  export {
130
130
  VideoTile
131
131
  };
132
- //# sourceMappingURL=chunk-H54FLNAF.js.map
132
+ //# sourceMappingURL=chunk-63N4PZUJ.js.map
@@ -76,5 +76,5 @@ function devWarn(code, message, detail) {
76
76
  }
77
77
 
78
78
  export { cn, cva, devWarn };
79
- //# sourceMappingURL=chunk-Y2FNNAIL.js.map
80
- //# sourceMappingURL=chunk-Y2FNNAIL.js.map
79
+ //# sourceMappingURL=chunk-EGVPAMQU.js.map
80
+ //# sourceMappingURL=chunk-EGVPAMQU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../shared/src/cn.ts","../../shared/src/cva.ts","../../shared/src/dev-feedback.ts"],"names":[],"mappings":";AAgBO,SAAS,MAAM,MAAA,EAAiD;AACrE,EAAA,MAAM,UAAoB,EAAA;AAE1B,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,IAAI,CAAC,KAAA,EAAO;AAEZ,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;IACpB,CAAA,MAAA,I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A,CAAK,IAAI,GAAG,CAAA;AAEZ,EAAA,MAAM,IAAA,GAAO,CAAA,gBAAA,EAAmB,IAAI,CAAA,EAAA,EAAK,OAAO,CAAA,CAAA;AAEhD,EAEO;AACL,IAAA,OAAA,CAAQ,IAAA,CAAK,IAAA,EAAM,MAAA,IAAU,EAAE,CAAA;AACjC,EAAA;AAgBF;AAWO,SAAS,OAAA,CACd,IAAA,EACA,OAAA,EACA,MAAA,EACM;AACN,EAAA,IAAA,CAAK,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,MAAM,CAAA;AACpC","file":"chunk-EGVPAMQU.js","sourcesContent":["/**\n * Lightweight class name utility — our own implementation.\n * Handles conditional classes, arrays, and falsy values.\n * No external dependencies (no clsx, no tailwind-merge).\n *\n * It does NOT resolve Tailwind conflicts: `cn('p-2', 'p-4')` keeps both and\n * the stylesheet order decides. Components therefore keep size-owned\n * utilities (height, text size, padding) out of their cva `base` and only in\n * the matching variant, so a variant prop always wins; a consumer `className`\n * that must beat a component utility can use Tailwind's `!` important\n * modifier (e.g. `!h-7`).\n */\n\ntype ClassValue = string | number | boolean | undefined | null | ClassValue[]\ntype ClassRecord = Record<string, boolean | undefined | null>\n\nexport function cn(...inputs: Array<ClassValue | ClassRecord>): string {\n const classes: string[] = []\n\n for (const input of inputs) {\n if (!input) continue\n\n if (typeof input === 'string') {\n classes.push(input)\n } else if (typeof input === 'number') {\n classes.push(String(input))\n } else if (Array.isArray(input)) {\n const nested = cn(...input)\n if (nested) classes.push(nested)\n } else if (typeof input === 'object') {\n for (const [key, value] of Object.entries(input)) {\n if (value) classes.push(key)\n }\n }\n }\n\n return classes.join(' ')\n}\n","/**\n * Lightweight class-variance-authority alternative — zero dependencies.\n * Creates variant-driven class name functions for components.\n */\n\ninterface VariantConfig {\n [variant: string]: Record<string, string>\n}\n\ninterface CVAConfig<V extends VariantConfig> {\n base?: string\n variants?: V\n defaultVariants?: {\n [K in keyof V]?: keyof V[K]\n }\n compoundVariants?: Array<\n {\n [K in keyof V]?: keyof V[K]\n } & { class: string }\n >\n}\n\ntype VariantProps<V extends VariantConfig> = {\n [K in keyof V]?: keyof V[K]\n}\n\nexport function cva<V extends VariantConfig>(config: CVAConfig<V>) {\n return (props?: VariantProps<V> & { className?: string }): string => {\n const classes: string[] = []\n\n if (config.base) {\n classes.push(config.base)\n }\n\n if (config.variants) {\n for (const [variantKey, variantOptions] of Object.entries(config.variants)) {\n const selectedValue =\n (props as Record<string, unknown> | undefined)?.[variantKey] ??\n config.defaultVariants?.[variantKey]\n\n if (selectedValue != null) {\n const variantClass = (variantOptions as Record<string, string>)[\n selectedValue as string\n ]\n if (variantClass) {\n classes.push(variantClass)\n }\n }\n }\n }\n\n if (config.compoundVariants) {\n for (const compound of config.compoundVariants) {\n const { class: compoundClass, ...conditions } = compound\n let matches = true\n\n for (const [key, value] of Object.entries(conditions)) {\n const propValue =\n (props as Record<string, unknown>)?.[key] ??\n config.defaultVariants?.[key]\n if (propValue !== value) {\n matches = false\n break\n }\n }\n\n if (matches) {\n classes.push(compoundClass as string)\n }\n }\n }\n\n if (props?.className) {\n classes.push(props.className)\n }\n\n return classes.filter(Boolean).join(' ')\n }\n}\n","/**\n * dev-feedback — zero-dependency `devWarn` / `devError` primitives.\n *\n * Design constraints (epic #247, issue #248):\n * - Guarded by `process.env.NODE_ENV !== 'production'` so production bundlers\n * dead-code-strip every call (the guard is a static string compare that\n * minifiers fold to `false` in prod builds).\n * - Warn-once dedupe per `code` — a footgun is reported once, not on every\n * render.\n * - NO import of `@refraction-ui/logger` (no hard dependency on the telemetry\n * lib). Forwarding to a telemetry sink happens ONLY if the consumer\n * explicitly injects one (dependency inversion, never an import).\n */\n\n/**\n * Minimal structural shape of the record a telemetry sink consumes. This is a\n * deliberate structural mirror of `@refraction-ui/logger`'s `LogRecord` — it is\n * NOT imported, so `@refraction-ui/shared` keeps zero dependency on the\n * telemetry lib. A consumer that wires the real logger sink satisfies this\n * shape structurally.\n */\nexport interface DevFeedbackRecord {\n level: 'warn' | 'error'\n message: string\n timestamp: number\n /** Structured detail — the library-origin envelope lives here. */\n context: Record<string, unknown>\n}\n\n/**\n * The narrow contract a consumer-injected telemetry sink must satisfy. Kept\n * intentionally minimal and structural so the real `TelemetrySink` from\n * `@refraction-ui/logger` is assignable WITHOUT shared importing the logger.\n */\nexport interface DevFeedbackSink {\n /** Receive a single dev-feedback record. Must never throw to the caller. */\n log(record: DevFeedbackRecord): void\n}\n\n/**\n * Minimal ambient view of `process.env` so we can read `NODE_ENV` WITHOUT\n * pulling `@types/node` into this zero-dependency package. Accessed defensively\n * (the `typeof process === 'undefined'` guard) so this is safe in browsers too.\n */\ndeclare const process:\n | { env?: { NODE_ENV?: string } }\n | undefined\n\n/** Per-code dedupe set — module-scoped so it survives across calls. */\nconst seen = new Set<string>()\n\n/**\n * Optional, consumer-injected sink. `null` until a consumer explicitly wires\n * one via {@link setDevFeedbackSink}. Nothing phones home implicitly.\n */\nlet injectedSink: DevFeedbackSink | null = null\n\n/**\n * Wire an optional telemetry sink that {@link devWarn} / {@link devError}\n * forward to (in addition to the console). Inversion of control: the consumer\n * owns the sink; this package never imports it. Pass `null` to unwire.\n *\n * Forwarding still only happens in non-production (the calls themselves are\n * stripped in prod), and still respects warn-once dedupe.\n */\nexport function setDevFeedbackSink(sink: DevFeedbackSink | null): void {\n injectedSink = sink\n}\n\n/** Test-only / consumer-only escape hatch to reset warn-once dedupe state. */\nexport function resetDevFeedback(): void {\n seen.clear()\n}\n\nfunction isDev(): boolean {\n // String compare (not a negated truthiness) so bundlers can statically fold\n // `process.env.NODE_ENV` and strip the whole branch in production builds.\n return (\n typeof process === 'undefined' ||\n process.env?.NODE_ENV !== 'production'\n )\n}\n\nfunction emit(\n level: 'warn' | 'error',\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n if (!isDev()) return\n\n // Warn-once dedupe, keyed by (level, code) so an error and a warning sharing\n // a code are not collapsed into one.\n const key = `${level}:${code}`\n if (seen.has(key)) return\n seen.add(key)\n\n const text = `[refraction-ui] ${code}: ${message}`\n\n if (level === 'error') {\n console.error(text, detail ?? '')\n } else {\n console.warn(text, detail ?? '')\n }\n\n // Forward to the consumer-injected sink ONLY if one was explicitly wired.\n if (injectedSink) {\n const record: DevFeedbackRecord = {\n level,\n message: `${code}: ${message}`,\n timestamp: Date.now(),\n context: { code, ...(detail ?? {}) },\n }\n try {\n injectedSink.log(record)\n } catch {\n // A broken sink must never break the consumer app.\n }\n }\n}\n\n/**\n * Emit a development-only warning for a refraction-ui footgun.\n *\n * @param code Stable, greppable identifier (e.g. `'react/no-controlled-prop'`).\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Warned at most once per `code`.\n */\nexport function devWarn(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('warn', code, message, detail)\n}\n\n/**\n * Emit a development-only error for a refraction-ui misuse / invariant break.\n *\n * @param code Stable, greppable identifier.\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Reported at most once per `code`.\n */\nexport function devError(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('error', code, message, detail)\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cn
3
- } from "./chunk-ZF3OHCGV.js";
3
+ } from "./chunk-2Q6HHFAN.js";
4
4
 
5
5
  // ../react-keyboard-shortcut/dist/index.js
6
6
  import * as React from "react";
@@ -313,4 +313,4 @@ export {
313
313
  KeyboardShortcut,
314
314
  ShortcutBadge
315
315
  };
316
- //# sourceMappingURL=chunk-WK2IIUFO.js.map
316
+ //# sourceMappingURL=chunk-QDMLIDYN.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildShortcodeMap
3
- } from "./chunk-533MCMSU.js";
3
+ } from "./chunk-3I3DYDHR.js";
4
4
 
5
5
  // ../rich-editor/dist/index.js
6
6
  function createTextSegment(text, marks = []) {
@@ -87,4 +87,4 @@ export {
87
87
  detectTriggerInText,
88
88
  detectEmojiShortcode
89
89
  };
90
- //# sourceMappingURL=chunk-BOLFYVI6.js.map
90
+ //# sourceMappingURL=chunk-QPCKJ2YR.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cn,
3
3
  cva
4
- } from "./chunk-ZF3OHCGV.js";
4
+ } from "./chunk-2Q6HHFAN.js";
5
5
 
6
6
  // ../react-input/dist/index.js
7
7
  import * as React from "react";
@@ -54,11 +54,11 @@ function createInput(props = {}) {
54
54
  };
55
55
  }
56
56
  var inputVariants = cva({
57
- base: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
57
+ base: "flex w-full rounded-md border border-input bg-transparent px-3 py-1 shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
58
58
  variants: {
59
59
  size: {
60
60
  sm: "h-8 text-xs",
61
- default: "h-9",
61
+ default: "h-9 text-sm",
62
62
  lg: "h-10 text-base"
63
63
  },
64
64
  validationState: {
@@ -151,4 +151,4 @@ export {
151
151
  inputVariants,
152
152
  Input
153
153
  };
154
- //# sourceMappingURL=chunk-TOZBR4GL.js.map
154
+ //# sourceMappingURL=chunk-RSWOLRIC.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../input/src/input.ts", "../../input/src/input.styles.ts", "../../react-input/src/input.tsx"],
4
- "sourcesContent": ["import type { AccessibilityProps } from '@refraction-ui/shared'\n\nexport type InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search'\n\n/** High-level validation affordance for an input. */\nexport type InputValidationState = 'valid' | 'invalid'\n\nexport interface InputProps {\n type?: InputType\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n placeholder?: string\n 'aria-invalid'?: boolean\n /**\n * Validation affordance. The core derives `aria-invalid` from this:\n * - `'valid'` → `aria-invalid={false}`\n * - `'invalid'` → `aria-invalid={true}`\n *\n * An explicit `aria-invalid` prop always takes precedence.\n */\n validationState?: InputValidationState\n}\n\nexport interface InputAPI {\n /** ARIA attributes to spread on the element */\n ariaProps: Partial<AccessibilityProps> & { 'aria-invalid'?: boolean; 'aria-required'?: boolean }\n /** Data attributes for CSS styling hooks */\n dataAttributes: Record<string, string>\n}\n\n/**\n * Resolve the effective `aria-invalid` value from an explicit `aria-invalid`\n * prop and a high-level `validationState`. The explicit prop always wins;\n * otherwise `validationState` maps `'invalid' → true`, `'valid' → false`, and\n * an absent state leaves `aria-invalid` undefined (legacy behavior).\n */\nexport function resolveAriaInvalid(\n ariaInvalid: boolean | undefined,\n validationState: InputValidationState | undefined,\n): boolean | undefined {\n if (ariaInvalid !== undefined) {\n return ariaInvalid\n }\n if (validationState === 'invalid') {\n return true\n }\n if (validationState === 'valid') {\n return false\n }\n return undefined\n}\n\nexport function createInput(props: InputProps = {}): InputAPI {\n const {\n disabled = false,\n readOnly = false,\n required = false,\n 'aria-invalid': ariaInvalid,\n validationState,\n } = props\n\n const resolvedInvalid = resolveAriaInvalid(ariaInvalid, validationState)\n\n const ariaProps: InputAPI['ariaProps'] = {}\n\n if (disabled) {\n ariaProps['aria-disabled'] = true\n }\n\n if (resolvedInvalid !== undefined) {\n ariaProps['aria-invalid'] = resolvedInvalid\n }\n\n if (required) {\n ariaProps['aria-required'] = true\n }\n\n const dataAttributes: Record<string, string> = {}\n\n if (disabled) {\n dataAttributes['data-disabled'] = ''\n }\n\n if (readOnly) {\n dataAttributes['data-readonly'] = ''\n }\n\n if (resolvedInvalid === true) {\n dataAttributes['data-invalid'] = ''\n }\n\n return {\n ariaProps,\n dataAttributes,\n }\n}\n\nexport function getInputAriaProps(state: {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}): Partial<AccessibilityProps> & { 'aria-invalid'?: boolean; 'aria-required'?: boolean } {\n const ariaProps: Partial<AccessibilityProps> & { 'aria-invalid'?: boolean; 'aria-required'?: boolean } = {}\n\n if (state.disabled) {\n ariaProps['aria-disabled'] = true\n }\n\n if (state.invalid) {\n ariaProps['aria-invalid'] = true\n }\n\n if (state.required) {\n ariaProps['aria-required'] = true\n }\n\n return ariaProps\n}\n", "import { cva } from '@refraction-ui/shared'\n\nexport const inputVariants = cva({\n base: 'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',\n variants: {\n size: {\n sm: 'h-8 text-xs',\n default: 'h-9',\n lg: 'h-10 text-base',\n },\n validationState: {\n valid: 'border-success focus-visible:ring-success',\n invalid: 'border-destructive focus-visible:ring-destructive',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n", "import * as React from 'react'\nimport {\n createInput,\n inputVariants,\n type InputValidationState,\n} from '@refraction-ui/input'\nimport { cn } from '@refraction-ui/shared'\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * Visual size of the input.\n *\n * Note: this prop intentionally **shadows** the native HTML `size`\n * attribute (which would otherwise control the visible character width\n * of the `<input>` element). We re-purpose the name for our visual\n * size variants (`'sm' | 'default' | 'lg'`) because in practice almost\n * no one uses the native character-width `size` attribute, while\n * visual sizing is a near-universal need.\n *\n * If you need the native character-width behavior, set it via\n * `htmlSize` on the underlying DOM through a `ref`, or render a plain\n * `<input>` instead.\n *\n * See the package README's \"Sizing\" section for more.\n */\n size?: 'sm' | 'default' | 'lg'\n /**\n * Validation affordance. Tints the border and wires `aria-invalid`:\n * - `'valid'` → green border, trailing check icon, `aria-invalid={false}`\n * - `'invalid'` → destructive border, `aria-invalid={true}`\n *\n * When omitted the input is rendered without a wrapper (identical to the\n * legacy bare `<input>` markup), unless `leadingIcon` is set.\n */\n validationState?: InputValidationState\n /**\n * Optional icon rendered inside the input's left padding. When provided\n * (or when `validationState` is set) the input is wrapped in a relative\n * `<div>` and gains left padding to make room for the icon.\n */\n leadingIcon?: React.ReactNode\n}\n\nconst CheckIcon = (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-success\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n)\n\n/**\n * Input component — renders a styled input with size support.\n *\n * Uses the headless @refraction-ui/input core for state, ARIA, and data attributes.\n * Styling via Tailwind utility classes (no external CSS-in-JS).\n */\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n function Input(\n {\n type = 'text',\n size,\n className,\n disabled,\n readOnly,\n required,\n validationState,\n leadingIcon,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n ref,\n ) {\n // The core owns the `aria-invalid` derivation and the validation border\n // tokens; the React layer only does DOM composition (wrapper + icons).\n const api = createInput({\n type: type as import('@refraction-ui/input').InputType,\n disabled,\n readOnly,\n required,\n 'aria-invalid': ariaInvalid === undefined ? undefined : ariaInvalid === true || ariaInvalid === 'true',\n validationState,\n })\n\n const hasWrapper = leadingIcon != null || validationState != null\n\n const classes = cn(\n inputVariants({ size, validationState }),\n leadingIcon != null && 'pl-9',\n validationState === 'valid' && 'pr-9',\n className,\n )\n\n const inputEl = (\n <input\n ref={ref}\n type={type}\n className={classes}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n {...api.ariaProps}\n {...api.dataAttributes}\n {...props}\n />\n )\n\n if (!hasWrapper) {\n return inputEl\n }\n\n return (\n <div className=\"relative\">\n {leadingIcon != null && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-3 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center text-muted-foreground\"\n >\n {leadingIcon}\n </span>\n )}\n {inputEl}\n {validationState === 'valid' && CheckIcon}\n </div>\n )\n },\n)\n"],
4
+ "sourcesContent": ["import type { AccessibilityProps } from '@refraction-ui/shared'\n\nexport type InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search'\n\n/** High-level validation affordance for an input. */\nexport type InputValidationState = 'valid' | 'invalid'\n\nexport interface InputProps {\n type?: InputType\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n placeholder?: string\n 'aria-invalid'?: boolean\n /**\n * Validation affordance. The core derives `aria-invalid` from this:\n * - `'valid'` → `aria-invalid={false}`\n * - `'invalid'` → `aria-invalid={true}`\n *\n * An explicit `aria-invalid` prop always takes precedence.\n */\n validationState?: InputValidationState\n}\n\nexport interface InputAPI {\n /** ARIA attributes to spread on the element */\n ariaProps: Partial<AccessibilityProps> & { 'aria-invalid'?: boolean; 'aria-required'?: boolean }\n /** Data attributes for CSS styling hooks */\n dataAttributes: Record<string, string>\n}\n\n/**\n * Resolve the effective `aria-invalid` value from an explicit `aria-invalid`\n * prop and a high-level `validationState`. The explicit prop always wins;\n * otherwise `validationState` maps `'invalid' → true`, `'valid' → false`, and\n * an absent state leaves `aria-invalid` undefined (legacy behavior).\n */\nexport function resolveAriaInvalid(\n ariaInvalid: boolean | undefined,\n validationState: InputValidationState | undefined,\n): boolean | undefined {\n if (ariaInvalid !== undefined) {\n return ariaInvalid\n }\n if (validationState === 'invalid') {\n return true\n }\n if (validationState === 'valid') {\n return false\n }\n return undefined\n}\n\nexport function createInput(props: InputProps = {}): InputAPI {\n const {\n disabled = false,\n readOnly = false,\n required = false,\n 'aria-invalid': ariaInvalid,\n validationState,\n } = props\n\n const resolvedInvalid = resolveAriaInvalid(ariaInvalid, validationState)\n\n const ariaProps: InputAPI['ariaProps'] = {}\n\n if (disabled) {\n ariaProps['aria-disabled'] = true\n }\n\n if (resolvedInvalid !== undefined) {\n ariaProps['aria-invalid'] = resolvedInvalid\n }\n\n if (required) {\n ariaProps['aria-required'] = true\n }\n\n const dataAttributes: Record<string, string> = {}\n\n if (disabled) {\n dataAttributes['data-disabled'] = ''\n }\n\n if (readOnly) {\n dataAttributes['data-readonly'] = ''\n }\n\n if (resolvedInvalid === true) {\n dataAttributes['data-invalid'] = ''\n }\n\n return {\n ariaProps,\n dataAttributes,\n }\n}\n\nexport function getInputAriaProps(state: {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}): Partial<AccessibilityProps> & { 'aria-invalid'?: boolean; 'aria-required'?: boolean } {\n const ariaProps: Partial<AccessibilityProps> & { 'aria-invalid'?: boolean; 'aria-required'?: boolean } = {}\n\n if (state.disabled) {\n ariaProps['aria-disabled'] = true\n }\n\n if (state.invalid) {\n ariaProps['aria-invalid'] = true\n }\n\n if (state.required) {\n ariaProps['aria-required'] = true\n }\n\n return ariaProps\n}\n", "import { cva } from '@refraction-ui/shared'\n\nexport const inputVariants = cva({\n base: 'flex w-full rounded-md border border-input bg-transparent px-3 py-1 shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',\n variants: {\n size: {\n sm: 'h-8 text-xs',\n default: 'h-9 text-sm',\n lg: 'h-10 text-base',\n },\n validationState: {\n valid: 'border-success focus-visible:ring-success',\n invalid: 'border-destructive focus-visible:ring-destructive',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n", "import * as React from 'react'\nimport {\n createInput,\n inputVariants,\n type InputValidationState,\n} from '@refraction-ui/input'\nimport { cn } from '@refraction-ui/shared'\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * Visual size of the input.\n *\n * Note: this prop intentionally **shadows** the native HTML `size`\n * attribute (which would otherwise control the visible character width\n * of the `<input>` element). We re-purpose the name for our visual\n * size variants (`'sm' | 'default' | 'lg'`) because in practice almost\n * no one uses the native character-width `size` attribute, while\n * visual sizing is a near-universal need.\n *\n * If you need the native character-width behavior, set it via\n * `htmlSize` on the underlying DOM through a `ref`, or render a plain\n * `<input>` instead.\n *\n * See the package README's \"Sizing\" section for more.\n */\n size?: 'sm' | 'default' | 'lg'\n /**\n * Validation affordance. Tints the border and wires `aria-invalid`:\n * - `'valid'` → green border, trailing check icon, `aria-invalid={false}`\n * - `'invalid'` → destructive border, `aria-invalid={true}`\n *\n * When omitted the input is rendered without a wrapper (identical to the\n * legacy bare `<input>` markup), unless `leadingIcon` is set.\n */\n validationState?: InputValidationState\n /**\n * Optional icon rendered inside the input's left padding. When provided\n * (or when `validationState` is set) the input is wrapped in a relative\n * `<div>` and gains left padding to make room for the icon.\n */\n leadingIcon?: React.ReactNode\n}\n\nconst CheckIcon = (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-success\"\n >\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n)\n\n/**\n * Input component — renders a styled input with size support.\n *\n * Uses the headless @refraction-ui/input core for state, ARIA, and data attributes.\n * Styling via Tailwind utility classes (no external CSS-in-JS).\n */\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n function Input(\n {\n type = 'text',\n size,\n className,\n disabled,\n readOnly,\n required,\n validationState,\n leadingIcon,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n ref,\n ) {\n // The core owns the `aria-invalid` derivation and the validation border\n // tokens; the React layer only does DOM composition (wrapper + icons).\n const api = createInput({\n type: type as import('@refraction-ui/input').InputType,\n disabled,\n readOnly,\n required,\n 'aria-invalid': ariaInvalid === undefined ? undefined : ariaInvalid === true || ariaInvalid === 'true',\n validationState,\n })\n\n const hasWrapper = leadingIcon != null || validationState != null\n\n const classes = cn(\n inputVariants({ size, validationState }),\n leadingIcon != null && 'pl-9',\n validationState === 'valid' && 'pr-9',\n className,\n )\n\n const inputEl = (\n <input\n ref={ref}\n type={type}\n className={classes}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n {...api.ariaProps}\n {...api.dataAttributes}\n {...props}\n />\n )\n\n if (!hasWrapper) {\n return inputEl\n }\n\n return (\n <div className=\"relative\">\n {leadingIcon != null && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-3 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center text-muted-foreground\"\n >\n {leadingIcon}\n </span>\n )}\n {inputEl}\n {validationState === 'valid' && CheckIcon}\n </div>\n )\n },\n)\n"],
5
5
  "mappings": ";;;;;;;;;AAqCO,SAAS,mBACd,aACA,iBACqB;AACrB,MAAI,gBAAgB,QAAW;AAC7B,WAAO;EACT;AACA,MAAI,oBAAoB,WAAW;AACjC,WAAO;EACT;AACA,MAAI,oBAAoB,SAAS;AAC/B,WAAO;EACT;AACA,SAAO;AACT;AAEO,SAAS,YAAY,QAAoB,CAAA,GAAc;AAC5D,QAAM;IACJ,WAAW;IACX,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB;EAAA,IACE;AAEJ,QAAM,kBAAkB,mBAAmB,aAAa,eAAe;AAEvE,QAAM,YAAmC,CAAA;AAEzC,MAAI,UAAU;AACZ,cAAU,eAAe,IAAI;EAC/B;AAEA,MAAI,oBAAoB,QAAW;AACjC,cAAU,cAAc,IAAI;EAC9B;AAEA,MAAI,UAAU;AACZ,cAAU,eAAe,IAAI;EAC/B;AAEA,QAAM,iBAAyC,CAAA;AAE/C,MAAI,UAAU;AACZ,mBAAe,eAAe,IAAI;EACpC;AAEA,MAAI,UAAU;AACZ,mBAAe,eAAe,IAAI;EACpC;AAEA,MAAI,oBAAoB,MAAM;AAC5B,mBAAe,cAAc,IAAI;EACnC;A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chunk-ZF3OHCGV.js";
4
+ } from "./chunk-2Q6HHFAN.js";
5
5
 
6
6
  // ../react-markdown-renderer/dist/index.js
7
7
  import * as React from "react";
@@ -222,4 +222,4 @@ export {
222
222
  proseVariants,
223
223
  MarkdownRenderer
224
224
  };
225
- //# sourceMappingURL=chunk-UNEM2TRI.js.map
225
+ //# sourceMappingURL=chunk-SDAJVXD4.js.map
@@ -3,7 +3,7 @@ import {
3
3
  createMachine,
4
4
  cva,
5
5
  generateId
6
- } from "./chunk-ZF3OHCGV.js";
6
+ } from "./chunk-2Q6HHFAN.js";
7
7
 
8
8
  // ../dialog/dist/index.js
9
9
  function createDialog(props = {}) {
@@ -89,4 +89,4 @@ export {
89
89
  overlayStyles,
90
90
  dialogContentVariants
91
91
  };
92
- //# sourceMappingURL=chunk-VK3EQ34F.js.map
92
+ //# sourceMappingURL=chunk-V24GDHUX.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cn,
3
3
  cva
4
- } from "./chunk-ZF3OHCGV.js";
4
+ } from "./chunk-2Q6HHFAN.js";
5
5
 
6
6
  // ../react-infinite-canvas/dist/index.js
7
7
  import * as React from "react";
@@ -247,4 +247,4 @@ var InfiniteCanvas = React.forwardRef(
247
247
  export {
248
248
  InfiniteCanvas
249
249
  };
250
- //# sourceMappingURL=chunk-AMK4VCBG.js.map
250
+ //# sourceMappingURL=chunk-WYKPPK3W.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generateId
3
- } from "./chunk-ZF3OHCGV.js";
3
+ } from "./chunk-2Q6HHFAN.js";
4
4
 
5
5
  // ../thread-view/dist/index.js
6
6
  function formatTimestamp(date) {
@@ -113,4 +113,4 @@ export {
113
113
  threadAttachmentStyles,
114
114
  threadEditedStyles
115
115
  };
116
- //# sourceMappingURL=chunk-ONACRMG4.js.map
116
+ //# sourceMappingURL=chunk-XMFNBOPO.js.map
package/dist/form.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../shared/src/cn.ts","../../shared/src/cva.ts","../../shared/src/dev-feedback.ts","../../react-slot/src/slot.tsx","../../react-form/src/form.tsx"],"names":["React","Slot","FormProvider","React2","Controller","useFormContext","useFormState","FormItem","jsx","FormLabel","FormControl","FormDescription","FormMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,SAAS,MAAM,MAAA,EAAiD;AACrE,EAAA,MAAM,UAAoB,EAAA;AAE1B,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,IAAI,CAAC,KAAA,EAAO;AAEZ,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;IACpB,CAAA,MAAA,IAAW,OAAO,UAAU,QAAA,EAAU;AACpC,MAAA,OAAA,CAAQ,IAAA,CAAK,MAAA,CAAO,KAAK,CAAC,CAAA;IAC5B,CAAA,MAAA,IAAW,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/B,MAAA,MAAM,MAAA,GAAS,EAAA,CAAG,GAAG,KAAK,CAAA;AAC1B,MAAA,IAAI,MAAA,EAAQ,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAA;IACjC,CAAA,MAAA,IAAW,OAAO,UAAU,QAAA,EAAU;AACpC,MAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,QAAA,IAAI,KAAA,EAAO,OAAA,CAAQ,IAAA,CAAK,GAAG,CAAA;AAC7B,MAAA;AACF,IAAA;AACF,EAAA;AAEA,EAAA,OAAO,OAAA,CAAQ,KAAK,GAAG,CAAA;AACzB;ACRO,SAAS,IAA6B,MAAA,EAAsB;AACjE,EAAA,OAAO,CAAC,KAAA,KAA6D;AACnE,IAAA,MAAM,UAAoB,EAAA;AAE1B,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,OAAA,CAAQ,IAAA,CAAK,OAAO,IAAI,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AAW,EAAA,CAAG,wCAAwC,SAAS,CAAA;QAC9D,GAAG,KAAA;QAEH,QAAA,EAAA;AAAA;AAAA,KAAA;AAGP,EAAA;AACF","file":"form.cjs","sourcesContent":["/**\n * Lightweight class name utility — our own implementation.\n * Handles conditional classes, arrays, and falsy values.\n * No external dependencies (no clsx, no tailwind-merge).\n *\n * For Tailwind class conflict resolution (e.g., 'p-2 p-4' → 'p-4'),\n * consumers can use @refraction-ui/tailwind-config which provides\n * a tw-merge-aware variant of this function.\n */\n\ntype ClassValue = string | number | boolean | undefined | null | ClassValue[]\ntype ClassRecord = Record<string, boolean | undefined | null>\n\nexport function cn(...inputs: Array<ClassValue | ClassRecord>): string {\n const classes: string[] = []\n\n for (const input of inputs) {\n if (!input) continue\n\n if (typeof input === 'string') {\n classes.push(input)\n } else if (typeof input === 'number') {\n classes.push(String(input))\n } else if (Array.isArray(input)) {\n const nested = cn(...input)\n if (nested) classes.push(nested)\n } else if (typeof input === 'object') {\n for (const [key, value] of Object.entries(input)) {\n if (value) classes.push(key)\n }\n }\n }\n\n return classes.join(' ')\n}\n","/**\n * Lightweight class-variance-authority alternative — zero dependencies.\n * Creates variant-driven class name functions for components.\n */\n\ninterface VariantConfig {\n [variant: string]: Record<string, string>\n}\n\ninterface CVAConfig<V extends VariantConfig> {\n base?: string\n variants?: V\n defaultVariants?: {\n [K in keyof V]?: keyof V[K]\n }\n compoundVariants?: Array<\n {\n [K in keyof V]?: keyof V[K]\n } & { class: string }\n >\n}\n\ntype VariantProps<V extends VariantConfig> = {\n [K in keyof V]?: keyof V[K]\n}\n\nexport function cva<V extends VariantConfig>(config: CVAConfig<V>) {\n return (props?: VariantProps<V> & { className?: string }): string => {\n const classes: string[] = []\n\n if (config.base) {\n classes.push(config.base)\n }\n\n if (config.variants) {\n for (const [variantKey, variantOptions] of Object.entries(config.variants)) {\n const selectedValue =\n (props as Record<string, unknown> | undefined)?.[variantKey] ??\n config.defaultVariants?.[variantKey]\n\n if (selectedValue != null) {\n const variantClass = (variantOptions as Record<string, string>)[\n selectedValue as string\n ]\n if (variantClass) {\n classes.push(variantClass)\n }\n }\n }\n }\n\n if (config.compoundVariants) {\n for (const compound of config.compoundVariants) {\n const { class: compoundClass, ...conditions } = compound\n let matches = true\n\n for (const [key, value] of Object.entries(conditions)) {\n const propValue =\n (props as Record<string, unknown>)?.[key] ??\n config.defaultVariants?.[key]\n if (propValue !== value) {\n matches = false\n break\n }\n }\n\n if (matches) {\n classes.push(compoundClass as string)\n }\n }\n }\n\n if (props?.className) {\n classes.push(props.className)\n }\n\n return classes.filter(Boolean).join(' ')\n }\n}\n","/**\n * dev-feedback — zero-dependency `devWarn` / `devError` primitives.\n *\n * Design constraints (epic #247, issue #248):\n * - Guarded by `process.env.NODE_ENV !== 'production'` so production bundlers\n * dead-code-strip every call (the guard is a static string compare that\n * minifiers fold to `false` in prod builds).\n * - Warn-once dedupe per `code` — a footgun is reported once, not on every\n * render.\n * - NO import of `@refraction-ui/logger` (no hard dependency on the telemetry\n * lib). Forwarding to a telemetry sink happens ONLY if the consumer\n * explicitly injects one (dependency inversion, never an import).\n */\n\n/**\n * Minimal structural shape of the record a telemetry sink consumes. This is a\n * deliberate structural mirror of `@refraction-ui/logger`'s `LogRecord` — it is\n * NOT imported, so `@refraction-ui/shared` keeps zero dependency on the\n * telemetry lib. A consumer that wires the real logger sink satisfies this\n * shape structurally.\n */\nexport interface DevFeedbackRecord {\n level: 'warn' | 'error'\n message: string\n timestamp: number\n /** Structured detail — the library-origin envelope lives here. */\n context: Record<string, unknown>\n}\n\n/**\n * The narrow contract a consumer-injected telemetry sink must satisfy. Kept\n * intentionally minimal and structural so the real `TelemetrySink` from\n * `@refraction-ui/logger` is assignable WITHOUT shared importing the logger.\n */\nexport interface DevFeedbackSink {\n /** Receive a single dev-feedback record. Must never throw to the caller. */\n log(record: DevFeedbackRecord): void\n}\n\n/**\n * Minimal ambient view of `process.env` so we can read `NODE_ENV` WITHOUT\n * pulling `@types/node` into this zero-dependency package. Accessed defensively\n * (the `typeof process === 'undefined'` guard) so this is safe in browsers too.\n */\ndeclare const process:\n | { env?: { NODE_ENV?: string } }\n | undefined\n\n/** Per-code dedupe set — module-scoped so it survives across calls. */\nconst seen = new Set<string>()\n\n/**\n * Optional, consumer-injected sink. `null` until a consumer explicitly wires\n * one via {@link setDevFeedbackSink}. Nothing phones home implicitly.\n */\nlet injectedSink: DevFeedbackSink | null = null\n\n/**\n * Wire an optional telemetry sink that {@link devWarn} / {@link devError}\n * forward to (in addition to the console). Inversion of control: the consumer\n * owns the sink; this package never imports it. Pass `null` to unwire.\n *\n * Forwarding still only happens in non-production (the calls themselves are\n * stripped in prod), and still respects warn-once dedupe.\n */\nexport function setDevFeedbackSink(sink: DevFeedbackSink | null): void {\n injectedSink = sink\n}\n\n/** Test-only / consumer-only escape hatch to reset warn-once dedupe state. */\nexport function resetDevFeedback(): void {\n seen.clear()\n}\n\nfunction isDev(): boolean {\n // String compare (not a negated truthiness) so bundlers can statically fold\n // `process.env.NODE_ENV` and strip the whole branch in production builds.\n return (\n typeof process === 'undefined' ||\n process.env?.NODE_ENV !== 'production'\n )\n}\n\nfunction emit(\n level: 'warn' | 'error',\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n if (!isDev()) return\n\n // Warn-once dedupe, keyed by (level, code) so an error and a warning sharing\n // a code are not collapsed into one.\n const key = `${level}:${code}`\n if (seen.has(key)) return\n seen.add(key)\n\n const text = `[refraction-ui] ${code}: ${message}`\n\n if (level === 'error') {\n console.error(text, detail ?? '')\n } else {\n console.warn(text, detail ?? '')\n }\n\n // Forward to the consumer-injected sink ONLY if one was explicitly wired.\n if (injectedSink) {\n const record: DevFeedbackRecord = {\n level,\n message: `${code}: ${message}`,\n timestamp: Date.now(),\n context: { code, ...(detail ?? {}) },\n }\n try {\n injectedSink.log(record)\n } catch {\n // A broken sink must never break the consumer app.\n }\n }\n}\n\n/**\n * Emit a development-only warning for a refraction-ui footgun.\n *\n * @param code Stable, greppable identifier (e.g. `'react/no-controlled-prop'`).\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Warned at most once per `code`.\n */\nexport function devWarn(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('warn', code, message, detail)\n}\n\n/**\n * Emit a development-only error for a refraction-ui misuse / invariant break.\n *\n * @param code Stable, greppable identifier.\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Reported at most once per `code`.\n */\nexport function devError(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('error', code, message, detail)\n}\n","import * as React from 'react'\n\n/**\n * Minimal Slot implementation — the shared `asChild` primitive.\n *\n * Why not @radix-ui/react-slot? Per package policy, no external runtime deps\n * are allowed in @refraction-ui/* packages. This Slot does the small amount\n * of work we actually need:\n * - Forwards a single React child\n * - Merges incoming props onto that child (event handlers are chained,\n * className is concatenated, style is shallow-merged)\n * - Merges refs (callback refs and ref objects)\n *\n * It is intentionally simpler than Radix Slot — no <Slottable/>, no asChild\n * recursion. `asChild` components render exactly one child element, which is\n * all we need here. Non-element children (text, arrays, null) render nothing.\n */\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>(function Slot(\n props,\n forwardedRef,\n) {\n const { children, ...slotProps } = props\n\n if (!React.isValidElement(children)) {\n return null\n }\n\n // The child element's existing props\n const childProps = (children.props ?? {}) as Record<string, unknown>\n\n const mergedProps = mergeProps(slotProps as Record<string, unknown>, childProps)\n\n // Forward + merge refs. In React 19 `ref` is a regular prop on `props`; in\n // React 18 it's hoisted onto the element. Prefer the prop and only fall back\n // to the element field if `props.ref` truly wasn't there — that fallback path\n // is React 18 only.\n let childRef: React.Ref<unknown> | undefined = childProps.ref as\n | React.Ref<unknown>\n | undefined\n if (childRef === undefined && !('ref' in (childProps as object))) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n childRef = (children as any).ref as React.Ref<unknown> | undefined\n }\n const mergedRef = composeRefs(forwardedRef as React.Ref<unknown>, childRef)\n\n return React.cloneElement(\n children as React.ReactElement,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { ...mergedProps, ref: mergedRef } as any,\n )\n})\n\nfunction mergeProps(\n slotProps: Record<string, unknown>,\n childProps: Record<string, unknown>,\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...slotProps }\n\n for (const key of Object.keys(childProps)) {\n const slotValue = slotProps[key]\n const childValue = childProps[key]\n\n // Chain event handlers: child's handler runs after slot's\n if (/^on[A-Z]/.test(key) && typeof slotValue === 'function' && typeof childValue === 'function') {\n merged[key] = (...args: unknown[]) => {\n const child = childValue as (...a: unknown[]) => unknown\n const slot = slotValue as (...a: unknown[]) => unknown\n child(...args)\n slot(...args)\n }\n } else if (key === 'className') {\n merged[key] = [slotValue, childValue].filter(Boolean).join(' ')\n } else if (key === 'style') {\n merged[key] = { ...(slotValue as object), ...(childValue as object) }\n } else if (childValue !== undefined) {\n // Child wins for non-event, non-merged props\n merged[key] = childValue\n }\n }\n\n return merged\n}\n\ntype PossibleRef<T> = React.Ref<T> | undefined\n\nfunction composeRefs<T>(...refs: Array<PossibleRef<T>>): React.RefCallback<T> {\n return (node: T) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref != null) {\n const objectRef = ref as React.MutableRefObject<T | null>\n objectRef.current = node\n }\n }\n }\n}\n","import * as React from 'react'\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form'\nimport { cn, cva, devWarn } from '@refraction-ui/shared'\nimport { Slot } from '@refraction-ui/react-slot'\n\n/**\n * Form — RHF FormProvider wrapper.\n *\n * Spread the result of `useForm()` into <Form> so descendants can read the\n * form state via context. Renders no DOM of its own; consumers can place a\n * <form onSubmit={form.handleSubmit(...)}> inside.\n */\nconst Form = FormProvider\n\n// -----------------------------------------------------------------------------\n// Field context — bridges <FormField> and the inner Form* primitives.\n// -----------------------------------------------------------------------------\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | undefined>(\n undefined,\n)\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue | undefined>(\n undefined,\n)\n\n/**\n * FormField — connects a named field to RHF's Controller and provides\n * field-name context to the descendants (FormLabel, FormControl, FormMessage).\n */\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(props: ControllerProps<TFieldValues, TName>) {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\n/**\n * useFormField — read-only access to the current field context.\n *\n * Returns the per-field id collection plus the live RHF error state. Useful\n * when building custom form controls that want the same wiring as FormControl.\n */\nfunction useFormField() {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const formContext = useFormContext()\n // useFormState subscribes to the specific field's error state, which keeps\n // re-renders narrow and works correctly with RHF v7 lazy subscriptions.\n const { errors } = useFormState({\n control: formContext?.control,\n name: fieldContext?.name as never,\n exact: true,\n })\n\n if (!fieldContext) {\n devWarn(\n 'react-form/use-form-field-outside-form-field',\n 'useFormField (via FormLabel/FormControl/FormDescription/FormMessage) must be used inside a <FormField>. The missing FormFieldContext makes this throw.',\n )\n throw new Error('useFormField must be used within a <FormField>')\n }\n if (!itemContext) {\n devWarn(\n 'react-form/use-form-field-outside-form-item',\n 'useFormField (via FormLabel/FormControl/FormDescription/FormMessage) must be used inside a <FormItem>. The missing FormItemContext makes this throw.',\n )\n throw new Error('useFormField must be used within a <FormItem>')\n }\n\n const { id } = itemContext\n const error = getNestedError(errors, fieldContext.name)\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n error,\n invalid: Boolean(error),\n }\n}\n\n// Walks a dot/bracket path through RHF's errors object. Mirrors the path\n// semantics of FieldPath without pulling in lodash.get.\nfunction getNestedError(\n errors: Record<string, unknown> | undefined,\n name: string,\n): { message?: string; type?: string } | undefined {\n if (!errors) return undefined\n const segments = name.replace(/\\[(\\w+)\\]/g, '.$1').split('.')\n let cursor: unknown = errors\n for (const seg of segments) {\n if (cursor && typeof cursor === 'object' && seg in (cursor as object)) {\n cursor = (cursor as Record<string, unknown>)[seg]\n } else {\n return undefined\n }\n }\n return cursor as { message?: string; type?: string } | undefined\n}\n\n// -----------------------------------------------------------------------------\n// FormItem — emits a stable id used by Label/Control/Description/Message.\n// -----------------------------------------------------------------------------\n\nconst formItemVariants = cva({ base: 'space-y-2' })\n\ninterface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(\n function FormItem({ className, ...props }, ref) {\n const id = React.useId()\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(formItemVariants(), className)} {...props} />\n </FormItemContext.Provider>\n )\n },\n)\n\n// -----------------------------------------------------------------------------\n// FormLabel\n// -----------------------------------------------------------------------------\n\nconst formLabelVariants = cva({\n base: 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n variants: {\n invalid: {\n true: 'text-destructive',\n false: '',\n },\n },\n defaultVariants: {\n invalid: 'false',\n },\n})\n\ninterface FormLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}\n\nconst FormLabel = React.forwardRef<HTMLLabelElement, FormLabelProps>(\n function FormLabel({ className, ...props }, ref) {\n const { invalid, formItemId } = useFormField()\n return (\n <label\n ref={ref}\n htmlFor={formItemId}\n data-invalid={invalid ? '' : undefined}\n className={cn(formLabelVariants({ invalid: invalid ? 'true' : 'false' }), className)}\n {...props}\n />\n )\n },\n)\n\n// -----------------------------------------------------------------------------\n// FormControl — Slot that injects id/aria-describedby/aria-invalid.\n// -----------------------------------------------------------------------------\n\ninterface FormControlProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode\n}\n\nconst FormControl = React.forwardRef<HTMLElement, FormControlProps>(\n function FormControl({ ...props }, ref) {\n const { invalid, formItemId, formDescriptionId, formMessageId } =\n useFormField()\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n invalid\n ? `${formDescriptionId} ${formMessageId}`\n : formDescriptionId\n }\n aria-invalid={invalid || undefined}\n {...props}\n />\n )\n },\n)\n\n// -----------------------------------------------------------------------------\n// FormDescription\n// -----------------------------------------------------------------------------\n\ninterface FormDescriptionProps\n extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n FormDescriptionProps\n>(function FormDescription({ className, ...props }, ref) {\n const { formDescriptionId } = useFormField()\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n )\n})\n\n// -----------------------------------------------------------------------------\n// FormMessage\n// -----------------------------------------------------------------------------\n\ninterface FormMessageProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, FormMessageProps>(\n function FormMessage({ className, children, ...props }, ref) {\n const { error, formMessageId } = useFormField()\n const body = error?.message ? String(error.message) : children\n if (!body) return null\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn('text-sm font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n )\n },\n)\n\nexport {\n Form,\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n useFormField,\n formItemVariants,\n formLabelVariants,\n}\n\nexport type {\n FormItemProps,\n FormLabelProps,\n FormControlProps,\n FormDescriptionProps,\n FormMessageProps,\n}\n"]}
1
+ {"version":3,"sources":["../../shared/src/cn.ts","../../shared/src/cva.ts","../../shared/src/dev-feedback.ts","../../react-slot/src/slot.tsx","../../react-form/src/form.tsx"],"names":["React","Slot","FormProvider","React2","Controller","useFormContext","useFormState","FormItem","jsx","FormLabel","FormControl","FormDescription","FormMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,MAAM,MAAA,EAAiD;AACrE,EAAA,MAAM,UAAoB,EAAA;AAE1B,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,IAAI,CAAC,KAAA,EAAO;AAEZ,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;IACpB,CAAA,MAAA,IAAW,OAAO,UAAU,QAAA,EAAU;AACpC,MAAA,OAAA,CAAQ,IAAA,CAAK,MAAA,CAAO,KAAK,CAAC,CAAA;IAC5B,CAAA,MAAA,IAAW,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/B,MAAA,MAAM,MAAA,GAAS,EAAA,CAAG,GAAG,KAAK,CAAA;AAC1B,MAAA,IAAI,MAAA,EAAQ,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAA;IACjC,CAAA,MAAA,IAAW,OAAO,UAAU,QAAA,EAAU;AACpC,MAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,QAAA,IAAI,KAAA,EAAO,OAAA,CAAQ,IAAA,CAAK,GAAG,CAAA;AAC7B,MAAA;AACF,IAAA;AACF,EAAA;AAEA,EAAA,OAAO,OAAA,CAAQ,KAAK,GAAG,CAAA;AACzB;ACXO,SAAS,IAA6B,MAAA,EAAsB;AACjE,EAAA,OAAO,CAAC,KAAA,KAA6D;AACnE,IAAA,MAAM,UAAoB,EAAA;AAE1B,IAAA,IAAI,OAAO,IAAA,EAAM;AACf,MAAA,OAAA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,EAAA,EAAI,aAAA;QACJ,SAAA,EAAW,EAAA,CAAG,wCAAwC,SAAS,CAAA;QAC9D,GAAG,KAAA;QAEH,QAAA,EAAA;AAAA;AAAA,KAAA;AAGP,EAAA;AACF","file":"form.cjs","sourcesContent":["/**\n * Lightweight class name utility — our own implementation.\n * Handles conditional classes, arrays, and falsy values.\n * No external dependencies (no clsx, no tailwind-merge).\n *\n * It does NOT resolve Tailwind conflicts: `cn('p-2', 'p-4')` keeps both and\n * the stylesheet order decides. Components therefore keep size-owned\n * utilities (height, text size, padding) out of their cva `base` and only in\n * the matching variant, so a variant prop always wins; a consumer `className`\n * that must beat a component utility can use Tailwind's `!` important\n * modifier (e.g. `!h-7`).\n */\n\ntype ClassValue = string | number | boolean | undefined | null | ClassValue[]\ntype ClassRecord = Record<string, boolean | undefined | null>\n\nexport function cn(...inputs: Array<ClassValue | ClassRecord>): string {\n const classes: string[] = []\n\n for (const input of inputs) {\n if (!input) continue\n\n if (typeof input === 'string') {\n classes.push(input)\n } else if (typeof input === 'number') {\n classes.push(String(input))\n } else if (Array.isArray(input)) {\n const nested = cn(...input)\n if (nested) classes.push(nested)\n } else if (typeof input === 'object') {\n for (const [key, value] of Object.entries(input)) {\n if (value) classes.push(key)\n }\n }\n }\n\n return classes.join(' ')\n}\n","/**\n * Lightweight class-variance-authority alternative — zero dependencies.\n * Creates variant-driven class name functions for components.\n */\n\ninterface VariantConfig {\n [variant: string]: Record<string, string>\n}\n\ninterface CVAConfig<V extends VariantConfig> {\n base?: string\n variants?: V\n defaultVariants?: {\n [K in keyof V]?: keyof V[K]\n }\n compoundVariants?: Array<\n {\n [K in keyof V]?: keyof V[K]\n } & { class: string }\n >\n}\n\ntype VariantProps<V extends VariantConfig> = {\n [K in keyof V]?: keyof V[K]\n}\n\nexport function cva<V extends VariantConfig>(config: CVAConfig<V>) {\n return (props?: VariantProps<V> & { className?: string }): string => {\n const classes: string[] = []\n\n if (config.base) {\n classes.push(config.base)\n }\n\n if (config.variants) {\n for (const [variantKey, variantOptions] of Object.entries(config.variants)) {\n const selectedValue =\n (props as Record<string, unknown> | undefined)?.[variantKey] ??\n config.defaultVariants?.[variantKey]\n\n if (selectedValue != null) {\n const variantClass = (variantOptions as Record<string, string>)[\n selectedValue as string\n ]\n if (variantClass) {\n classes.push(variantClass)\n }\n }\n }\n }\n\n if (config.compoundVariants) {\n for (const compound of config.compoundVariants) {\n const { class: compoundClass, ...conditions } = compound\n let matches = true\n\n for (const [key, value] of Object.entries(conditions)) {\n const propValue =\n (props as Record<string, unknown>)?.[key] ??\n config.defaultVariants?.[key]\n if (propValue !== value) {\n matches = false\n break\n }\n }\n\n if (matches) {\n classes.push(compoundClass as string)\n }\n }\n }\n\n if (props?.className) {\n classes.push(props.className)\n }\n\n return classes.filter(Boolean).join(' ')\n }\n}\n","/**\n * dev-feedback — zero-dependency `devWarn` / `devError` primitives.\n *\n * Design constraints (epic #247, issue #248):\n * - Guarded by `process.env.NODE_ENV !== 'production'` so production bundlers\n * dead-code-strip every call (the guard is a static string compare that\n * minifiers fold to `false` in prod builds).\n * - Warn-once dedupe per `code` — a footgun is reported once, not on every\n * render.\n * - NO import of `@refraction-ui/logger` (no hard dependency on the telemetry\n * lib). Forwarding to a telemetry sink happens ONLY if the consumer\n * explicitly injects one (dependency inversion, never an import).\n */\n\n/**\n * Minimal structural shape of the record a telemetry sink consumes. This is a\n * deliberate structural mirror of `@refraction-ui/logger`'s `LogRecord` — it is\n * NOT imported, so `@refraction-ui/shared` keeps zero dependency on the\n * telemetry lib. A consumer that wires the real logger sink satisfies this\n * shape structurally.\n */\nexport interface DevFeedbackRecord {\n level: 'warn' | 'error'\n message: string\n timestamp: number\n /** Structured detail — the library-origin envelope lives here. */\n context: Record<string, unknown>\n}\n\n/**\n * The narrow contract a consumer-injected telemetry sink must satisfy. Kept\n * intentionally minimal and structural so the real `TelemetrySink` from\n * `@refraction-ui/logger` is assignable WITHOUT shared importing the logger.\n */\nexport interface DevFeedbackSink {\n /** Receive a single dev-feedback record. Must never throw to the caller. */\n log(record: DevFeedbackRecord): void\n}\n\n/**\n * Minimal ambient view of `process.env` so we can read `NODE_ENV` WITHOUT\n * pulling `@types/node` into this zero-dependency package. Accessed defensively\n * (the `typeof process === 'undefined'` guard) so this is safe in browsers too.\n */\ndeclare const process:\n | { env?: { NODE_ENV?: string } }\n | undefined\n\n/** Per-code dedupe set — module-scoped so it survives across calls. */\nconst seen = new Set<string>()\n\n/**\n * Optional, consumer-injected sink. `null` until a consumer explicitly wires\n * one via {@link setDevFeedbackSink}. Nothing phones home implicitly.\n */\nlet injectedSink: DevFeedbackSink | null = null\n\n/**\n * Wire an optional telemetry sink that {@link devWarn} / {@link devError}\n * forward to (in addition to the console). Inversion of control: the consumer\n * owns the sink; this package never imports it. Pass `null` to unwire.\n *\n * Forwarding still only happens in non-production (the calls themselves are\n * stripped in prod), and still respects warn-once dedupe.\n */\nexport function setDevFeedbackSink(sink: DevFeedbackSink | null): void {\n injectedSink = sink\n}\n\n/** Test-only / consumer-only escape hatch to reset warn-once dedupe state. */\nexport function resetDevFeedback(): void {\n seen.clear()\n}\n\nfunction isDev(): boolean {\n // String compare (not a negated truthiness) so bundlers can statically fold\n // `process.env.NODE_ENV` and strip the whole branch in production builds.\n return (\n typeof process === 'undefined' ||\n process.env?.NODE_ENV !== 'production'\n )\n}\n\nfunction emit(\n level: 'warn' | 'error',\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n if (!isDev()) return\n\n // Warn-once dedupe, keyed by (level, code) so an error and a warning sharing\n // a code are not collapsed into one.\n const key = `${level}:${code}`\n if (seen.has(key)) return\n seen.add(key)\n\n const text = `[refraction-ui] ${code}: ${message}`\n\n if (level === 'error') {\n console.error(text, detail ?? '')\n } else {\n console.warn(text, detail ?? '')\n }\n\n // Forward to the consumer-injected sink ONLY if one was explicitly wired.\n if (injectedSink) {\n const record: DevFeedbackRecord = {\n level,\n message: `${code}: ${message}`,\n timestamp: Date.now(),\n context: { code, ...(detail ?? {}) },\n }\n try {\n injectedSink.log(record)\n } catch {\n // A broken sink must never break the consumer app.\n }\n }\n}\n\n/**\n * Emit a development-only warning for a refraction-ui footgun.\n *\n * @param code Stable, greppable identifier (e.g. `'react/no-controlled-prop'`).\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Warned at most once per `code`.\n */\nexport function devWarn(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('warn', code, message, detail)\n}\n\n/**\n * Emit a development-only error for a refraction-ui misuse / invariant break.\n *\n * @param code Stable, greppable identifier.\n * @param message Human-readable explanation.\n * @param detail Optional structured detail (forwarded to an injected sink).\n *\n * Stripped entirely in production. Reported at most once per `code`.\n */\nexport function devError(\n code: string,\n message: string,\n detail?: Record<string, unknown>,\n): void {\n emit('error', code, message, detail)\n}\n","import * as React from 'react'\n\n/**\n * Minimal Slot implementation — the shared `asChild` primitive.\n *\n * Why not @radix-ui/react-slot? Per package policy, no external runtime deps\n * are allowed in @refraction-ui/* packages. This Slot does the small amount\n * of work we actually need:\n * - Forwards a single React child\n * - Merges incoming props onto that child (event handlers are chained,\n * className is concatenated, style is shallow-merged)\n * - Merges refs (callback refs and ref objects)\n *\n * It is intentionally simpler than Radix Slot — no <Slottable/>, no asChild\n * recursion. `asChild` components render exactly one child element, which is\n * all we need here. Non-element children (text, arrays, null) render nothing.\n */\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode\n}\n\nexport const Slot = React.forwardRef<HTMLElement, SlotProps>(function Slot(\n props,\n forwardedRef,\n) {\n const { children, ...slotProps } = props\n\n if (!React.isValidElement(children)) {\n return null\n }\n\n // The child element's existing props\n const childProps = (children.props ?? {}) as Record<string, unknown>\n\n const mergedProps = mergeProps(slotProps as Record<string, unknown>, childProps)\n\n // Forward + merge refs. In React 19 `ref` is a regular prop on `props`; in\n // React 18 it's hoisted onto the element. Prefer the prop and only fall back\n // to the element field if `props.ref` truly wasn't there — that fallback path\n // is React 18 only.\n let childRef: React.Ref<unknown> | undefined = childProps.ref as\n | React.Ref<unknown>\n | undefined\n if (childRef === undefined && !('ref' in (childProps as object))) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n childRef = (children as any).ref as React.Ref<unknown> | undefined\n }\n const mergedRef = composeRefs(forwardedRef as React.Ref<unknown>, childRef)\n\n return React.cloneElement(\n children as React.ReactElement,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n { ...mergedProps, ref: mergedRef } as any,\n )\n})\n\nfunction mergeProps(\n slotProps: Record<string, unknown>,\n childProps: Record<string, unknown>,\n): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...slotProps }\n\n for (const key of Object.keys(childProps)) {\n const slotValue = slotProps[key]\n const childValue = childProps[key]\n\n // Chain event handlers: child's handler runs after slot's\n if (/^on[A-Z]/.test(key) && typeof slotValue === 'function' && typeof childValue === 'function') {\n merged[key] = (...args: unknown[]) => {\n const child = childValue as (...a: unknown[]) => unknown\n const slot = slotValue as (...a: unknown[]) => unknown\n child(...args)\n slot(...args)\n }\n } else if (key === 'className') {\n merged[key] = [slotValue, childValue].filter(Boolean).join(' ')\n } else if (key === 'style') {\n merged[key] = { ...(slotValue as object), ...(childValue as object) }\n } else if (childValue !== undefined) {\n // Child wins for non-event, non-merged props\n merged[key] = childValue\n }\n }\n\n return merged\n}\n\ntype PossibleRef<T> = React.Ref<T> | undefined\n\nfunction composeRefs<T>(...refs: Array<PossibleRef<T>>): React.RefCallback<T> {\n return (node: T) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref != null) {\n const objectRef = ref as React.MutableRefObject<T | null>\n objectRef.current = node\n }\n }\n }\n}\n","import * as React from 'react'\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form'\nimport { cn, cva, devWarn } from '@refraction-ui/shared'\nimport { Slot } from '@refraction-ui/react-slot'\n\n/**\n * Form — RHF FormProvider wrapper.\n *\n * Spread the result of `useForm()` into <Form> so descendants can read the\n * form state via context. Renders no DOM of its own; consumers can place a\n * <form onSubmit={form.handleSubmit(...)}> inside.\n */\nconst Form = FormProvider\n\n// -----------------------------------------------------------------------------\n// Field context — bridges <FormField> and the inner Form* primitives.\n// -----------------------------------------------------------------------------\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue | undefined>(\n undefined,\n)\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue | undefined>(\n undefined,\n)\n\n/**\n * FormField — connects a named field to RHF's Controller and provides\n * field-name context to the descendants (FormLabel, FormControl, FormMessage).\n */\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(props: ControllerProps<TFieldValues, TName>) {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\n/**\n * useFormField — read-only access to the current field context.\n *\n * Returns the per-field id collection plus the live RHF error state. Useful\n * when building custom form controls that want the same wiring as FormControl.\n */\nfunction useFormField() {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const formContext = useFormContext()\n // useFormState subscribes to the specific field's error state, which keeps\n // re-renders narrow and works correctly with RHF v7 lazy subscriptions.\n const { errors } = useFormState({\n control: formContext?.control,\n name: fieldContext?.name as never,\n exact: true,\n })\n\n if (!fieldContext) {\n devWarn(\n 'react-form/use-form-field-outside-form-field',\n 'useFormField (via FormLabel/FormControl/FormDescription/FormMessage) must be used inside a <FormField>. The missing FormFieldContext makes this throw.',\n )\n throw new Error('useFormField must be used within a <FormField>')\n }\n if (!itemContext) {\n devWarn(\n 'react-form/use-form-field-outside-form-item',\n 'useFormField (via FormLabel/FormControl/FormDescription/FormMessage) must be used inside a <FormItem>. The missing FormItemContext makes this throw.',\n )\n throw new Error('useFormField must be used within a <FormItem>')\n }\n\n const { id } = itemContext\n const error = getNestedError(errors, fieldContext.name)\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n error,\n invalid: Boolean(error),\n }\n}\n\n// Walks a dot/bracket path through RHF's errors object. Mirrors the path\n// semantics of FieldPath without pulling in lodash.get.\nfunction getNestedError(\n errors: Record<string, unknown> | undefined,\n name: string,\n): { message?: string; type?: string } | undefined {\n if (!errors) return undefined\n const segments = name.replace(/\\[(\\w+)\\]/g, '.$1').split('.')\n let cursor: unknown = errors\n for (const seg of segments) {\n if (cursor && typeof cursor === 'object' && seg in (cursor as object)) {\n cursor = (cursor as Record<string, unknown>)[seg]\n } else {\n return undefined\n }\n }\n return cursor as { message?: string; type?: string } | undefined\n}\n\n// -----------------------------------------------------------------------------\n// FormItem — emits a stable id used by Label/Control/Description/Message.\n// -----------------------------------------------------------------------------\n\nconst formItemVariants = cva({ base: 'space-y-2' })\n\ninterface FormItemProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nconst FormItem = React.forwardRef<HTMLDivElement, FormItemProps>(\n function FormItem({ className, ...props }, ref) {\n const id = React.useId()\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(formItemVariants(), className)} {...props} />\n </FormItemContext.Provider>\n )\n },\n)\n\n// -----------------------------------------------------------------------------\n// FormLabel\n// -----------------------------------------------------------------------------\n\nconst formLabelVariants = cva({\n base: 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n variants: {\n invalid: {\n true: 'text-destructive',\n false: '',\n },\n },\n defaultVariants: {\n invalid: 'false',\n },\n})\n\ninterface FormLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}\n\nconst FormLabel = React.forwardRef<HTMLLabelElement, FormLabelProps>(\n function FormLabel({ className, ...props }, ref) {\n const { invalid, formItemId } = useFormField()\n return (\n <label\n ref={ref}\n htmlFor={formItemId}\n data-invalid={invalid ? '' : undefined}\n className={cn(formLabelVariants({ invalid: invalid ? 'true' : 'false' }), className)}\n {...props}\n />\n )\n },\n)\n\n// -----------------------------------------------------------------------------\n// FormControl — Slot that injects id/aria-describedby/aria-invalid.\n// -----------------------------------------------------------------------------\n\ninterface FormControlProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode\n}\n\nconst FormControl = React.forwardRef<HTMLElement, FormControlProps>(\n function FormControl({ ...props }, ref) {\n const { invalid, formItemId, formDescriptionId, formMessageId } =\n useFormField()\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n invalid\n ? `${formDescriptionId} ${formMessageId}`\n : formDescriptionId\n }\n aria-invalid={invalid || undefined}\n {...props}\n />\n )\n },\n)\n\n// -----------------------------------------------------------------------------\n// FormDescription\n// -----------------------------------------------------------------------------\n\ninterface FormDescriptionProps\n extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n FormDescriptionProps\n>(function FormDescription({ className, ...props }, ref) {\n const { formDescriptionId } = useFormField()\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n )\n})\n\n// -----------------------------------------------------------------------------\n// FormMessage\n// -----------------------------------------------------------------------------\n\ninterface FormMessageProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, FormMessageProps>(\n function FormMessage({ className, children, ...props }, ref) {\n const { error, formMessageId } = useFormField()\n const body = error?.message ? String(error.message) : children\n if (!body) return null\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn('text-sm font-medium text-destructive', className)}\n {...props}\n >\n {body}\n </p>\n )\n },\n)\n\nexport {\n Form,\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n useFormField,\n formItemVariants,\n formLabelVariants,\n}\n\nexport type {\n FormItemProps,\n FormLabelProps,\n FormControlProps,\n FormDescriptionProps,\n FormMessageProps,\n}\n"]}
package/dist/form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { cva, cn, devWarn } from './chunk-Y2FNNAIL.js';
2
+ import { cva, cn, devWarn } from './chunk-EGVPAMQU.js';
3
3
  import * as React2 from 'react';
4
4
  import { useFormContext, useFormState, FormProvider, Controller } from 'react-hook-form';
5
5
  export { Controller, FormProvider, useController, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';