@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.
@@ -361,7 +361,10 @@ var ButtonIconSize = /* @__PURE__ */ ((ButtonIconSize2) => {
361
361
  })(ButtonIconSize || {});
362
362
 
363
363
  const convertHexToRgb = (color) => {
364
- if (color.startsWith("var(--")) return "120, 120, 120";
364
+ if (!color) return "";
365
+ if (color.startsWith("var(")) {
366
+ return color;
367
+ }
365
368
  if (color.startsWith("#")) {
366
369
  const hex = color.replace("#", "");
367
370
  const r = parseInt(hex.substring(0, 2), 16);
@@ -369,10 +372,10 @@ const convertHexToRgb = (color) => {
369
372
  const b = parseInt(hex.substring(4, 6), 16);
370
373
  return `${r}, ${g}, ${b}`;
371
374
  }
372
- if (color.includes("rgb(")) {
375
+ if (color.startsWith("rgb")) {
373
376
  return color.replace(/rgba?\(|\s|\)/g, "").split(",").slice(0, 3).join(", ");
374
377
  }
375
- return "0, 0, 0";
378
+ return "";
376
379
  };
377
380
 
378
381
  const _hoisted_1$c = ["aria-label", "tabindex", "aria-disabled", "disabled"];
@@ -427,7 +430,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
427
430
  };
428
431
  const computedIconColor = computed(() => {
429
432
  if (props.backgroundColor || props.hasBackground)
430
- return props.iconColor || "#fff";
433
+ return props.iconColor || "#000000";
431
434
  else return props.iconColor || "var(--color-primary)";
432
435
  });
433
436
  const computedBackgroundColor = computed(() => {
@@ -461,7 +464,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
461
464
  }, null, 8, ["name", "size", "color"])) : (openBlock(), createBlock(unref(_sfc_main$b), {
462
465
  key: 1,
463
466
  type: "circle1",
464
- color: computedIconColor.value || "var(--color-primary)",
467
+ color: computedIconColor.value || "#000",
465
468
  secondaryColor: computedBackgroundColor.value,
466
469
  size: __props.size,
467
470
  speed: 0.8
@@ -471,7 +474,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
471
474
  }
472
475
  });
473
476
 
474
- const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-32ab443d"]]);
477
+ const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-8cf8a123"]]);
475
478
 
476
479
  var ButtonLetterSize = /* @__PURE__ */ ((ButtonLetterSize2) => {
477
480
  ButtonLetterSize2["SMALL"] = "sm";
@@ -480,7 +483,7 @@ var ButtonLetterSize = /* @__PURE__ */ ((ButtonLetterSize2) => {
480
483
  return ButtonLetterSize2;
481
484
  })(ButtonLetterSize || {});
482
485
 
483
- const _hoisted_1$b = ["aria-label", "tabindex", "aria-disabled", "disabled"];
486
+ const _hoisted_1$b = ["aria-label", "aria-disabled", "disabled", "tabindex"];
484
487
  const _hoisted_2$b = { key: 0 };
485
488
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
486
489
  __name: "ButtonLetter",
@@ -515,7 +518,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
515
518
  },
516
519
  isLoading: {
517
520
  type: Boolean,
518
- defualt: false
521
+ default: false
519
522
  },
520
523
  size: {
521
524
  type: String,
@@ -527,25 +530,32 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
527
530
  const props = __props;
528
531
  const emit = __emit;
529
532
  const handleClick = (event) => {
530
- if (!props.disabled) {
533
+ if (!props.disabled && !props.isLoading) {
531
534
  emit("action:click", event);
532
535
  }
533
536
  };
534
537
  const computedLetterColor = computed(() => {
535
- if (props.backgroundColor || props.hasBackground)
536
- return props.letterColor || "#fff";
537
- else return props.letterColor || "var(--color-primary)";
538
+ if (props.hasBackground || props.backgroundColor) {
539
+ return props.letterColor || "#000000";
540
+ }
541
+ return props.letterColor || "var(--color-primary)";
538
542
  });
539
543
  const computedBackgroundColor = computed(() => {
540
544
  if (props.backgroundColor) return props.backgroundColor;
541
545
  if (props.hasBackground) return "var(--color-primary)";
542
546
  return "transparent";
543
547
  });
548
+ const letterColorRgb = computed(() => {
549
+ const color = computedLetterColor.value;
550
+ return color ? convertHexToRgb(color) : "";
551
+ });
544
552
  return (_ctx, _cache) => {
545
553
  return openBlock(), createElementBlock("button", {
546
554
  onClick: handleClick,
547
555
  "aria-label": __props.label,
548
- tabindex: __props.tabindex,
556
+ "aria-disabled": __props.disabled || __props.isLoading,
557
+ disabled: __props.disabled || __props.isLoading,
558
+ tabindex: __props.disabled ? -1 : 0,
549
559
  class: normalizeClass(["button-letter", {
550
560
  "button-letter--sm": __props.size === unref(ButtonLetterSize).SMALL,
551
561
  "button-letter--lg": __props.size === unref(ButtonLetterSize).LARGE,
@@ -554,10 +564,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
554
564
  }]),
555
565
  style: normalizeStyle({
556
566
  "--background-color": computedBackgroundColor.value,
557
- "--letter-color": unref(convertHexToRgb)(computedLetterColor.value)
558
- }),
559
- "aria-disabled": __props.disabled || __props.isLoading,
560
- disabled: __props.disabled || __props.isLoading
567
+ "--letter-color-rgb": letterColorRgb.value,
568
+ color: computedLetterColor.value
569
+ })
561
570
  }, [
562
571
  !__props.isLoading ? (openBlock(), createElementBlock("span", _hoisted_2$b, toDisplayString(__props.letter), 1)) : (openBlock(), createBlock(unref(_sfc_main$b), {
563
572
  key: 1,
@@ -572,7 +581,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
572
581
  }
573
582
  });
574
583
 
575
- const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-4df7cc96"]]);
584
+ const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-13b75270"]]);
576
585
 
577
586
  var AlertType = /* @__PURE__ */ ((AlertType2) => {
578
587
  AlertType2["WARNING"] = "warning";
@@ -1414,7 +1423,7 @@ const props = __props;
1414
1423
 
1415
1424
  const emit = __emit;
1416
1425
 
1417
- const isDarkMode = ref(false);
1426
+ const isDarkMode = ref(localStorage.getItem('theme') === 'dark');
1418
1427
 
1419
1428
  const applyTheme = (isDark) => {
1420
1429
  document.documentElement.classList.toggle('dark', isDark);
@@ -1433,13 +1442,6 @@ const handleKeydown = () => {
1433
1442
  };
1434
1443
 
1435
1444
  onMounted(() => {
1436
- const savedTheme =
1437
- localStorage.getItem('theme') ||
1438
- (window.matchMedia('(prefers-color-scheme: dark)').matches
1439
- ? 'dark'
1440
- : 'light');
1441
-
1442
- isDarkMode.value = savedTheme === 'dark';
1443
1445
  applyTheme(isDarkMode.value);
1444
1446
  });
1445
1447
 
@@ -1505,7 +1507,7 @@ return (_ctx, _cache) => {
1505
1507
  }
1506
1508
 
1507
1509
  };
1508
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-699fb0fe"]]);
1510
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-e4250caa"]]);
1509
1511
 
1510
1512
  const _hoisted_1$3 = { class: "input__fieldset" };
1511
1513
  const _hoisted_2$3 = {