@endfield-ui/react 1.2.0 → 1.2.1

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 (477) hide show
  1. package/README.md +8 -3
  2. package/dist/components/accordion/Accordion.d.ts +46 -0
  3. package/dist/components/accordion/Accordion.js +2 -0
  4. package/dist/components/accordion/index.d.ts +3 -0
  5. package/dist/components/alert/Alert.d.ts +28 -0
  6. package/dist/components/alert/Alert.js +2 -0
  7. package/dist/components/alert/index.d.ts +3 -0
  8. package/dist/components/avatar/Avatar.d.ts +24 -0
  9. package/dist/components/avatar/Avatar.js +2 -0
  10. package/dist/components/avatar/AvatarSwitcher.d.ts +46 -0
  11. package/dist/components/avatar/AvatarSwitcher.js +2 -0
  12. package/dist/components/avatar/index.d.ts +4 -0
  13. package/dist/components/back-to-top/BackToTop.d.ts +21 -0
  14. package/dist/components/back-to-top/BackToTop.js +2 -0
  15. package/dist/components/back-to-top/index.d.ts +3 -0
  16. package/dist/components/badge/Badge.d.ts +20 -0
  17. package/dist/components/badge/Badge.js +2 -0
  18. package/dist/components/badge/index.d.ts +3 -0
  19. package/dist/components/bracket-title/BracketTitle.d.ts +17 -0
  20. package/dist/components/bracket-title/BracketTitle.js +2 -0
  21. package/dist/components/bracket-title/index.d.ts +3 -0
  22. package/dist/components/breadcrumb/Breadcrumb.d.ts +26 -0
  23. package/dist/components/breadcrumb/Breadcrumb.js +2 -0
  24. package/dist/components/breadcrumb/index.d.ts +3 -0
  25. package/dist/components/button/Button.d.ts +50 -0
  26. package/dist/components/button/Button.js +2 -0
  27. package/dist/components/button/ButtonGroup.d.ts +21 -0
  28. package/dist/components/button/ButtonGroup.js +2 -0
  29. package/dist/components/button/index.d.ts +4 -0
  30. package/dist/components/calendar/Calendar.d.ts +57 -0
  31. package/dist/components/calendar/Calendar.js +2 -0
  32. package/dist/components/calendar/index.d.ts +3 -0
  33. package/dist/components/carousel/Carousel.d.ts +38 -0
  34. package/dist/components/carousel/Carousel.js +2 -0
  35. package/dist/components/carousel/index.d.ts +3 -0
  36. package/dist/components/carousel/snap-track.js +2 -0
  37. package/dist/components/checkbox/Checkbox.d.ts +18 -0
  38. package/dist/components/checkbox/Checkbox.js +2 -0
  39. package/dist/components/checkbox/choice-style.js +2 -0
  40. package/dist/components/checkbox/index.d.ts +3 -0
  41. package/dist/components/chip/FilterChip.d.ts +18 -0
  42. package/dist/components/chip/FilterChip.js +2 -0
  43. package/dist/components/chip/ResourceChip.d.ts +16 -0
  44. package/dist/components/chip/ResourceChip.js +2 -0
  45. package/dist/components/chip/capsule-style.d.ts +4 -0
  46. package/dist/components/chip/capsule-style.js +2 -0
  47. package/dist/components/chip/index.d.ts +4 -0
  48. package/dist/components/combobox/Combobox.d.ts +105 -0
  49. package/dist/components/combobox/Combobox.js +2 -0
  50. package/dist/components/combobox/index.d.ts +3 -0
  51. package/dist/components/completion-banner/CompletionBanner.d.ts +26 -0
  52. package/dist/components/completion-banner/CompletionBanner.js +2 -0
  53. package/dist/components/completion-banner/index.d.ts +3 -0
  54. package/dist/components/context-menu/ContextMenu.d.ts +30 -0
  55. package/dist/components/context-menu/ContextMenu.js +2 -0
  56. package/dist/components/context-menu/index.d.ts +3 -0
  57. package/dist/components/corner-brackets/CornerBrackets.d.ts +20 -0
  58. package/dist/components/corner-brackets/CornerBrackets.js +2 -0
  59. package/dist/components/corner-brackets/index.d.ts +3 -0
  60. package/dist/components/countdown/Countdown.d.ts +26 -0
  61. package/dist/components/countdown/Countdown.js +2 -0
  62. package/dist/components/countdown/index.d.ts +3 -0
  63. package/dist/components/dash-indicator/DashIndicator.d.ts +15 -0
  64. package/dist/components/dash-indicator/DashIndicator.js +2 -0
  65. package/dist/components/dash-indicator/index.d.ts +3 -0
  66. package/dist/components/data-row/DataRow.d.ts +58 -0
  67. package/dist/components/data-row/DataRow.js +2 -0
  68. package/dist/components/data-row/index.d.ts +3 -0
  69. package/dist/components/date-picker/DateField.js +2 -0
  70. package/dist/components/date-picker/DatePicker.d.ts +56 -0
  71. package/dist/components/date-picker/DatePicker.js +2 -0
  72. package/dist/components/date-picker/DateRangePicker.d.ts +57 -0
  73. package/dist/components/date-picker/DateRangePicker.js +2 -0
  74. package/dist/components/date-picker/index.d.ts +4 -0
  75. package/dist/components/dialog/Dialog.d.ts +55 -0
  76. package/dist/components/dialog/Dialog.js +2 -0
  77. package/dist/components/dialog/index.d.ts +3 -0
  78. package/dist/components/dialog/initial-focus.js +2 -0
  79. package/dist/components/dialog/overlay-style.js +2 -0
  80. package/dist/components/drawer/Drawer.d.ts +48 -0
  81. package/dist/components/drawer/Drawer.js +2 -0
  82. package/dist/components/drawer/index.d.ts +3 -0
  83. package/dist/components/dropdown-menu/DropdownMenu.d.ts +115 -0
  84. package/dist/components/dropdown-menu/DropdownMenu.js +2 -0
  85. package/dist/components/dropdown-menu/MenuCheck.js +2 -0
  86. package/dist/components/dropdown-menu/index.d.ts +3 -0
  87. package/dist/components/dropdown-menu/menu-style.d.ts +4 -0
  88. package/dist/components/dropdown-menu/menu-style.js +2 -0
  89. package/dist/components/empty-state/EmptyState.d.ts +22 -0
  90. package/dist/components/empty-state/EmptyState.js +2 -0
  91. package/dist/components/empty-state/index.d.ts +3 -0
  92. package/dist/components/field/Field.d.ts +58 -0
  93. package/dist/components/field/Field.js +2 -0
  94. package/dist/components/field/index.d.ts +3 -0
  95. package/dist/components/file-upload/FileItem.d.ts +50 -0
  96. package/dist/components/file-upload/FileItem.js +2 -0
  97. package/dist/components/file-upload/FileUpload.d.ts +82 -0
  98. package/dist/components/file-upload/FileUpload.js +2 -0
  99. package/dist/components/file-upload/index.d.ts +4 -0
  100. package/dist/components/flyout-bar/FlyoutBar.d.ts +46 -0
  101. package/dist/components/flyout-bar/FlyoutBar.js +2 -0
  102. package/dist/components/flyout-bar/index.d.ts +3 -0
  103. package/dist/components/ghost-text/GhostText.d.ts +21 -0
  104. package/dist/components/ghost-text/GhostText.js +2 -0
  105. package/dist/components/ghost-text/index.d.ts +3 -0
  106. package/dist/components/hatch/Hatch.d.ts +18 -0
  107. package/dist/components/hatch/Hatch.js +2 -0
  108. package/dist/components/hatch/index.d.ts +3 -0
  109. package/dist/components/hazard-stripe/HazardStripe.d.ts +15 -0
  110. package/dist/components/hazard-stripe/HazardStripe.js +2 -0
  111. package/dist/components/hazard-stripe/index.d.ts +3 -0
  112. package/dist/components/hover-card/HoverCard.d.ts +35 -0
  113. package/dist/components/hover-card/HoverCard.js +2 -0
  114. package/dist/components/hover-card/index.d.ts +3 -0
  115. package/dist/components/icon-button/IconButton.d.ts +21 -0
  116. package/dist/components/icon-button/IconButton.js +2 -0
  117. package/dist/components/icon-button/index.d.ts +3 -0
  118. package/dist/components/image-viewer/ImageViewer.d.ts +48 -0
  119. package/dist/components/image-viewer/ImageViewer.js +2 -0
  120. package/dist/components/image-viewer/index.d.ts +3 -0
  121. package/dist/components/input/Input.d.ts +27 -0
  122. package/dist/components/input/Input.js +2 -0
  123. package/dist/components/input/control-box.d.ts +5 -0
  124. package/dist/components/input/control-box.js +2 -0
  125. package/dist/components/input/index.d.ts +3 -0
  126. package/dist/components/input/value-chip.js +2 -0
  127. package/dist/components/item-slot/ItemGrid.d.ts +12 -0
  128. package/dist/components/item-slot/ItemGrid.js +2 -0
  129. package/dist/components/item-slot/ItemSlot.d.ts +54 -0
  130. package/dist/components/item-slot/ItemSlot.js +2 -0
  131. package/dist/components/item-slot/index.d.ts +4 -0
  132. package/dist/components/kbd/Kbd.d.ts +15 -0
  133. package/dist/components/kbd/Kbd.js +2 -0
  134. package/dist/components/kbd/index.d.ts +3 -0
  135. package/dist/components/link-element/LinkElement.d.ts +6 -0
  136. package/dist/components/link-element/LinkElement.js +2 -0
  137. package/dist/components/list/List.d.ts +46 -0
  138. package/dist/components/list/List.js +2 -0
  139. package/dist/components/list/band-style.js +2 -0
  140. package/dist/components/list/index.d.ts +3 -0
  141. package/dist/components/loader/Loader.d.ts +23 -0
  142. package/dist/components/loader/Loader.js +2 -0
  143. package/dist/components/loader/index.d.ts +3 -0
  144. package/dist/components/marquee/Marquee.d.ts +22 -0
  145. package/dist/components/marquee/Marquee.js +2 -0
  146. package/dist/components/marquee/index.d.ts +3 -0
  147. package/dist/components/media-card/MediaCard.d.ts +36 -0
  148. package/dist/components/media-card/MediaCard.js +2 -0
  149. package/dist/components/media-card/index.d.ts +3 -0
  150. package/dist/components/nav-action/NavAction.d.ts +34 -0
  151. package/dist/components/nav-action/NavAction.js +2 -0
  152. package/dist/components/nav-action/index.d.ts +3 -0
  153. package/dist/components/nav-menu/NavMenu.d.ts +57 -0
  154. package/dist/components/nav-menu/NavMenu.js +2 -0
  155. package/dist/components/nav-menu/index.d.ts +3 -0
  156. package/dist/components/navigator/Navigator.d.ts +27 -0
  157. package/dist/components/navigator/Navigator.js +2 -0
  158. package/dist/components/navigator/index.d.ts +3 -0
  159. package/dist/components/otp-input/OtpInput.d.ts +52 -0
  160. package/dist/components/otp-input/OtpInput.js +2 -0
  161. package/dist/components/otp-input/index.d.ts +3 -0
  162. package/dist/components/page-header/PageHeader.d.ts +56 -0
  163. package/dist/components/page-header/PageHeader.js +2 -0
  164. package/dist/components/page-header/index.d.ts +3 -0
  165. package/dist/components/pagination/Pagination.d.ts +29 -0
  166. package/dist/components/pagination/Pagination.js +2 -0
  167. package/dist/components/pagination/index.d.ts +3 -0
  168. package/dist/components/panel/Panel.d.ts +36 -0
  169. package/dist/components/panel/Panel.js +2 -0
  170. package/dist/components/panel/index.d.ts +3 -0
  171. package/dist/components/play-button/PlayButton.d.ts +20 -0
  172. package/dist/components/play-button/PlayButton.js +2 -0
  173. package/dist/components/play-button/index.d.ts +3 -0
  174. package/dist/components/popover/Popover.d.ts +36 -0
  175. package/dist/components/popover/Popover.js +2 -0
  176. package/dist/components/popover/index.d.ts +3 -0
  177. package/dist/components/popover/panel-style.js +2 -0
  178. package/dist/components/progress/Progress.d.ts +27 -0
  179. package/dist/components/progress/Progress.js +2 -0
  180. package/dist/components/progress/ProgressRing.d.ts +23 -0
  181. package/dist/components/progress/ProgressRing.js +2 -0
  182. package/dist/components/progress/index.d.ts +4 -0
  183. package/dist/components/radio/Radio.d.ts +33 -0
  184. package/dist/components/radio/Radio.js +2 -0
  185. package/dist/components/radio/index.d.ts +3 -0
  186. package/dist/components/rec-indicator/RecIndicator.d.ts +16 -0
  187. package/dist/components/rec-indicator/RecIndicator.js +2 -0
  188. package/dist/components/rec-indicator/index.d.ts +3 -0
  189. package/dist/components/registration-strip/RegistrationStrip.d.ts +16 -0
  190. package/dist/components/registration-strip/RegistrationStrip.js +2 -0
  191. package/dist/components/registration-strip/index.d.ts +3 -0
  192. package/dist/components/rolling-number/RollingNumber.d.ts +25 -0
  193. package/dist/components/rolling-number/RollingNumber.js +2 -0
  194. package/dist/components/rolling-number/index.d.ts +3 -0
  195. package/dist/components/schedule/Schedule.d.ts +78 -0
  196. package/dist/components/schedule/Schedule.js +2 -0
  197. package/dist/components/schedule/index.d.ts +3 -0
  198. package/dist/components/scroll-area/ScrollArea.d.ts +26 -0
  199. package/dist/components/scroll-area/ScrollArea.js +2 -0
  200. package/dist/components/scroll-area/index.d.ts +3 -0
  201. package/dist/components/scroll-hint/ScrollHint.d.ts +23 -0
  202. package/dist/components/scroll-hint/ScrollHint.js +2 -0
  203. package/dist/components/scroll-hint/index.d.ts +3 -0
  204. package/dist/components/section-title/SectionTitle.d.ts +33 -0
  205. package/dist/components/section-title/SectionTitle.js +2 -0
  206. package/dist/components/section-title/index.d.ts +3 -0
  207. package/dist/components/segmented-control/SegmentedControl.d.ts +49 -0
  208. package/dist/components/segmented-control/SegmentedControl.js +2 -0
  209. package/dist/components/segmented-control/index.d.ts +3 -0
  210. package/dist/components/select/Select.d.ts +95 -0
  211. package/dist/components/select/Select.js +2 -0
  212. package/dist/components/select/index.d.ts +3 -0
  213. package/dist/components/side-rail/SideRail.d.ts +62 -0
  214. package/dist/components/side-rail/SideRail.js +2 -0
  215. package/dist/components/side-rail/SideRailSub.d.ts +47 -0
  216. package/dist/components/side-rail/SideRailSub.js +2 -0
  217. package/dist/components/side-rail/index.d.ts +4 -0
  218. package/dist/components/skeleton/Skeleton.d.ts +22 -0
  219. package/dist/components/skeleton/Skeleton.js +2 -0
  220. package/dist/components/skeleton/index.d.ts +3 -0
  221. package/dist/components/slider/Slider.d.ts +63 -0
  222. package/dist/components/slider/Slider.js +2 -0
  223. package/dist/components/slider/index.d.ts +3 -0
  224. package/dist/components/sparkline/Sparkline.d.ts +32 -0
  225. package/dist/components/sparkline/Sparkline.js +2 -0
  226. package/dist/components/sparkline/index.d.ts +3 -0
  227. package/dist/components/spinner/Spinner.d.ts +19 -0
  228. package/dist/components/spinner/Spinner.js +2 -0
  229. package/dist/components/spinner/index.d.ts +3 -0
  230. package/dist/components/splash-screen/SplashScreen.d.ts +43 -0
  231. package/dist/components/splash-screen/SplashScreen.js +2 -0
  232. package/dist/components/splash-screen/index.d.ts +3 -0
  233. package/dist/components/stat/Stat.d.ts +22 -0
  234. package/dist/components/stat/Stat.js +2 -0
  235. package/dist/components/stat/index.d.ts +3 -0
  236. package/dist/components/stepper/Stepper.d.ts +29 -0
  237. package/dist/components/stepper/Stepper.js +2 -0
  238. package/dist/components/stepper/index.d.ts +3 -0
  239. package/dist/components/steps/Steps.d.ts +55 -0
  240. package/dist/components/steps/Steps.js +2 -0
  241. package/dist/components/steps/index.d.ts +3 -0
  242. package/dist/components/switch/Switch.d.ts +28 -0
  243. package/dist/components/switch/Switch.js +2 -0
  244. package/dist/components/switch/index.d.ts +3 -0
  245. package/dist/components/table/Table.d.ts +96 -0
  246. package/dist/components/table/Table.js +2 -0
  247. package/dist/components/table/index.d.ts +3 -0
  248. package/dist/components/tabs/Tabs.d.ts +39 -0
  249. package/dist/components/tabs/Tabs.js +2 -0
  250. package/dist/components/tabs/index.d.ts +3 -0
  251. package/dist/components/tag/Tag.d.ts +25 -0
  252. package/dist/components/tag/Tag.js +2 -0
  253. package/dist/components/tag/TagPair.d.ts +16 -0
  254. package/dist/components/tag/TagPair.js +2 -0
  255. package/dist/components/tag/index.d.ts +4 -0
  256. package/dist/components/tag-input/TagInput.d.ts +66 -0
  257. package/dist/components/tag-input/TagInput.js +3 -0
  258. package/dist/components/tag-input/index.d.ts +3 -0
  259. package/dist/components/term/Term.d.ts +19 -0
  260. package/dist/components/term/Term.js +2 -0
  261. package/dist/components/term/index.d.ts +3 -0
  262. package/dist/components/textarea/Textarea.d.ts +17 -0
  263. package/dist/components/textarea/Textarea.js +2 -0
  264. package/dist/components/textarea/index.d.ts +3 -0
  265. package/dist/components/texture/Texture.d.ts +19 -0
  266. package/dist/components/texture/Texture.js +2 -0
  267. package/dist/components/texture/index.d.ts +3 -0
  268. package/dist/components/tick-ring/TickRing.d.ts +22 -0
  269. package/dist/components/tick-ring/TickRing.js +2 -0
  270. package/dist/components/tick-ring/index.d.ts +3 -0
  271. package/dist/components/timeline/Timeline.d.ts +22 -0
  272. package/dist/components/timeline/Timeline.js +2 -0
  273. package/dist/components/timeline/index.d.ts +3 -0
  274. package/dist/components/toast/Toast.d.ts +45 -0
  275. package/dist/components/toast/Toast.js +2 -0
  276. package/dist/components/toast/index.d.ts +3 -0
  277. package/dist/components/toc/Toc.d.ts +46 -0
  278. package/dist/components/toc/Toc.js +2 -0
  279. package/dist/components/toc/index.d.ts +3 -0
  280. package/dist/components/toolbar/Toolbar.d.ts +97 -0
  281. package/dist/components/toolbar/Toolbar.js +2 -0
  282. package/dist/components/toolbar/index.d.ts +3 -0
  283. package/dist/components/tooltip/Tooltip.d.ts +47 -0
  284. package/dist/components/tooltip/Tooltip.js +2 -0
  285. package/dist/components/tooltip/index.d.ts +3 -0
  286. package/dist/components/top-bar/TopBar.d.ts +21 -0
  287. package/dist/components/top-bar/TopBar.js +2 -0
  288. package/dist/components/top-bar/index.d.ts +3 -0
  289. package/dist/components/viewfinder/Viewfinder.d.ts +35 -0
  290. package/dist/components/viewfinder/Viewfinder.js +2 -0
  291. package/dist/components/viewfinder/index.d.ts +3 -0
  292. package/dist/game/animated-dialog/AnimatedDialog.d.ts +53 -0
  293. package/dist/game/animated-dialog/AnimatedDialog.js +2 -0
  294. package/dist/game/animated-dialog/index.d.ts +3 -0
  295. package/dist/game/banner-alert/AlertIcons.js +2 -0
  296. package/dist/game/banner-alert/AlertModal.js +2 -0
  297. package/dist/game/banner-alert/BannerAlert.d.ts +6 -0
  298. package/dist/game/banner-alert/BannerAlert.js +2 -0
  299. package/dist/game/banner-alert/index.d.ts +3 -0
  300. package/dist/game/banner-alert/types.d.ts +48 -0
  301. package/dist/game/banner-alert/types.js +2 -0
  302. package/dist/game/banner-alert/useAlertActions.js +2 -0
  303. package/dist/game/banner-alert/useAlertGlitch.js +2 -0
  304. package/dist/game/full-width-alert/FullWidthAlert.d.ts +7 -0
  305. package/dist/game/full-width-alert/FullWidthAlert.js +2 -0
  306. package/dist/game/full-width-alert/index.d.ts +3 -0
  307. package/dist/game/item-card/ItemCard.d.ts +48 -0
  308. package/dist/game/item-card/ItemCard.js +2 -0
  309. package/dist/game/item-card/index.d.ts +3 -0
  310. package/dist/game/item-hover-card/ItemHoverCard.d.ts +31 -0
  311. package/dist/game/item-hover-card/ItemHoverCard.js +2 -0
  312. package/dist/game/item-hover-card/events.js +2 -0
  313. package/dist/game/item-hover-card/index.d.ts +3 -0
  314. package/dist/game/item-icon/ItemIcon.d.ts +5 -0
  315. package/dist/game/item-icon/ItemIcon.js +2 -0
  316. package/dist/game/item-icon/helpers.d.ts +22 -0
  317. package/dist/game/item-icon/helpers.js +2 -0
  318. package/dist/game/item-icon/index.d.ts +5 -0
  319. package/dist/game/item-icon/types.d.ts +32 -0
  320. package/dist/game/item-tooltip-card/ItemTooltipCard.d.ts +6 -0
  321. package/dist/game/item-tooltip-card/ItemTooltipCard.js +2 -0
  322. package/dist/game/item-tooltip-card/icons.js +2 -0
  323. package/dist/game/item-tooltip-card/index.d.ts +4 -0
  324. package/dist/game/item-tooltip-card/types.d.ts +40 -0
  325. package/dist/game/lib/core.d.ts +8 -0
  326. package/dist/game/lib/first-focusable.js +2 -0
  327. package/dist/game/rounded-button/RoundedButton.d.ts +22 -0
  328. package/dist/game/rounded-button/RoundedButton.js +2 -0
  329. package/dist/game/rounded-button/RoundedIconButton.d.ts +10 -0
  330. package/dist/game/rounded-button/RoundedIconButton.js +2 -0
  331. package/dist/game/rounded-button/index.d.ts +4 -0
  332. package/dist/game/rounded-select/RoundedSelect.d.ts +43 -0
  333. package/dist/game/rounded-select/RoundedSelect.js +2 -0
  334. package/dist/game/rounded-select/index.d.ts +3 -0
  335. package/dist/game/rounded-switch/RoundedSwitch.d.ts +16 -0
  336. package/dist/game/rounded-switch/RoundedSwitch.js +2 -0
  337. package/dist/game/rounded-switch/index.d.ts +3 -0
  338. package/dist/game/rounded-toggle/RoundedToggle.d.ts +23 -0
  339. package/dist/game/rounded-toggle/RoundedToggle.js +2 -0
  340. package/dist/game/rounded-toggle/index.d.ts +3 -0
  341. package/dist/game/rounded-toggle/keyboard.js +2 -0
  342. package/dist/game/rounded-toggle/spring-highlight.js +2 -0
  343. package/dist/game/splash-screen/EndfieldSplashScreen.d.ts +14 -0
  344. package/dist/game/splash-screen/EndfieldSplashScreen.js +2 -0
  345. package/dist/game/splash-screen/index.d.ts +3 -0
  346. package/dist/game.d.ts +29 -383
  347. package/dist/game.js +1 -2068
  348. package/dist/hooks/index.d.ts +7 -0
  349. package/dist/hooks/useAddedKeys.js +2 -0
  350. package/dist/hooks/useControllableState.d.ts +12 -0
  351. package/dist/hooks/useControllableState.js +2 -0
  352. package/dist/hooks/useFlip.js +2 -0
  353. package/dist/hooks/useInView.d.ts +15 -0
  354. package/dist/hooks/useInView.js +2 -0
  355. package/dist/hooks/useIndicator.js +2 -0
  356. package/dist/hooks/useLingering.js +2 -0
  357. package/dist/hooks/useOverflowing.js +2 -0
  358. package/dist/hooks/usePortalScope.d.ts +26 -0
  359. package/dist/hooks/usePortalScope.js +2 -0
  360. package/dist/hooks/usePresence.js +2 -0
  361. package/dist/hooks/useReducedMotion.d.ts +10 -0
  362. package/dist/hooks/useReducedMotion.js +2 -0
  363. package/dist/hooks/useScrollPosition.js +2 -0
  364. package/dist/hooks/useTheme.d.ts +21 -0
  365. package/dist/hooks/useTheme.js +2 -0
  366. package/dist/icons/ArrowCorner.d.ts +9 -0
  367. package/dist/icons/ArrowCorner.js +2 -0
  368. package/dist/icons/ArrowLeft.d.ts +8 -0
  369. package/dist/icons/ArrowLeft.js +2 -0
  370. package/dist/icons/ArrowRight.d.ts +8 -0
  371. package/dist/icons/ArrowRight.js +2 -0
  372. package/dist/icons/CalendarIcon.d.ts +12 -0
  373. package/dist/icons/CalendarIcon.js +2 -0
  374. package/dist/icons/Check.d.ts +9 -0
  375. package/dist/icons/Check.js +2 -0
  376. package/dist/icons/ChevronDown.d.ts +8 -0
  377. package/dist/icons/ChevronDown.js +2 -0
  378. package/dist/icons/ChevronLeft.d.ts +8 -0
  379. package/dist/icons/ChevronLeft.js +2 -0
  380. package/dist/icons/ChevronRight.d.ts +8 -0
  381. package/dist/icons/ChevronRight.js +2 -0
  382. package/dist/icons/Close.d.ts +8 -0
  383. package/dist/icons/Close.js +2 -0
  384. package/dist/icons/Crosshair.d.ts +9 -0
  385. package/dist/icons/Crosshair.js +2 -0
  386. package/dist/icons/Lock.d.ts +8 -0
  387. package/dist/icons/Lock.js +2 -0
  388. package/dist/icons/Menu.d.ts +9 -0
  389. package/dist/icons/Menu.js +2 -0
  390. package/dist/icons/Minus.d.ts +9 -0
  391. package/dist/icons/Minus.js +2 -0
  392. package/dist/icons/Plus.d.ts +8 -0
  393. package/dist/icons/Plus.js +2 -0
  394. package/dist/icons/StatusDanger.d.ts +9 -0
  395. package/dist/icons/StatusDanger.js +2 -0
  396. package/dist/icons/StatusInfo.d.ts +9 -0
  397. package/dist/icons/StatusInfo.js +2 -0
  398. package/dist/icons/StatusSuccess.d.ts +9 -0
  399. package/dist/icons/StatusSuccess.js +2 -0
  400. package/dist/icons/StatusWarning.d.ts +9 -0
  401. package/dist/icons/StatusWarning.js +2 -0
  402. package/dist/icons/TriangleRight.d.ts +9 -0
  403. package/dist/icons/TriangleRight.js +2 -0
  404. package/dist/icons/Upload.d.ts +9 -0
  405. package/dist/icons/Upload.js +2 -0
  406. package/dist/icons/createIcon.d.ts +16 -0
  407. package/dist/icons/createIcon.js +2 -0
  408. package/dist/icons/index.d.ts +23 -0
  409. package/dist/index.d.ts +209 -3546
  410. package/dist/index.js +1 -9848
  411. package/dist/lib/cn.d.ts +5 -0
  412. package/dist/lib/cn.js +2 -0
  413. package/dist/lib/create-lazy-context.js +2 -0
  414. package/dist/lib/date.js +2 -0
  415. package/dist/lib/decor.js +2 -0
  416. package/dist/lib/defined.js +2 -0
  417. package/dist/lib/file.js +2 -0
  418. package/dist/lib/focus-ring.js +2 -0
  419. package/dist/lib/inline-style.js +2 -0
  420. package/dist/lib/merge-refs.js +2 -0
  421. package/dist/lib/motion.js +2 -0
  422. package/package.json +17 -11
  423. package/src/components/accordion/Accordion.tsx +13 -5
  424. package/src/components/avatar/AvatarSwitcher.tsx +7 -5
  425. package/src/components/carousel/Carousel.tsx +6 -5
  426. package/src/components/context-menu/ContextMenu.tsx +5 -2
  427. package/src/components/data-row/DataRow.tsx +10 -4
  428. package/src/components/date-picker/DateField.tsx +1 -1
  429. package/src/components/dropdown-menu/DropdownMenu.tsx +7 -4
  430. package/src/components/dropdown-menu/menu-style.ts +3 -2
  431. package/src/components/field/Field.tsx +10 -6
  432. package/src/components/flyout-bar/FlyoutBar.tsx +1 -1
  433. package/src/components/image-viewer/ImageViewer.tsx +6 -5
  434. package/src/components/list/List.tsx +7 -5
  435. package/src/components/nav-action/NavAction.tsx +4 -3
  436. package/src/components/nav-menu/NavMenu.tsx +13 -7
  437. package/src/components/radio/Radio.tsx +7 -5
  438. package/src/components/schedule/Schedule.tsx +7 -5
  439. package/src/components/segmented-control/SegmentedControl.tsx +7 -5
  440. package/src/components/select/Select.tsx +11 -9
  441. package/src/components/side-rail/SideRail.tsx +15 -9
  442. package/src/components/side-rail/SideRailSub.tsx +12 -7
  443. package/src/components/steps/Steps.tsx +7 -5
  444. package/src/components/table/Table.tsx +23 -17
  445. package/src/components/tabs/Tabs.tsx +7 -5
  446. package/src/components/toast/Toast.tsx +8 -5
  447. package/src/components/toc/Toc.tsx +5 -4
  448. package/src/components/toolbar/Toolbar.tsx +7 -6
  449. package/src/components/tooltip/Tooltip.tsx +7 -4
  450. package/src/components/top-bar/TopBar.tsx +7 -2
  451. package/src/icons/ArrowCorner.tsx +1 -1
  452. package/src/icons/ArrowLeft.tsx +1 -1
  453. package/src/icons/ArrowRight.tsx +1 -1
  454. package/src/icons/CalendarIcon.tsx +1 -1
  455. package/src/icons/Check.tsx +4 -1
  456. package/src/icons/ChevronDown.tsx +4 -1
  457. package/src/icons/ChevronLeft.tsx +1 -1
  458. package/src/icons/ChevronRight.tsx +1 -1
  459. package/src/icons/Close.tsx +4 -1
  460. package/src/icons/Crosshair.tsx +1 -1
  461. package/src/icons/Lock.tsx +1 -1
  462. package/src/icons/Menu.tsx +4 -1
  463. package/src/icons/Minus.tsx +1 -1
  464. package/src/icons/Plus.tsx +4 -1
  465. package/src/icons/StatusDanger.tsx +1 -1
  466. package/src/icons/StatusInfo.tsx +1 -1
  467. package/src/icons/StatusSuccess.tsx +1 -1
  468. package/src/icons/StatusWarning.tsx +1 -1
  469. package/src/icons/TriangleRight.tsx +1 -1
  470. package/src/icons/Upload.tsx +1 -1
  471. package/src/lib/cn.ts +1 -1
  472. package/src/lib/create-lazy-context.ts +6 -0
  473. package/src/components/README.md +0 -191
  474. package/src/hooks/README.md +0 -20
  475. package/src/icons/README.md +0 -31
  476. package/src/lib/README.md +0 -19
  477. package/src/styles/README.md +0 -77
