@henriquepetrelli/hp-design-system 1.1.12 → 1.1.13

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";
@@ -375,8 +375,8 @@ const convertHexToRgb = (color) => {
375
375
  return "0, 0, 0";
376
376
  };
377
377
 
378
- const _hoisted_1$b = ["aria-label", "tabindex", "aria-disabled", "disabled"];
379
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
378
+ const _hoisted_1$c = ["aria-label", "tabindex", "aria-disabled", "disabled"];
379
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
380
380
  __name: "ButtonIcon",
381
381
  props: {
382
382
  label: {
@@ -466,12 +466,113 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
466
466
  size: __props.size,
467
467
  speed: 0.8
468
468
  }, null, 8, ["color", "secondaryColor", "size"]))
469
+ ], 14, _hoisted_1$c);
470
+ };
471
+ }
472
+ });
473
+
474
+ const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-32ab443d"]]);
475
+
476
+ var ButtonLetterSize = /* @__PURE__ */ ((ButtonLetterSize2) => {
477
+ ButtonLetterSize2["SMALL"] = "sm";
478
+ ButtonLetterSize2["REGULAR"] = "md";
479
+ ButtonLetterSize2["LARGE"] = "lg";
480
+ return ButtonLetterSize2;
481
+ })(ButtonLetterSize || {});
482
+
483
+ const _hoisted_1$b = ["aria-label", "tabindex", "aria-disabled", "disabled"];
484
+ const _hoisted_2$b = { key: 0 };
485
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
486
+ __name: "ButtonLetter",
487
+ props: {
488
+ label: {
489
+ type: String,
490
+ required: true
491
+ },
492
+ letter: {
493
+ type: String,
494
+ required: true
495
+ },
496
+ hasBackground: {
497
+ type: Boolean,
498
+ default: false
499
+ },
500
+ backgroundColor: {
501
+ type: String,
502
+ default: ""
503
+ },
504
+ letterColor: {
505
+ type: String,
506
+ default: ""
507
+ },
508
+ disabled: {
509
+ type: Boolean,
510
+ default: false
511
+ },
512
+ tabindex: {
513
+ type: Number,
514
+ default: 0
515
+ },
516
+ isLoading: {
517
+ type: Boolean,
518
+ defualt: false
519
+ },
520
+ size: {
521
+ type: String,
522
+ default: ButtonLetterSize.REGULAR
523
+ }
524
+ },
525
+ emits: ["action:click"],
526
+ setup(__props, { emit: __emit }) {
527
+ const props = __props;
528
+ const emit = __emit;
529
+ const handleClick = (event) => {
530
+ if (!props.disabled) {
531
+ emit("action:click", event);
532
+ }
533
+ };
534
+ const computedLetterColor = computed(() => {
535
+ if (props.backgroundColor || props.hasBackground)
536
+ return props.letterColor || "#fff";
537
+ else return props.letterColor || "var(--color-primary)";
538
+ });
539
+ const computedBackgroundColor = computed(() => {
540
+ if (props.backgroundColor) return props.backgroundColor;
541
+ if (props.hasBackground) return "var(--color-primary)";
542
+ return "transparent";
543
+ });
544
+ return (_ctx, _cache) => {
545
+ return openBlock(), createElementBlock("button", {
546
+ onClick: handleClick,
547
+ "aria-label": __props.label,
548
+ tabindex: __props.tabindex,
549
+ class: normalizeClass(["button-letter", {
550
+ "button-letter--sm": __props.size === unref(ButtonLetterSize).SMALL,
551
+ "button-letter--lg": __props.size === unref(ButtonLetterSize).LARGE,
552
+ "button-letter--disabled": __props.disabled,
553
+ "button-letter--is-loading": __props.isLoading
554
+ }]),
555
+ style: normalizeStyle({
556
+ "--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
561
+ }, [
562
+ !__props.isLoading ? (openBlock(), createElementBlock("span", _hoisted_2$b, toDisplayString(__props.letter), 1)) : (openBlock(), createBlock(unref(_sfc_main$b), {
563
+ key: 1,
564
+ type: "circle1",
565
+ color: computedLetterColor.value || "var(--color-primary)",
566
+ secondaryColor: computedBackgroundColor.value,
567
+ size: __props.size,
568
+ speed: 0.8
569
+ }, null, 8, ["color", "secondaryColor", "size"]))
469
570
  ], 14, _hoisted_1$b);
470
571
  };
471
572
  }
472
573
  });
473
574
 
474
- const HpButtonIcon = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-32ab443d"]]);
575
+ const ButtonLetter = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-4df7cc96"]]);
475
576
 
476
577
  var AlertType = /* @__PURE__ */ ((AlertType2) => {
477
578
  AlertType2["WARNING"] = "warning";
@@ -2589,6 +2690,7 @@ const components = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty
2589
2690
  __proto__: null,
2590
2691
  HpAlert: Alert,
2591
2692
  HpButtonIcon,
2693
+ HpButtonLetter: ButtonLetter,
2592
2694
  HpButtonPrimary,
2593
2695
  HpButtonSecondary,
2594
2696
  HpButtonTertiary: ButtonTertiary,
@@ -2642,5 +2744,5 @@ const index = {
2642
2744
  ...components
2643
2745
  };
2644
2746
 
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 };
2747
+ 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
2748
  //# sourceMappingURL=hp-design-system.es.js.map