@henriquepetrelli/hp-design-system 1.1.12 → 1.1.14

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.
@@ -23,8 +23,8 @@
23
23
  return ButtonSize2;
24
24
  })(ButtonSize || {});
25
25
 
26
- const _hoisted_1$f = ["xlink:href"];
27
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
26
+ const _hoisted_1$g = ["xlink:href"];
27
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
28
28
  __name: "Icon",
29
29
  props: {
30
30
  name: {
@@ -58,7 +58,7 @@
58
58
  }, [
59
59
  vue.createElementVNode("use", {
60
60
  "xlink:href": `#icon-${__props.name}`
61
- }, null, 8, _hoisted_1$f)
61
+ }, null, 8, _hoisted_1$g)
62
62
  ], 6);
63
63
  };
64
64
  }
@@ -72,10 +72,10 @@
72
72
  return target;
73
73
  };
74
74
 
75
- const HpIcon = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-0b477588"]]);
75
+ const HpIcon = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-0b477588"]]);
76
76
 
77
- const _hoisted_1$e = ["aria-label", "aria-disabled", "disabled"];
78
- const _hoisted_2$d = {
77
+ const _hoisted_1$f = ["aria-label", "aria-disabled", "disabled"];
78
+ const _hoisted_2$e = {
79
79
  key: 0,
80
80
  class: "button-primary__icon--left"
81
81
  };
@@ -83,7 +83,7 @@
83
83
  key: 1,
84
84
  class: "button-primary__icon--right"
85
85
  };
86
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
86
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
87
87
  __name: "ButtonPrimary",
88
88
  props: {
89
89
  label: {
@@ -156,7 +156,7 @@
156
156
  disabled: __props.disabled,
157
157
  onClick: handleClick
158
158
  }, [
159
- __props.icon && __props.iconPosition === vue.unref(IconPosition).LEFT ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$d, [
159
+ __props.icon && __props.iconPosition === vue.unref(IconPosition).LEFT ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$e, [
160
160
  vue.createVNode(HpIcon, {
161
161
  name: __props.icon,
162
162
  size: "sm",
@@ -174,15 +174,15 @@
174
174
  color: computedColor.value
175
175
  }, null, 8, ["name", "color"])
176
176
  ])) : vue.createCommentVNode("", true)
177
- ], 14, _hoisted_1$e);
177
+ ], 14, _hoisted_1$f);
178
178
  };
179
179
  }
180
180
  });
181
181
 
182
- const HpButtonPrimary = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-5c29dcce"]]);
182
+ const HpButtonPrimary = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-5c29dcce"]]);
183
183
 
184
- const _hoisted_1$d = ["aria-label", "aria-disabled", "disabled"];
185
- const _hoisted_2$c = {
184
+ const _hoisted_1$e = ["aria-label", "aria-disabled", "disabled"];
185
+ const _hoisted_2$d = {
186
186
  key: 0,
187
187
  class: "button-secondary__icon--left"
188
188
  };
@@ -191,7 +191,7 @@
191
191
  key: 1,
192
192
  class: "button-secondary__icon--right"
193
193
  };
194
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
194
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
195
195
  __name: "ButtonSecondary",
196
196
  props: {
197
197
  label: {
@@ -249,7 +249,7 @@
249
249
  disabled: __props.disabled,
250
250
  onClick: handleClick
251
251
  }, [
252
- __props.icon && __props.iconPosition === vue.unref(IconPosition).LEFT ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$c, [
252
+ __props.icon && __props.iconPosition === vue.unref(IconPosition).LEFT ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$d, [
253
253
  vue.createVNode(HpIcon, {
254
254
  name: __props.icon,
255
255
  size: "sm"
@@ -262,15 +262,15 @@
262
262
  size: "sm"
263
263
  }, null, 8, ["name"])
264
264
  ])) : vue.createCommentVNode("", true)
265
- ], 14, _hoisted_1$d);
265
+ ], 14, _hoisted_1$e);
266
266
  };
267
267
  }
268
268
  });
269
269
 
270
- const HpButtonSecondary = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-ce9350e4"]]);
270
+ const HpButtonSecondary = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-ce9350e4"]]);
271
271
 
