@rbxts/react-clean-ui 1.2.5 → 1.2.7
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/Input/Button.luau +109 -64
- package/out/Components/Input/Input.luau +18 -13
- package/out/Components/Input/Select.luau +34 -19
- package/out/Components/Layout/BreakpointProvider.d.ts +8 -0
- package/out/Components/Layout/BreakpointProvider.luau +67 -0
- package/out/Components/Layout/Tabs.d.ts +3 -0
- package/out/Components/Layout/Tabs.luau +101 -21
- package/out/Components/Layout/index.d.ts +1 -0
- package/out/Components/Layout/init.luau +3 -0
- package/out/Components/Surface/Badge.d.ts +10 -0
- package/out/Components/Surface/Badge.luau +89 -0
- package/out/Components/Surface/index.d.ts +1 -0
- package/out/Components/Surface/init.luau +3 -0
- package/out/Contexts/breakpoint.context.d.ts +9 -0
- package/out/Contexts/breakpoint.context.luau +65 -0
- package/out/Contexts/index.d.ts +1 -0
- package/out/Contexts/init.luau +3 -0
- package/out/Helpers/color.helper.luau +11 -1
- package/out/Interfaces/semantics.d.ts +1 -1
- package/out/Theme/theme.style.d.ts +1 -0
- package/out/Theme/theme.template.d.ts +18 -2
- package/out/Theme/themes/dark.theme.luau +99 -0
- package/out/Theme/themes/default.theme.luau +130 -0
- package/out/Theme/themes/sandstone.theme.luau +90 -0
- package/out/Theme/themes/wooden.theme.luau +132 -0
- package/package.json +1 -1
|
@@ -18,6 +18,35 @@ local HStack = TS.import(script, script.Parent.Parent, "Layout").HStack
|
|
|
18
18
|
local _ = TS.import(script, script.Parent.Parent, "Layout")
|
|
19
19
|
local Group = _.Group
|
|
20
20
|
local GroupContext = _.GroupContext
|
|
21
|
+
local function resolveOwnIntentTransparency(intent, state, intents)
|
|
22
|
+
if intent == nil or intent == "primary" then
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
25
|
+
local _entry = intents
|
|
26
|
+
if _entry ~= nil then
|
|
27
|
+
_entry = _entry[intent]
|
|
28
|
+
end
|
|
29
|
+
local entry = _entry
|
|
30
|
+
local _result = entry
|
|
31
|
+
if _result ~= nil then
|
|
32
|
+
_result = _result[state]
|
|
33
|
+
if _result ~= nil then
|
|
34
|
+
_result = _result.backgroundTransparency
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
local _condition = _result
|
|
38
|
+
if _condition == nil then
|
|
39
|
+
local _result_1 = entry
|
|
40
|
+
if _result_1 ~= nil then
|
|
41
|
+
_result_1 = _result_1.default
|
|
42
|
+
if _result_1 ~= nil then
|
|
43
|
+
_result_1 = _result_1.backgroundTransparency
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
_condition = _result_1
|
|
47
|
+
end
|
|
48
|
+
return _condition
|
|
49
|
+
end
|
|
21
50
|
local function ButtonText(props)
|
|
22
51
|
local theme = React.useContext(CleanThemeContext)
|
|
23
52
|
local _attributes = {
|
|
@@ -93,12 +122,22 @@ local Button = React.forwardRef(function(props, ref)
|
|
|
93
122
|
end
|
|
94
123
|
local intentColors = ColorHelper:getIntentColors(theme, _exp, state, _exp_1, _result)
|
|
95
124
|
local backgroundImage = CssHelper:resolveBackgroundImage(intentColors.backgroundImage)
|
|
96
|
-
local
|
|
97
|
-
local
|
|
125
|
+
local _exp_2 = props.intent
|
|
126
|
+
local _result_1 = props.styleOverride
|
|
127
|
+
if _result_1 ~= nil then
|
|
128
|
+
_result_1 = _result_1.intents
|
|
129
|
+
end
|
|
130
|
+
local _condition = resolveOwnIntentTransparency(_exp_2, state, _result_1)
|
|
98
131
|
if _condition == nil then
|
|
99
|
-
_condition =
|
|
132
|
+
_condition = resolveOwnIntentTransparency(props.intent, state, theme.components.button.intents)
|
|
133
|
+
end
|
|
134
|
+
local intentBackgroundTransparency = _condition
|
|
135
|
+
local _attributes = {}
|
|
136
|
+
local _condition_1 = props.name
|
|
137
|
+
if _condition_1 == nil then
|
|
138
|
+
_condition_1 = "Button"
|
|
100
139
|
end
|
|
101
|
-
_attributes.key =
|
|
140
|
+
_attributes.key = _condition_1
|
|
102
141
|
_attributes.ref = ref
|
|
103
142
|
_attributes.Active = not props.disabled
|
|
104
143
|
local _object = {}
|
|
@@ -112,11 +151,11 @@ local Button = React.forwardRef(function(props, ref)
|
|
|
112
151
|
if not props.disabled then
|
|
113
152
|
setHover(true)
|
|
114
153
|
end
|
|
115
|
-
local
|
|
116
|
-
if
|
|
117
|
-
|
|
118
|
-
if
|
|
119
|
-
|
|
154
|
+
local _result_2 = props.Event
|
|
155
|
+
if _result_2 ~= nil then
|
|
156
|
+
_result_2 = _result_2.MouseEnter
|
|
157
|
+
if _result_2 ~= nil then
|
|
158
|
+
_result_2(button, x, y)
|
|
120
159
|
end
|
|
121
160
|
end
|
|
122
161
|
end
|
|
@@ -124,11 +163,11 @@ local Button = React.forwardRef(function(props, ref)
|
|
|
124
163
|
if not props.disabled then
|
|
125
164
|
setHover(false)
|
|
126
165
|
end
|
|
127
|
-
local
|
|
128
|
-
if
|
|
129
|
-
|
|
130
|
-
if
|
|
131
|
-
|
|
166
|
+
local _result_2 = props.Event
|
|
167
|
+
if _result_2 ~= nil then
|
|
168
|
+
_result_2 = _result_2.MouseLeave
|
|
169
|
+
if _result_2 ~= nil then
|
|
170
|
+
_result_2(button, x, y)
|
|
132
171
|
end
|
|
133
172
|
end
|
|
134
173
|
end
|
|
@@ -136,46 +175,49 @@ local Button = React.forwardRef(function(props, ref)
|
|
|
136
175
|
if props.disabled then
|
|
137
176
|
return nil
|
|
138
177
|
end
|
|
139
|
-
local
|
|
140
|
-
if
|
|
141
|
-
|
|
142
|
-
if
|
|
143
|
-
|
|
178
|
+
local _result_2 = props.Event
|
|
179
|
+
if _result_2 ~= nil then
|
|
180
|
+
_result_2 = _result_2.Activated
|
|
181
|
+
if _result_2 ~= nil then
|
|
182
|
+
_result_2(button, inputObject, clickCount)
|
|
144
183
|
end
|
|
145
184
|
end
|
|
146
185
|
end
|
|
147
186
|
_attributes.Event = _object
|
|
148
|
-
local
|
|
187
|
+
local _result_2
|
|
149
188
|
if props.group then
|
|
150
|
-
local
|
|
151
|
-
if
|
|
152
|
-
|
|
153
|
-
if
|
|
154
|
-
|
|
189
|
+
local _result_3 = group
|
|
190
|
+
if _result_3 ~= nil then
|
|
191
|
+
_result_3 = _result_3.size
|
|
192
|
+
if _result_3 ~= nil then
|
|
193
|
+
_result_3 = _result_3.X
|
|
155
194
|
end
|
|
156
195
|
end
|
|
157
|
-
local
|
|
158
|
-
if
|
|
159
|
-
|
|
196
|
+
local _condition_2 = _result_3
|
|
197
|
+
if _condition_2 == nil then
|
|
198
|
+
_condition_2 = 0
|
|
160
199
|
end
|
|
161
|
-
|
|
200
|
+
_result_2 = _condition_2
|
|
162
201
|
else
|
|
163
|
-
|
|
202
|
+
_result_2 = 0
|
|
164
203
|
end
|
|
165
|
-
_attributes.Size = UDim2.fromOffset(
|
|
204
|
+
_attributes.Size = UDim2.fromOffset(_result_2, 0)
|
|
166
205
|
_attributes.AutomaticSize = Enum.AutomaticSize.XY
|
|
167
|
-
local
|
|
168
|
-
if
|
|
169
|
-
local
|
|
170
|
-
if
|
|
171
|
-
|
|
206
|
+
local _condition_2 = props.BackgroundTransparency
|
|
207
|
+
if _condition_2 == nil then
|
|
208
|
+
local _result_3 = props.styleOverride
|
|
209
|
+
if _result_3 ~= nil then
|
|
210
|
+
_result_3 = _result_3.backgroundTransparency
|
|
172
211
|
end
|
|
173
|
-
|
|
174
|
-
if
|
|
175
|
-
|
|
212
|
+
_condition_2 = _result_3
|
|
213
|
+
if _condition_2 == nil then
|
|
214
|
+
_condition_2 = intentBackgroundTransparency
|
|
215
|
+
if _condition_2 == nil then
|
|
216
|
+
_condition_2 = theme.components.button.backgroundTransparency
|
|
217
|
+
end
|
|
176
218
|
end
|
|
177
219
|
end
|
|
178
|
-
_attributes.BackgroundTransparency =
|
|
220
|
+
_attributes.BackgroundTransparency = _condition_2
|
|
179
221
|
_attributes.BackgroundColor3 = intentColors.backgroundColor
|
|
180
222
|
_attributes.AutoButtonColor = false
|
|
181
223
|
_attributes.LayoutOrder = props.LayoutOrder
|
|
@@ -188,49 +230,52 @@ local Button = React.forwardRef(function(props, ref)
|
|
|
188
230
|
_attributes.SliceScale = backgroundImage.SliceScale
|
|
189
231
|
_attributes.TileSize = backgroundImage.TileSize
|
|
190
232
|
local _attributes_1 = {}
|
|
191
|
-
local _result_2 = props.styleOverride
|
|
192
|
-
if _result_2 ~= nil then
|
|
193
|
-
_result_2 = _result_2.cornerRadius
|
|
194
|
-
end
|
|
195
|
-
local _condition_2 = _result_2
|
|
196
|
-
if _condition_2 == nil then
|
|
197
|
-
_condition_2 = theme.components.button.cornerRadius
|
|
198
|
-
end
|
|
199
|
-
_attributes_1.radius = _condition_2
|
|
200
|
-
local _exp_2 = React.createElement(Corners, _attributes_1)
|
|
201
|
-
local _attributes_2 = {
|
|
202
|
-
key = "Stroke",
|
|
203
|
-
}
|
|
204
233
|
local _result_3 = props.styleOverride
|
|
205
234
|
if _result_3 ~= nil then
|
|
206
|
-
_result_3 = _result_3.
|
|
235
|
+
_result_3 = _result_3.cornerRadius
|
|
207
236
|
end
|
|
208
237
|
local _condition_3 = _result_3
|
|
209
238
|
if _condition_3 == nil then
|
|
210
|
-
_condition_3 = theme.components.button.
|
|
239
|
+
_condition_3 = theme.components.button.cornerRadius
|
|
211
240
|
end
|
|
212
|
-
|
|
241
|
+
_attributes_1.radius = _condition_3
|
|
242
|
+
local _exp_3 = React.createElement(Corners, _attributes_1)
|
|
243
|
+
local _attributes_2 = {
|
|
244
|
+
key = "Stroke",
|
|
245
|
+
}
|
|
246
|
+
local _condition_4 = intentColors.borderThickness
|
|
247
|
+
if _condition_4 == nil then
|
|
248
|
+
local _result_4 = props.styleOverride
|
|
249
|
+
if _result_4 ~= nil then
|
|
250
|
+
_result_4 = _result_4.borderThickness
|
|
251
|
+
end
|
|
252
|
+
_condition_4 = _result_4
|
|
253
|
+
if _condition_4 == nil then
|
|
254
|
+
_condition_4 = theme.components.button.borderThickness
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
_attributes_2.Thickness = _condition_4
|
|
213
258
|
_attributes_2.BorderStrokePosition = Enum.BorderStrokePosition.Inner
|
|
214
259
|
_attributes_2.Color = intentColors.borderColor
|
|
215
|
-
local
|
|
260
|
+
local _exp_4 = React.createElement("uistroke", _attributes_2)
|
|
216
261
|
local _attributes_3 = table.clone(props)
|
|
217
262
|
setmetatable(_attributes_3, nil)
|
|
218
263
|
local _result_4 = props.styleOverride
|
|
219
264
|
if _result_4 ~= nil then
|
|
220
265
|
_result_4 = _result_4.boxShadow
|
|
221
266
|
end
|
|
222
|
-
local
|
|
223
|
-
if
|
|
224
|
-
|
|
267
|
+
local _condition_5 = _result_4
|
|
268
|
+
if _condition_5 == nil then
|
|
269
|
+
_condition_5 = theme.components.button.boxShadow
|
|
225
270
|
end
|
|
226
|
-
_attributes_3.value =
|
|
227
|
-
local
|
|
228
|
-
local
|
|
271
|
+
_attributes_3.value = _condition_5
|
|
272
|
+
local _exp_5 = React.createElement(BoxShadow, _attributes_3)
|
|
273
|
+
local _exp_6 = React.createElement(Gradient, {
|
|
229
274
|
value = intentColors.backgroundGradient,
|
|
230
275
|
})
|
|
231
276
|
local _attributes_4 = table.clone(props)
|
|
232
277
|
setmetatable(_attributes_4, nil)
|
|
233
|
-
return React.createElement("imagebutton", _attributes,
|
|
278
|
+
return React.createElement("imagebutton", _attributes, _exp_3, _exp_4, _exp_5, _exp_6, React.createElement(Padding, _attributes_4), React.createElement(Group.Element, {
|
|
234
279
|
enabled = props.group,
|
|
235
280
|
padding = padding,
|
|
236
281
|
}, (props.icon ~= nil or props.text ~= nil) and React.createElement(HStack, {
|
|
@@ -56,7 +56,12 @@ local function Input(props)
|
|
|
56
56
|
_attributes.key = _condition
|
|
57
57
|
_attributes.Size = props.Size or UDim2.fromScale(1, 0)
|
|
58
58
|
_attributes.AutomaticSize = Enum.AutomaticSize.Y
|
|
59
|
-
_attributes.
|
|
59
|
+
_attributes.BackgroundColor3 = theme.components.input.backgroundColor
|
|
60
|
+
local _condition_1 = theme.components.input.backgroundTransparency
|
|
61
|
+
if _condition_1 == nil then
|
|
62
|
+
_condition_1 = 1
|
|
63
|
+
end
|
|
64
|
+
_attributes.BackgroundTransparency = _condition_1
|
|
60
65
|
_attributes.AnchorPoint = props.AnchorPoint
|
|
61
66
|
_attributes.Position = props.Position
|
|
62
67
|
_attributes.LayoutOrder = props.LayoutOrder
|
|
@@ -99,21 +104,21 @@ local function Input(props)
|
|
|
99
104
|
FontFace = Font.fromName(typography.font.Name, typography.weight or Enum.FontWeight.Regular),
|
|
100
105
|
FontSize = typography.size,
|
|
101
106
|
}
|
|
102
|
-
local
|
|
103
|
-
if
|
|
104
|
-
|
|
107
|
+
local _condition_2 = props.PlaceholderText
|
|
108
|
+
if _condition_2 == nil then
|
|
109
|
+
_condition_2 = props.placeholder
|
|
105
110
|
end
|
|
106
|
-
_attributes_2.PlaceholderText =
|
|
111
|
+
_attributes_2.PlaceholderText = _condition_2
|
|
107
112
|
_attributes_2.PlaceholderColor3 = props.PlaceholderColor3 or placeholderTypography.color
|
|
108
113
|
_attributes_2.TextScaled = props.TextScaled
|
|
109
114
|
_attributes_2.LineHeight = typography.lineHeight
|
|
110
115
|
_attributes_2.Text = if props.controlled then props.value else value
|
|
111
116
|
_attributes_2.TextColor3 = props.TextColor3 or typography.color or theme.colors.intents.primary.default.textColor
|
|
112
|
-
local
|
|
113
|
-
if
|
|
114
|
-
|
|
117
|
+
local _condition_3 = props.TextTransparency
|
|
118
|
+
if _condition_3 == nil then
|
|
119
|
+
_condition_3 = typography.transparency
|
|
115
120
|
end
|
|
116
|
-
_attributes_2.TextTransparency =
|
|
121
|
+
_attributes_2.TextTransparency = _condition_3
|
|
117
122
|
_attributes_2.Active = props.Active
|
|
118
123
|
_attributes_2.Archivable = props.Archivable
|
|
119
124
|
_attributes_2.BorderColor3 = props.BorderColor3
|
|
@@ -133,11 +138,11 @@ local function Input(props)
|
|
|
133
138
|
_attributes_2.NextSelectionUp = props.NextSelectionUp
|
|
134
139
|
_attributes_2.SelectionGroup = props.SelectionGroup
|
|
135
140
|
_attributes_2.SelectionOrder = props.SelectionOrder
|
|
136
|
-
local
|
|
137
|
-
if
|
|
138
|
-
|
|
141
|
+
local _condition_4 = props.ClearTextOnFocus
|
|
142
|
+
if _condition_4 == nil then
|
|
143
|
+
_condition_4 = false
|
|
139
144
|
end
|
|
140
|
-
_attributes_2.ClearTextOnFocus =
|
|
145
|
+
_attributes_2.ClearTextOnFocus = _condition_4
|
|
141
146
|
_attributes_2.CursorPosition = props.CursorPosition
|
|
142
147
|
_attributes_2.MultiLine = props.MultiLine
|
|
143
148
|
_attributes_2.SelectionStart = props.SelectionStart
|
|
@@ -417,37 +417,51 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
417
417
|
_result_1 = _result_1.labelActivated
|
|
418
418
|
end
|
|
419
419
|
React.useEffect(_exp, { _result_1, activateSelect })
|
|
420
|
+
local _condition_3 = theme.components.select.backgroundTransparency
|
|
421
|
+
if _condition_3 == nil then
|
|
422
|
+
_condition_3 = 1
|
|
423
|
+
end
|
|
424
|
+
local themeBackgroundTransparency = _condition_3
|
|
420
425
|
if open and overlay.overlay == nil then
|
|
421
426
|
warn("You have used a Select component without using the Overlay Provider")
|
|
422
427
|
end
|
|
423
428
|
local _attributes = {}
|
|
424
|
-
local
|
|
425
|
-
if
|
|
426
|
-
|
|
429
|
+
local _condition_4 = props.name
|
|
430
|
+
if _condition_4 == nil then
|
|
431
|
+
_condition_4 = "Select"
|
|
427
432
|
end
|
|
428
|
-
_attributes.name =
|
|
433
|
+
_attributes.name = _condition_4
|
|
429
434
|
_attributes.ref = ref
|
|
430
435
|
for _k, _v in props do
|
|
431
436
|
_attributes[_k] = _v
|
|
432
437
|
end
|
|
433
438
|
_attributes.Size = UDim2.fromScale(1, 0)
|
|
434
439
|
_attributes.AutomaticSize = Enum.AutomaticSize.Y
|
|
440
|
+
_attributes.BackgroundColor3 = props.BackgroundColor3 or theme.components.select.backgroundColor
|
|
441
|
+
local _condition_5 = props.BackgroundTransparency
|
|
442
|
+
if _condition_5 == nil then
|
|
443
|
+
_condition_5 = themeBackgroundTransparency
|
|
444
|
+
end
|
|
445
|
+
_attributes.BackgroundTransparency = _condition_5
|
|
435
446
|
_attributes.backgroundImage = props.backgroundImage or theme.components.select.backgroundImage
|
|
436
|
-
local _exp_1 = React.createElement(
|
|
447
|
+
local _exp_1 = themeBackgroundTransparency < 1 and React.createElement(Corners, {
|
|
448
|
+
radius = theme.components.select.cornerRadius,
|
|
449
|
+
})
|
|
450
|
+
local _exp_2 = React.createElement(Gradient, {
|
|
437
451
|
value = props.backgroundGradient or theme.components.select.backgroundGradient,
|
|
438
452
|
})
|
|
439
|
-
local
|
|
453
|
+
local _exp_3 = React.createElement("uistroke", {
|
|
440
454
|
key = "Stroke",
|
|
441
455
|
Thickness = theme.components.select.borderThickness,
|
|
442
456
|
BorderStrokePosition = Enum.BorderStrokePosition.Inner,
|
|
443
457
|
Color = theme.components.select.borderColor,
|
|
444
458
|
})
|
|
445
|
-
local
|
|
459
|
+
local _exp_4 = React.createElement(Corners, {
|
|
446
460
|
radius = theme.components.select.cornerRadius,
|
|
447
461
|
})
|
|
448
462
|
local _attributes_1 = table.clone(props)
|
|
449
463
|
setmetatable(_attributes_1, nil)
|
|
450
|
-
local
|
|
464
|
+
local _exp_5 = React.createElement(Padding, _attributes_1)
|
|
451
465
|
local _attributes_2 = {
|
|
452
466
|
name = "SelectedText",
|
|
453
467
|
}
|
|
@@ -455,19 +469,20 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
455
469
|
if _result_2 ~= nil then
|
|
456
470
|
_result_2 = _result_2.props.text
|
|
457
471
|
end
|
|
458
|
-
local
|
|
459
|
-
if
|
|
460
|
-
|
|
472
|
+
local _condition_6 = _result_2
|
|
473
|
+
if _condition_6 == nil then
|
|
474
|
+
_condition_6 = "No Options"
|
|
461
475
|
end
|
|
462
|
-
_attributes_2.text =
|
|
476
|
+
_attributes_2.text = _condition_6
|
|
463
477
|
_attributes_2.typography = typography
|
|
464
|
-
|
|
478
|
+
_attributes_2.TextColor3 = theme.components.select.textColor
|
|
479
|
+
local _exp_6 = React.createElement(HStack, nil, React.createElement(FlexItem, nil, React.createElement(Text, _attributes_2)), React.createElement(Icon, {
|
|
465
480
|
name = "SelectCaret",
|
|
466
481
|
icon = "caret-down",
|
|
467
|
-
color = theme.colors.intents.primary.default.textColor,
|
|
482
|
+
color = theme.components.select.iconColor or theme.colors.intents.primary.default.textColor,
|
|
468
483
|
}))
|
|
469
|
-
local
|
|
470
|
-
if
|
|
484
|
+
local _condition_7 = open and overlay.overlay ~= nil
|
|
485
|
+
if _condition_7 then
|
|
471
486
|
local _attributes_3 = {
|
|
472
487
|
key = "SelectDropdown",
|
|
473
488
|
BackgroundTransparency = 0,
|
|
@@ -479,7 +494,7 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
479
494
|
_attributes_3.Size = UDim2.fromOffset(dropdownSize.X.Offset, 0)
|
|
480
495
|
_attributes_3.AutomaticSize = Enum.AutomaticSize.Y
|
|
481
496
|
_attributes_3.ClipsDescendants = true
|
|
482
|
-
|
|
497
|
+
_condition_7 = ReactRoblox.createPortal(React.createElement("frame", _attributes_3, React.createElement("uistroke", {
|
|
483
498
|
key = "Stroke",
|
|
484
499
|
Thickness = theme.components.select.borderThickness,
|
|
485
500
|
BorderStrokePosition = Enum.BorderStrokePosition.Outer,
|
|
@@ -509,7 +524,7 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
509
524
|
typography = typography,
|
|
510
525
|
}))))), overlay.overlay)
|
|
511
526
|
end
|
|
512
|
-
return React.createElement(Container, _attributes, _exp_1, React.createElement(SelectContext.Provider, {
|
|
527
|
+
return React.createElement(Container, _attributes, _exp_1, _exp_2, React.createElement(SelectContext.Provider, {
|
|
513
528
|
value = context,
|
|
514
529
|
}, React.createElement("imagebutton", {
|
|
515
530
|
key = "SelectButton",
|
|
@@ -520,7 +535,7 @@ local Select = React.forwardRef(function(props, ref)
|
|
|
520
535
|
Event = {
|
|
521
536
|
Activated = activateSelect,
|
|
522
537
|
},
|
|
523
|
-
},
|
|
538
|
+
}, _exp_3, _exp_4, _exp_5, _exp_6, _condition_7)))
|
|
524
539
|
end)
|
|
525
540
|
Select.Option = SelectOption
|
|
526
541
|
Select.OptGroup = SelectOptGroup
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { BreakPointElementProps } from "../../Interfaces/";
|
|
3
|
+
export interface BreakpointProviderProps extends BreakPointElementProps {
|
|
4
|
+
name?: string;
|
|
5
|
+
LayoutOrder?: number;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const BreakpointProvider: React.ForwardRefExoticComponent<BreakpointProviderProps & React.RefAttributes<Frame>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 _Contexts = TS.import(script, script.Parent.Parent.Parent, "Contexts")
|
|
5
|
+
local BreakpointContext = _Contexts.BreakpointContext
|
|
6
|
+
local CleanThemeContext = _Contexts.CleanThemeContext
|
|
7
|
+
local BreakpointHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").BreakpointHelper
|
|
8
|
+
local BreakpointProvider = React.forwardRef(function(props, ref)
|
|
9
|
+
local theme = React.useContext(CleanThemeContext)
|
|
10
|
+
local breakpoints = props.breakpoints or theme.breakpoints
|
|
11
|
+
local frameRef = React.useRef()
|
|
12
|
+
local widthRef = React.useRef(0)
|
|
13
|
+
local value, setValue = React.useState(function()
|
|
14
|
+
return {
|
|
15
|
+
width = 0,
|
|
16
|
+
breakpoint = BreakpointHelper:getBreakpoint(0, breakpoints),
|
|
17
|
+
}
|
|
18
|
+
end)
|
|
19
|
+
local valueRef = React.useRef(value)
|
|
20
|
+
local resolve = function(width)
|
|
21
|
+
widthRef.current = width
|
|
22
|
+
local breakpoint = BreakpointHelper:getBreakpoint(width, breakpoints)
|
|
23
|
+
if breakpoint == valueRef.current.breakpoint then
|
|
24
|
+
return nil
|
|
25
|
+
end
|
|
26
|
+
local resolved = {
|
|
27
|
+
width = width,
|
|
28
|
+
breakpoint = breakpoint,
|
|
29
|
+
}
|
|
30
|
+
valueRef.current = resolved
|
|
31
|
+
setValue(resolved)
|
|
32
|
+
end
|
|
33
|
+
React.useEffect(function()
|
|
34
|
+
local instance = frameRef.current
|
|
35
|
+
resolve(if instance ~= nil then instance.AbsoluteSize.X else widthRef.current)
|
|
36
|
+
end, { breakpoints })
|
|
37
|
+
local setFrame = React.useCallback(function(instance)
|
|
38
|
+
frameRef.current = instance
|
|
39
|
+
local _ref = ref
|
|
40
|
+
if type(_ref) == "function" then
|
|
41
|
+
ref(instance)
|
|
42
|
+
elseif ref ~= nil then
|
|
43
|
+
ref.current = instance
|
|
44
|
+
end
|
|
45
|
+
end, { ref })
|
|
46
|
+
local _attributes = {}
|
|
47
|
+
local _condition = props.name
|
|
48
|
+
if _condition == nil then
|
|
49
|
+
_condition = "BreakpointProvider"
|
|
50
|
+
end
|
|
51
|
+
_attributes.key = _condition
|
|
52
|
+
_attributes.ref = setFrame
|
|
53
|
+
_attributes.LayoutOrder = props.LayoutOrder
|
|
54
|
+
_attributes.Size = UDim2.fromScale(1, 1)
|
|
55
|
+
_attributes.BackgroundTransparency = 1
|
|
56
|
+
_attributes.Change = {
|
|
57
|
+
AbsoluteSize = function(instance)
|
|
58
|
+
return resolve(instance.AbsoluteSize.X)
|
|
59
|
+
end,
|
|
60
|
+
}
|
|
61
|
+
return React.createElement("frame", _attributes, React.createElement(BreakpointContext.Provider, {
|
|
62
|
+
value = value,
|
|
63
|
+
}, props.children))
|
|
64
|
+
end)
|
|
65
|
+
return {
|
|
66
|
+
BreakpointProvider = BreakpointProvider,
|
|
67
|
+
}
|
|
@@ -12,6 +12,7 @@ interface TabContentProps {
|
|
|
12
12
|
}
|
|
13
13
|
declare function TabContent(props: TabContentProps): React.JSX.Element;
|
|
14
14
|
interface TabsListProps extends ScalableElementProps {
|
|
15
|
+
fill?: boolean;
|
|
15
16
|
children?: React.ReactNode;
|
|
16
17
|
}
|
|
17
18
|
declare const TabsList: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<ImageLabel>>;
|
|
@@ -24,6 +25,8 @@ declare const TabsBody: React.ForwardRefExoticComponent<TabsBodyProps & React.Re
|
|
|
24
25
|
export interface TabsProps {
|
|
25
26
|
children?: React.ReactNode;
|
|
26
27
|
defaultValue?: string;
|
|
28
|
+
value?: string;
|
|
29
|
+
onValueChange?: (value: string) => void;
|
|
27
30
|
}
|
|
28
31
|
type TabsComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<Frame>> & {
|
|
29
32
|
List: typeof TabsList;
|