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

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 (212) hide show
  1. package/README.md +1 -18
  2. package/out/theme/constants/NumberConstants.d.ts +10 -0
  3. package/out/theme/constants/NumberConstants.luau +12 -0
  4. package/out/theme/interfaces/density/controlMetrics.luau +2 -2
  5. package/out/theme/interfaces/palette/Palette.d.ts +7 -0
  6. package/out/theme/interfaces/spacing/Shape.d.ts +6 -0
  7. package/out/theme/interfaces/theme/Theme.d.ts +6 -0
  8. package/out/theme/interfaces/typography/FontFamilies.luau +1 -0
  9. package/out/theme/interfaces/typography/FontFamilyOptions.d.ts +1 -1
  10. package/out/theme/interfaces/typography/FontSizeOptions.d.ts +1 -1
  11. package/out/theme/interfaces/typography/FontSizes.luau +2 -0
  12. package/out/theme/interfaces/typography/Variants.d.ts +3 -1
  13. package/out/theme/interfaces/typography/Variants.luau +25 -1
  14. package/out/theme/styles/utilities/focusRing.d.ts +2 -0
  15. package/out/theme/styles/utilities/focusRing.luau +3 -0
  16. package/out/theme/styles/utilities/index.d.ts +1 -1
  17. package/out/theme/styles/utilities/init.luau +3 -1
  18. package/out/theme/themes/DarkTheme.luau +4 -0
  19. package/out/theme/themes/LightTheme.luau +4 -0
  20. package/out/theme/themes/createPalette.luau +15 -0
  21. package/out/ui/packages/accordion/components/Accordion.luau +84 -40
  22. package/out/ui/packages/accordion/components/Accordion.styles.luau +35 -17
  23. package/out/ui/packages/alert/components/Alert.luau +15 -11
  24. package/out/ui/packages/alert/components/Alert.styles.luau +37 -26
  25. package/out/ui/packages/appBar/components/AppBar.luau +35 -13
  26. package/out/ui/packages/appBar/components/AppBar.styles.luau +41 -35
  27. package/out/ui/packages/autocomplete/components/Autocomplete.luau +4 -0
  28. package/out/ui/packages/avatar/components/Avatar.d.ts +2 -0
  29. package/out/ui/packages/avatar/components/Avatar.luau +9 -2
  30. package/out/ui/packages/avatar/components/Avatar.styles.luau +7 -0
  31. package/out/ui/packages/avatarGroup/components/AvatarGroup.luau +9 -4
  32. package/out/ui/packages/avatarGroup/components/AvatarGroup.styles.luau +6 -1
  33. package/out/ui/packages/badge/components/Badge.luau +14 -11
  34. package/out/ui/packages/badge/components/Badge.styles.luau +5 -1
  35. package/out/ui/packages/bottomNavigation/components/BottomNavigation.styles.luau +4 -3
  36. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +6 -2
  37. package/out/ui/packages/breadcrumbs/components/Breadcrumbs.styles.luau +4 -0
  38. package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +20 -2
  39. package/out/ui/packages/brickColorPicker/components/BrickColorPicker.styles.luau +72 -66
  40. package/out/ui/packages/button/components/Button.luau +61 -34
  41. package/out/ui/packages/button/components/buttonPaint.d.ts +16 -0
  42. package/out/ui/packages/button/components/buttonPaint.luau +70 -0
  43. package/out/ui/packages/buttonGroup/components/ButtonGroup.d.ts +1 -0
  44. package/out/ui/packages/buttonGroup/components/ButtonGroup.luau +17 -2
  45. package/out/ui/packages/card/components/Card.styles.luau +4 -2
  46. package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +9 -1
  47. package/out/ui/packages/cframeEditor/components/CFrameEditor.styles.luau +50 -41
  48. package/out/ui/packages/checkbox/components/Checkbox.luau +5 -4
  49. package/out/ui/packages/checkbox/components/checkboxLook.d.ts +2 -2
  50. package/out/ui/packages/checkbox/components/checkboxLook.luau +2 -2
  51. package/out/ui/packages/chip/components/Chip.luau +16 -14
  52. package/out/ui/packages/chip/components/Chip.styles.luau +7 -4
  53. package/out/ui/packages/circularProgress/components/CircularProgress.luau +10 -3
  54. package/out/ui/packages/codeEditor/components/CodeEditor.d.ts +12 -0
  55. package/out/ui/packages/codeEditor/components/CodeEditor.luau +262 -0
  56. package/out/ui/packages/codeEditor/components/CodeEditor.styles.d.ts +6 -0
  57. package/out/ui/packages/codeEditor/components/CodeEditor.styles.luau +124 -0
  58. package/out/ui/packages/codeEditor/highlightCode.d.ts +11 -0
  59. package/out/ui/packages/codeEditor/highlightCode.luau +503 -0
  60. package/out/ui/packages/codeEditor/index.d.ts +2 -0
  61. package/out/ui/packages/codeEditor/init.luau +5 -0
  62. package/out/ui/packages/colorPicker/components/ColorPicker.luau +9 -1
  63. package/out/ui/packages/colorPicker/components/ColorPicker.styles.luau +74 -67
  64. package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +12 -4
  65. package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +12 -4
  66. package/out/ui/packages/dateRange/components/DateRangePicker.luau +31 -19
  67. package/out/ui/packages/dialog/components/Dialog.styles.luau +4 -2
  68. package/out/ui/packages/divider/components/Divider.luau +3 -1
  69. package/out/ui/packages/divider/components/Divider.styles.luau +1 -0
  70. package/out/ui/packages/drawer/components/Drawer.d.ts +1 -0
  71. package/out/ui/packages/drawer/components/Drawer.luau +43 -14
  72. package/out/ui/packages/drawer/components/Drawer.styles.luau +13 -5
  73. package/out/ui/packages/drawer/components/drawerPlacement.d.ts +2 -0
  74. package/out/ui/packages/drawer/components/drawerPlacement.luau +18 -0
  75. package/out/ui/packages/editorFace.d.ts +22 -0
  76. package/out/ui/packages/editorFace.luau +49 -0
  77. package/out/ui/packages/fab/components/Fab.luau +19 -6
  78. package/out/ui/packages/fab/components/Fab.styles.luau +4 -3
  79. package/out/ui/packages/fab/components/fabSize.d.ts +1 -1
  80. package/out/ui/packages/fontEditor/components/FontEditor.luau +13 -3
  81. package/out/ui/packages/fontEditor/components/FontEditor.styles.luau +36 -27
  82. package/out/ui/packages/gradientEditor/components/GradientEditor.luau +21 -13
  83. package/out/ui/packages/gradientEditor/components/GradientEditor.styles.luau +52 -44
  84. package/out/ui/packages/icon/components/DrawnGlyph.d.ts +11 -0
  85. package/out/ui/packages/icon/components/DrawnGlyph.luau +87 -0
  86. package/out/ui/packages/icon/components/Icon.d.ts +6 -2
  87. package/out/ui/packages/icon/components/Icon.luau +23 -3
  88. package/out/ui/packages/icon/components/Icon.styles.luau +3 -0
  89. package/out/ui/packages/icon/components/glyphs.d.ts +28 -0
  90. package/out/ui/packages/icon/components/glyphs.luau +64 -0
  91. package/out/ui/packages/icon/index.d.ts +1 -0
  92. package/out/ui/packages/iconButton/components/IconButton.d.ts +5 -2
  93. package/out/ui/packages/iconButton/components/IconButton.luau +83 -16
  94. package/out/ui/packages/iconButton/components/IconButton.styles.luau +4 -27
  95. package/out/ui/packages/iconButton/components/iconButtonBox.d.ts +11 -0
  96. package/out/ui/packages/iconButton/components/iconButtonBox.luau +48 -0
  97. package/out/ui/packages/iconButton/components/transportGlyph.d.ts +1 -0
  98. package/out/ui/packages/iconButton/components/transportGlyph.luau +4 -0
  99. package/out/ui/packages/imageList/components/ImageList.luau +11 -36
  100. package/out/ui/packages/imageList/components/ImageList.styles.luau +1 -0
  101. package/out/ui/packages/imageList/components/imageListLayout.d.ts +0 -2
  102. package/out/ui/packages/imageList/components/imageListLayout.luau +0 -8
  103. package/out/ui/packages/index.d.ts +1 -0
  104. package/out/ui/packages/init.luau +3 -0
  105. package/out/ui/packages/input/components/Input.luau +46 -29
  106. package/out/ui/packages/input/components/Input.styles.luau +8 -11
  107. package/out/ui/packages/input/components/fieldChrome.d.ts +5 -0
  108. package/out/ui/packages/input/components/fieldChrome.luau +11 -0
  109. package/out/ui/packages/layout/components/Box.luau +92 -13
  110. package/out/ui/packages/layout/components/Box.styles.d.ts +0 -2
  111. package/out/ui/packages/layout/components/Box.styles.luau +0 -9
  112. package/out/ui/packages/layout/components/Grid.luau +81 -16
  113. package/out/ui/packages/layout/components/Pad.d.ts +24 -0
  114. package/out/ui/packages/layout/components/Pad.luau +88 -0
  115. package/out/ui/packages/layout/components/Stack.luau +79 -13
  116. package/out/ui/packages/link/components/Link.luau +19 -13
  117. package/out/ui/packages/link/components/Link.styles.luau +10 -1
  118. package/out/ui/packages/listItem/components/ListItem.luau +61 -4
  119. package/out/ui/packages/listItem/components/ListItem.styles.d.ts +1 -0
  120. package/out/ui/packages/listItem/components/ListItem.styles.luau +28 -11
  121. package/out/ui/packages/listItem/components/listItemInk.d.ts +1 -1
  122. package/out/ui/packages/listItem/components/listItemLayout.d.ts +12 -2
  123. package/out/ui/packages/listItem/components/listItemLayout.luau +29 -2
  124. package/out/ui/packages/markdown/components/Markdown.luau +163 -50
  125. package/out/ui/packages/markdown/components/Markdown.styles.luau +125 -76
  126. package/out/ui/packages/markdown/components/MarkdownEditor.luau +215 -146
  127. package/out/ui/packages/markdown/components/MarkdownEditor.styles.d.ts +1 -0
  128. package/out/ui/packages/markdown/components/MarkdownEditor.styles.luau +153 -83
  129. package/out/ui/packages/markdown/index.d.ts +1 -1
  130. package/out/ui/packages/markdown/parseMarkdown.d.ts +9 -1
  131. package/out/ui/packages/markdown/parseMarkdown.luau +350 -29
  132. package/out/ui/packages/menu/components/Menu.d.ts +1 -1
  133. package/out/ui/packages/menu/components/Menu.luau +12 -11
  134. package/out/ui/packages/menu/components/Menu.styles.luau +6 -1
  135. package/out/ui/packages/menu/components/menuIcon.d.ts +1 -1
  136. package/out/ui/packages/numberInput/components/NumberInput.luau +19 -4
  137. package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +9 -1
  138. package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.styles.luau +23 -16
  139. package/out/ui/packages/pager/components/Pager.luau +15 -13
  140. package/out/ui/packages/pager/components/Pager.styles.luau +5 -0
  141. package/out/ui/packages/pagination/components/Pagination.styles.luau +4 -1
  142. package/out/ui/packages/paper/components/Paper.luau +17 -11
  143. package/out/ui/packages/paper/components/Paper.styles.luau +12 -5
  144. package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +9 -1
  145. package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +24 -19
  146. package/out/ui/packages/popover/components/Popover.d.ts +1 -1
  147. package/out/ui/packages/popover/components/Popover.luau +6 -4
  148. package/out/ui/packages/popover/components/Popover.styles.luau +6 -0
  149. package/out/ui/packages/popup/components/Popup.d.ts +2 -0
  150. package/out/ui/packages/popup/components/Popup.luau +64 -2
  151. package/out/ui/packages/popup/components/placement.luau +6 -4
  152. package/out/ui/packages/progressBar/components/ProgressBar.luau +1 -1
  153. package/out/ui/packages/progressBar/components/ProgressBar.styles.luau +3 -2
  154. package/out/ui/packages/radioGroup/components/RadioGroup.luau +2 -1
  155. package/out/ui/packages/rating/components/Rating.luau +45 -3
  156. package/out/ui/packages/rating/components/Rating.styles.luau +1 -1
  157. package/out/ui/packages/rayEditor/components/RayEditor.luau +9 -1
  158. package/out/ui/packages/rayEditor/components/RayEditor.styles.luau +17 -11
  159. package/out/ui/packages/rectEditor/components/RectEditor.luau +9 -1
  160. package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +49 -42
  161. package/out/ui/packages/select/components/Select.d.ts +2 -0
  162. package/out/ui/packages/select/components/Select.luau +148 -106
  163. package/out/ui/packages/select/components/Select.styles.d.ts +2 -0
  164. package/out/ui/packages/select/components/Select.styles.luau +29 -5
  165. package/out/ui/packages/shadow/components/Shadow.luau +188 -19
  166. package/out/ui/packages/sidebar/components/Sidebar.styles.luau +1 -0
  167. package/out/ui/packages/skeleton/components/Skeleton.luau +4 -0
  168. package/out/ui/packages/slider/components/RangeSlider.luau +6 -5
  169. package/out/ui/packages/slider/components/Slider.luau +11 -16
  170. package/out/ui/packages/sparkline/components/Sparkline.luau +7 -5
  171. package/out/ui/packages/speedDial/components/SpeedDial.luau +4 -1
  172. package/out/ui/packages/speedDial/components/SpeedDial.styles.luau +5 -0
  173. package/out/ui/packages/speedDial/components/speedDialLabel.d.ts +1 -1
  174. package/out/ui/packages/splitPane/components/splitLook.d.ts +1 -1
  175. package/out/ui/packages/stepper/components/Stepper.styles.luau +9 -6
  176. package/out/ui/packages/switch/components/Switch.luau +2 -2
  177. package/out/ui/packages/switch/components/switchLook.d.ts +3 -3
  178. package/out/ui/packages/switch/components/switchLook.luau +4 -10
  179. package/out/ui/packages/table/components/Table.d.ts +1 -0
  180. package/out/ui/packages/table/components/Table.luau +92 -53
  181. package/out/ui/packages/table/components/Table.styles.luau +23 -6
  182. package/out/ui/packages/table/components/tableColumns.d.ts +2 -0
  183. package/out/ui/packages/table/components/tableColumns.luau +2 -0
  184. package/out/ui/packages/tabs/components/Tabs.luau +7 -4
  185. package/out/ui/packages/tabs/components/Tabs.styles.luau +12 -11
  186. package/out/ui/packages/tabs/components/tabIndicator.d.ts +7 -0
  187. package/out/ui/packages/tabs/components/tabIndicator.luau +21 -0
  188. package/out/ui/packages/text/components/Text.d.ts +2 -0
  189. package/out/ui/packages/text/components/Text.luau +12 -2
  190. package/out/ui/packages/timeField/components/TimeField.luau +11 -7
  191. package/out/ui/packages/timeline/components/Timeline.luau +35 -32
  192. package/out/ui/packages/timeline/components/Timeline.styles.luau +19 -10
  193. package/out/ui/packages/toast/components/Toast.luau +168 -72
  194. package/out/ui/packages/toast/components/Toast.styles.luau +36 -19
  195. package/out/ui/packages/toast/components/toastPlace.d.ts +4 -0
  196. package/out/ui/packages/toast/components/toastPlace.luau +13 -0
  197. package/out/ui/packages/toast/enums/ToastVariants.d.ts +2 -1
  198. package/out/ui/packages/toast/enums/ToastVariants.luau +1 -0
  199. package/out/ui/packages/toggleButton/components/ToggleButton.luau +43 -4
  200. package/out/ui/packages/toggleButton/components/ToggleButton.styles.luau +1 -1
  201. package/out/ui/packages/tooltip/components/Tooltip.styles.luau +2 -2
  202. package/out/ui/packages/treeView/components/TreeView.luau +12 -13
  203. package/out/ui/packages/treeView/components/TreeView.styles.luau +6 -0
  204. package/out/ui/packages/typography/components/Typography.d.ts +2 -0
  205. package/out/ui/packages/typography/components/Typography.luau +8 -0
  206. package/out/ui/packages/typography/components/Typography.styles.luau +3 -1
  207. package/out/ui/packages/udimEditor/components/UDimEditor.luau +9 -1
  208. package/out/ui/packages/udimEditor/components/UDimEditor.styles.luau +25 -18
  209. package/out/ui/packages/vectorEditor/components/VectorEditor.luau +17 -3
  210. package/out/ui/packages/vectorEditor/components/VectorEditor.styles.luau +30 -16
  211. package/out/ui/packages/virtualList/components/VirtualList.styles.luau +1 -0
  212. package/package.json +69 -67
