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,174 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="overflow-hidden rounded-[var(--ads-radius-sm)] border border-ads-neutro-claro-50 bg-[var(--ads-surface-card)] shadow-[var(--ads-shadow-level-1)]"
|
|
4
|
-
:class="widthClass"
|
|
5
|
-
>
|
|
6
|
-
<div v-if="searchable" class="px-4 pt-4 pb-2">
|
|
7
|
-
<UInput
|
|
8
|
-
v-model="query"
|
|
9
|
-
:placeholder="searchPlaceholder"
|
|
10
|
-
aria-label="Pesquisar opções"
|
|
11
|
-
icon="i-lucide-search"
|
|
12
|
-
color="neutral"
|
|
13
|
-
variant="outline"
|
|
14
|
-
size="md"
|
|
15
|
-
class="w-full"
|
|
16
|
-
:ui="searchFieldUi"
|
|
17
|
-
>
|
|
18
|
-
<template v-if="query" #trailing>
|
|
19
|
-
<button
|
|
20
|
-
type="button"
|
|
21
|
-
class="text-[var(--ads-text-secondary)]"
|
|
22
|
-
aria-label="Limpar busca"
|
|
23
|
-
@click="query = ''"
|
|
24
|
-
>
|
|
25
|
-
<UIcon name="i-lucide-x" class="size-4" />
|
|
26
|
-
</button>
|
|
27
|
-
</template>
|
|
28
|
-
</UInput>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<p
|
|
32
|
-
v-if="groups.empty"
|
|
33
|
-
class="flex h-16 items-center ps-6 text-sm leading-[1.3] text-[var(--ads-text-secondary)]"
|
|
34
|
-
>
|
|
35
|
-
{{ emptyLabel }}
|
|
36
|
-
</p>
|
|
37
|
-
|
|
38
|
-
<template v-else>
|
|
39
|
-
<div v-if="groups.exact.length">
|
|
40
|
-
<template v-for="(option, index) in groups.exact" :key="option.value">
|
|
41
|
-
<AdsFilterOption
|
|
42
|
-
:mode="type"
|
|
43
|
-
:label="option.label"
|
|
44
|
-
:selected="isSelected(option.value)"
|
|
45
|
-
@select="onSelect(option.value)"
|
|
46
|
-
/>
|
|
47
|
-
<div
|
|
48
|
-
v-if="index < groups.exact.length - 1"
|
|
49
|
-
class="h-px bg-[var(--ads-button-secondary-disabled)]"
|
|
50
|
-
:class="dividerInsetClass"
|
|
51
|
-
role="presentation"
|
|
52
|
-
/>
|
|
53
|
-
</template>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div
|
|
57
|
-
v-if="showSelectAll || groups.matches.length"
|
|
58
|
-
class="overflow-y-auto overscroll-contain [scrollbar-color:var(--color-ads-neutro-claro-50)_transparent] [scrollbar-width:thin]"
|
|
59
|
-
:class="
|
|
60
|
-
groups.exact.length
|
|
61
|
-
? 'max-h-[244px] border-t-[0.5px] border-[var(--ads-border-icon)]'
|
|
62
|
-
: 'max-h-[294px]'
|
|
63
|
-
"
|
|
64
|
-
>
|
|
65
|
-
<div :role="type === 'radio' ? 'listbox' : 'group'" :aria-label="listLabel">
|
|
66
|
-
<template v-if="showSelectAll">
|
|
67
|
-
<AdsFilterOption
|
|
68
|
-
mode="checkbox"
|
|
69
|
-
:label="selectAllLabel"
|
|
70
|
-
:selected="checkState === 'all'"
|
|
71
|
-
:indeterminate="checkState === 'partial'"
|
|
72
|
-
@select="onSelectAll"
|
|
73
|
-
/>
|
|
74
|
-
<div
|
|
75
|
-
v-if="groups.matches.length"
|
|
76
|
-
class="h-px bg-[var(--ads-button-secondary-disabled)]"
|
|
77
|
-
:class="dividerInsetClass"
|
|
78
|
-
role="presentation"
|
|
79
|
-
/>
|
|
80
|
-
</template>
|
|
81
|
-
<template v-for="(option, index) in groups.matches" :key="option.value">
|
|
82
|
-
<AdsFilterOption
|
|
83
|
-
:mode="type"
|
|
84
|
-
:label="option.label"
|
|
85
|
-
:selected="isSelected(option.value)"
|
|
86
|
-
@select="onSelect(option.value)"
|
|
87
|
-
/>
|
|
88
|
-
<div
|
|
89
|
-
v-if="index < groups.matches.length - 1"
|
|
90
|
-
class="h-px bg-[var(--ads-button-secondary-disabled)]"
|
|
91
|
-
:class="dividerInsetClass"
|
|
92
|
-
role="presentation"
|
|
93
|
-
/>
|
|
94
|
-
</template>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</template>
|
|
98
|
-
</div>
|
|
99
|
-
</template>
|
|
100
|
-
|
|
101
|
-
<script setup lang="ts">
|
|
102
|
-
import { computed } from "vue";
|
|
103
|
-
import AdsFilterOption from "./AdsFilterOption.vue";
|
|
104
|
-
import {
|
|
105
|
-
groupFilterOptions,
|
|
106
|
-
selectionCheckState,
|
|
107
|
-
toggleFilterValue,
|
|
108
|
-
toggleSelectAll,
|
|
109
|
-
type AdsFilterOption as FilterOption,
|
|
110
|
-
} from "../utils/ads-filter-select";
|
|
111
|
-
|
|
112
|
-
const props = withDefaults(
|
|
113
|
-
defineProps<{
|
|
114
|
-
type: "checkbox" | "radio";
|
|
115
|
-
options: FilterOption[];
|
|
116
|
-
searchable?: boolean;
|
|
117
|
-
selectAll?: boolean;
|
|
118
|
-
selectAllLabel?: string;
|
|
119
|
-
emptyLabel?: string;
|
|
120
|
-
searchPlaceholder?: string;
|
|
121
|
-
listLabel?: string;
|
|
122
|
-
widthClass?: string;
|
|
123
|
-
}>(),
|
|
124
|
-
{
|
|
125
|
-
searchable: true,
|
|
126
|
-
selectAll: true,
|
|
127
|
-
selectAllLabel: "Selecionar todos",
|
|
128
|
-
emptyLabel: "Nenhum resultado",
|
|
129
|
-
searchPlaceholder: "Pesquisar",
|
|
130
|
-
listLabel: "Opções",
|
|
131
|
-
widthClass: "w-[270px]",
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const model = defineModel<string | string[]>({ required: true });
|
|
136
|
-
const query = defineModel<string>("query", { default: "" });
|
|
137
|
-
const emit = defineEmits<{ pick: [] }>();
|
|
138
|
-
|
|
139
|
-
const groups = computed(() => groupFilterOptions(props.options, query.value));
|
|
140
|
-
const selectedList = computed(() =>
|
|
141
|
-
Array.isArray(model.value) ? model.value : model.value ? [model.value] : [],
|
|
142
|
-
);
|
|
143
|
-
const checkState = computed(() =>
|
|
144
|
-
selectionCheckState(selectedList.value, props.options),
|
|
145
|
-
);
|
|
146
|
-
const showSelectAll = computed(
|
|
147
|
-
() => props.type === "checkbox" && props.selectAll && query.value.trim() === "",
|
|
148
|
-
);
|
|
149
|
-
/** O separador começa no mesmo eixo do conteúdo da opção: texto (rádio) ou caixa (checkbox). */
|
|
150
|
-
const dividerInsetClass = computed(() => (props.type === "checkbox" ? "mx-4" : "mx-6"));
|
|
151
|
-
|
|
152
|
-
const isSelected = (value: string) => selectedList.value.includes(value);
|
|
153
|
-
|
|
154
|
-
const onSelect = (value: string) => {
|
|
155
|
-
if (props.type === "radio") {
|
|
156
|
-
model.value = value;
|
|
157
|
-
emit("pick");
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
model.value = toggleFilterValue(selectedList.value, value);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const onSelectAll = () => {
|
|
164
|
-
model.value = toggleSelectAll(selectedList.value, props.options);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Busca do painel ADS: pílula.
|
|
169
|
-
*/
|
|
170
|
-
const searchFieldUi = {
|
|
171
|
-
base: "h-10 rounded-[var(--ads-radius-pill)] bg-[var(--ads-surface-card)] text-sm text-[var(--ads-text-secondary)] !outline-none ring-1 ring-inset ring-ads-neutro-claro-50 enabled:hover:ring-[var(--ads-filter-hover-border)] placeholder:text-[var(--ads-text-tertiary)] focus-visible:!outline-none focus-visible:ring-(length:--ads-border-width-slim) focus-visible:ring-[var(--ads-text-brand)]",
|
|
172
|
-
leadingIcon: "text-[var(--ads-text-tertiary)]",
|
|
173
|
-
};
|
|
174
|
-
</script>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button
|
|
3
|
-
type="button"
|
|
4
|
-
class="flex h-[50px] w-full items-center gap-2 py-4 text-left hover:bg-neutral-100"
|
|
5
|
-
:class="mode === 'checkbox' ? 'ps-4' : 'ps-6'"
|
|
6
|
-
:role="mode === 'checkbox' ? 'checkbox' : 'option'"
|
|
7
|
-
:aria-checked="checkedState"
|
|
8
|
-
:aria-selected="mode === 'radio' ? selected : undefined"
|
|
9
|
-
@click="emit('select')"
|
|
10
|
-
>
|
|
11
|
-
<span
|
|
12
|
-
v-if="mode === 'checkbox'"
|
|
13
|
-
class="flex size-4 shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] border-2 border-[var(--ads-text-brand)]"
|
|
14
|
-
:class="selected || indeterminate ? 'bg-[var(--ads-surface-brand)]' : 'bg-[var(--ads-surface-card)]'"
|
|
15
|
-
>
|
|
16
|
-
<UIcon
|
|
17
|
-
v-if="indeterminate"
|
|
18
|
-
name="i-lucide-minus"
|
|
19
|
-
class="size-3 text-[var(--ads-text-contrast)]"
|
|
20
|
-
/>
|
|
21
|
-
<UIcon
|
|
22
|
-
v-else-if="selected"
|
|
23
|
-
name="i-lucide-check"
|
|
24
|
-
class="size-3 text-[var(--ads-text-contrast)]"
|
|
25
|
-
/>
|
|
26
|
-
</span>
|
|
27
|
-
<AdsTooltip
|
|
28
|
-
:description="label"
|
|
29
|
-
:show-title="false"
|
|
30
|
-
:disabled="!needsTooltip"
|
|
31
|
-
wing="down"
|
|
32
|
-
align="start"
|
|
33
|
-
>
|
|
34
|
-
<span
|
|
35
|
-
class="block min-w-0 truncate text-sm leading-[1.3] text-[var(--ads-text-secondary)]"
|
|
36
|
-
:class="mode === 'radio' && selected ? 'font-bold' : 'font-normal'"
|
|
37
|
-
>
|
|
38
|
-
{{ displayLabel }}
|
|
39
|
-
</span>
|
|
40
|
-
</AdsTooltip>
|
|
41
|
-
</button>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script setup lang="ts">
|
|
45
|
-
import { computed } from "vue";
|
|
46
|
-
import AdsTooltip from "./AdsTooltip.vue";
|
|
47
|
-
import {
|
|
48
|
-
filterLabelNeedsTooltip,
|
|
49
|
-
truncateFilterLabel,
|
|
50
|
-
} from "../utils/ads-filter-select";
|
|
51
|
-
|
|
52
|
-
const props = withDefaults(
|
|
53
|
-
defineProps<{
|
|
54
|
-
label: string;
|
|
55
|
-
mode: "checkbox" | "radio";
|
|
56
|
-
selected?: boolean;
|
|
57
|
-
indeterminate?: boolean;
|
|
58
|
-
}>(),
|
|
59
|
-
{
|
|
60
|
-
selected: false,
|
|
61
|
-
indeterminate: false,
|
|
62
|
-
},
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const emit = defineEmits<{ select: [] }>();
|
|
66
|
-
|
|
67
|
-
const displayLabel = computed(() => truncateFilterLabel(props.label));
|
|
68
|
-
const needsTooltip = computed(() => filterLabelNeedsTooltip(props.label));
|
|
69
|
-
const checkedState = computed(() => {
|
|
70
|
-
if (props.mode !== "checkbox") return undefined;
|
|
71
|
-
if (props.indeterminate) return "mixed";
|
|
72
|
-
return props.selected;
|
|
73
|
-
});
|
|
74
|
-
</script>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<AdsFilterDropdown
|
|
3
|
-
v-model="model"
|
|
4
|
-
v-model:query="query"
|
|
5
|
-
type="radio"
|
|
6
|
-
:options="options"
|
|
7
|
-
:searchable="search"
|
|
8
|
-
:select-all="false"
|
|
9
|
-
:empty-label="emptyLabel"
|
|
10
|
-
:search-placeholder="searchPlaceholder"
|
|
11
|
-
:list-label="listLabel"
|
|
12
|
-
width-class="min-w-[var(--ads-list-min-width)] w-full"
|
|
13
|
-
@pick="emit('pick', model)"
|
|
14
|
-
/>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
import { ref } from "vue";
|
|
19
|
-
import AdsFilterDropdown from "./AdsFilterDropdown.vue";
|
|
20
|
-
import type { AdsFilterOption } from "../utils/ads-filter-select";
|
|
21
|
-
|
|
22
|
-
withDefaults(
|
|
23
|
-
defineProps<{
|
|
24
|
-
options: AdsFilterOption[];
|
|
25
|
-
/** Figma `Search`. */
|
|
26
|
-
search?: boolean;
|
|
27
|
-
emptyLabel?: string;
|
|
28
|
-
searchPlaceholder?: string;
|
|
29
|
-
listLabel?: string;
|
|
30
|
-
}>(),
|
|
31
|
-
{
|
|
32
|
-
search: true,
|
|
33
|
-
emptyLabel: "Nenhum resultado",
|
|
34
|
-
searchPlaceholder: "Pesquisar",
|
|
35
|
-
listLabel: "Opções",
|
|
36
|
-
},
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const model = defineModel<string>({ default: "" });
|
|
40
|
-
const query = ref("");
|
|
41
|
-
const emit = defineEmits<{
|
|
42
|
-
pick: [value: string];
|
|
43
|
-
}>();
|
|
44
|
-
</script>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span
|
|
3
|
-
class="inline-flex h-[var(--ads-mini-height)] shrink-0 items-center justify-center rounded-full px-[var(--ads-mini-padding-x)] py-1 text-[length:var(--ads-mini-font-size)] [font-weight:var(--ads-mini-weight)] leading-[1.1] whitespace-nowrap"
|
|
4
|
-
:class="surfaceClass"
|
|
5
|
-
>
|
|
6
|
-
{{ resolvedLabel }}
|
|
7
|
-
</span>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { computed } from "vue";
|
|
12
|
-
|
|
13
|
-
type AdsMiniPillType = "nao-iniciado" | "pausado" | "novo";
|
|
14
|
-
|
|
15
|
-
const props = withDefaults(
|
|
16
|
-
defineProps<{
|
|
17
|
-
type?: AdsMiniPillType;
|
|
18
|
-
label?: string;
|
|
19
|
-
}>(),
|
|
20
|
-
{
|
|
21
|
-
type: "nao-iniciado",
|
|
22
|
-
label: undefined,
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const surfaces: Record<AdsMiniPillType, string> = {
|
|
27
|
-
"nao-iniciado": "bg-[var(--ads-mini-idle-bg)] text-[var(--ads-mini-idle-text)]",
|
|
28
|
-
pausado: "bg-[var(--ads-mini-paused-bg)] text-[var(--ads-mini-paused-text)]",
|
|
29
|
-
novo: "bg-[var(--ads-mini-new-bg)] text-[var(--ads-mini-new-text)]",
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const labels: Record<AdsMiniPillType, string> = {
|
|
33
|
-
"nao-iniciado": "Não iniciado",
|
|
34
|
-
pausado: "Pausado",
|
|
35
|
-
novo: "Novo",
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const surfaceClass = computed(() => surfaces[props.type]);
|
|
39
|
-
const resolvedLabel = computed(() => props.label ?? labels[props.type]);
|
|
40
|
-
</script>
|