@refraction-ui/react 0.4.2 → 0.5.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 (288) hide show
  1. package/README.md +9 -1
  2. package/dist/chunk-ZWRGVWUY.js +120 -0
  3. package/dist/chunk-ZWRGVWUY.js.map +1 -0
  4. package/dist/form.cjs +315 -0
  5. package/dist/form.cjs.map +1 -0
  6. package/dist/form.d.cts +1 -0
  7. package/dist/form.d.ts +1 -0
  8. package/dist/form.js +196 -0
  9. package/dist/form.js.map +1 -0
  10. package/dist/index.cjs +0 -226
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +74 -76
  13. package/dist/index.d.ts +74 -76
  14. package/dist/index.js +2 -302
  15. package/dist/index.js.map +1 -1
  16. package/dist/internal/animated-text/index.d.cts +47 -0
  17. package/dist/internal/animated-text/index.d.ts +47 -0
  18. package/dist/internal/app-shell/index.d.cts +128 -0
  19. package/dist/internal/app-shell/index.d.ts +128 -0
  20. package/dist/internal/auth/index.d.cts +74 -0
  21. package/dist/internal/auth/index.d.ts +74 -0
  22. package/dist/internal/avatar/index.d.cts +53 -0
  23. package/dist/internal/avatar/index.d.ts +53 -0
  24. package/dist/internal/avatar-group/index.d.cts +70 -0
  25. package/dist/internal/avatar-group/index.d.ts +70 -0
  26. package/dist/internal/badge/index.d.cts +26 -0
  27. package/dist/internal/badge/index.d.ts +26 -0
  28. package/dist/internal/bottom-nav/index.d.cts +29 -0
  29. package/dist/internal/bottom-nav/index.d.ts +29 -0
  30. package/dist/internal/breadcrumbs/index.d.cts +38 -0
  31. package/dist/internal/breadcrumbs/index.d.ts +38 -0
  32. package/dist/internal/button/index.d.cts +34 -0
  33. package/dist/internal/button/index.d.ts +34 -0
  34. package/dist/internal/calendar/index.d.cts +73 -0
  35. package/dist/internal/calendar/index.d.ts +73 -0
  36. package/dist/internal/card/index.d.cts +62 -0
  37. package/dist/internal/card/index.d.ts +62 -0
  38. package/dist/internal/card-grid/index.d.cts +10 -0
  39. package/dist/internal/card-grid/index.d.ts +10 -0
  40. package/dist/internal/checkbox/index.d.cts +40 -0
  41. package/dist/internal/checkbox/index.d.ts +40 -0
  42. package/dist/internal/code-editor/index.d.cts +47 -0
  43. package/dist/internal/code-editor/index.d.ts +47 -0
  44. package/dist/internal/collapsible/index.d.cts +43 -0
  45. package/dist/internal/collapsible/index.d.ts +43 -0
  46. package/dist/internal/command/index.d.cts +80 -0
  47. package/dist/internal/command/index.d.ts +80 -0
  48. package/dist/internal/content-protection/index.d.cts +47 -0
  49. package/dist/internal/content-protection/index.d.ts +47 -0
  50. package/dist/internal/data-table/index.d.cts +73 -0
  51. package/dist/internal/data-table/index.d.ts +73 -0
  52. package/dist/internal/date-picker/index.d.cts +98 -0
  53. package/dist/internal/date-picker/index.d.ts +98 -0
  54. package/dist/internal/device-frame/index.d.cts +40 -0
  55. package/dist/internal/device-frame/index.d.ts +40 -0
  56. package/dist/internal/dialog/index.d.cts +54 -0
  57. package/dist/internal/dialog/index.d.ts +54 -0
  58. package/dist/internal/dropdown-menu/index.d.cts +55 -0
  59. package/dist/internal/dropdown-menu/index.d.ts +55 -0
  60. package/dist/internal/emoji-picker/index.d.cts +77 -0
  61. package/dist/internal/emoji-picker/index.d.ts +77 -0
  62. package/dist/internal/feedback-dialog/index.d.cts +55 -0
  63. package/dist/internal/feedback-dialog/index.d.ts +55 -0
  64. package/dist/internal/file-upload/index.d.cts +91 -0
  65. package/dist/internal/file-upload/index.d.ts +91 -0
  66. package/dist/internal/footer/index.d.cts +30 -0
  67. package/dist/internal/footer/index.d.ts +30 -0
  68. package/dist/internal/inline-editor/index.d.cts +52 -0
  69. package/dist/internal/inline-editor/index.d.ts +52 -0
  70. package/dist/internal/input/index.d.cts +38 -0
  71. package/dist/internal/input/index.d.ts +38 -0
  72. package/dist/internal/input-group/index.d.cts +35 -0
  73. package/dist/internal/input-group/index.d.ts +35 -0
  74. package/dist/internal/install-prompt/index.d.cts +36 -0
  75. package/dist/internal/install-prompt/index.d.ts +36 -0
  76. package/dist/internal/keyboard-shortcut/index.d.cts +49 -0
  77. package/dist/internal/keyboard-shortcut/index.d.ts +49 -0
  78. package/dist/internal/language-selector/index.d.cts +63 -0
  79. package/dist/internal/language-selector/index.d.ts +63 -0
  80. package/dist/internal/markdown-renderer/index.d.cts +40 -0
  81. package/dist/internal/markdown-renderer/index.d.ts +40 -0
  82. package/dist/internal/mobile-nav/index.d.cts +45 -0
  83. package/dist/internal/mobile-nav/index.d.ts +45 -0
  84. package/dist/internal/navbar/index.d.cts +30 -0
  85. package/dist/internal/navbar/index.d.ts +30 -0
  86. package/dist/internal/otp-input/index.d.cts +66 -0
  87. package/dist/internal/otp-input/index.d.ts +66 -0
  88. package/dist/internal/payment/index.d.cts +9 -0
  89. package/dist/internal/payment/index.d.ts +9 -0
  90. package/dist/internal/popover/index.d.cts +46 -0
  91. package/dist/internal/popover/index.d.ts +46 -0
  92. package/dist/internal/presence-indicator/index.d.cts +38 -0
  93. package/dist/internal/presence-indicator/index.d.ts +38 -0
  94. package/dist/internal/progress-display/index.d.cts +60 -0
  95. package/dist/internal/progress-display/index.d.ts +60 -0
  96. package/dist/internal/radio/index.d.ts +43 -0
  97. package/dist/internal/react-accordion/index.d.ts +22 -0
  98. package/dist/internal/react-animated-text/index.d.cts +12 -0
  99. package/dist/internal/react-animated-text/index.d.ts +12 -0
  100. package/dist/internal/react-app-shell/index.d.cts +169 -0
  101. package/dist/internal/react-app-shell/index.d.ts +169 -0
  102. package/dist/internal/react-auth/index.d.cts +59 -0
  103. package/dist/internal/react-auth/index.d.ts +59 -0
  104. package/dist/internal/react-avatar/index.d.cts +20 -0
  105. package/dist/internal/react-avatar/index.d.ts +20 -0
  106. package/dist/internal/react-avatar-group/index.d.cts +33 -0
  107. package/dist/internal/react-avatar-group/index.d.ts +33 -0
  108. package/dist/internal/react-badge/index.d.cts +17 -0
  109. package/dist/internal/react-badge/index.d.ts +17 -0
  110. package/dist/internal/react-bottom-nav/index.d.cts +19 -0
  111. package/dist/internal/react-bottom-nav/index.d.ts +19 -0
  112. package/dist/internal/react-breadcrumbs/index.d.cts +24 -0
  113. package/dist/internal/react-breadcrumbs/index.d.ts +24 -0
  114. package/dist/internal/react-button/index.d.cts +21 -0
  115. package/dist/internal/react-button/index.d.ts +21 -0
  116. package/dist/internal/react-calendar/index.d.cts +44 -0
  117. package/dist/internal/react-calendar/index.d.ts +44 -0
  118. package/dist/internal/react-callout/index.d.cts +12 -0
  119. package/dist/internal/react-callout/index.d.ts +12 -0
  120. package/dist/internal/react-card/index.d.cts +29 -0
  121. package/dist/internal/react-card/index.d.ts +29 -0
  122. package/dist/internal/react-card-grid/index.d.cts +8 -0
  123. package/dist/internal/react-card-grid/index.d.ts +8 -0
  124. package/dist/internal/react-carousel/index.d.ts +22 -0
  125. package/dist/internal/react-checkbox/index.d.cts +18 -0
  126. package/dist/internal/react-checkbox/index.d.ts +18 -0
  127. package/dist/internal/react-code-block/index.d.cts +7 -0
  128. package/dist/internal/react-code-block/index.d.ts +7 -0
  129. package/dist/internal/react-code-editor/index.d.cts +28 -0
  130. package/dist/internal/react-code-editor/index.d.ts +28 -0
  131. package/dist/internal/react-collapsible/index.d.cts +29 -0
  132. package/dist/internal/react-collapsible/index.d.ts +29 -0
  133. package/dist/internal/react-combobox/index.d.cts +94 -0
  134. package/dist/internal/react-combobox/index.d.ts +94 -0
  135. package/dist/internal/react-command/index.d.cts +51 -0
  136. package/dist/internal/react-command/index.d.ts +51 -0
  137. package/dist/internal/react-content-protection/index.d.cts +22 -0
  138. package/dist/internal/react-content-protection/index.d.ts +22 -0
  139. package/dist/internal/react-data-table/index.d.cts +22 -0
  140. package/dist/internal/react-data-table/index.d.ts +22 -0
  141. package/dist/internal/react-date-picker/index.d.cts +23 -0
  142. package/dist/internal/react-date-picker/index.d.ts +23 -0
  143. package/dist/internal/react-device-frame/index.d.cts +37 -0
  144. package/dist/internal/react-device-frame/index.d.ts +37 -0
  145. package/dist/internal/react-dialog/index.d.cts +49 -0
  146. package/dist/internal/react-dialog/index.d.ts +49 -0
  147. package/dist/internal/react-dropdown-menu/index.d.cts +37 -0
  148. package/dist/internal/react-dropdown-menu/index.d.ts +37 -0
  149. package/dist/internal/react-emoji-picker/index.d.cts +32 -0
  150. package/dist/internal/react-emoji-picker/index.d.ts +32 -0
  151. package/dist/internal/react-feedback-dialog/index.d.cts +40 -0
  152. package/dist/internal/react-feedback-dialog/index.d.ts +40 -0
  153. package/dist/internal/react-file-tree/index.d.cts +5 -0
  154. package/dist/internal/react-file-tree/index.d.ts +5 -0
  155. package/dist/internal/react-file-upload/index.d.cts +22 -0
  156. package/dist/internal/react-file-upload/index.d.ts +22 -0
  157. package/dist/internal/react-footer/index.d.cts +20 -0
  158. package/dist/internal/react-footer/index.d.ts +20 -0
  159. package/dist/internal/react-form/index.d.cts +85 -0
  160. package/dist/internal/react-form/index.d.ts +85 -0
  161. package/dist/internal/react-icon-system/index.d.cts +5 -0
  162. package/dist/internal/react-icon-system/index.d.ts +5 -0
  163. package/dist/internal/react-inline-editor/index.d.cts +17 -0
  164. package/dist/internal/react-inline-editor/index.d.ts +17 -0
  165. package/dist/internal/react-input/index.d.cts +31 -0
  166. package/dist/internal/react-input/index.d.ts +31 -0
  167. package/dist/internal/react-input-group/index.d.cts +34 -0
  168. package/dist/internal/react-input-group/index.d.ts +34 -0
  169. package/dist/internal/react-install-prompt/index.d.cts +24 -0
  170. package/dist/internal/react-install-prompt/index.d.ts +24 -0
  171. package/dist/internal/react-keyboard-shortcut/index.d.cts +57 -0
  172. package/dist/internal/react-keyboard-shortcut/index.d.ts +57 -0
  173. package/dist/internal/react-language-selector/index.d.cts +26 -0
  174. package/dist/internal/react-language-selector/index.d.ts +26 -0
  175. package/dist/internal/react-link-card/index.d.cts +5 -0
  176. package/dist/internal/react-link-card/index.d.ts +5 -0
  177. package/dist/internal/react-markdown-renderer/index.d.cts +20 -0
  178. package/dist/internal/react-markdown-renderer/index.d.ts +20 -0
  179. package/dist/internal/react-mobile-nav/index.d.cts +33 -0
  180. package/dist/internal/react-mobile-nav/index.d.ts +33 -0
  181. package/dist/internal/react-navbar/index.d.cts +25 -0
  182. package/dist/internal/react-navbar/index.d.ts +25 -0
  183. package/dist/internal/react-otp-input/index.d.cts +21 -0
  184. package/dist/internal/react-otp-input/index.d.ts +21 -0
  185. package/dist/internal/react-pagination/index.d.ts +7 -0
  186. package/dist/internal/react-payment/index.d.cts +9 -0
  187. package/dist/internal/react-payment/index.d.ts +9 -0
  188. package/dist/internal/react-popover/index.d.cts +33 -0
  189. package/dist/internal/react-popover/index.d.ts +33 -0
  190. package/dist/internal/react-presence-indicator/index.d.cts +34 -0
  191. package/dist/internal/react-presence-indicator/index.d.ts +34 -0
  192. package/dist/internal/react-progress-display/index.d.cts +21 -0
  193. package/dist/internal/react-progress-display/index.d.ts +21 -0
  194. package/dist/internal/react-radio/index.d.ts +33 -0
  195. package/dist/internal/react-reaction-bar/index.d.cts +34 -0
  196. package/dist/internal/react-reaction-bar/index.d.ts +34 -0
  197. package/dist/internal/react-resizable-layout/index.d.cts +36 -0
  198. package/dist/internal/react-resizable-layout/index.d.ts +36 -0
  199. package/dist/internal/react-rich-editor/index.d.cts +2 -0
  200. package/dist/internal/react-rich-editor/index.d.ts +2 -0
  201. package/dist/internal/react-search-bar/index.d.cts +32 -0
  202. package/dist/internal/react-search-bar/index.d.ts +32 -0
  203. package/dist/internal/react-select/index.d.cts +30 -0
  204. package/dist/internal/react-select/index.d.ts +30 -0
  205. package/dist/internal/react-sheet/index.d.cts +67 -0
  206. package/dist/internal/react-sheet/index.d.ts +67 -0
  207. package/dist/internal/react-sidebar/index.d.cts +23 -0
  208. package/dist/internal/react-sidebar/index.d.ts +23 -0
  209. package/dist/internal/react-skeleton/index.d.cts +31 -0
  210. package/dist/internal/react-skeleton/index.d.ts +31 -0
  211. package/dist/internal/react-skip-to-content/index.d.cts +9 -0
  212. package/dist/internal/react-skip-to-content/index.d.ts +9 -0
  213. package/dist/internal/react-slide-viewer/index.d.cts +23 -0
  214. package/dist/internal/react-slide-viewer/index.d.ts +23 -0
  215. package/dist/internal/react-slider/index.d.cts +1 -0
  216. package/dist/internal/react-slider/index.d.ts +1 -0
  217. package/dist/internal/react-status-indicator/index.d.cts +34 -0
  218. package/dist/internal/react-status-indicator/index.d.ts +34 -0
  219. package/dist/internal/react-steps/index.d.cts +19 -0
  220. package/dist/internal/react-steps/index.d.ts +19 -0
  221. package/dist/internal/react-switch/index.d.cts +17 -0
  222. package/dist/internal/react-switch/index.d.ts +17 -0
  223. package/dist/internal/react-table-of-contents/index.d.ts +10 -0
  224. package/dist/internal/react-tabs/index.d.cts +31 -0
  225. package/dist/internal/react-tabs/index.d.ts +31 -0
  226. package/dist/internal/react-textarea/index.d.cts +16 -0
  227. package/dist/internal/react-textarea/index.d.ts +16 -0
  228. package/dist/internal/react-theme/index.d.cts +44 -0
  229. package/dist/internal/react-theme/index.d.ts +44 -0
  230. package/dist/internal/react-thread-view/index.d.cts +34 -0
  231. package/dist/internal/react-thread-view/index.d.ts +34 -0
  232. package/dist/internal/react-toast/index.d.cts +36 -0
  233. package/dist/internal/react-toast/index.d.ts +36 -0
  234. package/dist/internal/react-tooltip/index.d.cts +33 -0
  235. package/dist/internal/react-tooltip/index.d.ts +33 -0
  236. package/dist/internal/react-version-selector/index.d.cts +24 -0
  237. package/dist/internal/react-version-selector/index.d.ts +24 -0
  238. package/dist/internal/react-video-player/index.d.cts +9 -0
  239. package/dist/internal/react-video-player/index.d.ts +9 -0
  240. package/dist/internal/react-voice-pill/index.d.cts +10 -0
  241. package/dist/internal/react-voice-pill/index.d.ts +10 -0
  242. package/dist/internal/react-waveform/index.d.cts +9 -0
  243. package/dist/internal/react-waveform/index.d.ts +9 -0
  244. package/dist/internal/reaction-bar/index.d.cts +50 -0
  245. package/dist/internal/reaction-bar/index.d.ts +50 -0
  246. package/dist/internal/resizable-layout/index.d.cts +47 -0
  247. package/dist/internal/resizable-layout/index.d.ts +47 -0
  248. package/dist/internal/search-bar/index.d.cts +51 -0
  249. package/dist/internal/search-bar/index.d.ts +51 -0
  250. package/dist/internal/select/index.d.cts +69 -0
  251. package/dist/internal/select/index.d.ts +69 -0
  252. package/dist/internal/shared/index.d.cts +249 -0
  253. package/dist/internal/shared/index.d.ts +249 -0
  254. package/dist/internal/sidebar/index.d.cts +40 -0
  255. package/dist/internal/sidebar/index.d.ts +40 -0
  256. package/dist/internal/skeleton/index.d.cts +27 -0
  257. package/dist/internal/skeleton/index.d.ts +27 -0
  258. package/dist/internal/slide-viewer/index.d.cts +72 -0
  259. package/dist/internal/slide-viewer/index.d.ts +72 -0
  260. package/dist/internal/slider/index.d.cts +4 -0
  261. package/dist/internal/slider/index.d.ts +4 -0
  262. package/dist/internal/status-indicator/index.d.cts +42 -0
  263. package/dist/internal/status-indicator/index.d.ts +42 -0
  264. package/dist/internal/switch/index.d.cts +41 -0
  265. package/dist/internal/switch/index.d.ts +41 -0
  266. package/dist/internal/tabs/index.d.cts +45 -0
  267. package/dist/internal/tabs/index.d.ts +45 -0
  268. package/dist/internal/textarea/index.d.cts +28 -0
  269. package/dist/internal/textarea/index.d.ts +28 -0
  270. package/dist/internal/theme/index.d.cts +60 -0
  271. package/dist/internal/theme/index.d.ts +60 -0
  272. package/dist/internal/thread-view/index.d.cts +95 -0
  273. package/dist/internal/thread-view/index.d.ts +95 -0
  274. package/dist/internal/toast/index.d.cts +64 -0
  275. package/dist/internal/toast/index.d.ts +64 -0
  276. package/dist/internal/tooltip/index.d.cts +45 -0
  277. package/dist/internal/tooltip/index.d.ts +45 -0
  278. package/dist/internal/version-selector/index.d.cts +68 -0
  279. package/dist/internal/version-selector/index.d.ts +68 -0
  280. package/dist/internal/video-player/index.d.cts +50 -0
  281. package/dist/internal/video-player/index.d.ts +50 -0
  282. package/dist/internal/voice-pill/index.d.cts +86 -0
  283. package/dist/internal/voice-pill/index.d.ts +86 -0
  284. package/dist/internal/waveform/index.d.cts +83 -0
  285. package/dist/internal/waveform/index.d.ts +83 -0
  286. package/dist/theme.d.cts +1 -1
  287. package/dist/theme.d.ts +1 -1
  288. package/package.json +7 -6
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Framework-agnostic base prop types for all refraction-ui components.
3
+ * These are headless core types — no React, Angular, or Astro imports.
4
+ * Framework wrappers extend these with framework-specific types.
5
+ */
6
+ /** Base props shared by all components */
7
+ interface BaseProps {
8
+ id?: string;
9
+ className?: string;
10
+ style?: Record<string, string | number>;
11
+ [dataAttr: `data-${string}`]: string | undefined;
12
+ }
13
+ /** Accessibility props */
14
+ interface AccessibilityProps {
15
+ role?: string;
16
+ tabIndex?: number;
17
+ 'aria-label'?: string;
18
+ 'aria-labelledby'?: string;
19
+ 'aria-describedby'?: string;
20
+ 'aria-controls'?: string;
21
+ 'aria-expanded'?: boolean;
22
+ 'aria-selected'?: boolean;
23
+ 'aria-hidden'?: boolean;
24
+ 'aria-disabled'?: boolean;
25
+ 'aria-pressed'?: boolean | 'mixed';
26
+ 'aria-checked'?: boolean | 'mixed';
27
+ 'aria-current'?: boolean | 'page' | 'step' | 'location' | 'date' | 'time';
28
+ 'aria-live'?: 'off' | 'assertive' | 'polite';
29
+ 'aria-atomic'?: boolean;
30
+ }
31
+ /** Theme customization props (framework-agnostic) */
32
+ interface ThemeProps {
33
+ variant?: string;
34
+ size?: string;
35
+ colorScheme?: string;
36
+ disabled?: boolean;
37
+ }
38
+ /** Composition props (framework-agnostic) */
39
+ interface CompositionProps {
40
+ asChild?: boolean;
41
+ }
42
+
43
+ /** Standard size scale */
44
+ type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
45
+ /** Standard component variants */
46
+ type Variant = 'default' | 'primary' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link';
47
+ /** Layout orientation */
48
+ type Orientation = 'horizontal' | 'vertical';
49
+ /** Positioning side */
50
+ type Side = 'top' | 'right' | 'bottom' | 'left';
51
+ /** Alignment */
52
+ type Align = 'start' | 'center' | 'end';
53
+ /** Data state attribute values */
54
+ type DataState = 'open' | 'closed' | 'active' | 'inactive';
55
+
56
+ /** Defines the CSS custom properties a component reads */
57
+ interface TokenContract {
58
+ /** Component name */
59
+ name: string;
60
+ /** Map of token name → CSS custom property info */
61
+ tokens: Record<string, TokenDefinition>;
62
+ }
63
+ interface TokenDefinition {
64
+ /** CSS custom property name (e.g., '--rfr-button-bg') */
65
+ variable: string;
66
+ /** Fallback value when the variable is not set */
67
+ fallback: string;
68
+ /** Description of what this token controls */
69
+ description?: string;
70
+ }
71
+
72
+ /** Standard keyboard key constants */
73
+ declare const Keys: {
74
+ readonly Enter: "Enter";
75
+ readonly Space: " ";
76
+ readonly Escape: "Escape";
77
+ readonly Tab: "Tab";
78
+ readonly ArrowUp: "ArrowUp";
79
+ readonly ArrowDown: "ArrowDown";
80
+ readonly ArrowLeft: "ArrowLeft";
81
+ readonly ArrowRight: "ArrowRight";
82
+ readonly Home: "Home";
83
+ readonly End: "End";
84
+ readonly PageUp: "PageUp";
85
+ readonly PageDown: "PageDown";
86
+ readonly Backspace: "Backspace";
87
+ readonly Delete: "Delete";
88
+ };
89
+ type KeyboardKey = (typeof Keys)[keyof typeof Keys];
90
+ /** Map of key → handler function */
91
+ type KeyboardHandlerMap = Partial<Record<string, (event: KeyboardEvent) => void>>;
92
+ /** Create a keyboard event handler from a handler map */
93
+ declare function createKeyboardHandler(handlers: KeyboardHandlerMap): (event: KeyboardEvent) => void;
94
+
95
+ /**
96
+ * Minimal state machine — zero dependencies, < 1KB.
97
+ * Inspired by XState concepts but dramatically simpler.
98
+ */
99
+ interface MachineConfig<TState extends string, TEvent extends string> {
100
+ initial: TState;
101
+ states: Record<TState, {
102
+ on?: Partial<Record<TEvent, TState>>;
103
+ }>;
104
+ }
105
+ interface Machine<TState extends string, TEvent extends string> {
106
+ /** Current state */
107
+ state: TState;
108
+ /** Send an event to transition */
109
+ send(event: TEvent): void;
110
+ /** Subscribe to state changes. Returns unsubscribe function. */
111
+ subscribe(fn: (state: TState) => void): () => void;
112
+ /** Check if machine is in a given state */
113
+ matches(state: TState): boolean;
114
+ }
115
+ declare function createMachine<TState extends string, TEvent extends string>(config: MachineConfig<TState, TEvent>): Machine<TState, TEvent>;
116
+
117
+ /**
118
+ * Focus trap utilities — keeps keyboard focus within a container.
119
+ * Used by Dialog, DropdownMenu, and other overlay components.
120
+ * Pure TypeScript, no DOM dependency (accepts element via parameter).
121
+ */
122
+ /** Selector for all natively focusable elements */
123
+ declare const FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
124
+ /** Get all focusable elements within a container */
125
+ declare function getFocusableElements(container: Element): Element[];
126
+ /** Configuration for creating a focus trap */
127
+ interface FocusTrapConfig {
128
+ /** The container element */
129
+ container: Element;
130
+ /** Called to get the initial focus target */
131
+ initialFocus?: () => Element | null;
132
+ /** Called when Escape is pressed */
133
+ onEscape?: () => void;
134
+ /** Whether to return focus to trigger on deactivate */
135
+ returnFocusOnDeactivate?: boolean;
136
+ }
137
+ /** A focus trap instance */
138
+ interface FocusTrap {
139
+ activate(): void;
140
+ deactivate(): void;
141
+ isActive(): boolean;
142
+ }
143
+ /** Create a focus trap that keeps Tab/Shift+Tab within a container */
144
+ declare function createFocusTrap(config: FocusTrapConfig): FocusTrap;
145
+
146
+ /**
147
+ * Screen reader announcement utility.
148
+ * Creates and manages an aria-live region for dynamic content updates.
149
+ */
150
+ interface LiveRegionConfig {
151
+ /** 'polite' (default) or 'assertive' */
152
+ politeness?: 'polite' | 'assertive';
153
+ /** Clear the announcement after this many ms. Default: 5000 */
154
+ clearAfterMs?: number;
155
+ }
156
+ interface LiveRegion {
157
+ announce(message: string): void;
158
+ clear(): void;
159
+ destroy(): void;
160
+ }
161
+ /** Create a live region that announces messages to screen readers */
162
+ declare function createLiveRegion(config?: LiveRegionConfig): LiveRegion;
163
+
164
+ interface EngineAdapter<TState = Record<string, unknown>, TMethods = Record<string, unknown>, TReturnProps = Record<string, unknown>> {
165
+ name: string;
166
+ state: TState;
167
+ methods: TMethods;
168
+ getProps: (elementName: string, props?: Record<string, unknown>) => TReturnProps;
169
+ }
170
+
171
+ /**
172
+ * Skip-to-content link utility.
173
+ * Provides a keyboard-accessible link that is visually hidden until focused.
174
+ */
175
+ /** Props for a skip-to-content link */
176
+ interface SkipLinkProps {
177
+ /** ID of the target element. Default: 'main-content' */
178
+ targetId?: string;
179
+ /** Label text for the link. Default: 'Skip to main content' */
180
+ label?: string;
181
+ }
182
+ /** Create props for a skip-to-content link */
183
+ declare function createSkipLink(props?: SkipLinkProps): {
184
+ ariaProps: Record<string, string>;
185
+ href: string;
186
+ label: string;
187
+ /** CSS classes — visually hidden until focused */
188
+ className: string;
189
+ };
190
+
191
+ /** Merge multiple ARIA prop objects, later values override earlier ones */
192
+ declare function mergeAriaProps(...propSets: Array<Record<string, unknown>>): Record<string, unknown>;
193
+ /**
194
+ * Generate a unique ID, safe for SSR (deterministic within a render pass).
195
+ * In browsers, uses crypto.randomUUID when available.
196
+ */
197
+ declare function generateId(prefix?: string): string;
198
+ /** Reset the ID counter (useful for tests) */
199
+ declare function resetIdCounter(): void;
200
+
201
+ /**
202
+ * Lightweight class name utility — our own implementation.
203
+ * Handles conditional classes, arrays, and falsy values.
204
+ * No external dependencies (no clsx, no tailwind-merge).
205
+ *
206
+ * For Tailwind class conflict resolution (e.g., 'p-2 p-4' → 'p-4'),
207
+ * consumers can use @refraction-ui/tailwind-config which provides
208
+ * a tw-merge-aware variant of this function.
209
+ */
210
+ type ClassValue = string | number | boolean | undefined | null | ClassValue[];
211
+ type ClassRecord = Record<string, boolean | undefined | null>;
212
+ declare function cn(...inputs: Array<ClassValue | ClassRecord>): string;
213
+
214
+ /**
215
+ * Lightweight class-variance-authority alternative — zero dependencies.
216
+ * Creates variant-driven class name functions for components.
217
+ */
218
+ interface VariantConfig {
219
+ [variant: string]: Record<string, string>;
220
+ }
221
+ interface CVAConfig<V extends VariantConfig> {
222
+ base?: string;
223
+ variants?: V;
224
+ defaultVariants?: {
225
+ [K in keyof V]?: keyof V[K];
226
+ };
227
+ compoundVariants?: Array<{
228
+ [K in keyof V]?: keyof V[K];
229
+ } & {
230
+ class: string;
231
+ }>;
232
+ }
233
+ type VariantProps<V extends VariantConfig> = {
234
+ [K in keyof V]?: keyof V[K];
235
+ };
236
+ declare function cva<V extends VariantConfig>(config: CVAConfig<V>): (props?: VariantProps<V> & {
237
+ className?: string;
238
+ }) => string;
239
+
240
+ /**
241
+ * Reduced motion utilities.
242
+ * Respects user preferences for reduced motion.
243
+ */
244
+ /** Check if user prefers reduced motion */
245
+ declare function prefersReducedMotion(): boolean;
246
+ /** Get animation duration — returns '0ms' if reduced motion preferred */
247
+ declare function getAnimationDuration(normalDuration: string): string;
248
+
249
+ export { type AccessibilityProps, type Align, type BaseProps, type CompositionProps, type DataState, type EngineAdapter, FOCUSABLE_SELECTOR, type FocusTrap, type FocusTrapConfig, type KeyboardHandlerMap, type KeyboardKey, Keys, type LiveRegion, type LiveRegionConfig, type Machine, type MachineConfig, type Orientation, type Side, type Size, type SkipLinkProps, type ThemeProps, type TokenContract, type TokenDefinition, type Variant, cn, createFocusTrap, createKeyboardHandler, createLiveRegion, createMachine, createSkipLink, cva, generateId, getAnimationDuration, getFocusableElements, mergeAriaProps, prefersReducedMotion, resetIdCounter };
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Framework-agnostic base prop types for all refraction-ui components.
3
+ * These are headless core types — no React, Angular, or Astro imports.
4
+ * Framework wrappers extend these with framework-specific types.
5
+ */
6
+ /** Base props shared by all components */
7
+ interface BaseProps {
8
+ id?: string;
9
+ className?: string;
10
+ style?: Record<string, string | number>;
11
+ [dataAttr: `data-${string}`]: string | undefined;
12
+ }
13
+ /** Accessibility props */
14
+ interface AccessibilityProps {
15
+ role?: string;
16
+ tabIndex?: number;
17
+ 'aria-label'?: string;
18
+ 'aria-labelledby'?: string;
19
+ 'aria-describedby'?: string;
20
+ 'aria-controls'?: string;
21
+ 'aria-expanded'?: boolean;
22
+ 'aria-selected'?: boolean;
23
+ 'aria-hidden'?: boolean;
24
+ 'aria-disabled'?: boolean;
25
+ 'aria-pressed'?: boolean | 'mixed';
26
+ 'aria-checked'?: boolean | 'mixed';
27
+ 'aria-current'?: boolean | 'page' | 'step' | 'location' | 'date' | 'time';
28
+ 'aria-live'?: 'off' | 'assertive' | 'polite';
29
+ 'aria-atomic'?: boolean;
30
+ }
31
+ /** Theme customization props (framework-agnostic) */
32
+ interface ThemeProps {
33
+ variant?: string;
34
+ size?: string;
35
+ colorScheme?: string;
36
+ disabled?: boolean;
37
+ }
38
+ /** Composition props (framework-agnostic) */
39
+ interface CompositionProps {
40
+ asChild?: boolean;
41
+ }
42
+
43
+ /** Standard size scale */
44
+ type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
45
+ /** Standard component variants */
46
+ type Variant = 'default' | 'primary' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link';
47
+ /** Layout orientation */
48
+ type Orientation = 'horizontal' | 'vertical';
49
+ /** Positioning side */
50
+ type Side = 'top' | 'right' | 'bottom' | 'left';
51
+ /** Alignment */
52
+ type Align = 'start' | 'center' | 'end';
53
+ /** Data state attribute values */
54
+ type DataState = 'open' | 'closed' | 'active' | 'inactive';
55
+
56
+ /** Defines the CSS custom properties a component reads */
57
+ interface TokenContract {
58
+ /** Component name */
59
+ name: string;
60
+ /** Map of token name → CSS custom property info */
61
+ tokens: Record<string, TokenDefinition>;
62
+ }
63
+ interface TokenDefinition {
64
+ /** CSS custom property name (e.g., '--rfr-button-bg') */
65
+ variable: string;
66
+ /** Fallback value when the variable is not set */
67
+ fallback: string;
68
+ /** Description of what this token controls */
69
+ description?: string;
70
+ }
71
+
72
+ /** Standard keyboard key constants */
73
+ declare const Keys: {
74
+ readonly Enter: "Enter";
75
+ readonly Space: " ";
76
+ readonly Escape: "Escape";
77
+ readonly Tab: "Tab";
78
+ readonly ArrowUp: "ArrowUp";
79
+ readonly ArrowDown: "ArrowDown";
80
+ readonly ArrowLeft: "ArrowLeft";
81
+ readonly ArrowRight: "ArrowRight";
82
+ readonly Home: "Home";
83
+ readonly End: "End";
84
+ readonly PageUp: "PageUp";
85
+ readonly PageDown: "PageDown";
86
+ readonly Backspace: "Backspace";
87
+ readonly Delete: "Delete";
88
+ };
89
+ type KeyboardKey = (typeof Keys)[keyof typeof Keys];
90
+ /** Map of key → handler function */
91
+ type KeyboardHandlerMap = Partial<Record<string, (event: KeyboardEvent) => void>>;
92
+ /** Create a keyboard event handler from a handler map */
93
+ declare function createKeyboardHandler(handlers: KeyboardHandlerMap): (event: KeyboardEvent) => void;
94
+
95
+ /**
96
+ * Minimal state machine — zero dependencies, < 1KB.
97
+ * Inspired by XState concepts but dramatically simpler.
98
+ */
99
+ interface MachineConfig<TState extends string, TEvent extends string> {
100
+ initial: TState;
101
+ states: Record<TState, {
102
+ on?: Partial<Record<TEvent, TState>>;
103
+ }>;
104
+ }
105
+ interface Machine<TState extends string, TEvent extends string> {
106
+ /** Current state */
107
+ state: TState;
108
+ /** Send an event to transition */
109
+ send(event: TEvent): void;
110
+ /** Subscribe to state changes. Returns unsubscribe function. */
111
+ subscribe(fn: (state: TState) => void): () => void;
112
+ /** Check if machine is in a given state */
113
+ matches(state: TState): boolean;
114
+ }
115
+ declare function createMachine<TState extends string, TEvent extends string>(config: MachineConfig<TState, TEvent>): Machine<TState, TEvent>;
116
+
117
+ /**
118
+ * Focus trap utilities — keeps keyboard focus within a container.
119
+ * Used by Dialog, DropdownMenu, and other overlay components.
120
+ * Pure TypeScript, no DOM dependency (accepts element via parameter).
121
+ */
122
+ /** Selector for all natively focusable elements */
123
+ declare const FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
124
+ /** Get all focusable elements within a container */
125
+ declare function getFocusableElements(container: Element): Element[];
126
+ /** Configuration for creating a focus trap */
127
+ interface FocusTrapConfig {
128
+ /** The container element */
129
+ container: Element;
130
+ /** Called to get the initial focus target */
131
+ initialFocus?: () => Element | null;
132
+ /** Called when Escape is pressed */
133
+ onEscape?: () => void;
134
+ /** Whether to return focus to trigger on deactivate */
135
+ returnFocusOnDeactivate?: boolean;
136
+ }
137
+ /** A focus trap instance */
138
+ interface FocusTrap {
139
+ activate(): void;
140
+ deactivate(): void;
141
+ isActive(): boolean;
142
+ }
143
+ /** Create a focus trap that keeps Tab/Shift+Tab within a container */
144
+ declare function createFocusTrap(config: FocusTrapConfig): FocusTrap;
145
+
146
+ /**
147
+ * Screen reader announcement utility.
148
+ * Creates and manages an aria-live region for dynamic content updates.
149
+ */
150
+ interface LiveRegionConfig {
151
+ /** 'polite' (default) or 'assertive' */
152
+ politeness?: 'polite' | 'assertive';
153
+ /** Clear the announcement after this many ms. Default: 5000 */
154
+ clearAfterMs?: number;
155
+ }
156
+ interface LiveRegion {
157
+ announce(message: string): void;
158
+ clear(): void;
159
+ destroy(): void;
160
+ }
161
+ /** Create a live region that announces messages to screen readers */
162
+ declare function createLiveRegion(config?: LiveRegionConfig): LiveRegion;
163
+
164
+ interface EngineAdapter<TState = Record<string, unknown>, TMethods = Record<string, unknown>, TReturnProps = Record<string, unknown>> {
165
+ name: string;
166
+ state: TState;
167
+ methods: TMethods;
168
+ getProps: (elementName: string, props?: Record<string, unknown>) => TReturnProps;
169
+ }
170
+
171
+ /**
172
+ * Skip-to-content link utility.
173
+ * Provides a keyboard-accessible link that is visually hidden until focused.
174
+ */
175
+ /** Props for a skip-to-content link */
176
+ interface SkipLinkProps {
177
+ /** ID of the target element. Default: 'main-content' */
178
+ targetId?: string;
179
+ /** Label text for the link. Default: 'Skip to main content' */
180
+ label?: string;
181
+ }
182
+ /** Create props for a skip-to-content link */
183
+ declare function createSkipLink(props?: SkipLinkProps): {
184
+ ariaProps: Record<string, string>;
185
+ href: string;
186
+ label: string;
187
+ /** CSS classes — visually hidden until focused */
188
+ className: string;
189
+ };
190
+
191
+ /** Merge multiple ARIA prop objects, later values override earlier ones */
192
+ declare function mergeAriaProps(...propSets: Array<Record<string, unknown>>): Record<string, unknown>;
193
+ /**
194
+ * Generate a unique ID, safe for SSR (deterministic within a render pass).
195
+ * In browsers, uses crypto.randomUUID when available.
196
+ */
197
+ declare function generateId(prefix?: string): string;
198
+ /** Reset the ID counter (useful for tests) */
199
+ declare function resetIdCounter(): void;
200
+
201
+ /**
202
+ * Lightweight class name utility — our own implementation.
203
+ * Handles conditional classes, arrays, and falsy values.
204
+ * No external dependencies (no clsx, no tailwind-merge).
205
+ *
206
+ * For Tailwind class conflict resolution (e.g., 'p-2 p-4' → 'p-4'),
207
+ * consumers can use @refraction-ui/tailwind-config which provides
208
+ * a tw-merge-aware variant of this function.
209
+ */
210
+ type ClassValue = string | number | boolean | undefined | null | ClassValue[];
211
+ type ClassRecord = Record<string, boolean | undefined | null>;
212
+ declare function cn(...inputs: Array<ClassValue | ClassRecord>): string;
213
+
214
+ /**
215
+ * Lightweight class-variance-authority alternative — zero dependencies.
216
+ * Creates variant-driven class name functions for components.
217
+ */
218
+ interface VariantConfig {
219
+ [variant: string]: Record<string, string>;
220
+ }
221
+ interface CVAConfig<V extends VariantConfig> {
222
+ base?: string;
223
+ variants?: V;
224
+ defaultVariants?: {
225
+ [K in keyof V]?: keyof V[K];
226
+ };
227
+ compoundVariants?: Array<{
228
+ [K in keyof V]?: keyof V[K];
229
+ } & {
230
+ class: string;
231
+ }>;
232
+ }
233
+ type VariantProps<V extends VariantConfig> = {
234
+ [K in keyof V]?: keyof V[K];
235
+ };
236
+ declare function cva<V extends VariantConfig>(config: CVAConfig<V>): (props?: VariantProps<V> & {
237
+ className?: string;
238
+ }) => string;
239
+
240
+ /**
241
+ * Reduced motion utilities.
242
+ * Respects user preferences for reduced motion.
243
+ */
244
+ /** Check if user prefers reduced motion */
245
+ declare function prefersReducedMotion(): boolean;
246
+ /** Get animation duration — returns '0ms' if reduced motion preferred */
247
+ declare function getAnimationDuration(normalDuration: string): string;
248
+
249
+ export { type AccessibilityProps, type Align, type BaseProps, type CompositionProps, type DataState, type EngineAdapter, FOCUSABLE_SELECTOR, type FocusTrap, type FocusTrapConfig, type KeyboardHandlerMap, type KeyboardKey, Keys, type LiveRegion, type LiveRegionConfig, type Machine, type MachineConfig, type Orientation, type Side, type Size, type SkipLinkProps, type ThemeProps, type TokenContract, type TokenDefinition, type Variant, cn, createFocusTrap, createKeyboardHandler, createLiveRegion, createMachine, createSkipLink, cva, generateId, getAnimationDuration, getFocusableElements, mergeAriaProps, prefersReducedMotion, resetIdCounter };
@@ -0,0 +1,40 @@
1
+ interface SidebarItem {
2
+ label: string;
3
+ href: string;
4
+ icon?: string;
5
+ /** Roles required to see this item */
6
+ roles?: string[];
7
+ /** Nested items */
8
+ children?: SidebarItem[];
9
+ }
10
+ interface SidebarSection {
11
+ title?: string;
12
+ items: SidebarItem[];
13
+ }
14
+ interface SidebarProps {
15
+ sections?: SidebarSection[];
16
+ currentPath?: string;
17
+ collapsed?: boolean;
18
+ userRoles?: string[];
19
+ }
20
+ interface SidebarAPI {
21
+ ariaProps: Record<string, string>;
22
+ isActive: (href: string) => boolean;
23
+ isVisible: (item: SidebarItem) => boolean;
24
+ itemAriaProps: (href: string) => Record<string, string>;
25
+ visibleSections: SidebarSection[];
26
+ }
27
+ declare function createSidebar(props?: SidebarProps): SidebarAPI;
28
+
29
+ declare const sidebarVariants: (props?: ({
30
+ collapsed?: "true" | "false" | undefined;
31
+ } & {
32
+ className?: string;
33
+ }) | undefined) => string;
34
+ declare const sidebarItemVariants: (props?: ({
35
+ active?: "true" | "false" | undefined;
36
+ } & {
37
+ className?: string;
38
+ }) | undefined) => string;
39
+
40
+ export { type SidebarAPI, type SidebarItem, type SidebarProps, type SidebarSection, createSidebar, sidebarItemVariants, sidebarVariants };
@@ -0,0 +1,40 @@
1
+ interface SidebarItem {
2
+ label: string;
3
+ href: string;
4
+ icon?: string;
5
+ /** Roles required to see this item */
6
+ roles?: string[];
7
+ /** Nested items */
8
+ children?: SidebarItem[];
9
+ }
10
+ interface SidebarSection {
11
+ title?: string;
12
+ items: SidebarItem[];
13
+ }
14
+ interface SidebarProps {
15
+ sections?: SidebarSection[];
16
+ currentPath?: string;
17
+ collapsed?: boolean;
18
+ userRoles?: string[];
19
+ }
20
+ interface SidebarAPI {
21
+ ariaProps: Record<string, string>;
22
+ isActive: (href: string) => boolean;
23
+ isVisible: (item: SidebarItem) => boolean;
24
+ itemAriaProps: (href: string) => Record<string, string>;
25
+ visibleSections: SidebarSection[];
26
+ }
27
+ declare function createSidebar(props?: SidebarProps): SidebarAPI;
28
+
29
+ declare const sidebarVariants: (props?: ({
30
+ collapsed?: "true" | "false" | undefined;
31
+ } & {
32
+ className?: string;
33
+ }) | undefined) => string;
34
+ declare const sidebarItemVariants: (props?: ({
35
+ active?: "true" | "false" | undefined;
36
+ } & {
37
+ className?: string;
38
+ }) | undefined) => string;
39
+
40
+ export { type SidebarAPI, type SidebarItem, type SidebarProps, type SidebarSection, createSidebar, sidebarItemVariants, sidebarVariants };
@@ -0,0 +1,27 @@
1
+ import { AccessibilityProps } from '../shared/index.cjs';
2
+
3
+ type SkeletonShape = 'text' | 'circular' | 'rectangular' | 'rounded';
4
+ interface SkeletonProps {
5
+ shape?: SkeletonShape;
6
+ width?: string | number;
7
+ height?: string | number;
8
+ /** Number of lines to render for the text shape variant */
9
+ lines?: number;
10
+ /** Whether to animate the skeleton pulse. Defaults to true */
11
+ animate?: boolean;
12
+ }
13
+ interface SkeletonAPI {
14
+ /** ARIA attributes to spread on the element */
15
+ ariaProps: Partial<AccessibilityProps>;
16
+ /** Data attributes for CSS styling hooks */
17
+ dataAttributes: Record<string, string>;
18
+ }
19
+ declare function createSkeleton(props?: SkeletonProps): SkeletonAPI;
20
+
21
+ declare const skeletonVariants: (props?: ({
22
+ shape?: "text" | "circular" | "rectangular" | "rounded" | undefined;
23
+ } & {
24
+ className?: string;
25
+ }) | undefined) => string;
26
+
27
+ export { type SkeletonAPI, type SkeletonProps, type SkeletonShape, createSkeleton, skeletonVariants };
@@ -0,0 +1,27 @@
1
+ import { AccessibilityProps } from '../shared/index.js';
2
+
3
+ type SkeletonShape = 'text' | 'circular' | 'rectangular' | 'rounded';
4
+ interface SkeletonProps {
5
+ shape?: SkeletonShape;
6
+ width?: string | number;
7
+ height?: string | number;
8
+ /** Number of lines to render for the text shape variant */
9
+ lines?: number;
10
+ /** Whether to animate the skeleton pulse. Defaults to true */
11
+ animate?: boolean;
12
+ }
13
+ interface SkeletonAPI {
14
+ /** ARIA attributes to spread on the element */
15
+ ariaProps: Partial<AccessibilityProps>;
16
+ /** Data attributes for CSS styling hooks */
17
+ dataAttributes: Record<string, string>;
18
+ }
19
+ declare function createSkeleton(props?: SkeletonProps): SkeletonAPI;
20
+
21
+ declare const skeletonVariants: (props?: ({
22
+ shape?: "text" | "circular" | "rectangular" | "rounded" | undefined;
23
+ } & {
24
+ className?: string;
25
+ }) | undefined) => string;
26
+
27
+ export { type SkeletonAPI, type SkeletonProps, type SkeletonShape, createSkeleton, skeletonVariants };