ads-nuxt 0.1.4 → 0.1.5
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/app/components/AdsDatePicker.vue +12 -0
- package/app/components/AdsFilterSelect.vue +8 -1
- package/app/components/AdsInput.vue +5 -1
- package/app/components/AdsNumberInput.vue +8 -1
- package/app/components/AdsSearchInput.vue +11 -2
- package/app/components/AdsTextarea.vue +8 -1
- package/app/theme/component-tokens.ts +1 -1
- package/package.json +1 -1
|
@@ -34,10 +34,13 @@ const props = withDefaults(
|
|
|
34
34
|
size?: "sm" | "md" | "lg";
|
|
35
35
|
maximumDays?: number;
|
|
36
36
|
class?: string;
|
|
37
|
+
/** O valor veio de uma sugestão de IA. Quem usa limpa a marca quando a pessoa edita. */
|
|
38
|
+
aiSuggestion?: boolean;
|
|
37
39
|
}>(),
|
|
38
40
|
{
|
|
39
41
|
range: false,
|
|
40
42
|
size: "md",
|
|
43
|
+
aiSuggestion: false,
|
|
41
44
|
},
|
|
42
45
|
);
|
|
43
46
|
|
|
@@ -150,9 +153,17 @@ const rangeFieldClass = computed(() => [
|
|
|
150
153
|
"h-[var(--ads-date-height)] rounded-[var(--ads-date-radius)] px-[var(--ads-date-padding-x)] text-[length:var(--ads-date-font-size)] [font-weight:var(--ads-date-weight)] leading-[var(--ads-date-line-height)] text-[var(--ads-date-text)] bg-[var(--ads-date-background)] ring ring-inset ring-[var(--ads-date-border)]",
|
|
151
154
|
"enabled:hover:ring-[var(--ads-date-hover-border)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ads-date-focus-border)]",
|
|
152
155
|
"disabled:cursor-not-allowed disabled:opacity-75",
|
|
156
|
+
props.aiSuggestion && "bg-[var(--ads-button-ia-background)] ring-[var(--ads-button-ia-border)]",
|
|
153
157
|
props.class,
|
|
154
158
|
]);
|
|
155
159
|
|
|
160
|
+
/** O tema do UInputDate usa `!`, então a sugestão de IA também precisa de `!` para vencer. */
|
|
161
|
+
const inputDateUi = computed(() =>
|
|
162
|
+
props.aiSuggestion
|
|
163
|
+
? { base: "!bg-[var(--ads-button-ia-background)] !ring-[var(--ads-button-ia-border)]" }
|
|
164
|
+
: undefined,
|
|
165
|
+
);
|
|
166
|
+
|
|
156
167
|
const popoverUi = { content: "w-auto max-w-none p-0" };
|
|
157
168
|
|
|
158
169
|
/**
|
|
@@ -430,6 +441,7 @@ function isDateUnavailable(value: DateValue) {
|
|
|
430
441
|
:model-value="calendarModel"
|
|
431
442
|
:locale="UI_LOCALE_CODE"
|
|
432
443
|
:size="size"
|
|
444
|
+
:ui="inputDateUi"
|
|
433
445
|
:disabled="disabled"
|
|
434
446
|
:readonly="readonly"
|
|
435
447
|
:min-value="minCalendarDate"
|
|
@@ -100,6 +100,8 @@ const props = withDefaults(
|
|
|
100
100
|
searchPlaceholder?: string;
|
|
101
101
|
/** O gatilho ocupa a largura do campo, como um select de formulário. */
|
|
102
102
|
block?: boolean;
|
|
103
|
+
/** O valor veio de uma sugestão de IA. Quem usa limpa a marca quando a pessoa altera a seleção. */
|
|
104
|
+
aiSuggestion?: boolean;
|
|
103
105
|
}>(),
|
|
104
106
|
{
|
|
105
107
|
placeholder: "Selecione",
|
|
@@ -112,6 +114,7 @@ const props = withDefaults(
|
|
|
112
114
|
emptyLabel: "Nenhum resultado",
|
|
113
115
|
searchPlaceholder: "Pesquisar",
|
|
114
116
|
block: false,
|
|
117
|
+
aiSuggestion: false,
|
|
115
118
|
},
|
|
116
119
|
);
|
|
117
120
|
|
|
@@ -141,6 +144,7 @@ const fieldState = computed(() => {
|
|
|
141
144
|
if (props.disabled) return "disabled";
|
|
142
145
|
if (props.error) return "error";
|
|
143
146
|
if (isOpen.value) return "open";
|
|
147
|
+
if (props.aiSuggestion) return "ai";
|
|
144
148
|
if (hasValue.value) return "selected";
|
|
145
149
|
return "default";
|
|
146
150
|
});
|
|
@@ -155,6 +159,9 @@ const fieldClass = computed(() => {
|
|
|
155
159
|
if (fieldState.value === "open") {
|
|
156
160
|
return "border-(length:--ads-border-width-slim) border-[var(--ads-filter-focus-border)] bg-[var(--ads-filter-background)] text-[var(--ads-filter-text)]";
|
|
157
161
|
}
|
|
162
|
+
if (fieldState.value === "ai") {
|
|
163
|
+
return "border border-[var(--ads-button-ia-border)] bg-[var(--ads-button-ia-background)] hover:border-[var(--ads-filter-hover-border)] text-[var(--ads-filter-text)]";
|
|
164
|
+
}
|
|
158
165
|
if (fieldState.value === "selected") {
|
|
159
166
|
return "border border-[var(--ads-filter-border)] hover:border-[var(--ads-filter-hover-border)] bg-ads-neutro-claro-20 text-[var(--ads-filter-text)]";
|
|
160
167
|
}
|
|
@@ -163,7 +170,7 @@ const fieldClass = computed(() => {
|
|
|
163
170
|
|
|
164
171
|
const chevronClass = computed(() => {
|
|
165
172
|
if (fieldState.value === "disabled") return "text-ads-neutro-medio-60";
|
|
166
|
-
if (fieldState.value === "selected") return "text-ads-neutro-escuro-500";
|
|
173
|
+
if (fieldState.value === "selected" || fieldState.value === "ai") return "text-ads-neutro-escuro-500";
|
|
167
174
|
return "text-ads-neutro-medio-100";
|
|
168
175
|
});
|
|
169
176
|
|
|
@@ -70,6 +70,8 @@ const props = withDefaults(
|
|
|
70
70
|
step?: string | number;
|
|
71
71
|
/** Estado congelado para a documentação. `null` segue o campo. */
|
|
72
72
|
state?: AdsInputState | null;
|
|
73
|
+
/** O valor veio de uma sugestão de IA. Quem usa limpa a marca quando a pessoa edita. */
|
|
74
|
+
aiSuggestion?: boolean;
|
|
73
75
|
}>(),
|
|
74
76
|
{
|
|
75
77
|
label: "",
|
|
@@ -82,6 +84,7 @@ const props = withDefaults(
|
|
|
82
84
|
type: "text",
|
|
83
85
|
suffix: "",
|
|
84
86
|
state: null,
|
|
87
|
+
aiSuggestion: false,
|
|
85
88
|
},
|
|
86
89
|
);
|
|
87
90
|
|
|
@@ -110,6 +113,7 @@ const visualState = computed<AdsInputState>(() => {
|
|
|
110
113
|
if (isDisabled.value) return "disabled";
|
|
111
114
|
if (props.state) return props.state;
|
|
112
115
|
if (props.error) return "error";
|
|
116
|
+
if (props.aiSuggestion) return "ai";
|
|
113
117
|
return displayValue.value ? "active" : "default";
|
|
114
118
|
});
|
|
115
119
|
|
|
@@ -136,7 +140,7 @@ const fieldClass = computed(() => {
|
|
|
136
140
|
return "border-(length:--ads-border-width-slim) border-[var(--ads-input-focus-border)] bg-[var(--ads-input-background)] text-[var(--ads-input-text)]";
|
|
137
141
|
}
|
|
138
142
|
if (visualState.value === "ai") {
|
|
139
|
-
return
|
|
143
|
+
return `border border-[var(--ads-button-ia-border)] bg-[var(--ads-button-ia-background)] text-[var(--ads-text-secondary)] ${focus}`;
|
|
140
144
|
}
|
|
141
145
|
return `border border-[var(--ads-input-border)] bg-[var(--ads-input-background)] text-[var(--ads-input-text)] ${focus}`;
|
|
142
146
|
});
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
import { computed, useId, useTemplateRef } from "vue";
|
|
75
75
|
import AdsTooltip from "./AdsTooltip.vue";
|
|
76
76
|
|
|
77
|
-
export type AdsNumberInputState = "default" | "active" | "focus" | "error" | "disabled";
|
|
77
|
+
export type AdsNumberInputState = "default" | "active" | "focus" | "error" | "disabled" | "ai";
|
|
78
78
|
|
|
79
79
|
const props = withDefaults(
|
|
80
80
|
defineProps<{
|
|
@@ -89,6 +89,8 @@ const props = withDefaults(
|
|
|
89
89
|
step?: string | number;
|
|
90
90
|
/** Estado congelado para a documentação. `null` segue o campo. */
|
|
91
91
|
state?: AdsNumberInputState | null;
|
|
92
|
+
/** O valor veio de uma sugestão de IA. Quem usa limpa a marca quando a pessoa edita. */
|
|
93
|
+
aiSuggestion?: boolean;
|
|
92
94
|
}>(),
|
|
93
95
|
{
|
|
94
96
|
label: "",
|
|
@@ -99,6 +101,7 @@ const props = withDefaults(
|
|
|
99
101
|
suffix: "",
|
|
100
102
|
disabled: false,
|
|
101
103
|
state: null,
|
|
104
|
+
aiSuggestion: false,
|
|
102
105
|
},
|
|
103
106
|
);
|
|
104
107
|
|
|
@@ -136,6 +139,7 @@ const visualState = computed<AdsNumberInputState>(() => {
|
|
|
136
139
|
if (isDisabled.value) return "disabled";
|
|
137
140
|
if (props.state) return props.state;
|
|
138
141
|
if (props.error) return "error";
|
|
142
|
+
if (props.aiSuggestion) return "ai";
|
|
139
143
|
return displayValue.value ? "active" : "default";
|
|
140
144
|
});
|
|
141
145
|
|
|
@@ -161,6 +165,9 @@ const fieldClass = computed(() => {
|
|
|
161
165
|
if (visualState.value === "focus") {
|
|
162
166
|
return "border-(length:--ads-border-width-slim) border-[var(--ads-number-focus-border)] bg-[var(--ads-number-background)] text-[var(--ads-number-text)]";
|
|
163
167
|
}
|
|
168
|
+
if (visualState.value === "ai") {
|
|
169
|
+
return `border border-[var(--ads-button-ia-border)] bg-[var(--ads-button-ia-background)] text-[var(--ads-number-text)] ${focus}`;
|
|
170
|
+
}
|
|
164
171
|
return `border border-[var(--ads-number-border)] bg-[var(--ads-number-background)] text-[var(--ads-number-text)] ${focus}`;
|
|
165
172
|
});
|
|
166
173
|
</script>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<script setup lang="ts">
|
|
41
41
|
import { computed, useId } from "vue";
|
|
42
42
|
|
|
43
|
-
export type AdsSearchInputState = "default" | "active" | "focus" | "disabled";
|
|
43
|
+
export type AdsSearchInputState = "default" | "active" | "focus" | "disabled" | "ai";
|
|
44
44
|
export type AdsSearchInputSize = "md" | "sm";
|
|
45
45
|
|
|
46
46
|
const props = withDefaults(
|
|
@@ -53,6 +53,8 @@ const props = withDefaults(
|
|
|
53
53
|
size?: AdsSearchInputSize;
|
|
54
54
|
/** Estado congelado para a documentação. `null` segue o campo. */
|
|
55
55
|
state?: AdsSearchInputState | null;
|
|
56
|
+
/** O texto veio de uma sugestão de IA. Quem usa limpa a marca quando a pessoa edita. */
|
|
57
|
+
aiSuggestion?: boolean;
|
|
56
58
|
}>(),
|
|
57
59
|
{
|
|
58
60
|
placeholder: "Pesquisar",
|
|
@@ -62,6 +64,7 @@ const props = withDefaults(
|
|
|
62
64
|
icon: "i-lucide-search",
|
|
63
65
|
size: "md",
|
|
64
66
|
state: null,
|
|
67
|
+
aiSuggestion: false,
|
|
65
68
|
},
|
|
66
69
|
);
|
|
67
70
|
|
|
@@ -74,10 +77,13 @@ const isDisabled = computed(() => props.disabled || props.state === "disabled");
|
|
|
74
77
|
const visualState = computed<AdsSearchInputState>(() => {
|
|
75
78
|
if (isDisabled.value) return "disabled";
|
|
76
79
|
if (props.state) return props.state;
|
|
80
|
+
if (props.aiSuggestion) return "ai";
|
|
77
81
|
return model.value ? "active" : "default";
|
|
78
82
|
});
|
|
79
83
|
|
|
80
|
-
const showClear = computed(
|
|
84
|
+
const showClear = computed(
|
|
85
|
+
() => visualState.value === "active" || visualState.value === "focus" || visualState.value === "ai",
|
|
86
|
+
);
|
|
81
87
|
|
|
82
88
|
const iconClass = computed(() =>
|
|
83
89
|
props.size === "sm"
|
|
@@ -108,6 +114,9 @@ const fieldClass = computed(() => {
|
|
|
108
114
|
if (visualState.value === "focus") {
|
|
109
115
|
return `border-(length:--ads-border-width-slim) border-[var(--ads-search-focus-border)] bg-[var(--ads-search-background)] ${tone}`;
|
|
110
116
|
}
|
|
117
|
+
if (visualState.value === "ai") {
|
|
118
|
+
return `border border-[var(--ads-button-ia-border)] bg-[var(--ads-button-ia-background)] ${tone} ${focus}`;
|
|
119
|
+
}
|
|
111
120
|
return `border border-[var(--ads-search-border)] bg-[var(--ads-search-background)] ${tone} ${focus}`;
|
|
112
121
|
});
|
|
113
122
|
</script>
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<script setup lang="ts">
|
|
44
44
|
import { computed, useId } from "vue";
|
|
45
45
|
|
|
46
|
-
export type AdsTextareaState = "default" | "active" | "focus" | "error" | "disabled";
|
|
46
|
+
export type AdsTextareaState = "default" | "active" | "focus" | "error" | "disabled" | "ai";
|
|
47
47
|
|
|
48
48
|
const props = withDefaults(
|
|
49
49
|
defineProps<{
|
|
@@ -54,6 +54,8 @@ const props = withDefaults(
|
|
|
54
54
|
disabled?: boolean;
|
|
55
55
|
/** Estado congelado para a documentação. `null` segue o campo. */
|
|
56
56
|
state?: AdsTextareaState | null;
|
|
57
|
+
/** O texto veio de uma sugestão de IA. Quem usa limpa a marca quando a pessoa edita. */
|
|
58
|
+
aiSuggestion?: boolean;
|
|
57
59
|
}>(),
|
|
58
60
|
{
|
|
59
61
|
label: "",
|
|
@@ -62,6 +64,7 @@ const props = withDefaults(
|
|
|
62
64
|
placeholder: "",
|
|
63
65
|
disabled: false,
|
|
64
66
|
state: null,
|
|
67
|
+
aiSuggestion: false,
|
|
65
68
|
},
|
|
66
69
|
);
|
|
67
70
|
|
|
@@ -76,6 +79,7 @@ const visualState = computed<AdsTextareaState>(() => {
|
|
|
76
79
|
if (isDisabled.value) return "disabled";
|
|
77
80
|
if (props.state) return props.state;
|
|
78
81
|
if (props.error) return "error";
|
|
82
|
+
if (props.aiSuggestion) return "ai";
|
|
79
83
|
return model.value ? "active" : "default";
|
|
80
84
|
});
|
|
81
85
|
|
|
@@ -104,6 +108,9 @@ const fieldClass = computed(() => {
|
|
|
104
108
|
const focus = interactiveFocus
|
|
105
109
|
? "hover:not-focus-within:border-[var(--ads-textarea-hover-border)] focus-within:border-(length:--ads-border-width-slim) focus-within:border-[var(--ads-textarea-focus-border)]"
|
|
106
110
|
: "";
|
|
111
|
+
if (visualState.value === "ai") {
|
|
112
|
+
return `border border-[var(--ads-button-ia-border)] bg-[var(--ads-button-ia-background)] ${text} ${focus}`;
|
|
113
|
+
}
|
|
107
114
|
return `border border-[var(--ads-textarea-border)] bg-[var(--ads-textarea-background)] ${text} ${focus}`;
|
|
108
115
|
});
|
|
109
116
|
</script>
|
|
@@ -94,7 +94,7 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
|
|
|
94
94
|
id: "input",
|
|
95
95
|
section: "campo",
|
|
96
96
|
label: "Campo",
|
|
97
|
-
note: "Vale para o AdsInput. O estado de IA
|
|
97
|
+
note: "Vale para o AdsInput. O estado de IA usa os tokens do botão IA (--ads-button-ia-background e --ads-button-ia-border), também nos campos de busca e filtro.",
|
|
98
98
|
fields: [
|
|
99
99
|
length("--ads-input-height", "Altura", "Medida", "40px"),
|
|
100
100
|
length("--ads-input-padding-x", "Padding horizontal", "Medida", "12px"),
|