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