@rbxts/react-clean-ui 1.0.36 → 1.1.0
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.
- package/out/Components/Decorator/Corners.luau +5 -1
- package/out/Components/Decorator/Padding.luau +1 -1
- package/out/Components/Input/Button.d.ts +9 -0
- package/out/Components/Input/Button.luau +155 -46
- package/out/Components/Input/Checkbox.luau +22 -6
- package/out/Components/Input/Increment.d.ts +11 -0
- package/out/Components/Input/Increment.luau +107 -0
- package/out/Components/Input/Increment.step.d.ts +1 -0
- package/out/Components/Input/Increment.step.luau +25 -0
- package/out/Components/Input/Input.d.ts +4 -3
- package/out/Components/Input/Input.luau +115 -18
- package/out/Components/Input/Input.validation.d.ts +4 -0
- package/out/Components/Input/Input.validation.luau +42 -0
- package/out/Components/Input/Select.d.ts +4 -3
- package/out/Components/Input/Select.luau +23 -18
- package/out/Components/Input/Slider.d.ts +1 -1
- package/out/Components/Input/Slider.luau +68 -34
- package/out/Components/Input/index.d.ts +1 -0
- package/out/Components/Input/init.luau +3 -0
- package/out/Components/Layout/Accordion.d.ts +4 -4
- package/out/Components/Layout/Accordion.luau +75 -23
- package/out/Components/Layout/Container.d.ts +4 -2
- package/out/Components/Layout/Container.luau +12 -3
- package/out/Components/Layout/Draggable.luau +1 -1
- package/out/Components/Layout/Fieldset.d.ts +1 -1
- package/out/Components/Layout/Fieldset.luau +40 -6
- package/out/Components/Layout/FlexItem.d.ts +2 -1
- package/out/Components/Layout/FlexItem.luau +1 -0
- package/out/Components/Layout/Group.luau +30 -8
- package/out/Components/Layout/HStack.luau +1 -0
- package/out/Components/Layout/Row.luau +43 -9
- package/out/Components/Layout/Scroller.d.ts +1 -0
- package/out/Components/Layout/Scroller.luau +20 -5
- package/out/Components/Layout/Tabs.d.ts +5 -3
- package/out/Components/Layout/Tabs.luau +48 -16
- package/out/Components/Navigation/Menu.d.ts +1 -1
- package/out/Components/Navigation/Menu.luau +2 -0
- package/out/Components/Surface/Box.d.ts +4 -2
- package/out/Components/Surface/Box.luau +25 -22
- package/out/Components/Surface/Card.d.ts +12 -6
- package/out/Components/Surface/Card.luau +456 -26
- package/out/Components/Surface/Icon.luau +42 -4
- package/out/Components/Typography/Text.d.ts +1 -0
- package/out/Components/Typography/Text.luau +119 -10
- package/out/Contexts/row.context.d.ts +1 -1
- package/out/Contexts/theme.context.d.ts +2 -2
- package/out/Helpers/color.helper.d.ts +5 -3
- package/out/Helpers/color.helper.luau +62 -34
- package/out/Helpers/create-ui-story.d.ts +2 -2
- package/out/Helpers/create-ui-story.luau +33 -1
- package/out/Helpers/css.helper.d.ts +28 -2
- package/out/Helpers/css.helper.luau +208 -0
- package/out/Helpers/index.d.ts +1 -0
- package/out/Helpers/init.luau +3 -0
- package/out/Helpers/size.helper.d.ts +3 -1
- package/out/Helpers/size.helper.luau +10 -9
- package/out/Helpers/spacing.helper.d.ts +5 -4
- package/out/Helpers/spacing.helper.luau +102 -18
- package/out/Helpers/typography.helper.d.ts +2 -2
- package/out/Interfaces/css.types.d.ts +30 -0
- package/out/Interfaces/css.types.luau +21 -0
- package/out/Interfaces/element.props.d.ts +61 -0
- package/out/Interfaces/element.props.luau +1 -0
- package/out/Interfaces/index.d.ts +5 -3
- package/out/Interfaces/init.luau +1 -7
- package/out/Interfaces/responsive.types.d.ts +26 -0
- package/out/Interfaces/semantics.d.ts +3 -0
- package/out/Interfaces/semantics.luau +2 -0
- package/out/Providers/app.provider.d.ts +2 -2
- package/out/Providers/theme.provider.d.ts +2 -2
- package/out/Theme/index.d.ts +1 -0
- package/out/Theme/theme.factory.d.ts +3 -3
- package/out/Theme/theme.style.d.ts +48 -0
- package/out/Theme/theme.style.luau +1 -0
- package/out/Theme/theme.template.d.ts +34 -26
- package/out/Theme/themes/dark.theme.d.ts +1 -1
- package/out/Theme/themes/dark.theme.luau +28 -0
- package/out/Theme/themes/default.theme.d.ts +2 -2
- package/out/Theme/themes/default.theme.luau +11 -1
- package/out/Theme/themes/index.d.ts +1 -0
- package/out/Theme/themes/init.luau +3 -0
- package/out/Theme/themes/sandstone.theme.d.ts +1 -1
- package/out/Theme/themes/sandstone.theme.luau +25 -0
- package/out/Theme/themes/wooden.theme.d.ts +1 -0
- package/out/Theme/themes/wooden.theme.luau +554 -0
- package/out/index.d.ts +8 -8
- package/package.json +19 -7
- package/out/Interfaces/clean.element.props.d.ts +0 -114
- /package/out/{Interfaces/userinput.d.ts → Helpers/input.helper.d.ts} +0 -0
- /package/out/{Interfaces/userinput.luau → Helpers/input.helper.luau} +0 -0
- /package/out/Interfaces/{clean.element.props.luau → responsive.types.luau} +0 -0
|
@@ -5,6 +5,7 @@ local useTween = TS.import(script, TS.getModule(script, "@rbxts", "react-ripple"
|
|
|
5
5
|
local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
|
|
6
6
|
local _Helpers = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
7
7
|
local ColorHelper = _Helpers.ColorHelper
|
|
8
|
+
local CssHelper = _Helpers.CssHelper
|
|
8
9
|
local SizeHelper = _Helpers.SizeHelper
|
|
9
10
|
local SpacingHelper = _Helpers.SpacingHelper
|
|
10
11
|
local TypographyHelper = _Helpers.TypographyHelper
|
|
@@ -53,11 +54,11 @@ local function AccordionHeaderVisual(props)
|
|
|
53
54
|
end
|
|
54
55
|
local state = _result
|
|
55
56
|
local colors = ColorHelper:getIntentColors(theme, "primary", state, theme.components.accordion.header.intents)
|
|
56
|
-
local rotation, rotationTween = useTween(if props.open then
|
|
57
|
+
local rotation, rotationTween = useTween(if props.open then 180 else 0, {
|
|
57
58
|
duration = props.duration,
|
|
58
59
|
})
|
|
59
60
|
React.useEffect(function()
|
|
60
|
-
local goal = if props.open then
|
|
61
|
+
local goal = if props.open then 180 else 0
|
|
61
62
|
rotationTween:setGoal(goal, {
|
|
62
63
|
duration = props.duration,
|
|
63
64
|
})
|
|
@@ -75,7 +76,7 @@ local function AccordionHeaderVisual(props)
|
|
|
75
76
|
return props.header.children
|
|
76
77
|
end
|
|
77
78
|
local _exp = React.createElement(Padding, {
|
|
78
|
-
resolvedPadding = SpacingHelper:GetResolvedPadding(theme,
|
|
79
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, props.header, theme.components.accordion.header.spacing, theme.components.accordion.header.padding),
|
|
79
80
|
})
|
|
80
81
|
local _exp_1 = props.header.icon ~= nil and React.createElement(Icon, {
|
|
81
82
|
icon = props.header.icon,
|
|
@@ -103,12 +104,13 @@ local function AccordionHeaderVisual(props)
|
|
|
103
104
|
}, _exp_1, React.createElement(Container, {
|
|
104
105
|
Size = UDim2.new(1, theme.components.accordion.header.indicatorSize, 0, 0),
|
|
105
106
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
106
|
-
}, _result_1), React.createElement(Icon, {
|
|
107
|
+
}, _result_1), React.createElement(Container, nil, React.createElement(Icon, {
|
|
107
108
|
icon = "chevron-down",
|
|
108
109
|
color = if props.disabled then colors.textColor else theme.components.accordion.header.indicatorColor,
|
|
109
110
|
Size = UDim2.fromOffset(theme.components.accordion.header.indicatorSize, theme.components.accordion.header.indicatorSize),
|
|
111
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
110
112
|
Rotation = rotation,
|
|
111
|
-
})))
|
|
113
|
+
}))))
|
|
112
114
|
end
|
|
113
115
|
local function RenderedAccordionItem(props)
|
|
114
116
|
local theme = React.useContext(CleanThemeContext)
|
|
@@ -116,6 +118,43 @@ local function RenderedAccordionItem(props)
|
|
|
116
118
|
local height, heightTween = useTween(0, {
|
|
117
119
|
duration = props.duration,
|
|
118
120
|
})
|
|
121
|
+
local contentRef = React.useRef()
|
|
122
|
+
local onContentSizeRef = React.useRef()
|
|
123
|
+
onContentSizeRef.current = function(instance)
|
|
124
|
+
if props.open then
|
|
125
|
+
heightTween:setGoal(instance.AbsoluteSize.Y, {
|
|
126
|
+
duration = props.duration,
|
|
127
|
+
})
|
|
128
|
+
if props.duration == 0 then
|
|
129
|
+
heightTween:setPosition(instance.AbsoluteSize.Y)
|
|
130
|
+
end
|
|
131
|
+
heightTween:start()
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
React.useEffect(function()
|
|
135
|
+
local frame = contentRef.current
|
|
136
|
+
if not frame then
|
|
137
|
+
return nil
|
|
138
|
+
end
|
|
139
|
+
-- Some renderers (e.g. the browser-based Loom scene preview) don't back
|
|
140
|
+
-- this ref with an instance that supports property-changed signals, so
|
|
141
|
+
-- guard the subscription instead of throwing and losing height tracking.
|
|
142
|
+
local conn
|
|
143
|
+
pcall(function()
|
|
144
|
+
conn = frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
|
|
145
|
+
local _result = onContentSizeRef.current
|
|
146
|
+
if _result ~= nil then
|
|
147
|
+
_result(frame)
|
|
148
|
+
end
|
|
149
|
+
end)
|
|
150
|
+
end)
|
|
151
|
+
return function()
|
|
152
|
+
local _result = conn
|
|
153
|
+
if _result ~= nil then
|
|
154
|
+
_result:Disconnect()
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end, { mounted })
|
|
119
158
|
React.useEffect(function()
|
|
120
159
|
if props.open then
|
|
121
160
|
setMounted(true)
|
|
@@ -147,6 +186,9 @@ local function RenderedAccordionItem(props)
|
|
|
147
186
|
local defaultColors = ColorHelper:getIntentColors(theme, "primary", if props.disabled then "disabled" else "default", theme.components.accordion.header.intents)
|
|
148
187
|
local hoverColors = ColorHelper:getIntentColors(theme, "primary", "hover", theme.components.accordion.header.intents)
|
|
149
188
|
local focusColors = ColorHelper:getIntentColors(theme, "primary", "focus", theme.components.accordion.header.intents)
|
|
189
|
+
local defaultBackgroundImage = CssHelper:resolveBackgroundImage(defaultColors.backgroundImage)
|
|
190
|
+
local hoverBackgroundImage = CssHelper:resolveBackgroundImage(hoverColors.backgroundImage)
|
|
191
|
+
local focusBackgroundImage = CssHelper:resolveBackgroundImage(focusColors.backgroundImage)
|
|
150
192
|
local _condition = not props.first
|
|
151
193
|
if _condition then
|
|
152
194
|
local _attributes = {
|
|
@@ -163,12 +205,11 @@ local function RenderedAccordionItem(props)
|
|
|
163
205
|
isSelected = props.open,
|
|
164
206
|
}
|
|
165
207
|
local _object = {
|
|
166
|
-
Active = not props.disabled and props.content ~= nil,
|
|
167
|
-
Selectable = not props.disabled and props.content ~= nil,
|
|
208
|
+
Active = not props.disabled and (props.content ~= nil or props.contentText ~= nil),
|
|
209
|
+
Selectable = not props.disabled and (props.content ~= nil or props.contentText ~= nil),
|
|
168
210
|
AutoButtonColor = false,
|
|
169
211
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
170
212
|
Size = UDim2.fromScale(1, 0),
|
|
171
|
-
ImageTransparency = 1,
|
|
172
213
|
BackgroundColor3 = defaultColors.backgroundColor,
|
|
173
214
|
}
|
|
174
215
|
local _left = "BackgroundTransparency"
|
|
@@ -178,6 +219,13 @@ local function RenderedAccordionItem(props)
|
|
|
178
219
|
end
|
|
179
220
|
_object[_left] = _condition_1
|
|
180
221
|
_object.BorderSizePixel = 0
|
|
222
|
+
_object.Image = defaultBackgroundImage.Image
|
|
223
|
+
_object.ImageColor3 = defaultBackgroundImage.ImageColor3
|
|
224
|
+
_object.ImageTransparency = defaultBackgroundImage.ImageTransparency
|
|
225
|
+
_object.ScaleType = defaultBackgroundImage.ScaleType
|
|
226
|
+
_object.SliceCenter = defaultBackgroundImage.SliceCenter
|
|
227
|
+
_object.SliceScale = defaultBackgroundImage.SliceScale
|
|
228
|
+
_object.TileSize = defaultBackgroundImage.TileSize
|
|
181
229
|
_object.Event = {
|
|
182
230
|
Activated = props.onActivate,
|
|
183
231
|
}
|
|
@@ -191,6 +239,13 @@ local function RenderedAccordionItem(props)
|
|
|
191
239
|
_condition_2 = 0
|
|
192
240
|
end
|
|
193
241
|
_object_1[_left_1] = _condition_2
|
|
242
|
+
_object_1.Image = hoverBackgroundImage.Image
|
|
243
|
+
_object_1.ImageColor3 = hoverBackgroundImage.ImageColor3
|
|
244
|
+
_object_1.ImageTransparency = hoverBackgroundImage.ImageTransparency
|
|
245
|
+
_object_1.ScaleType = hoverBackgroundImage.ScaleType
|
|
246
|
+
_object_1.SliceCenter = hoverBackgroundImage.SliceCenter
|
|
247
|
+
_object_1.SliceScale = hoverBackgroundImage.SliceScale
|
|
248
|
+
_object_1.TileSize = hoverBackgroundImage.TileSize
|
|
194
249
|
_attributes.hover = _object_1
|
|
195
250
|
local _object_2 = {
|
|
196
251
|
BackgroundColor3 = focusColors.backgroundColor,
|
|
@@ -201,6 +256,13 @@ local function RenderedAccordionItem(props)
|
|
|
201
256
|
_condition_3 = 0
|
|
202
257
|
end
|
|
203
258
|
_object_2[_left_2] = _condition_3
|
|
259
|
+
_object_2.Image = focusBackgroundImage.Image
|
|
260
|
+
_object_2.ImageColor3 = focusBackgroundImage.ImageColor3
|
|
261
|
+
_object_2.ImageTransparency = focusBackgroundImage.ImageTransparency
|
|
262
|
+
_object_2.ScaleType = focusBackgroundImage.ScaleType
|
|
263
|
+
_object_2.SliceCenter = focusBackgroundImage.SliceCenter
|
|
264
|
+
_object_2.SliceScale = focusBackgroundImage.SliceScale
|
|
265
|
+
_object_2.TileSize = focusBackgroundImage.TileSize
|
|
204
266
|
_attributes.focus = _object_2
|
|
205
267
|
return React.createElement(Container, {
|
|
206
268
|
width = "100%",
|
|
@@ -225,25 +287,13 @@ local function RenderedAccordionItem(props)
|
|
|
225
287
|
return _exp + _arg0
|
|
226
288
|
end),
|
|
227
289
|
}, React.createElement("frame", {
|
|
290
|
+
ref = contentRef,
|
|
228
291
|
BackgroundColor3 = theme.components.accordion.content.backgroundColor,
|
|
229
292
|
BackgroundTransparency = theme.components.accordion.content.backgroundTransparency,
|
|
230
293
|
Size = UDim2.fromScale(1, 0),
|
|
231
294
|
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
295
|
}, React.createElement(Padding, {
|
|
246
|
-
resolvedPadding = SpacingHelper:GetResolvedPadding(theme,
|
|
296
|
+
resolvedPadding = SpacingHelper:GetResolvedPadding(theme, props.contentProps, theme.components.accordion.content.spacing, theme.components.accordion.content.padding),
|
|
247
297
|
}), if props.contentText ~= nil then React.createElement(Text, {
|
|
248
298
|
text = props.contentText,
|
|
249
299
|
}) else props.content)))))
|
|
@@ -263,6 +313,7 @@ local Accordion = React.forwardRef(function(props, ref)
|
|
|
263
313
|
return nil
|
|
264
314
|
end
|
|
265
315
|
local header
|
|
316
|
+
local contentProps
|
|
266
317
|
local contentText
|
|
267
318
|
local content
|
|
268
319
|
React.Children.forEach(item.props.children, function(itemChild)
|
|
@@ -273,7 +324,7 @@ local Accordion = React.forwardRef(function(props, ref)
|
|
|
273
324
|
header = itemChild.props
|
|
274
325
|
end
|
|
275
326
|
if itemChild.type == AccordionContent and content == nil then
|
|
276
|
-
|
|
327
|
+
contentProps = itemChild.props
|
|
277
328
|
contentText = contentProps.text
|
|
278
329
|
content = contentProps.children
|
|
279
330
|
end
|
|
@@ -291,6 +342,7 @@ local Accordion = React.forwardRef(function(props, ref)
|
|
|
291
342
|
end
|
|
292
343
|
_object[_left] = _condition
|
|
293
344
|
_object.header = header
|
|
345
|
+
_object.contentProps = contentProps or {}
|
|
294
346
|
_object.contentText = contentText
|
|
295
347
|
_object.content = content
|
|
296
348
|
table.insert(parsed, _object)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
2
|
import { PositionElementProps, SizeElementProps, ZIndexElementProps } from "../../Interfaces/";
|
|
3
|
-
|
|
3
|
+
import { CssBackgroundImage } from "../../Theme";
|
|
4
|
+
export interface ContainerProps extends SizeElementProps, PositionElementProps, ZIndexElementProps, React.InstanceProps<ImageLabel> {
|
|
4
5
|
group?: boolean;
|
|
6
|
+
backgroundImage?: Partial<CssBackgroundImage>;
|
|
5
7
|
}
|
|
6
|
-
export declare const Container: React.ForwardRefExoticComponent<Omit<ContainerProps, "ref"> & React.RefAttributes<
|
|
8
|
+
export declare const Container: React.ForwardRefExoticComponent<Omit<ContainerProps, "ref"> & React.RefAttributes<ImageLabel>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
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
|
|
4
|
+
local _ = TS.import(script, script.Parent.Parent.Parent, "Helpers")
|
|
5
|
+
local SizeHelper = _.SizeHelper
|
|
6
|
+
local CssHelper = _.CssHelper
|
|
5
7
|
local _Group = TS.import(script, script.Parent, "Group")
|
|
6
8
|
local Group = _Group.Group
|
|
7
9
|
local GroupContext = _Group.GroupContext
|
|
@@ -10,6 +12,7 @@ local Container = React.forwardRef(function(props, ref)
|
|
|
10
12
|
local autoSize = SizeHelper:GetAutoSize(props)
|
|
11
13
|
local isAutoSizeActive = autoSize ~= Enum.AutomaticSize.None and autoSize ~= "None"
|
|
12
14
|
local centerViaLayout = props.center == true and props.Position == nil and props.AnchorPoint == nil and isAutoSizeActive
|
|
15
|
+
local backgroundImage = CssHelper:resolveBackgroundImage(props.backgroundImage)
|
|
13
16
|
local _attributes = {
|
|
14
17
|
ref = ref,
|
|
15
18
|
Archivable = props.Archivable,
|
|
@@ -64,10 +67,16 @@ local Container = React.forwardRef(function(props, ref)
|
|
|
64
67
|
_attributes.ZIndex = props.ZIndex
|
|
65
68
|
_attributes.AutoLocalize = props.AutoLocalize
|
|
66
69
|
_attributes.RootLocalizationTable = props.RootLocalizationTable
|
|
67
|
-
_attributes.
|
|
70
|
+
_attributes.Image = backgroundImage.Image
|
|
71
|
+
_attributes.ImageColor3 = backgroundImage.ImageColor3
|
|
72
|
+
_attributes.ImageTransparency = backgroundImage.ImageTransparency
|
|
73
|
+
_attributes.ScaleType = backgroundImage.ScaleType
|
|
74
|
+
_attributes.SliceCenter = backgroundImage.SliceCenter
|
|
75
|
+
_attributes.SliceScale = backgroundImage.SliceScale
|
|
76
|
+
_attributes.TileSize = backgroundImage.TileSize
|
|
68
77
|
_attributes.Change = props.Change
|
|
69
78
|
_attributes.Event = props.Event
|
|
70
|
-
local content = (React.createElement("
|
|
79
|
+
local content = (React.createElement("imagelabel", _attributes, React.createElement(Group.Element, {
|
|
71
80
|
enabled = props.group,
|
|
72
81
|
}, props.children)))
|
|
73
82
|
if not centerViaLayout then
|
|
@@ -12,7 +12,7 @@ local DraggableContext = _Contexts.DraggableContext
|
|
|
12
12
|
local OverlayConsumer = _Contexts.OverlayConsumer
|
|
13
13
|
local createPortal = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox")).createPortal
|
|
14
14
|
local Corners = TS.import(script, script.Parent.Parent, "Decorator").Corners
|
|
15
|
-
local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "
|
|
15
|
+
local CustomInputService = TS.import(script, script.Parent.Parent.Parent, "Helpers").CustomInputService
|
|
16
16
|
local function DragHandle(_param)
|
|
17
17
|
local children = _param.children
|
|
18
18
|
local draggable = React.useContext(DraggableContext)
|
|
@@ -16,7 +16,7 @@ interface FieldsetSlotProps {
|
|
|
16
16
|
}
|
|
17
17
|
declare function FieldsetLabel(props: FieldsetSlotProps): React.JSX.Element;
|
|
18
18
|
declare function FieldsetControl(props: FieldsetSlotProps): React.JSX.Element;
|
|
19
|
-
type FieldsetComponent = React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<
|
|
19
|
+
type FieldsetComponent = React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<ImageLabel>> & {
|
|
20
20
|
Label: typeof FieldsetLabel;
|
|
21
21
|
Control: typeof FieldsetControl;
|
|
22
22
|
};
|
|
@@ -45,6 +45,45 @@ local Fieldset = React.forwardRef(function(props, ref)
|
|
|
45
45
|
labelActivated:Destroy()
|
|
46
46
|
end
|
|
47
47
|
end, {})
|
|
48
|
+
local containerRef = React.useRef()
|
|
49
|
+
local setContainerRef = function(instance)
|
|
50
|
+
containerRef.current = instance
|
|
51
|
+
local _ref = ref
|
|
52
|
+
if type(_ref) == "function" then
|
|
53
|
+
ref(instance)
|
|
54
|
+
else
|
|
55
|
+
local _condition = ref ~= nil
|
|
56
|
+
if _condition then
|
|
57
|
+
local _ref_1 = ref
|
|
58
|
+
_condition = type(_ref_1) == "table"
|
|
59
|
+
end
|
|
60
|
+
if _condition then
|
|
61
|
+
ref.current = instance
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
React.useEffect(function()
|
|
66
|
+
local frame = containerRef.current
|
|
67
|
+
if not frame then
|
|
68
|
+
return nil
|
|
69
|
+
end
|
|
70
|
+
-- Some renderers (e.g. the browser-based Loom scene preview) don't
|
|
71
|
+
-- back this ref with an instance that supports property-changed
|
|
72
|
+
-- signals, so guard the subscription instead of throwing and
|
|
73
|
+
-- losing breakpoint width tracking.
|
|
74
|
+
local conn
|
|
75
|
+
pcall(function()
|
|
76
|
+
conn = frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
|
|
77
|
+
return setWidth(frame.AbsoluteSize.X)
|
|
78
|
+
end)
|
|
79
|
+
end)
|
|
80
|
+
return function()
|
|
81
|
+
local _result = conn
|
|
82
|
+
if _result ~= nil then
|
|
83
|
+
_result:Disconnect()
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end, {})
|
|
48
87
|
local fieldsetContext = React.useMemo(function()
|
|
49
88
|
local _object = {}
|
|
50
89
|
local _left = "disabled"
|
|
@@ -68,12 +107,7 @@ local Fieldset = React.forwardRef(function(props, ref)
|
|
|
68
107
|
return React.createElement(FieldsetContext.Provider, {
|
|
69
108
|
value = fieldsetContext,
|
|
70
109
|
}, React.createElement(Container, {
|
|
71
|
-
ref =
|
|
72
|
-
Change = {
|
|
73
|
-
AbsoluteSize = function(instance)
|
|
74
|
-
setWidth(instance.AbsoluteSize.X)
|
|
75
|
-
end,
|
|
76
|
-
},
|
|
110
|
+
ref = setContainerRef,
|
|
77
111
|
}, React.createElement(HStack, {
|
|
78
112
|
Wraps = wrap,
|
|
79
113
|
valign = "Center",
|
|
@@ -6,6 +6,7 @@ interface FlexItemProps extends ContainerProps {
|
|
|
6
6
|
mode?: Enum.UIFlexMode | "Grow" | "None" | "Shrink" | "Fill" | "Custom" | Binding<Enum.UIFlexMode>;
|
|
7
7
|
GrowRatio?: number;
|
|
8
8
|
ShrinkRatio?: number;
|
|
9
|
+
HorizontalFlex?: Enum.UIFlexAlignment | "None" | "SpaceAround" | "Fill" | Binding<Enum.UIFlexAlignment>;
|
|
9
10
|
}
|
|
10
|
-
export declare const FlexItem: React.ForwardRefExoticComponent<Omit<FlexItemProps, "ref"> & React.RefAttributes<
|
|
11
|
+
export declare const FlexItem: React.ForwardRefExoticComponent<Omit<FlexItemProps, "ref"> & React.RefAttributes<ImageLabel>>;
|
|
11
12
|
export {};
|
|
@@ -11,6 +11,7 @@ local FlexItem = React.forwardRef(function(props, ref)
|
|
|
11
11
|
GrowRatio = props.GrowRatio,
|
|
12
12
|
ShrinkRatio = props.ShrinkRatio,
|
|
13
13
|
}), React.createElement("uilistlayout", {
|
|
14
|
+
HorizontalFlex = props.HorizontalFlex,
|
|
14
15
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
15
16
|
HorizontalAlignment = props.align,
|
|
16
17
|
}), props.children)
|
|
@@ -34,9 +34,7 @@ local function GroupElement(props)
|
|
|
34
34
|
_result_1 = _result_1.removeElement
|
|
35
35
|
end
|
|
36
36
|
React.useEffect(_exp, { enabled, _result_1 })
|
|
37
|
-
|
|
38
|
-
return props.children
|
|
39
|
-
end
|
|
37
|
+
local elementRef = React.useRef()
|
|
40
38
|
local _result_2 = props.padding
|
|
41
39
|
if _result_2 ~= nil then
|
|
42
40
|
_result_2 = _result_2.left
|
|
@@ -71,14 +69,38 @@ local function GroupElement(props)
|
|
|
71
69
|
_condition_4 = 0
|
|
72
70
|
end
|
|
73
71
|
local verticalPadding = _condition_3 + _condition_4
|
|
72
|
+
React.useEffect(function()
|
|
73
|
+
if not enabled then
|
|
74
|
+
return nil
|
|
75
|
+
end
|
|
76
|
+
local frame = elementRef.current
|
|
77
|
+
if not frame or not context then
|
|
78
|
+
return nil
|
|
79
|
+
end
|
|
80
|
+
-- Some renderers (e.g. the browser-based Loom scene preview) don't
|
|
81
|
+
-- back this ref with an instance that supports property-changed
|
|
82
|
+
-- signals, so guard the subscription instead of throwing and
|
|
83
|
+
-- losing size reporting.
|
|
84
|
+
local conn
|
|
85
|
+
pcall(function()
|
|
86
|
+
conn = frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
|
|
87
|
+
context.reportSize(id, Vector2.new(frame.AbsoluteSize.X + horizontalPadding, frame.AbsoluteSize.Y + verticalPadding))
|
|
88
|
+
end)
|
|
89
|
+
end)
|
|
90
|
+
return function()
|
|
91
|
+
local _result_6 = conn
|
|
92
|
+
if _result_6 ~= nil then
|
|
93
|
+
_result_6:Disconnect()
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end, { enabled, context, id, horizontalPadding, verticalPadding })
|
|
97
|
+
if not enabled then
|
|
98
|
+
return props.children
|
|
99
|
+
end
|
|
74
100
|
return React.createElement("frame", {
|
|
101
|
+
ref = elementRef,
|
|
75
102
|
BackgroundTransparency = 1,
|
|
76
103
|
AutomaticSize = Enum.AutomaticSize.XY,
|
|
77
|
-
Change = {
|
|
78
|
-
AbsoluteSize = function(instance)
|
|
79
|
-
context.reportSize(id, Vector2.new(instance.AbsoluteSize.X + horizontalPadding, instance.AbsoluteSize.Y + verticalPadding))
|
|
80
|
-
end,
|
|
81
|
-
},
|
|
82
104
|
}, props.children)
|
|
83
105
|
end
|
|
84
106
|
local function getMaxVector2(map)
|
|
@@ -11,6 +11,7 @@ local function HStack(props)
|
|
|
11
11
|
VerticalAlignment = props.valign,
|
|
12
12
|
Padding = props.Padding or UDim.new(0, math.ceil(SpacingHelper:GetPadding(theme, props.spacing) / 2)),
|
|
13
13
|
Wraps = if props.Wraps == nil then true else props.Wraps,
|
|
14
|
+
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
14
15
|
Change = props.Change,
|
|
15
16
|
Event = props.Event,
|
|
16
17
|
}), props.children)
|
|
@@ -13,6 +13,48 @@ 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
|
|
32
|
+
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)
|
|
49
|
+
end)
|
|
50
|
+
end)
|
|
51
|
+
return function()
|
|
52
|
+
local _result = conn
|
|
53
|
+
if _result ~= nil then
|
|
54
|
+
_result:Disconnect()
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end, {})
|
|
16
58
|
local _exp = React.createElement("uilistlayout", {
|
|
17
59
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
18
60
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
|
@@ -43,18 +85,10 @@ local Row = React.forwardRef(function(props, ref)
|
|
|
43
85
|
_object.breakpoint = BreakpointHelper:getBreakpoint(width, breakpoints)
|
|
44
86
|
_attributes.value = _object
|
|
45
87
|
return React.createElement("frame", {
|
|
46
|
-
ref =
|
|
88
|
+
ref = setRowRef,
|
|
47
89
|
Size = UDim2.fromScale(1, 1),
|
|
48
90
|
AutomaticSize = Enum.AutomaticSize.Y,
|
|
49
91
|
BackgroundTransparency = 1,
|
|
50
|
-
Change = {
|
|
51
|
-
AbsoluteSize = function(instance)
|
|
52
|
-
local nextWidth = instance.AbsoluteSize.X
|
|
53
|
-
setWidth(function(currentWidth)
|
|
54
|
-
return if currentWidth == nextWidth then currentWidth else nextWidth
|
|
55
|
-
end)
|
|
56
|
-
end,
|
|
57
|
-
},
|
|
58
92
|
}, _exp, React.createElement(RowContext.Provider, _attributes, props.children))
|
|
59
93
|
end)
|
|
60
94
|
return {
|
|
@@ -2,6 +2,7 @@ import React from "@rbxts/react";
|
|
|
2
2
|
import { PositionElementProps, SizeElementProps, SpacedElementProps } from "../../Interfaces";
|
|
3
3
|
interface ScrollerProps extends SizeElementProps, SpacedElementProps, PositionElementProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
AutomaticSizeParent?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare function Scroller(props: ScrollerProps): React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -19,11 +19,26 @@ local function Scroller(props)
|
|
|
19
19
|
setIsScrolling(frame.AbsoluteCanvasSize.Y > frame.AbsoluteWindowSize.Y)
|
|
20
20
|
end
|
|
21
21
|
updateScrolling()
|
|
22
|
-
|
|
23
|
-
|
|
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)
|
|
24
33
|
return function()
|
|
25
|
-
canvasConn
|
|
26
|
-
|
|
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
|
|
27
42
|
end
|
|
28
43
|
end, {})
|
|
29
44
|
local spacing = SpacingHelper:GetPadding(theme, props.spacing)
|
|
@@ -41,7 +56,7 @@ local function Scroller(props)
|
|
|
41
56
|
ScrollBarThickness = thickness,
|
|
42
57
|
VerticalScrollBarInset = Enum.ScrollBarInset.ScrollBar,
|
|
43
58
|
AutomaticCanvasSize = Enum.AutomaticSize.Y,
|
|
44
|
-
}, React.createElement("uilistlayout", {
|
|
59
|
+
}, props.AutomaticSizeParent and React.createElement("uilistlayout", {
|
|
45
60
|
FillDirection = Enum.FillDirection.Horizontal,
|
|
46
61
|
}), React.createElement("frame", {
|
|
47
62
|
Size = UDim2.new(1, if isScrolling then -thickness - spacing else 0, 0, 0),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "@rbxts/react";
|
|
2
|
-
import { ScalableElementProps } from "../../Interfaces";
|
|
2
|
+
import { PaddingProps, ScalableElementProps } from "../../Interfaces";
|
|
3
|
+
import { CssBackgroundImage } from "../../Theme";
|
|
3
4
|
interface TabProps {
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
declare function Tab(_props: TabProps): undefined;
|
|
7
|
-
interface TabTitleProps {
|
|
8
|
+
interface TabTitleProps extends PaddingProps {
|
|
8
9
|
text: string;
|
|
9
10
|
}
|
|
10
11
|
declare function TabTitle(_props: TabTitleProps): undefined;
|
|
@@ -13,8 +14,9 @@ interface TabContentProps {
|
|
|
13
14
|
}
|
|
14
15
|
declare function TabContent(props: TabContentProps): undefined;
|
|
15
16
|
interface TabsProps extends ScalableElementProps {
|
|
17
|
+
backgroundImage?: CssBackgroundImage;
|
|
16
18
|
}
|
|
17
|
-
type TabsComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<
|
|
19
|
+
type TabsComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<ImageLabel>> & {
|
|
18
20
|
Tab: typeof Tab;
|
|
19
21
|
Title: typeof TabTitle;
|
|
20
22
|
Content: typeof TabContent;
|