@henriquepetrelli/hp-design-system 1.1.6 → 1.1.8
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.
- package/dist/hp-design-system.es.js +41 -46
- package/dist/hp-design-system.es.js.map +1 -1
- package/dist/hp-design-system.umd.js +41 -46
- package/dist/hp-design-system.umd.js.map +1 -1
- package/dist/style.css +153 -66
- package/package.json +1 -1
|
@@ -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
|
|
|
@@ -1305,39 +1305,29 @@
|
|
|
1305
1305
|
type: String,
|
|
1306
1306
|
default: () => `theme-${Math.random().toString(36).substring(2, 9)}`
|
|
1307
1307
|
},
|
|
1308
|
-
lightBorderColor:
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
lightBackgroundColor: {
|
|
1313
|
-
type: String,
|
|
1314
|
-
default: ''
|
|
1315
|
-
},
|
|
1316
|
-
darkBorderColor: {
|
|
1317
|
-
type: String,
|
|
1318
|
-
default: ''
|
|
1319
|
-
},
|
|
1320
|
-
darkBackgroundColor: {
|
|
1321
|
-
type: String,
|
|
1322
|
-
default: ''
|
|
1323
|
-
}
|
|
1308
|
+
lightBorderColor: String,
|
|
1309
|
+
lightBackgroundColor: String,
|
|
1310
|
+
darkBorderColor: String,
|
|
1311
|
+
darkBackgroundColor: String
|
|
1324
1312
|
},
|
|
1325
|
-
|
|
1313
|
+
emits: ['update:modelValue'],
|
|
1314
|
+
setup(__props, { emit: __emit }) {
|
|
1326
1315
|
|
|
1327
1316
|
const props = __props;
|
|
1328
1317
|
|
|
1318
|
+
const emit = __emit;
|
|
1319
|
+
|
|
1329
1320
|
const isDarkMode = vue.ref(false);
|
|
1330
1321
|
|
|
1322
|
+
const applyTheme = (isDark) => {
|
|
1323
|
+
document.documentElement.classList.toggle('dark', isDark);
|
|
1324
|
+
document.documentElement.classList.toggle('light', !isDark);
|
|
1325
|
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1331
1328
|
const toggleTheme = () => {
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
document.documentElement.classList.add('dark');
|
|
1335
|
-
localStorage.setItem('theme', 'dark');
|
|
1336
|
-
} else {
|
|
1337
|
-
document.documentElement.classList.remove('dark');
|
|
1338
|
-
document.documentElement.classList.add('light');
|
|
1339
|
-
localStorage.setItem('theme', 'light');
|
|
1340
|
-
}
|
|
1329
|
+
emit('update:modelValue', isDarkMode.value);
|
|
1330
|
+
applyTheme(isDarkMode.value);
|
|
1341
1331
|
};
|
|
1342
1332
|
|
|
1343
1333
|
const handleKeydown = () => {
|
|
@@ -1351,29 +1341,35 @@
|
|
|
1351
1341
|
(window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
1352
1342
|
? 'dark'
|
|
1353
1343
|
: 'light');
|
|
1344
|
+
|
|
1354
1345
|
isDarkMode.value = savedTheme === 'dark';
|
|
1355
|
-
|
|
1356
|
-
document.documentElement.classList.add('dark');
|
|
1357
|
-
} else {
|
|
1358
|
-
document.documentElement.classList.add('light');
|
|
1359
|
-
}
|
|
1346
|
+
applyTheme(isDarkMode.value);
|
|
1360
1347
|
});
|
|
1361
1348
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1349
|
+
vue.watch(
|
|
1350
|
+
() => props.modelValue,
|
|
1351
|
+
(value) => {
|
|
1352
|
+
isDarkMode.value = value;
|
|
1353
|
+
applyTheme(value);
|
|
1354
|
+
},
|
|
1355
|
+
{ immediate: true }
|
|
1356
|
+
);
|
|
1365
1357
|
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1368
|
-
|
|
1358
|
+
const computedLightBorderColor = vue.computed(
|
|
1359
|
+
() => props.lightBorderColor || '#72cce3'
|
|
1360
|
+
);
|
|
1369
1361
|
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1372
|
-
|
|
1362
|
+
const computedLightBackgroundColor = vue.computed(
|
|
1363
|
+
() => props.lightBackgroundColor || '#96dcee'
|
|
1364
|
+
);
|
|
1373
1365
|
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1376
|
-
|
|
1366
|
+
const computedDarkBorderColor = vue.computed(
|
|
1367
|
+
() => props.darkBorderColor || '#072f5f'
|
|
1368
|
+
);
|
|
1369
|
+
|
|
1370
|
+
const computedDarkBackgroundColor = vue.computed(
|
|
1371
|
+
() => props.darkBackgroundColor || '#1261a0'
|
|
1372
|
+
);
|
|
1377
1373
|
|
|
1378
1374
|
return (_ctx, _cache) => {
|
|
1379
1375
|
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
@@ -1382,7 +1378,6 @@
|
|
|
1382
1378
|
id: __props.id,
|
|
1383
1379
|
class: "toggle--checkbox",
|
|
1384
1380
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
|
|
1385
|
-
checked: __props.modelValue,
|
|
1386
1381
|
onChange: toggleTheme,
|
|
1387
1382
|
role: "switch",
|
|
1388
1383
|
"aria-checked": isDarkMode.value,
|
|
@@ -1413,7 +1408,7 @@
|
|
|
1413
1408
|
}
|
|
1414
1409
|
|
|
1415
1410
|
};
|
|
1416
|
-
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-
|
|
1411
|
+
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-699fb0fe"]]);
|
|
1417
1412
|
|
|
1418
1413
|
const _hoisted_1$3 = { class: "input__fieldset" };
|
|
1419
1414
|
const _hoisted_2$3 = {
|