@rbxts/react-clean-ui 1.0.14 → 1.0.36

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 (64) hide show
  1. package/out/Components/Chart/BarChart.d.ts +47 -0
  2. package/out/Components/Chart/BarChart.luau +880 -0
  3. package/out/Components/Chart/Pie.d.ts +27 -0
  4. package/out/Components/Chart/Pie.luau +281 -0
  5. package/out/Components/Chart/index.d.ts +2 -0
  6. package/out/Components/Chart/init.luau +10 -0
  7. package/out/Components/Decorator/BoxShadow.d.ts +2 -1
  8. package/out/Components/Decorator/BoxShadow.luau +51 -28
  9. package/out/Components/Input/Select.d.ts +6 -14
  10. package/out/Components/Input/Select.luau +111 -151
  11. package/out/Components/Input/Slider.d.ts +3 -37
  12. package/out/Components/Input/Slider.luau +271 -300
  13. package/out/Components/Interaction/Toast.d.ts +1 -1
  14. package/out/Components/Interaction/Toast.luau +4 -4
  15. package/out/Components/Interaction/Tooltip.d.ts +1 -1
  16. package/out/Components/Interaction/Tooltip.luau +8 -1
  17. package/out/Components/Layout/Accordion.d.ts +34 -0
  18. package/out/Components/Layout/Accordion.luau +430 -0
  19. package/out/Components/Layout/Column.d.ts +2 -8
  20. package/out/Components/Layout/Column.luau +28 -48
  21. package/out/Components/Layout/Container.luau +21 -5
  22. package/out/Components/Layout/Draggable.d.ts +7 -31
  23. package/out/Components/Layout/Draggable.luau +190 -214
  24. package/out/Components/Layout/Fieldset.d.ts +8 -18
  25. package/out/Components/Layout/Fieldset.luau +42 -84
  26. package/out/Components/Layout/Group.d.ts +7 -14
  27. package/out/Components/Layout/Group.luau +111 -129
  28. package/out/Components/Layout/HStack.d.ts +2 -1
  29. package/out/Components/Layout/HStack.luau +1 -2
  30. package/out/Components/Layout/Row.d.ts +2 -11
  31. package/out/Components/Layout/Row.luau +46 -71
  32. package/out/Components/Layout/Tabs.d.ts +10 -18
  33. package/out/Components/Layout/Tabs.luau +85 -104
  34. package/out/Components/Layout/VStack.d.ts +4 -1
  35. package/out/Components/Layout/VStack.luau +2 -2
  36. package/out/Components/Layout/index.d.ts +1 -0
  37. package/out/Components/Layout/init.luau +3 -0
  38. package/out/Components/Navigation/Menu.d.ts +6 -10
  39. package/out/Components/Navigation/Menu.luau +38 -65
  40. package/out/Components/Surface/Box.d.ts +2 -2
  41. package/out/Components/Surface/Card.d.ts +8 -11
  42. package/out/Components/Surface/Card.luau +40 -48
  43. package/out/Components/Surface/Icon.d.ts +1 -1
  44. package/out/Components/Surface/Icon.luau +1 -0
  45. package/out/Components/Surface/index.d.ts +0 -1
  46. package/out/Components/Surface/init.luau +0 -3
  47. package/out/Components/Typography/Text.luau +26 -13
  48. package/out/Components/index.d.ts +1 -0
  49. package/out/Components/init.luau +3 -0
  50. package/out/Helpers/create-ui-story.d.ts +6 -4
  51. package/out/Helpers/create-ui-story.luau +15 -4
  52. package/out/Helpers/css.helper.d.ts +2 -1
  53. package/out/Helpers/css.helper.luau +25 -0
  54. package/out/Helpers/size.helper.luau +1 -1
  55. package/out/Interfaces/clean.element.props.d.ts +7 -2
  56. package/out/Providers/registry.provider.d.ts +1 -0
  57. package/out/Providers/registry.provider.luau +5 -0
  58. package/out/Theme/theme.template.d.ts +72 -1
  59. package/out/Theme/themes/dark.theme.luau +47 -0
  60. package/out/Theme/themes/default.theme.luau +116 -1
  61. package/out/Theme/themes/sandstone.theme.luau +59 -0
  62. package/package.json +4 -2
  63. package/out/Components/Surface/Panel.d.ts +0 -4
  64. package/out/Components/Surface/Panel.luau +0 -33
