@rbxts/react-clean-ui 1.1.0 → 1.2.4

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 (110) hide show
  1. package/out/Components/Chart/BarChart.d.ts +1 -0
  2. package/out/Components/Chart/BarChart.luau +149 -112
  3. package/out/Components/Chart/Pie.d.ts +1 -0
  4. package/out/Components/Chart/Pie.luau +21 -6
  5. package/out/Components/Decorator/BoxShadow.d.ts +1 -0
  6. package/out/Components/Decorator/BoxShadow.luau +12 -5
  7. package/out/Components/Decorator/Corners.d.ts +1 -0
  8. package/out/Components/Decorator/Corners.luau +8 -3
  9. package/out/Components/Decorator/Gradient.d.ts +8 -0
  10. package/out/Components/Decorator/Gradient.luau +23 -0
  11. package/out/Components/Decorator/Padding.d.ts +3 -1
  12. package/out/Components/Decorator/Padding.luau +11 -6
  13. package/out/Components/Decorator/index.d.ts +1 -0
  14. package/out/Components/Decorator/init.luau +3 -0
  15. package/out/Components/Input/Button.d.ts +1 -0
  16. package/out/Components/Input/Button.luau +49 -34
  17. package/out/Components/Input/Checkbox.d.ts +1 -0
  18. package/out/Components/Input/Checkbox.luau +28 -18
  19. package/out/Components/Input/HoverButton.d.ts +1 -0
  20. package/out/Components/Input/HoverButton.luau +44 -42
  21. package/out/Components/Input/Increment.d.ts +1 -0
  22. package/out/Components/Input/Increment.luau +10 -3
  23. package/out/Components/Input/Input.d.ts +3 -1
  24. package/out/Components/Input/Input.luau +89 -68
  25. package/out/Components/Input/Select.d.ts +11 -1
  26. package/out/Components/Input/Select.luau +315 -39
  27. package/out/Components/Input/Slider.luau +44 -53
  28. package/out/Components/Input/Switch.d.ts +9 -0
  29. package/out/Components/Input/Switch.luau +145 -0
  30. package/out/Components/Input/index.d.ts +1 -0
  31. package/out/Components/Input/init.luau +3 -0
  32. package/out/Components/Interaction/Modal.d.ts +14 -0
  33. package/out/Components/Interaction/Modal.luau +262 -0
  34. package/out/Components/Interaction/Toast.d.ts +2 -1
  35. package/out/Components/Interaction/Toast.luau +53 -28
  36. package/out/Components/Interaction/Tooltip.luau +36 -25
  37. package/out/Components/Interaction/index.d.ts +1 -0
  38. package/out/Components/Interaction/init.luau +3 -0
  39. package/out/Components/Layout/Accordion.d.ts +1 -0
  40. package/out/Components/Layout/Accordion.luau +51 -55
  41. package/out/Components/Layout/Column.d.ts +1 -0
  42. package/out/Components/Layout/Column.luau +11 -6
  43. package/out/Components/Layout/Container.d.ts +3 -0
  44. package/out/Components/Layout/Container.luau +26 -17
  45. package/out/Components/Layout/Draggable.luau +25 -3
  46. package/out/Components/Layout/Fieldset.d.ts +1 -0
  47. package/out/Components/Layout/Fieldset.luau +14 -42
  48. package/out/Components/Layout/FlexItem.luau +7 -0
  49. package/out/Components/Layout/Grid.d.ts +10 -0
  50. package/out/Components/Layout/Grid.luau +172 -0
  51. package/out/Components/Layout/Group.d.ts +1 -0
  52. package/out/Components/Layout/Group.luau +48 -60
  53. package/out/Components/Layout/HStack.d.ts +4 -0
  54. package/out/Components/Layout/HStack.luau +17 -10
  55. package/out/Components/Layout/Pagination.d.ts +32 -0
  56. package/out/Components/Layout/Pagination.luau +400 -0
  57. package/out/Components/Layout/Row.d.ts +1 -0
  58. package/out/Components/Layout/Row.luau +20 -48
  59. package/out/Components/Layout/Scroller.d.ts +1 -0
  60. package/out/Components/Layout/Scroller.luau +26 -34
  61. package/out/Components/Layout/Table.d.ts +31 -0
  62. package/out/Components/Layout/Table.luau +342 -0
  63. package/out/Components/Layout/Tabs.d.ts +20 -10
  64. package/out/Components/Layout/Tabs.luau +113 -119
  65. package/out/Components/Layout/VStack.d.ts +3 -0
  66. package/out/Components/Layout/VStack.luau +17 -10
  67. package/out/Components/Layout/index.d.ts +3 -0
  68. package/out/Components/Layout/init.luau +9 -0
  69. package/out/Components/Navigation/Menu.d.ts +1 -0
  70. package/out/Components/Navigation/Menu.luau +12 -3
  71. package/out/Components/Surface/Box.d.ts +3 -1
  72. package/out/Components/Surface/Box.luau +15 -4
  73. package/out/Components/Surface/Card.d.ts +1 -0
  74. package/out/Components/Surface/Card.luau +56 -154
  75. package/out/Components/Surface/Icon.d.ts +1 -0
  76. package/out/Components/Surface/Icon.luau +25 -16
  77. package/out/Components/Surface/ProgressBar.d.ts +14 -0
  78. package/out/Components/Surface/ProgressBar.luau +230 -0
  79. package/out/Components/Surface/index.d.ts +1 -0
  80. package/out/Components/Surface/init.luau +3 -0
  81. package/out/Components/Typography/Text.d.ts +1 -0
  82. package/out/Components/Typography/Text.luau +57 -53
  83. package/out/Contexts/index.d.ts +1 -0
  84. package/out/Contexts/init.luau +3 -0
  85. package/out/Contexts/modal.context.d.ts +15 -0
  86. package/out/Contexts/modal.context.luau +23 -0
  87. package/out/Contexts/toast.context.d.ts +1 -0
  88. package/out/Helpers/color.helper.luau +28 -0
  89. package/out/Helpers/css.helper.d.ts +4 -1
  90. package/out/Helpers/css.helper.luau +76 -6
  91. package/out/Helpers/gui.helper.luau +0 -3
  92. package/out/Helpers/size.helper.luau +0 -2
  93. package/out/Helpers/spacing.helper.luau +0 -3
  94. package/out/Helpers/typography.helper.luau +0 -2
  95. package/out/Interfaces/css.types.d.ts +7 -0
  96. package/out/Interfaces/css.types.luau +0 -20
  97. package/out/Providers/app.provider.luau +2 -1
  98. package/out/Providers/index.d.ts +1 -0
  99. package/out/Providers/init.luau +3 -0
  100. package/out/Providers/modal.provider.d.ts +6 -0
  101. package/out/Providers/modal.provider.luau +86 -0
  102. package/out/Providers/overlay.provider.luau +1 -0
  103. package/out/Providers/registry.provider.luau +0 -2
  104. package/out/Theme/theme.style.d.ts +2 -1
  105. package/out/Theme/theme.template.d.ts +126 -1
  106. package/out/Theme/themes/dark.theme.luau +225 -0
  107. package/out/Theme/themes/default.theme.luau +210 -0
  108. package/out/Theme/themes/sandstone.theme.luau +173 -0
  109. package/out/Theme/themes/wooden.theme.luau +195 -0
  110. package/package.json +1 -1
