{"version":3,"file":"AppShell.cjs","sources":["../../../src/components/AppShell/AppShell.tsx"],"sourcesContent":["import {\n  Box,\n  BoxProps,\n  createVarsResolver,\n  ElementProps,\n  factory,\n  Factory,\n  getDefaultZIndex,\n  RaikouSpacing,\n  StylesApiProps,\n  useProps,\n  useStyles,\n} from '../../core';\nimport { AppShellProvider } from './AppShell.context';\nimport {\n  AppShellAsideConfiguration,\n  AppShellFooterConfiguration,\n  AppShellHeaderConfiguration,\n  AppShellIconListConfiguration,\n  AppShellNavbarConfiguration,\n  AppShellResponsiveSize,\n} from './AppShell.types';\nimport { AppShellAside } from './AppShellAside/AppShellAside';\nimport { AppShellFooter } from './AppShellFooter/AppShellFooter';\nimport { AppShellHeader } from './AppShellHeader/AppShellHeader';\nimport { AppShellIconList } from './AppShellIconList/AppShellIconList';\nimport { AppShellMain } from './AppShellMain/AppShellMain';\nimport { AppShellMediaStyles } from './AppShellMediaStyles/AppShellMediaStyles';\nimport { AppShellNavbar } from './AppShellNavbar/AppShellNavbar';\nimport { AppShellSection } from './AppShellSection/AppShellSection';\nimport { useResizing } from './use-resizing/use-resizing';\nimport {\n  AppShellAsideStyle,\n  AppShellFooterStyle,\n  AppShellHeaderStyle,\n  AppShellIconListStyle,\n  AppShellMainStyle,\n  AppShellNavbarStyle,\n  AppShellRootStyle,\n  AppShellSectionStyle,\n} from './AppShell.css';\n\nexport type AppShellStylesNames =\n  | 'root'\n  | 'iconList'\n  | 'navbar'\n  | 'main'\n  | 'header'\n  | 'footer'\n  | 'aside'\n  | 'section';\n\nexport type AppShellCssVariables = {\n  root: '--app-shell-transition-duration' | '--app-shell-transition-timing-function';\n};\n\nexport interface AppShellProps\n  extends BoxProps,\n    StylesApiProps<AppShellFactory>,\n    ElementProps<'div'> {\n  /** Determines whether associated components should have a border, `true` by default */\n  withBorder?: boolean;\n\n  /** Controls padding of the main section, `0` by default. !important!: use `padding` prop instead of `p`. */\n  padding?: RaikouSpacing | AppShellResponsiveSize;\n\n  iconList?: AppShellIconListConfiguration;\n\n  /** AppShell.Navbar configuration, controls width, breakpoints and collapsed state. Required if you use AppShell.Navbar component. */\n  navbar?: AppShellNavbarConfiguration;\n\n  /** AppShell.Aside configuration, controls width, breakpoints and collapsed state. Required if you use AppShell.Aside component. */\n  aside?: AppShellAsideConfiguration;\n\n  /** AppShell.Header configuration, controls height, offset and collapsed state. Required if you use AppShell.Header component. */\n  header?: AppShellHeaderConfiguration;\n\n  /** AppShell.Footer configuration, controls height, offset and collapsed state. Required if you use AppShell.Footer component. */\n  footer?: AppShellFooterConfiguration;\n\n  /** Duration of all transitions in ms, `200` by default */\n  transitionDuration?: number;\n\n  /** Timing function of all transitions, `ease` by default */\n  transitionTimingFunction?: React.CSSProperties['transitionTimingFunction'];\n\n  /** `z-index` of all associated elements, `200` by default */\n  zIndex?: string | number;\n\n  /** If set, Navbar, Aside, Header and Footer components be hidden */\n  disabled?: boolean;\n\n  /** Determines whether Header and Footer components should include styles to offset scrollbars. Based on `react-remove-scroll`. `true` by default for `layout=\"default\"`, `false` for `layout=\"alt\"` */\n  offsetScrollbars?: boolean;\n}\n\nexport type AppShellFactory = Factory<{\n  props: AppShellProps;\n  ref: HTMLDivElement;\n  stylesNames: AppShellStylesNames;\n  vars: AppShellCssVariables;\n  staticComponents: {\n    Navbar: typeof AppShellNavbar;\n    Header: typeof AppShellHeader;\n    Main: typeof AppShellMain;\n    Aside: typeof AppShellAside;\n    Footer: typeof AppShellFooter;\n    Section: typeof AppShellSection;\n    IconList: typeof AppShellIconList;\n  };\n}>;\n\nconst defaultProps: Partial<AppShellProps> = {\n  withBorder: true,\n  offsetScrollbars: true,\n  padding: 0,\n  transitionDuration: 200,\n  transitionTimingFunction: 'ease',\n  zIndex: getDefaultZIndex('app'),\n};\n\nconst varsResolver = createVarsResolver<AppShellFactory>(\n  (_, { transitionDuration, transitionTimingFunction }) => ({\n    root: {\n      '--app-shell-transition-duration': `${transitionDuration}ms`,\n      '--app-shell-transition-timing-function': transitionTimingFunction,\n    },\n  })\n);\n\nconst offsetScrollbarsFunc = (iconList?: AppShellIconListConfiguration) => {\n  if (iconList?.layout) {\n    return true;\n  }\n\n  return false;\n};\n\nexport const AppShell = factory<AppShellFactory>((_props, ref) => {\n  const props = useProps('AppShell', defaultProps, _props);\n\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    unstyled,\n    vars,\n    navbar,\n    withBorder,\n    padding,\n    transitionDuration,\n    transitionTimingFunction,\n    header,\n    zIndex,\n    disabled,\n    aside,\n    footer,\n    iconList,\n    offsetScrollbars = offsetScrollbarsFunc(iconList),\n    mod,\n    ...others\n  } = props;\n\n  const getStyles = useStyles<AppShellFactory>({\n    name: 'AppShell',\n    classes: {\n      root: AppShellRootStyle,\n      navbar: AppShellNavbarStyle,\n      main: AppShellMainStyle,\n      header: AppShellHeaderStyle,\n      footer: AppShellFooterStyle,\n      aside: AppShellAsideStyle,\n      section: AppShellSectionStyle,\n      iconList: AppShellIconListStyle,\n    },\n    props,\n    className,\n    style,\n    classNames,\n    styles,\n    unstyled,\n    vars,\n    varsResolver,\n  });\n\n  const resizing = useResizing({ disabled, transitionDuration });\n\n  return (\n    <AppShellProvider value={{ getStyles, withBorder, zIndex, disabled, offsetScrollbars }}>\n      <AppShellMediaStyles\n        navbar={navbar}\n        header={header}\n        aside={aside}\n        footer={footer}\n        iconList={iconList}\n        padding={padding}\n      />\n      <Box ref={ref} {...getStyles('root')} mod={[{ resizing, disabled }, mod]} {...others} />\n    </AppShellProvider>\n  );\n});\n\nAppShell.displayName = '@raikou/core/AppShell';\nAppShell.Navbar = AppShellNavbar;\nAppShell.Header = AppShellHeader;\nAppShell.Main = AppShellMain;\nAppShell.Aside = AppShellAside;\nAppShell.Footer = AppShellFooter;\nAppShell.Section = AppShellSection;\nAppShell.IconList = AppShellIconList;\n"],"names":["getDefaultZIndex","createVarsResolver","factory","useProps","useStyles","AppShellRootStyle","AppShellNavbarStyle","AppShellMainStyle","AppShellHeaderStyle","AppShellFooterStyle","AppShellAsideStyle","AppShellSectionStyle","AppShellIconListStyle","useResizing","jsxs","AppShellProvider","jsx","AppShellMediaStyles","Box","AppShellNavbar","AppShellHeader","AppShellMain","AppShellAside","AppShellFooter","AppShellSection","AppShellIconList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,MAAM,YAAuC,GAAA;AAAA,EAC3C,UAAY,EAAA,IAAA;AAAA,EACZ,gBAAkB,EAAA,IAAA;AAAA,EAClB,OAAS,EAAA,CAAA;AAAA,EACT,kBAAoB,EAAA,GAAA;AAAA,EACpB,wBAA0B,EAAA,MAAA;AAAA,EAC1B,MAAA,EAAQA,kCAAiB,KAAK;AAChC,CAAA;AAEA,MAAM,YAAe,GAAAC,qCAAA;AAAA,EACnB,CAAC,CAAA,EAAG,EAAE,kBAAA,EAAoB,0BAAgC,MAAA;AAAA,IACxD,IAAM,EAAA;AAAA,MACJ,iCAAA,EAAmC,GAAG,kBAAkB,CAAA,EAAA,CAAA;AAAA,MACxD,wCAA0C,EAAA;AAAA;AAC5C,GACF;AACF,CAAA;AAEA,MAAM,oBAAA,GAAuB,CAAC,QAA6C,KAAA;AACzE,EAAA,IAAI,UAAU,MAAQ,EAAA;AACpB,IAAO,OAAA,IAAA;AAAA;AAGT,EAAO,OAAA,KAAA;AACT,CAAA;AAEO,MAAM,QAAW,GAAAC,eAAA,CAAyB,CAAC,MAAA,EAAQ,GAAQ,KAAA;AAChE,EAAA,MAAM,KAAQ,GAAAC,iBAAA,CAAS,UAAY,EAAA,YAAA,EAAc,MAAM,CAAA;AAEvD,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,kBAAA;AAAA,IACA,wBAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAA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