272
- const _hoisted_1$c = ["aria-label", "aria-disabled", "disabled"];
273
- const _hoisted_2$b = {
272
+ const _hoisted_1$d = ["aria-label", "aria-disabled", "disabled"];
273
+ const _hoisted_2$c = {
274
274
  key: 0,
275
275
  class: "button-tertiary__icon--left"
276
276
  };
@@ -279,7 +279,7 @@
279
279
  key: 1,
280
280
  class: "button-tertiary__icon--right"
281
281
  };
282
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
282
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
283
283
  __name: "ButtonTertiary",
284
284
  props: {
285
285
  label: {
@@ -337,7 +337,7 @@
337
337
  disabled: __props.disabled,
338
338
  onClick: handleClick
339
339
  }, [
340
- __props.icon && __props.iconPosition === vue.unref(IconPosition).LEFT ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$b, [
340
+ __props.icon && __props.iconPosition === vue.unref(IconPosition).LEFT ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$c, [
341
341
  vue.createVNode(HpIcon, {
342
342
  name: __props.icon,
343
343
  size: "sm"
@@ -350,12 +350,12 @@
350
350
  size: "sm"
351
351
  }, null, 8, ["name"])
352
352
  ])) : vue.createCommentVNode("", true)
353
- ], 14, _hoisted_1$c);
353
+ ], 14, _hoisted_1$d);
354
354
  };
355
355
  }
356
356
  });
357
357
 
358
- const ButtonTertiary = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-0401b00e"]]);
358
+ const ButtonTertiary = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-0401b00e"]]);
359
359
 
360
360
  var ButtonIconSize = /* @__PURE__ */ ((ButtonIconSize2) => {
361
361
  ButtonIconSize2["SMALL"] = "sm";
@@ -365,7 +365,10 @@
365
365
  })(ButtonIconSize || {});
366
366
 
367
367
  const convertHexToRgb = (color) => {
368
- if (color.startsWith("var(--")) return "120, 120, 120";
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,14 +376,14 @@
373
376
  const b = parseInt(hex.substring(4, 6), 16);
374
377
  return `${r}, ${g}, ${b}`;
375
378
  }
376
- if (color.includes("rgb(")) {
379
+ if (color.startsWith("rgb")) {
377
380
  return color.replace(/rgba?\(|\s|\)/g, "").split(",").slice(0, 3).join(", ");
378
381
  }
379
- return "0, 0, 0";
382
+ return "";
380
383
  };
381
384
 
382
- const _hoisted_1$b = ["aria-label", "tabindex", "aria-disabled", "disabled"];
383
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
385
+ const _hoisted_1$c = ["aria-label", "tabindex", "aria-disabled", "disabled"];
386
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
384
387
  __name: "ButtonIcon",