@@ -0,0 +1,400 @@
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 CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
5
+ local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
6
+ local ColorHelper = _Helpers.ColorHelper
7
+ local CssHelper = _Helpers.CssHelper
8
+ local SpacingHelper = _Helpers.SpacingHelper
9
+ local TypographyHelper = _Helpers.TypographyHelper
10
+ local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
11
+ local BoxShadow = _Decorator.BoxShadow
12
+ local Corners = _Decorator.Corners
13
+ local Padding = _Decorator.Padding
14
+ local _HoverButton = TS.import(script, script.Parent.Parent, "Input", "HoverButton")
15
+ local HoverButton = _HoverButton.HoverButton
16
+ local HoverButtonContext = _HoverButton.HoverButtonContext
17
+ local Icon = TS.import(script, script.Parent.Parent, "Surface", "Icon").Icon
18
+ local Text = TS.import(script, script.Parent.Parent, "Typography").Text
19
+ local Container = TS.import(script, script.Parent, "Container").Container
20
+ local HStack = TS.import(script, script.Parent, "HStack").HStack
21
+ local function computePaginationItems(page, totalPages, siblingCount)
22
+ local pageCount = math.max(0, math.floor(totalPages))
23
+ if pageCount == 0 then
24
+ return {}
25
+ end
26
+ local currentPage = math.clamp(math.floor(page), 1, pageCount)
27
+ local siblings = math.max(0, math.floor(siblingCount))
28
+ local visiblePageCount = siblings * 2 + 5
29
+ if pageCount <= visiblePageCount then
30
+ local allPages = {}
31
+ do
32
+ local value = 1
33
+ local _shouldIncrement = false
34
+ while true do
35
+ if _shouldIncrement then
36
+ value += 1
37
+ else
38
+ _shouldIncrement = true
39
+ end
40
+ if not (value <= pageCount) then
41
+ break
42
+ end
43
+ local _value = value
44
+ table.insert(allPages, _value)
45
+ end
46
+ end
47
+ return allPages
48
+ end
49
+ local leftSiblingIndex = math.max(currentPage - siblings, 1)
50
+ local rightSiblingIndex = math.min(currentPage + siblings, pageCount)
51
+ local showLeftEllipsis = leftSiblingIndex > 2
52
+ local showRightEllipsis = rightSiblingIndex < pageCount - 1
53
+ if not showLeftEllipsis and showRightEllipsis then
54
+ local leftItemCount = siblings * 2 + 3
55
+ local items = {}
56
+ do
57
+ local value = 1
58
+ local _shouldIncrement = false
59
+ while true do
60
+ if _shouldIncrement then
61
+ value += 1
62
+ else
63
+ _shouldIncrement = true
64
+ end
65
+ if not (value <= leftItemCount) then
66
+ break
67
+ end
68
+ local _value = value
69
+ table.insert(items, _value)
70
+ end
71
+ end
72
+ table.insert(items, "ellipsis")
73
+ table.insert(items, pageCount)
74
+ return items
75
+ end
76
+ if showLeftEllipsis and not showRightEllipsis then
77
+ local rightItemCount = siblings * 2 + 3
78
+ local items = { 1, "ellipsis" }
79
+ do
80
+ local value = pageCount - rightItemCount + 1
81
+ local _shouldIncrement = false
82
+ while true do
83
+ if _shouldIncrement then
84
+ value += 1
85
+ else
86
+ _shouldIncrement = true
87
+ end
88
+ if not (value <= pageCount) then
89
+ break
90
+ end
91
+ local _value = value
92
+ table.insert(items, _value)
93
+ end
94
+ end
95
+ return items
96
+ end
97
+ local items = { 1, "ellipsis" }
98
+ do
99
+ local value = leftSiblingIndex
100
+ local _shouldIncrement = false
101
+ while true do
102
+ if _shouldIncrement then
103
+ value += 1
104
+ else
105
+ _shouldIncrement = true
106
+ end
107
+ if not (value <= rightSiblingIndex) then
108
+ break
109
+ end
110
+ local _value = value
111
+ table.insert(items, _value)
112
+ end
113
+ end
114
+ table.insert(items, "ellipsis")
115
+ table.insert(items, pageCount)
116
+ return items
117
+ end
118
+ local PaginationContext = React.createContext(nil)
119
+ local function usePagination()
120
+ local context = React.useContext(PaginationContext)
121
+ if context == nil then
122
+ error("Pagination subparts must be rendered inside Pagination")
123
+ end
124
+ return context
125
+ end
126
+ local function PaginationItemVisual(props)
127
+ local theme = React.useContext(CleanThemeContext)
128
+ local hover = React.useContext(HoverButtonContext)
129
+ local _result
130
+ if props.disabled then
131
+ _result = "disabled"
132
+ else
133
+ local _result_1 = hover
134
+ if _result_1 ~= nil then
135
+ _result_1 = _result_1.isSelected
136
+ end
137
+ local _result_2
138
+ if _result_1 then
139
+ _result_2 = "focus"
140
+ else
141
+ local _result_3 = hover
142
+ if _result_3 ~= nil then
143
+ _result_3 = _result_3.hover
144
+ end
145
+ _result_2 = if _result_3 then "hover" else "default"
146
+ end
147
+ _result = _result_2
148
+ end
149
+ local colors = ColorHelper:getIntentColors(theme, "primary", _result, theme.components.pagination.item.intents)
150
+ local _exp = React.createElement(Corners, {
151
+ radius = theme.components.pagination.item.cornerRadius,
152
+ })
153
+ local _exp_1 = React.createElement(Padding, {
154
+ resolvedPadding = SpacingHelper:GetResolvedPadding(theme, props, theme.components.pagination.item.spacing, theme.components.pagination.item.padding),
155
+ })
156
+ local _attributes = {}
157
+ local _condition = colors.boxShadow
158
+ if _condition == nil then
159
+ _condition = theme.components.pagination.item.boxShadow
160
+ end
161
+ _attributes.value = _condition
162
+ return React.createElement(React.Fragment, nil, _exp, _exp_1, React.createElement(BoxShadow, _attributes), if props.text ~= nil then (React.createElement(Text, {
163
+ name = "PaginationItemText",
164
+ text = props.text,
165
+ TextColor3 = colors.textColor,
166
+ typography = TypographyHelper:getTypography(theme, nil, colors.typography or theme.components.pagination.item.typography),
167
+ })) else (React.createElement(Container, {
168
+ name = "PaginationIconContainer",
169
+ }, React.createElement(Icon, {
170
+ name = "PaginationIcon",
171
+ icon = props.icon,
172
+ color = colors.textColor,
173
+ }))))
174
+ end
175
+ local function getButtonState(theme)
176
+ local itemTheme = theme.components.pagination.item
177
+ local defaultColors = ColorHelper:getIntentColors(theme, "primary", "default", itemTheme.intents)
178
+ local hoverColors = ColorHelper:getIntentColors(theme, "primary", "hover", itemTheme.intents)
179
+ local focusColors = ColorHelper:getIntentColors(theme, "primary", "focus", itemTheme.intents)
180
+ local disabledColors = ColorHelper:getIntentColors(theme, "primary", "disabled", itemTheme.intents)
181
+ return {
182
+ defaultColors = defaultColors,
183
+ hoverColors = hoverColors,
184
+ focusColors = focusColors,
185
+ disabledColors = disabledColors,
186
+ defaultImage = CssHelper:resolveBackgroundImage(defaultColors.backgroundImage),
187
+ hoverImage = CssHelper:resolveBackgroundImage(hoverColors.backgroundImage),
188
+ focusImage = CssHelper:resolveBackgroundImage(focusColors.backgroundImage),
189
+ }
190
+ end
191
+ local function PaginationButton(props)
192
+ local theme = React.useContext(CleanThemeContext)
193
+ local state = getButtonState(theme)
194
+ return React.createElement(HoverButton, {
195
+ name = props.name,
196
+ isSelected = props.selected,
197
+ default = {
198
+ Active = not props.disabled,
199
+ Selectable = not props.disabled,
200
+ LayoutOrder = props.layoutOrder,
201
+ Size = UDim2.fromScale(0, 0),
202
+ AutomaticSize = Enum.AutomaticSize.XY,
203
+ BackgroundColor3 = if props.disabled then state.disabledColors.backgroundColor else state.defaultColors.backgroundColor,
204
+ BackgroundTransparency = if props.disabled then state.disabledColors.backgroundTransparency else state.defaultColors.backgroundTransparency,
205
+ BorderSizePixel = theme.components.pagination.item.borderThickness,
206
+ BorderColor3 = if props.disabled then state.disabledColors.borderColor else state.defaultColors.borderColor,
207
+ AutoButtonColor = false,
208
+ Image = state.defaultImage.Image,
209
+ ImageColor3 = state.defaultImage.ImageColor3,
210
+ ImageTransparency = if props.disabled then 0.7 else state.defaultImage.ImageTransparency,
211
+ ScaleType = state.defaultImage.ScaleType,
212
+ SliceCenter = state.defaultImage.SliceCenter,
213
+ SliceScale = state.defaultImage.SliceScale,
214
+ TileSize = state.defaultImage.TileSize,
215
+ Event = {
216
+ Activated = function()
217
+ if not props.disabled then
218
+ props.onActivate()
219
+ end
220
+ end,
221
+ },
222
+ },
223
+ hover = if props.disabled then nil else {
224
+ BackgroundColor3 = state.hoverColors.backgroundColor,
225
+ BackgroundTransparency = state.hoverColors.backgroundTransparency,
226
+ BorderColor3 = state.hoverColors.borderColor,
227
+ Image = state.hoverImage.Image,
228
+ ImageColor3 = state.hoverImage.ImageColor3,
229
+ ImageTransparency = state.hoverImage.ImageTransparency,
230
+ ScaleType = state.hoverImage.ScaleType,
231
+ SliceCenter = state.hoverImage.SliceCenter,
232
+ SliceScale = state.hoverImage.SliceScale,
233
+ TileSize = state.hoverImage.TileSize,
234
+ },
235
+ focus = {
236
+ BackgroundColor3 = state.focusColors.backgroundColor,
237
+ BackgroundTransparency = state.focusColors.backgroundTransparency,
238
+ BorderColor3 = state.focusColors.borderColor,
239
+ Image = state.focusImage.Image,
240
+ ImageColor3 = state.focusImage.ImageColor3,
241
+ ImageTransparency = state.focusImage.ImageTransparency,
242
+ ScaleType = state.focusImage.ScaleType,
243
+ SliceCenter = state.focusImage.SliceCenter,
244
+ SliceScale = state.focusImage.SliceScale,
245
+ TileSize = state.focusImage.TileSize,
246
+ },
247
+ }, props.children)
248
+ end
249
+ local function PaginationItem(props)
250
+ local _binding = usePagination()
251
+ local page = _binding.page
252
+ local setPage = _binding.setPage
253
+ local _attributes = table.clone(props)
254
+ setmetatable(_attributes, nil)
255
+ _attributes.text = `{props.value}`
256
+ return React.createElement(PaginationButton, {
257
+ name = `PaginationItem-{props.value}`,
258
+ selected = page == props.value,
259
+ layoutOrder = props.layoutOrder,
260
+ onActivate = function()
261
+ return setPage(props.value)
262
+ end,
263
+ }, React.createElement(PaginationItemVisual, _attributes))
264
+ end
265
+ local function PaginationPrev()
266
+ local _binding = usePagination()
267
+ local page = _binding.page
268
+ local setPage = _binding.setPage
269
+ local canGoPrev = _binding.canGoPrev
270
+ return React.createElement(PaginationButton, {
271
+ name = "PaginationPrev",
272
+ disabled = not canGoPrev,
273
+ onActivate = function()
274
+ return setPage(page - 1)
275
+ end,
276
+ }, React.createElement(PaginationItemVisual, {
277
+ icon = "chevron-left",
278
+ disabled = not canGoPrev,
279
+ }))
280
+ end
281
+ local function PaginationNext()
282
+ local _binding = usePagination()
283
+ local page = _binding.page
284
+ local setPage = _binding.setPage
285
+ local canGoNext = _binding.canGoNext
286
+ return React.createElement(PaginationButton, {
287
+ name = "PaginationNext",
288
+ disabled = not canGoNext,
289
+ onActivate = function()
290
+ return setPage(page + 1)
291
+ end,
292
+ }, React.createElement(PaginationItemVisual, {
293
+ icon = "chevron-right",
294
+ disabled = not canGoNext,
295
+ }))
296
+ end
297
+ local function PaginationEllipsis(props)
298
+ local theme = React.useContext(CleanThemeContext)
299
+ return React.createElement(Text, {
300
+ name = "PaginationEllipsis",
301
+ text = "…",
302
+ LayoutOrder = props.layoutOrder,
303
+ typography = TypographyHelper:getTypography(theme, nil, theme.components.pagination.item.typography),
304
+ })
305
+ end
306
+ local function PaginationList(props)
307
+ local _binding = usePagination()
308
+ local items = _binding.items
309
+ local _condition = props.children
310
+ if _condition == nil then
311
+ -- ▼ ReadonlyArray.map ▼
312
+ local _newValue = table.create(#items)
313
+ local _callback = function(item, index)
314
+ return if item == "ellipsis" then (React.createElement(PaginationEllipsis, {
315
+ key = `ellipsis-{index}`,
316
+ layoutOrder = index,
317
+ })) else (React.createElement(PaginationItem, {
318
+ key = item,
319
+ value = item,
320
+ layoutOrder = index,
321
+ }))
322
+ end
323
+ for _k, _v in items do
324
+ _newValue[_k] = _callback(_v, _k - 1, items)
325
+ end
326
+ -- ▲ ReadonlyArray.map ▲
327
+ _condition = _newValue
328
+ end
329
+ return React.createElement(Container, {
330
+ name = "PaginationList",
331
+ }, React.createElement(HStack, {
332
+ Wraps = false,
333
+ valign = "Center",
334
+ }, _condition))
335
+ end
336
+ local function PaginationDefaultLayout()
337
+ local theme = React.useContext(CleanThemeContext)
338
+ local paginationTheme = theme.components.pagination
339
+ return React.createElement(HStack, {
340
+ Wraps = false,
341
+ valign = "Center",
342
+ spacing = "None",
343
+ Padding = UDim.new(0, SpacingHelper:GetPadding(theme, nil, paginationTheme.spacing)),
344
+ }, React.createElement(PaginationPrev), React.createElement(PaginationList), React.createElement(PaginationNext))
345
+ end
346
+ local Pagination = React.forwardRef(function(props, _ref)
347
+ local theme = React.useContext(CleanThemeContext)
348
+ local pageCount = math.max(0, math.floor(props.totalPages))
349
+ local currentPage = if pageCount == 0 then 0 else math.clamp(math.floor(props.page), 1, pageCount)
350
+ local _condition = props.siblingCount
351
+ if _condition == nil then
352
+ _condition = 1
353
+ end
354
+ local siblingCount = math.max(0, math.floor(_condition))
355
+ local items = React.useMemo(function()
356
+ return computePaginationItems(currentPage, pageCount, siblingCount)
357
+ end, { currentPage, pageCount, siblingCount })
358
+ local setPage = function(page)
359
+ if pageCount == 0 then
360
+ return nil
361
+ end
362
+ props.onPageChange(math.clamp(math.floor(page), 1, pageCount))
363
+ end
364
+ local contextValue = React.useMemo(function()
365
+ return {
366
+ page = currentPage,
367
+ totalPages = pageCount,
368
+ items = items,
369
+ setPage = setPage,
370
+ canGoPrev = currentPage > 1,
371
+ canGoNext = currentPage < pageCount,
372
+ }
373
+ end, { currentPage, pageCount, items, props.onPageChange })
374
+ local paginationTheme = theme.components.pagination
375
+ return React.createElement(PaginationContext.Provider, {
376
+ value = contextValue,
377
+ }, React.createElement(Container, {
378
+ name = "Pagination",
379
+ BackgroundColor3 = paginationTheme.backgroundColor,
380
+ BackgroundTransparency = paginationTheme.backgroundTransparency,
381
+ BorderSizePixel = 0,
382
+ }, React.createElement("uistroke", {
383
+ key = "PaginationBorder",
384
+ Thickness = paginationTheme.borderThickness,
385
+ BorderStrokePosition = Enum.BorderStrokePosition.Inner,
386
+ Color = paginationTheme.borderColor,
387
+ }), React.createElement(Corners, {
388
+ radius = paginationTheme.cornerRadius,
389
+ }), React.createElement(Padding, {
390
+ resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, paginationTheme.spacing, paginationTheme.padding),
391
+ }), if props.children ~= nil then props.children else React.createElement(PaginationDefaultLayout)))
392
+ end)
393
+ Pagination.Prev = PaginationPrev
394
+ Pagination.Next = PaginationNext
395
+ Pagination.Item = PaginationItem
396
+ Pagination.Ellipsis = PaginationEllipsis
397
+ Pagination.List = PaginationList
398
+ return {
399
+ Pagination = Pagination,
400
+ }
@@ -1,6 +1,7 @@
1
1
  import React from "@rbxts/react";
