lau-ecom-design-system 1.0.22 → 1.0.23

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.
@@ -1,207 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed, ref } from "vue";
3
- import { LauEcomSize } from "../../enums";
4
- import {
5
- LauEcomUpcIconExclamationTriangle,
6
- LauEcomUpcIconNavCheckmark,
7
- } from "../LauEcomIcon";
8
-
9
- interface Props {
10
- id?: string;
11
- type?: string;
12
- placeholder?: string;
13
- isDisabled?: boolean;
14
- label?: string;
15
- size?: LauEcomSize;
16
- name?: string;
17
- modelValue?: string | number;
18
- inputContainerClass?: string;
19
- inputClass?: string;
20
- errorMessage?: string;
21
- hasSuccess?: boolean;
22
- limit?: number;
23
- }
24
-
25
- const props = withDefaults(defineProps<Props>(), {
26
- id: "lauEcomInput",
27
- type: "text",
28
- placeholder: "Placeholder",
29
- isDisabled: false,
30
- label: "Text label",
31
- size: LauEcomSize.md,
32
- name: "input",
33
- modelValue: "",
34
- inputContainerClass: "",
35
- inputClass: "",
36
- errorMessage: "",
37
- hasSuccess: false,
38
- limit: 50,
39
- });
40
-
41
- const emit = defineEmits<{
42
- "update:modelValue": [value: string];
43
- }>();
44
-
45
- const inputValue = ref(props.modelValue);
46
- const errorMessageValue = ref(props.errorMessage);
47
-
48
- const handleInput = (event: Event) => {
49
- const newValue = (event.target as HTMLInputElement).value;
50
-
51
- if (newValue.length === props.limit) {
52
- errorMessageValue.value = "Excediste el numero de caracteres";
53
- inputValue.value = newValue;
54
- emit("update:modelValue", newValue);
55
- return;
56
- } else {
57
- errorMessageValue.value = props.errorMessage;
58
- }
59
-
60
- inputValue.value = newValue;
61
- emit("update:modelValue", newValue);
62
- };
63
-
64
- const labelClasses = computed(() => {
65
- return {
66
- "lau-ecom-label": true,
67
- "lau-ecom-label--disabled": props.isDisabled,
68
- };
69
- });
70
-
71
- const inputContainerClasses = computed(() => {
72
- return [
73
- "dsEcom-relative",
74
- props.inputContainerClass ? props.inputContainerClass : "dsEcom-w-[284px]",
75
- props.size === LauEcomSize.md ? "dsEcom-h-[42px]" : "dsEcom-h-[46px]",
76
- ];
77
- });
78
-
79
- const inputClasses = computed(() => {
80
- return [
81
- "lau-ecom-input core-font-body-reg-04-16px",
82
- props.inputClass,
83
- props.size === LauEcomSize.md ? "dsEcom-py-[9px]" : "dsEcom-py-[11px]",
84
- { "lau-ecom-input--disabled": props.isDisabled },
85
- { "lau-ecom-input--error": errorMessageValue.value },
86
- { "lau-ecom-input-success": props.hasSuccess && !errorMessageValue.value },
87
- props.hasSuccess || errorMessageValue.value
88
- ? "placeholder:!dsEcom-text-neutral-100"
89
- : "placeholder:!dsEcom-text-neutral-80",
90
- ];
91
- });
92
-
93
- const successClasses = computed(() => {
94
- return [
95
- "lau-ecom-success",
96
- props.size === LauEcomSize.md ? "dsEcom-top-[10px]" : "dsEcom-top-3",
97
- ];
98
- });
99
- </script>
100
-
101
- <template>
102
- <div class="dsEcom-flex dsEcom-flex-col">
103
- <label v-if="label" :class="labelClasses">
104
- {{ label }}
105
- </label>
106
- <div :class="inputContainerClasses">
107
- <input
108
- :id="id"
109
- :class="inputClasses"
110
- :type="type"
111
- :placeholder="placeholder"
112
- :name="name"
113
- :disabled="isDisabled"
114
- :value="inputValue"
115
- :maxlength="limit"
116
- @input="handleInput"
117
- />
118
- <div v-if="hasSuccess && !errorMessageValue" :class="successClasses">
119
- <LauEcomUpcIconNavCheckmark
120
- class="dsEcom-fill-feedback-success-60"
121
- width="24"
122
- height="24"
123
- />
124
- </div>
125
- <div
126
- v-if="errorMessageValue"
127
- class="lau-ecom-error-message core-font-body-reg-06-12px"
128
- >
129
- <div class="dsEcom-flex">
130
- <LauEcomUpcIconExclamationTriangle
131
- class="dsEcom-fill-primary-60"
132
- width="16"
133
- height="16"
134
- />
135
- <p class="dsEcom-ml-1">
136
- {{ errorMessageValue }}
137
- </p>
138
- </div>
139
-
140
- <span v-if="inputValue.toString().length === limit">
141
- {{ `${inputValue.toString().length}/${limit}` }}
142
- </span>
143
- </div>
144
- </div>
145
- </div>
146
- </template>
147
-
148
- <style scoped>
149
- input[type="number"]::-webkit-inner-spin-button,
150
- input[type="number"]::-webkit-outer-spin-button {
151
- -webkit-appearance: none;
152
- margin: 0;
153
- }
154
-
155
- .lau-ecom-label {
156
- @apply dsEcom-block
157
- dsEcom-text-neutral-100
158
- dsEcom-font-core-font-family-public-sans
159
- dsEcom-text-[12px]
160
- dsEcom-font-core-font-weight-extrabold
161
- dsEcom-leading-[18px];
162
- }
163
-
164
- .lau-ecom-label--disabled {
165
- @apply !dsEcom-text-neutral-70;
166
- }
167
-
168
- .lau-ecom-input {
169
- @apply dsEcom-w-full
170
- dsEcom-pl-3
171
- dsEcom-pr-[44px]
172
- dsEcom-rounded-sm
173
- dsEcom-border
174
- dsEcom-border-neutral-80
175
- hover:dsEcom-border-stroke-secondary-60
176
- focus:dsEcom-border-stroke-secondary-60 focus:!dsEcom-text-neutral-100
177
- focus-visible:dsEcom-outline-none
178
- disabled:placeholder:dsEcom-text-neutral-70 disabled:dsEcom-bg-neutral-20
179
- disabled:!dsEcom-border-neutral-70;
180
- }
181
-
182
- .lau-ecom-input--disabled {
183
- @apply !dsEcom-text-neutral-70;
184
- }
185
-
186
- .lau-ecom-input--error {
187
- @apply !dsEcom-border-feedback-error-60;
188
- }
189
-
190
- .lau-ecom-input-success {
191
- @apply !dsEcom-border-feedback-success-60
192
- placeholder:!dsEcom-text-neutral-100;
193
- }
194
-
195
- .lau-ecom-error-message {
196
- @apply dsEcom-flex
197
- dsEcom-items-center
198
- dsEcom-mt-[2px]
199
- dsEcom-justify-between
200
- dsEcom-text-primary-60;
201
- }
202
-
203
- .lau-ecom-success {
204
- @apply dsEcom-absolute
205
- dsEcom-right-3;
206
- }
207
- </style>