@henriquepetrelli/hp-design-system 1.1.20 → 1.1.22

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.
@@ -183,7 +183,7 @@ const _hoisted_2$d = {
183
183
  class: "button-secondary__icon--left"
184
184
  };
185
185
  const _hoisted_3$b = { class: "button-secondary__label" };
186
- const _hoisted_4$7 = {
186
+ const _hoisted_4$8 = {
187
187
  key: 1,
188
188
  class: "button-secondary__icon--right"
189
189
  };
@@ -252,7 +252,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
252
252
  }, null, 8, ["name"])
253
253
  ])) : createCommentVNode("", true),
254
254
  createElementVNode("span", _hoisted_3$b, toDisplayString(__props.label), 1),
255
- __props.icon && __props.iconPosition === unref(IconPosition).RIGHT ? (openBlock(), createElementBlock("span", _hoisted_4$7, [
255
+ __props.icon && __props.iconPosition === unref(IconPosition).RIGHT ? (openBlock(), createElementBlock("span", _hoisted_4$8, [
256
256
  createVNode(HpIcon, {
257
257
  name: __props.icon,
258
258
  size: "sm"
@@ -271,7 +271,7 @@ const _hoisted_2$c = {
271
271
  class: "button-tertiary__icon--left"
272
272
  };
273
273
  const _hoisted_3$a = { class: "button-tertiary__label" };
274
- const _hoisted_4$6 = {
274
+ const _hoisted_4$7 = {
275
275
  key: 1,
276
276
  class: "button-tertiary__icon--right"
277
277
  };
@@ -340,7 +340,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
340
340
  }, null, 8, ["name"])
341
341
  ])) : createCommentVNode("", true),
342
342
  createElementVNode("span", _hoisted_3$a, toDisplayString(__props.label), 1),
343
- __props.icon && __props.iconPosition === unref(IconPosition).RIGHT ? (openBlock(), createElementBlock("span", _hoisted_4$6, [
343
+ __props.icon && __props.iconPosition === unref(IconPosition).RIGHT ? (openBlock(), createElementBlock("span", _hoisted_4$7, [
344
344
  createVNode(HpIcon, {
345
345
  name: __props.icon,
346
346
  size: "sm"
@@ -701,11 +701,11 @@ const _hoisted_3$9 = {
701
701
  key: 2,
702
702
  class: "spinner-circle-3"
703
703
  };
704
- const _hoisted_4$5 = {
704
+ const _hoisted_4$6 = {
705
705
  key: 3,
706
706
  class: "spinner-circle-4"
707
707
  };
708
- const _hoisted_5$5 = {
708
+ const _hoisted_5$6 = {
709
709
  key: 4,
710
710
  class: "spinner-dot-1"
711
711
  };
@@ -806,8 +806,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
806
806
  __props.type === "circle1" ? (openBlock(), createElementBlock("div", _hoisted_1$9)) : createCommentVNode("", true),
807
807
  __props.type === "circle2" ? (openBlock(), createElementBlock("div", _hoisted_2$9)) : createCommentVNode("", true),
808
808
  __props.type === "circle3" ? (openBlock(), createElementBlock("div", _hoisted_3$9)) : createCommentVNode("", true),
809
- __props.type === "circle4" ? (openBlock(), createElementBlock("div", _hoisted_4$5)) : createCommentVNode("", true),
810
- __props.type === "dot1" ? (openBlock(), createElementBlock("div", _hoisted_5$5, [
809
+ __props.type === "circle4" ? (openBlock(), createElementBlock("div", _hoisted_4$6)) : createCommentVNode("", true),
810
+ __props.type === "dot1" ? (openBlock(), createElementBlock("div", _hoisted_5$6, [
811
811
  (openBlock(), createElementBlock(Fragment, null, renderList(3, (i) => {
812
812
  return createElementVNode("div", {
813
813
  key: `dot1-${i}`,
@@ -1155,11 +1155,11 @@ const Heading = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
1155
1155
  const _hoisted_1$6 = { class: "modal__header" };
1156
1156
  const _hoisted_2$6 = { class: "modal__title" };
1157
1157
  const _hoisted_3$6 = { class: "modal__content" };
1158
- const _hoisted_4$4 = {
1158
+ const _hoisted_4$5 = {
1159
1159
  key: 0,
1160
1160
  class: "modal__footer"
1161
1161
  };
1162
- const _hoisted_5$4 = {
1162
+ const _hoisted_5$5 = {
1163
1163
  key: 1,
1164
1164
  class: "modal__footer"
1165
1165
  };
@@ -1264,7 +1264,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1264
1264
  createElementVNode("div", _hoisted_3$6, [
1265
1265
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
1266
1266
  ]),
1267
- __props.hasPrimaryButton || __props.hasSecondaryButton ? (openBlock(), createElementBlock("div", _hoisted_4$4, [
1267
+ __props.hasPrimaryButton || __props.hasSecondaryButton ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
1268
1268
  __props.hasSecondaryButton ? (openBlock(), createBlock(unref(HpButtonSecondary), {
1269
1269
  key: 0,
1270
1270
  label: __props.secondaryButtonLabel,
@@ -1278,7 +1278,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1278
1278
  onClick: handleSecondaryButtonClick
1279
1279
  }, null, 8, ["label", "backgroundColor"])) : createCommentVNode("", true)
1280
1280
  ])) : createCommentVNode("", true),
1281
- !__props.hasPrimaryButton && !__props.hasSecondaryButton && _ctx.$slots.buttons ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
1281
+ !__props.hasPrimaryButton && !__props.hasSecondaryButton && _ctx.$slots.buttons ? (openBlock(), createElementBlock("div", _hoisted_5$5, [
1282
1282
  renderSlot(_ctx.$slots, "buttons", {}, void 0, true)
1283
1283
  ])) : createCommentVNode("", true)
1284
1284
  ], 2)
@@ -1395,9 +1395,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1395
1395
 
1396
1396
  const ToggleSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-14c54b46"]]);
1397
1397
 
1398
- const _hoisted_1$4 = { class: "theme-switcher-container" };
1399
- const _hoisted_2$4 = ["id", "aria-checked"];
1400
- const _hoisted_3$4 = ["for", "onKeydown"];
1398
+ const _hoisted_1$4 = { key: 0 };
1399
+ const _hoisted_2$4 = ["aria-checked", "onKeydown"];
1400
+ const _hoisted_3$4 = {
1401
+ key: 1,
1402
+ class: "theme-switcher-animation"
1403
+ };
1404
+ const _hoisted_4$4 = ["id", "aria-checked"];
1405
+ const _hoisted_5$4 = ["for", "onKeydown"];
1401
1406
 
1402
1407
 
1403
1408
  const _sfc_main$4 = {
@@ -1411,10 +1416,24 @@ const _sfc_main$4 = {
1411
1416
  type: String,
1412
1417
  default: () => `theme-${Math.random().toString(36).substring(2, 9)}`
1413
1418
  },
1419
+ hasAnimation: {
1420
+ type: Boolean,
1421
+ default: true
1422
+ },
1423
+
1424
+ /* Toggle animado */
1414
1425
  lightBorderColor: String,
1415
1426
  lightBackgroundColor: String,
1416
1427
  darkBorderColor: String,
1417
- darkBackgroundColor: String
1428
+ darkBackgroundColor: String,
1429
+
1430
+ /* Ícone */
1431
+ lightIconColor: String,
1432
+ darkIconColor: String,
1433
+
1434
+ /* Hover */
1435
+ lightHoverBackgroundColor: String,
1436
+ darkHoverBackgroundColor: String
1418
1437
  },
1419
1438
  emits: ['update:modelValue'],
1420
1439
  setup(__props, { emit: __emit }) {
@@ -1430,7 +1449,6 @@ const isDarkMode = ref(isStoredDark());
1430
1449
 
1431
1450
  const applyTheme = (isDark) => {
1432
1451
  const theme = isDark ? 'dark' : 'light';
1433
-
1434
1452
  document.documentElement.setAttribute('data-theme', theme);
1435
1453
  localStorage.setItem('theme', theme);
1436
1454
  };
@@ -1440,7 +1458,7 @@ const toggleTheme = () => {
1440
1458
  emit('update:modelValue', isDarkMode.value);
1441
1459
  };
1442
1460
 
1443
- const handleKeydown = () => {
1461
+ const handleToggle = () => {
1444
1462
  isDarkMode.value = !isDarkMode.value;
1445
1463
  toggleTheme();
1446
1464
  };
@@ -1462,6 +1480,25 @@ watch(
1462
1480
  }
1463
1481
  );
1464
1482
 
1483
+ /* 🎨 Ícone */
1484
+ const computedButtonIcon = computed(() =>
1485
+ isDarkMode.value ? 'BE0130' : 'BE0140'
1486
+ );
1487
+
1488
+ const computedButtonIconColor = computed(() =>
1489
+ isDarkMode.value
1490
+ ? props.darkIconColor || '#f3c32e'
1491
+ : props.lightIconColor || '#000000'
1492
+ );
1493
+
1494
+ /* 🎯 Hover background */
1495
+ const computedButtonHoverBackgroundColor = computed(() =>
1496
+ isDarkMode.value
1497
+ ? props.darkHoverBackgroundColor || '#717171'
1498
+ : props.lightHoverBackgroundColor || 'rgba(0, 0, 0, 0.08)'
1499
+ );
1500
+
1501
+ /* 🎚 Toggle animado */
1465
1502
  const computedLightBorderColor = computed(
1466
1503
  () => props.lightBorderColor || '#72cce3'
1467
1504
  );
@@ -1479,43 +1516,69 @@ const computedDarkBackgroundColor = computed(
1479
1516
  );
1480
1517
 
1481
1518
  return (_ctx, _cache) => {
1482
- return (openBlock(), createElementBlock("div", _hoisted_1$4, [
1483
- withDirectives(createElementVNode("input", {
1484
- type: "checkbox",
1485
- id: __props.id,
1486
- class: "toggle--checkbox",
1487
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
1488
- onChange: toggleTheme,
1489
- role: "switch",
1490
- "aria-checked": isDarkMode.value,
1491
- "aria-label": "Alternar entre tema claro e escuro",
1492
- tabindex: "-1"
1493
- }, null, 40, _hoisted_2$4), [
1494
- [vModelCheckbox, isDarkMode.value]
1495
- ]),
1496
- createElementVNode("label", {
1497
- for: __props.id,
1498
- class: "toggle--label",
1499
- style: normalizeStyle({
1519
+ return (!__props.hasAnimation)
1520
+ ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
1521
+ createElementVNode("button", {
1522
+ class: "theme-switcher",
1523
+ type: "button",
1524
+ role: "switch",
1525
+ "aria-checked": isDarkMode.value,
1526
+ "aria-label": "Alternar entre tema claro e escuro",
1527
+ onClick: handleToggle,
1528
+ onKeydown: [
1529
+ withKeys(withModifiers(handleToggle, ["prevent"]), ["enter"]),
1530
+ withKeys(withModifiers(handleToggle, ["prevent"]), ["space"])
1531
+ ],
1532
+ style: normalizeStyle({
1533
+ '--hover-bg-color': computedButtonHoverBackgroundColor.value,
1534
+ '--icon-color': computedButtonIconColor.value
1535
+ })
1536
+ }, [
1537
+ createVNode(unref(HpIcon), {
1538
+ class: "theme-switcher__icon",
1539
+ name: computedButtonIcon.value,
1540
+ size: "sm",
1541
+ color: computedButtonIconColor.value
1542
+ }, null, 8, ["name", "color"])
1543
+ ], 44, _hoisted_2$4)
1544
+ ]))
1545
+ : (openBlock(), createElementBlock("div", _hoisted_3$4, [
1546
+ withDirectives(createElementVNode("input", {
1547
+ type: "checkbox",
1548
+ id: __props.id,
1549
+ class: "toggle--checkbox",
1550
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
1551
+ onChange: toggleTheme,
1552
+ role: "switch",
1553
+ "aria-checked": isDarkMode.value,
1554
+ "aria-label": "Alternar entre tema claro e escuro",
1555
+ tabindex: "-1"
1556
+ }, null, 40, _hoisted_4$4), [
1557
+ [vModelCheckbox, isDarkMode.value]
1558
+ ]),
1559
+ createElementVNode("label", {
1560
+ for: __props.id,
1561
+ class: "toggle--label",
1562
+ style: normalizeStyle({
1500
1563
  '--light-background-color': computedLightBackgroundColor.value,
1501
1564
  '--light-border-color': computedLightBorderColor.value,
1502
1565
  '--dark-background-color': computedDarkBackgroundColor.value,
1503
1566
  '--dark-border-color': computedDarkBorderColor.value
1504
1567
  }),
1505
- tabindex: "0",
1506
- onKeydown: [
1507
- withKeys(withModifiers(handleKeydown, ["prevent"]), ["enter"]),
1508
- withKeys(withModifiers(handleKeydown, ["prevent"]), ["space"])
1509
- ]
1510
- }, _cache[1] || (_cache[1] = [
1511
- createElementVNode("span", { class: "toggle--label-background" }, null, -1)
1512
- ]), 44, _hoisted_3$4)
1513
- ]))
1568
+ tabindex: "0",
1569
+ onKeydown: [
1570
+ withKeys(withModifiers(handleToggle, ["prevent"]), ["enter"]),
1571
+ withKeys(withModifiers(handleToggle, ["prevent"]), ["space"])
1572
+ ]
1573
+ }, _cache[1] || (_cache[1] = [
1574
+ createElementVNode("span", { class: "toggle--label-background" }, null, -1)
1575
+ ]), 44, _hoisted_5$4)
1576
+ ]))
1514
1577
  }
1515
1578
  }
1516
1579
 
1517
1580
  };
1518
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-f2c78aa3"]]);
1581
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-7efca676"]]);
1519
1582
 
1520
1583
  const _hoisted_1$3 = { class: "input__fieldset" };
1521
1584
  const _hoisted_2$3 = {