@@ -5,9 +5,11 @@ local React = _react
5
5
  local useEffect = _react.useEffect
6
6
  local useRef = _react.useRef
7
7
  local useState = _react.useState
8
+ local useReducedMotion = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "hooks").useReducedMotion
8
9
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
9
10
  local cx = _theme.cx
10
11
  local useTheme = _theme.useTheme
12
+ local playProperty = TS.import(script, script.Parent.Parent.Parent, "motion", "play").playProperty
11
13
  local canActivate = TS.import(script, script.Parent.Parent.Parent, "button", "components", "activation").canActivate
12
14
  local spinnerPixels = TS.import(script, script.Parent.Parent.Parent, "button", "components", "buttonLook").spinnerPixels
13
15
  local CircularProgress = TS.import(script, script.Parent.Parent.Parent, "circularProgress").CircularProgress
@@ -73,6 +75,8 @@ local function Input(props)
73
75
  local id = _binding.id
74
76
  local ref = _binding.ref
75
77
  local focusedRef = useRef(false)
78
+ local strokeRef = useRef()
79
+ local motion = useReducedMotion(reducedMotion)
76
80
  local entered = useRef(false)
77
81
  local _condition = text
78
82
  if _condition == nil then
@@ -103,7 +107,6 @@ local function Input(props)
103
107
  local errorColorText = _binding_2.errorColorText
