Skip to content

Commit 8449061

Browse files
authored
Merge pull request #993 from Sysvale/feature/support-link-event
feature/support-link-event
2 parents 7b4722b + 2a16b49 commit 8449061

File tree

11 files changed

+33
-12
lines changed

11 files changed

+33
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sysvale/cuida",
3-
"version": "3.135.1",
3+
"version": "3.136.0",
44
"description": "A design system built by Sysvale, using storybook and Vue components",
55
"repository": {
66
"type": "git",

src/components/BaseInput.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
:tooltip-icon="tooltipIcon"
3939
:support-link="supportLink"
4040
:support-link-url="supportLinkUrl"
41+
@support-link-click="emits('supportLinkClick')"
4142
/>
4243

4344
<div
@@ -380,7 +381,8 @@ const props = defineProps({
380381
});
381382
382383
const emits = defineEmits({
383-
...nativeEvents
384+
...nativeEvents,
385+
'supportLinkClick': null,
384386
});
385387
386388
/* REACTIVE DATA */

src/components/Label.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@
2525
</span>
2626

2727
<CdsLink
28-
v-if="supportLink"
28+
v-if="supportLink && supportLinkUrl"
2929
:href="supportLinkUrl"
3030
:text="supportLink"
3131
class="label__link"
3232
new-tab
3333
/>
34+
35+
<CdsText
36+
v-else
37+
class="label__link"
38+
@click="emits('supportLinkClick')"
39+
>
40+
{{ supportLink }}
41+
</CdsText>
3442
</label>
3543
</template>
3644

@@ -80,8 +88,8 @@ defineProps({
8088
* Define a url a ser acessada no clique do link de suporte.
8189
*/
8290
supportLinkUrl: {
83-
type: String,
84-
default: 'https://cuida.framer.wiki/',
91+
type: [String, null],
92+
default: null,
8593
},
8694
/**
8795
* Exibe asterisco de obrigatório (obs.: não faz a validação)
@@ -99,6 +107,8 @@ defineProps({
99107
required: false,
100108
},
101109
});
110+
111+
const emits = defineEmits(['supportLinkClick']);
102112
</script>
103113

104114
<style lang="scss" scoped>
@@ -125,6 +135,11 @@ defineProps({
125135
126136
&__link {
127137
justify-self: end;
138+
color: tokens.$bn-400;
139+
text-decoration: none;
140+
transition: tokens.$interaction;
141+
border-bottom: 1px solid transparent;
142+
cursor: pointer;
128143
}
129144
130145
&__content {

src/stories/components/BaseInput.stories.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const Template = (args) => ({
5555
@focus="logFocus"
5656
@blur="logBlur"
5757
@keydown="logKeydown"
58+
@supportLinkClick="logLinkClick"
5859
>
5960
<template #trailing-icon2>
6061
OPA
@@ -76,6 +77,9 @@ export const Template = (args) => ({
7677
logKeydown(event) {
7778
console.info('⚡ %cKeydown emitted: ', 'color: hsl(152, 77.20%, 51.80%);', event);
7879
},
80+
logLinkClick(event) {
81+
console.info('⚡ %clogLinkClick emitted: ', 'color: hsl(152, 77.20%, 51.80%);', event);
82+
},
7983
},
8084
updated() {
8185
console.info('%cv-model: ', 'color: #2C70CD;', this.value);

src/tests/__snapshots__/BaseInput.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`BaseInput > renders correctly 1`] = `
44
"<div data-v-82c69faf="">
55
<!--v-if--><label data-v-c1eb01da="" data-v-82c69faf="" class="label"><span data-v-c1eb01da="" class="label__content">Label <!--v-if--><!--v-if--></span>
6-
<!--v-if-->
6+
<cdstext data-v-c1eb01da="" class="label__link"></cdstext>
77
</label>
88
<div data-v-82c69faf="" class="base-input base-input--default">
99
<!--v-if-->

src/tests/__snapshots__/DateInput.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`DateInput > renders correctly 1`] = `
55
<!--v-if-->
66
<div data-v-82c69faf="" data-v-fcd39cd1="" variant="green" range="false" mobile="false" showtodaydot="false" highlighttoday="false" mindate="" maxdate="" mode="picking">
77
<!--v-if--><label data-v-c1eb01da="" data-v-82c69faf="" class="label"><span data-v-c1eb01da="" class="label__content">Selecione uma data <!--v-if--><!--v-if--></span>
8-
<!--v-if-->
8+
<cdstext data-v-c1eb01da="" class="label__link"></cdstext>
99
</label>
1010
<div data-v-82c69faf="" class="base-input base-input--default">
1111
<!--v-if-->

src/tests/__snapshots__/NumberInput.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`CdsNumberInput > renders correctly 1`] = `
44
"<div id="number-input">
55
<div data-v-82c69faf="" money="false" linkurl="https://cuida.framer.wiki/" mobile="false">
66
<!--v-if--><label data-v-c1eb01da="" data-v-82c69faf="" class="label"><span data-v-c1eb01da="" class="label__content">Valor <!--v-if--><!--v-if--></span>
7-
<!--v-if-->
7+
<cdstext data-v-c1eb01da="" class="label__link"></cdstext>
88
</label>
99
<div data-v-82c69faf="" class="base-input base-input--default">
1010
<!--v-if-->

src/tests/__snapshots__/RadioButtonGroup.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`RadioButtonGroup > renders correctly 1`] = `
44
"<div data-v-575576ed="" class="radio__button" style="--border-color-selected: #377EE1; --background-color: #f6f9fe; --display-vertical: inline-flex;" id="radio-button" value=""><label data-v-c1eb01da="" data-v-575576ed="" class="label"><span data-v-c1eb01da="" class="label__content">Label <!--v-if--><!--v-if--></span>
5-
<!--v-if-->
5+
<cdstext data-v-c1eb01da="" class="label__link"></cdstext>
66
</label>
77
<div data-v-575576ed="" class="">
88
<div data-v-575576ed="" class="" style=""><label data-v-575576ed="" class="radio-button" disabled="true" for="radio-button-value1"><input data-v-575576ed="" id="radio-button-value1" type="radio" disabled="" value="value1"><label data-v-575576ed="" class="radio-button__content" for="radio-button-value1">

src/tests/__snapshots__/Select.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`Select > renders correctly 1`] = `
55
<div data-v-96b70cc4="" class="select__container select__container--fit">
66
<div data-v-82c69faf="" data-v-96b70cc4="" options="[object Object],[object Object]" searchable="false" width="" optionsfield="value" returnvalue="false" linkurl="https://cuida.framer.wiki/" mobile="false" addable="false" onkeypress="return false;" class="select__input--undefined select__input--fit">
77
<!--v-if--><label data-v-c1eb01da="" data-v-82c69faf="" class="label"><span data-v-c1eb01da="" class="label__content">label <!--v-if--><!--v-if--></span>
8-
<!--v-if-->
8+
<cdstext data-v-c1eb01da="" class="label__link"></cdstext>
99
</label>
1010
<div data-v-82c69faf="" class="base-input base-input--default">
1111
<!--v-if-->

src/tests/__snapshots__/TextInput.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`TextInput > renders correctly 1`] = `
44
"<div data-v-82c69faf="" inputtype="text" linkurl="https://cuida.framer.wiki/" mobile="false" disableautocomplete="false">
55
<!--v-if--><label data-v-c1eb01da="" data-v-82c69faf="" class="label"><span data-v-c1eb01da="" class="label__content">Label <!--v-if--><!--v-if--></span>
6-
<!--v-if-->
6+
<cdstext data-v-c1eb01da="" class="label__link"></cdstext>
77
</label>
88
<div data-v-82c69faf="" class="base-input base-input--default">
99
<!--v-if-->

0 commit comments

Comments
 (0)