@weni/unnnic-system 3.2.4 → 3.2.5-alpha.1
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.
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +5 -5
- package/dist/components/Alert/Version1dot1.vue.d.ts +2 -2
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +3 -3
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
- package/dist/components/Banner/Banner.vue.d.ts +1 -1
- package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +2 -2
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/AccountCard.vue.d.ts +3 -3
- package/dist/components/Card/BlankCard.vue.d.ts +1 -1
- package/dist/components/Card/Card.vue.d.ts +20 -20
- package/dist/components/Card/CardCompany.vue.d.ts +7 -7
- package/dist/components/Card/CardData.vue.d.ts +1 -1
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +3 -3
- package/dist/components/Card/ContentCard.vue.d.ts +2 -2
- package/dist/components/Card/DashCard.vue.d.ts +4 -4
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
- package/dist/components/Card/SimpleCard.vue.d.ts +2 -2
- package/dist/components/Card/StatusCard.vue.d.ts +2 -2
- package/dist/components/Card/TitleCard.vue.d.ts +1 -1
- package/dist/components/CardImage/CardImage.vue.d.ts +7 -7
- package/dist/components/CardInformation/CardInformation.vue.d.ts +3 -3
- package/dist/components/CardProject/CardProject.vue.d.ts +2 -2
- package/dist/components/Carousel/Carousel.vue.d.ts +10 -10
- package/dist/components/Carousel/TagCarousel.vue.d.ts +8 -8
- package/dist/components/ChartBar/ChartBar.vue.d.ts +7 -7
- package/dist/components/ChatText/ChatText.vue.d.ts +1 -1
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +14 -14
- package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +4 -4
- package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
- package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
- package/dist/components/Comment/Comment.vue.d.ts +1 -1
- package/dist/components/DataArea/DataArea.vue.d.ts +1 -1
- package/dist/components/DataTable/index.vue.d.ts +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +182 -27
- package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
- package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
- package/dist/components/DropArea/DropArea.vue.d.ts +2 -0
- package/dist/components/DropArea/DropArea.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/FormElement/FormElement.vue.d.ts +38 -32
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon/types.d.ts +1 -1
- package/dist/components/Icon/types.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/Icon.vue.d.ts.map +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
- package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
- package/dist/components/Input/BaseInput.vue.d.ts +10 -1
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +182 -27
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +31 -13
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +192 -37
- package/dist/components/InputNext/InputNext.vue.d.ts +3 -3
- package/dist/components/Modal/Modal.vue.d.ts +2 -2
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +10 -10
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +189 -34
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +20 -14
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
- package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
- package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
- package/dist/components/Radio/Radio.vue.d.ts +2 -2
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +44 -26
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +7 -7
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
- package/dist/components/SelectTime/index.vue.d.ts +31 -13
- package/dist/components/Slider/Slider.vue.d.ts +1 -1
- package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
- package/dist/components/Switch/Switch.vue.d.ts +2 -2
- package/dist/components/Tab/Tab.vue.d.ts +1 -1
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
- package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
- package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
- package/dist/components/Tag/IndicatorTag.vue.d.ts +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +7 -7
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +9 -0
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +1 -0
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +15 -0
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.vue.d.ts +38 -32
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +6 -6
- package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
- package/dist/components/UploadArea/UploadArea.vue.d.ts +13 -7
- package/dist/components/index.d.ts +2071 -767
- package/dist/components/index.d.ts.map +1 -1
- package/dist/{es-d628da75.mjs → es-dc7f4ae0.mjs} +1 -1
- package/dist/{index-9a407ee0.mjs → index-93c6d4e1.mjs} +7917 -7731
- package/dist/{pt-br-d5be1f83.mjs → pt-br-6c72f1f4.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +126 -122
- package/dist/unnnic.umd.js +42 -41
- package/package.json +2 -2
- package/src/assets/img/previews/doc-preview.png +0 -0
- package/src/assets/img/previews/image-preview.png +0 -0
- package/src/assets/img/previews/video-preview.png +0 -0
- package/src/components/Button/Button.vue +57 -108
- package/src/components/Button/types.ts +0 -1
- package/src/components/DropArea/DropArea.vue +26 -2
- package/src/components/FormElement/FormElement.vue +50 -90
- package/src/components/Icon/types.ts +7 -0
- package/src/components/Icon.vue +7 -0
- package/src/components/Input/BaseInput.vue +10 -12
- package/src/components/Input/Input.scss +17 -20
- package/src/components/Input/Input.vue +86 -28
- package/src/components/Input/TextInput.vue +27 -35
- package/src/components/Input/__test__/TextInput.spec.js +5 -5
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +12 -3
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/ModalDialog/ModalDialog.vue +27 -29
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
- package/src/components/TemplatePreview/TemplatePreview.vue +249 -0
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +51 -0
- package/src/components/TemplatePreview/types.d.ts +16 -0
- package/src/components/TextArea/TextArea.vue +14 -9
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +7 -2
- package/src/components/index.ts +12 -3
- package/src/stories/Button.stories.js +1 -10
- package/src/stories/Input.stories.js +17 -3
- package/src/stories/TemplatePreview.stories.js +94 -0
- package/src/stories/TemplatePreviewModal.stories.js +110 -0
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
:class="classes"
|
|
8
8
|
:type="nativeType"
|
|
9
9
|
/>
|
|
10
|
-
|
|
11
10
|
<input
|
|
12
11
|
v-else
|
|
13
12
|
v-bind="attributes"
|
|
14
13
|
:value="fullySanitize(modelValue)"
|
|
15
14
|
:class="classes"
|
|
16
15
|
:type="nativeType"
|
|
16
|
+
:maxlength="maxlength"
|
|
17
17
|
/>
|
|
18
18
|
</template>
|
|
19
19
|
|
|
@@ -49,6 +49,10 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
hasIconLeft: Boolean,
|
|
51
51
|
hasIconRight: Boolean,
|
|
52
|
+
maxlength: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: null,
|
|
55
|
+
},
|
|
52
56
|
},
|
|
53
57
|
emits: ['update:modelValue'],
|
|
54
58
|
data() {
|
|
@@ -96,27 +100,21 @@ export default {
|
|
|
96
100
|
&.size {
|
|
97
101
|
&-md {
|
|
98
102
|
@include input-md-font;
|
|
99
|
-
|
|
100
|
-
padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
|
|
101
|
-
($unnnic-spacing-sm - $unnnic-border-width-thinner);
|
|
103
|
+
padding: $unnnic-space-3 $unnnic-space-4;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
&-sm {
|
|
105
107
|
@include input-sm-font;
|
|
106
|
-
|
|
107
|
-
padding: $unnnic-spacing-xs
|
|
108
|
-
($unnnic-spacing-sm - $unnnic-border-width-thinner);
|
|
108
|
+
padding: $unnnic-space-2 $unnnic-space-4;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
&.input--has-icon-left {
|
|
113
|
-
padding-left: $unnnic-
|
|
114
|
-
$unnnic-border-width-thinner;
|
|
113
|
+
padding-left: $unnnic-space-10;
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
&.input--has-icon-right {
|
|
118
|
-
padding-right: $unnnic-
|
|
119
|
-
$unnnic-spacing-xs - $unnnic-border-width-thinner;
|
|
117
|
+
padding-right: $unnnic-space-10;
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
&.error {
|
|
@@ -126,7 +124,7 @@ export default {
|
|
|
126
124
|
&:-ms-input-placeholder,
|
|
127
125
|
&::-ms-input-placeholder {
|
|
128
126
|
/* Internet Explorer 10-11 */
|
|
129
|
-
color: $unnnic-color-
|
|
127
|
+
color: $unnnic-color-fg-muted;
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
</style>
|
|
@@ -1,43 +1,40 @@
|
|
|
1
1
|
@use '@/assets/scss/unnnic' as *;
|
|
2
2
|
|
|
3
3
|
@mixin input-base {
|
|
4
|
-
background: $unnnic-color-
|
|
5
|
-
border: $unnnic-border-width-thinner solid $unnnic-color-
|
|
4
|
+
background: $unnnic-color-white;
|
|
5
|
+
border: $unnnic-border-width-thinner solid $unnnic-color-border-base;
|
|
6
6
|
outline: none;
|
|
7
|
-
border-radius: $unnnic-
|
|
8
|
-
color: $unnnic-color-
|
|
9
|
-
caret-color: $unnnic-color-
|
|
10
|
-
font
|
|
11
|
-
font-family: $unnnic-font-family-secondary;
|
|
7
|
+
border-radius: $unnnic-radius-2;
|
|
8
|
+
color: $unnnic-color-fg-emphasized;
|
|
9
|
+
caret-color: $unnnic-color-fg-muted;
|
|
10
|
+
font: $unnnic-font-body;
|
|
12
11
|
|
|
13
12
|
&:focus {
|
|
14
|
-
border-color: $unnnic-color-
|
|
13
|
+
border-color: $unnnic-color-border-active;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
&::placeholder {
|
|
18
|
-
color: $unnnic-color-
|
|
19
|
-
opacity: 1;
|
|
17
|
+
color: $unnnic-color-fg-muted;
|
|
18
|
+
opacity: 1;
|
|
19
|
+
/* Firefox */
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
&:disabled {
|
|
23
|
-
border-color: $unnnic-color-
|
|
24
|
-
background-color: $unnnic-color-
|
|
23
|
+
border-color: $unnnic-color-border-muted;
|
|
24
|
+
background-color: $unnnic-color-bg-muted;
|
|
25
25
|
cursor: not-allowed;
|
|
26
|
-
color: $unnnic-color-
|
|
26
|
+
color: $unnnic-color-fg-muted;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
@mixin input-sm-font {
|
|
31
|
-
font
|
|
32
|
-
line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
|
|
31
|
+
font: $unnnic-font-body;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
@mixin input-md-font {
|
|
36
|
-
font
|
|
37
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
35
|
+
font: $unnnic-font-body;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
@mixin input-error {
|
|
41
|
-
border-color: $unnnic-color-
|
|
42
|
-
|
|
43
|
-
}
|
|
39
|
+
border-color: $unnnic-color-border-critical;
|
|
40
|
+
}
|
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
>
|
|
7
7
|
<slot name="label" />
|
|
8
8
|
</p>
|
|
9
|
-
|
|
10
|
-
<p
|
|
9
|
+
<section
|
|
11
10
|
v-else-if="label"
|
|
12
11
|
class="unnnic-form__label"
|
|
13
12
|
>
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
<p>
|
|
14
|
+
{{ fullySanitize(label) }}
|
|
15
|
+
</p>
|
|
16
|
+
<UnnnicToolTip v-if="tooltip" enabled :text="tooltip">
|
|
17
|
+
<UnnnicIcon icon="help" size="sm" scheme="fg-base" />
|
|
18
|
+
</UnnnicToolTip>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
16
21
|
|
|
17
22
|
<TextInput
|
|
18
23
|
v-bind="$attrs"
|
|
@@ -28,24 +33,38 @@
|
|
|
28
33
|
:size="size"
|
|
29
34
|
:mask="mask"
|
|
30
35
|
:nativeType="nativeType"
|
|
36
|
+
:maxlength="maxlength"
|
|
37
|
+
:disabled="disabled"
|
|
31
38
|
/>
|
|
32
39
|
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
<section class="unnnic-form__hints-container">
|
|
41
|
+
<section class="unnnic-form__message-container">
|
|
42
|
+
<p
|
|
43
|
+
v-if="message"
|
|
44
|
+
class="unnnic-form__message"
|
|
45
|
+
>
|
|
46
|
+
{{ fullySanitize(message) }}
|
|
47
|
+
</p>
|
|
48
|
+
<p v-if="!!errors.length" class="unnnic-form__message error">
|
|
49
|
+
{{ Array.isArray(errors) ? errors.join(', ') : errors }}
|
|
50
|
+
</p>
|
|
51
|
+
</section>
|
|
52
|
+
<p v-if="maxlength && showMaxlengthCounter">
|
|
53
|
+
{{ (val || '').length }} / {{ maxlength }}
|
|
54
|
+
</p>
|
|
55
|
+
</section>
|
|
39
56
|
</div>
|
|
40
57
|
</template>
|
|
41
58
|
|
|
42
59
|
<script>
|
|
43
60
|
import { fullySanitize } from '../../utils/sanitize';
|
|
44
61
|
import TextInput from './TextInput.vue';
|
|
62
|
+
import UnnnicToolTip from '../ToolTip/ToolTip.vue';
|
|
63
|
+
import UnnnicIcon from '../Icon.vue';
|
|
45
64
|
|
|
46
65
|
export default {
|
|
47
66
|
name: 'UnnnicInput',
|
|
48
|
-
components: { TextInput },
|
|
67
|
+
components: { TextInput, UnnnicToolTip, UnnnicIcon },
|
|
49
68
|
props: {
|
|
50
69
|
placeholder: {
|
|
51
70
|
type: String,
|
|
@@ -68,19 +87,23 @@ export default {
|
|
|
68
87
|
},
|
|
69
88
|
message: {
|
|
70
89
|
type: String,
|
|
71
|
-
default:
|
|
90
|
+
default: '',
|
|
91
|
+
},
|
|
92
|
+
errors: {
|
|
93
|
+
type: [String, Array],
|
|
94
|
+
default: '',
|
|
72
95
|
},
|
|
73
96
|
label: {
|
|
74
97
|
type: String,
|
|
75
|
-
default:
|
|
98
|
+
default: '',
|
|
76
99
|
},
|
|
77
100
|
iconLeft: {
|
|
78
101
|
type: String,
|
|
79
|
-
default:
|
|
102
|
+
default: '',
|
|
80
103
|
},
|
|
81
104
|
iconRight: {
|
|
82
105
|
type: String,
|
|
83
|
-
default:
|
|
106
|
+
default: '',
|
|
84
107
|
},
|
|
85
108
|
allowTogglePassword: {
|
|
86
109
|
type: Boolean,
|
|
@@ -88,11 +111,11 @@ export default {
|
|
|
88
111
|
},
|
|
89
112
|
iconLeftClickable: {
|
|
90
113
|
type: Boolean,
|
|
91
|
-
default:
|
|
114
|
+
default: false,
|
|
92
115
|
},
|
|
93
116
|
iconRightClickable: {
|
|
94
117
|
type: Boolean,
|
|
95
|
-
default:
|
|
118
|
+
default: false,
|
|
96
119
|
},
|
|
97
120
|
hasCloudyColor: {
|
|
98
121
|
type: Boolean,
|
|
@@ -106,6 +129,22 @@ export default {
|
|
|
106
129
|
type: [String, Array],
|
|
107
130
|
default: '',
|
|
108
131
|
},
|
|
132
|
+
tooltip: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: '',
|
|
135
|
+
},
|
|
136
|
+
maxlength: {
|
|
137
|
+
type: [Number, null],
|
|
138
|
+
default: null,
|
|
139
|
+
},
|
|
140
|
+
showMaxlengthCounter: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false,
|
|
143
|
+
},
|
|
144
|
+
disabled: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: false,
|
|
147
|
+
},
|
|
109
148
|
},
|
|
110
149
|
emits: ['update:modelValue'],
|
|
111
150
|
data() {
|
|
@@ -138,27 +177,46 @@ export default {
|
|
|
138
177
|
<style lang="scss" scoped>
|
|
139
178
|
@use '@/assets/scss/unnnic' as *;
|
|
140
179
|
|
|
180
|
+
* {
|
|
181
|
+
margin: 0;
|
|
182
|
+
padding: 0;
|
|
183
|
+
box-sizing: border-box;
|
|
184
|
+
}
|
|
185
|
+
|
|
141
186
|
.unnnic-form {
|
|
142
|
-
font-family: $unnnic-font-family-secondary;
|
|
143
187
|
position: relative;
|
|
144
188
|
|
|
145
189
|
&__message {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
190
|
+
&.error {
|
|
191
|
+
color: $unnnic-color-fg-critical;
|
|
192
|
+
}
|
|
149
193
|
}
|
|
150
194
|
|
|
151
195
|
&__label {
|
|
152
|
-
font
|
|
153
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
154
|
-
font-size: $unnnic-font-size-body-gt;
|
|
196
|
+
font: $unnnic-font-body;
|
|
155
197
|
color: $unnnic-color-neutral-cloudy;
|
|
156
|
-
margin: $unnnic-
|
|
198
|
+
margin-bottom: $unnnic-space-1;
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
gap: $unnnic-space-2;
|
|
202
|
+
|
|
203
|
+
:deep(.unnnic-tooltip) {
|
|
204
|
+
display: flex;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&__hints-container {
|
|
209
|
+
display: flex;
|
|
210
|
+
justify-content: space-between;
|
|
211
|
+
margin-top: $unnnic-space-1;
|
|
212
|
+
font: $unnnic-font-caption-2;
|
|
213
|
+
color: $unnnic-color-fg-base;
|
|
157
214
|
}
|
|
158
215
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
216
|
+
&__message-container {
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
gap: $unnnic-space-1;
|
|
162
220
|
}
|
|
163
221
|
}
|
|
164
222
|
</style>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
:class="[
|
|
4
4
|
'text-input',
|
|
5
5
|
`size--${size}`,
|
|
6
|
-
`text-input--icon-right-size-${iconRightSize}`,
|
|
7
6
|
]"
|
|
8
7
|
>
|
|
9
8
|
<BaseInput
|
|
@@ -18,6 +17,7 @@
|
|
|
18
17
|
class="input-itself"
|
|
19
18
|
:hasIconLeft="!!iconLeft"
|
|
20
19
|
:hasIconRight="!!iconRight || allowTogglePassword"
|
|
20
|
+
:maxlength="maxlength"
|
|
21
21
|
@focus="onFocus"
|
|
22
22
|
@blur="onBlur"
|
|
23
23
|
/>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
v-if="iconLeft"
|
|
27
27
|
:scheme="iconScheme"
|
|
28
28
|
:icon="iconLeft"
|
|
29
|
-
size="
|
|
29
|
+
size="ant"
|
|
30
30
|
:clickable="iconLeftClickable"
|
|
31
31
|
:class="['icon-left', { clickable: iconLeftClickable }]"
|
|
32
32
|
@click="onIconLeftClick"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
v-if="iconRightSvg"
|
|
37
37
|
:scheme="iconScheme"
|
|
38
38
|
:icon="iconRightSvg"
|
|
39
|
-
|
|
39
|
+
size="ant"
|
|
40
40
|
:clickable="iconRightClickable || allowTogglePassword"
|
|
41
41
|
:class="[
|
|
42
42
|
'icon-right',
|
|
@@ -92,10 +92,6 @@ export default {
|
|
|
92
92
|
type: Boolean,
|
|
93
93
|
default: null,
|
|
94
94
|
},
|
|
95
|
-
iconRightSize: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: 'sm',
|
|
98
|
-
},
|
|
99
95
|
allowTogglePassword: {
|
|
100
96
|
type: Boolean,
|
|
101
97
|
default: null,
|
|
@@ -108,6 +104,14 @@ export default {
|
|
|
108
104
|
type: String,
|
|
109
105
|
default: 'md',
|
|
110
106
|
},
|
|
107
|
+
maxlength: {
|
|
108
|
+
type: Number,
|
|
109
|
+
default: null,
|
|
110
|
+
},
|
|
111
|
+
disabled: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
111
115
|
},
|
|
112
116
|
emits: ['icon-left-click', 'icon-right-click'],
|
|
113
117
|
data() {
|
|
@@ -118,7 +122,7 @@ export default {
|
|
|
118
122
|
},
|
|
119
123
|
computed: {
|
|
120
124
|
isDisabled() {
|
|
121
|
-
return this.$attrs.disabled;
|
|
125
|
+
return this.$attrs.disabled || this.disabled;
|
|
122
126
|
},
|
|
123
127
|
|
|
124
128
|
iconRightSvg() {
|
|
@@ -131,22 +135,22 @@ export default {
|
|
|
131
135
|
|
|
132
136
|
iconScheme() {
|
|
133
137
|
if (this.type === 'error') {
|
|
134
|
-
return '
|
|
138
|
+
return 'fg-critical';
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
if (this.isDisabled) {
|
|
138
|
-
return '
|
|
142
|
+
return 'fg-muted';
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
if (this.modelValue || this.isFocused) {
|
|
142
|
-
return '
|
|
146
|
+
return 'color-gray-700';
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
if (this.hasCloudyColor) {
|
|
146
|
-
return '
|
|
150
|
+
return 'fg-base';
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
return '
|
|
153
|
+
return 'fg-base';
|
|
150
154
|
},
|
|
151
155
|
|
|
152
156
|
attributes() {
|
|
@@ -183,6 +187,10 @@ export default {
|
|
|
183
187
|
<style lang="scss" scoped>
|
|
184
188
|
@use '@/assets/scss/unnnic' as *;
|
|
185
189
|
|
|
190
|
+
.text-input {
|
|
191
|
+
position: relative;
|
|
192
|
+
}
|
|
193
|
+
|
|
186
194
|
.icon {
|
|
187
195
|
&-left,
|
|
188
196
|
&-right {
|
|
@@ -193,32 +201,16 @@ export default {
|
|
|
193
201
|
|
|
194
202
|
&-left {
|
|
195
203
|
position: absolute;
|
|
196
|
-
top:
|
|
197
|
-
|
|
204
|
+
top: 50%;
|
|
205
|
+
transform: translateY(-50%);
|
|
206
|
+
left: $unnnic-space-4;
|
|
198
207
|
}
|
|
199
208
|
|
|
200
209
|
&-right {
|
|
201
210
|
position: absolute;
|
|
202
|
-
top:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
.text-input {
|
|
207
|
-
position: relative;
|
|
208
|
-
|
|
209
|
-
&.size--sm {
|
|
210
|
-
.icon-left,
|
|
211
|
-
.icon-right {
|
|
212
|
-
top: $unnnic-spacing-xs + 0.125 * $unnnic-font-size;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
&.size--sm.text-input--icon-right-size-ant .icon-right {
|
|
217
|
-
top: 0.5625 * $unnnic-font-size;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
&.size--md.text-input--icon-right-size-ant .icon-right {
|
|
221
|
-
top: 0.8125 * $unnnic-font-size;
|
|
211
|
+
top: 50%;
|
|
212
|
+
transform: translateY(-50%);
|
|
213
|
+
right: $unnnic-space-4;
|
|
222
214
|
}
|
|
223
215
|
}
|
|
224
216
|
</style>
|
|
@@ -74,22 +74,22 @@ describe('TextInput.vue', () => {
|
|
|
74
74
|
|
|
75
75
|
test('computes the correct iconScheme based on various states', async () => {
|
|
76
76
|
await wrapper.setProps({ type: 'error' });
|
|
77
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
77
|
+
expect(wrapper.vm.iconScheme).toBe('fg-critical');
|
|
78
78
|
|
|
79
79
|
await wrapper.setProps({ type: 'normal' });
|
|
80
80
|
await wrapper.setData({ isDisabled: true });
|
|
81
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
81
|
+
expect(wrapper.vm.iconScheme).toBe('fg-base');
|
|
82
82
|
|
|
83
83
|
await wrapper.setData({ isDisabled: false });
|
|
84
84
|
await wrapper.setProps({ modelValue: 'text' });
|
|
85
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
85
|
+
expect(wrapper.vm.iconScheme).toBe('color-gray-700');
|
|
86
86
|
|
|
87
87
|
await wrapper.setData({ isFocused: true });
|
|
88
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
88
|
+
expect(wrapper.vm.iconScheme).toBe('color-gray-700');
|
|
89
89
|
|
|
90
90
|
await wrapper.setProps({ hasCloudyColor: true, modelValue: '' });
|
|
91
91
|
await wrapper.setData({ isFocused: false });
|
|
92
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
92
|
+
expect(wrapper.vm.iconScheme).toBe('fg-base');
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
test('attributes computed property returns combined attributes and props', () => {
|
|
@@ -2,8 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Input.vue > matches the snapshot 1`] = `
|
|
4
4
|
"<div data-v-d890ad85="" class="unnnic-form md">
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
<section data-v-d890ad85="" class="unnnic-form__label">
|
|
6
|
+
<p data-v-d890ad85="">Sample Label</p>
|
|
7
|
+
<!--v-if-->
|
|
8
|
+
</section>
|
|
9
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-form-input" mask="####-####"><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-form-input input-itself input size-md normal input--has-icon-left input--has-icon-right unnnic-form-input input-itself" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" hascloudycolor="false" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span></div>
|
|
10
|
+
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
11
|
+
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
12
|
+
<p data-v-d890ad85="" class="unnnic-form__message">Error message</p>
|
|
13
|
+
<!--v-if-->
|
|
14
|
+
</section>
|
|
15
|
+
<!--v-if-->
|
|
16
|
+
</section>
|
|
8
17
|
</div>"
|
|
9
18
|
`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`TextInput.vue > matches the snapshot 1`] = `"<div data-v-a0d36167="" class="text-input size--md
|
|
3
|
+
exports[`TextInput.vue > matches the snapshot 1`] = `"<div data-v-a0d36167="" class="text-input size--md"><input data-v-86533b41="" data-v-a0d36167="" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" allowtogglepassword="false" hascloudycolor="false" class="input-itself input size-md normal input--has-icon-left input--has-icon-right input-itself" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span></div>"`;
|
|
@@ -24,10 +24,7 @@
|
|
|
24
24
|
</section>
|
|
25
25
|
|
|
26
26
|
<section class="unnnic-modal-dialog__container__body">
|
|
27
|
-
<header
|
|
28
|
-
v-if="title"
|
|
29
|
-
class="unnnic-modal-dialog__container__header"
|
|
30
|
-
>
|
|
27
|
+
<header v-if="title" class="unnnic-modal-dialog__container__header">
|
|
31
28
|
<section class="unnnic-modal-dialog__container__title-container">
|
|
32
29
|
<UnnnicIcon
|
|
33
30
|
v-if="icon || type"
|
|
@@ -49,6 +46,7 @@
|
|
|
49
46
|
data-testid="close-icon"
|
|
50
47
|
icon="close"
|
|
51
48
|
clickable
|
|
49
|
+
scheme="neutral-cloudy"
|
|
52
50
|
@click="close()"
|
|
53
51
|
/>
|
|
54
52
|
</header>
|
|
@@ -98,12 +96,12 @@
|
|
|
98
96
|
</template>
|
|
99
97
|
|
|
100
98
|
<script>
|
|
101
|
-
import UnnnicIcon from
|
|
102
|
-
import UnnnicButton from
|
|
103
|
-
import UnnnicI18n from
|
|
99
|
+
import UnnnicIcon from "../Icon.vue";
|
|
100
|
+
import UnnnicButton from "../Button/Button.vue";
|
|
101
|
+
import UnnnicI18n from "../../mixins/i18n";
|
|
104
102
|
|
|
105
103
|
export default {
|
|
106
|
-
name:
|
|
104
|
+
name: "UnnnicModalDialog",
|
|
107
105
|
components: {
|
|
108
106
|
UnnnicIcon,
|
|
109
107
|
UnnnicButton,
|
|
@@ -120,29 +118,29 @@ export default {
|
|
|
120
118
|
},
|
|
121
119
|
type: {
|
|
122
120
|
type: String,
|
|
123
|
-
default:
|
|
121
|
+
default: "",
|
|
124
122
|
validate(type) {
|
|
125
|
-
return [
|
|
123
|
+
return ["success", "warning", "attention"].includes(type);
|
|
126
124
|
},
|
|
127
125
|
},
|
|
128
126
|
size: {
|
|
129
127
|
type: String,
|
|
130
|
-
default:
|
|
128
|
+
default: "md",
|
|
131
129
|
validate(size) {
|
|
132
|
-
return [
|
|
130
|
+
return ["sm", "md", "lg"].includes(size);
|
|
133
131
|
},
|
|
134
132
|
},
|
|
135
133
|
title: {
|
|
136
134
|
type: String,
|
|
137
|
-
default:
|
|
135
|
+
default: "",
|
|
138
136
|
},
|
|
139
137
|
icon: {
|
|
140
138
|
type: String,
|
|
141
|
-
default:
|
|
139
|
+
default: "",
|
|
142
140
|
},
|
|
143
141
|
iconScheme: {
|
|
144
142
|
type: String,
|
|
145
|
-
default:
|
|
143
|
+
default: "",
|
|
146
144
|
},
|
|
147
145
|
showCloseIcon: {
|
|
148
146
|
type: Boolean,
|
|
@@ -165,26 +163,26 @@ export default {
|
|
|
165
163
|
default: () => ({}),
|
|
166
164
|
},
|
|
167
165
|
},
|
|
168
|
-
emits: [
|
|
166
|
+
emits: ["primaryButtonClick", "secondaryButtonClick", "update:modelValue"],
|
|
169
167
|
|
|
170
168
|
data() {
|
|
171
169
|
return {
|
|
172
170
|
defaultTranslations: {
|
|
173
171
|
cancel: {
|
|
174
|
-
|
|
175
|
-
en:
|
|
176
|
-
es:
|
|
172
|
+
"pt-br": "Cancelar",
|
|
173
|
+
en: "Cancel",
|
|
174
|
+
es: "Cancelar",
|
|
177
175
|
},
|
|
178
176
|
},
|
|
179
177
|
iconsMapper: {
|
|
180
|
-
success: { icon:
|
|
181
|
-
warning: { icon:
|
|
182
|
-
attention: { icon:
|
|
178
|
+
success: { icon: "check_circle", scheme: "aux-green-500" },
|
|
179
|
+
warning: { icon: "warning", scheme: "aux-red-500" },
|
|
180
|
+
attention: { icon: "error", scheme: "aux-yellow-500" },
|
|
183
181
|
},
|
|
184
182
|
primaryButtonTypeMapper: {
|
|
185
|
-
success:
|
|
186
|
-
warning:
|
|
187
|
-
attention:
|
|
183
|
+
success: "primary",
|
|
184
|
+
warning: "warning",
|
|
185
|
+
attention: "attention",
|
|
188
186
|
},
|
|
189
187
|
};
|
|
190
188
|
},
|
|
@@ -195,17 +193,17 @@ export default {
|
|
|
195
193
|
},
|
|
196
194
|
methods: {
|
|
197
195
|
close() {
|
|
198
|
-
this.$emit(
|
|
196
|
+
this.$emit("update:modelValue", false);
|
|
199
197
|
},
|
|
200
198
|
updateBodyOverflow(isHidden) {
|
|
201
|
-
document.body.style.overflow = isHidden ?
|
|
199
|
+
document.body.style.overflow = isHidden ? "hidden" : "";
|
|
202
200
|
},
|
|
203
201
|
},
|
|
204
202
|
};
|
|
205
203
|
</script>
|
|
206
204
|
|
|
207
205
|
<style lang="scss" scoped>
|
|
208
|
-
@use
|
|
206
|
+
@use "@/assets/scss/unnnic" as *;
|
|
209
207
|
* {
|
|
210
208
|
margin: 0;
|
|
211
209
|
padding: 0;
|
|
@@ -312,7 +310,7 @@ export default {
|
|
|
312
310
|
&__actions {
|
|
313
311
|
display: grid;
|
|
314
312
|
grid-template-columns: 1fr 1fr;
|
|
315
|
-
grid-template-areas:
|
|
313
|
+
grid-template-areas: "secondary-button primary-button";
|
|
316
314
|
gap: $unnnic-spacing-sm;
|
|
317
315
|
padding: $unnnic-spacing-md;
|
|
318
316
|
flex-shrink: 0;
|
|
@@ -11,7 +11,7 @@ exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
|
11
11
|
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="test-icon" clickable="false" size="md" scheme="neutral-darkest" data-testid="title-icon" class="unnnic-modal-dialog__container__title-icon"></unnnic-icon-stub>
|
|
12
12
|
<h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
|
|
13
13
|
</section>
|
|
14
|
-
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-
|
|
14
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-cloudy" data-testid="close-icon"></unnnic-icon-stub>
|
|
15
15
|
</header>
|
|
16
16
|
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
|
|
17
17
|
<section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
|