@@ -0,0 +1,5 @@
1
+
2
+ import { ClassValue } from "clsx";
3
+ //#region src/lib/cn.d.ts
4
+ export declare function cn(...inputs: ClassValue[]): string;
5
+ //#endregion
package/dist/lib/cn.js ADDED
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{clsx as e}from"clsx";import{extendTailwindMerge as t}from"tailwind-merge";const n=/* @__PURE__ */ t({extend:{theme:{text:[`micro`,`ghost`],tracking:[`ghost`,`label`],shadow:[`rail`],ease:[`standard`,`emphasis`,`exit`],animate:[`flicker`,`fill`,`scroll-hint`,`breathe`,`marquee`,`spin-slow`,`blink`,`slide-in`,`turn-in`,`fade-in`,`indeterminate`,`bracket-in`,`shift-in`,`wipe-in`]}}});function r(...t){return n(e(t))}export{r as cn};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{createContext as e}from"react";function t(t){let n;return()=>n??=e(t)}export{t as createLazyContext};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=/^(\d{4})-(\d{2})-(\d{2})$/,t=864e5,n=(e,t=2)=>String(e).padStart(t,`0`),r=t=>{let n=e.exec(t);return n?Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3])):NaN},i=e=>{let t=new Date(e);return`${n(t.getUTCFullYear(),4)}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())}`};function a(){let e=/* @__PURE__ */ new Date;return`${n(e.getFullYear(),4)}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function o(e){let[t,n,r]=e.split(`-`).map(Number);return{year:t,month:n,day:r}}function s(e,n){return i(r(e)+n*t)}function c(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function l(e,t){let{year:r,month:i,day:a}=o(e),s=r*12+(i-1)+t,l=Math.floor(s/12),u=s%12+1;return`${n(l,4)}-${n(u)}-${n(Math.min(a,c(l,u)))}`}function u(e,n){return Math.round((r(n)-r(e))/t)}function d(e){return new Date(r(e)).getUTCDay()}function f(e,t,n){return t&&e<t?t:n&&e>n?n:e}function p(e,t){return e<=t?[e,t]:[t,e]}function m(e){return e.slice(0,7)}function h(e,t){return m(l(`${e}-01`,t))}function g(e,t=1){return s(e,-((d(e)-t+7)%7))}function _(e,t=1){let n=g(`${e}-01`,t);return Array.from({length:6},(e,t)=>Array.from({length:7},(e,r)=>s(n,t*7+r)))}function v(e,t){let n=u(e,t)+1;return Array.from({length:Math.max(0,n)},(t,n)=>s(e,n))}function y(e){return new Date(r(e))}export{s as addDays,l as addMonths,h as addMonthsToMonth,f as clampDate,o as dateParts,d as dayOfWeek,u as daysBetween,c as daysInMonth,v as eachDay,_ as monthGrid,m as monthOf,p as orderDates,g as startOfWeek,y as toDateObject,a as today};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=`pointer-events-none select-none forced-colors:hidden print:hidden`;export{e as decor};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ function e(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}export{e as defined};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ function e(e,t){let n=(t??``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!0;let r=e.name.toLowerCase(),i=e.type.toLowerCase();return n.some(e=>e.startsWith(`.`)?r.endsWith(e):e.endsWith(`/*`)?i.startsWith(e.slice(0,-1)):i===e)}const t=[`B`,`KB`,`MB`,`GB`,`TB`];function n(e){if(!Number.isFinite(e)||e<0)return``;let n=e,r=0,i=()=>r===0||n>=100?Math.round(n):Math.round(n*10)/10;for(;r<t.length-1&&i()>=1024;)n/=1024,r+=1;return`${i()} ${t[r]}`}function r(e){let t=e.lastIndexOf(`.`);if(t<=0||t===e.length-1)return``;let n=e.slice(t+1);return/^[a-z0-9]{1,5}$/i.test(n)?n.toUpperCase():``}function i(e,t){return e.name===t.name&&e.size===t.size&&e.lastModified===t.lastModified}export{r as fileExtension,n as formatFileSize,e as matchesAccept,i as sameFile};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`,t=`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,n=`has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-focus`;export{e as focusRing,t as focusRingInset,n as focusRingWithin};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ function e(e){e.style.length===0&&e.hasAttribute(`style`)&&e.removeAttribute(`style`)}export{e as dropEmptyStyle};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ function e(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n&&(n.current=t)}}export{e as mergeRefs};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ const e=[`data-starting-style:data-[side=bottom]:-translate-y-(--motion-shift)`,`data-starting-style:data-[side=top]:translate-y-(--motion-shift)`,`data-starting-style:data-[side=right]:-translate-x-(--motion-shift)`,`data-starting-style:data-[side=left]:translate-x-(--motion-shift)`,`data-starting-style:data-[side=inline-end]:-translate-x-(--motion-shift)`,`data-starting-style:data-[side=inline-start]:translate-x-(--motion-shift)`].join(` `),t=[`grid grid-rows-[1fr]`,`transition-[grid-template-rows] duration-(--duration-base) ease-standard`,`data-leaving:grid-rows-[0fr] data-leaving:duration-(--duration-fast)`].join(` `),n=`starting:grid-rows-[0fr]`,r=`min-h-0 min-w-0 overflow-y-clip`,i=`animate-fade-in [animation-duration:var(--duration-fast)]`,a=[`relative isolate`,`after:pointer-events-none after:absolute after:top-0 after:left-0 after:-z-1`,`after:hidden data-indicator:after:block`,`after:opacity-0 data-[indicator=on]:after:opacity-100`,`after:transition-[translate,width,height,opacity] after:duration-(--duration-fast) after:ease-standard`,`data-[indicator=off]:after:transition-[opacity]`,`data-indicator-instant:after:transition-none`].join(` `),o=[`after:h-(--indicator-h) after:w-(--indicator-w)`,`after:translate-x-(--indicator-x) after:translate-y-(--indicator-y)`].join(` `),s=[`relative isolate content-start overflow-y-clip`,`transition-[min-height] duration-(--duration-fast) ease-standard`].join(` `),c=[`data-leaving:pointer-events-none data-leaving:absolute data-leaving:-z-1`,`data-leaving:opacity-0`].join(` `);export{t as collapse,n as collapseEnter,r as collapseInner,e as enterFromSide,i as fadeInFast,s as flipBox,c as flipLeaving,a as indicator,o as indicatorBox};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endfield-ui/react",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "终末地风格的 React 基础控件库(非官方)",
5
5
  "keywords": [
6
6
  "react",
@@ -33,6 +33,7 @@
33
33
  "!src/**/*.test.*",
34
34
  "!src/test",
35
35
  "!src/game",
36
+ "!src/**/*.md",
36
37
  "NOTICE.md"
37
38
  ],
