ads-nuxt 0.1.1 → 0.1.2

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 (74) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +567 -546
  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.svg +9 -9
  8. package/app/assets/css/component-tokens.css +403 -403
  9. package/app/assets/css/main.css +617 -617
  10. package/app/components/AdsBadge.vue +48 -48
  11. package/app/components/AdsBroadcast.vue +45 -45
  12. package/app/components/AdsButton.vue +569 -569
  13. package/app/components/AdsButtonGroup.vue +39 -39
  14. package/app/components/AdsButtonMenu.vue +48 -48
  15. package/app/components/AdsCard.vue +117 -117
  16. package/app/components/AdsCharttip.vue +78 -78
  17. package/app/components/AdsCheckbox.vue +77 -77
  18. package/app/components/AdsDatePicker.vue +473 -473
  19. package/app/components/AdsDropdownMenu.vue +19 -19
  20. package/app/components/AdsEmptyState.vue +58 -58
  21. package/app/components/AdsFarmarcasPill.vue +74 -74
  22. package/app/components/AdsFeatureCard.vue +217 -217
  23. package/app/components/AdsFileCard.vue +101 -101
  24. package/app/components/AdsFilterDropdown.vue +174 -174
  25. package/app/components/AdsFilterOption.vue +72 -72
  26. package/app/components/AdsFilterSelect.vue +202 -202
  27. package/app/components/AdsFooter.vue +25 -25
  28. package/app/components/AdsInput.vue +143 -143
  29. package/app/components/AdsListDropdown.vue +44 -44
  30. package/app/components/AdsLoading.vue +109 -109
  31. package/app/components/AdsMenuBar.vue +103 -103
  32. package/app/components/AdsMetricCard.vue +119 -119
  33. package/app/components/AdsMiniPill.vue +40 -40
  34. package/app/components/AdsModal.vue +157 -157
  35. package/app/components/AdsMonthPicker.vue +80 -80
  36. package/app/components/AdsNavbarApp.vue +67 -67
  37. package/app/components/AdsNavbarDesk.vue +62 -62
  38. package/app/components/AdsNotabilityPill.vue +27 -27
  39. package/app/components/AdsNumberInput.vue +166 -166
  40. package/app/components/AdsPagination.vue +91 -91
  41. package/app/components/AdsProductTag.vue +61 -61
  42. package/app/components/AdsRadio.vue +70 -70
  43. package/app/components/AdsSearchInput.vue +113 -113
  44. package/app/components/AdsSegmentedTabs.vue +28 -28
  45. package/app/components/AdsSideMenu.vue +101 -101
  46. package/app/components/AdsSmalltip.vue +44 -44
  47. package/app/components/AdsSteptip.vue +101 -101
  48. package/app/components/AdsSwitch.vue +59 -59
  49. package/app/components/AdsTable.vue +100 -100
  50. package/app/components/AdsTableToolbar.vue +44 -44
  51. package/app/components/AdsTabs.vue +51 -51
  52. package/app/components/AdsTextarea.vue +109 -109
  53. package/app/components/AdsToast.vue +181 -181
  54. package/app/components/AdsTooltip.vue +66 -66
  55. package/app/components/InvertedTooltip.vue +40 -40
  56. package/app/components/OverlayLoading.vue +173 -173
  57. package/app/components/ProgressBarLoading.vue +256 -256
  58. package/app/composables/useOverlayLoading.ts +66 -66
  59. package/app/locale/pt-br.ts +6 -6
  60. package/app/plugins/ads-toast.client.ts +24 -24
  61. package/app/theme/ads-theme.ts +370 -370
  62. package/app/theme/component-tokens.json +402 -402
  63. package/app/theme/component-tokens.ts +815 -815
  64. package/app/types/overlay-loading.types.ts +26 -26
  65. package/app/utils/ads-filter-select.ts +172 -172
  66. package/app/utils/ads-table.ts +204 -204
  67. package/app/utils/calendar-date.ts +128 -128
  68. package/app/utils/category-role.ts +45 -45
  69. package/app/utils/money.ts +77 -77
  70. package/app/utils/notability.ts +8 -8
  71. package/app/utils/parser.ts +134 -134
  72. package/app/utils/percentage.ts +54 -54
  73. package/nuxt.config.ts +31 -32
  74. package/package.json +48 -46
