@qoretechnologies/reqore 0.78.6-pr.715.g3e70b13 → 0.78.6-pr.715.g4e6c5cf

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 (334) hide show
  1. package/.claude/CLAUDE.md +14 -0
  2. package/dist/components/Accordion/index.d.ts.map +1 -1
  3. package/dist/components/Accordion/index.js +17 -12
  4. package/dist/components/Accordion/index.js.map +1 -1
  5. package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
  6. package/dist/components/Breadcrumbs/index.js +293 -34
  7. package/dist/components/Breadcrumbs/index.js.map +1 -1
  8. package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
  9. package/dist/components/Breadcrumbs/item.js +6 -2
  10. package/dist/components/Breadcrumbs/item.js.map +1 -1
  11. package/dist/components/Bubble/index.d.ts.map +1 -1
  12. package/dist/components/Bubble/index.js +10 -41
  13. package/dist/components/Bubble/index.js.map +1 -1
  14. package/dist/components/Button/index.d.ts +8 -0
  15. package/dist/components/Button/index.d.ts.map +1 -1
  16. package/dist/components/Button/index.js +78 -14
  17. package/dist/components/Button/index.js.map +1 -1
  18. package/dist/components/ButtonRail/index.d.ts.map +1 -1
  19. package/dist/components/ButtonRail/index.js +3 -2
  20. package/dist/components/ButtonRail/index.js.map +1 -1
  21. package/dist/components/Callout/index.d.ts +4 -3
  22. package/dist/components/Callout/index.d.ts.map +1 -1
  23. package/dist/components/Callout/index.js +40 -8
  24. package/dist/components/Callout/index.js.map +1 -1
  25. package/dist/components/Checkbox/index.d.ts.map +1 -1
  26. package/dist/components/Checkbox/index.js +11 -10
  27. package/dist/components/Checkbox/index.js.map +1 -1
  28. package/dist/components/Collapse/index.d.ts.map +1 -1
  29. package/dist/components/Collapse/index.js +7 -36
  30. package/dist/components/Collapse/index.js.map +1 -1
  31. package/dist/components/CollapsibleContent/index.d.ts.map +1 -1
  32. package/dist/components/CollapsibleContent/index.js +6 -38
  33. package/dist/components/CollapsibleContent/index.js.map +1 -1
  34. package/dist/components/Collection/index.js +3 -3
  35. package/dist/components/Collection/index.js.map +1 -1
  36. package/dist/components/Collection/item.d.ts.map +1 -1
  37. package/dist/components/Collection/item.js +3 -3
  38. package/dist/components/Collection/item.js.map +1 -1
  39. package/dist/components/Columns/column.d.ts.map +1 -1
  40. package/dist/components/Columns/column.js +6 -35
  41. package/dist/components/Columns/column.js.map +1 -1
  42. package/dist/components/Columns/index.d.ts.map +1 -1
  43. package/dist/components/Columns/index.js +3 -35
  44. package/dist/components/Columns/index.js.map +1 -1
  45. package/dist/components/Comment/index.js +8 -8
  46. package/dist/components/Comment/index.js.map +1 -1
  47. package/dist/components/CommentFeed/index.js +2 -2
  48. package/dist/components/CommentFeed/index.js.map +1 -1
  49. package/dist/components/Content/index.d.ts.map +1 -1
  50. package/dist/components/Content/index.js +3 -35
  51. package/dist/components/Content/index.js.map +1 -1
  52. package/dist/components/Content/wrapper.js +2 -2
  53. package/dist/components/Content/wrapper.js.map +1 -1
  54. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  55. package/dist/components/ControlGroup/index.js +8 -4
  56. package/dist/components/ControlGroup/index.js.map +1 -1
  57. package/dist/components/ControlGroup/item.d.ts.map +1 -1
  58. package/dist/components/ControlGroup/item.js +35 -6
  59. package/dist/components/ControlGroup/item.js.map +1 -1
  60. package/dist/components/DataView/index.d.ts +6 -0
  61. package/dist/components/DataView/index.d.ts.map +1 -1
  62. package/dist/components/DataView/index.js +39 -66
  63. package/dist/components/DataView/index.js.map +1 -1
  64. package/dist/components/DatePicker/index.d.ts.map +1 -1
  65. package/dist/components/DatePicker/index.js +40 -8
  66. package/dist/components/DatePicker/index.js.map +1 -1
  67. package/dist/components/DescriptionList/index.d.ts.map +1 -1
  68. package/dist/components/DescriptionList/index.js +12 -40
  69. package/dist/components/DescriptionList/index.js.map +1 -1
  70. package/dist/components/Drawer/backdrop.d.ts.map +1 -1
  71. package/dist/components/Drawer/backdrop.js +35 -6
  72. package/dist/components/Drawer/backdrop.js.map +1 -1
  73. package/dist/components/Drawer/index.d.ts.map +1 -1
  74. package/dist/components/Drawer/index.js +39 -44
  75. package/dist/components/Drawer/index.js.map +1 -1
  76. package/dist/components/Dropdown/index.d.ts.map +1 -1
  77. package/dist/components/Dropdown/index.js +3 -1
  78. package/dist/components/Dropdown/index.js.map +1 -1
  79. package/dist/components/Dropdown/list.d.ts.map +1 -1
  80. package/dist/components/Dropdown/list.js +71 -5
  81. package/dist/components/Dropdown/list.js.map +1 -1
  82. package/dist/components/Effect/index.d.ts.map +1 -1
  83. package/dist/components/Effect/index.js +12 -6
  84. package/dist/components/Effect/index.js.map +1 -1
  85. package/dist/components/EntityRow/index.d.ts +18 -1
  86. package/dist/components/EntityRow/index.d.ts.map +1 -1
  87. package/dist/components/EntityRow/index.js +57 -13
  88. package/dist/components/EntityRow/index.js.map +1 -1
  89. package/dist/components/FadeScroller/index.d.ts.map +1 -1
  90. package/dist/components/FadeScroller/index.js +12 -62
  91. package/dist/components/FadeScroller/index.js.map +1 -1
  92. package/dist/components/FeatureCard/index.d.ts +7 -1
  93. package/dist/components/FeatureCard/index.d.ts.map +1 -1
  94. package/dist/components/FeatureCard/index.js +33 -10
  95. package/dist/components/FeatureCard/index.js.map +1 -1
  96. package/dist/components/Header/index.js +2 -2
  97. package/dist/components/Header/index.js.map +1 -1
  98. package/dist/components/Icon/index.d.ts.map +1 -1
  99. package/dist/components/Icon/index.js +21 -6
  100. package/dist/components/Icon/index.js.map +1 -1
  101. package/dist/components/IconPicker/index.js +2 -2
  102. package/dist/components/IconPicker/index.js.map +1 -1
  103. package/dist/components/Input/index.d.ts.map +1 -1
  104. package/dist/components/Input/index.js +11 -10
  105. package/dist/components/Input/index.js.map +1 -1
  106. package/dist/components/InputClearButton/index.d.ts.map +1 -1
  107. package/dist/components/InputClearButton/index.js +35 -3
  108. package/dist/components/InputClearButton/index.js.map +1 -1
  109. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  110. package/dist/components/InternalPopover/index.js +37 -9
  111. package/dist/components/InternalPopover/index.js.map +1 -1
  112. package/dist/components/KeyboardShortcut/index.d.ts.map +1 -1
  113. package/dist/components/KeyboardShortcut/index.js +6 -5
  114. package/dist/components/KeyboardShortcut/index.js.map +1 -1
  115. package/dist/components/Layout/content.js +2 -2
  116. package/dist/components/Layout/content.js.map +1 -1
  117. package/dist/components/Layout/index.d.ts.map +1 -1
  118. package/dist/components/Layout/index.js +8 -36
  119. package/dist/components/Layout/index.js.map +1 -1
  120. package/dist/components/Link/index.d.ts.map +1 -1
  121. package/dist/components/Link/index.js +13 -40
  122. package/dist/components/Link/index.js.map +1 -1
  123. package/dist/components/Menu/divider.d.ts.map +1 -1
  124. package/dist/components/Menu/divider.js +7 -4
  125. package/dist/components/Menu/divider.js.map +1 -1
  126. package/dist/components/Menu/index.d.ts.map +1 -1
  127. package/dist/components/Menu/index.js +17 -11
  128. package/dist/components/Menu/index.js.map +1 -1
  129. package/dist/components/Menu/item.d.ts.map +1 -1
  130. package/dist/components/Menu/item.js +28 -0
  131. package/dist/components/Menu/item.js.map +1 -1
  132. package/dist/components/Menu/section.d.ts.map +1 -1
  133. package/dist/components/Menu/section.js +11 -6
  134. package/dist/components/Menu/section.js.map +1 -1
  135. package/dist/components/NavRail/index.d.ts.map +1 -1
  136. package/dist/components/NavRail/index.js +16 -6
  137. package/dist/components/NavRail/index.js.map +1 -1
  138. package/dist/components/Navbar/divider.d.ts.map +1 -1
  139. package/dist/components/Navbar/divider.js +35 -6
  140. package/dist/components/Navbar/divider.js.map +1 -1
  141. package/dist/components/Navbar/group.js +3 -3
  142. package/dist/components/Navbar/group.js.map +1 -1
  143. package/dist/components/Navbar/index.js +3 -3
  144. package/dist/components/Navbar/index.js.map +1 -1
  145. package/dist/components/Navbar/item.js +3 -3
  146. package/dist/components/Navbar/item.js.map +1 -1
  147. package/dist/components/Notifications/index.d.ts.map +1 -1
  148. package/dist/components/Notifications/index.js +6 -35
  149. package/dist/components/Notifications/index.js.map +1 -1
  150. package/dist/components/Notifications/notification.d.ts.map +1 -1
  151. package/dist/components/Notifications/notification.js +23 -47
  152. package/dist/components/Notifications/notification.js.map +1 -1
  153. package/dist/components/Notifications/styles.d.ts.map +1 -1
  154. package/dist/components/Notifications/styles.js +11 -10
  155. package/dist/components/Notifications/styles.js.map +1 -1
  156. package/dist/components/Paging/index.d.ts.map +1 -1
  157. package/dist/components/Paging/index.js +19 -19
  158. package/dist/components/Paging/index.js.map +1 -1
  159. package/dist/components/Panel/index.d.ts +12 -0
  160. package/dist/components/Panel/index.d.ts.map +1 -1
  161. package/dist/components/Panel/index.js +321 -44
  162. package/dist/components/Panel/index.js.map +1 -1
  163. package/dist/components/Paragraph/index.d.ts +6 -0
  164. package/dist/components/Paragraph/index.d.ts.map +1 -1
  165. package/dist/components/Paragraph/index.js +60 -11
  166. package/dist/components/Paragraph/index.js.map +1 -1
  167. package/dist/components/Popover/index.d.ts +8 -0
  168. package/dist/components/Popover/index.d.ts.map +1 -1
  169. package/dist/components/Popover/index.js +166 -18
  170. package/dist/components/Popover/index.js.map +1 -1
  171. package/dist/components/Progress/index.d.ts.map +1 -1
  172. package/dist/components/Progress/index.js +13 -44
  173. package/dist/components/Progress/index.js.map +1 -1
  174. package/dist/components/Rating/index.d.ts.map +1 -1
  175. package/dist/components/Rating/index.js +13 -39
  176. package/dist/components/Rating/index.js.map +1 -1
  177. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  178. package/dist/components/RichTextEditor/index.js +42 -7
  179. package/dist/components/RichTextEditor/index.js.map +1 -1
  180. package/dist/components/RowActionsMenu/index.d.ts +69 -0
  181. package/dist/components/RowActionsMenu/index.d.ts.map +1 -0
  182. package/dist/components/RowActionsMenu/index.js +170 -0
  183. package/dist/components/RowActionsMenu/index.js.map +1 -0
  184. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  185. package/dist/components/SegmentedControl/index.js +17 -46
  186. package/dist/components/SegmentedControl/index.js.map +1 -1
  187. package/dist/components/Select/valuePreview.js +6 -3
  188. package/dist/components/Select/valuePreview.js.map +1 -1
  189. package/dist/components/SeverityRow/index.d.ts +19 -1
  190. package/dist/components/SeverityRow/index.d.ts.map +1 -1
  191. package/dist/components/SeverityRow/index.js +59 -15
  192. package/dist/components/SeverityRow/index.js.map +1 -1
  193. package/dist/components/Skeleton/index.d.ts.map +1 -1
  194. package/dist/components/Skeleton/index.js +6 -35
  195. package/dist/components/Skeleton/index.js.map +1 -1
  196. package/dist/components/Slider/index.js +9 -9
  197. package/dist/components/Slider/index.js.map +1 -1
  198. package/dist/components/Spacer/index.js +7 -7
  199. package/dist/components/Spacer/index.js.map +1 -1
  200. package/dist/components/Span/index.d.ts.map +1 -1
  201. package/dist/components/Span/index.js +38 -9
  202. package/dist/components/Span/index.js.map +1 -1
  203. package/dist/components/StackedBar/index.d.ts.map +1 -1
  204. package/dist/components/StackedBar/index.js +16 -39
  205. package/dist/components/StackedBar/index.js.map +1 -1
  206. package/dist/components/Statistic/index.d.ts +8 -1
  207. package/dist/components/Statistic/index.d.ts.map +1 -1
  208. package/dist/components/Statistic/index.js +12 -40
  209. package/dist/components/Statistic/index.js.map +1 -1
  210. package/dist/components/Table/body.d.ts.map +1 -1
  211. package/dist/components/Table/body.js +41 -41
  212. package/dist/components/Table/body.js.map +1 -1
  213. package/dist/components/Table/cell.d.ts.map +1 -1
  214. package/dist/components/Table/cell.js +32 -24
  215. package/dist/components/Table/cell.js.map +1 -1
  216. package/dist/components/Table/header.d.ts.map +1 -1
  217. package/dist/components/Table/header.js +13 -10
  218. package/dist/components/Table/header.js.map +1 -1
  219. package/dist/components/Table/headerCell.d.ts.map +1 -1
  220. package/dist/components/Table/headerCell.js +26 -52
  221. package/dist/components/Table/headerCell.js.map +1 -1
  222. package/dist/components/Table/helpers.d.ts +37 -0
  223. package/dist/components/Table/helpers.d.ts.map +1 -1
  224. package/dist/components/Table/helpers.js +72 -1
  225. package/dist/components/Table/helpers.js.map +1 -1
  226. package/dist/components/Table/index.d.ts +57 -2
  227. package/dist/components/Table/index.d.ts.map +1 -1
  228. package/dist/components/Table/index.js +154 -59
  229. package/dist/components/Table/index.js.map +1 -1
  230. package/dist/components/Table/row.d.ts +3 -1
  231. package/dist/components/Table/row.d.ts.map +1 -1
  232. package/dist/components/Table/row.js +45 -14
  233. package/dist/components/Table/row.js.map +1 -1
  234. package/dist/components/Table/scrollbar.js +3 -3
  235. package/dist/components/Table/scrollbar.js.map +1 -1
  236. package/dist/components/Tabs/content.js +2 -2
  237. package/dist/components/Tabs/content.js.map +1 -1
  238. package/dist/components/Tabs/index.js +3 -3
  239. package/dist/components/Tabs/index.js.map +1 -1
  240. package/dist/components/Tabs/item.d.ts.map +1 -1
  241. package/dist/components/Tabs/item.js +7 -5
  242. package/dist/components/Tabs/item.js.map +1 -1
  243. package/dist/components/Tabs/list.d.ts +4 -2
  244. package/dist/components/Tabs/list.d.ts.map +1 -1
  245. package/dist/components/Tabs/list.js +31 -19
  246. package/dist/components/Tabs/list.js.map +1 -1
  247. package/dist/components/Tag/group.d.ts.map +1 -1
  248. package/dist/components/Tag/group.js +3 -35
  249. package/dist/components/Tag/group.js.map +1 -1
  250. package/dist/components/Tag/index.d.ts +7 -0
  251. package/dist/components/Tag/index.d.ts.map +1 -1
  252. package/dist/components/Tag/index.js +91 -24
  253. package/dist/components/Tag/index.js.map +1 -1
  254. package/dist/components/Testimonial/index.d.ts +6 -1
  255. package/dist/components/Testimonial/index.d.ts.map +1 -1
  256. package/dist/components/Testimonial/index.js +29 -7
  257. package/dist/components/Testimonial/index.js.map +1 -1
  258. package/dist/components/Textarea/index.d.ts +10 -0
  259. package/dist/components/Textarea/index.d.ts.map +1 -1
  260. package/dist/components/Textarea/index.js +164 -18
  261. package/dist/components/Textarea/index.js.map +1 -1
  262. package/dist/components/Tier/group.d.ts.map +1 -1
  263. package/dist/components/Tier/group.js +9 -8
  264. package/dist/components/Tier/group.js.map +1 -1
  265. package/dist/components/Tier/index.d.ts +5 -0
  266. package/dist/components/Tier/index.d.ts.map +1 -1
  267. package/dist/components/Tier/index.js +15 -11
  268. package/dist/components/Tier/index.js.map +1 -1
  269. package/dist/components/Timeline/index.d.ts.map +1 -1
  270. package/dist/components/Timeline/index.js +21 -18
  271. package/dist/components/Timeline/index.js.map +1 -1
  272. package/dist/components/TooltipComponent/index.d.ts.map +1 -1
  273. package/dist/components/TooltipComponent/index.js +6 -7
  274. package/dist/components/TooltipComponent/index.js.map +1 -1
  275. package/dist/components/Tree/index.js +3 -3
  276. package/dist/components/Tree/index.js.map +1 -1
  277. package/dist/components/Tree/modal.d.ts.map +1 -1
  278. package/dist/components/Tree/modal.js +3 -1
  279. package/dist/components/Tree/modal.js.map +1 -1
  280. package/dist/constants/sizes.d.ts +5 -0
  281. package/dist/constants/sizes.d.ts.map +1 -1
  282. package/dist/constants/sizes.js +6 -1
  283. package/dist/constants/sizes.js.map +1 -1
  284. package/dist/constants/theme.d.ts +44 -0
  285. package/dist/constants/theme.d.ts.map +1 -1
  286. package/dist/constants/theme.js.map +1 -1
  287. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  288. package/dist/containers/ReqoreProvider.js +27 -13
  289. package/dist/containers/ReqoreProvider.js.map +1 -1
  290. package/dist/containers/UIProvider.d.ts.map +1 -1
  291. package/dist/containers/UIProvider.js +8 -36
  292. package/dist/containers/UIProvider.js.map +1 -1
  293. package/dist/helpers/hoveringPointer.d.ts +54 -0
  294. package/dist/helpers/hoveringPointer.d.ts.map +1 -0
  295. package/dist/helpers/hoveringPointer.js +66 -0
  296. package/dist/helpers/hoveringPointer.js.map +1 -0
  297. package/dist/helpers/styled.d.ts +39 -26
  298. package/dist/helpers/styled.d.ts.map +1 -1
  299. package/dist/helpers/styled.js +156 -4
  300. package/dist/helpers/styled.js.map +1 -1
  301. package/dist/helpers/typeScale.d.ts +25 -0
  302. package/dist/helpers/typeScale.d.ts.map +1 -0
  303. package/dist/helpers/typeScale.js +28 -0
  304. package/dist/helpers/typeScale.js.map +1 -0
  305. package/dist/hooks/useCloneThroughFragments.d.ts.map +1 -1
  306. package/dist/hooks/useCloneThroughFragments.js +51 -18
  307. package/dist/hooks/useCloneThroughFragments.js.map +1 -1
  308. package/dist/hooks/useDragToScroll.d.ts +58 -0
  309. package/dist/hooks/useDragToScroll.d.ts.map +1 -0
  310. package/dist/hooks/useDragToScroll.js +262 -0
  311. package/dist/hooks/useDragToScroll.js.map +1 -0
  312. package/dist/hooks/useMarqueeOnHover.d.ts.map +1 -1
  313. package/dist/hooks/useMarqueeOnHover.js +10 -0
  314. package/dist/hooks/useMarqueeOnHover.js.map +1 -1
  315. package/dist/hooks/usePaging.d.ts +9 -4
  316. package/dist/hooks/usePaging.d.ts.map +1 -1
  317. package/dist/hooks/usePaging.js +21 -32
  318. package/dist/hooks/usePaging.js.map +1 -1
  319. package/dist/hooks/usePointerDrag.d.ts.map +1 -1
  320. package/dist/hooks/usePointerDrag.js +13 -3
  321. package/dist/hooks/usePointerDrag.js.map +1 -1
  322. package/dist/hooks/useReqoreMedia.d.ts +22 -7
  323. package/dist/hooks/useReqoreMedia.d.ts.map +1 -1
  324. package/dist/hooks/useReqoreMedia.js +33 -9
  325. package/dist/hooks/useReqoreMedia.js.map +1 -1
  326. package/dist/index.d.ts +6 -0
  327. package/dist/index.d.ts.map +1 -1
  328. package/dist/index.js +14 -3
  329. package/dist/index.js.map +1 -1
  330. package/dist/styles.js +6 -6
  331. package/dist/styles.js.map +1 -1
  332. package/docs/docs/guides/theming.mdx +15 -0
  333. package/package.json +2 -4
  334. package/vitest.config.ts +105 -31
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watchHoverGate = exports.HOVER_GATE_POINTER_EVENTS = exports.useHoverGate = exports.createHoverGate = exports.isHoveringPointer = void 0;
4
+ var react_1 = require("react");
5
+ /**
6
+ * The pointer can hover: a mouse, or a pen held above the screen. A finger cannot.
7
+ *
8
+ * A tap is followed by the mouse events a browser emulates for pages written for a mouse - `mouseover`,
9
+ * `mouseenter`, `mousemove`, `mousedown`, `mouseup`, `click` - at the tap, with nothing in them to tell them
10
+ * from a mouse's. Whatever opened on `mouseenter` therefore opened at a tap too, and stayed open until the
11
+ * next tap elsewhere: a hover tooltip, a panel's floating actions, a rail's labels.
12
+ *
13
+ * Asked of each event, not of the device (`isHoverCapable` asks about the device's primary pointer): a touch
14
+ * laptop's mouse hovers, and so does a mouse plugged into a tablet, whose screen is still a finger's. A pen
15
+ * hovers while it is held above the screen (`buttons` 0); pressed to it, it is drawing.
16
+ *
17
+ * Only what cannot hover is turned away: a finger, and a pen pressed to the screen. A pointer the event does
18
+ * not name (`pointerType` '' - which the specification allows where the type cannot be told, and which
19
+ * user-event sends under jsdom - or none at all) is taken for one that hovers, as a `mouseenter` no pointer
20
+ * event came before is. Taken for one that does not, it closed every tooltip a consumer's test opened with
21
+ * `userEvent.hover` (qorus-ide: MiniBarChart, IncompleteCasesStrip, valueControlAndChips).
22
+ */
23
+ var isHoveringPointer = function (_a) {
24
+ var pointerType = _a.pointerType, buttons = _a.buttons;
25
+ return pointerType !== 'touch' && !(pointerType === 'pen' && buttons !== 0);
26
+ };
27
+ exports.isHoveringPointer = isHoveringPointer;
28
+ var createHoverGate = function () {
29
+ var noted;
30
+ return {
31
+ notePointer: function (_a) {
32
+ var pointerType = _a.pointerType, buttons = _a.buttons;
33
+ noted = { pointerType: pointerType, buttons: buttons };
34
+ },
35
+ isHover: function () {
36
+ var pointer = noted;
37
+ noted = undefined;
38
+ return !pointer || (0, exports.isHoveringPointer)(pointer);
39
+ },
40
+ };
41
+ };
42
+ exports.createHoverGate = createHoverGate;
43
+ /** A hover gate for the life of a component: see `createHoverGate`. */
44
+ var useHoverGate = function () { return (0, react_1.useMemo)(exports.createHoverGate, []); };
45
+ exports.useHoverGate = useHoverGate;
46
+ /** The pointer events a hover gate notes on an element: those a browser sends before its mouse events. */
47
+ exports.HOVER_GATE_POINTER_EVENTS = [
48
+ 'pointerenter',
49
+ 'pointerover',
50
+ 'pointerdown',
51
+ 'pointermove',
52
+ 'pointerup',
53
+ ];
54
+ /**
55
+ * Notes, on `target`, the pointer behind the mouse events that come next (see `createHoverGate`). Returns
56
+ * what stops it. Capture phase, so a pointer event a child stops from bubbling is noted too.
57
+ */
58
+ var watchHoverGate = function (target, gate) {
59
+ var note = function (event) { return gate.notePointer(event); };
60
+ exports.HOVER_GATE_POINTER_EVENTS.forEach(function (type) { return target.addEventListener(type, note, true); });
61
+ return function () {
62
+ return exports.HOVER_GATE_POINTER_EVENTS.forEach(function (type) { return target.removeEventListener(type, note, true); });
63
+ };
64
+ };
65
+ exports.watchHoverGate = watchHoverGate;
66
+ //# sourceMappingURL=hoveringPointer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hoveringPointer.js","sourceRoot":"","sources":["../../src/helpers/hoveringPointer.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAQhC;;;;;;;;;;;;;;;;;GAiBG;AACI,IAAM,iBAAiB,GAAG,UAAC,EAAqD;QAAnD,WAAW,iBAAA,EAAE,OAAO,aAAA;IACtD,OAAA,WAAW,KAAK,OAAO,IAAI,CAAC,CAAC,WAAW,KAAK,KAAK,IAAI,OAAO,KAAK,CAAC,CAAC;AAApE,CAAoE,CAAC;AAD1D,QAAA,iBAAiB,qBACyC;AAsBhE,IAAM,eAAe,GAAG;IAC7B,IAAI,KAA8C,CAAC;IACnD,OAAO;QACL,WAAW,EAAE,UAAC,EAAwB;gBAAtB,WAAW,iBAAA,EAAE,OAAO,aAAA;YAClC,KAAK,GAAG,EAAE,WAAW,aAAA,EAAE,OAAO,SAAA,EAAE,CAAC;QACnC,CAAC;QACD,OAAO,EAAE;YACP,IAAM,OAAO,GAAG,KAAK,CAAC;YACtB,KAAK,GAAG,SAAS,CAAC;YAClB,OAAO,CAAC,OAAO,IAAI,IAAA,yBAAiB,EAAC,OAAO,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B;AAEF,uEAAuE;AAChE,IAAM,YAAY,GAAG,cAAwB,OAAA,IAAA,eAAO,EAAC,uBAAe,EAAE,EAAE,CAAC,EAA5B,CAA4B,CAAC;AAApE,QAAA,YAAY,gBAAwD;AAEjF,0GAA0G;AAC7F,QAAA,yBAAyB,GAAG;IACvC,cAAc;IACd,aAAa;IACb,aAAa;IACb,aAAa;IACb,WAAW;CACH,CAAC;AAEX;;;GAGG;AACI,IAAM,cAAc,GAAG,UAAC,MAAmB,EAAE,IAAsB;IACxE,IAAM,IAAI,GAAG,UAAC,KAAY,IAAK,OAAA,IAAI,CAAC,WAAW,CAAC,KAAqB,CAAC,EAAvC,CAAuC,CAAC;IACvE,iCAAyB,CAAC,OAAO,CAAC,UAAC,IAAI,IAAK,OAAA,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAzC,CAAyC,CAAC,CAAC;IACvF,OAAO;QACL,OAAA,iCAAyB,CAAC,OAAO,CAAC,UAAC,IAAI,IAAK,OAAA,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAA5C,CAA4C,CAAC;IAAzF,CAAyF,CAAC;AAC9F,CAAC,CAAC;AALW,QAAA,cAAc,kBAKzB"}
@@ -1,4 +1,5 @@
1
- import type { ComponentType } from 'react';
1
+ import type { ComponentType, JSX } from 'react';
2
+ import baseStyled from 'styled-components';
2
3
  /**
3
4
  * The default prop validator styled-components hands to `shouldForwardProp`. It answers
4
5
  * "is this a real HTML attribute?" — it knows nothing about the element being rendered.
@@ -11,32 +12,17 @@ export type TReqoreStyledPropValidator = (prop: string | number | symbol) => boo
11
12
  */
