@henriquepetrelli/hp-design-system 1.1.13 → 1.1.15
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.
|
@@ -365,7 +365,10 @@
|
|
|
365
365
|
})(ButtonIconSize || {});
|
|
366
366
|
|
|
367
367
|
const convertHexToRgb = (color) => {
|
|
368
|
-
if (color
|
|
368
|
+
if (!color) return "";
|
|
369
|
+
if (color.startsWith("var(")) {
|
|
370
|
+
return color;
|
|
371
|
+
}
|
|
369
372
|
if (color.startsWith("#")) {
|
|
370
373
|
const hex = color.replace("#", "");
|
|
371
374
|
const r = parseInt(hex.substring(0, 2), 16);
|
|
@@ -373,10 +376,10 @@
|
|
|
373
376
|
const b = parseInt(hex.substring(4, 6), 16);
|
|
374
377
|
return `${r}, ${g}, ${b}`;
|
|
375
378
|
}
|
|
376
|
-
if (color.
|
|
379
|
+
if (color.startsWith("rgb")) {
|
|
377
380
|
return color.replace(/rgba?\(|\s|\)/g, "").split(",").slice(0, 3).join(", ");
|
|
378
381
|
}
|
|
379
|
-
return "
|
|
382
|
+
return "";
|
|
380
383
|
};
|
|
381
384
|
|
|
382
385
|
const _hoisted_1$c = ["aria-label", "tabindex", "aria-disabled", "disabled"];
|
|
@@ -431,7 +434,7 @@
|
|
|
431
434
|
};
|
|
432
435
|
const computedIconColor = vue.computed(() => {
|
|
433
436
|
if (props.backgroundColor || props.hasBackground)
|
|
434
|
-
return props.iconColor || "#
|
|
437
|
+
return props.iconColor || "#000000";
|
|
435
438
|
else return props.iconColor || "var(--color-primary)";
|
|
436
439
|
});
|
|
437
440
|
const computedBackgroundColor = vue.computed(() => {
|
|
@@ -465,7 +468,7 @@
|
|
|
465
468
|
}, null, 8, ["name", "size", "color"])) : (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$b), {
|
|
466
469
|
key: 1,
|
|
467
470
|
type: "circle1",
|
|
468
|
-
color: computedIconColor.value || "
|
|
471
|
+
color: computedIconColor.value || "#000",
|
|
469
472
|
secondaryColor: computedBackgroundColor.value,
|
|
470
473
|
size: __props.size,
|
|
471
474
|
speed: 0.8
|
|
@@ -475,7 +478,7 @@
|
|
|
475
478
|
}
|
|
476
479
|
});
|
|
477
480
|
|
|
478
|
-
const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
481
|
+
const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-8cf8a123"]]);
|
|
479
482
|
|
|
480
483
|
var ButtonLetterSize = /* @__PURE__ */ ((ButtonLetterSize2) => {
|
|
481
484
|
ButtonLetterSize2["SMALL"] = "sm";
|
|
@@ -484,7 +487,7 @@
|
|
|
484
487
|
return ButtonLetterSize2;
|
|
485
488
|
})(ButtonLetterSize || {});
|
|
486
489
|
|
|
487
|
-
const _hoisted_1$b = ["aria-label", "
|
|
490
|
+
const _hoisted_1$b = ["aria-label", "aria-disabled", "disabled", "tabindex"];
|
|
488
491
|
const _hoisted_2$b = { key: 0 };
|
|
489
492
|
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
490
493
|
__name: "ButtonLetter",
|
|
@@ -519,7 +522,7 @@
|
|
|
519
522
|
},
|
|
520
523
|
isLoading: {
|
|
521
524
|
type: Boolean,
|
|
522
|
-
|
|
525
|
+
default: false
|
|
523
526
|
},
|
|
524
527
|
size: {
|
|
525
528
|
type: String,
|
|
@@ -531,25 +534,32 @@
|
|
|
531
534
|
const props = __props;
|
|
532
535
|
const emit = __emit;
|
|
533
536
|
const handleClick = (event) => {
|
|
534
|
-
if (!props.disabled) {
|
|
537
|
+
if (!props.disabled && !props.isLoading) {
|
|
535
538
|
emit("action:click", event);
|
|
536
539
|
}
|
|
537
540
|
};
|
|
538
541
|
const computedLetterColor = vue.computed(() => {
|
|
539
|
-
if (props.
|
|
540
|
-
return props.letterColor || "#
|
|
541
|
-
|
|
542
|
+
if (props.hasBackground || props.backgroundColor) {
|
|
543
|
+
return props.letterColor || "#000000";
|
|
544
|
+
}
|
|
545
|
+
return props.letterColor || "var(--color-primary)";
|
|
542
546
|
});
|
|
543
547
|
const computedBackgroundColor = vue.computed(() => {
|
|
544
548
|
if (props.backgroundColor) return props.backgroundColor;
|
|
545
549
|
if (props.hasBackground) return "var(--color-primary)";
|
|
546
550
|
return "transparent";
|
|
547
551
|
});
|
|
552
|
+
const letterColorRgb = vue.computed(() => {
|
|
553
|
+
const color = computedLetterColor.value;
|
|
554
|
+
return color ? convertHexToRgb(color) : "";
|
|
555
|
+
});
|
|
548
556
|
return (_ctx, _cache) => {
|
|
549
557
|
return vue.openBlock(), vue.createElementBlock("button", {
|
|
550
558
|
onClick: handleClick,
|
|
551
559
|
"aria-label": __props.label,
|
|
552
|
-
|
|
560
|
+
"aria-disabled": __props.disabled || __props.isLoading,
|
|
561
|
+
disabled: __props.disabled || __props.isLoading,
|
|
562
|
+
tabindex: __props.disabled ? -1 : 0,
|
|
553
563
|
class: vue.normalizeClass(["button-letter", {
|
|
554
564
|
"button-letter--sm": __props.size === vue.unref(ButtonLetterSize).SMALL,
|
|
555
565
|
"button-letter--lg": __props.size === vue.unref(ButtonLetterSize).LARGE,
|
|
@@ -558,10 +568,9 @@
|
|
|
558
568
|
}]),
|
|
559
569
|
style: vue.normalizeStyle({
|
|
560
570
|
"--background-color": computedBackgroundColor.value,
|
|
561
|
-
"--letter-color":
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
disabled: __props.disabled || __props.isLoading
|
|
571
|
+
"--letter-color-rgb": letterColorRgb.value,
|
|
572
|
+
color: computedLetterColor.value
|
|
573
|
+
})
|
|
565
574
|
}, [
|
|
566
575
|
!__props.isLoading ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$b, vue.toDisplayString(__props.letter), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$b), {
|
|
567
576
|
key: 1,
|
|
@@ -576,7 +585,7 @@
|
|
|
576
585
|
}
|
|
577
586
|
});
|
|
578
587
|
|
|
579
|
-
const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-
|
|
588
|
+
const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-13b75270"]]);
|
|
580
589
|
|
|
581
590
|
var AlertType = /* @__PURE__ */ ((AlertType2) => {
|
|
582
591
|
AlertType2["WARNING"] = "warning";
|
|
@@ -1418,7 +1427,7 @@
|
|
|
1418
1427
|
|
|
1419
1428
|
const emit = __emit;
|
|
1420
1429
|
|
|
1421
|
-
const isDarkMode = vue.ref(
|
|
1430
|
+
const isDarkMode = vue.ref(localStorage.getItem('theme') === 'dark');
|
|
1422
1431
|
|
|
1423
1432
|
const applyTheme = (isDark) => {
|
|
1424
1433
|
document.documentElement.classList.toggle('dark', isDark);
|
|
@@ -1437,13 +1446,6 @@
|
|
|
1437
1446
|
};
|
|
1438
1447
|
|
|
1439
1448
|
vue.onMounted(() => {
|
|
1440
|
-
const savedTheme =
|
|
1441
|
-
localStorage.getItem('theme') ||
|
|
1442
|
-
(window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
1443
|
-
? 'dark'
|
|
1444
|
-
: 'light');
|
|
1445
|
-
|
|
1446
|
-
isDarkMode.value = savedTheme === 'dark';
|
|
1447
1449
|
applyTheme(isDarkMode.value);
|
|
1448
1450
|
});
|
|
1449
1451
|
|
|
@@ -1509,7 +1511,7 @@
|
|
|
1509
1511
|
}
|
|
1510
1512
|
|
|
1511
1513
|
};
|
|
1512
|
-
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-
|
|
1514
|
+
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-e4250caa"]]);
|
|
1513
1515
|
|
|
1514
1516
|
const _hoisted_1$3 = { class: "input__fieldset" };
|
|
1515
1517
|
const _hoisted_2$3 = {
|