{"version":3,"file":"assign-iconlist-variables.mjs","sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-iconlist-variables/assign-iconlist-variables.ts"],"sourcesContent":["import { getBreakpointValue, keys, RaikouTheme, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\nimport type { CSSVariables, MediaQueryVariables } from '../get-variables/get-variables';\nimport { isPrimitiveSize } from '../is-primitive-size/is-primitive-size';\nimport { isResponsiveSize } from '../is-responsive-size/is-responsive-size';\n\ninterface AssignIconListVariablesInput {\n  baseStyles: CSSVariables;\n  minMediaStyles: MediaQueryVariables;\n  maxMediaStyles: MediaQueryVariables;\n  iconList: AppShellProps['iconList'] | undefined;\n  theme: RaikouTheme;\n}\n\nexport function assignIconListVariables({\n  baseStyles,\n  minMediaStyles,\n  maxMediaStyles,\n  iconList,\n  theme,\n}: AssignIconListVariablesInput) {\n  const iconListWidth = iconList?.width;\n  const collapsedIconListTransform = 'translateX(calc(var(--app-shell-iconlist-width) * -1))';\n  const collapsedIconListTransformRtl = 'translateX(var(--app-shell-iconlist-width))';\n\n  if (iconList?.layout === 'alt') {\n    baseStyles['--app-shell-iconlist-offset-y'] = '0px !important';\n    baseStyles['--app-shell-iconlist-height'] = '100dvh !important';\n  } else {\n    baseStyles['--app-shell-iconlist-offset-y'] =\n      'var(--app-shell-header-offset-y, 0rem) !important';\n    baseStyles['--app-shell-iconlist-height'] =\n      'calc(100dvh - var(--app-shell-header-offset-y, 0rem) - var(--app-shell-footer-offset, 0rem)) !important';\n  }\n\n  if (iconList?.breakpoint && !iconList?.collapsed?.mobile) {\n    maxMediaStyles[iconList?.breakpoint] = maxMediaStyles[iconList?.breakpoint] || {};\n    maxMediaStyles[iconList?.breakpoint]['--app-shell-iconlist-width'] = '100%';\n    maxMediaStyles[iconList?.breakpoint]['--app-shell-iconlist-offset'] = '0px';\n  }\n\n  if (isPrimitiveSize(iconListWidth)) {\n    const baseSize = rem(getBaseSize(iconListWidth));\n    baseStyles['--app-shell-iconlist-width'] = baseSize;\n    baseStyles['--app-shell-iconlist-offset'] = baseSize;\n  }\n\n  if (isResponsiveSize(iconListWidth)) {\n    if (typeof iconListWidth.base !== 'undefined') {\n      baseStyles['--app-shell-iconlist-width'] = rem(iconListWidth.base);\n      baseStyles['--app-shell-iconlist-offset'] = rem(iconListWidth.base);\n    }\n\n    keys(iconListWidth).forEach((key) => {\n      if (key !== 'base') {\n        minMediaStyles[key] = minMediaStyles[key] || {};\n        minMediaStyles[key]['--app-shell-iconlist-width'] = rem(iconListWidth![key]);\n        minMediaStyles[key]['--app-shell-iconlist-offset'] = rem(iconListWidth![key]);\n      }\n    });\n  }\n\n  if (iconList?.collapsed?.desktop) {\n    const breakpointValue = iconList!.breakpoint;\n    minMediaStyles[breakpointValue] = minMediaStyles[breakpointValue] || {};\n    minMediaStyles[breakpointValue]['--app-shell-iconlist-transform'] = collapsedIconListTransform;\n    minMediaStyles[breakpointValue]['--app-shell-iconlist-transform-rtl'] =\n      collapsedIconListTransformRtl;\n    minMediaStyles[breakpointValue]['--app-shell-iconlist-offset'] = '0px !important';\n  }\n\n  if (iconList?.collapsed?.mobile) {\n    const breakpointValue = getBreakpointValue(iconList!.breakpoint, theme.breakpoints) - 0.1;\n    maxMediaStyles[breakpointValue] = maxMediaStyles[breakpointValue] || {};\n    maxMediaStyles[breakpointValue]['--app-shell-iconlist-width'] = '0%';\n    maxMediaStyles[breakpointValue]['--app-shell-iconlist-offset'] = '0px';\n    maxMediaStyles[breakpointValue]['--app-shell-iconlist-opacity'] = '0';\n    maxMediaStyles[breakpointValue]['--app-shell-iconlist-transform'] = collapsedIconListTransform;\n    maxMediaStyles[breakpointValue]['--app-shell-iconlist-transform-rtl'] =\n      collapsedIconListTransformRtl;\n  }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAeO,SAAS,uBAAwB,CAAA;AAAA,EACtC,UAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA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