12
13
  export type TReqoreStyledTarget = string | ComponentType<any>;
13
14
  /**
14
- * Builds a `shouldForwardProp` predicate for `styled(...).withConfig({ ... })` that keeps the
15
- * named props out of the rendered element while leaving every other prop alone.
16
- *
17
- * Reqore layout flags (`fill`, `wrap`, ...) are meaningful to a parent — a `ReqoreControlGroup`
18
- * propagates `fill` through polymorphic children, a `ReqoreTable` threads `wrap` into rows and
19
- * cells — but they are not valid HTML attributes. Without this filter React renders them as
20
- * boolean attributes and logs a "received `true` for a non-boolean attribute" warning.
21
- *
22
- * IMPORTANT — why the target type is checked. Supplying `shouldForwardProp` *replaces*
23
- * styled-components' built-in rule outright; it does not layer on top of it. That built-in rule
24
- * is `isTargetTag ? isPropValid(prop) : true` — a DOM tag only receives real HTML attributes,
25
- * but a **component** target receives everything, because a component's props are its own API
26
- * and `isPropValid` knows nothing about them. Chaining `defaultValidatorFn` unconditionally
27
- * therefore strips a component's entire prop surface: `styled(ReqoreIcon)` silently lost
28
- * `icon` / `wrapperElement` / `wrapperSize` (the input clear button rendered as an empty span),
29
- * `styled(StyledEffect) as={Resizable}` lost re-resizable's `enable` / size / handle config, and
30
- * `ReqoreTextarea as={Editable}` lost Slate's `renderElement` / `renderLeaf` / `decorate`. Each
31
- * was previously patched with a bespoke per-call-site allow-list; mirroring the built-in rule
32
- * here fixes all of them at the source, so `styled(SomeComponent)` keeps working like plain
33
- * styled-components while the explicitly-omitted props still never reach the DOM.
34
- *
35
- * @example
36
- * const StyledPanel = styled(StyledEffect).withConfig({
37
- * shouldForwardProp: omitStyleProps('fill'),
38
- * })<IStyledPanel>`...`;
15
+ * Reqore prop names that are ALSO an HTML attribute — of some elements. `isPropValid`, which
16
+ * styled-components uses to filter a DOM tag's props, only asks whether a name is an attribute
17
+ * anywhere, so `size='normal'` (a Reqore size) reached every `div` and `span` it was handed to as
18
+ * `size="normal"`, a checkbox's `checked` reached its `div`, a table cell's `selected` and
19
+ * `disabled` theirs, and so on. Each name maps to the elements it is an attribute of; on any
20
+ * other HTML element it is a styling prop and stays back. A name with no elements is not an
21
+ * attribute of any HTML element (only of SVG ones, or of nothing current).
39
22
  */
