local T=script.Parent.Parent.Parent local O=require(T.Constants)local a=require(T.Packages.Roact)local D=require(T.Packages.StudioComponents)local w=D.Checkbox local v=D.withTheme local H=O.GridCellSize local t=O.CheckboxHeight local A=Vector2.new(t,t)local c=(H-A)*.5 local function I(T)return v(function(O)local D=O:GetColor(Enum.StudioStyleGuideColor.MainBackground)if not T.Disabled and T.Highlighted then D=O:GetColor(Enum.StudioStyleGuideColor.Button,Enum.StudioStyleGuideModifier.Hover)end return a.createElement("\070\114\097\109\101",{LayoutOrder=T.LayoutOrder,BackgroundColor3=D;BorderSizePixel=0;Size=UDim2.fromOffset(H.x,H.y);[a.Event.InputBegan]=function(O,a)if T.Disabled then return end if a.UserInputType==Enum.UserInputType.MouseMovement then T.OnHoverBegan()end end;[a.Event.InputEnded]=function(O,a)if a.UserInputType==Enum.UserInputType.MouseMovement then T.OnHoverEnded()end end},{Holder=a.createElement("\070\114\097\109\101",{Position=UDim2.fromOffset(c.x,c.y),Size=UDim2.fromOffset(A.x,A.y);BackgroundTransparency=1},{Checkbox=a.createElement(w,{Value=T.Collidable,OnActivated=T.OnActivated,Disabled=T.Disabled})})})end)end return I
local Plugin = script.Parent.Parent.Parent
local Constants = require(Plugin.Constants)

local Roact = require(Plugin.Packages.Roact)
local StudioComponents = require(Plugin.Packages.StudioComponents)

local Checkbox = StudioComponents.Checkbox
local withTheme = StudioComponents.withTheme

local CELL_SIZE = Constants.GridCellSize
local CHECKBOX_HEIGHT = Constants.CheckboxHeight

local size = Vector2.new(CHECKBOX_HEIGHT, CHECKBOX_HEIGHT)
local offset = (CELL_SIZE - size) * 0.5

local function GridItem(props)
	return withTheme(function(theme)
		local color = theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
		if not props.Disabled and props.Highlighted then
			color = theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Hover)
		end
		return Roact.createElement("Frame", {
			LayoutOrder = props.LayoutOrder,
			BackgroundColor3 = color,
			BorderSizePixel = 0,
			Size = UDim2.fromOffset(CELL_SIZE.x, CELL_SIZE.y),
			[Roact.Event.InputBegan] = function(_, input)
				if props.Disabled then
					return
				end
				if input.UserInputType == Enum.UserInputType.MouseMovement then
					props.OnHoverBegan()
				end
			end,
			[Roact.Event.InputEnded] = function(_, input)
				if input.UserInputType == Enum.UserInputType.MouseMovement then
					props.OnHoverEnded()
				end
			end,
		}, {
			Holder = Roact.createElement("Frame", {
				Position = UDim2.fromOffset(offset.x, offset.y),
				Size = UDim2.fromOffset(size.x, size.y),
				BackgroundTransparency = 1,
			}, {
				Checkbox = Roact.createElement(Checkbox, {
					Value = props.Collidable,
					OnActivated = props.OnActivated,
					Disabled = props.Disabled,
				}),
			}),
		})
	end)
end

return GridItem
