-- Compiled with roblox-ts v3.0.0 local TS = _G[script] local React = TS.import(script, TS.getModule(script, "@lattice-ui", "core").out).React local _style = TS.import(script, TS.getModule(script, "@lattice-ui", "style").out) local mergeGuiProps = _style.mergeGuiProps local resolveSx = _style.resolveSx local useTheme = _style.useTheme local _space = TS.import(script, script.Parent, "space") local resolvePadding = _space.resolvePadding local resolveSpace = _space.resolveSpace local function toHorizontalAlignment(value) repeat if value == "center" then return Enum.HorizontalAlignment.Center end if value == "end" then return Enum.HorizontalAlignment.Right end return Enum.HorizontalAlignment.Left until true end local function toVerticalAlignment(value) repeat if value == "center" then return Enum.VerticalAlignment.Center end if value == "end" then return Enum.VerticalAlignment.Bottom end return Enum.VerticalAlignment.Top until true end local function toAutomaticSize(autoSize, direction) if autoSize == nil or autoSize == false then return Enum.AutomaticSize.None end if autoSize == true then return if direction == "vertical" then Enum.AutomaticSize.Y else Enum.AutomaticSize.X end repeat if autoSize == "x" then return Enum.AutomaticSize.X end if autoSize == "y" then return Enum.AutomaticSize.Y end if autoSize == "xy" then return Enum.AutomaticSize.XY end return Enum.AutomaticSize.None until true end local function Stack(props) local direction = props.direction or "vertical" local _condition = props.gap if _condition == nil then _condition = 0 end local gap = _condition local align = props.align or "start" local justify = props.justify or "start" local autoSize = props.autoSize local sx = props.sx local children = props.children local asChild = props.asChild if asChild ~= nil then error("[Stack] `asChild` is not supported in M3.") end local restProps = {} for rawKey, value in pairs(props) do if not (type(rawKey) == "string") then continue end if rawKey == "direction" or rawKey == "gap" or rawKey == "align" or rawKey == "justify" or rawKey == "autoSize" or rawKey == "sx" or rawKey == "asChild" or rawKey == "padding" or rawKey == "paddingX" or rawKey == "paddingY" or rawKey == "paddingTop" or rawKey == "paddingRight" or rawKey == "paddingBottom" or rawKey == "paddingLeft" or rawKey == "children" then continue end restProps[rawKey] = value end local _binding = useTheme() local theme = _binding.theme local sxProps = resolveSx(sx, theme) local baseProps = { BackgroundTransparency = 1, BorderSizePixel = 0, AutomaticSize = toAutomaticSize(autoSize, direction), } local mergedProps = mergeGuiProps(baseProps, sxProps, restProps) local resolvedGap = resolveSpace(theme, gap) local padding = resolvePadding(theme, props) local hasPadding = padding.top > 0 or padding.right > 0 or padding.bottom > 0 or padding.left > 0 local vertical = direction == "vertical" local horizontalAlignment = if vertical then toHorizontalAlignment(align) else toHorizontalAlignment(justify) local verticalAlignment = if vertical then toVerticalAlignment(justify) else toVerticalAlignment(align) local _attributes = table.clone(mergedProps) setmetatable(_attributes, nil) return React.createElement("frame", _attributes, React.createElement("uilistlayout", { FillDirection = if vertical then Enum.FillDirection.Vertical else Enum.FillDirection.Horizontal, HorizontalAlignment = horizontalAlignment, Padding = UDim.new(0, resolvedGap), SortOrder = Enum.SortOrder.LayoutOrder, VerticalAlignment = verticalAlignment, }), if hasPadding then (React.createElement("uipadding", { PaddingBottom = UDim.new(0, padding.bottom), PaddingLeft = UDim.new(0, padding.left), PaddingRight = UDim.new(0, padding.right), PaddingTop = UDim.new(0, padding.top), })) else nil, children) end return { Stack = Stack, }