@caipira/tamandua 0.0.1

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 (295) hide show
  1. package/.editorconfig +12 -0
  2. package/.prettierrc +5 -0
  3. package/.storybook/main.ts +25 -0
  4. package/.storybook/preview-body.html +3 -0
  5. package/.storybook/preview.ts +24 -0
  6. package/App.vue +1 -0
  7. package/Dockerfile +21 -0
  8. package/LICENSE +674 -0
  9. package/README.md +11 -0
  10. package/assets/icons/account.svg +1 -0
  11. package/assets/icons/alert-octagon-outline.svg +1 -0
  12. package/assets/icons/alert-octagon.svg +1 -0
  13. package/assets/icons/archive-outline.svg +1 -0
  14. package/assets/icons/archive.svg +1 -0
  15. package/assets/icons/arrow-left.svg +1 -0
  16. package/assets/icons/arrow-right.svg +1 -0
  17. package/assets/icons/bank-outline.svg +1 -0
  18. package/assets/icons/bank.svg +1 -0
  19. package/assets/icons/camera.svg +1 -0
  20. package/assets/icons/cards-outline.svg +1 -0
  21. package/assets/icons/cards-variant.svg +1 -0
  22. package/assets/icons/cart-outline.svg +1 -0
  23. package/assets/icons/chart-box-outline.svg +1 -0
  24. package/assets/icons/chart-box.svg +1 -0
  25. package/assets/icons/check-circle-outline.svg +1 -0
  26. package/assets/icons/check-circle.svg +1 -0
  27. package/assets/icons/check.svg +1 -0
  28. package/assets/icons/checkbox-dark.svg +1 -0
  29. package/assets/icons/checkbox-indeterminate-dark.svg +1 -0
  30. package/assets/icons/checkbox-indeterminate.svg +1 -0
  31. package/assets/icons/checkbox.svg +1 -0
  32. package/assets/icons/chevron-down.svg +1 -0
  33. package/assets/icons/chevron-left.svg +1 -0
  34. package/assets/icons/chevron-right.svg +1 -0
  35. package/assets/icons/chevron-up.svg +1 -0
  36. package/assets/icons/circle.svg +1 -0
  37. package/assets/icons/clock.svg +1 -0
  38. package/assets/icons/close-circle-outline.svg +1 -0
  39. package/assets/icons/close-circle.svg +1 -0
  40. package/assets/icons/close.svg +1 -0
  41. package/assets/icons/cog.svg +1 -0
  42. package/assets/icons/color-fill.svg +1 -0
  43. package/assets/icons/copy.svg +1 -0
  44. package/assets/icons/credit-card-plus.svg +1 -0
  45. package/assets/icons/credit-card.svg +1 -0
  46. package/assets/icons/currency.svg +1 -0
  47. package/assets/icons/database.svg +1 -0
  48. package/assets/icons/dots-grid.svg +1 -0
  49. package/assets/icons/dots-vertical.svg +1 -0
  50. package/assets/icons/email-open-outline.svg +1 -0
  51. package/assets/icons/email-outline.svg +1 -0
  52. package/assets/icons/eye-off.svg +1 -0
  53. package/assets/icons/eye.svg +1 -0
  54. package/assets/icons/file-document-plus-outline.svg +1 -0
  55. package/assets/icons/filmstrip.svg +1 -0
  56. package/assets/icons/filter.svg +1 -0
  57. package/assets/icons/fullscreen-exit.svg +1 -0
  58. package/assets/icons/fullscreen.svg +1 -0
  59. package/assets/icons/group.svg +1 -0
  60. package/assets/icons/image-album-outline.svg +1 -0
  61. package/assets/icons/image-album.svg +1 -0
  62. package/assets/icons/image-outline.svg +1 -0
  63. package/assets/icons/image.svg +1 -0
  64. package/assets/icons/info-outline.svg +1 -0
  65. package/assets/icons/key-chain.svg +1 -0
  66. package/assets/icons/key-variant.svg +1 -0
  67. package/assets/icons/key.svg +1 -0
  68. package/assets/icons/listbox-outline.svg +1 -0
  69. package/assets/icons/loading.svg +1 -0
  70. package/assets/icons/lock-outline.svg +1 -0
  71. package/assets/icons/lock.svg +1 -0
  72. package/assets/icons/logout.svg +1 -0
  73. package/assets/icons/menu-down.svg +1 -0
  74. package/assets/icons/menu-left.svg +1 -0
  75. package/assets/icons/menu-right.svg +1 -0
  76. package/assets/icons/menu.svg +1 -0
  77. package/assets/icons/minus-circle-outline.svg +1 -0
  78. package/assets/icons/minus-circle.svg +1 -0
  79. package/assets/icons/minus.svg +1 -0
  80. package/assets/icons/moon.svg +1 -0
  81. package/assets/icons/open-in-new.svg +1 -0
  82. package/assets/icons/pencil.svg +1 -0
  83. package/assets/icons/people.svg +1 -0
  84. package/assets/icons/piggy-bank-outline.svg +1 -0
  85. package/assets/icons/plus-circle-outline.svg +1 -0
  86. package/assets/icons/plus-circle.svg +1 -0
  87. package/assets/icons/plus.svg +1 -0
  88. package/assets/icons/qrcode-scan.svg +1 -0
  89. package/assets/icons/radio-dark.svg +1 -0
  90. package/assets/icons/radio.svg +1 -0
  91. package/assets/icons/refresh.svg +1 -0
  92. package/assets/icons/save.svg +1 -0
  93. package/assets/icons/search.svg +1 -0
  94. package/assets/icons/spotlight.svg +1 -0
  95. package/assets/icons/store-outline.svg +1 -0
  96. package/assets/icons/sun.svg +1 -0
  97. package/assets/icons/swap-horizontal.svg +1 -0
  98. package/assets/icons/swap-left.svg +1 -0
  99. package/assets/icons/swap-right.svg +1 -0
  100. package/assets/icons/swap.svg +1 -0
  101. package/assets/icons/system-theme.svg +1 -0
  102. package/assets/icons/tag-outline.svg +1 -0
  103. package/assets/icons/trash-can-outline.svg +1 -0
  104. package/assets/icons/trash-can.svg +1 -0
  105. package/assets/icons/upload.svg +1 -0
  106. package/assets/icons/user-circle.svg +1 -0
  107. package/assets/icons/zip-box.svg +1 -0
  108. package/assets/images/fs/apk.svg +11 -0
  109. package/assets/images/fs/bmp.svg +7 -0
  110. package/assets/images/fs/css.svg +8 -0
  111. package/assets/images/fs/doc.svg +9 -0
  112. package/assets/images/fs/docx.svg +9 -0
  113. package/assets/images/fs/folder-adwaita.svg +8 -0
  114. package/assets/images/fs/folder-black.svg +8 -0
  115. package/assets/images/fs/folder-brown.svg +8 -0
  116. package/assets/images/fs/folder-grey.svg +8 -0
  117. package/assets/images/fs/folder-nordic.svg +8 -0
  118. package/assets/images/fs/folder-orange.svg +8 -0
  119. package/assets/images/fs/folder-palebrown.svg +8 -0
  120. package/assets/images/fs/folder-paleorange.svg +8 -0
  121. package/assets/images/fs/folder-teal.svg +8 -0
  122. package/assets/images/fs/folder-white.svg +8 -0
  123. package/assets/images/fs/folder-yellow.svg +8 -0
  124. package/assets/images/fs/gif.svg +7 -0
  125. package/assets/images/fs/go.svg +9 -0
  126. package/assets/images/fs/ics.svg +24 -0
  127. package/assets/images/fs/iso.svg +10 -0
  128. package/assets/images/fs/jpeg.svg +7 -0
  129. package/assets/images/fs/jpg.svg +7 -0
  130. package/assets/images/fs/js.svg +9 -0
  131. package/assets/images/fs/json.svg +9 -0
  132. package/assets/images/fs/lua.svg +9 -0
  133. package/assets/images/fs/m4v.svg +7 -0
  134. package/assets/images/fs/md.svg +10 -0
  135. package/assets/images/fs/mov.svg +7 -0
  136. package/assets/images/fs/mp3.svg +9 -0
  137. package/assets/images/fs/mp4.svg +7 -0
  138. package/assets/images/fs/pdf.svg +9 -0
  139. package/assets/images/fs/pgp.svg +8 -0
  140. package/assets/images/fs/php.svg +9 -0
  141. package/assets/images/fs/png.svg +7 -0
  142. package/assets/images/fs/ppt.svg +9 -0
  143. package/assets/images/fs/py.svg +9 -0
  144. package/assets/images/fs/rar.svg +20 -0
  145. package/assets/images/fs/rpm.svg +7 -0
  146. package/assets/images/fs/rs.svg +9 -0
  147. package/assets/images/fs/sh.svg +9 -0
  148. package/assets/images/fs/tar.svg +20 -0
  149. package/assets/images/fs/txt.svg +8 -0
  150. package/assets/images/fs/unknown.svg +8 -0
  151. package/assets/images/fs/xls.svg +9 -0
  152. package/assets/images/fs/xlsx.svg +9 -0
  153. package/assets/images/fs/xml.svg +8 -0
  154. package/assets/images/fs/yaml.svg +9 -0
  155. package/assets/images/fs/zip.svg +20 -0
  156. package/components/Avatar/Avatar.story.ts +55 -0
  157. package/components/Avatar/Avatar.vue +82 -0
  158. package/components/Avatar/index.ts +12 -0
  159. package/components/Backdrop/Backdrop.vue +27 -0
  160. package/components/Backdrop/index.ts +12 -0
  161. package/components/Button/Button.story.ts +74 -0
  162. package/components/Button/Button.vue +230 -0
  163. package/components/Button/index.ts +12 -0
  164. package/components/ButtonCopy/ButtonCopy.vue +61 -0
  165. package/components/ButtonCopy/index.ts +12 -0
  166. package/components/Drawer/Drawer.vue +102 -0
  167. package/components/Drawer/index.ts +12 -0
  168. package/components/Dropdown/Dropdown.vue +258 -0
  169. package/components/Dropdown/index.ts +12 -0
  170. package/components/EventListener/EventListener.vue +12 -0
  171. package/components/FileDrop/FileDrop.vue +116 -0
  172. package/components/FileDrop/index.ts +12 -0
  173. package/components/Form/Form.spec.ts +72 -0
  174. package/components/Form/Form.vue +134 -0
  175. package/components/Form/index.ts +12 -0
  176. package/components/FormItem/FormItem.vue +85 -0
  177. package/components/FormItem/index.ts +12 -0
  178. package/components/GraphyEmpty/GraphyEmpty.vue +16 -0
  179. package/components/GraphyEmpty/index.ts +12 -0
  180. package/components/GraphyLabel/GraphyLabel.vue +34 -0
  181. package/components/GraphyLabel/index.ts +12 -0
  182. package/components/GraphyPrice/GraphyPrice.story.ts +37 -0
  183. package/components/GraphyPrice/GraphyPrice.vue +65 -0
  184. package/components/GraphyPrice/index.ts +12 -0
  185. package/components/GraphySubtitle/GraphySubtitle.vue +22 -0
  186. package/components/GraphySubtitle/index.ts +12 -0
  187. package/components/GraphyTitle/GraphyTitle.vue +13 -0
  188. package/components/GraphyTitle/index.ts +12 -0
  189. package/components/Icon/Icon.vue +84 -0
  190. package/components/Icon/index.ts +12 -0
  191. package/components/IconButton/IconButton.vue +168 -0
  192. package/components/IconButton/index.ts +12 -0
  193. package/components/InputAvatar/InputAvatar.vue +63 -0
  194. package/components/InputAvatar/index.ts +12 -0
  195. package/components/InputCheckbox/InputCheckbox.vue +77 -0
  196. package/components/InputCheckbox/index.ts +12 -0
  197. package/components/InputColor/InputColor.vue +54 -0
  198. package/components/InputColor/index.ts +12 -0
  199. package/components/InputDate/InputDate.story.ts +15 -0
  200. package/components/InputDate/InputDate.vue +368 -0
  201. package/components/InputDate/index.ts +12 -0
  202. package/components/InputMultiplier/InputMultiplier.vue +144 -0
  203. package/components/InputMultiplier/index.ts +12 -0
  204. package/components/InputPassword/InputPassword.vue +168 -0
  205. package/components/InputPassword/index.ts +12 -0
  206. package/components/InputPhone/InputPhone.vue +125 -0
  207. package/components/InputPhone/index.ts +12 -0
  208. package/components/InputPrice/InputPrice.vue +96 -0
  209. package/components/InputPrice/index.ts +12 -0
  210. package/components/InputRadio/InputRadio.vue +41 -0
  211. package/components/InputRadio/InputRadioGroup.story.ts +24 -0
  212. package/components/InputRadio/InputRadioGroup.vue +48 -0
  213. package/components/InputRadio/index.ts +14 -0
  214. package/components/InputSelect/InputSelect.story.ts +87 -0
  215. package/components/InputSelect/InputSelect.vue +507 -0
  216. package/components/InputSelect/index.ts +12 -0
  217. package/components/InputSwitch/InputSwitch.story.ts +34 -0
  218. package/components/InputSwitch/InputSwitch.vue +82 -0
  219. package/components/InputSwitch/index.ts +12 -0
  220. package/components/InputText/InputText.vue +62 -0
  221. package/components/InputText/index.ts +12 -0
  222. package/components/InputTextarea/InputTextarea.vue +64 -0
  223. package/components/InputTextarea/index.ts +12 -0
  224. package/components/LineChart/LineChart.vue +14 -0
  225. package/components/LineChart/index.ts +12 -0
  226. package/components/Modal/Modal.vue +106 -0
  227. package/components/Modal/index.ts +12 -0
  228. package/components/ModalForm/ModalForm.vue +141 -0
  229. package/components/ModalForm/index.ts +12 -0
  230. package/components/Pagination/Pagination.story.ts +15 -0
  231. package/components/Pagination/Pagination.vue +138 -0
  232. package/components/Pagination/index.ts +12 -0
  233. package/components/PieChart/PieChart.vue +14 -0
  234. package/components/PieChart/index.ts +12 -0
  235. package/components/Popconfirm/Popconfirm.vue +80 -0
  236. package/components/Popconfirm/index.ts +12 -0
  237. package/components/Popover/Popover.vue +133 -0
  238. package/components/Popover/index.ts +12 -0
  239. package/components/ProgressCircle/ProgressCircle.story.ts +31 -0
  240. package/components/ProgressCircle/ProgressCircle.vue +82 -0
  241. package/components/ProgressCircle/index.ts +12 -0
  242. package/components/ProgressLine/ProgressLine.story.ts +27 -0
  243. package/components/ProgressLine/ProgressLine.vue +104 -0
  244. package/components/ProgressLine/index.ts +12 -0
  245. package/components/SensitiveInfo/SensitiveInfo.vue +18 -0
  246. package/components/SensitiveInfo/index.ts +12 -0
  247. package/components/Tab/Tab.vue +58 -0
  248. package/components/Tab/index.ts +12 -0
  249. package/components/Table/Table.story.ts +32 -0
  250. package/components/Table/Table.vue +318 -0
  251. package/components/Table/index.ts +12 -0
  252. package/components/Tag/Tag.vue +73 -0
  253. package/components/Tag/index.ts +12 -0
  254. package/components/Toast/Toast.vue +75 -0
  255. package/components/Toast/index.ts +12 -0
  256. package/components/index.ts +43 -0
  257. package/components/plugins.ts +89 -0
  258. package/composables/index.ts +2 -0
  259. package/composables/useBreakpoints.ts +30 -0
  260. package/composables/useRender.ts +29 -0
  261. package/entrypoint.sh +19 -0
  262. package/enums/app.ts +5 -0
  263. package/enums/form.ts +25 -0
  264. package/enums/ui.ts +160 -0
  265. package/env.d.ts +8 -0
  266. package/i18n.ts +20 -0
  267. package/index.css +383 -0
  268. package/index.html +22 -0
  269. package/index.ts +14 -0
  270. package/main.ts +31 -0
  271. package/package.json +70 -0
  272. package/plugins/register-component.ts +5 -0
  273. package/postcss.config.js +6 -0
  274. package/services/clipboard.ts +5 -0
  275. package/services/date.ts +27 -0
  276. package/services/form/crud.ts +109 -0
  277. package/services/form/form-data-transformers.ts +148 -0
  278. package/services/form/form-json-transformers.ts +91 -0
  279. package/services/form/form-transformer.ts +54 -0
  280. package/services/form/form-value-transformers.ts +35 -0
  281. package/services/form/form.test.ts +98 -0
  282. package/services/form/form.ts +80 -0
  283. package/services/password.ts +309 -0
  284. package/services/ui.ts +43 -0
  285. package/tailwind.config.js +16 -0
  286. package/tsconfig.json +23 -0
  287. package/types/address.ts +44 -0
  288. package/types/api.ts +28 -0
  289. package/types/common.ts +5 -0
  290. package/types/form.ts +144 -0
  291. package/types/index.ts +5 -0
  292. package/types/ui.ts +55 -0
  293. package/types/website.ts +16 -0
  294. package/vite.config.mts +38 -0
  295. package/vitest.setup.ts +21 -0
