@rbxts/react-clean-ui 1.1.0 → 1.2.2

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 (89) 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 -5
  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/Padding.d.ts +3 -1
  10. package/out/Components/Decorator/Padding.luau +11 -6
  11. package/out/Components/Input/Button.d.ts +1 -0
  12. package/out/Components/Input/Button.luau +44 -33
  13. package/out/Components/Input/Checkbox.d.ts +1 -0
  14. package/out/Components/Input/Checkbox.luau +22 -16
  15. package/out/Components/Input/HoverButton.d.ts +1 -0
  16. package/out/Components/Input/HoverButton.luau +44 -40
  17. package/out/Components/Input/Increment.d.ts +1 -0
  18. package/out/Components/Input/Increment.luau +10 -3
  19. package/out/Components/Input/Input.d.ts +3 -1
  20. package/out/Components/Input/Input.luau +85 -66
  21. package/out/Components/Input/Select.d.ts +9 -0
  22. package/out/Components/Input/Select.luau +311 -34
  23. package/out/Components/Input/Slider.luau +44 -29
  24. package/out/Components/Input/Switch.d.ts +9 -0
  25. package/out/Components/Input/Switch.luau +147 -0
  26. package/out/Components/Input/index.d.ts +1 -0
  27. package/out/Components/Input/init.luau +3 -0
  28. package/out/Components/Interaction/Modal.d.ts +14 -0
  29. package/out/Components/Interaction/Modal.luau +276 -0
  30. package/out/Components/Interaction/Toast.d.ts +2 -1
  31. package/out/Components/Interaction/Toast.luau +53 -28
  32. package/out/Components/Interaction/Tooltip.luau +36 -24
  33. package/out/Components/Interaction/index.d.ts +1 -0
  34. package/out/Components/Interaction/init.luau +3 -0
  35. package/out/Components/Layout/Accordion.d.ts +1 -0
  36. package/out/Components/Layout/Accordion.luau +51 -55
  37. package/out/Components/Layout/Column.d.ts +1 -0
  38. package/out/Components/Layout/Column.luau +11 -6
  39. package/out/Components/Layout/Container.d.ts +1 -0
  40. package/out/Components/Layout/Container.luau +22 -16
  41. package/out/Components/Layout/Draggable.luau +25 -3
  42. package/out/Components/Layout/Fieldset.d.ts +1 -0
  43. package/out/Components/Layout/Fieldset.luau +14 -42
  44. package/out/Components/Layout/FlexItem.luau +7 -0
  45. package/out/Components/Layout/Group.d.ts +1 -0
  46. package/out/Components/Layout/Group.luau +16 -33
  47. package/out/Components/Layout/HStack.d.ts +4 -0
  48. package/out/Components/Layout/HStack.luau +17 -10
  49. package/out/Components/Layout/Pagination.d.ts +32 -0
  50. package/out/Components/Layout/Pagination.luau +405 -0
  51. package/out/Components/Layout/Row.d.ts +1 -0
  52. package/out/Components/Layout/Row.luau +20 -48
  53. package/out/Components/Layout/Scroller.d.ts +1 -0
  54. package/out/Components/Layout/Scroller.luau +26 -34
  55. package/out/Components/Layout/Table.d.ts +31 -0
  56. package/out/Components/Layout/Table.luau +342 -0
  57. package/out/Components/Layout/Tabs.d.ts +18 -9
  58. package/out/Components/Layout/Tabs.luau +134 -119
  59. package/out/Components/Layout/VStack.d.ts +3 -0
  60. package/out/Components/Layout/VStack.luau +17 -10
  61. package/out/Components/Layout/index.d.ts +2 -0
  62. package/out/Components/Layout/init.luau +6 -0
  63. package/out/Components/Navigation/Menu.d.ts +1 -0
  64. package/out/Components/Navigation/Menu.luau +12 -3
  65. package/out/Components/Surface/Box.d.ts +1 -0
  66. package/out/Components/Surface/Box.luau +12 -4
  67. package/out/Components/Surface/Card.d.ts +1 -0
  68. package/out/Components/Surface/Card.luau +54 -51
  69. package/out/Components/Surface/Icon.d.ts +1 -0
  70. package/out/Components/Surface/Icon.luau +25 -16
  71. package/out/Components/Typography/Text.d.ts +1 -0
  72. package/out/Components/Typography/Text.luau +57 -47
  73. package/out/Contexts/index.d.ts +1 -0
  74. package/out/Contexts/init.luau +3 -0
  75. package/out/Contexts/modal.context.d.ts +15 -0
  76. package/out/Contexts/modal.context.luau +26 -0
  77. package/out/Contexts/toast.context.d.ts +1 -0
  78. package/out/Providers/app.provider.luau +2 -1
  79. package/out/Providers/index.d.ts +1 -0
  80. package/out/Providers/init.luau +3 -0
  81. package/out/Providers/modal.provider.d.ts +6 -0
  82. package/out/Providers/modal.provider.luau +86 -0
  83. package/out/Providers/overlay.provider.luau +1 -0
  84. package/out/Theme/theme.template.d.ts +85 -0
  85. package/out/Theme/themes/dark.theme.luau +103 -0
  86. package/out/Theme/themes/default.theme.luau +130 -0
  87. package/out/Theme/themes/sandstone.theme.luau +103 -0
  88. package/out/Theme/themes/wooden.theme.luau +122 -0
  89. package/package.json +1 -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 };