@@ -1,6 +1,6 @@
1
1
  import React from "@rbxts/react";
2
2
  import { SizeElementProps } from "../../Interfaces";
3
- import { ToastOptions } from "../../Contexts/";
3
+ import { ToastOptions } from "../../Contexts";
4
4
  interface ToastProps extends ToastOptions {
5
5
  onDismiss: () => void;
6
6
  }
@@ -10,11 +10,11 @@ local Container = _Layout.Container
10
10
  local FlexItem = _Layout.FlexItem
11
11
  local HStack = _Layout.HStack
12
12
  local VStack = _Layout.VStack
13
- local Button = TS.import(script, script.Parent.Parent, "Input").Button
13
+ local Button = TS.import(script, script.Parent.Parent, "Input", "Button").Button
14
14
  local Text = TS.import(script, script.Parent.Parent, "Typography").Text
15
- local _ = TS.import(script, script.Parent.Parent.Parent, "Contexts")
16
- local CleanThemeContext = _.CleanThemeContext
17
- local useToast = _.useToast
15
+ local _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
16
+ local CleanThemeContext = _Contexts.CleanThemeContext
17
+ local useToast = _Contexts.useToast
18
18
  local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
19
19
  local ColorHelper = _Helpers.ColorHelper
20
20
  local SizeHelper = _Helpers.SizeHelper
@@ -1,7 +1,7 @@
1
1
  import React from "@rbxts/react";
2
2
  import { IntentElementProps } from "../../Interfaces";
3
3
  import { BoxProps } from "../Surface";
