{"version":3,"sources":["../src/createSlideStyles.ts"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\nimport { DATA_POSITIONING_PLACEMENT } from './constants';\n\n/**\n * Creates animation styles so that positioned elements slide in from the main axis\n * @param mainAxis - distance than the element sides for\n * @returns Griffel styles to spread to a slot\n *\n * @deprecated The popover-related components now use the Slide motion component,\n * which they inject using the `surfaceMotion` slot.\n */\nexport function createSlideStyles(mainAxis: number): GriffelStyle {\n  // With 'accumulate' animation composition, these opacity keyframes are added onto the default opacity of 1.\n  const fadeIn = {\n    from: {\n      opacity: -1, // becomes opacity: 0\n    },\n    to: {\n      opacity: 0, // becomes opacity: 1\n    },\n  };\n\n  const slideDistanceVarX = '--fui-positioning-slide-distance-x';\n  const slideDistanceVarY = '--fui-positioning-slide-distance-y';\n\n  return {\n    // NOTE: there was a previous attempt to give fadeIn a separate composition mode:\n    //   animationComposition: 'replace, accumulate',\n    // but somehow this was linked to a performance regression observed in Teams (bug #4255933)\n    animationComposition: 'accumulate',\n    animationDuration: tokens.durationSlower,\n    animationTimingFunction: tokens.curveDecelerateMid,\n    [slideDistanceVarX]: `0px`,\n    [slideDistanceVarY]: `${mainAxis}px`,\n    [`&[${DATA_POSITIONING_PLACEMENT}^=right]`]: {\n      [slideDistanceVarX]: `-${mainAxis}px`,\n      [slideDistanceVarY]: '0px',\n    },\n\n    [`&[${DATA_POSITIONING_PLACEMENT}^=bottom]`]: {\n      [slideDistanceVarX]: '0px',\n      [slideDistanceVarY]: `-${mainAxis}px`,\n    },\n\n    [`&[${DATA_POSITIONING_PLACEMENT}^=left]`]: {\n      [slideDistanceVarX]: `${mainAxis}px`,\n      [slideDistanceVarY]: '0px',\n    },\n\n    animationName: [\n      fadeIn,\n      {\n        from: {\n          transform: `translate(var(${slideDistanceVarX}), var(${slideDistanceVarY}))`,\n        },\n        to: {},\n      },\n    ],\n\n    // Note: at-rules have more specificity in Griffel\n    '@media(prefers-reduced-motion)': {\n      [`&[${DATA_POSITIONING_PLACEMENT}]`]: {\n        animationDuration: '1ms',\n        animationName: fadeIn,\n      },\n    },\n\n    // Tested in Firefox 79\n    '@supports not (animation-composition: accumulate)': {\n      [`&[${DATA_POSITIONING_PLACEMENT}]`]: {\n        animationName: fadeIn,\n      },\n    },\n  };\n}\n"],"names":["tokens","DATA_POSITIONING_PLACEMENT","createSlideStyles","mainAxis","fadeIn","from","opacity","to","slideDistanceVarX","slideDistanceVarY","animationComposition","animationDuration","durationSlower","animationTimingFunction","curveDecelerateMid","animationName","transform"],"mappings":";;;;+BAYgBE;;;;;;4BAZO,wBAAwB;2BAEJ,iBAAc;AAUlD,2BAA2BC,QAAgB;IAChD,4GAA4G;IAC5G,MAAMC,SAAS;QACbC,MAAM;YACJC,SAAS,CAAC;QACZ;QACAC,IAAI;YACFD,SAAS;QACX;IACF;IAEA,MAAME,oBAAoB;IAC1B,MAAMC,oBAAoB;IAE1B,OAAO;QACL,iFAAiF;QACjF,iDAAiD;QACjD,2FAA2F;QAC3FC,sBAAsB;QACtBC,mBAAmBX,kBAAAA,CAAOY,cAAc;QACxCC,yBAAyBb,kBAAAA,CAAOc,kBAAkB;QAClD,CAACN,kBAAkB,EAAE,CAAC,GAAG,CAAC;QAC1B,CAACC,kBAAkB,EAAE,GAAGN,SAAS,EAAE,CAAC;QACpC,CAAC,CAAC,EAAE,EAAEF,qCAAAA,CAA2B,QAAQ,CAAC,CAAC,EAAE;YAC3C,CAACO,kBAAkB,EAAE,CAAC,CAAC,EAAEL,SAAS,EAAE,CAAC;YACrC,CAACM,kBAAkB,EAAE;QACvB;QAEA,CAAC,CAAC,EAAE,EAAER,qCAAAA,CAA2B,SAAS,CAAC,CAAC,EAAE;YAC5C,CAACO,kBAAkB,EAAE;YACrB,CAACC,kBAAkB,EAAE,CAAC,CAAC,EAAEN,SAAS,EAAE,CAAC;QACvC;QAEA,CAAC,CAAC,EAAE,EAAEF,qCAAAA,CAA2B,OAAO,CAAC,CAAC,EAAE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