@rbxts/react-clean-ui 1.0.14 → 1.0.19

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 (43) hide show
  1. package/out/Components/Chart/Pie.d.ts +27 -0
  2. package/out/Components/Chart/Pie.luau +281 -0
  3. package/out/Components/Chart/index.d.ts +1 -0
  4. package/out/Components/Chart/init.luau +7 -0
  5. package/out/Components/Decorator/BoxShadow.d.ts +2 -1
  6. package/out/Components/Decorator/BoxShadow.luau +51 -28
  7. package/out/Components/Input/Select.d.ts +6 -14
  8. package/out/Components/Input/Select.luau +111 -151
  9. package/out/Components/Input/Slider.d.ts +3 -37
  10. package/out/Components/Input/Slider.luau +271 -300
  11. package/out/Components/Layout/Column.d.ts +2 -8
  12. package/out/Components/Layout/Column.luau +28 -48
  13. package/out/Components/Layout/Draggable.d.ts +7 -31
  14. package/out/Components/Layout/Draggable.luau +190 -214
  15. package/out/Components/Layout/Fieldset.d.ts +8 -18
  16. package/out/Components/Layout/Fieldset.luau +42 -84
  17. package/out/Components/Layout/Group.d.ts +7 -14
  18. package/out/Components/Layout/Group.luau +111 -129
  19. package/out/Components/Layout/Row.d.ts +2 -11
  20. package/out/Components/Layout/Row.luau +46 -71
  21. package/out/Components/Layout/Tabs.d.ts +10 -18
  22. package/out/Components/Layout/Tabs.luau +85 -104
  23. package/out/Components/Navigation/Menu.d.ts +6 -10
  24. package/out/Components/Navigation/Menu.luau +38 -65
  25. package/out/Components/Surface/Card.d.ts +8 -11
  26. package/out/Components/Surface/Card.luau +28 -48
  27. package/out/Components/Surface/index.d.ts +0 -1
  28. package/out/Components/Surface/init.luau +0 -3
  29. package/out/Components/index.d.ts +1 -0
  30. package/out/Components/init.luau +3 -0
  31. package/out/Helpers/css.helper.d.ts +2 -1
  32. package/out/Helpers/css.helper.luau +25 -0
  33. package/out/Helpers/size.helper.luau +1 -1
  34. package/out/Interfaces/clean.element.props.d.ts +5 -0
  35. package/out/Providers/registry.provider.d.ts +1 -0
  36. package/out/Providers/registry.provider.luau +5 -0
  37. package/out/Theme/theme.template.d.ts +15 -1
  38. package/out/Theme/themes/dark.theme.luau +3 -0
  39. package/out/Theme/themes/default.theme.luau +15 -0
  40. package/out/Theme/themes/sandstone.theme.luau +13 -0
  41. package/package.json +1 -1
  42. package/out/Components/Surface/Panel.d.ts +0 -4
  43. package/out/Components/Surface/Panel.luau +0 -33
@@ -1,72 +1,56 @@
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 CustomInputService = TS.import(script, script.Parent.Parent.Parent, "Interfaces").CustomInputService
8
5
  local CleanThemeContext = TS.import(script, script.Parent.Parent.Parent, "Contexts").CleanThemeContext
9
6
  local SizeHelper = TS.import(script, script.Parent.Parent.Parent, "Helpers").SizeHelper
10
7
  local BoxShadow = TS.import(script, script.Parent.Parent, "Decorator").BoxShadow