4
- type TooltipPlacement = "Top" | "Bottom" | "Left" | "Right";
4
+ type TooltipPlacement = "Top" | "Bottom" | "Left" | "Right" | "Center";
5
5
  interface TooltipProps extends BoxProps, IntentElementProps {
6
6
  content: React.ReactNode | string;
7
7
  children: React.ReactElement<React.InstanceProps<GuiObject>>;
@@ -38,7 +38,7 @@ local function TooltipPopup(props)
38
38
  resolvedPadding.left += shadow.blurRadius.Offset + shadow.spread.X.Offset - shadow.offset.X.Offset
39
39
  resolvedPadding.right += shadow.blurRadius.Offset + shadow.spread.X.Offset + shadow.offset.X.Offset
40
40
  end
41
- local pointerSize = theme.components.tooltip.pointerSize
41
+ local pointerSize = if props.placement == "Center" then 0 else theme.components.tooltip.pointerSize
42
42
  local anchor = Vector2.zero
43
43
  local _position = props.target.position
44
44
  local _absolutePosition = props.overlay.AbsolutePosition
@@ -93,6 +93,13 @@ local function TooltipPopup(props)
93
93
  resolvedPadding.left = math.max(math.floor(pointerHeight), resolvedPadding.left)
94
94
  break
95
95
  end
96
+ if _exp == "Center" then
97
+ anchor = Vector2.new(0.5, 0.5)
98
+ local _position_1 = position
99
+ local _vector2 = Vector2.new(props.target.size.X / 2, props.target.size.Y / 2)
100
+ position = _position_1 + _vector2
101
+ break
102
+ end
96
103
  until true
97
104
  local intent = ColorHelper:getIntentColors(theme, props.intent, "default", theme.components.tooltip.intents)
98
105
  local padding = SpacingHelper:ResolveNumberPadding(SpacingHelper:GetPadding(theme, props.spacing, theme.components.tooltip.spacing))
@@ -0,0 +1,34 @@
1
+ import React from "@rbxts/react";
2
+ import { IconName, ScalableElementProps } from "../../Interfaces";
3
+ interface AccordionItemProps {
4
+ children?: React.ReactNode;
5
+ value: string;
6
+ disabled?: boolean;
7
+ }
8
+ declare function AccordionItem(_props: AccordionItemProps): undefined;
9
+ interface AccordionHeaderProps {
10
+ children?: React.ReactNode | string;
11
+ icon?: IconName;
12
+ text?: string;
13
+ }
14
+ declare function AccordionHeader(_props: AccordionHeaderProps): undefined;
15
+ interface AccordionContentProps {
16
+ children?: React.ReactNode;
17
+ text?: string;
18
+ }
19
+ declare function AccordionContent(_props: AccordionContentProps): undefined;
20
+ export interface AccordionProps extends ScalableElementProps {
21
+ children?: React.ReactNode;
22
+ collapsible?: boolean;
23
+ animationDuration?: number;
24
+ defaultValue?: string;
25
+ value?: string;
26
+ onValueChange?: (value: string | undefined) => void;
27
+ }
28
+ type AccordionComponent = React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<Frame>> & {
29
+ Item: typeof AccordionItem;
30
+ Header: typeof AccordionHeader;
31
+ Content: typeof AccordionContent;
32
+ };
33
+ declare const Accordion: AccordionComponent;
34
+ export { Accordion };
@@ -0,0 +1,430 @@
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 useTween = TS.import(script, TS.getModule(script, "@rbxts", "react-ripple").src).useTween
5
+ local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
6
+ local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
7
+ local ColorHelper = _Helpers.ColorHelper
8
+ local SizeHelper = _Helpers.SizeHelper
9
+ local SpacingHelper = _Helpers.SpacingHelper
10
+ local TypographyHelper = _Helpers.TypographyHelper
11
+ local _Decorator = TS.import(script, script.Parent.Parent, "Decorator")
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 VStack = TS.import(script, script.Parent, "VStack").VStack
22
+ local function AccordionItem(_props)
23
+ return nil
24
+ end
25
+ local function AccordionHeader(_props)
26
+ return nil
27
+ end
28
+ local function AccordionContent(_props)
29
+ return nil
30
+ end
31
+ local function AccordionHeaderVisual(props)
32
+ local theme = React.useContext(CleanThemeContext)
33
+ local hover = React.useContext(HoverButtonContext)
34
+ local _result
35
+ if props.disabled then
36
+ _result = "disabled"
37
+ else
38
+ local _result_1 = hover
39
+ if _result_1 ~= nil then
40
+ _result_1 = _result_1.isSelected
41
+ end
42
+ local _result_2
43
+ if _result_1 then
44
+ _result_2 = "focus"
45
+ else
46
+ local _result_3 = hover
47
+ if _result_3 ~= nil then
48
+ _result_3 = _result_3.hover
49
+ end
50
+ _result_2 = if _result_3 then "hover" else "default"
51
+ end
52
+ _result = _result_2
53
+ end
54
+ local state = _result
55
+ local colors = ColorHelper:getIntentColors(theme, "primary", state, theme.components.accordion.header.intents)
56
+ local rotation, rotationTween = useTween(if props.open then 0 else -90, {
57
+ duration = props.duration,
58
+ })
59
+ React.useEffect(function()
60
+ local goal = if props.open then 0 else -90
61
+ rotationTween:setGoal(goal, {
62
+ duration = props.duration,
63
+ })
64
+ if props.duration == 0 then
65
+ rotationTween:setPosition(goal)
66
+ end
67
+ rotationTween:start()
68
+ end, { props.duration, props.open, rotationTween })
69
+ local _condition = props.header.text == nil and props.header.children ~= nil
70
+ if _condition then
71
+ local _children = props.header.children
72
+ _condition = not (type(_children) == "string")
73
+ end
74
+ if _condition then
75
+ return props.header.children
76
+ end
77
+ local _exp = React.createElement(Padding, {
78
+ resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.accordion.header.spacing),
79
+ })
80
+ local _exp_1 = props.header.icon ~= nil and React.createElement(Icon, {
81
+ icon = props.header.icon,
82
+ color = colors.textColor,
83
+ })
84
+ local _result_1
85
+ if props.header.text ~= nil then
86
+ _result_1 = React.createElement(Text, {
87
+ text = props.header.text,
88
+ TextColor3 = colors.textColor,
89
+ typography = TypographyHelper:getTypography(theme, nil, colors.typography or theme.components.accordion.header.typography),
90
+ })
91
+ else
92
+ local _children = props.header.children
93
+ _result_1 = if type(_children) == "string" then React.createElement(Text, {
94
+ text = props.header.children,
95
+ TextColor3 = colors.textColor,
96
+ typography = TypographyHelper:getTypography(theme, nil, colors.typography or theme.components.accordion.header.typography),
97
+ }) else props.header.children
98
+ end
99
+ return React.createElement(React.Fragment, nil, _exp, React.createElement(HStack, {
100
+ valign = "Center",
101
+ Wraps = false,
102
+ HorizontalFlex = Enum.UIFlexAlignment.Fill,
103
+ }, _exp_1, React.createElement(Container, {
104
+ Size = UDim2.new(1, theme.components.accordion.header.indicatorSize, 0, 0),
105
+ AutomaticSize = Enum.AutomaticSize.Y,
106
+ }, _result_1), React.createElement(Icon, {
107
+ icon = "chevron-down",
108
+ color = if props.disabled then colors.textColor else theme.components.accordion.header.indicatorColor,
109
+ Size = UDim2.fromOffset(theme.components.accordion.header.indicatorSize, theme.components.accordion.header.indicatorSize),
110
+ Rotation = rotation,
111
+ })))
112
+ end
113
+ local function RenderedAccordionItem(props)
114
+ local theme = React.useContext(CleanThemeContext)
115
+ local mounted, setMounted = React.useState(props.open)
116
+ local height, heightTween = useTween(0, {
117
+ duration = props.duration,
118
+ })
119
+ React.useEffect(function()
120
+ if props.open then
121
+ setMounted(true)
122
+ else
123
+ heightTween:setGoal(0, {
124
+ duration = props.duration,
125
+ })
126
+ if props.duration == 0 then
127
+ heightTween:setPosition(0)
128
+ end
129
+ heightTween:start()
130
+ if props.duration == 0 then
131
+ setMounted(false)
132
+ end
133
+ end
134
+ end, { props.duration, props.open, heightTween })
135
+ React.useEffect(function()
136
+ if props.duration == 0 then
137
+ heightTween:setPosition(heightTween:getGoal())
138
+ end
139
+ end, { props.duration, heightTween })
140
+ React.useEffect(function()
141
+ return heightTween:onComplete(function(value)
142
+ if value == 0 and not props.open then
143
+ setMounted(false)
144
+ end
145
+ end)
146
+ end, { heightTween, props.open })
147
+ local defaultColors = ColorHelper:getIntentColors(theme, "primary", if props.disabled then "disabled" else "default", theme.components.accordion.header.intents)
148
+ local hoverColors = ColorHelper:getIntentColors(theme, "primary", "hover", theme.components.accordion.header.intents)
149
+ local focusColors = ColorHelper:getIntentColors(theme, "primary", "focus", theme.components.accordion.header.intents)
150
+ local _condition = not props.first
151
+ if _condition then
152
+ local _attributes = {
153
+ BackgroundColor3 = theme.components.accordion.borderColor,
154
+ BackgroundTransparency = 0,
155
+ BorderSizePixel = 0,
156
+ }
157
+ local _exp = UDim2.fromOffset(0, theme.components.accordion.borderThickness)
158
+ local _arg0 = UDim2.fromScale(1, 0)
159
+ _attributes.Size = _exp + _arg0
160
+ _condition = (React.createElement("frame", _attributes))
161
+ end
162
+ local _attributes = {
163
+ isSelected = props.open,
164
+ }
165
+ local _object = {
166
+ Active = not props.disabled and props.content ~= nil,
167
+ Selectable = not props.disabled and props.content ~= nil,
168
+ AutoButtonColor = false,
169
+ AutomaticSize = Enum.AutomaticSize.Y,
170
+ Size = UDim2.fromScale(1, 0),
171
+ ImageTransparency = 1,
172
+ BackgroundColor3 = defaultColors.backgroundColor,
173
+ }
174
+ local _left = "BackgroundTransparency"
175
+ local _condition_1 = defaultColors.backgroundTransparency
176
+ if _condition_1 == nil then
177
+ _condition_1 = 0
178
+ end
179
+ _object[_left] = _condition_1
180
+ _object.BorderSizePixel = 0
181
+ _object.Event = {
182
+ Activated = props.onActivate,
183
+ }
184
+ _attributes.default = _object
185
+ local _object_1 = {
186
+ BackgroundColor3 = hoverColors.backgroundColor,
187
+ }
188
+ local _left_1 = "BackgroundTransparency"
189
+ local _condition_2 = hoverColors.backgroundTransparency
190
+ if _condition_2 == nil then
191
+ _condition_2 = 0
192
+ end
193
+ _object_1[_left_1] = _condition_2
194
+ _attributes.hover = _object_1
195
+ local _object_2 = {
196
+ BackgroundColor3 = focusColors.backgroundColor,
197
+ }
198
+ local _left_2 = "BackgroundTransparency"
199
+ local _condition_3 = focusColors.backgroundTransparency
200
+ if _condition_3 == nil then
201
+ _condition_3 = 0
202
+ end
203
+ _object_2[_left_2] = _condition_3
204
+ _attributes.focus = _object_2
205
+ return React.createElement(Container, {
206
+ width = "100%",
207
+ }, React.createElement(VStack, {
208
+ spacing = "None",
209
+ }, _condition, React.createElement(HoverButton, _attributes, props.first and (React.createElement("uicorner", {
210
+ TopLeftRadius = SizeHelper:toUDim(theme.components.accordion.cornerRadius),
211
+ TopRightRadius = SizeHelper:toUDim(theme.components.accordion.cornerRadius),
212
+ BottomLeftRadius = UDim.new(0, 0),
213
+ BottomRightRadius = UDim.new(0, 0),
214
+ })), React.createElement(AccordionHeaderVisual, {
215
+ header = props.header,
216
+ disabled = props.disabled,
217
+ duration = props.duration,
218
+ open = props.open,
219
+ })), mounted and (React.createElement("frame", {
220
+ BackgroundTransparency = 1,
221
+ ClipsDescendants = true,
222
+ Size = height:map(function(value)
223
+ local _exp = UDim2.fromScale(1, 0)
224
+ local _arg0 = UDim2.fromOffset(0, value)
225
+ return _exp + _arg0
226
+ end),
227
+ }, React.createElement("frame", {
228
+ BackgroundColor3 = theme.components.accordion.content.backgroundColor,
229
+ BackgroundTransparency = theme.components.accordion.content.backgroundTransparency,
230
+ Size = UDim2.fromScale(1, 0),
231
+ AutomaticSize = Enum.AutomaticSize.Y,
232
+ Change = {
233
+ AbsoluteSize = function(instance)
234
+ if props.open then
235
+ heightTween:setGoal(instance.AbsoluteSize.Y, {
236
+ duration = props.duration,
237
+ })
238
+ if props.duration == 0 then
239
+ heightTween:setPosition(instance.AbsoluteSize.Y)
240
+ end
241
+ heightTween:start()
242
+ end
243
+ end,
244
+ },
245
+ }, React.createElement(Padding, {
246
+ resolvedPadding = SpacingHelper:GetResolvedPadding(theme, {}, theme.components.accordion.content.spacing),
247
+ }), if props.contentText ~= nil then React.createElement(Text, {
248
+ text = props.contentText,
249
+ }) else props.content)))))
250
+ end
251
+ local Accordion = React.forwardRef(function(props, ref)
252
+ local theme = React.useContext(CleanThemeContext)
253
+ local items = React.useMemo(function()
254
+ local parsed = {}
255
+ local seen = {}
256
+ React.Children.forEach(props.children, function(child)
257
+ if not React.isValidElement(child) or child.type ~= AccordionItem then
258
+ return nil
259
+ end
260
+ local item = child
261
+ local _value = item.props.value
262
+ if seen[_value] ~= nil then
263
+ return nil
264
+ end
265
+ local header
266
+ local contentText
267
+ local content
268
+ React.Children.forEach(item.props.children, function(itemChild)
269
+ if not React.isValidElement(itemChild) then
270
+ return nil
271
+ end
272
+ if itemChild.type == AccordionHeader and header == nil then
273
+ header = itemChild.props
274
+ end
275
+ if itemChild.type == AccordionContent and content == nil then
276
+ local contentProps = itemChild.props
277
+ contentText = contentProps.text
278
+ content = contentProps.children
279
+ end
280
+ end)
281
+ if header ~= nil then
282
+ local _value_1 = item.props.value
283
+ seen[_value_1] = true
284
+ local _object = {
285
+ value = item.props.value,
286
+ }
287
+ local _left = "disabled"
288
+ local _condition = item.props.disabled
289
+ if _condition == nil then
290
+ _condition = false
291
+ end
292
+ _object[_left] = _condition
293
+ _object.header = header
294
+ _object.contentText = contentText
295
+ _object.content = content
296
+ table.insert(parsed, _object)
297
+ end
298
+ end)
299
+ return parsed
300
+ end, { props.children })
301
+ local initial = if props.defaultValue ~= nil then { props.defaultValue } else {}
302
+ local uncontrolled, setUncontrolled = React.useState(initial)
303
+ local supplied = if props.value ~= nil then { props.value } else uncontrolled
304
+ local _set = {}
305
+ -- ▼ ReadonlyArray.map ▼
306
+ local _newValue = table.create(#items)
307
+ local _callback = function(item)
308
+ return item.value
309
+ end
310
+ for _k, _v in items do
311
+ _newValue[_k] = _callback(_v, _k - 1, items)
312
+ end
313
+ -- ▲ ReadonlyArray.map ▲
314
+ for _, _v in _newValue do
315
+ _set[_v] = true
316
+ end
317
+ local available = _set
318
+ -- ▼ ReadonlyArray.filter ▼
319
+ local _newValue_1 = {}
320
+ local _callback_1 = function(value)
321
+ local _value = value
322
+ return available[_value] ~= nil
323
+ end
324
+ local _length = 0
325
+ for _k, _v in supplied do
326
+ if _callback_1(_v, _k - 1, supplied) == true then
327
+ _length += 1
328
+ _newValue_1[_length] = _v
329
+ end
330
+ end
331
+ -- ▲ ReadonlyArray.filter ▲
332
+ local openValues = _newValue_1
333
+ React.useEffect(function()
334
+ local _condition = props.value == nil
335
+ if _condition then
336
+ local _condition_1 = #uncontrolled ~= #openValues
337
+ if not _condition_1 then
338
+ -- ▼ ReadonlyArray.some ▼
339
+ local _result = false
340
+ local _callback_2 = function(value)
341
+ local _value = value
342
+ return not (available[_value] ~= nil)
343
+ end
344
+ for _k, _v in uncontrolled do
345
+ if _callback_2(_v, _k - 1, uncontrolled) then
346
+ _result = true
347
+ break
348
+ end
349
+ end
350
+ -- ▲ ReadonlyArray.some ▲
351
+ _condition_1 = _result
352
+ end
353
+ _condition = _condition_1
354
+ end
355
+ if _condition then
356
+ setUncontrolled(openValues)
357
+ end
358
+ end, { items, props.value })
359
+ local activate = function(item)
360
+ if item.disabled or (item.content == nil and item.contentText == nil) then
361
+ return nil
362
+ end
363
+ local _value = item.value
364
+ local isOpen = table.find(openValues, _value) ~= nil
365
+ local nextValues
366
+ if isOpen then
367
+ if not props.collapsible then
368
+ return nil
369
+ end
370
+ nextValues = {}
371
+ else
372
+ nextValues = { item.value }
373
+ end
374
+ if props.value == nil then
375
+ setUncontrolled(nextValues)
376
+ end
377
+ local _result = props.onValueChange
378
+ if _result ~= nil then
379
+ _result(nextValues[1])
380
+ end
381
+ end
382
+ local _exp = React.createElement(Corners, {
383
+ radius = theme.components.accordion.cornerRadius,
384
+ })
385
+ local _exp_1 = React.createElement("uistroke", {
386
+ Color = theme.components.accordion.borderColor,
387
+ Thickness = theme.components.accordion.borderThickness,
388
+ BorderStrokePosition = Enum.BorderStrokePosition.Outer,
389
+ })
390
+ -- ▼ ReadonlyArray.map ▼
391
+ local _newValue_2 = table.create(#items)
392
+ local _callback_2 = function(item, index)
393
+ local _attributes = {
394
+ key = item.value,
395
+ }
396
+ for _k, _v in item do
397
+ _attributes[_k] = _v
398
+ end
399
+ _attributes.first = index == 0
400
+ local _value = item.value
401
+ _attributes.open = table.find(openValues, _value) ~= nil
402
+ local _condition = props.animationDuration
403
+ if _condition == nil then
404
+ _condition = theme.components.accordion.animation.duration
405
+ end
406
+ _attributes.duration = _condition
407
+ _attributes.onActivate = function()
408
+ return activate(item)
409
+ end
410
+ return React.createElement(RenderedAccordionItem, _attributes)
411
+ end
412
+ for _k, _v in items do
413
+ _newValue_2[_k] = _callback_2(_v, _k - 1, items)
414
+ end
415
+ -- ▲ ReadonlyArray.map ▲
416
+ return React.createElement(Container, {
417
+ ref = ref,
418
+ width = "100%",
419
+ height = "100%",
420
+ ClipsDescendants = true,
421
+ }, _exp, _exp_1, React.createElement(VStack, {
422
+ Padding = UDim.new(0, SpacingHelper:GetPadding(theme, props.scale, theme.components.accordion.spacing)),
423
+ }, _newValue_2))
424
+ end)
425
+ Accordion.Item = AccordionItem
426
+ Accordion.Header = AccordionHeader
427
+ Accordion.Content = AccordionContent
428
+ return {
429
+ Accordion = Accordion,
430
+ }
@@ -1,13 +1,7 @@
1
- import React, { Component } from "@rbxts/react";
2
- import { RowContext } from "../../Contexts/";
1
+ import React from "@rbxts/react";
3
2
  import { ResponsiveGridSpan } from "../../Interfaces/";
4
3
  interface ColumnProps {
5
4
  span?: ResponsiveGridSpan | number | `${number}`;
6
5
  }
7
- export declare class Column extends Component<ColumnProps> {
8
- static contextType: React.Context<import("../../Contexts/row.context").RowContextValue>;
9
- context: React.ContextType<typeof RowContext>;
10
- private getSpan;
11
- render(): React.JSX.Element;
12
- }
6
+ export declare const Column: React.ForwardRefExoticComponent<ColumnProps & React.RefAttributes<Frame>>;
13
7
  export {};
@@ -1,60 +1,40 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
- local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
- local React = _react
5
- local Component = _react.Component
6
- local ReactComponent = _react.ReactComponent
3
+ local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
4
  local RowContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").RowContext
8
5
  local BreakpointHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").BreakpointHelper
9
- local Column
10
- do
11
- local super = Component
12
- Column = setmetatable({}, {
13
- __tostring = function()
14
- return "Column"
15
- end,
16
- __index = super,
17
- })
18
- Column.__index = Column
19
- function Column.new(...)
20
- local self = setmetatable({}, Column)
21
- return self:constructor(...) or self
6
+ local function resolveSpan(span, children, breakpoint)
7
+ if span == nil then
8
+ return math.floor(12 / math.max(children, 1))
22
9
  end
23
- function Column:constructor(...)
24
- super.constructor(self, ...)
10
+ local _span = span
11
+ if type(_span) == "number" then
12
+ return span
25
13
  end
26
- function Column:getSpan()
27
- local span = self.props.span
28
- if span == nil then
29
- return math.floor(12 / math.max(self.context.children, 1))
14
+ local _span_1 = span
15
+ if type(_span_1) == "string" then
16
+ local _condition = tonumber(span)
17
+ if _condition == nil then
18
+ _condition = 12
30
19
  end
31
- if type(span) == "number" then
32
- return span
33
- end
34
- if type(span) == "string" then
35
- local _condition = tonumber(span)
36
- if _condition == nil then
37
- _condition = 12
38
- end
39
- return _condition
40
- end
41
- return BreakpointHelper:getValue(self.context.breakpoint, span) or 12
42
- end
43
- function Column:render()
44
- local span = self:getSpan()
45
- local fraction = math.floor((span / 12) * 1000) / 1000
46
- local padding = self.context.padding
47
- local widthScale = fraction + ((fraction - 1) * padding.Scale)
48
- local widthOffset = (fraction - 1) * padding.Offset
49
- return React.createElement("frame", {
50
- Size = UDim2.new(widthScale, widthOffset, 0, 0),
51
- AutomaticSize = Enum.AutomaticSize.Y,
52
- BackgroundTransparency = 1,
53
- }, self.props.children)
20
+ return _condition
54
21
  end
55
- Column.contextType = RowContext
56
- Column = ReactComponent(Column) or Column
22
+ return BreakpointHelper:getValue(breakpoint, span) or 12
57
23
  end
24
+ local Column = React.forwardRef(function(props, ref)
25
+ local context = React.useContext(RowContext)
26
+ local span = resolveSpan(props.span, context.children, context.breakpoint)
27
+ local fraction = math.floor((span / 12) * 1000) / 1000
28
+ local padding = context.padding
29
+ local widthScale = fraction + ((fraction - 1) * padding.Scale)
30
+ local widthOffset = (fraction - 1) * padding.Offset
31
+ return React.createElement("frame", {
32
+ ref = ref,
33
+ Size = UDim2.new(widthScale, widthOffset, 0, 0),
34
+ AutomaticSize = Enum.AutomaticSize.Y,
35
+ BackgroundTransparency = 1,
36
+ }, props.children)
37
+ end)
58
38
  return {
59
39
  Column = Column,
60
40
  }
@@ -7,13 +7,16 @@ local Group = _Group.Group
7
7
  local GroupContext = _Group.GroupContext
8
8
  local Container = React.forwardRef(function(props, ref)
9
9
  local group = React.useContext(GroupContext)
10
+ local autoSize = SizeHelper:GetAutoSize(props)
11
+ local isAutoSizeActive = autoSize ~= Enum.AutomaticSize.None and autoSize ~= "None"
12
+ local centerViaLayout = props.center == true and props.Position == nil and props.AnchorPoint == nil and isAutoSizeActive
10
13
  local _attributes = {
11
14
  ref = ref,
12
15
  Archivable = props.Archivable,
13
16
  Tag = props.Tag,
14
17
  Active = props.Active,
15
- AnchorPoint = SizeHelper:GetAnchor(props),
16
- AutomaticSize = SizeHelper:GetAutoSize(props),
18
+ AnchorPoint = if centerViaLayout then Vector2.zero else SizeHelper:GetAnchor(props),
19
+ AutomaticSize = autoSize,
17
20
  BackgroundColor3 = props.BackgroundColor3,
18
21
  }
19
22
  local _condition = props.BackgroundTransparency
@@ -31,7 +34,7 @@ local Container = React.forwardRef(function(props, ref)
31
34
  _attributes.NextSelectionLeft = props.NextSelectionLeft
32
35
  _attributes.NextSelectionRight = props.NextSelectionRight
33
36
  _attributes.NextSelectionUp = props.NextSelectionUp
34
- _attributes.Position = SizeHelper:GetPosition(props)
37
+ _attributes.Position = if centerViaLayout then UDim2.fromOffset(0, 0) else SizeHelper:GetPosition(props)
35
38
  _attributes.Rotation = props.Rotation
36
39
  _attributes.Selectable = props.Selectable
37
40
  _attributes.SelectionGroup = props.SelectionGroup
@@ -64,9 +67,22 @@ local Container = React.forwardRef(function(props, ref)
64
67
  _attributes.Style = props.Style
65
68
  _attributes.Change = props.Change
66
69
  _attributes.Event = props.Event
67
- return React.createElement("frame", _attributes, React.createElement(Group.Element, {
70
+ local content = (React.createElement("frame", _attributes, React.createElement(Group.Element, {
68
71
  enabled = props.group,
69
- }, props.children))
72
+ }, props.children)))
73
+ if not centerViaLayout then
74
+ return content
75
+ end
76
+ return React.createElement("frame", {
77
+ Size = UDim2.fromScale(1, 1),
78
+ BackgroundTransparency = 1,
79
+ ZIndex = props.ZIndex,
80
+ LayoutOrder = props.LayoutOrder,
81
+ }, React.createElement("uilistlayout", {
82
+ FillDirection = Enum.FillDirection.Horizontal,
83
+ HorizontalAlignment = Enum.HorizontalAlignment.Center,
84
+ VerticalAlignment = Enum.VerticalAlignment.Center,
85
+ }), content)
70
86
  end)
71
87
  return {
72
88
  Container = Container,