@@ -0,0 +1,342 @@
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 SizeHelper = _Helpers.SizeHelper
7
+ local SpacingHelper = _Helpers.SpacingHelper
8
+ local TypographyHelper = _Helpers.TypographyHelper
9
+ local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
10
+ local Corners = _Decorator.Corners
11
+ local Padding = _Decorator.Padding
12
+ local Text = TS.import(script, script.Parent.Parent, "Typography").Text
13
+ local Container = TS.import(script, script.Parent, "Container").Container
14
+ local HStack = TS.import(script, script.Parent, "HStack").HStack
15
+ local VStack = TS.import(script, script.Parent, "VStack").VStack
16
+ local TableSectionContext = React.createContext(nil)
17
+ local TableScaleContext = React.createContext(nil)
18
+ local TableLayoutContext = React.createContext(nil)
19
+ local TableColumnContext = React.createContext(0)
20
+ local nextTableCellId = 0
21
+ local function TableHeader(props)
22
+ local theme = React.useContext(CleanThemeContext)
23
+ local layout = React.useContext(TableLayoutContext)
24
+ local _result = layout
25
+ if _result ~= nil then
26
+ _result = _result.autoWidth
27
+ end
28
+ local autoSectionWidth = if _result == true then layout.totalWidth else nil
29
+ return React.createElement(TableSectionContext.Provider, {
30
+ value = "header",
31
+ }, React.createElement(Container, {
32
+ name = "TableHeader",
33
+ Size = if autoSectionWidth ~= nil then UDim2.fromOffset(autoSectionWidth, 0) else nil,
34
+ width = if autoSectionWidth == nil then "100%" else nil,
35
+ AutomaticSize = Enum.AutomaticSize.Y,
36
+ BackgroundColor3 = theme.components.table.header.backgroundColor,
37
+ BackgroundTransparency = theme.components.table.header.backgroundTransparency,
38
+ }, React.createElement("uicorner", {
39
+ key = "Corners",
40
+ TopLeftRadius = SizeHelper:toUDim(theme.components.table.cornerRadius),
41
+ TopRightRadius = SizeHelper:toUDim(theme.components.table.cornerRadius),
42
+ BottomLeftRadius = UDim.new(0, 0),
43
+ BottomRightRadius = UDim.new(0, 0),
44
+ }), React.createElement(VStack, {
45
+ spacing = "None",
46
+ }, props.children)))
47
+ end
48
+ local function TableBody(props)
49
+ local layout = React.useContext(TableLayoutContext)
50
+ local _result = layout
51
+ if _result ~= nil then
52
+ _result = _result.autoWidth
53
+ end
54
+ local autoSectionWidth = if _result == true then layout.totalWidth else nil
55
+ return React.createElement(TableSectionContext.Provider, {
56
+ value = "body",
57
+ }, React.createElement(Container, {
58
+ name = "TableBody",
59
+ Size = if autoSectionWidth ~= nil then UDim2.fromOffset(autoSectionWidth, 0) else nil,
60
+ width = if autoSectionWidth == nil then "100%" else nil,
61
+ AutomaticSize = Enum.AutomaticSize.Y,
62
+ }, React.createElement(VStack, {
63
+ spacing = "None",
64
+ }, props.children)))
65
+ end
66
+ local TableHead, TableCell
67
+ local function TableRow(props)
68
+ local theme = React.useContext(CleanThemeContext)
69
+ local section = React.useContext(TableSectionContext)
70
+ local layout = React.useContext(TableLayoutContext)
71
+ local columnIndex = 0
72
+ local children = React.Children.map(props.children, function(child)
73
+ if not React.isValidElement(child) or (child.type ~= TableHead and child.type ~= TableCell) then
74
+ return child
75
+ end
76
+ local _original = columnIndex
77
+ columnIndex += 1
78
+ local currentColumnIndex = _original
79
+ return React.createElement(TableColumnContext.Provider, {
80
+ value = currentColumnIndex,
81
+ }, child)
82
+ end)
83
+ local _result = layout
84
+ if _result ~= nil then
85
+ _result = _result.autoWidth
86
+ end
87
+ local autoRowWidth = if _result == true then layout.totalWidth else nil
88
+ local _condition = section == "body"
89
+ if _condition then
90
+ local _attributes = {
91
+ key = "Divider",
92
+ BackgroundColor3 = theme.components.table.rowDividerColor,
93
+ BorderSizePixel = 0,
94
+ }
95
+ local _exp = UDim2.fromOffset(0, theme.components.table.rowDividerThickness)
96
+ local _arg0 = UDim2.fromScale(1, 0)
97
+ _attributes.Size = _exp + _arg0
98
+ _condition = (React.createElement("frame", _attributes))
99
+ end
100
+ return React.createElement(Container, {
101
+ name = "TableRow",
102
+ Size = if autoRowWidth ~= nil then UDim2.fromOffset(autoRowWidth, 0) else nil,
103
+ width = if autoRowWidth == nil then "100%" else nil,
104
+ AutomaticSize = Enum.AutomaticSize.Y,
105
+ }, _condition, React.createElement(Container, {
106
+ name = "TableRowContent",
107
+ width = "100%",
108
+ AutomaticSize = Enum.AutomaticSize.Y,
109
+ }, React.createElement(HStack, {
110
+ Padding = UDim.new(0, 0),
111
+ Wraps = false,
112
+ }, children)))
113
+ end
114
+ local function TableCellContent(props)
115
+ local theme = React.useContext(CleanThemeContext)
116
+ local tableScale = React.useContext(TableScaleContext)
117
+ local layout = React.useContext(TableLayoutContext)
118
+ local _original = nextTableCellId
119
+ nextTableCellId += 1
120
+ local id = React.useRef(_original).current
121
+ local measurementRef = React.useRef()
122
+ local typography = if props.header then TypographyHelper:getTypography(theme, tableScale, theme.components.table.header.typography) else TypographyHelper:getTypography(theme, tableScale, theme.components.table.cell.typography)
123
+ local _condition = props.text
124
+ if _condition == nil then
125
+ _condition = props.children
126
+ end
127
+ local content = _condition
128
+ local columnIndex = React.useContext(TableColumnContext)
129
+ local _result = layout
130
+ if _result ~= nil then
131
+ _result = _result.columnWidths[columnIndex]
132
+ end
133
+ local _condition_1 = _result
134
+ if _condition_1 == nil then
135
+ _condition_1 = 0
136
+ end
137
+ local columnWidth = _condition_1
138
+ local _result_1 = layout
139
+ if _result_1 ~= nil then
140
+ _result_1 = _result_1.autoWidth
141
+ end
142
+ local _condition_2 = _result_1 == false
143
+ if _condition_2 then
144
+ _condition_2 = layout.totalWidth > 0
145
+ end
146
+ local cellWidth = if _condition_2 then UDim.new(columnWidth / layout.totalWidth, 0) else UDim.new(0, columnWidth)
147
+ local _exp = function(instance)
148
+ local _result_2 = layout
149
+ if _result_2 ~= nil then
150
+ _result_2 = _result_2.reportWidth(id, columnIndex, instance.AbsoluteSize.X)
151
+ end
152
+ return _result_2
153
+ end
154
+ local _result_2 = layout
155
+ if _result_2 ~= nil then
156
+ _result_2 = _result_2.reportWidth
157
+ end
158
+ local reportMeasurement = React.useCallback(_exp, { _result_2, id, columnIndex })
159
+ local _exp_1 = function()
160
+ return function()
161
+ local _result_3 = layout
162
+ if _result_3 ~= nil then
163
+ _result_3 = _result_3.removeWidth(id)
164
+ end
165
+ return _result_3
166
+ end
167
+ end
168
+ local _result_3 = layout
169
+ if _result_3 ~= nil then
170
+ _result_3 = _result_3.removeWidth
171
+ end
172
+ React.useEffect(_exp_1, { _result_3 })
173
+ React.useEffect(function()
174
+ local mounted = true
175
+ local reportMountedMeasurement = function()
176
+ local instance = measurementRef.current
177
+ if mounted and instance ~= nil then
178
+ reportMeasurement(instance)
179
+ end
180
+ end
181
+ reportMountedMeasurement()
182
+ task.defer(reportMountedMeasurement)
183
+ return function()
184
+ mounted = false
185
+ end
186
+ end, { reportMeasurement })
187
+ local _exp_2 = React.createElement("uilistlayout", {
188
+ key = "TableCellLayout",
189
+ FillDirection = Enum.FillDirection.Horizontal,
190
+ HorizontalAlignment = props.align or "Left",
191
+ })
192
+ local _attributes = {}
193
+ local _object = table.clone(props)
194
+ setmetatable(_object, nil)
195
+ _object.spacing = props.spacing or tableScale
196
+ _attributes.resolvedPadding = SpacingHelper:GetResolvedPadding(theme, _object, theme.components.table.cell.spacing, theme.components.table.cell.padding)
197
+ return React.createElement(Container, {
198
+ name = if props.header then "TableHead" else "TableCell",
199
+ Size = UDim2.new(cellWidth, UDim.new(0, 0)),
200
+ AutomaticSize = Enum.AutomaticSize.Y,
201
+ }, _exp_2, React.createElement("frame", {
202
+ key = "TableCellMeasurement",
203
+ ref = measurementRef,
204
+ Size = UDim2.fromOffset(0, 0),
205
+ AutomaticSize = Enum.AutomaticSize.XY,
206
+ BackgroundTransparency = 1,
207
+ Change = {
208
+ AbsoluteSize = reportMeasurement,
209
+ },
210
+ }, React.createElement(Padding, _attributes), if type(content) == "string" then React.createElement(Text, {
211
+ text = content,
212
+ typography = typography,
213
+ TextWrap = false,
214
+ }) else content))
215
+ end
216
+ function TableHead(props)
217
+ local _object = table.clone(props)
218
+ setmetatable(_object, nil)
219
+ _object.header = true
220
+ return TableCellContent(_object)
221
+ end
222
+ function TableCell(props)
223
+ local _object = table.clone(props)
224
+ setmetatable(_object, nil)
225
+ _object.header = false
226
+ return TableCellContent(_object)
227
+ end
228
+ local Table = React.forwardRef(function(props, ref)
229
+ local theme = React.useContext(CleanThemeContext)
230
+ local measurements, setMeasurements = React.useState({})
231
+ local autoWidth = props.Size == nil and props.width == nil
232
+ local reportWidth = React.useCallback(function(id, columnIndex, width)
233
+ setMeasurements(function(current)
234
+ local _current = current
235
+ local _id = id
236
+ local previous = _current[_id]
237
+ local _result = previous
238
+ if _result ~= nil then
239
+ _result = _result.columnIndex
240
+ end
241
+ local _condition = _result == columnIndex
242
+ if _condition then
243
+ _condition = previous.width == width
244
+ end
245
+ if _condition then
246
+ return current
247
+ end
248
+ local updated = {}
249
+ for currentId, measurement in current do
250
+ updated[currentId] = measurement
251
+ end
252
+ local _id_1 = id
253
+ local _arg1 = {
254
+ columnIndex = columnIndex,
255
+ width = width,
256
+ }
257
+ updated[_id_1] = _arg1
258
+ return updated
259
+ end)
260
+ end, {})
261
+ local removeWidth = React.useCallback(function(id)
262
+ setMeasurements(function(current)
263
+ local _current = current
264
+ local _id = id
265
+ if not (_current[_id] ~= nil) then
266
+ return current
267
+ end
268
+ local updated = {}
269
+ for currentId, measurement in current do
270
+ updated[currentId] = measurement
271
+ end
272
+ local _id_1 = id
273
+ updated[_id_1] = nil
274
+ return updated
275
+ end)
276
+ end, {})
277
+ local columnWidths = React.useMemo(function()
278
+ local widths = {}
279
+ for _, measurement in measurements do
280
+ local _exp = measurement.columnIndex
281
+ local _columnIndex = measurement.columnIndex
282
+ local _condition = widths[_columnIndex]
283
+ if _condition == nil then
284
+ _condition = 0
285
+ end
286
+ local _arg1 = math.max(_condition, measurement.width)
287
+ widths[_exp] = _arg1
288
+ end
289
+ return widths
290
+ end, { measurements })
291
+ local totalWidth = 0
292
+ for _, width in columnWidths do
293
+ totalWidth += width
294
+ end
295
+ local layout = React.useMemo(function()
296
+ return {
297
+ autoWidth = autoWidth,
298
+ columnWidths = columnWidths,
299
+ totalWidth = totalWidth,
300
+ reportWidth = reportWidth,
301
+ removeWidth = removeWidth,
302
+ }
303
+ end, { autoWidth, columnWidths, totalWidth, reportWidth, removeWidth })
304
+ local _attributes = {
305
+ ref = ref,
306
+ }
307
+ local _condition = props.name
308
+ if _condition == nil then
309
+ _condition = "Table"
310
+ end
311
+ _attributes.name = _condition
312
+ _attributes.Size = props.Size
313
+ _attributes.width = props.width
314
+ _attributes.height = props.height
315
+ _attributes.AutomaticSize = props.AutomaticSize
316
+ _attributes.BackgroundColor3 = theme.components.table.backgroundColor
317
+ _attributes.BackgroundTransparency = theme.components.table.backgroundTransparency
318
+ _attributes.ClipsDescendants = true
319
+ return React.createElement(TableScaleContext.Provider, {
320
+ value = props.scale,
321
+ }, React.createElement(TableLayoutContext.Provider, {
322
+ value = layout,
323
+ }, React.createElement(Container, _attributes, React.createElement(Corners, {
324
+ radius = theme.components.table.cornerRadius,
325
+ }), React.createElement("uistroke", {
326
+ key = "Stroke",
327
+ Color = theme.components.table.borderColor,
328
+ Thickness = theme.components.table.borderThickness,
329
+ BorderStrokePosition = Enum.BorderStrokePosition.Outer,
330
+ }), React.createElement(VStack, {
331
+ spacing = "None",
332
+ HorizontalFlex = if autoWidth then Enum.UIFlexAlignment.None else Enum.UIFlexAlignment.Fill,
333
+ }, props.children))))
334
+ end)
335
+ Table.Header = TableHeader
336
+ Table.Body = TableBody
337
+ Table.Row = TableRow
338
+ Table.Head = TableHead
339
+ Table.Cell = TableCell
340
+ return {
341
+ Table = Table,
342
+ }
@@ -1,23 +1,32 @@
1
1
  import React from "@rbxts/react";