23
+ export declare const REQORE_AMBIGUOUS_PROP_ELEMENTS: Readonly<Record<string, readonly (keyof JSX.IntrinsicElements)[]>>;
24
+ /** Whether `prop` is an attribute of the element `tag`, as far as Reqore's names go. */
25
+ export declare const isReqoreElementAttribute: (prop: string | number | symbol, tag: string) => boolean;
40
26
  export declare const omitStyleProps: (...propsToOmit: string[]) => (prop: string | number | symbol, defaultValidatorFn: TReqoreStyledPropValidator, elementToBeCreated?: TReqoreStyledTarget) => boolean;
41
27
  /**
42
28
  * The props `ReqoreControlGroup` clones onto every child that is a component (see the group's
@@ -46,4 +32,31 @@ export declare const omitStyleProps: (...propsToOmit: string[]) => (prop: string
46
32
  * them: `shouldForwardProp: omitStyleProps(...REQORE_CONTROL_GROUP_CHILD_PROPS)`.
47
33
  */
48
34
  export declare const REQORE_CONTROL_GROUP_CHILD_PROPS: string[];
35
+ /**
36
+ * The props of a styled component's prop interface `TProps` that only style it: every key that
37
+ * is not one of `TTargetProps` — the attributes and props of what the component renders.
38
+ *
39
+ * `as`, `forwardedAs` and transient (`$`-prefixed) props are left out: styled-components consumes
40
+ * those itself and never forwards them.
41
+ */
42
+ export type TReqoreStylePropKeys<TProps, TTargetProps> = Exclude<Extract<keyof TProps, string>, keyof TTargetProps | 'as' | 'forwardedAs' | `$${string}`>;
43
+ /**
44
+ * Lists a component's styling props for `omitStyleProps`, from a record the compiler checks
45
+ * against the component's prop interface.
46
+ *
47
+ * A hand-written omit list goes stale: a prop added to the interface later reaches the rendered
48
+ * element until someone remembers the list (ReqoreButton rendered `as` a router link handed its
49
+ * `fluid`, `compact`, `maxWidth`, ... to the link, which wrote them onto its `<a>`; a resizable,
50
+ * transparent ReqorePanel handed re-resizable `transparent`). Typed as
51
+ * `Record<TReqoreStylePropKeys<...>, true>`, the record must name every such prop and nothing
52
+ * else, so a new prop that is not added fails the build instead of leaking.
53
+ *
54
+ * @example
55
+ * const BUTTON_STYLE_PROPS = listReqoreStyleProps<
56
+ * TReqoreStylePropKeys<IReqoreButtonStyle, React.ButtonHTMLAttributes<HTMLButtonElement>>
57
+ * >({ fluid: true, compact: true, ... });
58
+ */
59
+ export declare const listReqoreStyleProps: <TKeys extends string>(props: Record<TKeys, true>) => TKeys[];
60
+ declare const reqoreStyled: typeof baseStyled;
61
+ export default reqoreStyled;
49
62
  //# sourceMappingURL=styled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../src/helpers/styled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,aAAa,MAAM,EAAE,MAInD,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,EAC9B,oBAAoB,0BAA0B,EAC9C,qBAAqB,mBAAmB,KACvC,OAQJ,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,UA0B5C,CAAC"}