2
2
  import { BreakPointElementProps, SpacedElementProps } from "../../Interfaces/";
3
3
  interface RowProps extends SpacedElementProps, BreakPointElementProps {
4
+ name?: string;
4
5
  }
5
6
  export declare const Row: React.ForwardRefExoticComponent<RowProps & React.RefAttributes<Frame>>;
6
7
  export {};
@@ -13,55 +13,32 @@ local Row = React.forwardRef(function(props, ref)
13
13
  local width, setWidth = React.useState(0)
14
14
  local breakpoints = props.breakpoints or theme.breakpoints
15
15
  local padding = UDim.new(0, SpacingHelper:GetPadding(theme, props.spacing))
16
- local rowRef = React.useRef()
17
- local setRowRef = function(instance)
18
- rowRef.current = instance
19
- local _ref = ref
20
- if type(_ref) == "function" then
21
- ref(instance)
22
- else
23
- local _condition = ref ~= nil
24
- if _condition then
25
- local _ref_1 = ref
26
- _condition = type(_ref_1) == "table"
27
- end
28
- if _condition then
29
- ref.current = instance
30
- end
31
- end
16
+ local _attributes = {}
17
+ local _condition = props.name
18
+ if _condition == nil then
19
+ _condition = "Row"
32
20
  end
33
- React.useEffect(function()
34
- local frame = rowRef.current
35
- if not frame then
36
- return nil
37
- end
38
- -- Some renderers (e.g. the browser-based Loom scene preview) don't
39
- -- back this ref with an instance that supports property-changed
40
- -- signals, so guard the subscription instead of throwing and
41
- -- losing breakpoint width tracking.
42
- local conn
43
- pcall(function()
44
- conn = frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
45
- local nextWidth = frame.AbsoluteSize.X
46
- setWidth(function(currentWidth)
47
- return if currentWidth == nextWidth then currentWidth else nextWidth
48
- end)
21
+ _attributes.key = _condition
22
+ _attributes.ref = ref
23
+ _attributes.Size = UDim2.fromScale(1, 1)
24
+ _attributes.AutomaticSize = Enum.AutomaticSize.Y
25
+ _attributes.BackgroundTransparency = 1
26
+ _attributes.Change = {
27
+ AbsoluteSize = function(instance)
28
+ local nextWidth = instance.AbsoluteSize.X
29
+ setWidth(function(currentWidth)
30
+ return if currentWidth == nextWidth then currentWidth else nextWidth
49
31
  end)
50
- end)
51
- return function()
52
- local _result = conn
53
- if _result ~= nil then
54
- _result:Disconnect()
55
- end
56
- end
57
- end, {})
32
+ end,
33
+ }
58
34
  local _exp = React.createElement("uilistlayout", {
35
+ key = "RowLayout",
59
36
  FillDirection = Enum.FillDirection.Horizontal,
60
37
  SortOrder = Enum.SortOrder.LayoutOrder,
61
38
  Padding = padding,
62
39
  Wraps = true,
63
40
  })
64
- local _attributes = {}
41
+ local _attributes_1 = {}
65
42
  local _object = {
66
43
  width = width,
67
44
  }
@@ -83,13 +60,8 @@ local Row = React.forwardRef(function(props, ref)
83
60
  _object[_left] = #_newValue
84
61
  _object.padding = padding
85
62
  _object.breakpoint = BreakpointHelper:getBreakpoint(width, breakpoints)
86
- _attributes.value = _object
87
- return React.createElement("frame", {
88
- ref = setRowRef,
89
- Size = UDim2.fromScale(1, 1),
90
- AutomaticSize = Enum.AutomaticSize.Y,
91
- BackgroundTransparency = 1,
92
- }, _exp, React.createElement(RowContext.Provider, _attributes, props.children))
63
+ _attributes_1.value = _object
64
+ return React.createElement("frame", _attributes, _exp, React.createElement(RowContext.Provider, _attributes_1, props.children))
93
65
  end)
94
66
  return {
95
67
  Row = Row,
@@ -3,6 +3,7 @@ import { PositionElementProps, SizeElementProps, SpacedElementProps } from "../.
3
3
  interface ScrollerProps extends SizeElementProps, SpacedElementProps, PositionElementProps {
4
4
  children?: React.ReactNode;
5
5
  AutomaticSizeParent?: boolean;
6
+ name?: string;
6
7
  }
7
8
  export declare function Scroller(props: ScrollerProps): React.JSX.Element;
8
9
  export {};
@@ -19,46 +19,38 @@ local function Scroller(props)
19
19
  setIsScrolling(frame.AbsoluteCanvasSize.Y > frame.AbsoluteWindowSize.Y)
20
20
  end
21
21
  updateScrolling()
22
- -- Some renderers (e.g. the browser-based Loom scene preview) don't back
23
- -- this ref with an instance that supports property-changed signals, so
24
- -- guard the subscription instead of throwing and losing overflow tracking.
25
- local canvasConn
26
- local windowConn
27
- pcall(function()
28
- canvasConn = frame:GetPropertyChangedSignal("AbsoluteCanvasSize"):Connect(updateScrolling)
29
- end)
30
- pcall(function()
31
- windowConn = frame:GetPropertyChangedSignal("AbsoluteWindowSize"):Connect(updateScrolling)
32
- end)
22
+ local canvasConn = frame:GetPropertyChangedSignal("AbsoluteCanvasSize"):Connect(updateScrolling)
23
+ local windowConn = frame:GetPropertyChangedSignal("AbsoluteWindowSize"):Connect(updateScrolling)
33
24
  return function()
34
- local _result = canvasConn
35
- if _result ~= nil then
36
- _result:Disconnect()
37
- end
38
- local _result_1 = windowConn
39
- if _result_1 ~= nil then
40
- _result_1:Disconnect()
41
- end
25
+ canvasConn:Disconnect()
26
+ windowConn:Disconnect()
42
27
  end
43
28
  end, {})
44
29
  local spacing = SpacingHelper:GetPadding(theme, props.spacing)
45
- return React.createElement("scrollingframe", {
46
- ref = ref,
47
- AnchorPoint = SizeHelper:GetAnchor(props),
48
- AutomaticSize = SizeHelper:GetAutoSize(props, Enum.AutomaticSize.None),
49
- Position = SizeHelper:GetPosition(props),
50
- Size = SizeHelper:GetSize(props, UDim2.fromScale(1, 1)),
51
- BorderSizePixel = 0,
52
- ScrollingDirection = Enum.ScrollingDirection.Y,
53
- ScrollBarImageColor3 = theme.components.scroller.barColor,
54
- CanvasSize = UDim2.fromScale(1, 0),
55
- BackgroundTransparency = 1,
56
- ScrollBarThickness = thickness,
57
- VerticalScrollBarInset = Enum.ScrollBarInset.ScrollBar,
58
- AutomaticCanvasSize = Enum.AutomaticSize.Y,
59
- }, props.AutomaticSizeParent and React.createElement("uilistlayout", {
30
+ local _attributes = {}
31
+ local _condition = props.name
32
+ if _condition == nil then
33
+ _condition = "Scroller"
34
+ end
35
+ _attributes.key = _condition
36
+ _attributes.ref = ref
37
+ _attributes.AnchorPoint = SizeHelper:GetAnchor(props)
38
+ _attributes.AutomaticSize = SizeHelper:GetAutoSize(props, Enum.AutomaticSize.None)
39
+ _attributes.Position = SizeHelper:GetPosition(props)
40
+ _attributes.Size = SizeHelper:GetSize(props, UDim2.fromScale(1, 1))
41
+ _attributes.BorderSizePixel = 0
42
+ _attributes.ScrollingDirection = Enum.ScrollingDirection.Y
43
+ _attributes.ScrollBarImageColor3 = theme.components.scroller.barColor
44
+ _attributes.CanvasSize = UDim2.fromScale(1, 0)
45
+ _attributes.BackgroundTransparency = 1
46
+ _attributes.ScrollBarThickness = thickness
47
+ _attributes.VerticalScrollBarInset = Enum.ScrollBarInset.ScrollBar
48
+ _attributes.AutomaticCanvasSize = Enum.AutomaticSize.Y
49
+ return React.createElement("scrollingframe", _attributes, props.AutomaticSizeParent and React.createElement("uilistlayout", {
50
+ key = "AutomaticSizeLayout",
60
51
  FillDirection = Enum.FillDirection.Horizontal,
61
52
  }), React.createElement("frame", {
53
+ key = "ScrollerContent",
62
54
  Size = UDim2.new(1, if isScrolling then -thickness - spacing else 0, 0, 0),
63
55
  AutomaticSize = Enum.AutomaticSize.Y,
64
56
  BackgroundTransparency = 1,
@@ -0,0 +1,31 @@
1
+ import React from "@rbxts/react";
2
+ import { PaddingProps, ScalableElementProps, SizeElementProps } from "../../Interfaces";
3
+ export interface TableProps extends ScalableElementProps, SizeElementProps {
4
+ children?: React.ReactNode;
5
+ name?: string;
6
+ }
7
+ export interface TableSectionProps {
8
+ children?: React.ReactNode;
9
+ }
10
+ export interface TableRowProps {
11
+ children?: React.ReactNode;
12
+ }
13
+ export interface TableCellProps extends PaddingProps {
14
+ children?: React.ReactNode | string;
15
+ text?: string;
16
+ align?: Enum.HorizontalAlignment | "Left" | "Center" | "Right";
17
+ }
18
+ declare function TableHeader(props: TableSectionProps): React.JSX.Element;
19
+ declare function TableBody(props: TableSectionProps): React.JSX.Element;
20
+ declare function TableRow(props: TableRowProps): React.JSX.Element;
21
+ declare function TableHead(props: TableCellProps): React.JSX.Element;
22
+ declare function TableCell(props: TableCellProps): React.JSX.Element;
23
+ type TableComponent = React.ForwardRefExoticComponent<TableProps & React.RefAttributes<ImageLabel>> & {
24
+ Header: typeof TableHeader;
25
+ Body: typeof TableBody;
26
+ Row: typeof TableRow;
27
+ Head: typeof TableHead;
28
+ Cell: typeof TableCell;
29
+ };
30
+ declare const Table: TableComponent;
31
+ export { Table };