2
2
  import { PaddingProps, ScalableElementProps } from "../../Interfaces";
3
3
  import { CssBackgroundImage } from "../../Theme";
4
- interface TabProps {
5
- children?: React.ReactNode;
6
- }
7
- declare function Tab(_props: TabProps): undefined;
8
4
  interface TabTitleProps extends PaddingProps {
5
+ value: string;
9
6
  text: string;
10
7
  }
11
- declare function TabTitle(_props: TabTitleProps): undefined;
8
+ declare function TabTitle(props: TabTitleProps): React.JSX.Element;
12
9
  interface TabContentProps {
10
+ value: string;
11
+ children?: React.ReactNode;
12
+ }
13
+ declare function TabContent(props: TabContentProps): React.JSX.Element;
14
+ interface TabsListProps extends ScalableElementProps {
13
15
  children?: React.ReactNode;
14
16
  }
15
- declare function TabContent(props: TabContentProps): undefined;
16
- interface TabsProps extends ScalableElementProps {
17
+ declare const TabsList: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<ImageLabel>>;
18
+ interface TabsBodyProps extends ScalableElementProps {
17
19
  backgroundImage?: CssBackgroundImage;
20
+ children?: React.ReactNode;
21
+ }
22
+ declare const TabsBody: React.ForwardRefExoticComponent<TabsBodyProps & React.RefAttributes<ImageLabel>>;
23
+ export interface TabsProps {
24
+ children?: React.ReactNode;
25
+ defaultValue?: string;
18
26
  }
19
- type TabsComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<ImageLabel>> & {
20
- Tab: typeof Tab;
27
+ type TabsComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<Frame>> & {
28
+ List: typeof TabsList;
29
+ Body: typeof TabsBody;
21
30
  Title: typeof TabTitle;
22
31
  Content: typeof TabContent;
23
32
  };