@allxsmith/bestax-bulma 5.0.0 → 5.1.0

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.
package/dist/index.cjs.js CHANGED
@@ -7805,7 +7805,7 @@ function cssVarToProp(varName) {
7805
7805
  .join('');
7806
7806
  }
7807
7807
  const bulmaVarPropMap = Object.fromEntries(bulmaCssVars.map(cssVar => [cssVarToProp(cssVar), cssVar]));
7808
- const Theme = ({ bulmaVars = {}, children, className, isRoot = false, ...restProps }) => {
7808
+ const Theme = ({ bulmaVars = {}, children, className, isRoot = false, colorMode, ...restProps }) => {
7809
7809
  const { bulmaVarProps, otherProps } = React.useMemo(() => {
7810
7810
  const varProps = {};
7811
7811
  const otherPropsObj = {};
@@ -7855,6 +7855,27 @@ const Theme = ({ bulmaVars = {}, children, className, isRoot = false, ...restPro
7855
7855
  }
7856
7856
  };
7857
7857
  }, [mergedVars, isRoot]);
7858
+ React.useEffect(() => {
7859
+ if (colorMode === undefined) {
7860
+ return;
7861
+ }
7862
+ const root = document.documentElement;
7863
+ const previous = root.getAttribute('data-theme');
7864
+ if (colorMode === 'system') {
7865
+ root.removeAttribute('data-theme');
7866
+ }
7867
+ else {
7868
+ root.setAttribute('data-theme', colorMode);
7869
+ }
7870
+ return () => {
7871
+ if (previous === null) {
7872
+ root.removeAttribute('data-theme');
7873
+ }
7874
+ else {
7875
+ root.setAttribute('data-theme', previous);
7876
+ }
7877
+ };
7878
+ }, [colorMode]);
7858
7879
  const style = React.useMemo(() => {
7859
7880
  if (isRoot) {
7860
7881
  return {};