{"version":3,"file":"Layout.cjs","names":["_styled","_interopRequireDefault","require","_react","_Box","_OdysseyDesignTokensContext","_jsxRuntime","e","__esModule","default","LayoutContent","styled","shouldForwardProp","prop","includes","odysseyDesignTokens","regions","display","gridTemplateColumns","gridGap","Spacing4","gap","marginBlockStart","Layout","children","useOdysseyDesignTokens","mappedRegions","map","region","join","jsx","Box","Children","toArray","child","MemoizedLayout","exports","memo","displayName"],"sources":["../../../../src/labs/PageTemplate/Layout.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { Children, memo, ReactNode } from \"react\";\n\nimport { Box } from \"../../Box.js\";\nimport {\n  DesignTokens,\n  useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\n\ntype SupportedRegionRatios =\n  | [1]\n  | [1, 1]\n  | [1, 2]\n  | [2, 1]\n  | [1, 3]\n  | [3, 1]\n  | [1, 1, 1]\n  | [1, 1, 1, 1];\n\nexport type LayoutProps = {\n  /**\n   * The content of the Grid. May be a `string` or any other `ReactNode` or array of `ReactNode`s.\n   */\n  children?: ReactNode;\n  /**\n   * The supported region ratios for the Grid. Each number is a fractional unit that is mapped to the 'fr' CSS unit. e.g. [2, 1] defines a 2/3, 1/3 layout and [1, 1, 1] defines a 1/3, 1/3, 1/3 layout\n   * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Basic_concepts_of_grid_layout#the_fr_unit\n   */\n  regions: SupportedRegionRatios;\n};\n\ninterface LayoutContentProps {\n  odysseyDesignTokens: DesignTokens;\n  regions: string;\n}\n\nconst LayoutContent = styled(\"div\", {\n  shouldForwardProp: (prop) =>\n    ![\"odysseyDesignTokens\", \"regions\"].includes(prop),\n})<LayoutContentProps>(({ odysseyDesignTokens, regions }) => ({\n  display: \"grid\",\n  gridTemplateColumns: regions,\n  gridGap: odysseyDesignTokens.Spacing4,\n  gap: odysseyDesignTokens.Spacing4,\n\n  \"& + &\": {\n    marginBlockStart: odysseyDesignTokens.Spacing4,\n  },\n}));\n\nconst Layout = ({ regions, children }: LayoutProps) => {\n  const odysseyDesignTokens = useOdysseyDesignTokens();\n  const mappedRegions = regions\n    .map((region) => `minmax(0, ${region}fr)`)\n    .join(\" \");\n\n  return (\n    <Box>\n      <LayoutContent\n        odysseyDesignTokens={odysseyDesignTokens}\n        regions={mappedRegions}\n      >\n        {Children.toArray(children).map((child) => child)}\n      </LayoutContent>\n    </Box>\n  );\n};\n\nconst MemoizedLayout = memo(Layout);\nMemoizedLayout.displayName = \"Layout\";\n\nexport { MemoizedLayout as Layout };\n"],"mappings":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAG6C,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAnB7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsCA,MAAMG,aAAa,GAAG,IAAAC,eAAM,EAAC,KAAK,EAAE;EAClCC,iBAAiB,EAAGC,IAAI,IACtB,CAAC,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAACC,QAAQ,CAACD,IAAI;AACrD,CAAC,CAAC,CAAqB,CAAC;EAAEE,mBAAmB;EAAEC;AAAQ,CAAC,MAAM;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