@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.
@@ -19,8 +19,8 @@ var ButtonSize = /* @__PURE__ */ ((ButtonSize2) => {
19
19
  return ButtonSize2;
20
20
  })(ButtonSize || {});
21
21
 
22
- const _hoisted_1$f = ["xlink:href"];
23
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
22
+ const _hoisted_1$g = ["xlink:href"];
23
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
24
24
  __name: "Icon",
25
25
  props: {
26
26
  name: {
@@ -54,7 +54,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
54
54
  }, [
55
55
  createElementVNode("use", {
56
56
  "xlink:href": `#icon-${__props.name}`
57
- }, null, 8, _hoisted_1$f)
57
+ }, null, 8, _hoisted_1$g)
58
58
  ], 6);
59
59
  };
60
60
  }
@@ -68,10 +68,10 @@ const _export_sfc = (sfc, props) => {
68
68
  return target;
69
69
  };
70
70
 
71
- const HpIcon = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-0b477588"]]);
71
+ const HpIcon = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-0b477588"]]);
72
72
 
73
- const _hoisted_1$e = ["aria-label", "aria-disabled", "disabled"];
74
- const _hoisted_2$d = {
73
+ const _hoisted_1$f = ["aria-label", "aria-disabled", "disabled"];
74
+ const _hoisted_2$e = {
75
75
  key: 0,
76
76
  class: "button-primary__icon--left"
77
77
  };
@@ -79,7 +79,7 @@ const _hoisted_3$c = {
79
79
  key: 1,
80
80
  class: "button-primary__icon--right"
81
81
  };
82
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
82
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
83
83
  __name: "ButtonPrimary",
84
84
  props: {
85
85
  label: {
@@ -152,7 +152,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
152
152
  disabled: __props.disabled,
153
153
  onClick: handleClick
154
154
  }, [
155
- __props.icon && __props.iconPosition === unref(IconPosition).LEFT ? (openBlock(), createElementBlock("span", _hoisted_2$d, [
155
+ __props.icon && __props.iconPosition === unref(IconPosition).LEFT ? (openBlock(), createElementBlock("span", _hoisted_2$e, [
156
156
  createVNode(HpIcon, {
157
157
  name: __props.icon,
158
158
  size: "sm",
@@ -170,15 +170,15 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
170
170
  color: computedColor.value
171
171
  }, null, 8, ["name", "color"])
172
172
  ])) : createCommentVNode("", true)
173
- ], 14, _hoisted_1$e);
173
+ ], 14, _hoisted_1$f);
174
174
  };
175
175
  }
176
176
  });
177
177
 
178
- const HpButtonPrimary = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-5c29dcce"]]);
178
+ const HpButtonPrimary = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-5c29dcce"]]);
179
179
 
180
- const _hoisted_1$d = ["aria-label", "aria-disabled", "disabled"];
181
- const _hoisted_2$c = {
180
+ const _hoisted_1$e = ["aria-label", "aria-disabled", "disabled"];
181
+ const _hoisted_2$d = {
182
182
  key: 0,
183
183
  class: "button-secondary__icon--left"
184
184
  };
@@ -187,7 +187,7 @@ const _hoisted_4$7 = {
187
187
  key: 1,
188
188
  class: "button-secondary__icon--right"
189
189
  };
190
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
190
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
191
191
  __name: "ButtonSecondary",
192
192
  props: {
193
193
  label: {
@@ -245,7 +245,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
245
245
  disabled: __props.disabled,
246
246
  onClick: handleClick
247
247
  }, [
248
- __props.icon && __props.iconPosition === unref(IconPosition).LEFT ? (openBlock(), createElementBlock("span", _hoisted_2$c, [
248
+ __props.icon && __props.iconPosition === unref(IconPosition).LEFT ? (openBlock(), createElementBlock("span", _hoisted_2$d, [
249
249
  createVNode(HpIcon, {
250
250
  name: __props.icon,
251
251
  size: "sm"
@@ -258,15 +258,15 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
258
258
  size: "sm"
259
259
  }, null, 8, ["name"])
260
260
  ])) : createCommentVNode("", true)
261
- ], 14, _hoisted_1$d);
261
+ ], 14, _hoisted_1$e);
262
262
  };
263
263
  }
264
264
  });
265
265
 
266
- const HpButtonSecondary = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-ce9350e4"]]);
266
+ const HpButtonSecondary = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-ce9350e4"]]);
267
267
 