385
388
  props: {
386
389
  label: {
@@ -431,7 +434,7 @@
431
434
  };
432
435
  const computedIconColor = vue.computed(() => {
433
436
  if (props.backgroundColor || props.hasBackground)
434
- return props.iconColor || "#fff";
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,114 @@
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 || "var(--color-primary)",
471
+ color: computedIconColor.value || "#000",
472
+ secondaryColor: computedBackgroundColor.value,
473
+ size: __props.size,
474
+ speed: 0.8
475
+ }, null, 8, ["color", "secondaryColor", "size"]))
476
+ ], 14, _hoisted_1$c);
477
+ };
478
+ }
479
+ });
480
+
481
+ const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-8cf8a123"]]);
482
+
483
+ var ButtonLetterSize = /* @__PURE__ */ ((ButtonLetterSize2) => {
484
+ ButtonLetterSize2["SMALL"] = "sm";
485
+ ButtonLetterSize2["REGULAR"] = "md";
486
+ ButtonLetterSize2["LARGE"] = "lg";
487
+ return ButtonLetterSize2;
488
+ })(ButtonLetterSize || {});
489
+
490
+ const _hoisted_1$b = ["aria-label", "aria-disabled", "disabled", "tabindex"];
491
+ const _hoisted_2$b = { key: 0 };
492
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
493
+ __name: "ButtonLetter",
494
+ props: {
495
+ label: {
496
+ type: String,
497
+ required: true
498
+ },
499
+ letter: {
500
+ type: String,
501
+ required: true
502
+ },
503
+ hasBackground: {
504
+ type: Boolean,
505
+ default: false
506
+ },
507
+ backgroundColor: {
508
+ type: String,
509
+ default: ""
510
+ },
511
+ letterColor: {
512
+ type: String,
513
+ default: ""
514
+ },
515
+ disabled: {
516
+ type: Boolean,
517
+ default: false
518
+ },
519
+ tabindex: {
520
+ type: Number,
521
+ default: 0
522
+ },
523
+ isLoading: {
524
+ type: Boolean,
525
+ default: false
526
+ },
527
+ size: {
528
+ type: String,
529
+ default: ButtonLetterSize.REGULAR
530
+ }
531
+ },
532
+ emits: ["action:click"],
533
+ setup(__props, { emit: __emit }) {
534
+ const props = __props;
535
+ const emit = __emit;
536
+ const handleClick = (event) => {
537
+ if (!props.disabled && !props.isLoading) {
538
+ emit("action:click", event);
539
+ }
540
+ };
541
+ const computedLetterColor = vue.computed(() => {
542
+ if (props.hasBackground || props.backgroundColor) {
543
+ return props.letterColor || "#000000";
544
+ }
545
+ return props.letterColor || "var(--color-primary)";
546
+ });
547
+ const computedBackgroundColor = vue.computed(() => {
548
+ if (props.backgroundColor) return props.backgroundColor;
549
+ if (props.hasBackground) return "var(--color-primary)";
550
+ return "transparent";
551
+ });
552
+ const letterColorRgb = vue.computed(() => {
553
+ const color = computedLetterColor.value;
554
+ return color ? convertHexToRgb(color) : "";
555
+ });
556
+ return (_ctx, _cache) => {
557
+ return vue.openBlock(), vue.createElementBlock("button", {
558
+ onClick: handleClick,
559
+ "aria-label": __props.label,
560
+ "aria-disabled": __props.disabled || __props.isLoading,
561
+ disabled: __props.disabled || __props.isLoading,
562
+ tabindex: __props.disabled ? -1 : 0,
563
+ class: vue.normalizeClass(["button-letter", {
564
+ "button-letter--sm": __props.size === vue.unref(ButtonLetterSize).SMALL,
565
+ "button-letter--lg": __props.size === vue.unref(ButtonLetterSize).LARGE,
566
+ "button-letter--disabled": __props.disabled,
567
+ "button-letter--is-loading": __props.isLoading
568
+ }]),
569
+ style: vue.normalizeStyle({
570
+ "--background-color": computedBackgroundColor.value,
571
+ "--letter-color-rgb": letterColorRgb.value,
572
+ color: computedLetterColor.value
573
+ })
574
+ }, [
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), {
576
+ key: 1,
577
+ type: "circle1",
578
+ color: computedLetterColor.value || "var(--color-primary)",
469
579
  secondaryColor: computedBackgroundColor.value,
470
580
  size: __props.size,
471
581
  speed: 0.8
@@ -475,7 +585,7 @@
475
585
  }
476
586
  });
477
587
 
478
- const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-32ab443d"]]);
588
+ const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-13b75270"]]);
479
589
 
480
590
  var AlertType = /* @__PURE__ */ ((AlertType2) => {
481
591
  AlertType2["WARNING"] = "warning";
@@ -2593,6 +2703,7 @@
2593
2703
  __proto__: null,
2594
2704
  HpAlert: Alert,
2595
2705
  HpButtonIcon,
2706
+ HpButtonLetter: ButtonLetter,
2596
2707
  HpButtonPrimary,
2597
2708
  HpButtonSecondary,
2598
2709
  HpButtonTertiary: ButtonTertiary,
@@ -2648,6 +2759,7 @@
2648
2759
 
2649
2760
  exports.HpAlert = Alert;
2650
2761
  exports.HpButtonIcon = HpButtonIcon;
2762
+ exports.HpButtonLetter = ButtonLetter;
2651
2763
  exports.HpButtonPrimary = HpButtonPrimary;
2652
2764
  exports.HpButtonSecondary = HpButtonSecondary;
2653
2765
  exports.HpButtonTertiary = ButtonTertiary;