38
39
  "exports": {
@@ -62,31 +63,36 @@
62
63
  }
63
64
  },
64
65
  "dependencies": {
65
- "@base-ui/react": "^1.8.0",
66
+ "@base-ui/react": "^1.9.0",
66
67
  "clsx": "^2.1.1",
67
68
  "tailwind-merge": "^3.7.0"
68
69
  },
69
70
  "devDependencies": {
70
- "@tailwindcss/cli": "^4.3.3",
71
+ "@rollup/plugin-commonjs": "^29.0.3",
72
+ "@rollup/plugin-node-resolve": "^16.0.3",
73
+ "@tailwindcss/node": "^4.3.3",
74
+ "@tailwindcss/oxide": "^4.3.3",
71
75
  "@testing-library/dom": "^10.4.2",
72
76
  "@testing-library/jest-dom": "^7.0.1",
73
77
  "@testing-library/react": "^16.3.3",
74
- "@testing-library/user-event": "^14.6.7",
78
+ "@testing-library/user-event": "^14.6.8",
75
79
  "@types/react": "^19.3.0",
76
80
  "@types/react-dom": "^19.3.0",
77
- "jsdom": "^30.1.2",
78
- "react": "^19.3.0",
79
- "react-dom": "^19.3.0",
81
+ "jsdom": "^30.1.3",
82
+ "react": "^19.3.1",
83
+ "react-dom": "^19.3.1",
84
+ "rollup": "^4.64.12",
80
85
  "tailwindcss": "^4.3.3",
81
- "tsdown": "^0.23.0",
86
+ "tsdown": "^0.23.1",
82
87
  "typescript": "^7.0.2",
83
- "vitest": "^5.0.3"
88
+ "vitest": "^5.0.5"
84
89
  },
