@rbxts/uiblox 0.2.0-alpha.35 → 0.2.0-alpha.37

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 (284) hide show
  1. package/out/theme/styles/utilities/focusRing.d.ts +5 -0
  2. package/out/theme/styles/utilities/focusRing.luau +11 -0
  3. package/out/theme/styles/utilities/index.d.ts +1 -0
  4. package/out/theme/styles/utilities/init.luau +1 -0
  5. package/out/theme/styles/utilities/resolveSx.d.ts +6 -1
  6. package/out/theme/styles/utilities/resolveSx.luau +53 -12
  7. package/out/ui/packages/accordion/components/Accordion.d.ts +1 -0
  8. package/out/ui/packages/accordion/components/Accordion.luau +55 -19
  9. package/out/ui/packages/accordion/components/Accordion.styles.luau +49 -29
  10. package/out/ui/packages/accordion/components/accordionNote.d.ts +2 -0
  11. package/out/ui/packages/accordion/components/accordionNote.luau +11 -0
  12. package/out/ui/packages/alert/components/Alert.d.ts +2 -0
  13. package/out/ui/packages/alert/components/Alert.luau +24 -1
  14. package/out/ui/packages/alert/components/Alert.styles.luau +11 -0
  15. package/out/ui/packages/alert/components/alertAction.d.ts +2 -0
  16. package/out/ui/packages/alert/components/alertAction.luau +11 -0
  17. package/out/ui/packages/appBar/components/AppBar.d.ts +1 -0
  18. package/out/ui/packages/appBar/components/AppBar.luau +59 -15
  19. package/out/ui/packages/appBar/components/AppBar.styles.luau +24 -0
  20. package/out/ui/packages/appBar/components/appBarSubtitle.d.ts +2 -0
  21. package/out/ui/packages/appBar/components/appBarSubtitle.luau +11 -0
  22. package/out/ui/packages/avatarGroup/components/AvatarGroup.d.ts +14 -0
  23. package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +102 -0
  24. package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.d.ts +6 -0
  25. package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +50 -0
  26. package/out/ui/packages/avatarGroup/components/avatarGroupCut.d.ts +2 -0
  27. package/out/ui/packages/avatarGroup/components/avatarGroupCut.luau +11 -0
  28. package/out/ui/packages/avatarGroup/index.d.ts +3 -0
  29. package/out/ui/packages/avatarGroup/init.luau +6 -0
  30. package/out/ui/packages/bottomNavigation/components/BottomNavigation.d.ts +4 -1
  31. package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +19 -1
  32. package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +20 -0
  33. package/out/ui/packages/bottomNavigation/components/navBadge.d.ts +2 -0
  34. package/out/ui/packages/bottomNavigation/components/navBadge.luau +14 -0
  35. package/out/ui/packages/bottomNavigation/index.d.ts +1 -1
  36. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +16 -5
  37. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +6 -0
  38. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.d.ts +2 -0
  39. package/out/ui/packages/breadcrumbs/components/breadcrumbItems.luau +8 -0
  40. package/out/ui/packages/button/components/Button.d.ts +2 -0
  41. package/out/ui/packages/button/components/Button.luau +59 -10
  42. package/out/ui/packages/button/components/Button.styles.luau +2 -0
  43. package/out/ui/packages/button/components/buttonLook.d.ts +2 -0
  44. package/out/ui/packages/button/components/buttonLook.luau +11 -0
  45. package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +13 -0
  46. package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +102 -0
  47. package/out/ui/packages/buttonGroup/components/ButtonGroup.styles.d.ts +5 -0
  48. package/out/ui/packages/buttonGroup/components/ButtonGroup.styles.luau +57 -0
  49. package/out/ui/packages/buttonGroup/components/buttonGroupEdge.d.ts +2 -0
  50. package/out/ui/packages/buttonGroup/components/buttonGroupEdge.luau +16 -0
  51. package/out/ui/packages/buttonGroup/index.d.ts +3 -0
  52. package/out/ui/packages/buttonGroup/init.luau +6 -0
  53. package/out/ui/packages/card/components/Card.d.ts +1 -0
  54. package/out/ui/packages/card/components/Card.luau +21 -2
  55. package/out/ui/packages/card/components/Card.styles.d.ts +3 -1
  56. package/out/ui/packages/card/components/Card.styles.luau +16 -7
  57. package/out/ui/packages/card/components/cardWidth.d.ts +10 -0
  58. package/out/ui/packages/card/components/cardWidth.luau +36 -0
  59. package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -4
  60. package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +10 -1
  61. package/out/ui/packages/cframeEditor/components/cframeValue.d.ts +1 -0
  62. package/out/ui/packages/cframeEditor/components/cframeValue.luau +13 -0
  63. package/out/ui/packages/checkbox/components/Checkbox.luau +2 -1
  64. package/out/ui/packages/checkbox/components/Checkbox.styles.luau +2 -0
  65. package/out/ui/packages/chip/components/Chip.styles.d.ts +2 -1
  66. package/out/ui/packages/chip/components/Chip.styles.luau +9 -6
  67. package/out/ui/packages/chip/components/chipTone.d.ts +3 -0
  68. package/out/ui/packages/chip/components/chipTone.luau +11 -0
  69. package/out/ui/packages/collapse/components/Collapse.d.ts +8 -0
  70. package/out/ui/packages/collapse/components/Collapse.luau +34 -0
  71. package/out/ui/packages/collapse/components/Collapse.styles.d.ts +2 -0
  72. package/out/ui/packages/collapse/components/Collapse.styles.luau +20 -0
  73. package/out/ui/packages/collapse/components/collapseOpen.d.ts +1 -0
  74. package/out/ui/packages/collapse/components/collapseOpen.luau +7 -0
  75. package/out/ui/packages/collapse/index.d.ts +3 -0
  76. package/out/ui/packages/collapse/init.luau +6 -0
  77. package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +4 -2
  78. package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +4 -2
  79. package/out/ui/packages/colorPicker/components/sequenceValue.d.ts +2 -0
  80. package/out/ui/packages/colorPicker/components/sequenceValue.luau +8 -0
  81. package/out/ui/packages/colorPicker/index.d.ts +1 -1
  82. package/out/ui/packages/colorPicker/init.luau +2 -0
  83. package/out/ui/packages/copyButton/components/CopyButton.d.ts +8 -0
  84. package/out/ui/packages/copyButton/components/CopyButton.luau +32 -0
  85. package/out/ui/packages/copyButton/components/copyInvoke.d.ts +2 -0
  86. package/out/ui/packages/copyButton/components/copyInvoke.luau +12 -0
  87. package/out/ui/packages/copyButton/index.d.ts +3 -0
  88. package/out/ui/packages/copyButton/init.luau +6 -0
  89. package/out/ui/packages/cover/components/Cover.d.ts +8 -0
  90. package/out/ui/packages/cover/components/Cover.luau +47 -0
  91. package/out/ui/packages/cover/components/coverFill.d.ts +2 -0
  92. package/out/ui/packages/cover/components/coverFill.luau +14 -0
  93. package/out/ui/packages/cover/index.d.ts +3 -0
  94. package/out/ui/packages/cover/init.luau +6 -0
  95. package/out/ui/packages/dateRange/components/DateRangePicker.d.ts +3 -0
  96. package/out/ui/packages/dateRange/components/DateRangePicker.luau +167 -88
  97. package/out/ui/packages/dateRange/dateRangeValue.d.ts +5 -0
  98. package/out/ui/packages/dateRange/dateRangeValue.luau +34 -0
  99. package/out/ui/packages/dateRange/index.d.ts +1 -1
  100. package/out/ui/packages/dateRange/init.luau +3 -0
  101. package/out/ui/packages/dialog/components/Dialog.d.ts +1 -0
  102. package/out/ui/packages/dialog/components/Dialog.luau +55 -6
  103. package/out/ui/packages/dialog/components/Dialog.styles.luau +5 -3
  104. package/out/ui/packages/dialog/components/dialogWidth.d.ts +7 -0
  105. package/out/ui/packages/dialog/components/dialogWidth.luau +35 -0
  106. package/out/ui/packages/divider/components/Divider.luau +57 -12
  107. package/out/ui/packages/divider/components/dividerLabel.d.ts +2 -0
  108. package/out/ui/packages/divider/components/dividerLabel.luau +11 -0
  109. package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
  110. package/out/ui/packages/drawer/components/Drawer.luau +18 -3
  111. package/out/ui/packages/drawer/components/drawerPlacement.d.ts +13 -1
  112. package/out/ui/packages/drawer/components/drawerPlacement.luau +28 -0
  113. package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
  114. package/out/ui/packages/iconButton/components/IconButton.d.ts +2 -0
  115. package/out/ui/packages/iconButton/components/IconButton.luau +37 -3
  116. package/out/ui/packages/iconButton/components/transportGlyph.d.ts +9 -0
  117. package/out/ui/packages/iconButton/components/transportGlyph.luau +73 -0
  118. package/out/ui/packages/imageList/components/ImageList.d.ts +4 -0
  119. package/out/ui/packages/imageList/components/ImageList.luau +57 -11
  120. package/out/ui/packages/imageList/components/ImageList.styles.d.ts +1 -0
  121. package/out/ui/packages/imageList/components/ImageList.styles.luau +16 -10
  122. package/out/ui/packages/imageList/components/imageListLayout.d.ts +10 -0
  123. package/out/ui/packages/imageList/components/imageListLayout.luau +44 -0
  124. package/out/ui/packages/index.d.ts +12 -0
  125. package/out/ui/packages/init.luau +36 -0
  126. package/out/ui/packages/input/components/Input.d.ts +4 -0
  127. package/out/ui/packages/input/components/Input.luau +29 -9
  128. package/out/ui/packages/input/components/Input.styles.d.ts +1 -0
  129. package/out/ui/packages/input/components/Input.styles.luau +42 -12
  130. package/out/ui/packages/input/components/clampText.d.ts +2 -0
  131. package/out/ui/packages/input/components/clampText.luau +16 -0
  132. package/out/ui/packages/input/components/multilineHeight.d.ts +1 -0
  133. package/out/ui/packages/input/components/multilineHeight.luau +11 -0
  134. package/out/ui/packages/link/components/Link.luau +13 -9
  135. package/out/ui/packages/link/components/Link.styles.d.ts +0 -1
  136. package/out/ui/packages/link/components/Link.styles.luau +1 -12
  137. package/out/ui/packages/listItem/components/ListItem.d.ts +6 -0
  138. package/out/ui/packages/listItem/components/ListItem.luau +97 -39
  139. package/out/ui/packages/listItem/components/ListItem.styles.d.ts +3 -0
  140. package/out/ui/packages/listItem/components/ListItem.styles.luau +52 -30
  141. package/out/ui/packages/listItem/components/listItemInk.d.ts +3 -0
  142. package/out/ui/packages/listItem/components/listItemInk.luau +14 -0
  143. package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -0
  144. package/out/ui/packages/listItem/components/listItemLayout.luau +41 -0
  145. package/out/ui/packages/markdown/components/Markdown.d.ts +2 -0
  146. package/out/ui/packages/markdown/components/Markdown.luau +91 -6
  147. package/out/ui/packages/markdown/components/Markdown.styles.luau +25 -0
  148. package/out/ui/packages/markdown/index.d.ts +2 -2
  149. package/out/ui/packages/markdown/init.luau +2 -0
  150. package/out/ui/packages/markdown/parseMarkdown.d.ts +21 -1
  151. package/out/ui/packages/markdown/parseMarkdown.luau +109 -2
  152. package/out/ui/packages/menu/components/Menu.d.ts +3 -0
  153. package/out/ui/packages/menu/components/Menu.luau +68 -21
  154. package/out/ui/packages/menu/components/menuIcon.d.ts +6 -0
  155. package/out/ui/packages/menu/components/menuIcon.luau +32 -0
  156. package/out/ui/packages/numberInput/components/NumberInput.d.ts +1 -0
  157. package/out/ui/packages/numberInput/components/NumberInput.luau +67 -1
  158. package/out/ui/packages/numberInput/components/numberValue.d.ts +2 -0
  159. package/out/ui/packages/numberInput/components/numberValue.luau +10 -0
  160. package/out/ui/packages/pager/components/Pager.d.ts +11 -0
  161. package/out/ui/packages/pager/components/Pager.luau +112 -0
  162. package/out/ui/packages/pager/components/Pager.styles.d.ts +2 -0
  163. package/out/ui/packages/pager/components/Pager.styles.luau +61 -0
  164. package/out/ui/packages/pager/components/pagerStep.d.ts +3 -0
  165. package/out/ui/packages/pager/components/pagerStep.luau +24 -0
  166. package/out/ui/packages/pager/index.d.ts +3 -0
  167. package/out/ui/packages/pager/init.luau +9 -0
  168. package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +5 -0
  169. package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +5 -0
  170. package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +22 -0
  171. package/out/ui/packages/popover/components/Popover.d.ts +12 -0
  172. package/out/ui/packages/popover/components/Popover.luau +50 -0
  173. package/out/ui/packages/popover/components/Popover.styles.d.ts +2 -0
  174. package/out/ui/packages/popover/components/Popover.styles.luau +26 -0
  175. package/out/ui/packages/popover/index.d.ts +2 -0
  176. package/out/ui/packages/popover/init.luau +5 -0
  177. package/out/ui/packages/radioGroup/components/RadioGroup.d.ts +4 -1
  178. package/out/ui/packages/radioGroup/components/RadioGroup.luau +51 -8
  179. package/out/ui/packages/radioGroup/components/RadioGroup.styles.luau +26 -2
  180. package/out/ui/packages/radioGroup/components/radioHint.d.ts +2 -0
  181. package/out/ui/packages/radioGroup/components/radioHint.luau +11 -0
  182. package/out/ui/packages/radioGroup/index.d.ts +1 -1
  183. package/out/ui/packages/rating/components/Rating.d.ts +1 -1
  184. package/out/ui/packages/rating/components/Rating.luau +4 -2
  185. package/out/ui/packages/rating/components/ratingCommit.d.ts +2 -0
  186. package/out/ui/packages/rating/components/ratingCommit.luau +11 -0
  187. package/out/ui/packages/reorder/index.d.ts +2 -0
  188. package/out/ui/packages/reorder/init.luau +14 -0
  189. package/out/ui/packages/reorder/reorder.d.ts +24 -0
  190. package/out/ui/packages/reorder/reorder.luau +178 -0
  191. package/out/ui/packages/reorder/useReorderDrag.d.ts +15 -0
  192. package/out/ui/packages/reorder/useReorderDrag.luau +129 -0
  193. package/out/ui/packages/scroll/components/ScrollView.luau +76 -7
  194. package/out/ui/packages/select/components/Select.luau +18 -1
  195. package/out/ui/packages/select/components/Select.styles.luau +2 -5
  196. package/out/ui/packages/select/components/selectWidth.d.ts +2 -0
  197. package/out/ui/packages/select/components/selectWidth.luau +15 -0
  198. package/out/ui/packages/shadow/components/Shadow.luau +14 -2
  199. package/out/ui/packages/slider/components/RangeSlider.d.ts +16 -0
  200. package/out/ui/packages/slider/components/RangeSlider.luau +231 -0
  201. package/out/ui/packages/slider/components/RangeSlider.styles.d.ts +7 -0
  202. package/out/ui/packages/slider/components/RangeSlider.styles.luau +48 -0
  203. package/out/ui/packages/slider/components/Slider.d.ts +1 -0
  204. package/out/ui/packages/slider/components/Slider.luau +44 -11
  205. package/out/ui/packages/slider/components/Slider.styles.d.ts +1 -0
  206. package/out/ui/packages/slider/components/Slider.styles.luau +19 -5
  207. package/out/ui/packages/slider/components/rangeValue.d.ts +21 -0
  208. package/out/ui/packages/slider/components/rangeValue.luau +77 -0
  209. package/out/ui/packages/slider/components/sliderLabel.d.ts +4 -0
  210. package/out/ui/packages/slider/components/sliderLabel.luau +30 -0
  211. package/out/ui/packages/slider/index.d.ts +3 -0
  212. package/out/ui/packages/slider/init.luau +6 -0
  213. package/out/ui/packages/snackbar/components/Snackbar.d.ts +1 -0
  214. package/out/ui/packages/snackbar/components/Snackbar.luau +2 -0
  215. package/out/ui/packages/sparkline/components/Sparkline.d.ts +3 -0
  216. package/out/ui/packages/sparkline/components/Sparkline.luau +69 -7
  217. package/out/ui/packages/sparkline/index.d.ts +1 -1
  218. package/out/ui/packages/sparkline/init.luau +6 -1
  219. package/out/ui/packages/sparkline/sparklineLayout.d.ts +17 -0
  220. package/out/ui/packages/sparkline/sparklineLayout.luau +132 -8
  221. package/out/ui/packages/speedDial/components/SpeedDial.d.ts +1 -0
  222. package/out/ui/packages/speedDial/components/SpeedDial.luau +56 -9
  223. package/out/ui/packages/speedDial/components/SpeedDial.styles.d.ts +1 -0
  224. package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +45 -3
  225. package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +4 -0
  226. package/out/ui/packages/speedDial/components/speedDialLabel.luau +16 -0
  227. package/out/ui/packages/stateMatrix.d.ts +1 -0
  228. package/out/ui/packages/stateMatrix.luau +9 -0
  229. package/out/ui/packages/stepper/components/Stepper.d.ts +2 -0
  230. package/out/ui/packages/stepper/components/Stepper.luau +35 -7
  231. package/out/ui/packages/stepper/components/Stepper.styles.luau +3 -0
  232. package/out/ui/packages/stepper/components/stepState.d.ts +4 -2
  233. package/out/ui/packages/stepper/components/stepState.luau +12 -1
  234. package/out/ui/packages/stepper/index.d.ts +1 -1
  235. package/out/ui/packages/stepper/init.luau +3 -1
  236. package/out/ui/packages/switch/components/Switch.styles.luau +2 -5
  237. package/out/ui/packages/table/components/Table.luau +8 -5
  238. package/out/ui/packages/table/components/tableSort.d.ts +2 -0
  239. package/out/ui/packages/table/components/tableSort.luau +95 -0
  240. package/out/ui/packages/table/index.d.ts +1 -0
  241. package/out/ui/packages/table/init.luau +1 -0
  242. package/out/ui/packages/tabs/components/Tabs.luau +70 -2
  243. package/out/ui/packages/tabs/components/tabScroll.d.ts +2 -0
  244. package/out/ui/packages/tabs/components/tabScroll.luau +18 -0
  245. package/out/ui/packages/text/components/Text.d.ts +7 -0
  246. package/out/ui/packages/text/components/Text.luau +54 -0
  247. package/out/ui/packages/text/components/textBox.d.ts +12 -0
  248. package/out/ui/packages/text/components/textBox.luau +21 -0
  249. package/out/ui/packages/text/index.d.ts +2 -0
  250. package/out/ui/packages/text/init.luau +5 -0
  251. package/out/ui/packages/timeField/components/TimeField.d.ts +13 -0
  252. package/out/ui/packages/timeField/components/TimeField.luau +102 -0
  253. package/out/ui/packages/timeField/index.d.ts +4 -0
  254. package/out/ui/packages/timeField/init.luau +9 -0
  255. package/out/ui/packages/timeField/timeValue.d.ts +8 -0
  256. package/out/ui/packages/timeField/timeValue.luau +49 -0
  257. package/out/ui/packages/timeline/components/Timeline.d.ts +12 -0
  258. package/out/ui/packages/timeline/components/Timeline.luau +99 -0
  259. package/out/ui/packages/timeline/components/Timeline.styles.d.ts +2 -0
  260. package/out/ui/packages/timeline/components/Timeline.styles.luau +106 -0
  261. package/out/ui/packages/timeline/components/timelineRail.d.ts +4 -0
  262. package/out/ui/packages/timeline/components/timelineRail.luau +15 -0
  263. package/out/ui/packages/timeline/index.d.ts +3 -0
  264. package/out/ui/packages/timeline/init.luau +8 -0
  265. package/out/ui/packages/toast/components/Toast.d.ts +1 -0
  266. package/out/ui/packages/toast/components/Toast.luau +59 -12
  267. package/out/ui/packages/toast/components/Toast.styles.luau +6 -3
  268. package/out/ui/packages/toast/components/toastPlace.d.ts +12 -0
  269. package/out/ui/packages/toast/components/toastPlace.luau +31 -0
  270. package/out/ui/packages/tooltip/components/Tooltip.d.ts +1 -0
  271. package/out/ui/packages/tooltip/components/Tooltip.luau +109 -31
  272. package/out/ui/packages/tooltip/components/Tooltip.styles.luau +30 -0
  273. package/out/ui/packages/tooltip/components/tooltipBox.d.ts +4 -0
  274. package/out/ui/packages/tooltip/components/tooltipBox.luau +12 -0
  275. package/out/ui/packages/tooltip/components/tooltipPointer.d.ts +2 -0
  276. package/out/ui/packages/tooltip/components/tooltipPointer.luau +11 -0
  277. package/out/ui/packages/vectorEditor/components/VectorEditor.luau +1 -0
  278. package/out/ui/packages/weekGrid/components/WeekGrid.d.ts +24 -0
  279. package/out/ui/packages/weekGrid/components/WeekGrid.luau +187 -0
  280. package/out/ui/packages/weekGrid/components/weekColumns.d.ts +9 -0
  281. package/out/ui/packages/weekGrid/components/weekColumns.luau +25 -0
  282. package/out/ui/packages/weekGrid/index.d.ts +3 -0
  283. package/out/ui/packages/weekGrid/init.luau +8 -0
  284. package/package.json +67 -69
