@henriquepetrelli/hp-design-system 1.1.19 → 1.1.21

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 }) {
@@ -1423,18 +1442,15 @@ const props = __props;
1423
1442
 
1424
1443
  const emit = __emit;
1425
1444
 
1426
- const getStoredTheme = () => localStorage.getItem('theme');
1445
+ const getStoredTheme = () => localStorage.getItem('theme') || 'light';
1427
1446
  const isStoredDark = () => getStoredTheme() === 'dark';
1428
1447
 
1429
1448
  const isDarkMode = ref(isStoredDark());
1430
1449
 
1431
1450
  const applyTheme = (isDark) => {
1432
- const root = document.documentElement;
1433
-
1434
- root.classList.toggle('dark', isDark);
1435
- root.classList.remove('light'); // light é o default via :root
1436
-
1437
- localStorage.setItem('theme', isDark ? 'dark' : 'light');
1451
+ const theme = isDark ? 'dark' : 'light';
1452
+ document.documentElement.setAttribute('data-theme', theme);
1453
+ localStorage.setItem('theme', theme);
1438
1454
  };
1439
1455
 
1440
1456
  const toggleTheme = () => {
@@ -1442,7 +1458,7 @@ const toggleTheme = () => {
1442
1458
  emit('update:modelValue', isDarkMode.value);
1443
1459
  };
1444
1460
 
1445
- const handleKeydown = () => {
1461
+ const handleToggle = () => {
1446
1462
  isDarkMode.value = !isDarkMode.value;
1447
1463
  toggleTheme();
1448
1464
  };
@@ -1464,6 +1480,25 @@ watch(
1464
1480
  }
1465
1481
  );
1466
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 */
1467
1502
  const computedLightBorderColor = computed(
1468
1503
  () => props.lightBorderColor || '#72cce3'
1469
1504
  );
@@ -1481,43 +1516,69 @@ const computedDarkBackgroundColor = computed(
1481
1516
  );
1482
1517
 
1483
1518
  return (_ctx, _cache) => {
1484
- return (openBlock(), createElementBlock("div", _hoisted_1$4, [
1485
- withDirectives(createElementVNode("input", {
1486
- type: "checkbox",
1487
- id: __props.id,
1488
- class: "toggle--checkbox",
1489
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((isDarkMode).value = $event)),
1490
- onChange: toggleTheme,
1491
- role: "switch",
1492
- "aria-checked": isDarkMode.value,
1493
- "aria-label": "Alternar entre tema claro e escuro",
1494
- tabindex: "-1"
1495
- }, null, 40, _hoisted_2$4), [
1496
- [vModelCheckbox, isDarkMode.value]
1497
- ]),
1498
- createElementVNode("label", {
1499
- for: __props.id,
1500
- class: "toggle--label",
1501
- 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({
1502
1563
  '--light-background-color': computedLightBackgroundColor.value,
1503
1564
  '--light-border-color': computedLightBorderColor.value,
1504
1565
  '--dark-background-color': computedDarkBackgroundColor.value,
1505
1566
  '--dark-border-color': computedDarkBorderColor.value
1506
1567
  }),
1507
- tabindex: "0",
1508
- onKeydown: [
1509
- withKeys(withModifiers(handleKeydown, ["prevent"]), ["enter"]),
1510
- withKeys(withModifiers(handleKeydown, ["prevent"]), ["space"])
1511
- ]
1512
- }, _cache[1] || (_cache[1] = [
1513
- createElementVNode("span", { class: "toggle--label-background" }, null, -1)
1514
- ]), 44, _hoisted_3$4)
1515
- ]))
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
+ ]))
1516
1577
  }
1517
1578
  }
1518
1579
 
1519
1580
  };
1520
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-ed2b100c"]]);
1581
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-7efca676"]]);
1521
1582
 
1522
1583
  const _hoisted_1$3 = { class: "input__fieldset" };
1523
1584
  const _hoisted_2$3 = {