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