11
- local Slider
12
- do
13
- local super = Component
14
- Slider = setmetatable({}, {
15
- __tostring = function()
16
- return "Slider"
17
- end,
18
- __index = super,
19
- })
20
- Slider.__index = Slider
21
- function Slider.new(...)
22
- local self = setmetatable({}, Slider)
23
- return self:constructor(...) or self
24
- end
25
- function Slider:constructor(...)
26
- super.constructor(self, ...)
27
- self.isDragging = false
28
- self.containerRef = React.createRef()
29
- self.state = {
30
- value = self:getInitialValue(),
31
- dragging = false,
32
- hoveredHandle = nil,
33
- }
34
- end
35
- function Slider:getInitialValue()
36
- local _condition = self.props["min-value"]
8
+ local Slider = React.forwardRef(function(props, ref)
9
+ local theme = React.useContext(CleanThemeContext).components.slider
10
+ local containerRef = React.useRef()
11
+ local isDraggingRef = React.useRef(false)
12
+ local activeHandleRef = React.useRef()
13
+ local getInitialValue = function()
14
+ local _condition = props["min-value"]
37
15
  if _condition == nil then
38
16
  _condition = 0
39
17
  end
40
18
  local minValue = _condition
41
- local maxValue = self.props["max-value"]
42
- if self.props.range then
43
- local _value = self.props.value
44
- return if typeof(_value) == "Vector2" then self.props.value else Vector2.new(minValue, maxValue)
19
+ local maxValue = props["max-value"]
20
+ if props.range then
21
+ local _value = props.value
22
+ return if typeof(_value) == "Vector2" then props.value else Vector2.new(minValue, maxValue)
45
23
  end
46
- local _value = self.props.value
47
- return if type(_value) == "number" then self.props.value else minValue
24
+ local _value = props.value
25
+ return if type(_value) == "number" then props.value else minValue
48
26
  end
49
- function Slider:getCurrentValue()
50
- if self.props.controlled then
51
- local value = self.props.value
52
- if self.props.range then
27
+ local value, setValue = React.useState(getInitialValue)
28
+ local dragging, setDragging = React.useState(false)
29
+ local hoveredHandle, setHoveredHandle = React.useState()
30
+ local propsRef = React.useRef(props)
31
+ propsRef.current = props
32
+ local currentValue = React.useMemo(function()
33
+ if props.controlled then
34
+ if props.range then
35
+ local _value = props.value
53
36
  local _result
54
- if typeof(value) == "Vector2" then
55
- _result = value
37
+ if typeof(_value) == "Vector2" then
38
+ _result = props.value
56
39
  else
57
- local _condition = self.props["min-value"]
40
+ local _condition = props["min-value"]
58
41
  if _condition == nil then
59
42
  _condition = 0
60
43
  end
61
- _result = Vector2.new(_condition, self.props["max-value"])
44
+ _result = Vector2.new(_condition, props["max-value"])
62
45
  end
63
46
  return _result
64
47
  end
48
+ local _value = props.value
65
49
  local _result
66
- if type(value) == "number" then
67
- _result = value
50
+ if type(_value) == "number" then
51
+ _result = props.value
68
52
  else
69
- local _condition = self.props["min-value"]
53
+ local _condition = props["min-value"]
70
54
  if _condition == nil then
71
55
  _condition = 0
72
56
  end
@@ -74,10 +58,23 @@ do
74
58
  end
75
59
  return _result
76
60
  end
77
- return self.state.value
78
- end
79
- function Slider:getNumberFromInput(input)
80
- local container = self.containerRef.current
61
+ return value
62
+ end, { props.controlled, props.range, props.value, props["min-value"], props["max-value"], value })
63
+ local currentValueRef = React.useRef(currentValue)
64
+ currentValueRef.current = currentValue
65
+ local updateValue = React.useCallback(function(nextValue)
66
+ if not propsRef.current.controlled then
67
+ currentValueRef.current = nextValue
68
+ end
69
+ setValue(nextValue)
70
+ end, {})
71
+ --[[
72
+ *
73
+ * Converts an input position into a single slider value.
74
+
75
+ ]]
76
+ local getNumberFromInput = React.useCallback(function(input)
77
+ local container = containerRef.current
81
78
  if not container then
82
79
  return nil
83
80
  end
@@ -88,328 +85,302 @@ do
88
85
  local inputX = input.Position.X
89
86
  local containerStart = container.AbsolutePosition.X
90
87
  local percentage = math.clamp((inputX - containerStart) / containerWidth, 0, 1)
91
- local _condition = self.props["min-value"]
88
+ local currentProps = propsRef.current
89
+ local _condition = currentProps["min-value"]
92
90
  if _condition == nil then
93
91
  _condition = 0
94
92
  end
95
93
  local minValue = _condition
96
- local maxValue = self.props["max-value"]
97
- local value = minValue + percentage * (maxValue - minValue)
98
- local step = self.props.step
94
+ local maxValue = currentProps["max-value"]
95
+ local nextValue = minValue + percentage * (maxValue - minValue)
96
+ local step = currentProps.step
99
97
  if step ~= nil and step > 0 then
100
98
  --[[
101
99
 
102
- * Offset snapping from minValue so ranges such as
103
- * min=5, step=2 produce 5, 7, 9, etc.
104
-
100
+ * Offset snapping from minValue so ranges such as
101
+ * min=5, step=2 produce 5, 7, 9, etc.
102
+
105
103
  ]]
106
- value = minValue + math.round((value - minValue) / step) * step
104
+ nextValue = minValue + math.round((nextValue - minValue) / step) * step
107
105
  -- Remove floating-point artifacts.
108
106
  local parts = string.split(tostring(step), ".")
109
107
  local decimals = if #parts > 1 then #parts[2] else 0
110
108
  local scale = 10 ^ decimals
111
- value = math.round(value * scale) / scale
109
+ nextValue = math.round(nextValue * scale) / scale
112
110
  end
113
- return math.clamp(value, minValue, maxValue)
114
- end
115
- function Slider:getValueFromInput(input)
116
- local inputValue = self:getNumberFromInput(input)
111
+ return math.clamp(nextValue, minValue, maxValue)
112
+ end, {})
113
+ --[[
114
+ *
115
+ * Converts a single input value into either a number or Vector2,
116
+ * depending on whether range mode is enabled.
117
+
118
+ ]]
119
+ local getValueFromInput = React.useCallback(function(input)
120
+ local inputValue = getNumberFromInput(input)
117
121
  if inputValue == nil then
118
122
  return nil
119
123
  end
120
- if not self.props.range then
124
+ local currentProps = propsRef.current
125
+ if not currentProps.range then
121
126
  return inputValue
122
127
  end
123
- local currentValue = self:getCurrentValue()
128
+ local _current = currentValueRef.current
124
129
  local _result
125
- if typeof(currentValue) == "Vector2" then
126
- _result = currentValue
130
+ if typeof(_current) == "Vector2" then
131
+ _result = currentValueRef.current
127
132
  else
128
- local _condition = self.props["min-value"]
133
+ local _condition = currentProps["min-value"]
129
134
  if _condition == nil then
130
135
  _condition = 0
131
136
  end
132
- _result = Vector2.new(_condition, self.props["max-value"])
137
+ _result = Vector2.new(_condition, currentProps["max-value"])
133
138
  end
134
139
  local rangeValue = _result
135
- if self.activeHandle == 0 then
140
+ if activeHandleRef.current == 0 then
136
141
  return Vector2.new(math.min(inputValue, rangeValue.Y), rangeValue.Y)
137
142
  end
138
- if self.activeHandle == 1 then
143
+ if activeHandleRef.current == 1 then
139
144
  return Vector2.new(rangeValue.X, math.max(inputValue, rangeValue.X))
140
145
  end
141
146
  return rangeValue
142
- end
143
- function Slider:beginDragging(handle, input)
147
+ end, { getNumberFromInput })
148
+ local beginDragging = React.useCallback(function(handle, input)
144
149
  if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then
145
150
  return nil
146
151
  end
147
- self.activeHandle = handle
148
- self.isDragging = true
149
- local value = self:getValueFromInput(input)
150
- local _self = self
151
- local _object = {
152
- dragging = true,
153
- }
154
- local _left = "value"
155
- local _condition = value
156
- if _condition == nil then
157
- _condition = self.state.value
158
- end
159
- _object[_left] = _condition
160
- _self:setState(_object)
161
- if value ~= nil then
162
- local _result = self.props.onDragged
152
+ activeHandleRef.current = handle
153
+ isDraggingRef.current = true
154
+ local nextValue = getValueFromInput(input)
155
+ setDragging(true)
156
+ if nextValue ~= nil then
157
+ updateValue(nextValue)
158
+ local _result = propsRef.current.onDragged
163
159
  if _result ~= nil then
164
- _result(value)
160
+ _result(nextValue)
165
161
  end
166
162
  end
167
- end
168
- function Slider:componentDidMount()
169
- self.inputChangedListener = CustomInputService.InputChanged:Connect(function(input)
163
+ end, { getValueFromInput, updateValue })
164
+ React.useEffect(function()
165
+ local inputChangedListener = CustomInputService.InputChanged:Connect(function(input)
170
166
  if input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch then
171
167
  return nil
172
168
  end
173
- if not self.isDragging then
169
+ if not isDraggingRef.current then
174
170
  return nil
175
171
  end
176
- local value = self:getValueFromInput(input)
177
- if value == nil then
172
+ local nextValue = getValueFromInput(input)
173
+ if nextValue == nil then
178
174
  return nil
179
175
  end
180
- self:setState({
181
- value = value,
182
- })
183
- local _result = self.props.onDragged
176
+ updateValue(nextValue)
177
+ local _result = propsRef.current.onDragged
184
178
  if _result ~= nil then
185
- _result(value)
179
+ _result(nextValue)
186
180
  end
187
181
  end)
188
- self.inputEndedListener = CustomInputService.InputEnded:Connect(function(input)
182
+ local inputEndedListener = CustomInputService.InputEnded:Connect(function(input)
189
183
  if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then
190
184
  return nil
191
185
  end
192
- if not self.isDragging then
186
+ if not isDraggingRef.current then
193
187
  return nil
194
188
  end
195
189
  --[[
196
190
 
197
- * Stop processing movement immediately, before
198
- * React gets around to updating the state.
199
-
191
+ * Stop processing movement immediately, before
192
+ * React gets around to updating the state.
193
+
200
194
  ]]
201
- self.isDragging = false
202
- local value = self:getValueFromInput(input)
203
- self.activeHandle = nil
204
- local _self = self
205
- local _object = {}
206
- local _left = "value"
207
- local _condition = value
208
- if _condition == nil then
209
- _condition = self.state.value
210
- end
211
- _object[_left] = _condition
212
- _object.dragging = false
213
- _object.hoveredHandle = React.None
214
- _self:setState(_object)
215
- if value ~= nil then
216
- local _result = self.props.onChanged
195
+ isDraggingRef.current = false
196
+ local nextValue = getValueFromInput(input)
197
+ activeHandleRef.current = nil
198
+ setDragging(false)
199
+ setHoveredHandle(nil)
200
+ if nextValue ~= nil then
201
+ updateValue(nextValue)
202
+ local _result = propsRef.current.onChanged
217
203
  if _result ~= nil then
218
- _result(value)
204
+ _result(nextValue)
219
205
  end
220
206
  end
221
207
  end)
222
- end
223
- function Slider:componentWillUnmount()
224
- self.isDragging = false
225
- self.activeHandle = nil
226
- local _result = self.inputChangedListener
227
- if _result ~= nil then
228
- _result:Disconnect()
229
- end
230
- local _result_1 = self.inputEndedListener
231
- if _result_1 ~= nil then
232
- _result_1:Disconnect()
208
+ return function()
209
+ isDraggingRef.current = false
210
+ activeHandleRef.current = nil
211
+ inputChangedListener:Disconnect()
212
+ inputEndedListener:Disconnect()
233
213
  end
214
+ end, { getValueFromInput, updateValue })
215
+ local height = SizeHelper:toUDim(theme.height)
216
+ local _condition = props["min-value"]
217
+ if _condition == nil then
218
+ _condition = 0
234
219
  end
235
- function Slider:render()
236
- local theme = self.context.components.slider
237
- local height = SizeHelper:toUDim(theme.height)
238
- local _condition = self.props["min-value"]
239
- if _condition == nil then
240
- _condition = 0
241
- end
242
- local minValue = _condition
243
- local maxValue = self.props["max-value"]
244
- local valueRange = maxValue - minValue
245
- local currentValue = self:getCurrentValue()
246
- local firstValue
247
- local secondValue
248
- if self.props.range and typeof(currentValue) == "Vector2" then
249
- firstValue = currentValue.X
250
- secondValue = currentValue.Y
251
- else
252
- firstValue = if type(currentValue) == "number" then currentValue else currentValue.X
253
- end
254
- local getPosition = function(value)
255
- if valueRange <= 0 then
256
- return 0
257
- end
258
- return math.clamp((value - minValue) / valueRange, 0, 1)
259
- end
260
- local firstPosition = getPosition(firstValue)
261
- local secondPosition = if secondValue ~= nil then getPosition(secondValue) else nil
262
- local padding = SizeHelper:toUDim(theme.bar.padding)
263
- local handles = { {
264
- index = 0,
265
- position = firstPosition,
266
- } }
267
- if self.props.range and secondPosition ~= nil then
268
- local _arg0 = {
269
- index = 1,
270
- position = secondPosition,
271
- }
272
- table.insert(handles, _arg0)
220
+ local minValue = _condition
221
+ local maxValue = props["max-value"]
222
+ local valueRange = maxValue - minValue
223
+ local firstValue
224
+ local secondValue
225
+ if props.range and typeof(currentValue) == "Vector2" then
226
+ firstValue = currentValue.X
227
+ secondValue = currentValue.Y
228
+ else
229
+ firstValue = if type(currentValue) == "number" then currentValue else currentValue.X
230
+ end
231
+ local getPosition = function(sliderValue)
232
+ if valueRange <= 0 then
233
+ return 0
273
234
  end
274
- local _exp = React.createElement("frame", {
275
- Size = UDim2.new(UDim.new(1, 0), SizeHelper:toUDim(theme.bar.height)),
276
- Position = UDim2.fromScale(0.5, 0.5),
277
- AnchorPoint = Vector2.new(0.5, 0.5),
278
- BackgroundTransparency = theme.bar.backgroundTransparency,
279
- BackgroundColor3 = theme.bar.backgroundColor,
280
- }, React.createElement("uistroke", {
281
- Thickness = theme.bar.borderThickness,
282
- Color = theme.bar.borderColor,
283
- }), React.createElement("uicorner", {
284
- CornerRadius = SizeHelper:toUDim(theme.bar.cornerRadius),
285
- }))
286
- local _attributes = {
287
- ref = self.containerRef,
235
+ return math.clamp((sliderValue - minValue) / valueRange, 0, 1)
236
+ end
237
+ local firstPosition = getPosition(firstValue)
238
+ local secondPosition = if secondValue ~= nil then getPosition(secondValue) else nil
239
+ local padding = SizeHelper:toUDim(theme.bar.padding)
240
+ local handles = { {
241
+ index = 0,
242
+ position = firstPosition,
243
+ } }
244
+ if props.range and secondPosition ~= nil then
245
+ local _arg0 = {
246
+ index = 1,
247
+ position = secondPosition,
288
248
  }
289
- local _exp_1 = UDim2.fromScale(1, 1)
290
- local _uDim2 = UDim2.new(padding + padding, UDim.new(0, 0))
291
- _attributes.Size = _exp_1 - _uDim2
292
- _attributes.BackgroundTransparency = 1
293
- _attributes.Position = UDim2.fromScale(0.5, 0.5)
294
- _attributes.AnchorPoint = Vector2.new(0.5, 0.5)
295
- local _condition_1 = self.props.highlight ~= nil
296
- if _condition_1 then
297
- local _attributes_1 = {
298
- BackgroundColor3 = theme.bar.highlight.backgroundColor,
299
- BackgroundTransparency = theme.bar.highlight.backgroundTransparency,
300
- }
301
- local _result
302
- if self.props.highlight == "start" then
303
- local _exp_2 = UDim2.fromScale(0, 0.5)
249
+ table.insert(handles, _arg0)
250
+ end
251
+ local _exp = React.createElement("frame", {
252
+ Size = UDim2.new(UDim.new(1, 0), SizeHelper:toUDim(theme.bar.height)),
253
+ Position = UDim2.fromScale(0.5, 0.5),
254
+ AnchorPoint = Vector2.new(0.5, 0.5),
255
+ BackgroundTransparency = theme.bar.backgroundTransparency,
256
+ BackgroundColor3 = theme.bar.backgroundColor,
257
+ }, React.createElement("uistroke", {
258
+ Thickness = theme.bar.borderThickness,
259
+ Color = theme.bar.borderColor,
260
+ }), React.createElement("uicorner", {
261
+ CornerRadius = SizeHelper:toUDim(theme.bar.cornerRadius),
262
+ }))
263
+ local _attributes = {
264
+ ref = containerRef,
265
+ }
266
+ local _exp_1 = UDim2.fromScale(1, 1)
267
+ local _uDim2 = UDim2.new(padding + padding, UDim.new(0, 0))
268
+ _attributes.Size = _exp_1 - _uDim2
269
+ _attributes.BackgroundTransparency = 1
270
+ _attributes.Position = UDim2.fromScale(0.5, 0.5)
271
+ _attributes.AnchorPoint = Vector2.new(0.5, 0.5)
272
+ local _condition_1 = props.highlight ~= nil
273
+ if _condition_1 then
274
+ local _attributes_1 = {
275
+ BackgroundColor3 = theme.bar.highlight.backgroundColor,
276
+ BackgroundTransparency = theme.bar.highlight.backgroundTransparency,
277
+ }
278
+ local _result
279
+ if props.highlight == "start" then
280
+ local _exp_2 = UDim2.fromScale(0, 0.5)
281
+ local _uDim2_1 = UDim2.new(padding, UDim.new(0, 0))
282
+ _result = _exp_2 - _uDim2_1
283
+ else
284
+ local _result_1
285
+ if props.highlight == "end" then
286
+ local _exp_2 = UDim2.fromScale(1, 0.5)
304
287
  local _uDim2_1 = UDim2.new(padding, UDim.new(0, 0))
305
- _result = _exp_2 - _uDim2_1
288
+ _result_1 = _exp_2 + _uDim2_1
306
289
  else
307
- local _result_1
308
- if self.props.highlight == "end" then
309
- local _exp_2 = UDim2.fromScale(1, 0.5)
310
- local _uDim2_1 = UDim2.new(padding, UDim.new(0, 0))
311
- _result_1 = _exp_2 + _uDim2_1
312
- else
313
- _result_1 = UDim2.fromScale(firstPosition, 0.5)
314
- end
315
- _result = _result_1
290
+ _result_1 = UDim2.fromScale(firstPosition, 0.5)
316
291
  end
317
- _attributes_1.Position = _result
318
- _attributes_1.AnchorPoint = if self.props.highlight == "end" then Vector2.new(1, 0.5) else Vector2.new(0, 0.5)
319
- local _result_1
320
- if self.props.highlight == "start" then
321
- local _uDim2_1 = UDim2.new(UDim.new(firstPosition, 0), SizeHelper:toUDim(theme.bar.height))
292
+ _result = _result_1
293
+ end
294
+ _attributes_1.Position = _result
295
+ _attributes_1.AnchorPoint = if props.highlight == "end" then Vector2.new(1, 0.5) else Vector2.new(0, 0.5)
296
+ local _result_1
297
+ if props.highlight == "start" then
298
+ local _uDim2_1 = UDim2.new(UDim.new(firstPosition, 0), SizeHelper:toUDim(theme.bar.height))
299
+ local _uDim2_2 = UDim2.new(padding, UDim.new(0, 0))
300
+ _result_1 = _uDim2_1 + _uDim2_2
301
+ else
302
+ local _result_2
303
+ if props.highlight == "end" then
304
+ local _condition_2 = secondPosition
305
+ if _condition_2 == nil then
306
+ _condition_2 = firstPosition
307
+ end
308
+ local _uDim2_1 = UDim2.new(UDim.new(1 - _condition_2, 0), SizeHelper:toUDim(theme.bar.height))
322
309
  local _uDim2_2 = UDim2.new(padding, UDim.new(0, 0))
323
- _result_1 = _uDim2_1 + _uDim2_2
310
+ _result_2 = _uDim2_1 + _uDim2_2
324
311
  else
325
- local _result_2
326
- if self.props.highlight == "end" then
327
- local _condition_2 = secondPosition
328
- if _condition_2 == nil then
329
- _condition_2 = firstPosition
330
- end
331
- local _uDim2_1 = UDim2.new(UDim.new(1 - _condition_2, 0), SizeHelper:toUDim(theme.bar.height))
332
- local _uDim2_2 = UDim2.new(padding, UDim.new(0, 0))
333
- _result_2 = _uDim2_1 + _uDim2_2
334
- else
335
- local _condition_2 = secondPosition
336
- if _condition_2 == nil then
337
- _condition_2 = 0
338
- end
339
- _result_2 = UDim2.new(UDim.new(_condition_2 - firstPosition, 0), SizeHelper:toUDim(theme.bar.height))
312
+ local _condition_2 = secondPosition
313
+ if _condition_2 == nil then
314
+ _condition_2 = 0
340
315
  end
341
- _result_1 = _result_2
342
- end
343
- _attributes_1.Size = _result_1
344
- _condition_1 = React.createElement("frame", _attributes_1, React.createElement("uistroke", {
345
- Thickness = theme.bar.borderThickness,
346
- Color = theme.bar.highlight.borderColor,
347
- }), React.createElement("uicorner", {
348
- CornerRadius = SizeHelper:toUDim(theme.bar.cornerRadius),
349
- }))
350
- end
351
- -- ▼ ReadonlyArray.map ▼
352
- local _newValue = table.create(#handles)
353
- local _callback = function(_param)
354
- local index = _param.index
355
- local position = _param.position
356
- local _exp_2 = React.createElement("uistroke", {
357
- Thickness = theme.handle.borderThickness,
358
- Color = theme.handle.borderColor,
359
- })
360
- local _exp_3 = React.createElement("uicorner", {
361
- CornerRadius = SizeHelper:toUDim(theme.handle.cornerRadius),
362
- })
363
- local _exp_4 = (self.state.hoveredHandle == index or (self.state.dragging and self.activeHandle == index)) and (React.createElement(BoxShadow, {
364
- ["box-shadow"] = theme.handle.boxShadow,
365
- }))
366
- local _attributes_1 = {}
367
- local _condition_2 = theme.handle.aspectRation
368
- if _condition_2 == nil then
369
- _condition_2 = 1
316
+ _result_2 = UDim2.new(UDim.new(_condition_2 - firstPosition, 0), SizeHelper:toUDim(theme.bar.height))
370
317
  end
371
- _attributes_1.AspectRatio = _condition_2
372
- _attributes_1.DominantAxis = Enum.DominantAxis.Height
373
- _attributes_1.AspectType = Enum.AspectType.ScaleWithParentSize
374
- return React.createElement("frame", {
375
- key = index,
376
- Position = UDim2.fromScale(position, 0.5),
377
- AnchorPoint = Vector2.new(0.5, 0.5),
378
- Size = UDim2.fromScale(0, 1),
379
- BackgroundTransparency = theme.handle.backgroundTransparency,
380
- BackgroundColor3 = theme.handle.backgroundColor,
381
- BorderSizePixel = 0,
382
- Event = {
383
- InputBegan = function(_instance, input)
384
- self:beginDragging(index, input)
385
- end,
386
- MouseEnter = function()
387
- self:setState({
388
- hoveredHandle = index,
389
- })
390
- end,
391
- MouseLeave = function()
392
- self:setState(function(state)
393
- return {
394
- hoveredHandle = if state.hoveredHandle == index then React.None else (if state.hoveredHandle == nil then React.None else state.hoveredHandle),
395
- }
396
- end)
397
- end,
398
- },
399
- }, _exp_2, _exp_3, _exp_4, React.createElement("uiaspectratioconstraint", _attributes_1))
318
+ _result_1 = _result_2
400
319
  end
401
- for _k, _v in handles do
402
- _newValue[_k] = _callback(_v, _k - 1, handles)
320
+ _attributes_1.Size = _result_1
321
+ _condition_1 = (React.createElement("frame", _attributes_1, React.createElement("uistroke", {
322
+ Thickness = theme.bar.borderThickness,
323
+ Color = theme.bar.highlight.borderColor,
324
+ }), React.createElement("uicorner", {
325
+ CornerRadius = SizeHelper:toUDim(theme.bar.cornerRadius),
326
+ })))
327
+ end
328
+ -- ▼ ReadonlyArray.map ▼
329
+ local _newValue = table.create(#handles)
330
+ local _callback = function(_param)
331
+ local index = _param.index
332
+ local position = _param.position
333
+ local _exp_2 = React.createElement("uistroke", {
334
+ Thickness = theme.handle.borderThickness,
335
+ Color = theme.handle.borderColor,
336
+ })
337
+ local _exp_3 = React.createElement("uicorner", {
338
+ CornerRadius = SizeHelper:toUDim(theme.handle.cornerRadius),
339
+ })
340
+ local _exp_4 = (hoveredHandle == index or (dragging and activeHandleRef.current == index)) and (React.createElement(BoxShadow, {
341
+ ["box-shadow"] = theme.handle.boxShadow,
342
+ }))
343
+ local _attributes_1 = {}
344
+ local _condition_2 = theme.handle.aspectRation
345
+ if _condition_2 == nil then
346
+ _condition_2 = 1
403
347
  end
404
- -- ReadonlyArray.map ▲
348
+ _attributes_1.AspectRatio = _condition_2
349
+ _attributes_1.DominantAxis = Enum.DominantAxis.Height
350
+ _attributes_1.AspectType = Enum.AspectType.ScaleWithParentSize
405
351
  return React.createElement("frame", {
406
- Size = UDim2.new(UDim.new(1, 0), height),
407
- BackgroundTransparency = 1,
408
- }, _exp, React.createElement("frame", _attributes, _condition_1, _newValue))
352
+ key = index,
353
+ Position = UDim2.fromScale(position, 0.5),
354
+ AnchorPoint = Vector2.new(0.5, 0.5),
355
+ Size = UDim2.fromScale(0, 1),
356
+ BackgroundTransparency = theme.handle.backgroundTransparency,
357
+ BackgroundColor3 = theme.handle.backgroundColor,
358
+ BorderSizePixel = 0,
359
+ Event = {
360
+ InputBegan = function(_instance, input)
361
+ beginDragging(index, input)
362
+ end,
363
+ MouseEnter = function()
364
+ setHoveredHandle(index)
365
+ end,
366
+ MouseLeave = function()
367
+ setHoveredHandle(function(currentHoveredHandle)
368
+ return if currentHoveredHandle == index then nil else currentHoveredHandle
369
+ end)
370
+ end,
371
+ },
372
+ }, _exp_2, _exp_3, _exp_4, React.createElement("uiaspectratioconstraint", _attributes_1))
373
+ end
374
+ for _k, _v in handles do
375
+ _newValue[_k] = _callback(_v, _k - 1, handles)
409
376
  end
410
- Slider.contextType = CleanThemeContext
411
- Slider = ReactComponent(Slider) or Slider
412
- end
377
+ -- ▲ ReadonlyArray.map
378
+ return React.createElement("frame", {
379
+ ref = ref,
380
+ Size = UDim2.new(UDim.new(1, 0), height),
381
+ BackgroundTransparency = 1,
382
+ }, _exp, React.createElement("frame", _attributes, _condition_1, _newValue))
383
+ end)
413
384
  return {
414
385
  Slider = Slider,
415
386
  }