{"version":3,"file":"AnimationContext.cjs","names":["_react","require","_useMediaQuery","_jsxRuntime","AnimationContext","createContext","hasAnimations","AnimationProvider","children","shouldReduceMotion","useMediaQuery","providerValue","useMemo","jsx","Provider","value","MemoizedAnimationProvider","exports","memo","displayName","useAnimation","useContext"],"sources":["../../src/AnimationContext.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2026-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 {\n  createContext,\n  memo,\n  type ReactNode,\n  useContext,\n  useMemo,\n} from \"react\";\n\nimport { useMediaQuery } from \"./theme/useMediaQuery.js\";\n\nexport type AnimationContextValue = {\n  /** If `true`, Odyssey components may animate. */\n  hasAnimations: boolean;\n};\n\nconst AnimationContext = createContext<AnimationContextValue>({\n  hasAnimations: true,\n});\n\nexport type AnimationProviderProps = {\n  /** The components that receive the animation setting. */\n  children: ReactNode;\n  /**\n   * If `true`, components may animate unless the user prefers reduced motion.\n   */\n  hasAnimations: boolean;\n};\n\n/** Controls animation for every Odyssey component inside it. */\nconst AnimationProvider = ({\n  children,\n  hasAnimations,\n}: AnimationProviderProps) => {\n  const shouldReduceMotion = useMediaQuery(\"(prefers-reduced-motion: reduce)\");\n  const providerValue = useMemo(\n    () => ({ hasAnimations: hasAnimations && !shouldReduceMotion }),\n    [hasAnimations, shouldReduceMotion],\n  );\n\n  return (\n    <AnimationContext.Provider value={providerValue}>\n      {children}\n    </AnimationContext.Provider>\n  );\n};\n\nconst MemoizedAnimationProvider = memo(AnimationProvider);\nMemoizedAnimationProvider.displayName = \"AnimationProvider\";\n\nexport { MemoizedAnimationProvider as AnimationProvider };\n\n/** Returns `true` if Odyssey components may animate. */\nexport const useAnimation = () => useContext(AnimationContext).hasAnimations;\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,cAAA,GAAAD,OAAA;AAAyD,IAAAE,WAAA,GAAAF,OAAA;AApBzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,MAAMG,gBAAgB,GAAG,IAAAC,oBAAa,EAAwB;EAC5DC,aAAa,EAAE;AACjB,CAAC,CAAC;AAYF,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,QAAQ;EACRF;AACsB,CAAC,KAAK;EAC5B,MAAMG,kBAAkB,GAAG,IAAAC,4BAAa,EAAC,kCAAkC,CAAC;EAC5E,MAAMC,aAAa,GAAG,IAAAC,cAAO,EAC3B,OAAO;IAAEN,aAAa,EAAEA,aAAa,IAAI,CAACG;EAAmB,CAAC,CAAC,EAC/D,CAACH,aAAa,EAAEG,kBAAkB,CACpC,CAAC;EAED,OACE,IAAAN,WAAA,CAAAU,GAAA,EAACT,gBAAgB,CAACU,QAAQ;IAACC,KAAK,EAAEJ,aAAc;IAAAH,QAAA,EAC7CA;EAAQ,CACgB,CAAC;AAEhC,CAAC;AAED,MAAMQ,yBAAyB,GAAAC,OAAA,CAAAV,iBAAA,GAAG,IAAAW,WAAI,EAACX,iBAAiB,CAAC;AACzDS,yBAAyB,CAACG,WAAW,mDAAsB;AAKpD,MAAMC,YAAY,GAAGA,CAAA,KAAM,IAAAC,iBAAU,EAACjB,gBAAgB,CAAC,CAACE,aAAa;AAACW,OAAA,CAAAG,YAAA,GAAAA,YAAA","ignoreList":[]}