@henriquepetrelli/hp-design-system 1.1.4 → 1.1.5
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.
|
@@ -1286,7 +1286,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1286
1286
|
const ToggleSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-14c54b46"]]);
|
|
1287
1287
|
|
|
1288
1288
|
const _hoisted_1$4 = { class: "theme-switcher-container" };
|
|
1289
|
-
const _hoisted_2$4 = ["id", "aria-checked"];
|
|
1289
|
+
const _hoisted_2$4 = ["id", "checked", "aria-checked"];
|
|
1290
1290
|
const _hoisted_3$4 = ["for", "onKeydown"];
|
|
1291
1291
|
|
|
1292
1292
|
|
|
@@ -1324,37 +1324,6 @@ const props = __props;
|
|
|
1324
1324
|
|
|
1325
1325
|
const isDarkMode = ref(false);
|
|
1326
1326
|
|
|
1327
|
-
// Função para pegar variáveis CSS do projeto
|
|
1328
|
-
const getCSSVariable = (name, fallback) => {
|
|
1329
|
-
return (
|
|
1330
|
-
getComputedStyle(document.documentElement).getPropertyValue(name).trim() ||
|
|
1331
|
-
fallback
|
|
1332
|
-
)
|
|
1333
|
-
};
|
|
1334
|
-
|
|
1335
|
-
// Computed para cores do switcher
|
|
1336
|
-
const computedLightBackgroundColor = computed(() => {
|
|
1337
|
-
return (
|
|
1338
|
-
props.lightBackgroundColor ||
|
|
1339
|
-
getCSSVariable('--color-background', '#96dcee')
|
|
1340
|
-
)
|
|
1341
|
-
});
|
|
1342
|
-
|
|
1343
|
-
const computedLightBorderColor = computed(() => {
|
|
1344
|
-
return props.lightBorderColor || getCSSVariable('--color-primary', '#72cce3')
|
|
1345
|
-
});
|
|
1346
|
-
|
|
1347
|
-
const computedDarkBackgroundColor = computed(() => {
|
|
1348
|
-
return (
|
|
1349
|
-
props.darkBackgroundColor || getCSSVariable('--color-background', '#1261a0')
|
|
1350
|
-
)
|
|
1351
|
-
});
|
|
1352
|
-
|
|
1353
|
-
const computedDarkBorderColor = computed(() => {
|
|
1354
|
-
return props.darkBorderColor || getCSSVariable('--color-primary', '#072f5f')
|
|
1355
|
-
});
|
|
1356
|
-
|
|
1357
|
-
// Alterna tema baseado no valor atual de isDarkMode
|
|
1358
1327
|
const toggleTheme = () => {
|
|
1359
1328
|
if (isDarkMode.value) {
|
|
1360
1329
|
document.documentElement.classList.remove('light');
|
|
@@ -1367,13 +1336,11 @@ const toggleTheme = () => {
|
|
|
1367
1336
|
}
|
|
1368
1337
|
};
|
|
1369
1338
|
|
|
1370
|
-
// Alterna tema via teclado
|
|
1371
1339
|
const handleKeydown = () => {
|
|
1372
1340
|
isDarkMode.value = !isDarkMode.value;
|
|
1373
1341
|
toggleTheme();
|
|
1374
1342
|
};
|
|
1375
1343
|
|
|
1376
|
-
// Inicializa o tema baseado no localStorage ou preferência do sistema
|
|
1377
1344
|
onMounted(() => {
|
|
1378
1345
|
const savedTheme =
|
|
1379
1346
|
localStorage.getItem('theme') ||
|
|
@@ -1387,6 +1354,22 @@ onMounted(() => {
|
|
|
1387
1354
|
document.documentElement.classList.add('light');
|
|
1388
1355
|
}
|
|
1389
1356
|
});
|
|
1357
|
+
|
|
1358
|
+
const computedLightBorderColor = computed(() => {
|
|
1359
|
+
return props.lightBorderColor || '#72cce3'
|
|
1360
|
+
});
|
|
1361
|
+
|
|
1362
|
+
const computedLightBackgroundColor = computed(() => {
|
|
1363
|
+
return props.lightBackgroundColor || '#96dcee'
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
const computedDarkBorderColor = computed(() => {
|
|
1367
|
+
return props.darkBorderColor || '#072f5f'
|
|
1368
|
+
});
|
|
1369
|
+
|
|
1370
|
+
const computedDarkBackgroundColor = computed(() => {
|
|
1371
|
+
return props.darkBackgroundColor || '#1261a0'
|
|
1372
|
+
});
|
|
1390
1373
|
|
|
1391
1374
|
return (_ctx, _cache) => {
|
|
1392
1375
|
return (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
@@ -1395,6 +1378,7 @@ return (_ctx, _cache) => {
|
|
|
1395
1378
|
id: __props.id,
|
|
1396
1379
|
class: "toggle--checkbox",
|
|
1397
1380
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
|
|
1381
|
+
checked: __props.modelValue,
|
|
1398
1382
|
onChange: toggleTheme,
|
|
1399
1383
|
role: "switch",
|
|
1400
1384
|
"aria-checked": isDarkMode.value,
|
|
@@ -1426,7 +1410,7 @@ return (_ctx, _cache) => {
|
|
|
1426
1410
|
}
|
|
1427
1411
|
|
|
1428
1412
|
};
|
|
1429
|
-
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-
|
|
1413
|
+
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-08fdca46"]]);
|
|
1430
1414
|
|
|
1431
1415
|
const _hoisted_1$3 = { class: "input__fieldset" };
|
|
1432
1416
|
const _hoisted_2$3 = {
|