ads-nuxt 0.4.1 → 0.5.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.
Files changed (76) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -574
  3. package/app/app.config.ts +25 -25
  4. package/app/assets/ads/checkbox-check.svg +5 -5
  5. package/app/assets/ads/checkbox-minus.svg +5 -5
  6. package/app/assets/brand/farmarcas.svg +6 -6
  7. package/app/assets/brand/radar-symbol.svg +9 -9
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -257
  10. package/app/assets/css/main.css +585 -585
  11. package/app/components/AdsBadge.vue +47 -47
  12. package/app/components/AdsBroadcast.vue +24 -24
  13. package/app/components/AdsButton.vue +334 -547
  14. package/app/components/AdsButtonGroup.vue +39 -39
  15. package/app/components/AdsButtonMenu.vue +48 -48
  16. package/app/components/AdsCard.vue +188 -188
  17. package/app/components/AdsCardHint.vue +56 -56
  18. package/app/components/AdsCardPeriod.vue +43 -43
  19. package/app/components/AdsCardVariation.vue +31 -31
  20. package/app/components/AdsCharttip.vue +79 -79
  21. package/app/components/AdsDatePicker.vue +509 -509
  22. package/app/components/AdsDropdownMenu.vue +30 -30
  23. package/app/components/AdsEmptyState.vue +61 -61
  24. package/app/components/AdsFeatureCard.vue +292 -292
  25. package/app/components/AdsFileCard.vue +98 -98
  26. package/app/components/AdsFooter.vue +25 -25
  27. package/app/components/AdsHeavyAccountCell.vue +59 -59
  28. package/app/components/AdsHeavyHeaderCell.vue +70 -70
  29. package/app/components/AdsHeavyTable.vue +135 -135
  30. package/app/components/AdsInput.vue +148 -148
  31. package/app/components/AdsLoading.vue +217 -217
  32. package/app/components/AdsMenuBar.vue +110 -110
  33. package/app/components/AdsMetricCard.vue +226 -226
  34. package/app/components/AdsModal.vue +160 -160
  35. package/app/components/AdsMonthPicker.vue +80 -80
  36. package/app/components/AdsNavbarApp.vue +67 -67
  37. package/app/components/AdsNavbarDesk.vue +67 -67
  38. package/app/components/AdsNotabilityPill.vue +24 -24
  39. package/app/components/AdsNumberInput.vue +173 -173
  40. package/app/components/AdsPanelCard.vue +99 -99
  41. package/app/components/AdsPill.vue +144 -144
  42. package/app/components/AdsProductTag.vue +80 -80
  43. package/app/components/AdsSearchInput.vue +122 -122
  44. package/app/components/AdsSegmentedTabs.vue +62 -62
  45. package/app/components/AdsSelect.vue +283 -283
  46. package/app/components/AdsSelectItem.vue +128 -128
  47. package/app/components/AdsSelectPanel.vue +221 -221
  48. package/app/components/AdsSideMenu.vue +101 -101
  49. package/app/components/AdsSmalltip.vue +44 -44
  50. package/app/components/AdsStepper.vue +222 -222
  51. package/app/components/AdsTable.vue +172 -172
  52. package/app/components/AdsTableHeaderCell.vue +80 -80
  53. package/app/components/AdsTableSkeleton.vue +113 -113
  54. package/app/components/AdsTableToolbar.vue +44 -44
  55. package/app/components/AdsTabs.vue +51 -51
  56. package/app/components/AdsTextarea.vue +116 -116
  57. package/app/components/AdsToast.vue +184 -184
  58. package/app/components/AdsTooltip.vue +73 -73
  59. package/app/components/ProgressBarLoading.vue +235 -235
  60. package/app/composables/useOverlayLoading.ts +88 -88
  61. package/app/constants/ads-color-swatches.ts +240 -240
  62. package/app/locale/pt-br.ts +6 -6
  63. package/app/plugins/ads-toast.client.ts +24 -24
  64. package/app/theme/ads-theme.ts +374 -374
  65. package/app/theme/ads-tokens.ts +391 -391
  66. package/app/types/overlay-loading.types.ts +32 -32
  67. package/app/utils/ads-filter-select.ts +191 -191
  68. package/app/utils/ads-table.ts +416 -416
  69. package/app/utils/calendar-date.ts +163 -163
  70. package/app/utils/category-role.ts +45 -45
  71. package/app/utils/money.ts +77 -77
  72. package/app/utils/notability.ts +8 -8
  73. package/app/utils/parser.ts +134 -134
  74. package/app/utils/percentage.ts +54 -54
  75. package/nuxt.config.ts +31 -31
  76. package/package.json +57 -57
