ads-nuxt 0.1.4 → 0.2.0
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/LICENSE +21 -21
- package/README.md +573 -577
- package/app/app.config.ts +25 -25
- package/app/assets/ads/checkbox-check.svg +5 -5
- package/app/assets/ads/checkbox-minus.svg +5 -5
- package/app/assets/brand/farmarcas.svg +6 -6
- package/app/assets/brand/radar-symbol.svg +9 -0
- package/app/assets/brand/radar.svg +9 -9
- package/app/assets/css/ads-colors.css +257 -246
- package/app/assets/css/component-tokens.css +367 -403
- package/app/assets/css/main.css +624 -617
- package/app/components/AdsBadge.vue +47 -48
- package/app/components/AdsBroadcast.vue +24 -45
- package/app/components/AdsButton.vue +539 -569
- package/app/components/AdsButtonGroup.vue +39 -39
- package/app/components/AdsButtonMenu.vue +48 -48
- package/app/components/AdsCard.vue +188 -117
- package/app/components/AdsCardHint.vue +22 -0
- package/app/components/AdsCardPeriod.vue +43 -0
- package/app/components/AdsCardVariation.vue +31 -0
- package/app/components/AdsCharttip.vue +78 -78
- package/app/components/AdsCheckbox.vue +77 -77
- package/app/components/AdsDatePicker.vue +492 -479
- package/app/components/AdsDropdownMenu.vue +30 -19
- package/app/components/AdsEmptyState.vue +58 -58
- package/app/components/AdsFeatureCard.vue +210 -219
- package/app/components/AdsFileCard.vue +98 -101
- package/app/components/AdsFooter.vue +25 -25
- package/app/components/AdsHeavyAccountCell.vue +59 -0
- package/app/components/AdsHeavyHeaderCell.vue +70 -0
- package/app/components/AdsHeavyTable.vue +135 -0
- package/app/components/AdsInput.vue +147 -143
- package/app/components/AdsLoading.vue +217 -109
- package/app/components/AdsMenuBar.vue +103 -103
- package/app/components/AdsMetricCard.vue +216 -119
- package/app/components/AdsModal.vue +157 -157
- package/app/components/AdsMonthPicker.vue +80 -80
- package/app/components/AdsNavbarApp.vue +67 -67
- package/app/components/AdsNavbarDesk.vue +62 -62
- package/app/components/AdsNotabilityPill.vue +24 -27
- package/app/components/AdsNumberInput.vue +173 -166
- package/app/components/AdsPagination.vue +91 -91
- package/app/components/AdsPanelCard.vue +99 -0
- package/app/components/AdsPill.vue +144 -92
- package/app/components/AdsProductTag.vue +61 -61
- package/app/components/AdsRadio.vue +70 -70
- package/app/components/AdsSearchInput.vue +122 -113
- package/app/components/AdsSegmentedTabs.vue +62 -28
- package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -203
- package/app/components/AdsSelectItem.vue +128 -0
- package/app/components/AdsSelectPanel.vue +150 -0
- package/app/components/AdsSideMenu.vue +101 -101
- package/app/components/AdsSmalltip.vue +44 -44
- package/app/components/AdsStepper.vue +222 -0
- package/app/components/AdsSteptip.vue +101 -101
- package/app/components/AdsSwitch.vue +59 -59
- package/app/components/AdsTable.vue +161 -100
- package/app/components/AdsTableHeaderCell.vue +80 -0
- package/app/components/AdsTableSkeleton.vue +113 -0
- package/app/components/AdsTableToolbar.vue +44 -44
- package/app/components/AdsTabs.vue +51 -51
- package/app/components/AdsTextarea.vue +116 -109
- package/app/components/AdsToast.vue +183 -181
- package/app/components/AdsTooltip.vue +73 -73
- package/app/components/OverlayLoading.vue +173 -173
- package/app/components/ProgressBarLoading.vue +235 -256
- package/app/composables/useOverlayLoading.ts +66 -66
- package/app/constants/ads-color-swatches.ts +240 -239
- package/app/locale/pt-br.ts +6 -6
- package/app/plugins/ads-toast.client.ts +24 -24
- package/app/theme/ads-theme.ts +374 -370
- package/app/theme/ads-tokens.ts +391 -379
- package/app/theme/component-tokens.json +366 -402
- package/app/theme/component-tokens.ts +807 -815
- package/app/types/overlay-loading.types.ts +26 -26
- package/app/utils/ads-filter-select.ts +191 -172
- package/app/utils/ads-table.ts +395 -204
- package/app/utils/calendar-date.ts +163 -163
- package/app/utils/category-role.ts +45 -45
- package/app/utils/money.ts +77 -77
- package/app/utils/notability.ts +8 -8
- package/app/utils/parser.ts +134 -134
- package/app/utils/percentage.ts +54 -54
- package/nuxt.config.ts +31 -31
- package/package.json +1 -1
- package/app/components/AdsFarmarcasPill.vue +0 -74
- package/app/components/AdsFilterDropdown.vue +0 -174
- package/app/components/AdsFilterOption.vue +0 -74
- package/app/components/AdsListDropdown.vue +0 -44
- package/app/components/AdsMiniPill.vue +0 -40
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<label
|
|
3
|
-
class="inline-flex items-center gap-[var(--ads-radio-gap)]"
|
|
4
|
-
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
5
|
-
>
|
|
6
|
-
<span class="relative grid size-[var(--ads-radio-size)] shrink-0 place-items-center">
|
|
7
|
-
<input
|
|
8
|
-
v-bind="attrs"
|
|
9
|
-
type="radio"
|
|
10
|
-
class="peer absolute inset-0 m-0 size-full appearance-none opacity-0 disabled:cursor-not-allowed"
|
|
11
|
-
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
12
|
-
:name="fieldName"
|
|
13
|
-
:value="value"
|
|
14
|
-
:checked="checked"
|
|
15
|
-
:disabled="isDisabled"
|
|
16
|
-
@change="onChange"
|
|
17
|
-
>
|
|
18
|
-
<span
|
|
19
|
-
class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-size)] rounded-full border-[length:var(--ads-radio-border-width)] bg-[var(--ads-radio-background)] peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[var(--ads-text-brand)]"
|
|
20
|
-
:class="isDisabled
|
|
21
|
-
? 'border-[var(--ads-radio-disabled)] peer-checked:border-[var(--ads-radio-disabled)] peer-checked:bg-[var(--ads-radio-disabled)]'
|
|
22
|
-
: 'border-[var(--ads-radio-border)] peer-checked:border-[var(--ads-radio-border)] peer-checked:bg-[var(--ads-radio-border)]'"
|
|
23
|
-
/>
|
|
24
|
-
<span class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-dot)] rounded-full bg-[var(--ads-radio-dot-color)] opacity-0 peer-checked:opacity-100" />
|
|
25
|
-
</span>
|
|
26
|
-
<span
|
|
27
|
-
v-if="hasLabel"
|
|
28
|
-
class="text-[length:var(--ads-radio-label-size)] font-normal leading-[1.3]"
|
|
29
|
-
:class="isDisabled ? 'text-[var(--ads-text-tertiary)]' : 'text-[var(--ads-radio-label)]'"
|
|
30
|
-
>
|
|
31
|
-
<slot>{{ label }}</slot>
|
|
32
|
-
</span>
|
|
33
|
-
</label>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script setup lang="ts">
|
|
37
|
-
import { computed, useAttrs, useId, useSlots } from "vue";
|
|
38
|
-
|
|
39
|
-
defineOptions({ inheritAttrs: false });
|
|
40
|
-
|
|
41
|
-
const props = withDefaults(
|
|
42
|
-
defineProps<{
|
|
43
|
-
label?: string;
|
|
44
|
-
value?: string | number | boolean;
|
|
45
|
-
name?: string;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
}>(),
|
|
48
|
-
{
|
|
49
|
-
label: "",
|
|
50
|
-
value: "on",
|
|
51
|
-
name: "",
|
|
52
|
-
disabled: false,
|
|
53
|
-
},
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const model = defineModel<string | number | boolean>({ default: "" });
|
|
57
|
-
const attrs = useAttrs();
|
|
58
|
-
const slots = useSlots();
|
|
59
|
-
const autoName = useId();
|
|
60
|
-
|
|
61
|
-
const hasLabel = computed(() => props.label.length > 0 || Boolean(slots.default));
|
|
62
|
-
const isDisabled = computed(() => props.disabled);
|
|
63
|
-
const fieldName = computed(() => props.name || autoName);
|
|
64
|
-
const checked = computed(() => model.value === props.value);
|
|
65
|
-
|
|
66
|
-
const onChange = () => {
|
|
67
|
-
if (isDisabled.value) return;
|
|
68
|
-
model.value = props.value;
|
|
69
|
-
};
|
|
70
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
class="inline-flex items-center gap-[var(--ads-radio-gap)]"
|
|
4
|
+
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
5
|
+
>
|
|
6
|
+
<span class="relative grid size-[var(--ads-radio-size)] shrink-0 place-items-center">
|
|
7
|
+
<input
|
|
8
|
+
v-bind="attrs"
|
|
9
|
+
type="radio"
|
|
10
|
+
class="peer absolute inset-0 m-0 size-full appearance-none opacity-0 disabled:cursor-not-allowed"
|
|
11
|
+
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
12
|
+
:name="fieldName"
|
|
13
|
+
:value="value"
|
|
14
|
+
:checked="checked"
|
|
15
|
+
:disabled="isDisabled"
|
|
16
|
+
@change="onChange"
|
|
17
|
+
>
|
|
18
|
+
<span
|
|
19
|
+
class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-size)] rounded-full border-[length:var(--ads-radio-border-width)] bg-[var(--ads-radio-background)] peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[var(--ads-text-brand)]"
|
|
20
|
+
:class="isDisabled
|
|
21
|
+
? 'border-[var(--ads-radio-disabled)] peer-checked:border-[var(--ads-radio-disabled)] peer-checked:bg-[var(--ads-radio-disabled)]'
|
|
22
|
+
: 'border-[var(--ads-radio-border)] peer-checked:border-[var(--ads-radio-border)] peer-checked:bg-[var(--ads-radio-border)]'"
|
|
23
|
+
/>
|
|
24
|
+
<span class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-dot)] rounded-full bg-[var(--ads-radio-dot-color)] opacity-0 peer-checked:opacity-100" />
|
|
25
|
+
</span>
|
|
26
|
+
<span
|
|
27
|
+
v-if="hasLabel"
|
|
28
|
+
class="text-[length:var(--ads-radio-label-size)] font-normal leading-[1.3]"
|
|
29
|
+
:class="isDisabled ? 'text-[var(--ads-text-tertiary)]' : 'text-[var(--ads-radio-label)]'"
|
|
30
|
+
>
|
|
31
|
+
<slot>{{ label }}</slot>
|
|
32
|
+
</span>
|
|
33
|
+
</label>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { computed, useAttrs, useId, useSlots } from "vue";
|
|
38
|
+
|
|
39
|
+
defineOptions({ inheritAttrs: false });
|
|
40
|
+
|
|
41
|
+
const props = withDefaults(
|
|
42
|
+
defineProps<{
|
|
43
|
+
label?: string;
|
|
44
|
+
value?: string | number | boolean;
|
|
45
|
+
name?: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}>(),
|
|
48
|
+
{
|
|
49
|
+
label: "",
|
|
50
|
+
value: "on",
|
|
51
|
+
name: "",
|
|
52
|
+
disabled: false,
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const model = defineModel<string | number | boolean>({ default: "" });
|
|
57
|
+
const attrs = useAttrs();
|
|
58
|
+
const slots = useSlots();
|
|
59
|
+
const autoName = useId();
|
|
60
|
+
|
|
61
|
+
const hasLabel = computed(() => props.label.length > 0 || Boolean(slots.default));
|
|
62
|
+
const isDisabled = computed(() => props.disabled);
|
|
63
|
+
const fieldName = computed(() => props.name || autoName);
|
|
64
|
+
const checked = computed(() => model.value === props.value);
|
|
65
|
+
|
|
66
|
+
const onChange = () => {
|
|
67
|
+
if (isDisabled.value) return;
|
|
68
|
+
model.value = props.value;
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
@@ -1,113 +1,122 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex w-full min-w-0 flex-col gap-0.5">
|
|
3
|
-
<div
|
|
4
|
-
class="flex items-center gap-2 rounded-[var(--ads-search-radius)] transition-colors px-[var(--ads-search-padding-x)]"
|
|
5
|
-
:class="[fieldClass, size === 'sm' ? 'h-[var(--ads-search-sm-height)]' : 'h-[var(--ads-search-md-height)]']"
|
|
6
|
-
:data-state="visualState"
|
|
7
|
-
>
|
|
8
|
-
<UIcon :name="icon" :class="iconClass" />
|
|
9
|
-
<input
|
|
10
|
-
v-model="model"
|
|
11
|
-
type="search"
|
|
12
|
-
autocomplete="off"
|
|
13
|
-
class="min-w-0 flex-1 bg-transparent leading-[1.3] outline-none placeholder:text-current disabled:cursor-not-allowed [&::-webkit-search-cancel-button]:hidden"
|
|
14
|
-
:class="size === 'sm' ? 'text-[length:var(--ads-search-sm-font-size)]' : 'text-[length:var(--ads-search-md-font-size)]'"
|
|
15
|
-
:placeholder="placeholder"
|
|
16
|
-
:disabled="isDisabled"
|
|
17
|
-
:aria-label="ariaLabel || placeholder"
|
|
18
|
-
:aria-describedby="hint ? hintId : undefined"
|
|
19
|
-
>
|
|
20
|
-
<button
|
|
21
|
-
v-if="showClear"
|
|
22
|
-
type="button"
|
|
23
|
-
class="inline-flex shrink-0"
|
|
24
|
-
aria-label="Limpar busca"
|
|
25
|
-
@click="model = ''"
|
|
26
|
-
>
|
|
27
|
-
<UIcon name="i-lucide-x" :class="iconClass" />
|
|
28
|
-
</button>
|
|
29
|
-
</div>
|
|
30
|
-
<p
|
|
31
|
-
v-if="hint"
|
|
32
|
-
:id="hintId"
|
|
33
|
-
:class="hintClass"
|
|
34
|
-
>
|
|
35
|
-
{{ hint }}
|
|
36
|
-
</p>
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<script setup lang="ts">
|
|
41
|
-
import { computed, useId } from "vue";
|
|
42
|
-
|
|
43
|
-
export type AdsSearchInputState = "default" | "active" | "focus" | "disabled";
|
|
44
|
-
export type AdsSearchInputSize = "md" | "sm";
|
|
45
|
-
|
|
46
|
-
const props = withDefaults(
|
|
47
|
-
defineProps<{
|
|
48
|
-
placeholder?: string;
|
|
49
|
-
ariaLabel?: string;
|
|
50
|
-
hint?: string;
|
|
51
|
-
disabled?: boolean;
|
|
52
|
-
icon?: string;
|
|
53
|
-
size?: AdsSearchInputSize;
|
|
54
|
-
/** Estado congelado para a documentação. `null` segue o campo. */
|
|
55
|
-
state?: AdsSearchInputState | null;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
? "
|
|
91
|
-
: "
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex w-full min-w-0 flex-col gap-0.5">
|
|
3
|
+
<div
|
|
4
|
+
class="flex items-center gap-2 rounded-[var(--ads-search-radius)] transition-colors px-[var(--ads-search-padding-x)]"
|
|
5
|
+
:class="[fieldClass, size === 'sm' ? 'h-[var(--ads-search-sm-height)]' : 'h-[var(--ads-search-md-height)]']"
|
|
6
|
+
:data-state="visualState"
|
|
7
|
+
>
|
|
8
|
+
<UIcon :name="icon" :class="iconClass" />
|
|
9
|
+
<input
|
|
10
|
+
v-model="model"
|
|
11
|
+
type="search"
|
|
12
|
+
autocomplete="off"
|
|
13
|
+
class="min-w-0 flex-1 bg-transparent leading-[1.3] outline-none placeholder:text-current disabled:cursor-not-allowed [&::-webkit-search-cancel-button]:hidden"
|
|
14
|
+
:class="size === 'sm' ? 'text-[length:var(--ads-search-sm-font-size)]' : 'text-[length:var(--ads-search-md-font-size)]'"
|
|
15
|
+
:placeholder="placeholder"
|
|
16
|
+
:disabled="isDisabled"
|
|
17
|
+
:aria-label="ariaLabel || placeholder"
|
|
18
|
+
:aria-describedby="hint ? hintId : undefined"
|
|
19
|
+
>
|
|
20
|
+
<button
|
|
21
|
+
v-if="showClear"
|
|
22
|
+
type="button"
|
|
23
|
+
class="inline-flex shrink-0"
|
|
24
|
+
aria-label="Limpar busca"
|
|
25
|
+
@click="model = ''"
|
|
26
|
+
>
|
|
27
|
+
<UIcon name="i-lucide-x" :class="iconClass" />
|
|
28
|
+
</button>
|
|
29
|
+
</div>
|
|
30
|
+
<p
|
|
31
|
+
v-if="hint"
|
|
32
|
+
:id="hintId"
|
|
33
|
+
:class="hintClass"
|
|
34
|
+
>
|
|
35
|
+
{{ hint }}
|
|
36
|
+
</p>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import { computed, useId } from "vue";
|
|
42
|
+
|
|
43
|
+
export type AdsSearchInputState = "default" | "active" | "focus" | "disabled" | "ai";
|
|
44
|
+
export type AdsSearchInputSize = "md" | "sm";
|
|
45
|
+
|
|
46
|
+
const props = withDefaults(
|
|
47
|
+
defineProps<{
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
ariaLabel?: string;
|
|
50
|
+
hint?: string;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
icon?: string;
|
|
53
|
+
size?: AdsSearchInputSize;
|
|
54
|
+
/** Estado congelado para a documentação. `null` segue o campo. */
|
|
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;
|
|
58
|
+
}>(),
|
|
59
|
+
{
|
|
60
|
+
placeholder: "Pesquisar",
|
|
61
|
+
ariaLabel: "",
|
|
62
|
+
hint: "",
|
|
63
|
+
disabled: false,
|
|
64
|
+
icon: "i-lucide-search",
|
|
65
|
+
size: "md",
|
|
66
|
+
state: null,
|
|
67
|
+
aiSuggestion: false,
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const model = defineModel<string>({ default: "" });
|
|
72
|
+
|
|
73
|
+
const hintId = useId();
|
|
74
|
+
|
|
75
|
+
const isDisabled = computed(() => props.disabled || props.state === "disabled");
|
|
76
|
+
|
|
77
|
+
const visualState = computed<AdsSearchInputState>(() => {
|
|
78
|
+
if (isDisabled.value) return "disabled";
|
|
79
|
+
if (props.state) return props.state;
|
|
80
|
+
if (props.aiSuggestion) return "ai";
|
|
81
|
+
return model.value ? "active" : "default";
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const showClear = computed(
|
|
85
|
+
() => visualState.value === "active" || visualState.value === "focus" || visualState.value === "ai",
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const iconClass = computed(() =>
|
|
89
|
+
props.size === "sm"
|
|
90
|
+
? "size-4 shrink-0 text-base"
|
|
91
|
+
: "size-[18px] shrink-0 text-[18px]",
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const hintClass = computed(() => {
|
|
95
|
+
const tone = visualState.value === "disabled"
|
|
96
|
+
? "text-[var(--ads-text-tertiary)]"
|
|
97
|
+
: "text-[var(--ads-text-secondary)]";
|
|
98
|
+
const type = props.size === "sm" ? "text-[10px] leading-[1.1]" : "text-xs leading-[1.2]";
|
|
99
|
+
return `${type} ${tone}`;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const fieldClass = computed(() => {
|
|
103
|
+
const tone = visualState.value === "default" || visualState.value === "disabled"
|
|
104
|
+
? "text-[var(--ads-search-placeholder)]"
|
|
105
|
+
: "text-[var(--ads-search-text)]";
|
|
106
|
+
const interactiveFocus = props.state === null && !isDisabled.value;
|
|
107
|
+
const focus = interactiveFocus
|
|
108
|
+
? "hover:not-focus-within:border-[var(--ads-search-hover-border)] focus-within:border-(length:--ads-border-width-slim) focus-within:border-[var(--ads-search-focus-border)]"
|
|
109
|
+
: "";
|
|
110
|
+
|
|
111
|
+
if (visualState.value === "disabled") {
|
|
112
|
+
return `border border-[var(--ads-search-disabled-border)] bg-[var(--ads-search-disabled-background)] ${tone}`;
|
|
113
|
+
}
|
|
114
|
+
if (visualState.value === "focus") {
|
|
115
|
+
return `border-(length:--ads-border-width-slim) border-[var(--ads-search-focus-border)] bg-[var(--ads-search-background)] ${tone}`;
|
|
116
|
+
}
|
|
117
|
+
if (visualState.value === "ai") {
|
|
118
|
+
return `border border-[var(--ads-button-ia-border)] bg-[var(--ads-surface-ai)] text-[var(--ads-text-ai)] ${focus}`;
|
|
119
|
+
}
|
|
120
|
+
return `border border-[var(--ads-search-border)] bg-[var(--ads-search-background)] ${tone} ${focus}`;
|
|
121
|
+
});
|
|
122
|
+
</script>
|
|
@@ -1,28 +1,62 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<UTabs
|
|
3
|
-
v-model="model"
|
|
4
|
-
:items="items"
|
|
5
|
-
:content="false"
|
|
6
|
-
variant="pill"
|
|
7
|
-
color="neutral"
|
|
8
|
-
:ui="adsSegmentedTabsUi"
|
|
9
|
-
:aria-label="ariaLabel"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<UTabs
|
|
3
|
+
v-model="model"
|
|
4
|
+
:items="items as TabsItem[]"
|
|
5
|
+
:content="false"
|
|
6
|
+
variant="pill"
|
|
7
|
+
color="neutral"
|
|
8
|
+
:ui="adsSegmentedTabsUi"
|
|
9
|
+
:aria-label="ariaLabel"
|
|
10
|
+
>
|
|
11
|
+
<!-- Rótulo e, abaixo, o subtítulo opcional. O ícone de 24px vem do próprio UTabs, à esquerda. -->
|
|
12
|
+
<template #default="{ item }">
|
|
13
|
+
<span>{{ item.label }}</span>
|
|
14
|
+
<span
|
|
15
|
+
v-if="(item as AdsSegmentedTabsItem).subtitle"
|
|
16
|
+
class="font-normal text-[var(--ads-text-secondary)]"
|
|
17
|
+
>
|
|
18
|
+
{{ (item as AdsSegmentedTabsItem).subtitle }}
|
|
19
|
+
</span>
|
|
20
|
+
</template>
|
|
21
|
+
</UTabs>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts" generic="T extends string | number">
|
|
25
|
+
import type { TabsItem } from "@nuxt/ui";
|
|
26
|
+
import { watch } from "vue";
|
|
27
|
+
import { adsSegmentedTabsUi } from "../theme/ads-theme";
|
|
28
|
+
|
|
29
|
+
/** Estende TabsItem com `subtitle` opcional. O `icon` (24px, à esquerda) já vem do Nuxt UI. */
|
|
30
|
+
export interface AdsSegmentedTabsItem extends Omit<TabsItem, "slot"> {
|
|
31
|
+
/** Linha secundária abaixo do rótulo, em 12px regular. */
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const MAX_TABS = 8;
|
|
36
|
+
|
|
37
|
+
const props = withDefaults(
|
|
38
|
+
defineProps<{
|
|
39
|
+
items: AdsSegmentedTabsItem[];
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
}>(),
|
|
42
|
+
{
|
|
43
|
+
ariaLabel: undefined,
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (import.meta.dev) {
|
|
48
|
+
watch(
|
|
49
|
+
() => props.items.length,
|
|
50
|
+
(len) => {
|
|
51
|
+
if (len > MAX_TABS) {
|
|
52
|
+
console.warn(
|
|
53
|
+
`[AdsSegmentedTabs] Limite de ${MAX_TABS} abas excedido (${len}). Acima desse limite o filtro pode ficar ilegível em telas menores.`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{ immediate: true },
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const model = defineModel<T>({ required: true });
|
|
62
|
+
</script>
|