104
108
  local divider = _binding_2.divider
105
109
  local corner = _binding_2.corner
106
- local stroke = _binding_2.stroke
107
110
  useEffect(function()
108
111
  setDraft(function(current)
109
112
  return clampText(syncInputDraft(focusedRef.current, text, current), maxLength)
@@ -111,6 +114,21 @@ local function Input(props)
111
114
  end, { text, maxLength })
112
115
  local showStroke = variant == "outlined" or variant == "filled"
113
116
  local showCorner = rounded
117
+ local ink = if hasError then theme.palette.status.error.main elseif focused then theme.palette.focus else theme.palette.border
118
+ local weight = if focused then 2 else 1
119
+ useEffect(function()
120
+ if not showStroke then
121
+ return nil
122
+ end
123
+ local line = strokeRef.current
124
+ if not line then
125
+ return nil
126
+ end
127
+ return playProperty(line, {
128
+ Color = ink,
129
+ Thickness = weight,
130
+ }, theme.motion.fast, motion)
131
+ end, { showStroke, ink, weight, motion, theme })
114
132
  local _attributes = {
115
133
  tag = "frame",
116
134
  }
@@ -140,27 +158,26 @@ local function Input(props)
140
158
  for _k, _v in shell do
141
159
  _attributes_2[_k] = _v
142
160
  end
143
- local _condition_2 = showStroke
161
+ local _exp = showStroke and React.createElement("uistroke", {
162
+ ref = strokeRef,
163
+ ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
164
+ Transparency = 0,
165
+ })
166
+ local _condition_2 = showCorner
144
167
  if _condition_2 then
145
- local _attributes_3 = table.clone(stroke)
146
- setmetatable(_attributes_3, nil)
147
- _condition_2 = React.createElement("uistroke", _attributes_3)
148
- end
149
- local _condition_3 = showCorner
150
- if _condition_3 then
151
168
  local _attributes_3 = table.clone(corner)
152
169
  setmetatable(_attributes_3, nil)
153
- _condition_3 = React.createElement("uicorner", _attributes_3)
170
+ _condition_2 = React.createElement("uicorner", _attributes_3)
154
171
  end
155
- local _condition_4 = startAdornment ~= nil
156
- if _condition_4 then
172
+ local _condition_3 = startAdornment ~= nil
173
+ if _condition_3 then
157
174
  local _attributes_3 = {
158
175
  key = "Start",
159
176
  }
160
177
  for _k, _v in startSlot do
161
178
  _attributes_3[_k] = _v
162
179
  end
163
- _condition_4 = (React.createElement("frame", _attributes_3, adornmentAlign(), startAdornment))
180
+ _condition_3 = (React.createElement("frame", _attributes_3, adornmentAlign(), startAdornment))
164
181
  end
165
182
  local _attributes_3 = {
166
183
  key = "Field",
@@ -233,48 +250,48 @@ local function Input(props)
233
250
  if onBlur then
234
251
  onBlur()
235
252
  end
236
- local _condition_5 = text
237
- if _condition_5 == nil then
238
- _condition_5 = ""
253
+ local _condition_4 = text
254
+ if _condition_4 == nil then
255
+ _condition_4 = ""
239
256
  end
240
- setDraft(clampText(_condition_5, maxLength))
257
+ setDraft(clampText(_condition_4, maxLength))
241
258
  end,
242
259
  }
243
- local _exp = React.createElement("textbox", _attributes_3)
244
- local _condition_5 = loading
245
- if _condition_5 then
260
+ local _exp_1 = React.createElement("textbox", _attributes_3)
261
+ local _condition_4 = loading
262
+ if _condition_4 then
246
263
  local _attributes_4 = {
247
264
  key = "End",
248
265
  }
249
266
  for _k, _v in endSlot do
250
267
  _attributes_4[_k] = _v
251
268
  end
252
- _condition_5 = (React.createElement("frame", _attributes_4, adornmentAlign(), React.createElement(CircularProgress, {
269
+ _condition_4 = (React.createElement("frame", _attributes_4, adornmentAlign(), React.createElement(CircularProgress, {
253
270
  size = spinnerPixels(size),
254
271
  thickness = 2,
255
272
  color = theme.palette.text.secondary,
256
273
  reducedMotion = reducedMotion,
257
274
  })))
258
275
  end
259
- local _condition_6 = endSlotContent ~= nil
260
- if _condition_6 then
276
+ local _condition_5 = endSlotContent ~= nil
277
+ if _condition_5 then
261
278
  local _attributes_4 = {
262
279
  key = "End",
263
280
  }
264
281
  for _k, _v in endSlot do
265
282
  _attributes_4[_k] = _v
266
283
  end
267
- _condition_6 = (React.createElement("frame", _attributes_4, adornmentAlign(), endSlotContent))
284
+ _condition_5 = (React.createElement("frame", _attributes_4, adornmentAlign(), endSlotContent))
268
285
  end
269
- local _exp_1 = React.createElement("frame", _attributes_2, _condition_2, _condition_3, _condition_4, _exp, _condition_5, _condition_6)
270
- local _exp_2 = variant == "standard" and (React.createElement(Divider, {
286
+ local _exp_2 = React.createElement("frame", _attributes_2, _exp, _condition_2, _condition_3, _exp_1, _condition_4, _condition_5)
287
+ local _exp_3 = variant == "standard" and (React.createElement(Divider, {
271
288
  padding = 0,
272
289
  weight = if focused then 2 else nil,
273
290
  orientation = Orientations.Horizontal,
274
291
  className = cx(divider, hasError and errorColorFrame),
275
292
  }))
276
- local _condition_7 = helperText ~= nil
277
- if _condition_7 then
293
+ local _condition_6 = helperText ~= nil
294
+ if _condition_6 then
278
295
  local _attributes_4 = {
279
296
  key = "HelperText",
280
297
  }
@@ -288,9 +305,9 @@ local function Input(props)
288
305
  _attributes_4[_k] = _v
289
306
  end
290
307
  _attributes_4.Text = helperText
291
- _condition_7 = (React.createElement("textlabel", _attributes_4))
308
+ _condition_6 = (React.createElement("textlabel", _attributes_4))
292
309
  end
293
- return React.createElement(SxHost, _attributes, React.createElement("frame", _attributes_1, _exp_1, _exp_2, _condition_7))
310
+ return React.createElement(SxHost, _attributes, React.createElement("frame", _attributes_1, _exp_2, _exp_3, _condition_6))
294
311
  end
295
312
  local default = Input
296
313
  return {
@@ -5,13 +5,10 @@ local controlMetrics = _theme.controlMetrics
5
5
  local createStyles = _theme.createStyles
6
6
  local componentStyles = _theme.componentStyles
7
7
  local focusRing = _theme.focusRing
8
+ local fieldChrome = TS.import(script, script.Parent, "fieldChrome").fieldChrome
8
9
  local inputInsets = TS.import(script, script.Parent, "inputInsets").inputInsets
9
10
  local multilineHeight = TS.import(script, script.Parent, "multilineHeight").multilineHeight
10
11
  local useInputStyles = componentStyles("Input", function(theme, _param)
11
- local color = _param.color
12
- if color == nil then
13
- color = "primary"
14
- end
15
12
  local margin = _param.margin
16
13
  if margin == nil then
17
14
  margin = "none"
@@ -61,14 +58,14 @@ local useInputStyles = componentStyles("Input", function(theme, _param)
61
58
  contentHeight = 0
62
59
  end
63
60
  local metrics = controlMetrics(theme.density, size)
61
+ local chrome = fieldChrome(metrics.height, theme.padding.calc(1))
64
62
  local hasStart = startAdornment ~= nil
65
63
  local hasEnd = endAdornment ~= nil or loading
66
64
  local icon = metrics.icon
67
- local gap = theme.padding.calc(1)
65
+ local gap = chrome.padX
68
66
  local insets = inputInsets(hasStart, hasEnd, icon, gap)
69
- local verticalPad = theme.padding.calc(1)
70
- local fieldHeight = if multiline then multilineHeight(contentHeight, metrics.font, minRows, maxRows, verticalPad) else metrics.height + (if variant == "standard" then 0 else verticalPad)
71
- local accent = if color == "primary" then theme.palette.primary.main else theme.palette.text.primary
67
+ local verticalPad = chrome.padX
68
+ local fieldHeight = if multiline then multilineHeight(contentHeight, metrics.font, minRows, maxRows, verticalPad) else chrome.height
72
69
  local makeRootStyles = function()
73
70
  local defaultStyles = {}
74
71
  defaultStyles.BackgroundTransparency = 1
@@ -186,7 +183,7 @@ local useInputStyles = componentStyles("Input", function(theme, _param)
186
183
  },
187
184
  divider = {
188
185
  Position = UDim2.new(0, 0, 0, fieldHeight),
189
- BackgroundColor3 = if focused then theme.palette.focus else accent,
186
+ BackgroundColor3 = if focused then theme.palette.focus else theme.palette.border,
190
187
  ZIndex = 11000,
191
188
  },
192
189
  corner = {
@@ -195,8 +192,8 @@ local useInputStyles = componentStyles("Input", function(theme, _param)
195
192
  }
196
193
  local _left = "stroke"
197
194
  local _object_1 = {
198
- Color = if hasError then theme.palette.status.error.main else accent,
199
- Transparency = if focused or hasError then 0 else 0.45,
195
+ Color = if hasError then theme.palette.status.error.main elseif focused then theme.palette.focus else theme.palette.border,
196
+ Transparency = 0,
200
197
  Thickness = 1,
201
198
  ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
202
199
  }
@@ -0,0 +1,5 @@
1
+ /** Shared single-line field size. Height is the control metric. Inset is one padding step. */
2
+ export declare function fieldChrome(controlHeight: number, padUnit: number): {
3
+ height: number;
4
+ padX: number;
5
+ };
@@ -0,0 +1,11 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ --* Shared single-line field size. Height is the control metric. Inset is one padding step.
3
+ local function fieldChrome(controlHeight, padUnit)
4
+ return {
5
+ height = controlHeight,
6
+ padX = padUnit,
7
+ }
8
+ end
9
+ return {
10
+ fieldChrome = fieldChrome,
11
+ }
@@ -1,8 +1,71 @@
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 _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
5
+ local resolveSx = _theme.resolveSx
6
+ local useTheme = _theme.useTheme
4
7
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
8
+ local boxPadSides = TS.import(script, script.Parent, "boxPad").boxPadSides
5
9
  local useBoxStyles = TS.import(script, script.Parent, "Box.styles").default
10
+ local _Pad = TS.import(script, script.Parent, "Pad")
11
+ local automaticAxes = _Pad.automaticAxes
12
+ local Pad = _Pad.Pad
13
+ local padActive = _Pad.padActive
14
+ local styleAutomaticSize = _Pad.styleAutomaticSize
15
+ local withoutPad = _Pad.withoutPad
16
+ local function padPixels(themePad, padding, resolved)
17
+ local sides = boxPadSides(padding)
18
+ if sides.top + sides.right + sides.bottom + sides.left > 0 then
19
+ return {
20
+ left = themePad(sides.left),
21
+ right = themePad(sides.right),
22
+ top = themePad(sides.top),
23
+ bottom = themePad(sides.bottom),
24
+ }
25
+ end
26
+ local _object = {}
27
+ local _left = "left"
28
+ local _result = resolved
29
+ if _result ~= nil then
30
+ _result = _result.PaddingLeft.Offset
31
+ end
32
+ local _condition = _result
33
+ if _condition == nil then
34
+ _condition = 0
35
+ end
36
+ _object[_left] = _condition
37
+ local _left_1 = "right"
38
+ local _result_1 = resolved
39
+ if _result_1 ~= nil then
40
+ _result_1 = _result_1.PaddingRight.Offset
41
+ end
42
+ local _condition_1 = _result_1
43
+ if _condition_1 == nil then
44
+ _condition_1 = 0
45
+ end
46
+ _object[_left_1] = _condition_1
47
+ local _left_2 = "top"
48
+ local _result_2 = resolved
49
+ if _result_2 ~= nil then
50
+ _result_2 = _result_2.PaddingTop.Offset
51
+ end
52
+ local _condition_2 = _result_2
53
+ if _condition_2 == nil then
54
+ _condition_2 = 0
55
+ end
56
+ _object[_left_2] = _condition_2
57
+ local _left_3 = "bottom"
58
+ local _result_3 = resolved
59
+ if _result_3 ~= nil then
60
+ _result_3 = _result_3.PaddingBottom.Offset
61
+ end
62
+ local _condition_3 = _result_3
63
+ if _condition_3 == nil then
64
+ _condition_3 = 0
65
+ end
66
+ _object[_left_3] = _condition_3
67
+ return _object
68
+ end
6
69
  local function Box(props)
7
70
  local _binding = props
8
71
  local padding = _binding.padding
@@ -12,27 +75,43 @@ local function Box(props)
12
75
  local sx = _binding.sx
13
76
  local id = _binding.id
14
77
  local ref = _binding.ref
78
+ local _binding_1 = useTheme()
79
+ local theme = _binding_1.theme
15
80
  local styles = useBoxStyles({
16
- padding = padding,
17
81
  bgcolor = bgcolor,
18
82
  })
83
+ local resolved = resolveSx(theme, sx).padding
84
+ local edges = padPixels(function(step)
85
+ return theme.spacing.calc(step)
86
+ end, padding, resolved)
87
+ local inset = padActive(edges.left, edges.right, edges.top, edges.bottom)
88
+ local _result = sx
89
+ if _result ~= nil then
90
+ _result = _result.AutomaticSize
91
+ end
92
+ local _condition = _result
93
+ if _condition == nil then
94
+ _condition = styleAutomaticSize(styles.root)
95
+ end
96
+ local auto = automaticAxes(_condition)
19
97
  local _attributes = {}
20
- local _condition = id
21
- if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
22
- _condition = "Box"
98
+ local _condition_1 = id
99
+ if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
100
+ _condition_1 = "Box"
23
101
  end
24
- _attributes.key = _condition
102
+ _attributes.key = _condition_1
25
103
  _attributes.hostRef = ref
26
104
  _attributes.base = styles.root
27
105
  _attributes.className = className
28
- _attributes.sx = sx
29
- local _condition_1 = padding ~= nil
30
- if _condition_1 then
31
- local _attributes_1 = table.clone(styles.padding)
32
- setmetatable(_attributes_1, nil)
33
- _condition_1 = React.createElement("uipadding", _attributes_1)
34
- end
35
- return React.createElement(SxHost, _attributes, _condition_1, children)
106
+ _attributes.sx = if inset then withoutPad(sx) else sx
107
+ return React.createElement(SxHost, _attributes, if inset then (React.createElement(Pad, {
108
+ left = edges.left,
109
+ right = edges.right,
110
+ top = edges.top,
111
+ bottom = edges.bottom,
112
+ autoX = auto.x,
113
+ autoY = auto.y,
114
+ }, children)) else children)
36
115
  end
37
116
  local default = Box
38
117
  return {
@@ -1,7 +1,5 @@
1
- import { BoxPad } from "./boxPad";
2
1
  export type BoxBg = "transparent" | "paper" | "elevated" | "input";
3
2
  declare const useBoxStyles: (props: {
4
- padding?: BoxPad;
5
3
  bgcolor?: BoxBg;
6
4
  }) => import("../../../../theme/index").ClassNameMap<string>;
7
5
  export default useBoxStyles;
@@ -3,14 +3,11 @@ local TS = _G[script]
3
3
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
4
4
  local componentStyles = _theme.componentStyles
5
5
  local createStyles = _theme.createStyles
6
- local boxPadSides = TS.import(script, script.Parent, "boxPad").boxPadSides
7
6
  local useBoxStyles = componentStyles("Box", function(theme, _param)
8
- local padding = _param.padding
9
7
  local bgcolor = _param.bgcolor
10
8
  if bgcolor == nil then
11
9
  bgcolor = "transparent"
12
10
  end
13
- local sides = boxPadSides(padding)
14
11
  local fill = if bgcolor == "paper" then theme.palette.surface.paper elseif bgcolor == "elevated" then theme.palette.surface.elevated elseif bgcolor == "input" then theme.palette.surface.input else theme.palette.surface.paper
15
12
  return createStyles({
16
13
  root = {
@@ -20,12 +17,6 @@ local useBoxStyles = componentStyles("Box", function(theme, _param)
20
17
  BackgroundTransparency = if bgcolor == "transparent" then 1 else 0,
21
18
  BorderSizePixel = 0,
22
19
  },
23
- padding = {
24
- PaddingTop = UDim.new(0, theme.spacing.calc(sides.top)),
25
- PaddingRight = UDim.new(0, theme.spacing.calc(sides.right)),
26
- PaddingBottom = UDim.new(0, theme.spacing.calc(sides.bottom)),
27
- PaddingLeft = UDim.new(0, theme.spacing.calc(sides.left)),
28
- },
29
20
  })
30
21
  end)
31
22
  local default = useBoxStyles
@@ -4,7 +4,15 @@ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
4
  local _theme = TS.import(script, script.Parent.Parent.Parent.Parent.Parent, "theme")
5
5
  local componentStyles = _theme.componentStyles
6
6
  local createStyles = _theme.createStyles
7
+ local resolveSx = _theme.resolveSx
8
+ local useTheme = _theme.useTheme
7
9
  local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
10
+ local _Pad = TS.import(script, script.Parent, "Pad")
11
+ local automaticAxes = _Pad.automaticAxes
12
+ local Pad = _Pad.Pad
13
+ local padActive = _Pad.padActive
14
+ local styleAutomaticSize = _Pad.styleAutomaticSize
15
+ local withoutPad = _Pad.withoutPad
8
16
  local _gridProps = TS.import(script, script.Parent, "gridProps")
9
17
  local gridCornerKey = _gridProps.gridCornerKey
10
18
  local gridMaxCells = _gridProps.gridMaxCells
@@ -92,7 +100,9 @@ local function Grid(props)
92
100
  local children = _binding.children
93
101
  local id = _binding.id
94
102
  local ref = _binding.ref
95
- local _binding_1 = useGridStyles({
103
+ local _binding_1 = useTheme()
104
+ local theme = _binding_1.theme
105
+ local _binding_2 = useGridStyles({
96
106
  cellPadding = cellPadding,
97
107
  cellSize = cellSize,
98
108
  gap = gap,
@@ -105,25 +115,80 @@ local function Grid(props)
105
115
  horizontalAlignment = horizontalAlignment,
106
116
  verticalAlignment = verticalAlignment,
107
117
  })
108
- local baseGrid = _binding_1.baseGrid
109
- local baseLayout = _binding_1.baseLayout
110
- local _attributes = {}
111
- local _condition = id
112
- if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
113
- _condition = "Grid"
114
- end
115
- _attributes.key = _condition
116
- _attributes.hostRef = ref
117
- _attributes.base = baseGrid
118
- _attributes.className = className
119
- _attributes.sx = sx
120
- local _attributes_1 = {
118
+ local baseGrid = _binding_2.baseGrid
119
+ local baseLayout = _binding_2.baseLayout
120
+ local pad = resolveSx(theme, sx).padding
121
+ local _result = pad
122
+ if _result ~= nil then
123
+ _result = _result.PaddingLeft.Offset
124
+ end
125
+ local _condition = _result
126
+ if _condition == nil then
127
+ _condition = 0
128
+ end
129
+ local left = _condition
130
+ local _result_1 = pad
131
+ if _result_1 ~= nil then
132
+ _result_1 = _result_1.PaddingRight.Offset
133
+ end
134
+ local _condition_1 = _result_1
135
+ if _condition_1 == nil then
136
+ _condition_1 = 0
137
+ end
138
+ local right = _condition_1
139
+ local _result_2 = pad
140
+ if _result_2 ~= nil then
141
+ _result_2 = _result_2.PaddingTop.Offset
142
+ end
143
+ local _condition_2 = _result_2
144
+ if _condition_2 == nil then
145
+ _condition_2 = 0
146
+ end
147
+ local top = _condition_2
148
+ local _result_3 = pad
149
+ if _result_3 ~= nil then
150
+ _result_3 = _result_3.PaddingBottom.Offset
151
+ end
152
+ local _condition_3 = _result_3
153
+ if _condition_3 == nil then
154
+ _condition_3 = 0
155
+ end
156
+ local bottom = _condition_3
157
+ local inset = padActive(left, right, top, bottom)
158
+ local _result_4 = sx
159
+ if _result_4 ~= nil then
160
+ _result_4 = _result_4.AutomaticSize
161
+ end
162
+ local _condition_4 = _result_4
163
+ if _condition_4 == nil then
164
+ _condition_4 = styleAutomaticSize(baseGrid)
165
+ end
166
+ local auto = automaticAxes(_condition_4)
167
+ local _attributes = {
121
168
  key = "GridLayout",
122
169
  }
123
170
  for _k, _v in baseLayout do
124
- _attributes_1[_k] = _v
171
+ _attributes[_k] = _v
172
+ end
173
+ local body = (React.createElement(React.Fragment, nil, React.createElement("uigridlayout", _attributes), children))
174
+ local _attributes_1 = {}
175
+ local _condition_5 = id
176
+ if not (_condition_5 ~= 0 and _condition_5 == _condition_5 and _condition_5 ~= "" and _condition_5) then
177
+ _condition_5 = "Grid"
125
178
  end
126
- return React.createElement(SxHost, _attributes, React.createElement("uigridlayout", _attributes_1), children)
179
+ _attributes_1.key = _condition_5
180
+ _attributes_1.hostRef = ref
181
+ _attributes_1.base = baseGrid
182
+ _attributes_1.className = className
183
+ _attributes_1.sx = if inset then withoutPad(sx) else sx
184
+ return React.createElement(SxHost, _attributes_1, if inset then (React.createElement(Pad, {
185
+ left = left,
186
+ right = right,
187
+ top = top,
188
+ bottom = bottom,
189
+ autoX = auto.x,
190
+ autoY = auto.y,
191
+ }, body)) else body)
127
192
  end
128
193
  local default = Grid
129
194
  return {
@@ -0,0 +1,24 @@
1
+ import React from "@rbxts/react";
2
+ /** Padding on the host offsets scale-sized children without shrinking them. */
3
+ export declare function withoutPad(sx: object | undefined): {
4
+ [key: string]: unknown;
5
+ } | undefined;
6
+ export declare function styleAutomaticSize(style: object): Enum.AutomaticSize | undefined;
7
+ export declare function automaticAxes(value: Enum.AutomaticSize | undefined): {
8
+ x: boolean;
9
+ y: boolean;
10
+ };
11
+ export declare function padActive(left: number, right: number, top: number, bottom: number): boolean;
12
+ /**
13
+ * Fixed axes use a shrunk size so scale children stop at the padding.
14
+ * Automatic axes keep trailing padding on the content instead.
15
+ */
16
+ export declare function Pad(props: {
17
+ left: number;
18
+ right: number;
19
+ top: number;
20
+ bottom: number;
21
+ autoX: boolean;
22
+ autoY: boolean;
23
+ children?: React.ReactNode;
24
+ }): JSX.Element;
@@ -0,0 +1,88 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
+ local function isPadKey(key)
5
+ return key == "p" or key == "px" or key == "py" or key == "pt" or key == "pr" or key == "pb" or key == "pl" or key == "padding"
6
+ end
7
+ --* Padding on the host offsets scale-sized children without shrinking them.
8
+ local function withoutPad(sx)
9
+ if sx == nil then
10
+ return nil
11
+ end
12
+ local rest = {}
13
+ local kept = false
14
+ for key, value in pairs(sx) do
15
+ local name = tostring(key)
16
+ if isPadKey(name) then
17
+ continue
18
+ end
19
+ rest[name] = value
20
+ kept = true
21
+ end
22
+ return if kept then rest else nil
23
+ end
24
+ local function styleAutomaticSize(style)
25
+ return style.AutomaticSize
26
+ end
27
+ local function automaticAxes(value)
28
+ if value == Enum.AutomaticSize.X then
29
+ return {
30
+ x = true,
31
+ y = false,
32
+ }
33
+ end
34
+ if value == Enum.AutomaticSize.Y then
35
+ return {
36
+ x = false,
37
+ y = true,
38
+ }
39
+ end
40
+ if value == Enum.AutomaticSize.XY then
41
+ return {
42
+ x = true,
43
+ y = true,
44
+ }
45
+ end
46
+ return {
47
+ x = false,
48
+ y = false,
49
+ }
50
+ end
51
+ local function padActive(left, right, top, bottom)
52
+ return left + right + top + bottom > 0
53
+ end
54
+ --[[
55
+ *
56
+ * Fixed axes use a shrunk size so scale children stop at the padding.
57
+ * Automatic axes keep trailing padding on the content instead.
58
+
59
+ ]]
60
+ local function Pad(props)
61
+ local _binding = props
62
+ local left = _binding.left
63
+ local right = _binding.right
64
+ local top = _binding.top
65
+ local bottom = _binding.bottom
66
+ local autoX = _binding.autoX
67
+ local autoY = _binding.autoY
68
+ local children = _binding.children
69
+ local auto = if autoX and autoY then Enum.AutomaticSize.XY elseif autoY then Enum.AutomaticSize.Y elseif autoX then Enum.AutomaticSize.X else Enum.AutomaticSize.None
70
+ return React.createElement("frame", {
71
+ key = "Pad",
72
+ Position = UDim2.new(0, left, 0, top),
73
+ Size = UDim2.new(if autoX then 0 else 1, if autoX then 0 else -(left + right), if autoY then 0 else 1, if autoY then 0 else -(top + bottom)),
74
+ AutomaticSize = auto,
75
+ BackgroundTransparency = 1,
76
+ BorderSizePixel = 0,
77
+ }, if autoX or autoY then (React.createElement("uipadding", {
78
+ PaddingRight = UDim.new(0, if autoX then right else 0),
79
+ PaddingBottom = UDim.new(0, if autoY then bottom else 0),
80
+ })) else nil, children)
81
+ end
82
+ return {
83
+ withoutPad = withoutPad,
84
+ styleAutomaticSize = styleAutomaticSize,
85
+ automaticAxes = automaticAxes,
86
+ padActive = padActive,
87
+ Pad = Pad,
88
+ }