@aws-amplify/ui-react 2.15.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";import{
|
|
1
|
+
import*as t from"react";import{createTheme as e}from"@aws-amplify/ui";const o=t.createContext({theme:e()});export{o as AmplifyContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import*as m from"react";import{createTheme as o}from"@aws-amplify/ui";import{AmplifyContext as n}from"./AmplifyContext.js";function d({children:d,colorMode:
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import*as m from"react";import{createTheme as o}from"@aws-amplify/ui";import{AmplifyContext as n}from"./AmplifyContext.js";function d({children:d,colorMode:i,theme:a}){const r=o(a),{name:c,cssText:l}=r;return m.useEffect((()=>{if(document&&document.documentElement){const t=document.documentElement.getAttribute("data-amplify-theme"),e=document.documentElement.getAttribute("data-amplify-color-mode");return document.documentElement.setAttribute("data-amplify-theme",c),document.documentElement.setAttribute("data-amplify-color-mode",i||""),function(){document.documentElement.setAttribute("data-amplify-theme",t),document.documentElement.setAttribute("data-amplify-color-mode",e)}}}),[c,i]),t(n.Provider,Object.assign({value:{theme:r}},{children:[e("div",Object.assign({"data-amplify-theme":c,"data-amplify-color-mode":i},{children:d})),void 0===a||/<\/style/i.test(l)?null:e("style",{id:`amplify-theme-${c}`,dangerouslySetInnerHTML:{__html:l}})]}))}export{d as AmplifyProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"react";import{
|
|
1
|
+
import*as o from"react";import{createTheme as t}from"@aws-amplify/ui";import{AmplifyContext as e}from"../components/AmplifyProvider/AmplifyContext.js";const m=()=>{const t=o.useContext(e);return r(t)},r=o=>void 0===o||void 0===o.theme?t():o.theme;export{r as getThemeFromContext,m as useTheme};
|