@henriquepetrelli/hp-design-system 1.1.3 → 1.1.4

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.
@@ -1290,7 +1290,7 @@
1290
1290
  const ToggleSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-14c54b46"]]);
1291
1291
 
1292
1292
  const _hoisted_1$4 = { class: "theme-switcher-container" };
1293
- const _hoisted_2$4 = ["id", "checked", "aria-checked"];
1293
+ const _hoisted_2$4 = ["id", "aria-checked"];
1294
1294
  const _hoisted_3$4 = ["for", "onKeydown"];
1295
1295
 
1296
1296
 
@@ -1328,6 +1328,7 @@
1328
1328
 
1329
1329
  const isDarkMode = vue.ref(false);
1330
1330
 
1331
+ // Função para pegar variáveis CSS do projeto
1331
1332
  const getCSSVariable = (name, fallback) => {
1332
1333
  return (
1333
1334
  getComputedStyle(document.documentElement).getPropertyValue(name).trim() ||
@@ -1335,6 +1336,7 @@
1335
1336
  )
1336
1337
  };
1337
1338
 
1339
+ // Computed para cores do switcher
1338
1340
  const computedLightBackgroundColor = vue.computed(() => {
1339
1341
  return (
1340
1342
  props.lightBackgroundColor ||
@@ -1356,8 +1358,8 @@
1356
1358
  return props.darkBorderColor || getCSSVariable('--color-primary', '#072f5f')
1357
1359
  });
1358
1360
 
1361
+ // Alterna tema baseado no valor atual de isDarkMode
1359
1362
  const toggleTheme = () => {
1360
- isDarkMode.value = !isDarkMode.value;
1361
1363
  if (isDarkMode.value) {
1362
1364
  document.documentElement.classList.remove('light');
1363
1365
  document.documentElement.classList.add('dark');
@@ -1369,10 +1371,13 @@
1369
1371
  }
1370
1372
  };
1371
1373
 
1374
+ // Alterna tema via teclado
1372
1375
  const handleKeydown = () => {
1376
+ isDarkMode.value = !isDarkMode.value;
1373
1377
  toggleTheme();
1374
1378
  };
1375
1379
 
1380
+ // Inicializa o tema baseado no localStorage ou preferência do sistema
1376
1381
  vue.onMounted(() => {
1377
1382
  const savedTheme =
1378
1383
  localStorage.getItem('theme') ||
@@ -1394,7 +1399,6 @@
1394
1399
  id: __props.id,
1395
1400
  class: "toggle--checkbox",
1396
1401
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
1397
- checked: __props.modelValue,
1398
1402
  onChange: toggleTheme,
1399
1403
  role: "switch",
1400
1404
  "aria-checked": isDarkMode.value,
@@ -1426,7 +1430,7 @@
1426
1430
  }
1427
1431
 
1428
1432
  };
1429
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-74ce4ef8"]]);
1433
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-d1afbbb3"]]);
1430
1434
 
1431
1435
  const _hoisted_1$3 = { class: "input__fieldset" };
1432
1436
  const _hoisted_2$3 = {