@@ -3,9 +3,12 @@ local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local Divider = TS.import(script, script.Parent.Parent.Parent, "divider").Divider
5
5
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
6
+ local Link = TS.import(script, script.Parent.Parent.Parent, "link").Link
6
7
  local Orientations = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Orientations
7
8
  local _parseMarkdown = TS.import(script, script.Parent.Parent, "parseMarkdown")
9
+ local inlinePieces = _parseMarkdown.inlinePieces
8
10
  local inlinesToRichText = _parseMarkdown.inlinesToRichText
11
+ local markdownLinkPayload = _parseMarkdown.markdownLinkPayload
9
12
  local parseMarkdown = _parseMarkdown.parseMarkdown
10
13
  local useMarkdownStyles = TS.import(script, script.Parent, "Markdown.styles").default
11
14
  local function headingVariant(level)
@@ -58,7 +61,88 @@ local function richLabel(key, styles, inlines, variant, order)
58
61
  _attributes.Font = if variant ~= nil and variant ~= "body" then Enum.Font.SourceSansBold else Enum.Font.SourceSans
59
62
  return React.createElement("textlabel", _attributes)
60
63
  end
61
- local function renderBlock(block, index, styles)
64
+ local function inlineHasLink(inlines)
65
+ for _, part in inlines do
66
+ if markdownLinkPayload(part) ~= nil then
67
+ return true
68
+ end
69
+ end
70
+ return false
71
+ end
72
+ local function inlineFlow(key, styles, inlines, variant, order, onLink)
73
+ if not inlineHasLink(inlines) then
74
+ return richLabel(key, styles, inlines, variant, order)
75
+ end
76
+ local pieces = inlinePieces(inlines)
77
+ local textSize = textSizeFor(variant)
78
+ local font = if variant ~= nil and variant ~= "body" then Enum.Font.SourceSansBold else Enum.Font.SourceSans
79
+ local _attributes = {
80
+ key = key,
81
+ }
82
+ for _k, _v in styles.flow do
83
+ _attributes[_k] = _v
84
+ end
85
+ _attributes.LayoutOrder = order
86
+ local _attributes_1 = table.clone(styles.flowLayout)
87
+ setmetatable(_attributes_1, nil)
88
+ local _exp = React.createElement("uilistlayout", _attributes_1)
89
+ -- ▼ ReadonlyArray.map ▼
90
+ local _newValue = table.create(#pieces)
91
+ local _callback = function(piece, index)
92
+ if piece.kind == "break" then
93
+ return React.createElement("frame", {
94
+ key = `br-{index}`,
95
+ LayoutOrder = index,
96
+ Size = UDim2.new(1, 0, 0, 0),
97
+ BackgroundTransparency = 1,
98
+ BorderSizePixel = 0,
99
+ })
100
+ end
101
+ if piece.kind == "link" then
102
+ local payload = markdownLinkPayload({
103
+ kind = "link",
104
+ text = piece.text,
105
+ href = piece.href,
106
+ })
107
+ if payload == nil then
108
+ return nil
109
+ end
110
+ return React.createElement(Link, {
111
+ key = `ln-{index}`,
112
+ text = payload.text,
113
+ sx = {
114
+ TextSize = textSize,
115
+ Font = font,
116
+ LayoutOrder = index,
117
+ },
118
+ onActivated = function()
119
+ local _result = onLink
120
+ if _result ~= nil then
121
+ _result = _result(payload)
122
+ end
123
+ return _result
124
+ end,
125
+ })
126
+ end
127
+ local _attributes_2 = {
128
+ key = `wd-{index}`,
129
+ }
130
+ for _k, _v in styles.word do
131
+ _attributes_2[_k] = _v
132
+ end
133
+ _attributes_2.LayoutOrder = index
134
+ _attributes_2.Text = piece.text
135
+ _attributes_2.TextSize = textSize
136
+ _attributes_2.Font = font
137
+ return React.createElement("textlabel", _attributes_2)
138
+ end
139
+ for _k, _v in pieces do
140
+ _newValue[_k] = _callback(_v, _k - 1, pieces)
141
+ end
142
+ -- ▲ ReadonlyArray.map ▲
143
+ return React.createElement("frame", _attributes, _exp, _newValue)
144
+ end
145
+ local function renderBlock(block, index, styles, onLink)
62
146
  if block.kind == "heading" then
63
147
  local _attributes = {
64
148
  key = `h-{index}`,
@@ -67,7 +151,7 @@ local function renderBlock(block, index, styles)
67
151
  _attributes[_k] = _v
68
152
  end
69
153
  _attributes.LayoutOrder = index
70
- return React.createElement("frame", _attributes, richLabel("Text", styles, block.inlines, headingVariant(block.level)))
154
+ return React.createElement("frame", _attributes, inlineFlow("Text", styles, block.inlines, headingVariant(block.level), nil, onLink))
71
155
  end
72
156
  if block.kind == "paragraph" then
73
157
  local _attributes = {
@@ -77,7 +161,7 @@ local function renderBlock(block, index, styles)
77
161
  _attributes[_k] = _v
78
162
  end
79
163
  _attributes.LayoutOrder = index
80
- return React.createElement("frame", _attributes, richLabel("Text", styles, block.inlines, "body"))
164
+ return React.createElement("frame", _attributes, inlineFlow("Text", styles, block.inlines, "body", nil, onLink))
81
165
  end
82
166
  if block.kind == "code" then
83
167
  local _attributes = {
@@ -132,7 +216,7 @@ local function renderBlock(block, index, styles)
132
216
  local _exp_1 = React.createElement("frame", _attributes_1)
133
217
  local _attributes_2 = table.clone(styles.quotePad)
134
218
  setmetatable(_attributes_2, nil)
135
- return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("uipadding", _attributes_2), richLabel("Text", styles, block.inlines, "body"))
219
+ return React.createElement("frame", _attributes, _exp, _exp_1, React.createElement("uipadding", _attributes_2), inlineFlow("Text", styles, block.inlines, "body", nil, onLink))
136
220
  end
137
221
  if block.kind == "list" then
138
222
  local _attributes = {
@@ -167,7 +251,7 @@ local function renderBlock(block, index, styles)
167
251
  _attributes_1[_k] = _v
168
252
  end
169
253
  _attributes_1.LayoutOrder = itemIndex
170
- return React.createElement("frame", _attributes_1, richLabel("Text", styles, labeled, "body"))
254
+ return React.createElement("frame", _attributes_1, inlineFlow("Text", styles, labeled, "body", nil, onLink))
171
255
  end
172
256
  for _k, _v in _exp_1 do
173
257
  _newValue[_k] = _callback(_v, _k - 1, _exp_1)
@@ -183,6 +267,7 @@ local function Markdown(props)
183
267
  if value == nil then
184
268
  value = ""
185
269
  end
270
+ local onLink = _binding.onLink
186
271
  local className = _binding.className
187
272
  local sx = _binding.sx
188
273
  local id = _binding.id
@@ -207,7 +292,7 @@ local function Markdown(props)
207
292
  -- ▼ ReadonlyArray.map ▼
208
293
  local _newValue = table.create(#blocks)
209
294
  local _callback = function(block, index)
210
- return renderBlock(block, index, styles)
295
+ return renderBlock(block, index, styles, onLink)
211
296
  end
212
297
  for _k, _v in blocks do
213
298
  _newValue[_k] = _callback(_v, _k - 1, blocks)
@@ -93,6 +93,31 @@ local useMarkdownStyles = componentStyles("Markdown", function(theme)
93
93
  BackgroundTransparency = 1,
94
94
  BorderSizePixel = 0,
95
95
  }
96
+ _object.flow = {
97
+ AutomaticSize = Enum.AutomaticSize.Y,
98
+ Size = UDim2.new(1, 0, 0, 0),
99
+ BackgroundTransparency = 1,
100
+ BorderSizePixel = 0,
101
+ }
102
+ _object.flowLayout = {
103
+ FillDirection = Enum.FillDirection.Horizontal,
104
+ HorizontalAlignment = Enum.HorizontalAlignment.Left,
105
+ VerticalAlignment = Enum.VerticalAlignment.Center,
106
+ SortOrder = Enum.SortOrder.LayoutOrder,
107
+ Wraps = true,
108
+ Padding = UDim.new(0, 4),
109
+ }
110
+ _object.word = {
111
+ AutomaticSize = Enum.AutomaticSize.XY,
112
+ Size = UDim2.fromScale(0, 0),
113
+ BackgroundTransparency = 1,
114
+ BorderSizePixel = 0,
115
+ Font = theme.typography.fontFamilies.default,
116
+ TextSize = theme.typography.fontSizes.body,
117
+ TextColor3 = theme.palette.text.primary,
118
+ TextXAlignment = Enum.TextXAlignment.Left,
119
+ RichText = true,
120
+ }
96
121
  return createStyles(_object)
97
122
  end)
98
123
  local default = useMarkdownStyles
@@ -3,6 +3,6 @@ export type { MarkdownProps } from "./components/Markdown";
3
3
  export { default as MarkdownEditor } from "./components/MarkdownEditor";
4
4
  export type { MarkdownEditorProps } from "./components/MarkdownEditor";
5
5
  export type { MarkdownEditorMode } from "./components/MarkdownEditor.styles";
6
- export { parseMarkdown, inlinesToPlain, inlinesToRichText } from "./parseMarkdown";
7
- export type { MdBlock, MdInline } from "./parseMarkdown";
6
+ export { parseMarkdown, inlinesToPlain, inlinesToRichText, inlinePieces, markdownLinkPayload } from "./parseMarkdown";
7
+ export type { MdBlock, MdInline, MdPiece, MarkdownLinkPayload } from "./parseMarkdown";
8
8
  export { htmlToMarkdown } from "./htmlToMarkdown";
@@ -7,5 +7,7 @@ local _parseMarkdown = TS.import(script, script, "parseMarkdown")
7
7
  exports.parseMarkdown = _parseMarkdown.parseMarkdown
8
8
  exports.inlinesToPlain = _parseMarkdown.inlinesToPlain
9
9
  exports.inlinesToRichText = _parseMarkdown.inlinesToRichText
10
+ exports.inlinePieces = _parseMarkdown.inlinePieces
11
+ exports.markdownLinkPayload = _parseMarkdown.markdownLinkPayload
10
12
  exports.htmlToMarkdown = TS.import(script, script, "htmlToMarkdown").htmlToMarkdown
11
13
  return exports
@@ -38,5 +38,25 @@ export type MdBlock = {
38
38
  /** Small markdown subset → blocks. Unsupported syntax stays plain text. */
39
39
  export declare function parseMarkdown(source: string): MdBlock[];
40
40
  export declare function inlinesToPlain(inlines: MdInline[]): string;
41
- /** Turn inline nodes into Roblox RichText. Links become colored label + (url). */
41
+ /** Turn inline nodes into Roblox RichText. Links stay the label only. */
42
42
  export declare function inlinesToRichText(inlines: MdInline[]): string;
43
+ export interface MarkdownLinkPayload {
44
+ text: string;
45
+ href: string;
46
+ }
47
+ /** Click payload for a link inline. Other inlines are not activatable. */
48
+ export declare function markdownLinkPayload(inline: MdInline): MarkdownLinkPayload | undefined;
49
+ export type MdPiece = {
50
+ kind: "word";
51
+ text: string;
52
+ } | {
53
+ kind: "link";
54
+ text: string;
55
+ href: string;
56
+ } | {
57
+ kind: "break";
58
+ };
59
+ /** Split a line into words and link payloads so a link can take a click. */
60
+ export declare function inlinePieces(inlines: MdInline[]): MdPiece[];
61
+ /** Line index of each piece. A piece wraps only when it does not fit beside the previous one. */
62
+ export declare function inlineLines(pieces: MdPiece[], maxWidth: number, gap?: number): number[];
@@ -432,7 +432,7 @@ local function escapeRich(text)
432
432
  end
433
433
  return out
434
434
  end
435
- --* Turn inline nodes into Roblox RichText. Links become colored label + (url).
435
+ --* Turn inline nodes into Roblox RichText. Links stay the label only.
436
436
  local function inlinesToRichText(inlines)
437
437
  local out = ""
438
438
  for _, part in inlines do
@@ -447,13 +447,120 @@ local function inlinesToRichText(inlines)
447
447
  elseif part.kind == "code" then
448
448
  out = `{out}<font face="RobotoMono">{escapeRich(part.text)}</font>`
449
449
  elseif part.kind == "link" then
450
- out = `{out}<font color="#4C9AFF">{escapeRich(part.text)}</font> ({escapeRich(part.href)})`
450
+ out = `{out}<font color="#4C9AFF"><u>{escapeRich(part.text)}</u></font>`
451
451
  end
452
452
  end
453
453
  return out
454
454
  end
455
+ --* Click payload for a link inline. Other inlines are not activatable.
456
+ local function markdownLinkPayload(inline)
457
+ if inline.kind ~= "link" or #inline.text == 0 then
458
+ return nil
459
+ end
460
+ return {
461
+ text = inline.text,
462
+ href = inline.href,
463
+ }
464
+ end
465
+ local function richWord(kind, word)
466
+ local safe = escapeRich(word)
467
+ if kind == "bold" then
468
+ return `<b>{safe}</b>`
469
+ end
470
+ if kind == "italic" then
471
+ return `<i>{safe}</i>`
472
+ end
473
+ if kind == "code" then
474
+ return `<font face="RobotoMono">{safe}</font>`
475
+ end
476
+ return safe
477
+ end
478
+ --* Split a line into words and link payloads so a link can take a click.
479
+ local function inlinePieces(inlines)
480
+ local out = {}
481
+ for _, part in inlines do
482
+ local link = markdownLinkPayload(part)
483
+ if link ~= nil then
484
+ local _arg0 = {
485
+ kind = "link",
486
+ text = link.text,
487
+ href = link.href,
488
+ }
489
+ table.insert(out, _arg0)
490
+ continue
491
+ end
492
+ if part.kind == "link" then
493
+ continue
494
+ end
495
+ local word = ""
496
+ local flush = function()
497
+ if #word == 0 then
498
+ return nil
499
+ end
500
+ local _arg0 = {
501
+ kind = "word",
502
+ text = richWord(part.kind, word),
503
+ }
504
+ table.insert(out, _arg0)
505
+ word = ""
506
+ end
507
+ local source = part.text
508
+ for i = 1, #source do
509
+ local _i = i
510
+ local _i_1 = i
511
+ local ch = string.sub(source, _i, _i_1)
512
+ if ch == " " or ch == "\t" or ch == "\r" then
513
+ flush()
514
+ continue
515
+ end
516
+ if ch == "\n" then
517
+ flush()
518
+ table.insert(out, {
519
+ kind = "break",
520
+ })
521
+ continue
522
+ end
523
+ word = `{word}{ch}`
524
+ end
525
+ flush()
526
+ end
527
+ return out
528
+ end
529
+ --* Line index of each piece. A piece wraps only when it does not fit beside the previous one.
530
+ local function inlineLines(pieces, maxWidth, gap)
531
+ if gap == nil then
532
+ gap = 1
533
+ end
534
+ local lineOf = {}
535
+ local line = 0
536
+ local used = 0
537
+ for _, piece in pieces do
538
+ if piece.kind == "break" then
539
+ local _line = line
540
+ table.insert(lineOf, _line)
541
+ line += 1
542
+ used = 0
543
+ continue
544
+ end
545
+ local width = #piece.text
546
+ if used > 0 and used + gap + width > maxWidth then
547
+ line += 1
548
+ used = width
549
+ elseif used == 0 then
550
+ used = width
551
+ else
552
+ used += gap + width
553
+ end
554
+ local _line = line
555
+ table.insert(lineOf, _line)
556
+ end
557
+ return lineOf
558
+ end
455
559
  return {
456
560
  parseMarkdown = parseMarkdown,
457
561
  inlinesToPlain = inlinesToPlain,
458
562
  inlinesToRichText = inlinesToRichText,
563
+ markdownLinkPayload = markdownLinkPayload,
564
+ inlinePieces = inlinePieces,
565
+ inlineLines = inlineLines,
459
566
  }
@@ -1,9 +1,12 @@
1
1
  import React from "@rbxts/react";
2
2
  import { CustomizedProps } from "../../../../theme/index";
3
+ import { Icons } from "../../../enums/index";
3
4
  export interface MenuItem {
4
5
  id: string;
5
6
  text: string;
7
+ icon?: Icons;
6
8
  disabled?: boolean;
9
+ tone?: "danger";
7
10
  }
8
11
  export interface MenuProps {
9
12
  anchor?: GuiObject;
@@ -1,13 +1,19 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
5
+ local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
4
6
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
7
+ local Icon = TS.import(script, script.Parent.Parent.Parent, "icon").Icon
5
8
  local ListItem = TS.import(script, script.Parent.Parent.Parent, "listItem").ListItem
9
+ local listItemInk = TS.import(script, script.Parent.Parent.Parent, "listItem", "components", "listItemInk").listItemInk
6
10
  local Popup = TS.import(script, script.Parent.Parent.Parent, "popup").Popup
7
11
  local EmptyListHint = TS.import(script, script.Parent.Parent.Parent, "virtualList").EmptyListHint
12
+ local _menuIcon = TS.import(script, script.Parent, "menuIcon")
13
+ local menuIcon = _menuIcon.menuIcon
14
+ local menuRow = _menuIcon.menuRow
15
+ local menuWidth = _menuIcon.menuWidth
8
16
  local useMenuStyles = TS.import(script, script.Parent, "Menu.styles").default
9
- local ROW = 28
10
- local ROW_DENSE = 22
11
17
  local function Menu(props)
12
18
  local _binding = props
13
19
  local anchor = _binding.anchor
@@ -23,21 +29,52 @@ local function Menu(props)
23
29
  local sx = _binding.sx
24
30
  local id = _binding.id
25
31
  local ref = _binding.ref
32
+ local _binding_1 = useTheme()
33
+ local theme = _binding_1.theme
26
34
  local styles = useMenuStyles()
27
35
  if not open then
28
36
  return nil
29
37
  end
30
38
  local vacant = #items == 0
31
- local row = if dense == true then ROW_DENSE else ROW
32
- local height = if vacant then row else #items * row
39
+ -- ▼ ReadonlyArray.some ▼
40
+ local _result = false
41
+ local _callback = function(item)
42
+ return menuIcon(item.icon) ~= nil
43
+ end
44
+ for _k, _v in items do
45
+ if _callback(_v, _k - 1, items) then
46
+ _result = true
47
+ break
48
+ end
49
+ end
50
+ -- ▲ ReadonlyArray.some ▲
51
+ local icons = _result
52
+ local row = menuRow(dense, icons)
53
+ local height = if vacant then menuRow(dense) else #items * row
54
+ local font = theme.typography.fontFamilies.default or Enum.Font.SourceSans
55
+ local _condition = (if dense == true then theme.typography.fontSizes.caption else theme.typography.fontSizes.body)
56
+ if _condition == nil then
57
+ _condition = 14
58
+ end
59
+ local textSize = _condition
60
+ local widest = 0
61
+ for _, item in items do
62
+ local bounds = TextService:GetTextSize(item.text, textSize, font, Vector2.new(10000, 100))
63
+ if bounds.X > widest then
64
+ widest = bounds.X
65
+ end
66
+ end
67
+ local pad = theme.padding.calc(if dense == true then 1 else 2)
68
+ local floor = if anchor ~= nil then anchor.AbsoluteSize.X else 0
69
+ local width = if vacant then 0 else menuWidth(widest, icons, pad, floor)
33
70
  local _attributes = {
34
71
  tag = "frame",
35
72
  }
36
- local _condition = id
37
- if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
38
- _condition = "Surface"
73
+ local _condition_1 = id
74
+ if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
75
+ _condition_1 = "Surface"
39
76
  end
40
- _attributes.key = _condition
77
+ _attributes.key = _condition_1
41
78
  _attributes.hostRef = ref
42
79
  _attributes.base = styles.surface
43
80
  _attributes.className = className
@@ -51,30 +88,39 @@ local function Menu(props)
51
88
  local _attributes_3 = table.clone(styles.list)
52
89
  setmetatable(_attributes_3, nil)
53
90
  local _exp_2 = React.createElement("uilistlayout", _attributes_3)
54
- local _result
91
+ local _result_1
55
92
  if vacant then
56
- local _condition_1 = empty
57
- if _condition_1 == nil then
93
+ local _condition_2 = empty
94
+ if _condition_2 == nil then
58
95
  local _attributes_4 = {}
59
- local _condition_2 = emptyText
60
- if _condition_2 == nil then
61
- _condition_2 = "No options"
96
+ local _condition_3 = emptyText
97
+ if _condition_3 == nil then
98
+ _condition_3 = "No options"
62
99
  end
63
- _attributes_4.text = _condition_2
100
+ _attributes_4.text = _condition_3
64
101
  _attributes_4.height = row
65
- _condition_1 = React.createElement(EmptyListHint, _attributes_4)
102
+ _condition_2 = React.createElement(EmptyListHint, _attributes_4)
66
103
  end
67
- _result = _condition_1
104
+ _result_1 = _condition_2
68
105
  else
69
106
  -- ▼ ReadonlyArray.map ▼
70
107
  local _newValue = table.create(#items)
71
- local _callback = function(item)
108
+ local _callback_1 = function(item)
109
+ local glyph = menuIcon(item.icon)
110
+ local ink = listItemInk(item.tone, item.disabled)
111
+ local tint = if ink == "error" then theme.palette.status.error.main elseif ink == "disabled" then theme.palette.text.disabled else theme.palette.text.primary
72
112
  return React.createElement(ListItem, {
73
113
  key = item.id,
74
114
  text = item.text,
75
115
  disabled = item.disabled,
116
+ tone = item.tone,
76
117
  dense = dense,
77
118
  selected = item.id == selected,
119
+ leading = if glyph ~= nil then React.createElement(Icon, {
120
+ icon = glyph,
121
+ size = "sm",
122
+ tint = tint,
123
+ }) else nil,
78
124
  onActivated = function()
79
125
  if item.disabled == true then
80
126
  return nil
@@ -85,16 +131,17 @@ local function Menu(props)
85
131
  })
86
132
  end
87
133
  for _k, _v in items do
88
- _newValue[_k] = _callback(_v, _k - 1, items)
134
+ _newValue[_k] = _callback_1(_v, _k - 1, items)
89
135
  end
90
136
  -- ▲ ReadonlyArray.map ▲
91
- _result = (React.createElement(React.Fragment, nil, _newValue))
137
+ _result_1 = (React.createElement(React.Fragment, nil, _newValue))
92
138
  end
93
139
  return React.createElement(Popup, {
94
140
  anchor = anchor,
95
141
  preferredHeight = height,
142
+ preferredWidth = width,
96
143
  onDismiss = onClose,
97
- }, React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_2, _result))
144
+ }, React.createElement(SxHost, _attributes, _exp, _exp_1, _exp_2, _result_1))
98
145
  end
99
146
  local default = Menu
100
147
  return {
@@ -0,0 +1,6 @@
1
+ /** An empty glyph stays off the row. */
2
+ export declare function menuIcon(icon?: string): string | undefined;
3
+ /** Icon rows need the leading slot. Plain rows stay the short menu height. */
4
+ export declare function menuRow(dense?: boolean, icon?: boolean): 22 | 48 | 28 | 44;
5
+ /** Grow past a narrow anchor so the label and glyph fit. Stay at least as wide as the anchor. */
6
+ export declare function menuWidth(text: number, icon: boolean, pad: number, floor: number): number;
@@ -0,0 +1,32 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --* An empty glyph stays off the row.
3
+ local function menuIcon(icon)
4
+ if icon == nil or icon == "" then
5
+ return nil
6
+ end
7
+ return icon
8
+ end
9
+ --* Icon rows need the leading slot. Plain rows stay the short menu height.
10
+ local function menuRow(dense, icon)
11
+ if icon == true then
12
+ return if dense == true then 44 else 48
13
+ end
14
+ return if dense == true then 22 else 28
15
+ end
16
+ --* Grow past a narrow anchor so the label and glyph fit. Stay at least as wide as the anchor.
17
+ local function menuWidth(text, icon, pad, floor)
18
+ local lead = if icon then 48 else 0
19
+ local need = text + lead + pad
20
+ if need < 0 then
21
+ need = 0
22
+ end
23
+ if floor > need then
24
+ return floor
25
+ end
26
+ return need
27
+ end
28
+ return {
29
+ menuIcon = menuIcon,
30
+ menuRow = menuRow,
31
+ menuWidth = menuWidth,
32
+ }
@@ -13,6 +13,7 @@ export interface NumberInputProps {
13
13
  width?: UDim;
14
14
  size?: ControlSize;
15
15
  reducedMotion?: boolean;
16
+ stepper?: boolean;
16
17
  }
17
18
  declare function NumberInput(props: CustomizedProps<Frame, NumberInputProps>): JSX.Element;
18
19
  export default NumberInput;
@@ -1,10 +1,38 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local useTheme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme").useTheme
4
5
  local Input = TS.import(script, script.Parent.Parent.Parent, "input").Input
5
6
  local _numberValue = TS.import(script, script.Parent, "numberValue")
6
7
  local formatNumber = _numberValue.formatNumber
7
8
  local parseNumberDraft = _numberValue.parseNumberDraft
9
+ local stepNumber = _numberValue.stepNumber
10
+ local function StepButton(props)
11
+ local _binding = useTheme()
12
+ local theme = _binding.theme
13
+ return React.createElement("textbutton", {
14
+ LayoutOrder = props.order,
15
+ Size = UDim2.fromOffset(28, 28),
16
+ BackgroundColor3 = theme.palette.surface.paper,
17
+ BackgroundTransparency = if props.enabled then 0 else 0.45,
18
+ BorderSizePixel = 0,
19
+ Text = props.text,
20
+ Font = theme.typography.fontFamilies.default,
21
+ TextSize = theme.typography.fontSizes.body,
22
+ TextColor3 = if props.enabled then theme.palette.text.primary else theme.palette.text.secondary,
23
+ AutoButtonColor = props.enabled,
24
+ Active = props.enabled,
25
+ Event = {
26
+ Activated = function()
27
+ if props.enabled then
28
+ props.onClick()
29
+ end
30
+ end,
31
+ },
32
+ }, React.createElement("uicorner", {
33
+ CornerRadius = UDim.new(0, theme.shape.borderRadius),
34
+ }))
35
+ end
8
36
  local function NumberInput(props)
9
37
  local _binding = props
10
38
  local value = _binding.value
@@ -20,10 +48,12 @@ local function NumberInput(props)
20
48
  local width = _binding.width
21
49
  local size = _binding.size
22
50
  local reducedMotion = _binding.reducedMotion
51
+ local stepper = _binding.stepper
23
52
  local className = _binding.className
24
53
  local sx = _binding.sx
25
54
  local id = _binding.id
26
55
  local ref = _binding.ref
56
+ local locked = disabled == true or readOnly == true
27
57
  local _attributes = {}
28
58
  local _condition = id
29
59
  if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
@@ -53,7 +83,43 @@ local function NumberInput(props)
53
83
  onChange(committed)
54
84
  end
55
85
  end
56
- return React.createElement(Input, _attributes)
86
+ local field = (React.createElement(Input, _attributes))
87
+ if stepper ~= true then
88
+ return field
89
+ end
90
+ local down = stepNumber(value, -1, min, max, step)
91
+ local up = stepNumber(value, 1, min, max, step)
92
+ return React.createElement("frame", {
93
+ Size = UDim2.fromScale(0, 0),
94
+ AutomaticSize = Enum.AutomaticSize.XY,
95
+ BackgroundTransparency = 1,
96
+ BorderSizePixel = 0,
97
+ }, React.createElement("uilistlayout", {
98
+ FillDirection = Enum.FillDirection.Horizontal,
99
+ Padding = UDim.new(0, 4),
100
+ VerticalAlignment = Enum.VerticalAlignment.Center,
101
+ SortOrder = Enum.SortOrder.LayoutOrder,
102
+ }), React.createElement(StepButton, {
103
+ text = "-",
104
+ order = 0,
105
+ enabled = not locked and down ~= nil,
106
+ onClick = function()
107
+ return down ~= nil and onChange(down)
108
+ end,
109
+ }), React.createElement("frame", {
110
+ LayoutOrder = 1,
111
+ Size = UDim2.fromScale(0, 0),
112
+ AutomaticSize = Enum.AutomaticSize.XY,
113
+ BackgroundTransparency = 1,
114
+ BorderSizePixel = 0,
115
+ }, field), React.createElement(StepButton, {
116
+ text = "+",
117
+ order = 2,
118
+ enabled = not locked and up ~= nil,
119
+ onClick = function()
120
+ return up ~= nil and onChange(up)
121
+ end,
122
+ }))
57
123
  end
58
124
  local default = NumberInput
59
125
  return {
@@ -1,3 +1,5 @@
1
1
  export declare function commitNumber(value: number | undefined, min?: number, max?: number, step?: number): number | undefined;
2
2
  export declare function parseNumberDraft(text: string, min?: number, max?: number, step?: number): number | undefined;
3
+ /** One step up or down. Undefined when the value would not change. */
4
+ export declare function stepNumber(value: number, direction: number, min?: number, max?: number, step?: number): number | undefined;
3
5
  export declare function formatNumber(value: number, places?: number): string;