@henriquepetrelli/hp-design-system 1.1.15 → 1.1.16

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.
@@ -1427,12 +1427,19 @@
1427
1427
 
1428
1428
  const emit = __emit;
1429
1429
 
1430
- const isDarkMode = vue.ref(localStorage.getItem('theme') === 'dark');
1430
+ const isDarkMode = vue.ref(
1431
+ typeof window !== 'undefined' && localStorage.getItem('theme') === 'dark'
1432
+ );
1431
1433
 
1432
1434
  const applyTheme = (isDark) => {
1433
- document.documentElement.classList.toggle('dark', isDark);
1434
- document.documentElement.classList.toggle('light', !isDark);
1435
- localStorage.setItem('theme', isDark ? 'dark' : 'light');
1435
+ if (typeof document === 'undefined') return
1436
+
1437
+ const theme = isDark ? 'dark' : 'light';
1438
+
1439
+ document.documentElement.classList.remove('dark', 'light');
1440
+ document.documentElement.classList.add(theme);
1441
+
1442
+ localStorage.setItem('theme', theme);
1436
1443
  };
1437
1444
 
1438
1445
  const toggleTheme = () => {
@@ -1445,10 +1452,6 @@
1445
1452
  toggleTheme();
1446
1453
  };
1447
1454
 
1448
- vue.onMounted(() => {
1449
- applyTheme(isDarkMode.value);
1450
- });
1451
-
1452
1455
  vue.watch(
1453
1456
  () => props.modelValue,
1454
1457
  (value) => {
@@ -1511,7 +1514,7 @@
1511
1514
  }
1512
1515
 
1513
1516
  };
1514
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-e4250caa"]]);
1517
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-ba2225dd"]]);
1515
1518
 
1516
1519
  const _hoisted_1$3 = { class: "input__fieldset" };
1517
1520
  const _hoisted_2$3 = {