local G=require(script.Parent.Parent.Runtime)local M=require(script.Parent.Parent.Style)local t=require(script.Parent.Parent.create)return G.widget(function(m)local D,n=G.useState(false)local E=G.useInstance(function(G)local m=M.get()return t("\084\101\120\116\066\117\116\116\111\110",{[G]="\098\117\116\116\111\110",BackgroundColor3=m.bg3,BorderSizePixel=0;Font=Enum.Font.SourceSans;Size=UDim2.new(0,100,0,40),TextColor3=m.textColor,AutomaticSize=Enum.AutomaticSize.X;TextSize=21;t("\085\073\080\097\100\100\105\110\103",{PaddingLeft=UDim.new(0,10),PaddingRight=UDim.new(0,10)});t("\085\073\067\111\114\110\101\114");Activated=function()n(true)end})end)local P=E.button P.Text=m local q={clicked=function()if D then n(false)return true end return false end}return q end)
--[=[
	@within Plasma
	@function button
	@tag widgets
	@param label string -- The label for the checkbox
	@return ButtonWidgetHandle

	A text button.

	Returns a widget handle, which has the field:

	- `clicked`, a function you can call to check if the checkbox was clicked this frame

	![A button](https://i.eryn.io/2150/RobloxStudioBeta-iwRM0RMx.png)

	```lua
	Plasma.window("Button", function()
		if Plasma.button("button text"):clicked() then
			print("clicked!")
		end
	end)
	```
]=]

local Runtime = require(script.Parent.Parent.Runtime)
local Style = require(script.Parent.Parent.Style)
local create = require(script.Parent.Parent.create)

return Runtime.widget(function(text)
	local clicked, setClicked = Runtime.useState(false)
	local refs = Runtime.useInstance(function(ref)
		local style = Style.get()

		return create("TextButton", {
			[ref] = "button",
			BackgroundColor3 = style.bg3,
			BorderSizePixel = 0,
			Font = Enum.Font.SourceSans,
			Size = UDim2.new(0, 100, 0, 40),
			TextColor3 = style.textColor,
			AutomaticSize = Enum.AutomaticSize.X,
			TextSize = 21,

			create("UIPadding", {
				PaddingLeft = UDim.new(0, 10),
				PaddingRight = UDim.new(0, 10),
			}),

			create("UICorner"),

			Activated = function()
				setClicked(true)
			end,
		})
	end)

	local instance = refs.button

	instance.Text = text

	local handle = {
		clicked = function()
			if clicked then
				setClicked(false)
				return true
			end

			return false
		end,
	}

	return handle
end)