1
+ {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../src/helpers/styled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AA0D9D;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CACnD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,CA4CzD,CAAC;AAaF,wFAAwF;AACxF,eAAO,MAAM,wBAAwB,GAAI,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,MAAM,KAAG,OAQtF,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,GAAG,aAAa,MAAM,EAAE,MAInD,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,EAC9B,oBAAoB,0BAA0B,EAC9C,qBAAqB,mBAAmB,KACvC,OAqBJ,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,UA0B5C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,CAAC,MAAM,EAAE,YAAY,IAAI,OAAO,CAC9D,OAAO,CAAC,MAAM,MAAM,EAAE,MAAM,CAAC,EAC7B,MAAM,YAAY,GAAG,IAAI,GAAG,aAAa,GAAG,IAAI,MAAM,EAAE,CACzD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,SAAS,MAAM,EAAE,OAAO,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAG,KAAK,EAC9D,CAAC;AAgBhC,QAAA,MAAM,YAAY,EAGZ,OAAO,UAAU,CAAC;AAExB,eAAe,YAAY,CAAC"}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REQORE_CONTROL_GROUP_CHILD_PROPS = exports.omitStyleProps = void 0;
6
+ exports.listReqoreStyleProps = exports.REQORE_CONTROL_GROUP_CHILD_PROPS = exports.omitStyleProps = exports.isReqoreElementAttribute = exports.REQORE_AMBIGUOUS_PROP_ELEMENTS = void 0;
7
+ var styled_components_1 = __importDefault(require("styled-components"));
4
8
  /**
5
9
  * Builds a `shouldForwardProp` predicate for `styled(...).withConfig({ ... })` that keeps the
6
10
  * named props out of the rendered element while leaving every other prop alone.
@@ -28,6 +32,106 @@ exports.REQORE_CONTROL_GROUP_CHILD_PROPS = exports.omitStyleProps = void 0;
28
32
  * shouldForwardProp: omitStyleProps('fill'),
29
33
  * })<IStyledPanel>`...`;
30
34
  */
35
+ /** The SVG elements: their presentation attributes (`fill`, `opacity`, `width`, ...) are real. */
36
+ var SVG_TAGS = new Set([
37
+ 'svg',
38
+ 'g',
39
+ 'path',
40
+ 'circle',
41
+ 'ellipse',
42
+ 'line',
43
+ 'polyline',
44
+ 'polygon',
45
+ 'rect',
46
+ 'text',
47
+ 'tspan',
48
+ 'textPath',
49
+ 'defs',
50
+ 'symbol',
51
+ 'use',
52
+ 'image',
53
+ 'marker',
54
+ 'mask',
55
+ 'pattern',
56
+ 'clipPath',
57
+ 'linearGradient',
58
+ 'radialGradient',
59
+ 'stop',
60
+ 'foreignObject',
61
+ 'filter',
62
+ ]);
63
+ /**
64
+ * Reqore prop names that are ALSO an HTML attribute — of some elements. `isPropValid`, which
65
+ * styled-components uses to filter a DOM tag's props, only asks whether a name is an attribute
66
+ * anywhere, so `size='normal'` (a Reqore size) reached every `div` and `span` it was handed to as
67
+ * `size="normal"`, a checkbox's `checked` reached its `div`, a table cell's `selected` and
68
+ * `disabled` theirs, and so on. Each name maps to the elements it is an attribute of; on any
69
+ * other HTML element it is a styling prop and stays back. A name with no elements is not an
70
+ * attribute of any HTML element (only of SVG ones, or of nothing current).
71
+ */
72
+ exports.REQORE_AMBIGUOUS_PROP_ELEMENTS = {
73
+ size: ['input', 'select'],
74
+ width: ['img', 'canvas', 'video', 'iframe', 'input', 'embed', 'object', 'col', 'colgroup'],
75
+ height: ['img', 'canvas', 'video', 'iframe', 'input', 'embed', 'object'],
76
+ wrap: ['textarea'],
77
+ color: [],
78
+ fill: [],
79
+ opacity: [],
80
+ direction: [],
81
+ offset: [],
82
+ spacing: [],
83
+ disabled: ['button', 'input', 'select', 'textarea', 'option', 'optgroup', 'fieldset'],
84
+ readOnly: ['input', 'textarea'],
85
+ checked: ['input'],
86
+ selected: ['option'],
87
+ placeholder: ['input', 'textarea'],
88
+ label: ['track', 'option', 'optgroup'],
89
+ type: [
90
+ 'input',
91
+ 'button',
92
+ 'ol',
93
+ 'li',
94
+ 'a',
95
+ 'source',
96
+ 'embed',
97
+ 'object',
98
+ 'script',
99
+ 'style',
100
+ 'link',
101
+ ],
102
+ value: [
103
+ 'input',
104
+ 'button',
105
+ 'select',
106
+ 'textarea',
107
+ 'option',
108
+ 'li',
109
+ 'meter',
110
+ 'progress',
111
+ 'param',
112
+ 'data',
113
+ 'output',
114
+ ],
115
+ };
116
+ /**
117
+ * The state attributes a component's omit list may name for its default element but that are
118
+ * the element's own when it is rendered `as` an element that has them (see `omitStyleProps`).
119
+ */
120
+ var REQORE_ELEMENT_STATE_PROPS = new Set([
121
+ 'disabled',
122
+ 'readOnly',
123
+ 'checked',
124
+ 'selected',
125
+ ]);
126
+ /** Whether `prop` is an attribute of the element `tag`, as far as Reqore's names go. */
127
+ var isReqoreElementAttribute = function (prop, tag) {
128
+ if (typeof prop !== 'string' || SVG_TAGS.has(tag)) {
129
+ return true;
130
+ }
131
+ var elements = exports.REQORE_AMBIGUOUS_PROP_ELEMENTS[prop];
132
+ return !elements || elements.includes(tag);
133
+ };
134
+ exports.isReqoreElementAttribute = isReqoreElementAttribute;
31
135
  var omitStyleProps = function () {
32
136
  var propsToOmit = [];
33
137
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -36,10 +140,19 @@ var omitStyleProps = function () {
36
140
  var omitted = new Set(propsToOmit);
37
141
  return function (prop, defaultValidatorFn, elementToBeCreated) {
38
142
  if (omitted.has(prop)) {
39
- return false;
143
+ // A component's omit list is built against its default element. Given `as` another tag
144
+ // that has the state attribute — `<ReqorePanel as='fieldset' disabled>`, `<ReqoreTag
145
+ // as='button' disabled>` — the attribute is that element's, so it goes through.
146
+ return (typeof elementToBeCreated === 'string' &&
147
+ REQORE_ELEMENT_STATE_PROPS.has(prop) &&
148
+ defaultValidatorFn(prop) &&
149
+ exports.REQORE_AMBIGUOUS_PROP_ELEMENTS[prop].includes(elementToBeCreated));
40
150
  }
41
- // Mirror styled-components' own default so only the omitted props change behaviour.
42
- return typeof elementToBeCreated === 'string' ? defaultValidatorFn(prop) : true;
151
+ // Mirror styled-components' own default — a component gets everything, a DOM tag what is an
152
+ // HTML attribute — except that a DOM tag only gets an attribute of ITS element.
153
+ return typeof elementToBeCreated === 'string'
154
+ ? defaultValidatorFn(prop) && (0, exports.isReqoreElementAttribute)(prop, elementToBeCreated)
155
+ : true;
43
156
  };
44
157
  };
45
158
  exports.omitStyleProps = omitStyleProps;
@@ -77,4 +190,43 @@ exports.REQORE_CONTROL_GROUP_CHILD_PROPS = [
77
190
  'isMasterGroupRounded',
78
191
  'rounded',
79
192
  ];
193
+ /**
194
+ * Lists a component's styling props for `omitStyleProps`, from a record the compiler checks
195
+ * against the component's prop interface.
196
+ *
197
+ * A hand-written omit list goes stale: a prop added to the interface later reaches the rendered
198
+ * element until someone remembers the list (ReqoreButton rendered `as` a router link handed its
199
+ * `fluid`, `compact`, `maxWidth`, ... to the link, which wrote them onto its `<a>`; a resizable,
200
+ * transparent ReqorePanel handed re-resizable `transparent`). Typed as
201
+ * `Record<TReqoreStylePropKeys<...>, true>`, the record must name every such prop and nothing
202
+ * else, so a new prop that is not added fails the build instead of leaking.
203
+ *
204
+ * @example
205
+ * const BUTTON_STYLE_PROPS = listReqoreStyleProps<
206
+ * TReqoreStylePropKeys<IReqoreButtonStyle, React.ButtonHTMLAttributes<HTMLButtonElement>>
207
+ * >({ fluid: true, compact: true, ... });
208
+ */
209
+ var listReqoreStyleProps = function (props) {
210
+ return Object.keys(props);
211
+ };
212
+ exports.listReqoreStyleProps = listReqoreStyleProps;
213
+ /**
214
+ * Reqore's `styled`: styled-components' own, except that every styled component it makes filters
215
+ * its props with `omitStyleProps()` — so a DOM element only receives the attributes of ITS
216
+ * element (see `REQORE_AMBIGUOUS_PROP_ELEMENTS`), whether or not its author remembered to filter.
217
+ *
218
+ * Every Reqore source file imports `styled` from here (an ESLint rule forbids the default import
219
+ * of `styled-components`). A styled component's own `.withConfig({ shouldForwardProp })`
220
+ * replaces this filter, and is built with `omitStyleProps`, which includes it.
221
+ */
222
+ var withReqoreProps = function (construct) {
223
+ return typeof (construct === null || construct === void 0 ? void 0 : construct.withConfig) === 'function'
224
+ ? construct.withConfig({ shouldForwardProp: (0, exports.omitStyleProps)() })
225
+ : construct;
226
+ };
227
+ var reqoreStyled = new Proxy(styled_components_1.default, {
228
+ apply: function (target, thisArg, args) { return withReqoreProps(Reflect.apply(target, thisArg, args)); },
229
+ get: function (target, key, receiver) { return withReqoreProps(Reflect.get(target, key, receiver)); },
230
+ });
231
+ exports.default = reqoreStyled;
80
232
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../src/helpers/styled.ts"],"names":[],"mappings":";;;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,IAAM,cAAc,GAAG;IAAC,qBAAwB;SAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;QAAxB,gCAAwB;;IACrD,IAAM,OAAO,GAAG,IAAI,GAAG,CAA2B,WAAW,CAAC,CAAC;IAE/D,OAAO,UACL,IAA8B,EAC9B,kBAA8C,EAC9C,kBAAwC;QAExC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,oFAAoF;QACpF,OAAO,OAAO,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,cAAc,kBAezB;AAEF;;;;;;GAMG;AACU,QAAA,gCAAgC,GAAG;IAC9C,aAAa;IACb,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,cAAc;IACd,OAAO;IACP,qBAAqB;IACrB,SAAS;IACT,eAAe;IACf,SAAS;IACT,SAAS;IACT,cAAc;IACd,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,QAAQ;IACR,aAAa;IACb,oBAAoB;IACpB,mBAAmB;IACnB,sBAAsB;IACtB,SAAS;CACV,CAAC"}
1
+ {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../src/helpers/styled.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The px a `size` renders its text at, as the theme decides it.
3
+ *
4
+ * `theme.typeScale` names the sizes an app wants at its own px; everything it leaves out is
5
+ * Reqore's own table (`TEXT_FROM_SIZE`, `CONTROL_TEXT_FROM_SIZE`, `TAG_TEXT_FROM_SIZE`). Every
6
+ * component reads its text size through one of these three, so a theme decides the type scale
7
+ * of the whole app in one place, and a theme without `typeScale` renders exactly as before.
8
+ */
9
+ import { TSizes } from '../constants/sizes';
10
+ import { IReqoreTheme } from '../constants/theme';
11
+ type TReqoreTypeScaleTheme = Pick<IReqoreTheme, 'typeScale'> | undefined;
12
+ /**
13
+ * px for running text at `size`: paragraphs, spans, links, table cells, panel / accordion /
14
+ * callout / bubble / notification / data view text, and `effect.textSize` given as a size name.
15
+ */
16
+ export declare const getTextSize: (theme: TReqoreTypeScaleTheme, size: TSizes) => number;
17
+ /**
18
+ * px for a control's text at `size`: buttons, inputs, textareas, tabs, checkboxes, the segmented
19
+ * control, progress labels and a tag's actions.
20
+ */
21
+ export declare const getControlTextSize: (theme: TReqoreTypeScaleTheme, size: TSizes) => number;
22
+ /** px for a tag's, a badge's or a keyboard key's text at `size`. */
23
+ export declare const getTagTextSize: (theme: TReqoreTypeScaleTheme, size: TSizes) => number;
24
+ export {};
25
+ //# sourceMappingURL=typeScale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeScale.d.ts","sourceRoot":"","sources":["../../src/helpers/typeScale.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAIL,MAAM,EACP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,KAAK,qBAAqB,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG,SAAS,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,qBAAqB,EAAE,MAAM,MAAM,KAAG,MACjB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,qBAAqB,EAAE,MAAM,MAAM,KAAG,MACb,CAAC;AAEpE,oEAAoE;AACpE,eAAO,MAAM,cAAc,GAAI,OAAO,qBAAqB,EAAE,MAAM,MAAM,KAAG,MACjB,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTagTextSize = exports.getControlTextSize = exports.getTextSize = void 0;
4
+ /**
5
+ * The px a `size` renders its text at, as the theme decides it.
6
+ *
7
+ * `theme.typeScale` names the sizes an app wants at its own px; everything it leaves out is
8
+ * Reqore's own table (`TEXT_FROM_SIZE`, `CONTROL_TEXT_FROM_SIZE`, `TAG_TEXT_FROM_SIZE`). Every
9
+ * component reads its text size through one of these three, so a theme decides the type scale
10
+ * of the whole app in one place, and a theme without `typeScale` renders exactly as before.
11
+ */
12
+ var sizes_1 = require("../constants/sizes");
13
+ /**
14
+ * px for running text at `size`: paragraphs, spans, links, table cells, panel / accordion /
15
+ * callout / bubble / notification / data view text, and `effect.textSize` given as a size name.
16
+ */
17
+ var getTextSize = function (theme, size) { var _a, _b, _c; return (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.typeScale) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b[size]) !== null && _c !== void 0 ? _c : sizes_1.TEXT_FROM_SIZE[size]; };
18
+ exports.getTextSize = getTextSize;
19
+ /**
20
+ * px for a control's text at `size`: buttons, inputs, textareas, tabs, checkboxes, the segmented
21
+ * control, progress labels and a tag's actions.
22
+ */
23
+ var getControlTextSize = function (theme, size) { var _a, _b, _c; return (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.typeScale) === null || _a === void 0 ? void 0 : _a.control) === null || _b === void 0 ? void 0 : _b[size]) !== null && _c !== void 0 ? _c : sizes_1.CONTROL_TEXT_FROM_SIZE[size]; };
24
+ exports.getControlTextSize = getControlTextSize;
25
+ /** px for a tag's, a badge's or a keyboard key's text at `size`. */
26
+ var getTagTextSize = function (theme, size) { var _a, _b, _c; return (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.typeScale) === null || _a === void 0 ? void 0 : _a.tag) === null || _b === void 0 ? void 0 : _b[size]) !== null && _c !== void 0 ? _c : sizes_1.TAG_TEXT_FROM_SIZE[size]; };
27
+ exports.getTagTextSize = getTagTextSize;
28
+ //# sourceMappingURL=typeScale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeScale.js","sourceRoot":"","sources":["../../src/helpers/typeScale.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,4CAK4B;AAK5B;;;GAGG;AACI,IAAM,WAAW,GAAG,UAAC,KAA4B,EAAE,IAAY,oBACpE,OAAA,MAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,IAAI,0CAAG,IAAI,CAAC,mCAAI,sBAAc,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC;AAD5C,QAAA,WAAW,eACiC;AAEzD;;;GAGG;AACI,IAAM,kBAAkB,GAAG,UAAC,KAA4B,EAAE,IAAY,oBAC3E,OAAA,MAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,OAAO,0CAAG,IAAI,CAAC,mCAAI,8BAAsB,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC;AADvD,QAAA,kBAAkB,sBACqC;AAEpE,oEAAoE;AAC7D,IAAM,cAAc,GAAG,UAAC,KAA4B,EAAE,IAAY,oBACvE,OAAA,MAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,GAAG,0CAAG,IAAI,CAAC,mCAAI,0BAAkB,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC;AAD/C,QAAA,cAAc,kBACiC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCloneThroughFragments.d.ts","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,eAAO,MAAM,wBAAwB,GACnC,aAAa,CACX,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,KAClC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACjC,OAAO,GAAG,EAAE;sBAIyB,KAAK,CAAC,SAAS,KAAG,KAAK,CAAC,SAAS;CA0BvE,CAAC"}
1
+ {"version":3,"file":"useCloneThroughFragments.d.ts","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,eAAO,MAAM,wBAAwB,GACnC,aAAa,CACX,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,KAClC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACjC,OAAO,GAAG,EAAE;sBAEyB,KAAK,CAAC,SAAS,KAAG,KAAK,CAAC,SAAS;CAsDvE,CAAC"}
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -36,26 +47,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
47
  exports.useCloneThroughFragments = void 0;