@@ -1,56 +1,56 @@
1
- <template>
2
- <span class="inline-flex shrink-0" :class="align === 'end' ? 'order-last ml-auto' : undefined">
3
- <AdsTooltip :description="text" :show-title="false" class="inline-flex">
4
- <!-- span focável, e não button: o card inteiro pode ser um botão -->
5
- <span
6
- tabindex="0"
7
- role="img"
8
- class="inline-flex size-4 items-center justify-center rounded-[var(--ads-radius-circular)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
9
- :class="colorClass"
10
- :aria-label="text"
11
- >
12
- <UIcon :name="icon" class="size-4" aria-hidden="true" />
13
- </span>
14
- </AdsTooltip>
15
- </span>
16
- </template>
17
-
18
- <script setup lang="ts">
19
- import { computed } from "vue";
20
- import AdsTooltip from "./AdsTooltip.vue";
21
-
22
- /** Cor do ícone do balão. `secondary` é o cinza do Figma. */
23
- export type AdsCardHintColor = "secondary" | "primary" | "brand" | "success" | "attention" | "warning" | "new" | "ai";
24
-
25
- /** `start` fica junto do título. `end` encosta no fim da linha, à direita. */
26
- export type AdsCardHintAlign = "start" | "end";
27
-
28
- const props = withDefaults(
29
- defineProps<{
30
- /** Texto do balão. Também nomeia o ícone para leitor de tela. */
31
- text: string;
32
- /** Ícone Lucide. Padrão: informação. */
33
- icon?: string;
34
- color?: AdsCardHintColor;
35
- align?: AdsCardHintAlign;
36
- }>(),
37
- {
38
- icon: "i-lucide-info",
39
- color: "secondary",
40
- align: "start",
41
- },
42
- );
43
-
44
- const colorClasses: Record<AdsCardHintColor, string> = {
45
- secondary: "text-[var(--ads-text-secondary)]",
46
- primary: "text-[var(--ads-text-primary)]",
47
- brand: "text-[var(--ads-text-brand)]",
48
- success: "text-[var(--ads-status-success-800)]",
49
- attention: "text-[var(--ads-status-attention-800)]",
50
- warning: "text-[var(--ads-status-warning-800)]",
51
- new: "text-[var(--ads-status-new-800)]",
52
- ai: "text-[var(--ads-text-ai)]",
53
- };
54
-
55
- const colorClass = computed(() => colorClasses[props.color]);
56
- </script>
1
+ <template>
2
+ <span class="inline-flex shrink-0" :class="align === 'end' ? 'order-last ml-auto' : undefined">
3
+ <AdsTooltip :description="text" :show-title="false" class="inline-flex">
4
+ <!-- span focável, e não button: o card inteiro pode ser um botão -->
5
+ <span
6
+ tabindex="0"
7
+ role="img"
8
+ class="inline-flex size-4 items-center justify-center rounded-[var(--ads-radius-circular)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
9
+ :class="colorClass"
10
+ :aria-label="text"
11
+ >
12
+ <UIcon :name="icon" class="size-4" aria-hidden="true" />
13
+ </span>
14
+ </AdsTooltip>
15
+ </span>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { computed } from "vue";
20
+ import AdsTooltip from "./AdsTooltip.vue";
21
+
22
+ /** Cor do ícone do balão. `secondary` é o cinza do Figma. */
23
+ export type AdsCardHintColor = "secondary" | "primary" | "brand" | "success" | "attention" | "warning" | "new" | "ai";
24
+
25
+ /** `start` fica junto do título. `end` encosta no fim da linha, à direita. */
26
+ export type AdsCardHintAlign = "start" | "end";
27
+
28
+ const props = withDefaults(
29
+ defineProps<{
30
+ /** Texto do balão. Também nomeia o ícone para leitor de tela. */
31
+ text: string;
32
+ /** Ícone Lucide. Padrão: informação. */
33
+ icon?: string;
34
+ color?: AdsCardHintColor;
35
+ align?: AdsCardHintAlign;
36
+ }>(),
37
+ {
38
+ icon: "i-lucide-info",
39
+ color: "secondary",
40
+ align: "start",
41
+ },
42
+ );
43
+
44
+ const colorClasses: Record<AdsCardHintColor, string> = {
45
+ secondary: "text-[var(--ads-text-secondary)]",
46
+ primary: "text-[var(--ads-text-primary)]",
47
+ brand: "text-[var(--ads-text-brand)]",
48
+ success: "text-[var(--ads-status-success-800)]",
49
+ attention: "text-[var(--ads-status-attention-800)]",
50
+ warning: "text-[var(--ads-status-warning-800)]",
51
+ new: "text-[var(--ads-status-new-800)]",
52
+ ai: "text-[var(--ads-text-ai)]",
53
+ };
54
+
55
+ const colorClass = computed(() => colorClasses[props.color]);
56
+ </script>
@@ -1,43 +1,43 @@
1
- <template>
2
- <div class="flex w-full flex-wrap items-center gap-x-2 gap-y-1">
3
- <span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">{{ label }}</span>
4
- <span
5
- v-if="loading"
6
- class="block h-[18px] animate-pulse rounded-[var(--ads-radius-pill)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
7
- :style="{ width: `${skeletonWidth}px` }"
8
- aria-hidden="true"
9
- />
10
- <span
11
- v-else-if="value"
12
- class="inline-flex h-[18px] items-center rounded-[var(--ads-radius-pill)] px-2 text-[length:var(--ads-font-size-minimal)] font-bold leading-[1.1] whitespace-nowrap"
13
- :class="tone === 'neutral'
14
- ? 'bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]'
15
- : 'bg-ads-radar-25 text-ads-radar-800'"
16
- >
17
- {{ value }}
18
- </span>
19
- </div>
20
- </template>
21
-
22
- <script setup lang="ts">
23
- /**
24
- * Rótulo com selo, usado no período e no comparativo dos cards.
25
- * brand é o selo de datas (azul); neutral é o selo do comparativo (cinza).
26
- */
27
- withDefaults(
28
- defineProps<{
29
- label: string;
30
- value?: string;
31
- tone?: "brand" | "neutral";
32
- loading?: boolean;
33
- /** Largura do skeleton do selo, em px. */
34
- skeletonWidth?: number;
35
- }>(),
36
- {
37
- value: undefined,
38
- tone: "brand",
39
- loading: false,
40
- skeletonWidth: 150,
41
- },
42
- );
43
- </script>
1
+ <template>
2
+ <div class="flex w-full flex-wrap items-center gap-x-2 gap-y-1">
3
+ <span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">{{ label }}</span>
4
+ <span
5
+ v-if="loading"
6
+ class="block h-[18px] animate-pulse rounded-[var(--ads-radius-pill)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
7
+ :style="{ width: `${skeletonWidth}px` }"
8
+ aria-hidden="true"
9
+ />
10
+ <span
11
+ v-else-if="value"
12
+ class="inline-flex h-[18px] items-center rounded-[var(--ads-radius-pill)] px-2 text-[length:var(--ads-font-size-minimal)] font-bold leading-[1.1] whitespace-nowrap"
13
+ :class="tone === 'neutral'
14
+ ? 'bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]'
15
+ : 'bg-ads-radar-25 text-ads-radar-800'"
16
+ >
17
+ {{ value }}
18
+ </span>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ /**
24
+ * Rótulo com selo, usado no período e no comparativo dos cards.
25
+ * brand é o selo de datas (azul); neutral é o selo do comparativo (cinza).
26
+ */
27
+ withDefaults(
28
+ defineProps<{
29
+ label: string;
30
+ value?: string;
31
+ tone?: "brand" | "neutral";
32
+ loading?: boolean;
33
+ /** Largura do skeleton do selo, em px. */
34
+ skeletonWidth?: number;
35
+ }>(),
36
+ {
37
+ value: undefined,
38
+ tone: "brand",
39
+ loading: false,
40
+ skeletonWidth: 150,
41
+ },
42
+ );
43
+ </script>
@@ -1,31 +1,31 @@
1
- <template>
2
- <span
3
- class="inline-flex shrink-0 items-center gap-0.5 text-[length:var(--ads-font-size-xxxs)] font-bold leading-[1.2] tabular-nums"
4
- :class="tone === 'negative' ? 'text-[var(--ads-status-warning-500)]' : 'text-[var(--ads-status-success-800)]'"
5
- >
6
- <UIcon :name="direction === 'down' ? 'i-lucide-arrow-down' : 'i-lucide-arrow-up'" class="size-4" aria-hidden="true" />
7
- <span class="sr-only">{{ direction === "down" ? "Queda de" : "Alta de" }}</span>
8
- {{ value }}
9
- </span>
10
- </template>
11
-
12
- <script setup lang="ts">
13
- export type AdsCardVariationDirection = "up" | "down";
14
- export type AdsCardVariationTone = "positive" | "negative";
15
-
16
- /**
17
- * Variação de métrica (_Card Variation do Figma): seta e percentual.
18
- * direction diz se o número subiu ou caiu; tone diz se isso é bom (positive) ou ruim (negative).
19
- */
20
- withDefaults(
21
- defineProps<{
22
- value: string;
23
- direction?: AdsCardVariationDirection;
24
- tone?: AdsCardVariationTone;
25
- }>(),
26
- {
27
- direction: "up",
28
- tone: "positive",
29
- },
30
- );
31
- </script>
1
+ <template>
2
+ <span
3
+ class="inline-flex shrink-0 items-center gap-0.5 text-[length:var(--ads-font-size-xxxs)] font-bold leading-[1.2] tabular-nums"
4
+ :class="tone === 'negative' ? 'text-[var(--ads-status-warning-500)]' : 'text-[var(--ads-status-success-800)]'"
5
+ >
6
+ <UIcon :name="direction === 'down' ? 'i-lucide-arrow-down' : 'i-lucide-arrow-up'" class="size-4" aria-hidden="true" />
7
+ <span class="sr-only">{{ direction === "down" ? "Queda de" : "Alta de" }}</span>
8
+ {{ value }}
9
+ </span>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ export type AdsCardVariationDirection = "up" | "down";
14
+ export type AdsCardVariationTone = "positive" | "negative";
15
+
16
+ /**
17
+ * Variação de métrica (_Card Variation do Figma): seta e percentual.
18
+ * direction diz se o número subiu ou caiu; tone diz se isso é bom (positive) ou ruim (negative).
19
+ */
20
+ withDefaults(
21
+ defineProps<{
22
+ value: string;
23
+ direction?: AdsCardVariationDirection;
24
+ tone?: AdsCardVariationTone;
25
+ }>(),
26
+ {
27
+ direction: "up",
28
+ tone: "positive",
29
+ },
30
+ );
31
+ </script>
@@ -1,79 +1,79 @@
1
- <template>
2
- <DefinePanel>
3
- <div class="flex min-w-[var(--ads-charttip-min-width)] flex-col gap-4 rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-4 text-[var(--ads-tooltip-title)] shadow-[var(--ads-shadow-level-1)]">
4
- <p v-if="title" class="text-center text-base leading-[1.3] font-bold">{{ title }}</p>
5
- <!-- Figma 6471:852: 16px entre o título e cada linha. -->
6
- <ul class="flex flex-col gap-4">
7
- <li v-for="(row, index) in rows" :key="index" class="flex items-center gap-2 text-sm leading-[1.3]">
8
- <span class="size-[var(--ads-charttip-swatch)] shrink-0 rounded-[var(--ads-radius-xsm)]" :class="row.colorClass" :style="row.color ? { background: row.color } : undefined" />
9
- <span class="min-w-0 flex-1">{{ row.label }}</span>
10
- <span>{{ row.value }}</span>
11
- </li>
12
- </ul>
13
- </div>
14
- </DefinePanel>
15
-
16
- <UTooltip
17
- v-if="hasTrigger"
18
- :delay-duration="delayDuration"
19
- :content="{ side, align: 'center', sideOffset: 8 }"
20
- :ui="tooltipUi"
21
- >
22
- <slot />
23
- <template #content>
24
- <ReusePanel />
25
- </template>
26
- </UTooltip>
27
- <ReusePanel v-else />
28
- </template>
29
-
30
- <script setup lang="ts">
31
- import { computed, useSlots } from "vue";
32
- import { createReusableTemplate } from "@vueuse/core";
33
-
34
- export type AdsCharttipRow = {
35
- label: string;
36
- value: string;
37
- /** Classe de fundo, como `bg-ads-grafico-c1-400`. */
38
- colorClass?: string;
39
- /** Cor sem token. Preferir `colorClass`. */
40
- color?: string;
41
- };
42
-
43
- const props = withDefaults(
44
- defineProps<{
45
- title?: string;
46
- rows?: AdsCharttipRow[];
47
- /** Figma `Property 1`. Com slot, escolhe o lado em que o painel abre, como no AdsTooltip. A seta não é desenhada. */
48
- wing?: "up" | "down" | "left" | "right";
49
- delayDuration?: number;
50
- }>(),
51
- {
52
- title: "Título",
53
- rows: () => [
54
- { label: "Série 1", value: "12", colorClass: "bg-ads-grafico-c1-400" },
55
- { label: "Série 2", value: "8", colorClass: "bg-ads-innovation-500" },
56
- { label: "Série 3", value: "5", colorClass: "bg-ads-grafico-c3-400" },
57
- ],
58
- wing: "down",
59
- delayDuration: 150,
60
- },
61
- );
62
-
63
- const [DefinePanel, ReusePanel] = createReusableTemplate();
64
-
65
- const slots = useSlots();
66
- const hasTrigger = computed(() => Boolean(slots.default));
67
-
68
- const side = computed(() => {
69
- if (props.wing === "down") return "bottom" as const;
70
- if (props.wing === "left") return "left" as const;
71
- if (props.wing === "right") return "right" as const;
72
- return "top" as const;
73
- });
74
-
75
- /** O painel já tem fundo, raio e sombra: o conteúdo do UTooltip só posiciona. */
76
- const tooltipUi = {
77
- content: "z-[70] h-auto max-w-none rounded-none bg-transparent p-0 shadow-none ring-0",
78
- };
79
- </script>
1
+ <template>
2
+ <DefinePanel>
3
+ <div class="flex min-w-[var(--ads-charttip-min-width)] flex-col gap-4 rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-4 text-[var(--ads-tooltip-title)] shadow-[var(--ads-shadow-level-1)]">
4
+ <p v-if="title" class="text-center text-base leading-[1.3] font-bold">{{ title }}</p>
5
+ <!-- Figma 6471:852: 16px entre o título e cada linha. -->
6
+ <ul class="flex flex-col gap-4">
7
+ <li v-for="(row, index) in rows" :key="index" class="flex items-center gap-2 text-sm leading-[1.3]">
8
+ <span class="size-[var(--ads-charttip-swatch)] shrink-0 rounded-[var(--ads-radius-xsm)]" :class="row.colorClass" :style="row.color ? { background: row.color } : undefined" />
9
+ <span class="min-w-0 flex-1">{{ row.label }}</span>
10
+ <span>{{ row.value }}</span>
11
+ </li>
12
+ </ul>
13
+ </div>
14
+ </DefinePanel>
15
+
16
+ <UTooltip
17
+ v-if="hasTrigger"
18
+ :delay-duration="delayDuration"
19
+ :content="{ side, align: 'center', sideOffset: 8 }"
20
+ :ui="tooltipUi"
21
+ >
22
+ <slot />
23
+ <template #content>
24
+ <ReusePanel />
25
+ </template>
26
+ </UTooltip>
27
+ <ReusePanel v-else />
28
+ </template>
29
+
30
+ <script setup lang="ts">
31
+ import { computed, useSlots } from "vue";
32
+ import { createReusableTemplate } from "@vueuse/core";
33
+
34
+ export type AdsCharttipRow = {
35
+ label: string;
36
+ value: string;
37
+ /** Classe de fundo, como `bg-ads-grafico-c1-400`. */
38
+ colorClass?: string;
39
+ /** Cor sem token. Preferir `colorClass`. */
40
+ color?: string;
41
+ };
42
+
43
+ const props = withDefaults(
44
+ defineProps<{
45
+ title?: string;
46
+ rows?: AdsCharttipRow[];
47
+ /** Figma `Property 1`. Com slot, escolhe o lado em que o painel abre, como no AdsTooltip. A seta não é desenhada. */
48
+ wing?: "up" | "down" | "left" | "right";
49
+ delayDuration?: number;
50
+ }>(),
51
+ {
52
+ title: "Título",
53
+ rows: () => [
54
+ { label: "Série 1", value: "12", colorClass: "bg-ads-grafico-c1-400" },
55
+ { label: "Série 2", value: "8", colorClass: "bg-ads-innovation-500" },
56
+ { label: "Série 3", value: "5", colorClass: "bg-ads-grafico-c3-400" },
57
+ ],
58
+ wing: "down",
59
+ delayDuration: 150,
60
+ },
61
+ );
62
+
63
+ const [DefinePanel, ReusePanel] = createReusableTemplate();
64
+
65
+ const slots = useSlots();
66
+ const hasTrigger = computed(() => Boolean(slots.default));
67
+
68
+ const side = computed(() => {
69
+ if (props.wing === "down") return "bottom" as const;
70
+ if (props.wing === "left") return "left" as const;
71
+ if (props.wing === "right") return "right" as const;
72
+ return "top" as const;
73
+ });
74
+
75
+ /** O painel já tem fundo, raio e sombra: o conteúdo do UTooltip só posiciona. */
76
+ const tooltipUi = {
77
+ content: "z-[70] h-auto max-w-none rounded-none bg-transparent p-0 shadow-none ring-0",
78
+ };
79
+ </script>