85
90
  "scripts": {
86
91
  "build": "tsdown && pnpm build:css && pnpm build:game",
87
- "build:css": "tailwindcss -i src/styles/index.css -o dist/styles.css --minify",
88
- "build:game": "tailwindcss -i src/game/styles.css -o dist/game/styles.css --minify && node scripts/copy-game-assets.mjs",
92
+ "build:css": "node scripts/build-css.mjs src/styles/index.css dist/styles.css",
93
+ "build:game": "node scripts/build-css.mjs src/game/styles.css dist/game/styles.css && node scripts/copy-game-assets.mjs",
89
94
  "test": "vitest run",
95
+ "test:package": "node --test scripts/package.test.mjs",
90
96
  "test:watch": "vitest",
91
97
  "typecheck": "tsc --noEmit"
92
98
  }
@@ -1,6 +1,5 @@
1
1
  import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
2
2
  import {
3
- createContext,
4
3
  useContext,
5
4
  useMemo,
6
5
  type ComponentProps,
@@ -9,11 +8,12 @@ import {
9
8
  import { Minus } from "../../icons/Minus";
10
9
  import { cn } from "../../lib/cn";
11
10
  import { focusRingInset } from "../../lib/focus-ring";
11
+ import { createLazyContext } from "../../lib/create-lazy-context";
12
12
 
13
13
  export type AccordionSize = "sm" | "md";
14
14
  export type AccordionLevel = 2 | 3 | 4 | 5 | 6;
15
15
 
16
- const AccordionContext = createContext<{
16
+ const getAccordionContext = /* @__PURE__ */ createLazyContext<{
17
17
  size: AccordionSize;
18
18
  level: AccordionLevel;
19
19
  }>({ size: "md", level: 3 });
@@ -59,10 +59,11 @@ export function Accordion({
59
59
  children,
60
60
  ...props
61
61
  }: AccordionProps) {
62
+ const AccordionContext = getAccordionContext();
62
63
  const context = useMemo(() => ({ size, level }), [size, level]);
63
64
 
64
65
  return (
65
- <AccordionContext value={context}>
66
+ <AccordionContext.Provider value={context}>
66
67
  <BaseAccordion.Root
67
68
  {...props}
68
69
  multiple={multiple}
@@ -78,7 +79,7 @@ export function Accordion({
78
79
  >
79
80
  {children}
80
81
  </BaseAccordion.Root>
81
- </AccordionContext>
82
+ </AccordionContext.Provider>
82
83
  );
83
84
  }
84
85
 
@@ -112,7 +113,7 @@ export function AccordionItem({
112
113
  children,
113
114
  ...props
114
115
  }: AccordionItemProps) {
115
- const { size, level } = useContext(AccordionContext);
116
+ const { size, level } = useContext(getAccordionContext());
116
117
  const Heading = `h${level}` as const;
117
118
 
118
119
  return (
@@ -124,6 +125,13 @@ export function AccordionItem({
124
125
  >
125
126
  <BaseAccordion.Header render={<Heading />} className="flex">
126
127
  <BaseAccordion.Trigger
128
+ render={(props, state) => (
129
+ <button
130
+ {...props}
131
+ disabled={false}
132
+ aria-disabled={state.disabled || undefined}
133
+ />
134
+ )}
127
135
  className={cn(
128
136
  "group/trigger flex w-full items-center gap-3 px-4 text-left font-medium",
129
137
  "transition-colors duration-(--duration-fast) ease-standard",
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  Children,
3
- createContext,
4
3
  isValidElement,
5
4
  useContext,
6
5
  useEffect,
@@ -17,6 +16,7 @@ import { ChevronRight } from "../../icons/ChevronRight";
17
16
  import { cn } from "../../lib/cn";
18
17
  import { IconButton } from "../icon-button/IconButton";
19
18
  import { Avatar, type AvatarSize } from "./Avatar";
19
+ import { createLazyContext } from "../../lib/create-lazy-context";
20
20
 
21
21
  export type AvatarSwitcherOrientation = "vertical" | "horizontal";
22
22
 
@@ -27,7 +27,8 @@ type SwitcherContextValue = {
27
27
  select: (value: string) => void;
28
28
  };
29
29
 
30
- const SwitcherContext = createContext<SwitcherContextValue | null>(null);
30
+ const getSwitcherContext =
31
+ /* @__PURE__ */ createLazyContext<SwitcherContextValue | null>(null);
31
32
 
32
33
  export type AvatarSwitcherProps = Omit<
33
34
  ComponentProps<"div">,
@@ -74,6 +75,7 @@ export function AvatarSwitcher({
74
75
  children,
75
76
  ...props
76
77
  }: AvatarSwitcherProps) {
78
+ const SwitcherContext = getSwitcherContext();
77
79
  const generatedName = useId();
78
80
  const name = nameProp ?? generatedName;
79
81
  const vertical = orientation === "vertical";
@@ -138,7 +140,7 @@ export function AvatarSwitcher({
138
140
  const Next = vertical ? ChevronDown : ChevronRight;
139
141
 
140
142
  return (
141
- <SwitcherContext value={context}>
143
+ <SwitcherContext.Provider value={context}>
142
144
  <div
143
145
  {...props}
144
146
  role="radiogroup"
@@ -185,7 +187,7 @@ export function AvatarSwitcher({
185
187
  <Next />
186
188
  </IconButton>
187
189
  </div>
188
- </SwitcherContext>
190
+ </SwitcherContext.Provider>
189
191
  );
190
192
  }
191
193
 
@@ -213,7 +215,7 @@ export function AvatarSwitcherItem({
213
215
  children,
214
216
  ...props
215
217
  }: AvatarSwitcherItemProps) {
216
- const context = useContext(SwitcherContext);
218
+ const context = useContext(getSwitcherContext());
217
219
  if (!context) {
218
220
  throw new Error("AvatarSwitcherItem 要放在 AvatarSwitcher 里面");
219
221
  }
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  Children,
3
- createContext,
4
3
  isValidElement,
5
4
  useContext,
6
5
  type ComponentProps,
@@ -15,6 +14,7 @@ import { focusRing } from "../../lib/focus-ring";
15
14
  import { DashIndicator } from "../dash-indicator/DashIndicator";
16
15
  import { IconButton } from "../icon-button/IconButton";
17
16
  import { useSnapTrack } from "./snap-track";
17
+ import { createLazyContext } from "../../lib/create-lazy-context";
18
18
 
19
19
  export type CarouselRatio = "16/9" | "4/3" | "1/1" | "3/4" | "21/9";
20
20
 
@@ -26,7 +26,7 @@ const ratioClass: Record<CarouselRatio, string> = {
26
26
  "21/9": "aspect-21/9",
27
27
  };
28
28
 
29
- const SlideContext = createContext<{
29
+ const getSlideContext = /* @__PURE__ */ createLazyContext<{
30
30
  position: number;
31
31
  count: number;
32
32
  current: boolean;
@@ -73,6 +73,7 @@ export function Carousel({
73
73
  children,
74
74
  ...props
75
75
  }: CarouselProps) {
76
+ const SlideContext = getSlideContext();
76
77
  // 标题和说明从子元素上读,所以子元素必须直接是 CarouselSlide
77
78
  const slides = Children.toArray(children).filter((child) =>
78
79
  isValidElement<SlideLike>(child),
@@ -151,12 +152,12 @@ export function Carousel({
151
152
  )}
152
153
  >
153
154
  {slides.map((slide, position) => (
154
- <SlideContext
155
+ <SlideContext.Provider
155
156
  key={position}
156
157
  value={{ position, count, current: position === index }}
157
158
  >
158
159
  {slide}
159
- </SlideContext>
160
+ </SlideContext.Provider>
160
161
  ))}
161
162
  </div>
162
163
  {/* 压在媒体左下角的一对圆钮。它们在轨道外面:轨道滚的时候不跟着走 */}
@@ -228,7 +229,7 @@ export function CarouselSlide({
228
229
  children,
229
230
  ...props
230
231
  }: CarouselSlideProps) {
231
- const slide = useContext(SlideContext);
232
+ const slide = useContext(getSlideContext());
232
233
  if (!slide) {
233
234
  throw new Error("CarouselSlide 要直接放在 Carousel 里面");
234
235
  }
@@ -3,7 +3,7 @@ import type { ReactElement, ReactNode } from "react";
3
3
  import { usePortalScope } from "../../hooks/usePortalScope";
4
4
  import { cn } from "../../lib/cn";
5
5
  import {
6
- MenuVariantContext,
6
+ getMenuVariantContext,
7
7
  menuPanel,
8
8
  type MenuVariant,
9
9
  } from "../dropdown-menu/menu-style";
@@ -42,6 +42,7 @@ export function ContextMenu({
42
42
  disabled,
43
43
  className,
44
44
  }: ContextMenuProps) {
45
+ const MenuVariantContext = getMenuVariantContext();
45
46
  const { anchorRef, portalRef } = usePortalScope();
46
47
 
47
48
  return (
@@ -61,7 +62,9 @@ export function ContextMenu({
61
62
  className,
62
63
  )}
63
64
  >
64
- <MenuVariantContext value={variant}>{menu}</MenuVariantContext>
65
+ <MenuVariantContext.Provider value={variant}>
66
+ {menu}
67
+ </MenuVariantContext.Provider>
65
68
  </BaseContextMenu.Popup>
66
69
  </BaseContextMenu.Positioner>
67
70
  </BaseContextMenu.Portal>
@@ -1,5 +1,4 @@
1
1
  import {
2
- createContext,
3
2
  useContext,
4
3
  type ComponentProps,
5
4
  type CSSProperties,
@@ -9,6 +8,7 @@ import { cn } from "../../lib/cn";
9
8
  import { focusRing } from "../../lib/focus-ring";
10
9
  import { bandCanvas, bandGap, bandRow } from "../list/band-style";
11
10
  import { Sparkline } from "../sparkline/Sparkline";
11
+ import { createLazyContext } from "../../lib/create-lazy-context";
12
12
 
13
13
  export type DataRowColumns = {
14
14
  /** 名称那一列的列名 */
@@ -32,7 +32,10 @@ export type DataRowListProps = Omit<ComponentProps<"div">, "children"> & {
32
32
 
33
33
  type Layout = { trend: boolean; reference: boolean };
34
34
 
35
- const LayoutContext = createContext<Layout>({ trend: false, reference: false });
35
+ const getLayoutContext = /* @__PURE__ */ createLazyContext<Layout>({
36
+ trend: false,
37
+ reference: false,
38
+ });
36
39
 
37
40
  /*
38
41
  * 列的模板。容器变窄时先收起走势列(@lg 以下),再收起参考值列(@sm 以下);
@@ -87,6 +90,7 @@ export function DataRowList({
87
90
  children,
88
91
  ...props
89
92
  }: DataRowListProps) {
93
+ const LayoutContext = getLayoutContext();
90
94
  const layout: Layout = {
91
95
  trend: columns.trend !== undefined,
92
96
  reference: columns.reference !== undefined,
@@ -121,7 +125,9 @@ export function DataRowList({
121
125
  </HeaderCell>
122
126
  )}
123
127
  </div>
124
- <LayoutContext value={layout}>{children}</LayoutContext>
128
+ <LayoutContext.Provider value={layout}>
129
+ {children}
130
+ </LayoutContext.Provider>
125
131
  </div>
126
132
  </div>
127
133
  );
@@ -187,7 +193,7 @@ export function DataRow({
187
193
  style,
188
194
  ...props
189
195
  }: DataRowProps) {
190
- const layout = useContext(LayoutContext);
196
+ const layout = useContext(getLayoutContext());
191
197
  const hasFavorite = favorite !== undefined || onFavoriteChange !== undefined;
192
198
  const dotClass = cn(favoriteDot, favorite ? favoriteOn : favoriteOff);
193
199
 
@@ -23,7 +23,7 @@ import {
23
23
  export const dottedDate = (date: string) => date.replaceAll("-", ".");
24
24
 
25
25
  /** 面板底下那一行里的文字钮 */
26
- export const dateFooterButton = cn(
26
+ export const dateFooterButton = /* @__PURE__ */ cn(
27
27
  "px-2 py-1 text-sm font-medium text-ink underline underline-offset-4 hover:text-ink-secondary",
28
28
  "disabled:cursor-not-allowed disabled:text-ink-disabled disabled:no-underline",
29
29
  focusRing,
@@ -13,7 +13,7 @@ import { defined } from "../../lib/defined";
13
13
  import type { LinkRender } from "../link-element/LinkElement";
14
14
  import { MenuCheck } from "./MenuCheck";
15
15
  import {
16
- MenuVariantContext,
16
+ getMenuVariantContext,
17
17
  menuGroupLabel,
18
18
  menuItem,
19
19
  menuItemCurrent,
@@ -66,6 +66,7 @@ export function DropdownMenu({
66
66
  className,
67
67
  children,
68
68
  }: DropdownMenuProps) {
69
+ const MenuVariantContext = getMenuVariantContext();
69
70
  const { anchorRef, portalRef } = usePortalScope();
70
71
 
71
72
  return (
@@ -91,7 +92,9 @@ export function DropdownMenu({
91
92
  className,
92
93
  )}
93
94
  >
94
- <MenuVariantContext value={variant}>{children}</MenuVariantContext>
95
+ <MenuVariantContext.Provider value={variant}>
96
+ {children}
97
+ </MenuVariantContext.Provider>
95
98
  </BaseMenu.Popup>
96
99
  </BaseMenu.Positioner>
97
100
  </BaseMenu.Portal>
@@ -296,7 +299,7 @@ export function DropdownMenuRadioItem({
296
299
  children,
297
300
  ...props
298
301
  }: DropdownMenuRadioItemProps) {
299
- const variant = useContext(MenuVariantContext);
302
+ const variant = useContext(getMenuVariantContext());
300
303
 
301
304
  return (
302
305
  <BaseMenu.RadioItem
@@ -385,7 +388,7 @@ export function DropdownMenuSub({
385
388
  className,
386
389
  children,
387
390
  }: DropdownMenuSubProps) {
388
- const variant = useContext(MenuVariantContext);
391
+ const variant = useContext(getMenuVariantContext());
389
392
  // 子面板也挂在 <body> 下:从这一行往上找,能找到主面板带着的主题
390
393
  const { anchorRef, portalRef } = usePortalScope();
391
394
 
@@ -1,6 +1,6 @@
1
- import { createContext } from "react";
2
1
  import { focusRingInset } from "../../lib/focus-ring";
3
2
  import { enterFromSide } from "../../lib/motion";
3
+ import { createLazyContext } from "../../lib/create-lazy-context";
4
4
 
5
5
  /*
6
6
  * 下拉菜单与下拉选择共用的面板和选项。
@@ -11,7 +11,8 @@ import { enterFromSide } from "../../lib/motion";
11
11
  export type MenuVariant = "plain" | "strong";
12
12
 
13
13
  /** 选项要知道自己在哪种面板里,才知道"当前项"怎么画 */
14
- export const MenuVariantContext = createContext<MenuVariant>("plain");
14
+ export const getMenuVariantContext =
15
+ /* @__PURE__ */ createLazyContext<MenuVariant>("plain");
15
16
 
16
17
  /**
17
18
  * 面板:直角、1px 线、环境阴影;顶部一条半宽的行动色细条,展开时从 0 伸到一半宽。
@@ -1,5 +1,4 @@
1
1
  import {
2
- createContext,
3
2
  useContext,
4
3
  useId,
5
4
  useMemo,
@@ -11,6 +10,7 @@ import { usePresence } from "../../hooks/usePresence";
11
10
  import { StatusDanger } from "../../icons/StatusDanger";
12
11
  import { cn } from "../../lib/cn";
13
12
  import { collapse, collapseEnter, collapseInner } from "../../lib/motion";
13
+ import { createLazyContext } from "../../lib/create-lazy-context";
14
14
 
15
15
  type FieldContextValue = {
16
16
  /** 单个控件的 id;`group` 字段里有多个控件,不提供 */
@@ -23,11 +23,12 @@ type FieldContextValue = {
23
23
  group: boolean;
24
24
  };
25
25
 
26
- const FieldContext = createContext<FieldContextValue | null>(null);
26
+ const getFieldContext =
27
+ /* @__PURE__ */ createLazyContext<FieldContextValue | null>(null);
27
28
 
28
29
  /** 给成组的控件(单选组)读取所在字段的状态。不在 `Field` 里时返回 `null`。 */
29
30
  export function useFieldContext(): FieldContextValue | null {
30
- return useContext(FieldContext);
31
+ return useContext(getFieldContext());
31
32
  }
32
33
 
33
34
  type ControlProps = {
@@ -50,7 +51,7 @@ export function useFieldControl({
50
51
  invalid,
51
52
  "aria-describedby": describedBy,
52
53
  }: ControlProps) {
53
- const field = useContext(FieldContext);
54
+ const field = useContext(getFieldContext());
54
55
  const mergedDescribedBy =
55
56
  [describedBy, field?.describedBy].filter(Boolean).join(" ") || undefined;
56
57
 
@@ -97,6 +98,7 @@ export function Field({
97
98
  children,
98
99
  ...props
99
100
  }: FieldProps) {
101
+ const FieldContext = getFieldContext();
100
102
  const baseId = useId();
101
103
  const id = controlId ?? `${baseId}-control`;
102
104
  const labelId = `${baseId}-label`;
@@ -212,7 +214,9 @@ export function Field({
212
214
  </legend>
213
215
  {/* 组里的控件默认竖排;要横排就自己包一层,作为这里唯一的子元素 */}
214
216
  <div className="flex flex-col items-start">
215
- <FieldContext value={context}>{children}</FieldContext>
217
+ <FieldContext.Provider value={context}>
218
+ {children}
219
+ </FieldContext.Provider>
216
220
  </div>
217
221
  {messages}
218
222
  </fieldset>
@@ -228,7 +232,7 @@ export function Field({
228
232
  <label id={labelId} htmlFor={id} className={cn(labelClass, "mb-1.5")}>
229
233
  {labelContent}
230
234
  </label>
231
- <FieldContext value={context}>{children}</FieldContext>
235
+ <FieldContext.Provider value={context}>{children}</FieldContext.Provider>
232
236
  {messages}
233
237
  </div>
234
238
  );
@@ -101,7 +101,7 @@ type ItemOwnProps = {
101
101
  export type FlyoutBarItemProps = ItemOwnProps &
102
102
  Omit<ComponentProps<"div">, keyof ItemOwnProps | "id" | "style">;
103
103
 
104
- const itemClass = cn(
104
+ const itemClass = /* @__PURE__ */ cn(
105
105
  "flex min-w-10 cursor-default items-center justify-center gap-2 px-2.5 text-sm select-none",
106
106
  "transition-colors duration-(--duration-fast) ease-standard",
107
107
  "data-disabled:text-ink-disabled data-highlighted:text-ink",
@@ -1,7 +1,6 @@
1
1
  import { Dialog as BaseDialog } from "@base-ui/react/dialog";
2
2
  import {
3
3
  Children,
4
- createContext,
5
4
  isValidElement,
6
5
  useContext,
7
6
  useRef,
@@ -22,6 +21,7 @@ import { useSnapTrack } from "../carousel/snap-track";
22
21
  import { overlayClose, overlayHeader } from "../dialog/overlay-style";
23
22
  import { IconButton } from "../icon-button/IconButton";
24
23
  import { Viewfinder } from "../viewfinder/Viewfinder";
24
+ import { createLazyContext } from "../../lib/create-lazy-context";
25
25
 
26
26
  export type ImageViewerRatio = "16/9" | "4/3" | "1/1" | "3/4";
27
27
 
@@ -38,7 +38,7 @@ type ItemLike = {
38
38
  children?: ReactNode;
39
39
  };
40
40
 
41
- const ItemContext = createContext<{
41
+ const getItemContext = /* @__PURE__ */ createLazyContext<{
42
42
  position: number;
43
43
  count: number;
44
44
  ratio: ImageViewerRatio;
@@ -93,6 +93,7 @@ export function ImageViewer({
93
93
  children,
94
94
  ...props
95
95
  }: ImageViewerProps) {
96
+ const ItemContext = getItemContext();
96
97
  // 标题、说明和大图都从子元素上读,所以子元素必须直接是 ImageViewerItem
97
98
  const items = Children.toArray(children).filter((child) =>
98
99
  isValidElement<ItemLike>(child),
@@ -133,7 +134,7 @@ export function ImageViewer({
133
134
  )}
134
135
  >
135
136
  {items.map((item, position) => (
136
- <ItemContext
137
+ <ItemContext.Provider
137
138
  key={position}
138
139
  value={{
139
140
  position,
@@ -145,7 +146,7 @@ export function ImageViewer({
145
146
  }}
146
147
  >
147
148
  {item}
148
- </ItemContext>
149
+ </ItemContext.Provider>
149
150
  ))}
150
151
  </ul>
151
152
  <BaseDialog.Root open={open} onOpenChange={(next) => setOpen(next)}>
@@ -427,7 +428,7 @@ export function ImageViewerItem({
427
428
  children,
428
429
  ...props
429
430
  }: ImageViewerItemProps) {
430
- const item = useContext(ItemContext);
431
+ const item = useContext(getItemContext());
431
432
  if (!item) {
432
433
  throw new Error("ImageViewerItem 要直接放在 ImageViewer 里面");
433
434
  }
@@ -1,5 +1,4 @@
1
1
  import {
2
- createContext,
3
2
  useContext,
4
3
  type ComponentProps,
5
4
  type MouseEvent,
@@ -10,6 +9,7 @@ import { focusRingInset } from "../../lib/focus-ring";
10
9
  import { GhostText } from "../ghost-text/GhostText";
11
10
  import { LinkElement, type LinkRender } from "../link-element/LinkElement";
12
11
  import { bandCanvas, bandGap, bandRow } from "./band-style";
12
+ import { createLazyContext } from "../../lib/create-lazy-context";
13
13
 
14
14
  export type ListVariant = "plain" | "band";
15
15
 
@@ -21,12 +21,14 @@ export type ListProps = ComponentProps<"ul"> & {
21
21
  variant?: ListVariant;
22
22
  };
23
23
 
24
- const ListVariantContext = createContext<ListVariant>("plain");
24
+ const getListVariantContext =
25
+ /* @__PURE__ */ createLazyContext<ListVariant>("plain");
25
26
 
26
27
  /** 列表行的容器,外圈不描边。里面只放 `ListRow`。 */
27
28
  export function List({ variant = "plain", className, ...props }: ListProps) {
29
+ const ListVariantContext = getListVariantContext();
28
30
  return (
29
- <ListVariantContext value={variant}>
31
+ <ListVariantContext.Provider value={variant}>
30
32
  <ul
31
33
  {...props}
32
34
  data-variant={variant}
@@ -38,7 +40,7 @@ export function List({ variant = "plain", className, ...props }: ListProps) {
38
40
  className,
39
41
  )}
40
42
  />
41
- </ListVariantContext>
43
+ </ListVariantContext.Provider>
42
44
  );
43
45
  }
44
46
 
@@ -103,7 +105,7 @@ export function ListRow({
103
105
  children,
104
106
  ...props
105
107
  }: ListRowProps) {
106
- const band = useContext(ListVariantContext) === "band";
108
+ const band = useContext(getListVariantContext()) === "band";
107
109
  const isLink = href !== undefined || render !== undefined;
108
110
  const isButton = !isLink && onClick !== undefined;
109
111
  const interactive = (isLink || isButton) && !disabled;
@@ -1,5 +1,4 @@
1
1
  import {
2
- createContext,
3
2
  useContext,
4
3
  type ComponentProps,
5
4
  type MouseEvent,
@@ -9,11 +8,13 @@ import { TriangleRight } from "../../icons/TriangleRight";
9
8
  import { cn } from "../../lib/cn";
10
9
  import { focusRing } from "../../lib/focus-ring";
11
10
  import { LinkElement, type LinkRender } from "../link-element/LinkElement";
11
+ import { createLazyContext } from "../../lib/create-lazy-context";
12
12
 
13
13
  export type NavActionLayout = "inline" | "block" | "stacked";
14
14
 
15
15
  /** 侧轨和全屏菜单用它告诉里面的主行动块该怎么摆。不对外导出 */
16
- export const NavActionContext = createContext<NavActionLayout | null>(null);
16
+ export const getNavActionContext =
17
+ /* @__PURE__ */ createLazyContext<NavActionLayout | null>(null);
17
18
 
18
19
  type OwnProps = {
19
20
  /** 换掉默认的实心三角 */
@@ -65,7 +66,7 @@ export function NavAction({
65
66
  children,
66
67
  ...props
67
68
  }: NavActionProps) {
68
- const inherited = useContext(NavActionContext);
69
+ const inherited = useContext(getNavActionContext());
69
70
  const layout = layoutProp ?? inherited ?? "inline";
70
71
  const stacked = layout === "stacked";
71
72