37
48
  var react_1 = __importStar(require("react"));
38
49
  var useCloneThroughFragments = function (propsMapper, deps) {
39
- var realIndex = 0;
40
50
  var clone = (0, react_1.useCallback)(function (children) {
41
- return react_1.default.Children.map(children, function (child, reactIndex) {
42
- if (child && react_1.default.isValidElement(child)) {
43
- if (child.type === react_1.default.Fragment) {
44
- return clone(child.props.children);
51
+ /* Counted per call, from the first child: the clone is kept between renders (`deps`), and a count kept with
52
+ it went on from where the last render left it - a group re-rendering by itself numbered its first child
53
+ the fourth. */
54
+ var realIndex = 0;
55
+ var cloneLevel = function (nodes) {
56
+ /* The keys given at this level of the children. A child keeps its own key, so React keeps it
57
+ (and its state) when another is added before it; a key given again is made unique (`#1`,
58
+ `#2`, ...), as the place a control group joined to every key used to make it. Children keyed
59
+ by what they say (a label, a name) can repeat it, and two children with one key are one to
60
+ React: it warns, and on an update drops or repeats one of them. A fragment's children are
61
+ keyed under the fragment, so each level counts its own. */
62
+ var given = new Map();
63
+ return react_1.default.Children.map(nodes, function (child, reactIndex) {
64
+ var _a;
65
+ if (child && react_1.default.isValidElement(child)) {
66
+ if (child.type === react_1.default.Fragment) {
67
+ return cloneLevel(child.props.children);
68
+ }
69
+ var props = propsMapper(child.props, reactIndex, realIndex, child.type);
70
+ /*
71
+ * Because of the way React.Children.map works, we have to
72
+ * manually decrement the index for every child that is `null`
73
+ * because react maps through null children and returns them in `Count`
74
+ * We filter these children out in the `realChildCount` variable,
75
+ * but the index is still incremented
76
+ * */
77
+ realIndex = realIndex + 1;
78
+ // a key the mapper set (a control group's `reactKey`) is the caller's to keep unique
79
+ if ((props === null || props === void 0 ? void 0 : props.key) === undefined && child.key !== null) {
80
+ var times = (_a = given.get(child.key)) !== null && _a !== void 0 ? _a : 0;
81
+ given.set(child.key, times + 1);
82
+ if (times > 0) {
83
+ return react_1.default.cloneElement(child, __assign(__assign({}, props), { key: "".concat(child.key, "#").concat(times) }));
84
+ }
85
+ }
86
+ return react_1.default.cloneElement(child, props);
45
87
  }
46
- var props = propsMapper(child.props, reactIndex, realIndex, child.type);
47
- /*
48
- * Because of the way React.Children.map works, we have to
49
- * manually decrement the index for every child that is `null`
50
- * because react maps through null children and returns them in `Count`
51
- * We filter these children out in the `realChildCount` variable,
52
- * but the index is still incremented
53
- * */
54
- realIndex = realIndex + 1;
55
- return react_1.default.cloneElement(child, props);
56
- }
57
- return child;
58
- });
88
+ return child;
89
+ });
90
+ };
91
+ return cloneLevel(children);
59
92
  }, deps);
60
93
  return (0, react_1.useMemo)(function () { return ({ clone: clone }); }, [clone]);
61
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useCloneThroughFragments.js","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoD;AAE7C,IAAM,wBAAwB,GAAG,UACtC,WAKiC,EACjC,IAAY;IAEZ,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,IAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,UAAC,QAAyB;QAClD,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,UAAU;YACpD,IAAI,KAAK,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAK,CAAC,QAAQ,EAAE,CAAC;oBAClC,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACrC,CAAC;gBAED,IAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAE1E;;;;;;qBAMK;gBACL,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC;gBAE1B,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC1C,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,IAAA,eAAO,EAAC,cAAM,OAAA,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,EAAX,CAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AArCW,QAAA,wBAAwB,4BAqCnC"}
1
+ {"version":3,"file":"useCloneThroughFragments.js","sourceRoot":"","sources":["../../src/hooks/useCloneThroughFragments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoD;AAE7C,IAAM,wBAAwB,GAAG,UACtC,WAKiC,EACjC,IAAY;IAEZ,IAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,UAAC,QAAyB;QAClD;;yBAEiB;QACjB,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,IAAM,UAAU,GAAG,UAAC,KAAsB;YACxC;;;;;yEAK6D;YAC7D,IAAM,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;YAE3C,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,UAAC,KAAK,EAAE,UAAU;;gBACjD,IAAI,KAAK,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAK,CAAC,QAAQ,EAAE,CAAC;wBAClC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;oBAE1E;;;;;;yBAMK;oBACL,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC;oBAE1B,qFAAqF;oBACrF,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,MAAK,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;wBACnD,IAAM,KAAK,GAAG,MAAA,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,mCAAI,CAAC,CAAC;wBAExC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;wBAEhC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;4BACd,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,wBAAO,KAAK,KAAE,GAAG,EAAE,UAAG,KAAK,CAAC,GAAG,cAAI,KAAK,CAAE,IAAG,CAAC;wBAC/E,CAAC;oBACH,CAAC;oBAED,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBAC1C,CAAC;gBAED,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,IAAA,eAAO,EAAC,cAAM,OAAA,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,EAAX,CAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AA/DW,QAAA,wBAAwB,4BA+DnC"}
@@ -0,0 +1,58 @@
1
+ import { RefObject } from 'react';
2
+ /**
3
+ * How far the pointer must travel before a press becomes a drag.
4
+ *
5
+ * Zero would make every click a one-pixel drag and swallow it; too large and the
6
+ * row feels stuck before it moves. Four pixels is the usual hysteresis for
7
+ * distinguishing a click from a drag.
8
+ */
9
+ export declare const DRAG_TO_SCROLL_THRESHOLD = 4;
10
+ /**
11
+ * Elements a drag must never start on.
12
+ *
13
+ * Deliberately NOT "anything interactive". The surfaces this is built for are made
14
+ * OF interactive things - a rail of clickable KPI tiles, a table header of sort
15
+ * buttons - so excluding buttons would leave nowhere to grab and the feature would
16
+ * do nothing. Their clicks are protected instead by suppressing the click that
17
+ * follows a real drag, which is what makes press-and-release still activate a
18
+ * tile while press-and-pull scrolls past it.
19
+ *
20
+ * What IS excluded is text entry, where a press-and-move already means
21
+ * "select within this value" and there is no other way to ask for it, and anything
22
+ * marked `reqore-no-drag-scroll`: a grab handle of its own (a column's resize handle),
23
+ * where a press-and-move already means something else.
24
+ */
25
+ export declare const NON_DRAGGABLE = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"], .reqore-no-drag-scroll";
26
+ export interface IUseDragToScrollOptions {
27
+ /** What scrolls sideways. */
28
+ scrollRef: RefObject<HTMLElement>;
29
+ /**
30
+ * Where the gesture is taken, when that is not the scroller itself: a table's
31
+ * header, which is scrolled with its body but is not a scroller of its own.
32
+ */
33
+ handleRef?: RefObject<HTMLElement>;
34
+ /** Mouse and pen: press and pull sideways to scroll. */
35
+ mouse?: boolean;
36
+ /**
37
+ * Touch: a sideways swipe on the handle scrolls the scroller. Only for a handle
38
+ * the browser cannot pan by itself (it does not overflow-scroll); on a real
39
+ * scroller touch already pans natively, and taking it over would replace that.
40
+ * The handle's own CSS must leave sideways panning to the page script
41
+ * (`touch-action: pan-y`), or the browser cancels the pointer before it moves.
42
+ */
43
+ touch?: boolean;
44
+ /** Set on the handle while a drag is engaged. */
45
+ draggingClass?: string;
46
+ }
47
+ /**
48
+ * Press and pull a sideways-scrolling surface to scroll it.
49
+ *
50
+ * `ReqoreTable`'s (`dragToScroll`, and its header's touch swipes). It binds to the
51
+ * elements themselves, not through handlers spread in render, because a table's body
52
+ * appears after mount and its header scrolls a body that is another element. The other
53
+ * drags in the library - a sheet, a modal, a toast, a tier stack, `ReqoreFadeScroller`'s
54
+ * `dragToScroll` - share `usePointerDrag`; a fix to the gesture belongs in both (a
55
+ * finger's implicit capture, for one).
56
+ */
57
+ export declare const useDragToScroll: ({ scrollRef, handleRef, mouse, touch, draggingClass, }: IUseDragToScrollOptions) => void;
58
+ //# sourceMappingURL=useDragToScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDragToScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useDragToScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,wGACyE,CAAC;AAEpG,MAAM,WAAW,uBAAuB;IACtC,6BAA6B;IAC7B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,wDAM7B,uBAAuB,SA+CzB,CAAC"}