@@ -0,0 +1,85 @@
1
+ <script lang="ts">
2
+ let localId = 0;
3
+ </script>
4
+
5
+ <script lang="ts" setup>
6
+ import { useSlots, computed, provide } from "vue";
7
+
8
+ defineOptions({ name: "TFormItem" });
9
+
10
+ const props = withDefaults(
11
+ defineProps<{
12
+ label?: string;
13
+ rules?: any;
14
+ inline?: boolean;
15
+ }>(),
16
+ {
17
+ inline: true,
18
+ },
19
+ );
20
+
21
+ const id = `formitem_${++localId}`;
22
+ const slots = useSlots();
23
+ const errors: string[] = [];
24
+
25
+ const isCheckbox = computed<boolean>(() => {
26
+ if (!slots || !slots.default) {
27
+ return false;
28
+ }
29
+
30
+ const slot: any = slots?.default();
31
+ if (!slot) {
32
+ return false;
33
+ }
34
+
35
+ return (slot[0].type?.props?.key?.default ?? "") === "checkbox";
36
+ });
37
+
38
+ provide("id", id);
39
+ </script>
40
+
41
+ <template>
42
+ <div class="w-full">
43
+ <div
44
+ class="flex items-start my-3"
45
+ :class="{ 'flex-col': !props.inline }"
46
+ >
47
+ <t-graphy-label
48
+ v-if="!isCheckbox && (props.label || slots.label)"
49
+ :text="props.label"
50
+ :for="id"
51
+ :class="{
52
+ 'cursor-pointer': isCheckbox,
53
+ }"
54
+ class="text-right"
55
+ >
56
+ <slot name="label" />
57
+ </t-graphy-label>
58
+ <slot />
59
+ <t-graphy-label
60
+ v-if="isCheckbox && (props.label || slots.label)"
61
+ :invert-controls="true"
62
+ :text="props.label"
63
+ :for="id"
64
+ :class="{
65
+ 'cursor-pointer': isCheckbox,
66
+ }"
67
+ class="text-left"
68
+ >
69
+ <slot name="label" />
70
+ </t-graphy-label>
71
+ </div>
72
+ <div
73
+ v-if="errors"
74
+ class="float-right"
75
+ >
76
+ <span
77
+ v-for="(error, index) in errors"
78
+ class="text-sm text-red-600"
79
+ :key="index"
80
+ >
81
+ {{ error }}
82
+ </span>
83
+ </div>
84
+ </div>
85
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import FormItem from "./FormItem.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, FormItem);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { FormItem };
@@ -0,0 +1,16 @@
1
+ <script lang="ts" setup>
2
+ defineOptions({ name: "TGraphyEmpty" });
3
+
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ text?: string;
7
+ }>(),
8
+ {},
9
+ );
10
+ </script>
11
+
12
+ <template>
13
+ <span class="text-gray-400 select-none">
14
+ {{ props.text }}
15
+ </span>
16
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import GraphyEmpty from "./GraphyEmpty.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, GraphyEmpty);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { GraphyEmpty };
@@ -0,0 +1,34 @@
1
+ <script lang="ts" setup>
2
+ import { inject } from "vue";
3
+
4
+ defineOptions({ name: "TGraphyLabel" });
5
+
6
+ const props = withDefaults(
7
+ defineProps<{
8
+ text?: string;
9
+ invertControls?: boolean;
10
+ injectFormStyle?: boolean;
11
+ }>(),
12
+ {
13
+ invertControls: false,
14
+ injectFormStyle: true,
15
+ },
16
+ );
17
+
18
+ const formStyle = inject("formStyle", { input: "", label: "" });
19
+ </script>
20
+
21
+ <template>
22
+ <label
23
+ class="input-label"
24
+ :class="{
25
+ [formStyle.label]: props.injectFormStyle && !props.invertControls,
26
+ [formStyle.input]: props.injectFormStyle && props.invertControls,
27
+ 'mr-2': props.injectFormStyle && !props.invertControls,
28
+ 'ml-2': props.injectFormStyle && props.invertControls,
29
+ }"
30
+ >
31
+ {{ props.text }}
32
+ <slot />
33
+ </label>
34
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import GraphyLabel from "./GraphyLabel.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, GraphyLabel);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { GraphyLabel };
@@ -0,0 +1,37 @@
1
+ import { GraphyPriceVariant } from "@/enums/ui";
2
+
3
+ export default {
4
+ title: "Typography",
5
+ };
6
+
7
+ const Template1 = (args: any) => ({
8
+ setup() {
9
+ return { args };
10
+ },
11
+ template: `
12
+ <t-graphy-price
13
+ :value="args.value"
14
+ :currency="args.currency"
15
+ :variant="args.variant"
16
+ class="text-2xl"
17
+ />
18
+ `,
19
+ });
20
+
21
+ export const Increase: any = Template1.bind({});
22
+ Increase.args = {
23
+ value: 10.99,
24
+ variant: GraphyPriceVariant.INCREASE,
25
+ currency: {
26
+ symbol: "USD",
27
+ },
28
+ };
29
+
30
+ export const Decrease: any = Template1.bind({});
31
+ Decrease.args = {
32
+ value: 10.99,
33
+ variant: GraphyPriceVariant.DECREASE,
34
+ currency: {
35
+ symbol: "USD",
36
+ },
37
+ };
@@ -0,0 +1,65 @@
1
+ <script lang="ts" setup>
2
+ import { GraphyPriceVariant } from "@/enums/ui";
3
+
4
+ import gsap from "gsap";
5
+ import { useI18n } from "vue-i18n";
6
+ import { reactive, watch } from "vue";
7
+
8
+ defineOptions({ name: "TGraphyPrice" });
9
+
10
+ const props = withDefaults(
11
+ defineProps<{
12
+ value: number;
13
+ currency: string;
14
+ animate?: boolean;
15
+ variant?: `${GraphyPriceVariant}`;
16
+ priceColor?: string;
17
+ }>(),
18
+ {
19
+ animate: false,
20
+ variant: GraphyPriceVariant.DEFAULT,
21
+ priceColor: "color-text",
22
+ },
23
+ );
24
+
25
+ const { n } = useI18n();
26
+ const price = reactive<{ value: number }>({ value: 0 });
27
+
28
+ watch(
29
+ () => props.value,
30
+ (newValue) => {
31
+ if (!props.animate) {
32
+ price.value = newValue;
33
+
34
+ return;
35
+ }
36
+
37
+ gsap.to(price, {
38
+ duration: 0.5,
39
+ ease: "power3.in",
40
+ value: newValue,
41
+ });
42
+ },
43
+ { immediate: true },
44
+ );
45
+ </script>
46
+
47
+ <template>
48
+ <span
49
+ class="tracking-tighter"
50
+ :class="{
51
+ 'color-caipira-green':
52
+ props.variant === GraphyPriceVariant.INCREASE ||
53
+ (props.variant === GraphyPriceVariant.AUTO && price.value > 0),
54
+ 'color-caipira-red':
55
+ props.variant === GraphyPriceVariant.DECREASE ||
56
+ (props.variant === GraphyPriceVariant.AUTO && price.value < 0),
57
+ [props.priceColor]:
58
+ props.variant === GraphyPriceVariant.DEFAULT ||
59
+ (props.variant === GraphyPriceVariant.AUTO &&
60
+ price.value === 0),
61
+ }"
62
+ >
63
+ {{ n(price.value, "currency", props.currency.toUpperCase()) }}
64
+ </span>
65
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import GraphyPrice from "./GraphyPrice.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, GraphyPrice);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { GraphyPrice };
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ defineOptions({ name: "TGraphySubtitle" });
3
+
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ text: string;
7
+ textColor?: string;
8
+ }>(),
9
+ {
10
+ textColor: "color-text",
11
+ },
12
+ );
13
+ </script>
14
+
15
+ <template>
16
+ <h2
17
+ class="text-2xl font-bold mr-2"
18
+ :class="[textColor]"
19
+ >
20
+ {{ props.text }}
21
+ </h2>
22
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import GraphySubtitle from "./GraphySubtitle.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, GraphySubtitle);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { GraphySubtitle };
@@ -0,0 +1,13 @@
1
+ <script lang="ts" setup>
2
+ defineOptions({ name: "TGraphyTitle" });
3
+
4
+ const props = defineProps<{
5
+ text: string;
6
+ }>();
7
+ </script>
8
+
9
+ <template>
10
+ <h1 class="color-caipira-primary-inverted text-3xl select-none">
11
+ {{ props.text }}
12
+ </h1>
13
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import GraphyTitle from "./GraphyTitle.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, GraphyTitle);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { GraphyTitle };
@@ -0,0 +1,84 @@
1
+ <script lang="ts" setup>
2
+ import { Icon, ElementSize } from "@/enums/ui";
3
+
4
+ import uiService from "@/services/ui";
5
+ import { ref, computed, getCurrentInstance, watch } from "vue";
6
+
7
+ defineOptions({ name: "TIcon" });
8
+
9
+ const props = withDefaults(
10
+ defineProps<{
11
+ icon: `${Icon}`;
12
+ role?: string;
13
+ size?: `${ElementSize}`;
14
+ }>(),
15
+ {
16
+ role: "",
17
+ size: ElementSize.DEFAULT,
18
+ },
19
+ );
20
+
21
+ const content = ref<string>("");
22
+ const instance = getCurrentInstance();
23
+ const reference = ref<InstanceType<typeof HTMLElement> | null>(null);
24
+
25
+ const isButton = computed<boolean>(() => {
26
+ return props.role === "button";
27
+ });
28
+
29
+ const shadowRole = computed<string>(() => {
30
+ if (props.role !== "") {
31
+ return props.role;
32
+ }
33
+
34
+ if (instance && uiService.isPopoverActivator(instance)) {
35
+ return "button";
36
+ }
37
+
38
+ return "";
39
+ });
40
+
41
+ const onClick = (e: MouseEvent) => {
42
+ if (instance && uiService.isPopoverActivator(instance)) {
43
+ uiService.onPopoverActivatorClick(e, instance);
44
+ }
45
+ };
46
+
47
+ const refreshContent = async (): Promise<string> => {
48
+ const content = await import(`../../assets/icons/${props.icon}.svg?raw`);
49
+
50
+ return content.default;
51
+ };
52
+
53
+ watch(
54
+ () => props.icon,
55
+ async (newIcon, oldIcon) => {
56
+ if (newIcon === oldIcon) {
57
+ return;
58
+ }
59
+
60
+ content.value = await refreshContent();
61
+ },
62
+ { immediate: true },
63
+ );
64
+
65
+ defineExpose({ reference });
66
+ </script>
67
+
68
+ <template>
69
+ <i
70
+ v-html="content"
71
+ ref="reference"
72
+ class="inline-block fill-current"
73
+ :class="{
74
+ 'w-4': size === ElementSize.EXTRA_SMALL,
75
+ 'w-5': size === ElementSize.SMALL,
76
+ 'w-6': size === ElementSize.DEFAULT,
77
+ 'w-10': size === ElementSize.LARGE,
78
+ 'w-12': size === ElementSize.EXTRA_LARGE,
79
+ 'cursor-pointer': isButton,
80
+ }"
81
+ :role="shadowRole"
82
+ @click="onClick"
83
+ />
84
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import Icon from "./Icon.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, Icon);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { Icon };
@@ -0,0 +1,168 @@
1
+ <script lang="ts" setup>
2
+ import {
3
+ ButtonType,
4
+ ElementSize,
5
+ ElementShape,
6
+ Icon as EIcon,
7
+ ElementVariant,
8
+ } from "@/enums/ui";
9
+
10
+ import uiService from "@/services/ui";
11
+ import { computed, ref, getCurrentInstance } from "vue";
12
+
13
+ import Icon from "@/components/Icon/Icon.vue";
14
+
15
+ export type ButtonProps = {
16
+ to?: any;
17
+ icon: `${EIcon}`;
18
+ href?: string;
19
+ type?: `${ButtonType}`;
20
+ size?: `${ElementSize}`;
21
+ label?: string;
22
+ shape?: `${ElementShape}`;
23
+ target?: string;
24
+ variant?: `${ElementVariant}`;
25
+ multiple?: boolean;
26
+ isOutline?: boolean;
27
+ isDisabled?: boolean;
28
+ injectStyle?: { icon: string };
29
+ disableStyle?: boolean;
30
+ };
31
+
32
+ defineOptions({ name: "TIconButton" });
33
+
34
+ const props = withDefaults(defineProps<ButtonProps>(), {
35
+ href: "",
36
+ type: ButtonType.BUTTON,
37
+ size: ElementSize.DEFAULT,
38
+ label: "",
39
+ shape: ElementShape.ROUNDED,
40
+ target: undefined,
41
+ variant: ElementVariant.DEFAULT,
42
+ multiple: false,
43
+ isOutline: false,
44
+ isDisabled: false,
45
+ injectStyle: () => ({ icon: "" }),
46
+ disableStyle: false,
47
+ });
48
+
49
+ const emit = defineEmits<{
50
+ (e: "upload", val: FileList): void;
51
+ }>();
52
+
53
+ const instance = getCurrentInstance();
54
+ const fileInput = ref<HTMLInputElement>();
55
+ const iconReference = ref<InstanceType<typeof Icon> | null>(null);
56
+
57
+ const link = computed<string | undefined>(() => {
58
+ return props.href ? props.href : undefined;
59
+ });
60
+
61
+ const shadowType = computed<string | undefined>(() => {
62
+ switch (props.type) {
63
+ case ButtonType.LINK:
64
+ return undefined;
65
+ case ButtonType.FILE:
66
+ return "button";
67
+ default:
68
+ return props.type;
69
+ }
70
+ });
71
+
72
+ const value = computed<string | undefined>(() => {
73
+ return props.type === ButtonType.SUBMIT ? props.label : undefined;
74
+ });
75
+
76
+ const element = computed<string>(() => {
77
+ switch (props.type) {
78
+ case ButtonType.SUBMIT:
79
+ return "input";
80
+ case ButtonType.LINK:
81
+ return "a";
82
+ case ButtonType.ROUTER_LINK:
83
+ return "router-link";
84
+ default:
85
+ return "button";
86
+ }
87
+ });
88
+
89
+ const onClick = (e: MouseEvent): void => {
90
+ if (instance && uiService.isPopoverActivator(instance)) {
91
+ uiService.onPopoverActivatorClick(e, instance);
92
+ }
93
+
94
+ if (props.type === ButtonType.SUBMIT) {
95
+ e.preventDefault();
96
+ }
97
+
98
+ if (props.type === ButtonType.FILE) {
99
+ fileInput.value?.click();
100
+ }
101
+ };
102
+
103
+ const onFileChange = (e: Event) => {
104
+ e.stopPropagation();
105
+
106
+ const element: HTMLInputElement = e.target as HTMLInputElement;
107
+ const files: FileList | null = element.files;
108
+
109
+ if (!files || !files.length) {
110
+ return;
111
+ }
112
+
113
+ emit("upload", files);
114
+ };
115
+
116
+ defineExpose({ iconReference });
117
+ </script>
118
+
119
+ <template>
120
+ <component
121
+ :is="element"
122
+ :type="shadowType"
123
+ :href="link"
124
+ :value="value"
125
+ :to="props.to"
126
+ :disabled="props.isDisabled"
127
+ :target="props.target"
128
+ :class="{
129
+ 'opacity-50': props.isDisabled,
130
+
131
+ // Padding
132
+ 'px-1 py-0':
133
+ !props.disableStyle && props.size === ElementSize.EXTRA_SMALL,
134
+ 'px-1': !props.disableStyle && props.size === ElementSize.SMALL,
135
+ 'px-4 py-2 h-10':
136
+ !props.disableStyle && props.size === ElementSize.DEFAULT,
137
+
138
+ // Shape
139
+ 'rounded-full': props.shape === ElementShape.CIRCLE,
140
+ 'input-roundness': props.shape === ElementShape.ROUNDED,
141
+
142
+ // Cursor
143
+ 'cursor-pointer': !props.isDisabled,
144
+ 'cursor-not-allowed': props.isDisabled,
145
+ }"
146
+ class="input-outline inline-flex items-center justify-center"
147
+ role="button"
148
+ @click="onClick"
149
+ >
150
+ <slot />
151
+ <t-icon
152
+ ref="iconReference"
153
+ :size="props.size"
154
+ :icon="props.icon"
155
+ :class="{
156
+ [props.injectStyle.icon]: true,
157
+ }"
158
+ />
159
+ <input
160
+ v-if="props.type === 'file'"
161
+ :multiple="props.multiple"
162
+ @change="onFileChange"
163
+ type="file"
164
+ ref="fileInput"
165
+ class="hidden"
166
+ />
167
+ </component>
168
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ import registerComponent from "@/plugins/register-component";
3
+
4
+ import IconButton from "./IconButton.vue";
5
+
6
+ export default {
7
+ install(app: App) {
8
+ registerComponent(app, IconButton);
9
+ },
10
+ } as Plugin;
11
+
12
+ export { IconButton };