268
- const _hoisted_1$c = ["aria-label", "aria-disabled", "disabled"];
269
- const _hoisted_2$b = {
268
+ const _hoisted_1$d = ["aria-label", "aria-disabled", "disabled"];
269
+ const _hoisted_2$c = {
270
270
  key: 0,
271
271
  class: "button-tertiary__icon--left"
272
272
  };
@@ -275,7 +275,7 @@ const _hoisted_4$6 = {
275
275
  key: 1,
276
276
  class: "button-tertiary__icon--right"
277
277
  };
278
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
278
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
279
279
  __name: "ButtonTertiary",
280
280
  props: {
281
281
  label: {
@@ -333,7 +333,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
333
333
  disabled: __props.disabled,
334
334
  onClick: handleClick
335
335
  }, [
336
- __props.icon && __props.iconPosition === unref(IconPosition).LEFT ? (openBlock(), createElementBlock("span", _hoisted_2$b, [
336
+ __props.icon && __props.iconPosition === unref(IconPosition).LEFT ? (openBlock(), createElementBlock("span", _hoisted_2$c, [
337
337
  createVNode(HpIcon, {
338
338
  name: __props.icon,
339
339
  size: "sm"
@@ -346,12 +346,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
346
346
  size: "sm"
347
347
  }, null, 8, ["name"])
348
348
  ])) : createCommentVNode("", true)
349
- ], 14, _hoisted_1$c);
349
+ ], 14, _hoisted_1$d);
350
350
  };
351
351
  }
352
352
  });
353
353
 
354
- const ButtonTertiary = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-0401b00e"]]);
354
+ const ButtonTertiary = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-0401b00e"]]);
355
355
 
