@henriquepetrelli/hp-design-system 1.1.2 → 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", "
|
|
1293
|
+
const _hoisted_2$4 = ["id", "aria-checked"];
|
|
1294
1294
|
const _hoisted_3$4 = ["for", "onKeydown"];
|
|
1295
1295
|
|
|
1296
1296
|
|
|
@@ -1328,6 +1328,37 @@
|
|
|
1328
1328
|
|
|
1329
1329
|
const isDarkMode = vue.ref(false);
|
|
1330
1330
|
|
|
1331
|
+
// Função para pegar variáveis CSS do projeto
|
|
1332
|
+
const getCSSVariable = (name, fallback) => {
|
|
1333
|
+
return (
|
|
1334
|
+
getComputedStyle(document.documentElement).getPropertyValue(name).trim() ||
|
|
1335
|
+
fallback
|
|
1336
|
+
)
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
// Computed para cores do switcher
|
|
1340
|
+
const computedLightBackgroundColor = vue.computed(() => {
|
|
1341
|
+
return (
|
|
1342
|
+
props.lightBackgroundColor ||
|
|
1343
|
+
getCSSVariable('--color-background', '#96dcee')
|
|
1344
|
+
)
|
|
1345
|
+
});
|
|
1346
|
+
|
|
1347
|
+
const computedLightBorderColor = vue.computed(() => {
|
|
1348
|
+
return props.lightBorderColor || getCSSVariable('--color-primary', '#72cce3')
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
const computedDarkBackgroundColor = vue.computed(() => {
|
|
1352
|
+
return (
|
|
1353
|
+
props.darkBackgroundColor || getCSSVariable('--color-background', '#1261a0')
|
|
1354
|
+
)
|
|
1355
|
+
});
|
|
1356
|
+
|
|
1357
|
+
const computedDarkBorderColor = vue.computed(() => {
|
|
1358
|
+
return props.darkBorderColor || getCSSVariable('--color-primary', '#072f5f')
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
// Alterna tema baseado no valor atual de isDarkMode
|
|
1331
1362
|
const toggleTheme = () => {
|
|
1332
1363
|
if (isDarkMode.value) {
|
|
1333
1364
|
document.documentElement.classList.remove('light');
|
|
@@ -1340,11 +1371,13 @@
|
|
|
1340
1371
|
}
|
|
1341
1372
|
};
|
|
1342
1373
|
|
|
1374
|
+
// Alterna tema via teclado
|
|
1343
1375
|
const handleKeydown = () => {
|
|
1344
1376
|
isDarkMode.value = !isDarkMode.value;
|
|
1345
1377
|
toggleTheme();
|
|
1346
1378
|
};
|
|
1347
1379
|
|
|
1380
|
+
// Inicializa o tema baseado no localStorage ou preferência do sistema
|
|
1348
1381
|
vue.onMounted(() => {
|
|
1349
1382
|
const savedTheme =
|
|
1350
1383
|
localStorage.getItem('theme') ||
|
|
@@ -1358,22 +1391,6 @@
|
|
|
1358
1391
|
document.documentElement.classList.add('light');
|
|
1359
1392
|
}
|
|
1360
1393
|
});
|
|
1361
|
-
|
|
1362
|
-
const computedLightBorderColor = vue.computed(() => {
|
|
1363
|
-
return props.lightBorderColor || '#72cce3'
|
|
1364
|
-
});
|
|
1365
|
-
|
|
1366
|
-
const computedLightBackgroundColor = vue.computed(() => {
|
|
1367
|
-
return props.lightBackgroundColor || '#96dcee'
|
|
1368
|
-
});
|
|
1369
|
-
|
|
1370
|
-
const computedDarkBorderColor = vue.computed(() => {
|
|
1371
|
-
return props.darkBorderColor || '#072f5f'
|
|
1372
|
-
});
|
|
1373
|
-
|
|
1374
|
-
const computedDarkBackgroundColor = vue.computed(() => {
|
|
1375
|
-
return props.darkBackgroundColor || '#1261a0'
|
|
1376
|
-
});
|
|
1377
1394
|
|
|
1378
1395
|
return (_ctx, _cache) => {
|
|
1379
1396
|
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
@@ -1382,7 +1399,6 @@
|
|
|
1382
1399
|
id: __props.id,
|
|
1383
1400
|
class: "toggle--checkbox",
|
|
1384
1401
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
|
|
1385
|
-
checked: __props.modelValue,
|
|
1386
1402
|
onChange: toggleTheme,
|
|
1387
1403
|
role: "switch",
|
|
1388
1404
|
"aria-checked": isDarkMode.value,
|
|
@@ -1414,7 +1430,7 @@
|
|
|
1414
1430
|
}
|
|
1415
1431
|
|
|
1416
1432
|
};
|
|
1417
|
-
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-
|
|
1433
|
+
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-d1afbbb3"]]);
|
|
1418
1434
|
|
|
1419
1435
|
const _hoisted_1$3 = { class: "input__fieldset" };
|
|
1420
1436
|
const _hoisted_2$3 = {
|