diff --git a/src/Components/ScrollingFrame.lua b/src/Components/ScrollingFrame.lua index 99a7468..a9a10a9 100644 --- a/src/Components/ScrollingFrame.lua +++ b/src/Components/ScrollingFrame.lua @@ -3,6 +3,7 @@ local Fusion = require(OnyxUI.Parent.Fusion) local Themer = require(OnyxUI.Utils.Themer) local PubTypes = require(OnyxUI.Utils.PubTypes) local CombineProps = require(OnyxUI.Utils.CombineProps) +local EnsureValue = require(OnyxUI.Utils.EnsureValue) local Hydrate = Fusion.Hydrate local Computed = Fusion.Computed @@ -28,34 +29,51 @@ export type Props = Base.Props & { } return function(Props: Props) - return Hydrate(Base(CombineProps(Props, { - ClassName = "ScrollingFrame", - Name = "ScrollingFrame", - }))) { - BottomImage = Computed(function() + local BottomImage = EnsureValue( + Props.BottomImage, + "string", + Computed(function() if Themer.Theme.CornerRadius["1"]:get() >= 3 then return "rbxassetid://16547643439" else return "rbxassetid://16547330984" end - end), - TopImage = Computed(function() + end) + ) + local TopImage = EnsureValue( + Props.TopImage, + "string", + Computed(function() if Themer.Theme.CornerRadius["1"]:get() >= 3 then return "rbxassetid://16547667444" else return "rbxassetid://16547330984" end - end), - MidImage = "rbxassetid://16547330984", + end) + ) + local MidImage = EnsureValue(Props.MidImage, "string", "rbxassetid://16547330984") + local ScrollBarImageColor3 = + EnsureValue(Props.ScrollBarImageColor3, "Color3", Themer.Theme.Colors.NeutralContent.Dark) + local ScrollBarImageTransparency = EnsureValue(Props.ScrollBarImageTransparency, "number", 0) + local ScrollBarThickness = EnsureValue(Props.ScrollBarThickness, "number", 8) + local AutomaticCanvasSize = EnsureValue(Props.AutomaticCanvasSize, "EnumItem", Enum.AutomaticSize.Y) + local ScrollingDirection = EnsureValue(Props.ScrollingDirection, "EnumItem", Enum.ScrollingDirection.Y) + + return Hydrate(Base(CombineProps(Props, { + ClassName = "ScrollingFrame", + Name = "ScrollingFrame", Selectable = false, - ScrollBarImageColor3 = Themer.Theme.Colors.NeutralContent.Dark, - ScrollBarImageTransparency = 0, - ScrollBarThickness = 8, BackgroundTransparency = 1, - AutomaticCanvasSize = Enum.AutomaticSize.Y, - ScrollingDirection = Enum.ScrollingDirection.Y, AutomaticSize = Enum.AutomaticSize.None, - + }))) { + BottomImage = BottomImage, + TopImage = TopImage, + MidImage = MidImage, + ScrollBarImageColor3 = ScrollBarImageColor3, + ScrollBarImageTransparency = ScrollBarImageTransparency, + ScrollBarThickness = ScrollBarThickness, + AutomaticCanvasSize = AutomaticCanvasSize, + ScrollingDirection = ScrollingDirection, CanvasPosition = Props.CanvasPosition, CanvasSize = Props.CanvasSize, ElasticBehavior = Props.ElasticBehavior, diff --git a/src/Components/Text.lua b/src/Components/Text.lua index d83426b..0aebb28 100644 --- a/src/Components/Text.lua +++ b/src/Components/Text.lua @@ -47,16 +47,16 @@ return function(Props: Props) ClassName = "TextLabel", Name = "Text", AutomaticSize = Enum.AutomaticSize.XY, + ClipsDescendants = false, + BackgroundTransparency = 1, }))) { TextColor3 = TextColor3, TextSize = TextSize, RichText = RichText, FontFace = FontFace, TextWrapped = TextWrapped, - ClipsDescendants = false, TextXAlignment = TextXAlignment, TextYAlignment = TextYAlignment, - BackgroundTransparency = 1, Text = Props.Text, TextTransparency = Props.TextTransparency, diff --git a/src/Components/TextInput.lua b/src/Components/TextInput.lua index 99f04e2..ae4499d 100644 --- a/src/Components/TextInput.lua +++ b/src/Components/TextInput.lua @@ -27,6 +27,13 @@ export type Props = Base.Props & { ClearTextOnFocus: PubTypes.CanBeState?, TextWrapped: PubTypes.CanBeState?, MultiLine: PubTypes.CanBeState?, + TextSize: PubTypes.CanBeState?, + TextColor3: PubTypes.CanBeState?, + FontFace: PubTypes.CanBeState?, + PlaceholderColor3: PubTypes.CanBeState?, + TextXAlignment: PubTypes.CanBeState?, + TextYAlignment: PubTypes.CanBeState?, + IsFocused: PubTypes.CanBeState?, OnFocused: PubTypes.CanBeState<() -> ()>?, OnFocusLost: PubTypes.CanBeState<() -> ()>?, @@ -39,6 +46,34 @@ return function(Props: Props) local CharacterLimit = EnsureValue(Props.CharacterLimit, "number", -1) local ClearTextOnFocus = EnsureValue(Props.ClearTextOnFocus, "boolean", false) local PlaceholderText = EnsureValue(Props.PlaceholderText, "string", "") + local TextSize = EnsureValue(Props.TextSize, "number", Themer.Theme.TextSize["1"]) + local PlaceholderColor3 = EnsureValue( + Props.PlaceholderColor3, + "Color3", + Computed(function() + if Disabled:get() then + return Themer.Theme.Colors.NeutralContent.Dark:get() + else + return Themer.Theme.Colors.NeutralContent.Light:get() + end + end) + ) + local TextColor3 = EnsureValue( + Props.TextColor3, + "Color3", + Computed(function() + return Themer.Theme.Colors.BaseContent.Main:get() + end) + ) + local FontFace = EnsureValue( + Props.FontFace, + "Font", + Computed(function() + return Font.new(Themer.Theme.Font.Body:get(), Themer.Theme.FontWeight.Body:get()) + end) + ) + local TextXAlignment = EnsureValue(Props.TextXAlignment, "EnumItem", Enum.TextXAlignment.Left) + local TextYAlignment = EnsureValue(Props.TextYAlignment, "EnumItem", Enum.TextYAlignment.Top) local RemainingCharaters = Value(-1) local IsFocused = EnsureValue(Props.IsFocused, "boolean", false) @@ -98,29 +133,20 @@ return function(Props: Props) [Cleanup] = Observers, }))) { Text = Text, - TextColor3 = Computed(function() - return Themer.Theme.Colors.BaseContent.Main:get() - end), - TextSize = Themer.Theme.TextSize["1"], - FontFace = Computed(function() - return Font.new(Themer.Theme.Font.Body:get(), Themer.Theme.FontWeight.Body:get()) - end), - PlaceholderColor3 = Computed(function() - if Disabled:get() then - return Themer.Theme.Colors.NeutralContent.Dark:get() - else - return Themer.Theme.Colors.NeutralContent.Light:get() - end - end), + TextColor3 = TextColor3, + TextSize = TextSize, + FontFace = FontFace, + PlaceholderColor3 = PlaceholderColor3, PlaceholderText = PlaceholderText, - TextXAlignment = Enum.TextXAlignment.Left, - TextYAlignment = Enum.TextYAlignment.Top, - MultiLine = Props.MultiLine, + TextXAlignment = TextXAlignment, + TextYAlignment = TextYAlignment, ClearTextOnFocus = ClearTextOnFocus, + MultiLine = Props.MultiLine, + TextWrapped = Props.TextWrapped, + TextEditable = Computed(function() return not Disabled:get() end), - TextWrapped = Props.TextWrapped, [OnEvent "Focused"] = function() if not Disabled:get() then