@rbxts/uiblox 0.1.49 → 0.1.51
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/theme/hooks/useTheme.luau +12 -7
- package/out/ui/packages/button/components/Button.d.ts +1 -0
- package/out/ui/packages/button/components/Button.luau +10 -3
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +6 -0
- package/out/ui/packages/loadingStroke/components/LoadingStroke.luau +63 -0
- package/out/ui/packages/loadingStroke/index.d.ts +3 -0
- package/out/ui/packages/loadingStroke/init.luau +8 -0
- package/package.json +1 -1
|
@@ -1,22 +1,27 @@
|
|
|
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 useEffect = _react.useEffect
|
|
5
5
|
local useMemo = _react.useMemo
|
|
6
6
|
local useState = _react.useState
|
|
7
7
|
local themeProducer = TS.import(script, script.Parent.Parent, "context", "ThemeProducer").themeProducer
|
|
8
8
|
local useTheme = function()
|
|
9
9
|
local theme, setTheme = useState(themeProducer:getState())
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
useEffect(function()
|
|
11
|
+
local unsubscribeFn = themeProducer:subscribe(function(state, _previousState)
|
|
12
|
+
setTheme(state)
|
|
13
|
+
end)
|
|
14
|
+
return function()
|
|
15
|
+
unsubscribeFn()
|
|
16
|
+
end
|
|
12
17
|
end)
|
|
13
|
-
local
|
|
14
|
-
themeProducer.setTheme
|
|
15
|
-
end, { setTheme })
|
|
18
|
+
local memoizedSetTheme = useMemo(function()
|
|
19
|
+
return themeProducer.setTheme
|
|
20
|
+
end, { themeProducer.setTheme })
|
|
16
21
|
return useMemo(function()
|
|
17
22
|
return {
|
|
18
23
|
theme = theme,
|
|
19
|
-
setTheme =
|
|
24
|
+
setTheme = memoizedSetTheme,
|
|
20
25
|
}
|
|
21
26
|
end, { theme, setTheme })
|
|
22
27
|
end
|
|
@@ -4,6 +4,7 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local React = _react
|
|
5
5
|
local useState = _react.useState
|
|
6
6
|
local useButtonStyles = TS.import(script, script.Parent, "Button.styles").default
|
|
7
|
+
local LoadingStroke = TS.import(script, script.Parent.Parent.Parent, "loadingStroke").LoadingStroke
|
|
7
8
|
local function Button(props)
|
|
8
9
|
local _binding = props
|
|
9
10
|
local text = _binding.text
|
|
@@ -30,6 +31,10 @@ local function Button(props)
|
|
|
30
31
|
if hoveringDisabled == nil then
|
|
31
32
|
hoveringDisabled = false
|
|
32
33
|
end
|
|
34
|
+
local animating = _binding.animating
|
|
35
|
+
if animating == nil then
|
|
36
|
+
animating = false
|
|
37
|
+
end
|
|
33
38
|
local onLeftClick = _binding.onLeftClick
|
|
34
39
|
local onLeftDown = _binding.onLeftDown
|
|
35
40
|
local onLeftUp = _binding.onLeftUp
|
|
@@ -61,10 +66,10 @@ local function Button(props)
|
|
|
61
66
|
for _k, _v in font do
|
|
62
67
|
_attributes[_k] = _v
|
|
63
68
|
end
|
|
64
|
-
_attributes.Active = not disabled
|
|
69
|
+
_attributes.Active = not disabled
|
|
65
70
|
_attributes.Text = text
|
|
66
71
|
local _result
|
|
67
|
-
if (not hoveringDisabled and hovering) or disabled
|
|
72
|
+
if (not hoveringDisabled and hovering) or disabled then
|
|
68
73
|
_result = 0.75
|
|
69
74
|
else
|
|
70
75
|
local _result_1 = className
|
|
@@ -151,7 +156,9 @@ local function Button(props)
|
|
|
151
156
|
setmetatable(_attributes_1, nil)
|
|
152
157
|
_condition_2 = React.createElement("uicorner", _attributes_1)
|
|
153
158
|
end
|
|
154
|
-
return React.createElement("textbutton", _attributes, _condition_1, _condition_2, children
|
|
159
|
+
return React.createElement("textbutton", _attributes, _condition_1, _condition_2, children, React.createElement(LoadingStroke, {
|
|
160
|
+
animating = animating,
|
|
161
|
+
}))
|
|
155
162
|
end
|
|
156
163
|
local default = Button
|
|
157
164
|
return {
|
|
@@ -0,0 +1,63 @@
|
|
|
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 React = _react
|
|
5
|
+
local useEffect = _react.useEffect
|
|
6
|
+
local useRef = _react.useRef
|
|
7
|
+
local TweenService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TweenService
|
|
8
|
+
local function LoadingStroke(props)
|
|
9
|
+
local _binding = props
|
|
10
|
+
local animating = _binding.animating
|
|
11
|
+
if animating == nil then
|
|
12
|
+
animating = false
|
|
13
|
+
end
|
|
14
|
+
local className = _binding.className
|
|
15
|
+
local children = _binding.children
|
|
16
|
+
local id = _binding.id
|
|
17
|
+
local ref = _binding.ref
|
|
18
|
+
local gradientRef = useRef()
|
|
19
|
+
useEffect(function()
|
|
20
|
+
if gradientRef.current then
|
|
21
|
+
if animating then
|
|
22
|
+
local tween = TweenService:Create(gradientRef.current, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, false), {
|
|
23
|
+
Rotation = 360,
|
|
24
|
+
})
|
|
25
|
+
tween:Play()
|
|
26
|
+
return function()
|
|
27
|
+
return tween:Destroy()
|
|
28
|
+
end
|
|
29
|
+
else
|
|
30
|
+
gradientRef.current.Rotation = 0
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end, { animating })
|
|
34
|
+
local _condition = animating
|
|
35
|
+
if _condition then
|
|
36
|
+
local _attributes = {}
|
|
37
|
+
local _condition_1 = id
|
|
38
|
+
if not (_condition_1 ~= 0 and _condition_1 == _condition_1 and _condition_1 ~= "" and _condition_1) then
|
|
39
|
+
_condition_1 = "LoadingStroke"
|
|
40
|
+
end
|
|
41
|
+
_attributes.key = _condition_1
|
|
42
|
+
_attributes.ref = ref
|
|
43
|
+
_attributes.Color = Color3.fromRGB(255, 255, 255)
|
|
44
|
+
_attributes.Thickness = 2
|
|
45
|
+
_attributes.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
|
|
46
|
+
if className then
|
|
47
|
+
for _k, _v in className do
|
|
48
|
+
_attributes[_k] = _v
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
_condition = (React.createElement("uistroke", _attributes, React.createElement("uigradient", {
|
|
52
|
+
ref = gradientRef,
|
|
53
|
+
Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.5, 0), NumberSequenceKeypoint.new(1, 1) }),
|
|
54
|
+
Rotation = 0,
|
|
55
|
+
Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(0.5, Color3.fromRGB(235, 235, 235)), ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 255, 255)) }),
|
|
56
|
+
}), children))
|
|
57
|
+
end
|
|
58
|
+
return React.createElement(React.Fragment, nil, _condition)
|
|
59
|
+
end
|
|
60
|
+
local default = LoadingStroke
|
|
61
|
+
return {
|
|
62
|
+
default = default,
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
exports.LoadingStroke = TS.import(script, script, "components", "LoadingStroke").default
|
|
5
|
+
for _k, _v in TS.import(script, script, "components", "LoadingStroke") or {} do
|
|
6
|
+
exports[_k] = _v
|
|
7
|
+
end
|
|
8
|
+
return exports
|