local C=script.Parent.Parent.Parent.Parent local U=C.Parent local Z=require(C.Theme)local b=Z.WithTheme local p=require(U.Roact)local w=p.createElement local m=require(script.Parent.Checkbox)local O=UDim.new(0,8)local M=p.PureComponent:extend(script.Name)function M.init(C)C:setState({Selected=nil})end function M.render(C)local U=C.props local Z=C.state return b(function(b)local M=w(m,{Label=Z.Selected==nil and"\073\110\100\101\116\101\114\109\105\110\097\116\101"or Z.Selected==true and"\083\101\108\101\099\116\101\100"or"\068\101\115\101\108\101\099\116\101\100";Selected=Z.Selected,Disabled=C.props.Disabled,[p.Event.Activated]=function(...)print(...)C:setState({Selected=not Z.Selected})end})if U.OnBackground then return w("\070\114\097\109\101",{BackgroundTransparency=U.BackgroundTransparency,BackgroundColor3=b["\099\111\108\111\114\115\047\066\097\099\107\103\114\111\117\110\100\047\070\105\108\108\095\067\111\108\111\114\047\083\111\108\105\100\095\066\097\099\107\103\114\111\117\110\100\047\066\097\115\101"].Color;AutomaticSize="\088\089",Size=UDim2.new(1,0,0,45)},{Padding=w("\085\073\080\097\100\100\105\110\103",{PaddingBottom=O;PaddingLeft=O;PaddingRight=O;PaddingTop=O}),Checkbox=M})else return M end end)end local r={OnBackground=true,Disabled=false}return{storyElement=M;roact=p;controls=r,stories={Checkbox=function(C)local U=C.controls return p.createElement(M,U)end}}
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent

local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme

local Roact = require(Packages.Roact)
local new = Roact.createElement

local Checkbox = require(script.Parent.Checkbox)

local BORDER_PADDING = UDim.new(0, 8)

local CheckboxStory = Roact.PureComponent:extend(script.Name)

function CheckboxStory:init()
	self:setState({
		Selected = nil
	})
end

function CheckboxStory:render()
	local props = self.props
	local state = self.state

	return WithTheme(function(Theme)

		local Checkbox = new(Checkbox, {
			Label = state.Selected == nil and 'Indeterminate' or state.Selected == true and 'Selected' or 'Deselected',
			Selected = state.Selected,
			Disabled = self.props.Disabled,
			[Roact.Event.Activated] = function(...)
				print(...)
				self:setState({
					Selected = not state.Selected
				})
			end
		})

		if props.OnBackground then
			return new('Frame', {
				BackgroundTransparency = props.BackgroundTransparency,
				BackgroundColor3 = Theme['colors/Background/Fill_Color/Solid_Background/Base'].Color,
				AutomaticSize = 'XY',
				Size = UDim2.new(1, 0, 0, 45)
			}, {
				Padding = new('UIPadding', {
				PaddingBottom = BORDER_PADDING,
				PaddingLeft = BORDER_PADDING,
				PaddingRight = BORDER_PADDING,
				PaddingTop = BORDER_PADDING,
			}),
				Checkbox = Checkbox
			})
		else
			return Checkbox
		end
	end)	
end

local Controls = {
	OnBackground = true,
	Disabled = false
}

return {
	storyElement = CheckboxStory,
	roact = Roact,
	controls = Controls,
	stories = {
		Checkbox = function(props)
			local controls = props.controls

			return Roact.createElement(CheckboxStory, controls)
		end
	}
}