356
356
  var ButtonIconSize = /* @__PURE__ */ ((ButtonIconSize2) => {
357
357
  ButtonIconSize2["SMALL"] = "sm";
@@ -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,14 +372,14 @@ 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
- const _hoisted_1$b = ["aria-label", "tabindex", "aria-disabled", "disabled"];
379
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
381
+ const _hoisted_1$c = ["aria-label", "tabindex", "aria-disabled", "disabled"];
382
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
380
383
  __name: "ButtonIcon",
381
384
  props: {
382
385
  label: {
@@ -427,7 +430,7 @@ const _sfc_main$d = /* @__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,114 @@ const _sfc_main$d = /* @__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",
468
+ secondaryColor: computedBackgroundColor.value,
469
+ size: __props.size,
470
+ speed: 0.8
471
+ }, null, 8, ["color", "secondaryColor", "size"]))
472
+ ], 14, _hoisted_1$c);
473
+ };
474
+ }
475
+ });
476
+
477
+ const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-8cf8a123"]]);
478
+
479
+ var ButtonLetterSize = /* @__PURE__ */ ((ButtonLetterSize2) => {
480
+ ButtonLetterSize2["SMALL"] = "sm";
481
+ ButtonLetterSize2["REGULAR"] = "md";
482
+ ButtonLetterSize2["LARGE"] = "lg";
483
+ return ButtonLetterSize2;
484
+ })(ButtonLetterSize || {});
485
+
486
+ const _hoisted_1$b = ["aria-label", "aria-disabled", "disabled", "tabindex"];
487
+ const _hoisted_2$b = { key: 0 };
488
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
489
+ __name: "ButtonLetter",
490
+ props: {
491
+ label: {
492
+ type: String,
493
+ required: true
494
+ },
495
+ letter: {
496
+ type: String,
497
+ required: true
498
+ },
499
+ hasBackground: {
500
+ type: Boolean,
501
+ default: false
502
+ },
503
+ backgroundColor: {
504
+ type: String,
505
+ default: ""
506
+ },
507
+ letterColor: {
508
+ type: String,
509
+ default: ""
510
+ },
511
+ disabled: {
512
+ type: Boolean,
513
+ default: false
514
+ },
515
+ tabindex: {
516
+ type: Number,
517
+ default: 0
518
+ },
519
+ isLoading: {
520
+ type: Boolean,
521
+ default: false
522
+ },
523
+ size: {
524
+ type: String,
525
+ default: ButtonLetterSize.REGULAR
526
+ }
527
+ },
528
+ emits: ["action:click"],
529
+ setup(__props, { emit: __emit }) {
530
+ const props = __props;
531
+ const emit = __emit;
532
+ const handleClick = (event) => {
533
+ if (!props.disabled && !props.isLoading) {
534
+ emit("action:click", event);
535
+ }
536
+ };
537
+ const computedLetterColor = computed(() => {
538
+ if (props.hasBackground || props.backgroundColor) {
539
+ return props.letterColor || "#000000";
540
+ }
541
+ return props.letterColor || "var(--color-primary)";
542
+ });
543
+ const computedBackgroundColor = computed(() => {
544
+ if (props.backgroundColor) return props.backgroundColor;
545
+ if (props.hasBackground) return "var(--color-primary)";
546
+ return "transparent";
547
+ });
548
+ const letterColorRgb = computed(() => {
549
+ const color = computedLetterColor.value;
550
+ return color ? convertHexToRgb(color) : "";
551
+ });
552
+ return (_ctx, _cache) => {
553
+ return openBlock(), createElementBlock("button", {
554
+ onClick: handleClick,
555
+ "aria-label": __props.label,
556
+ "aria-disabled": __props.disabled || __props.isLoading,
557
+ disabled: __props.disabled || __props.isLoading,
558
+ tabindex: __props.disabled ? -1 : 0,
559
+ class: normalizeClass(["button-letter", {
560
+ "button-letter--sm": __props.size === unref(ButtonLetterSize).SMALL,
561
+ "button-letter--lg": __props.size === unref(ButtonLetterSize).LARGE,
562
+ "button-letter--disabled": __props.disabled,
563
+ "button-letter--is-loading": __props.isLoading
564
+ }]),
565
+ style: normalizeStyle({
566
+ "--background-color": computedBackgroundColor.value,
567
+ "--letter-color-rgb": letterColorRgb.value,
568
+ color: computedLetterColor.value
569
+ })
570
+ }, [
571
+ !__props.isLoading ? (openBlock(), createElementBlock("span", _hoisted_2$b, toDisplayString(__props.letter), 1)) : (openBlock(), createBlock(unref(_sfc_main$b), {
572
+ key: 1,
573
+ type: "circle1",
574
+ color: computedLetterColor.value || "var(--color-primary)",
465
575
  secondaryColor: computedBackgroundColor.value,
466
576
  size: __props.size,
467
577
  speed: 0.8
@@ -471,7 +581,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
471
581
  }
472
582
  });
473
583
 
474
- const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-32ab443d"]]);
584
+ const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-13b75270"]]);
475
585
 
476
586
  var AlertType = /* @__PURE__ */ ((AlertType2) => {
477
587
  AlertType2["WARNING"] = "warning";
@@ -2589,6 +2699,7 @@ const components = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
2589
2699
  __proto__: null,
2590
2700
  HpAlert: Alert,
2591
2701
  HpButtonIcon,
2702
+ HpButtonLetter: ButtonLetter,
2592
2703
  HpButtonPrimary,
2593
2704
  HpButtonSecondary,
2594
2705
  HpButtonTertiary: ButtonTertiary,
@@ -2642,5 +2753,5 @@ const index = {
2642
2753
  ...components
2643
2754
  };
2644
2755
 
2645
- export { Alert as HpAlert, HpButtonIcon, HpButtonPrimary, HpButtonSecondary, ButtonTertiary as HpButtonTertiary, Checkbox as HpCheckbox, Heading as HpHeading, HpIcon, InputNumber as HpInputNumber, InputRange as HpInputRange, InputSelect as HpInputSelect, InputText as HpInputText, Modal as HpModal, RadioButton as HpRadioButton, _sfc_main$b as HpSpinnerLoader, Text as HpText, ThemeSwitcher as HpThemeSwitcher, ToggleSwitch as HpToggleSwitch, index as default };
2756
+ export { Alert as HpAlert, HpButtonIcon, ButtonLetter as HpButtonLetter, HpButtonPrimary, HpButtonSecondary, ButtonTertiary as HpButtonTertiary, Checkbox as HpCheckbox, Heading as HpHeading, HpIcon, InputNumber as HpInputNumber, InputRange as HpInputRange, InputSelect as HpInputSelect, InputText as HpInputText, Modal as HpModal, RadioButton as HpRadioButton, _sfc_main$b as HpSpinnerLoader, Text as HpText, ThemeSwitcher as HpThemeSwitcher, ToggleSwitch as HpToggleSwitch, index as default };
2646
2757
  //# sourceMappingURL=hp-design-system.es.js.map