@@ -1,51 +1,51 @@
1
- <template>
2
- <UTabs
3
- v-model="model"
4
- variant="link"
5
- color="primary"
6
- :items="items"
7
- :content="content"
8
- :default-item="defaultItem"
9
- :ui="ui"
10
- >
11
- <template v-if="slots.trailing" #trailing="slotProps">
12
- <slot name="trailing" v-bind="slotProps" />
13
- </template>
14
- <template v-if="slots.content" #content="slotProps">
15
- <slot name="content" v-bind="slotProps" />
16
- </template>
17
- </UTabs>
18
- </template>
19
-
20
- <script setup lang="ts" generic="T extends string | number">
21
- import type { TabsItem } from "@nuxt/ui";
22
- import { computed, useSlots } from "vue";
23
- import { adsLinkTabsUi } from "../theme/ads-theme";
24
-
25
- const props = withDefaults(
26
- defineProps<{
27
- items: TabsItem[];
28
- /** `false` deixa só a faixa de abas, sem painel. */
29
- content?: boolean;
30
- defaultItem?: TabsItem;
31
- /** Classes extras na lista, como um recuo lateral. */
32
- listClass?: string;
33
- }>(),
34
- {
35
- content: true,
36
- defaultItem: undefined,
37
- listClass: "",
38
- },
39
- );
40
-
41
- const model = defineModel<T>();
42
- const slots = useSlots();
43
-
44
- const ui = computed(() => ({
45
- ...adsLinkTabsUi,
46
- root: [adsLinkTabsUi.root, props.content ? "flex-col gap-4" : ""]
47
- .filter(Boolean)
48
- .join(" "),
49
- list: [adsLinkTabsUi.list, props.listClass].filter(Boolean).join(" "),
50
- }));
51
- </script>
1
+ <template>
2
+ <UTabs
3
+ v-model="model"
4
+ variant="link"
5
+ color="primary"
6
+ :items="items"
7
+ :content="content"
8
+ :default-item="defaultItem"
9
+ :ui="ui"
10
+ >
11
+ <template v-if="slots.trailing" #trailing="slotProps">
12
+ <slot name="trailing" v-bind="slotProps" />
13
+ </template>
14
+ <template v-if="slots.content" #content="slotProps">
15
+ <slot name="content" v-bind="slotProps" />
16
+ </template>
17
+ </UTabs>
18
+ </template>
19
+
20
+ <script setup lang="ts" generic="T extends string | number">
21
+ import type { TabsItem } from "@nuxt/ui";
22
+ import { computed, useSlots } from "vue";
23
+ import { adsLinkTabsUi } from "../theme/ads-theme";
24
+
25
+ const props = withDefaults(
26
+ defineProps<{
27
+ items: TabsItem[];
28
+ /** `false` deixa só a faixa de abas, sem painel. */
29
+ content?: boolean;
30
+ defaultItem?: TabsItem;
31
+ /** Classes extras na lista, como um recuo lateral. */
32
+ listClass?: string;
33
+ }>(),
34
+ {
35
+ content: true,
36
+ defaultItem: undefined,
37
+ listClass: "",
38
+ },
39
+ );
40
+
41
+ const model = defineModel<T>();
42
+ const slots = useSlots();
43
+
44
+ const ui = computed(() => ({
45
+ ...adsLinkTabsUi,
46
+ root: [adsLinkTabsUi.root, props.content ? "flex-col gap-4" : ""]
47
+ .filter(Boolean)
48
+ .join(" "),
49
+ list: [adsLinkTabsUi.list, props.listClass].filter(Boolean).join(" "),
50
+ }));
51
+ </script>
@@ -1,109 +1,109 @@
1
- <template>
2
- <div class="flex w-full min-w-0 flex-col gap-0.5">
3
- <label
4
- v-if="label"
5
- :for="fieldId"
6
- class="text-[length:var(--ads-textarea-label-size)] leading-[1.2]"
7
- :class="supportClass"
8
- >
9
- {{ label }}
10
- </label>
11
-
12
- <div
13
- class="relative flex min-h-[var(--ads-textarea-min-height)] transition-colors rounded-[var(--ads-textarea-radius)]"
14
- :class="fieldClass"
15
- :data-state="visualState"
16
- >
17
- <textarea
18
- :id="fieldId"
19
- v-model="model"
20
- class="min-h-[calc(var(--ads-textarea-min-height)-24px)] w-full flex-1 resize-y bg-transparent p-[var(--ads-textarea-padding)] pe-8 text-[length:var(--ads-textarea-font-size)] leading-[1.3] outline-none placeholder:text-current disabled:cursor-not-allowed"
21
- :placeholder="placeholder"
22
- :disabled="isDisabled"
23
- :aria-invalid="error ? true : undefined"
24
- :aria-describedby="supportText ? supportId : undefined"
25
- />
26
- <UIcon
27
- name="i-lucide-move-diagonal-2"
28
- class="pointer-events-none absolute end-3 bottom-3 size-4 text-base text-ads-neutro-medio-60"
29
- />
30
- </div>
31
-
32
- <p
33
- v-if="supportText"
34
- :id="supportId"
35
- class="text-[length:var(--ads-textarea-label-size)] leading-[1.2]"
36
- :class="supportClass"
37
- >
38
- {{ supportText }}
39
- </p>
40
- </div>
41
- </template>
42
-
43
- <script setup lang="ts">
44
- import { computed, useId } from "vue";
45
-
46
- export type AdsTextareaState = "default" | "active" | "focus" | "error" | "disabled";
47
-
48
- const props = withDefaults(
49
- defineProps<{
50
- label?: string;
51
- hint?: string;
52
- error?: string;
53
- placeholder?: string;
54
- disabled?: boolean;
55
- /** Estado congelado para a documentação. `null` segue o campo. */
56
- state?: AdsTextareaState | null;
57
- }>(),
58
- {
59
- label: "",
60
- hint: "",
61
- error: "",
62
- placeholder: "",
63
- disabled: false,
64
- state: null,
65
- },
66
- );
67
-
68
- const model = defineModel<string>({ default: "" });
69
-
70
- const fieldId = useId();
71
- const supportId = useId();
72
-
73
- const isDisabled = computed(() => props.disabled || props.state === "disabled");
74
-
75
- const visualState = computed<AdsTextareaState>(() => {
76
- if (isDisabled.value) return "disabled";
77
- if (props.state) return props.state;
78
- if (props.error) return "error";
79
- return model.value ? "active" : "default";
80
- });
81
-
82
- const supportText = computed(() => props.error || props.hint);
83
- const supportClass = computed(() =>
84
- visualState.value === "disabled"
85
- ? "text-[var(--ads-text-tertiary)]"
86
- : "text-[var(--ads-text-secondary)]",
87
- );
88
-
89
- const fieldClass = computed(() => {
90
- const interactiveFocus = props.state === null && !isDisabled.value && !props.error;
91
- const text = visualState.value === "default" || visualState.value === "disabled"
92
- ? "text-[var(--ads-textarea-placeholder)]"
93
- : "text-[var(--ads-textarea-text)]";
94
-
95
- if (visualState.value === "disabled") {
96
- return `border border-[var(--ads-textarea-disabled-border)] bg-[var(--ads-textarea-disabled-background)] ${text}`;
97
- }
98
- if (visualState.value === "error") {
99
- return `border-(length:--ads-border-width-slim) border-[var(--ads-textarea-error-border)] bg-[var(--ads-textarea-background)] ${text}`;
100
- }
101
- if (visualState.value === "focus") {
102
- return `border-(length:--ads-border-width-slim) border-[var(--ads-textarea-focus-border)] bg-[var(--ads-textarea-background)] ${text}`;
103
- }
104
- const focus = interactiveFocus
105
- ? "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
- : "";
107
- return `border border-[var(--ads-textarea-border)] bg-[var(--ads-textarea-background)] ${text} ${focus}`;
108
- });
109
- </script>
1
+ <template>
2
+ <div class="flex w-full min-w-0 flex-col gap-0.5">
3
+ <label
4
+ v-if="label"
5
+ :for="fieldId"
6
+ class="text-[length:var(--ads-textarea-label-size)] leading-[1.2]"
7
+ :class="supportClass"
8
+ >
9
+ {{ label }}
10
+ </label>
11
+
12
+ <div
13
+ class="relative flex min-h-[var(--ads-textarea-min-height)] transition-colors rounded-[var(--ads-textarea-radius)]"
14
+ :class="fieldClass"
15
+ :data-state="visualState"
16
+ >
17
+ <textarea
18
+ :id="fieldId"
19
+ v-model="model"
20
+ class="min-h-[calc(var(--ads-textarea-min-height)-24px)] w-full flex-1 resize-y bg-transparent p-[var(--ads-textarea-padding)] pe-8 text-[length:var(--ads-textarea-font-size)] leading-[1.3] outline-none placeholder:text-current disabled:cursor-not-allowed"
21
+ :placeholder="placeholder"
22
+ :disabled="isDisabled"
23
+ :aria-invalid="error ? true : undefined"
24
+ :aria-describedby="supportText ? supportId : undefined"
25
+ />
26
+ <UIcon
27
+ name="i-lucide-move-diagonal-2"
28
+ class="pointer-events-none absolute end-3 bottom-3 size-4 text-base text-ads-neutro-medio-60"
29
+ />
30
+ </div>
31
+
32
+ <p
33
+ v-if="supportText"
34
+ :id="supportId"
35
+ class="text-[length:var(--ads-textarea-label-size)] leading-[1.2]"
36
+ :class="supportClass"
37
+ >
38
+ {{ supportText }}
39
+ </p>
40
+ </div>
41
+ </template>
42
+
43
+ <script setup lang="ts">
44
+ import { computed, useId } from "vue";
45
+
46
+ export type AdsTextareaState = "default" | "active" | "focus" | "error" | "disabled";
47
+
48
+ const props = withDefaults(
49
+ defineProps<{
50
+ label?: string;
51
+ hint?: string;
52
+ error?: string;
53
+ placeholder?: string;
54
+ disabled?: boolean;
55
+ /** Estado congelado para a documentação. `null` segue o campo. */
56
+ state?: AdsTextareaState | null;
57
+ }>(),
58
+ {
59
+ label: "",
60
+ hint: "",
61
+ error: "",
62
+ placeholder: "",
63
+ disabled: false,
64
+ state: null,
65
+ },
66
+ );
67
+
68
+ const model = defineModel<string>({ default: "" });
69
+
70
+ const fieldId = useId();
71
+ const supportId = useId();
72
+
73
+ const isDisabled = computed(() => props.disabled || props.state === "disabled");
74
+
75
+ const visualState = computed<AdsTextareaState>(() => {
76
+ if (isDisabled.value) return "disabled";
77
+ if (props.state) return props.state;
78
+ if (props.error) return "error";
79
+ return model.value ? "active" : "default";
80
+ });
81
+
82
+ const supportText = computed(() => props.error || props.hint);
83
+ const supportClass = computed(() =>
84
+ visualState.value === "disabled"
85
+ ? "text-[var(--ads-text-tertiary)]"
86
+ : "text-[var(--ads-text-secondary)]",
87
+ );
88
+
89
+ const fieldClass = computed(() => {
90
+ const interactiveFocus = props.state === null && !isDisabled.value && !props.error;
91
+ const text = visualState.value === "default" || visualState.value === "disabled"
92
+ ? "text-[var(--ads-textarea-placeholder)]"
93
+ : "text-[var(--ads-textarea-text)]";
94
+
95
+ if (visualState.value === "disabled") {
96
+ return `border border-[var(--ads-textarea-disabled-border)] bg-[var(--ads-textarea-disabled-background)] ${text}`;
97
+ }
98
+ if (visualState.value === "error") {
99
+ return `border-(length:--ads-border-width-slim) border-[var(--ads-textarea-error-border)] bg-[var(--ads-textarea-background)] ${text}`;
100
+ }
101
+ if (visualState.value === "focus") {
102
+ return `border-(length:--ads-border-width-slim) border-[var(--ads-textarea-focus-border)] bg-[var(--ads-textarea-background)] ${text}`;
103
+ }
104
+ const focus = interactiveFocus
105
+ ? "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
+ : "";
107
+ return `border border-[var(--ads-textarea-border)] bg-[var(--ads-textarea-background)] ${text} ${focus}`;
108
+ });
109
+ </script>