@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.
- package/.editorconfig +12 -0
- package/.prettierrc +5 -0
- package/.storybook/main.ts +25 -0
- package/.storybook/preview-body.html +3 -0
- package/.storybook/preview.ts +24 -0
- package/App.vue +1 -0
- package/Dockerfile +21 -0
- package/LICENSE +674 -0
- package/README.md +11 -0
- package/assets/icons/account.svg +1 -0
- package/assets/icons/alert-octagon-outline.svg +1 -0
- package/assets/icons/alert-octagon.svg +1 -0
- package/assets/icons/archive-outline.svg +1 -0
- package/assets/icons/archive.svg +1 -0
- package/assets/icons/arrow-left.svg +1 -0
- package/assets/icons/arrow-right.svg +1 -0
- package/assets/icons/bank-outline.svg +1 -0
- package/assets/icons/bank.svg +1 -0
- package/assets/icons/camera.svg +1 -0
- package/assets/icons/cards-outline.svg +1 -0
- package/assets/icons/cards-variant.svg +1 -0
- package/assets/icons/cart-outline.svg +1 -0
- package/assets/icons/chart-box-outline.svg +1 -0
- package/assets/icons/chart-box.svg +1 -0
- package/assets/icons/check-circle-outline.svg +1 -0
- package/assets/icons/check-circle.svg +1 -0
- package/assets/icons/check.svg +1 -0
- package/assets/icons/checkbox-dark.svg +1 -0
- package/assets/icons/checkbox-indeterminate-dark.svg +1 -0
- package/assets/icons/checkbox-indeterminate.svg +1 -0
- package/assets/icons/checkbox.svg +1 -0
- package/assets/icons/chevron-down.svg +1 -0
- package/assets/icons/chevron-left.svg +1 -0
- package/assets/icons/chevron-right.svg +1 -0
- package/assets/icons/chevron-up.svg +1 -0
- package/assets/icons/circle.svg +1 -0
- package/assets/icons/clock.svg +1 -0
- package/assets/icons/close-circle-outline.svg +1 -0
- package/assets/icons/close-circle.svg +1 -0
- package/assets/icons/close.svg +1 -0
- package/assets/icons/cog.svg +1 -0
- package/assets/icons/color-fill.svg +1 -0
- package/assets/icons/copy.svg +1 -0
- package/assets/icons/credit-card-plus.svg +1 -0
- package/assets/icons/credit-card.svg +1 -0
- package/assets/icons/currency.svg +1 -0
- package/assets/icons/database.svg +1 -0
- package/assets/icons/dots-grid.svg +1 -0
- package/assets/icons/dots-vertical.svg +1 -0
- package/assets/icons/email-open-outline.svg +1 -0
- package/assets/icons/email-outline.svg +1 -0
- package/assets/icons/eye-off.svg +1 -0
- package/assets/icons/eye.svg +1 -0
- package/assets/icons/file-document-plus-outline.svg +1 -0
- package/assets/icons/filmstrip.svg +1 -0
- package/assets/icons/filter.svg +1 -0
- package/assets/icons/fullscreen-exit.svg +1 -0
- package/assets/icons/fullscreen.svg +1 -0
- package/assets/icons/group.svg +1 -0
- package/assets/icons/image-album-outline.svg +1 -0
- package/assets/icons/image-album.svg +1 -0
- package/assets/icons/image-outline.svg +1 -0
- package/assets/icons/image.svg +1 -0
- package/assets/icons/info-outline.svg +1 -0
- package/assets/icons/key-chain.svg +1 -0
- package/assets/icons/key-variant.svg +1 -0
- package/assets/icons/key.svg +1 -0
- package/assets/icons/listbox-outline.svg +1 -0
- package/assets/icons/loading.svg +1 -0
- package/assets/icons/lock-outline.svg +1 -0
- package/assets/icons/lock.svg +1 -0
- package/assets/icons/logout.svg +1 -0
- package/assets/icons/menu-down.svg +1 -0
- package/assets/icons/menu-left.svg +1 -0
- package/assets/icons/menu-right.svg +1 -0
- package/assets/icons/menu.svg +1 -0
- package/assets/icons/minus-circle-outline.svg +1 -0
- package/assets/icons/minus-circle.svg +1 -0
- package/assets/icons/minus.svg +1 -0
- package/assets/icons/moon.svg +1 -0
- package/assets/icons/open-in-new.svg +1 -0
- package/assets/icons/pencil.svg +1 -0
- package/assets/icons/people.svg +1 -0
- package/assets/icons/piggy-bank-outline.svg +1 -0
- package/assets/icons/plus-circle-outline.svg +1 -0
- package/assets/icons/plus-circle.svg +1 -0
- package/assets/icons/plus.svg +1 -0
- package/assets/icons/qrcode-scan.svg +1 -0
- package/assets/icons/radio-dark.svg +1 -0
- package/assets/icons/radio.svg +1 -0
- package/assets/icons/refresh.svg +1 -0
- package/assets/icons/save.svg +1 -0
- package/assets/icons/search.svg +1 -0
- package/assets/icons/spotlight.svg +1 -0
- package/assets/icons/store-outline.svg +1 -0
- package/assets/icons/sun.svg +1 -0
- package/assets/icons/swap-horizontal.svg +1 -0
- package/assets/icons/swap-left.svg +1 -0
- package/assets/icons/swap-right.svg +1 -0
- package/assets/icons/swap.svg +1 -0
- package/assets/icons/system-theme.svg +1 -0
- package/assets/icons/tag-outline.svg +1 -0
- package/assets/icons/trash-can-outline.svg +1 -0
- package/assets/icons/trash-can.svg +1 -0
- package/assets/icons/upload.svg +1 -0
- package/assets/icons/user-circle.svg +1 -0
- package/assets/icons/zip-box.svg +1 -0
- package/assets/images/fs/apk.svg +11 -0
- package/assets/images/fs/bmp.svg +7 -0
- package/assets/images/fs/css.svg +8 -0
- package/assets/images/fs/doc.svg +9 -0
- package/assets/images/fs/docx.svg +9 -0
- package/assets/images/fs/folder-adwaita.svg +8 -0
- package/assets/images/fs/folder-black.svg +8 -0
- package/assets/images/fs/folder-brown.svg +8 -0
- package/assets/images/fs/folder-grey.svg +8 -0
- package/assets/images/fs/folder-nordic.svg +8 -0
- package/assets/images/fs/folder-orange.svg +8 -0
- package/assets/images/fs/folder-palebrown.svg +8 -0
- package/assets/images/fs/folder-paleorange.svg +8 -0
- package/assets/images/fs/folder-teal.svg +8 -0
- package/assets/images/fs/folder-white.svg +8 -0
- package/assets/images/fs/folder-yellow.svg +8 -0
- package/assets/images/fs/gif.svg +7 -0
- package/assets/images/fs/go.svg +9 -0
- package/assets/images/fs/ics.svg +24 -0
- package/assets/images/fs/iso.svg +10 -0
- package/assets/images/fs/jpeg.svg +7 -0
- package/assets/images/fs/jpg.svg +7 -0
- package/assets/images/fs/js.svg +9 -0
- package/assets/images/fs/json.svg +9 -0
- package/assets/images/fs/lua.svg +9 -0
- package/assets/images/fs/m4v.svg +7 -0
- package/assets/images/fs/md.svg +10 -0
- package/assets/images/fs/mov.svg +7 -0
- package/assets/images/fs/mp3.svg +9 -0
- package/assets/images/fs/mp4.svg +7 -0
- package/assets/images/fs/pdf.svg +9 -0
- package/assets/images/fs/pgp.svg +8 -0
- package/assets/images/fs/php.svg +9 -0
- package/assets/images/fs/png.svg +7 -0
- package/assets/images/fs/ppt.svg +9 -0
- package/assets/images/fs/py.svg +9 -0
- package/assets/images/fs/rar.svg +20 -0
- package/assets/images/fs/rpm.svg +7 -0
- package/assets/images/fs/rs.svg +9 -0
- package/assets/images/fs/sh.svg +9 -0
- package/assets/images/fs/tar.svg +20 -0
- package/assets/images/fs/txt.svg +8 -0
- package/assets/images/fs/unknown.svg +8 -0
- package/assets/images/fs/xls.svg +9 -0
- package/assets/images/fs/xlsx.svg +9 -0
- package/assets/images/fs/xml.svg +8 -0
- package/assets/images/fs/yaml.svg +9 -0
- package/assets/images/fs/zip.svg +20 -0
- package/components/Avatar/Avatar.story.ts +55 -0
- package/components/Avatar/Avatar.vue +82 -0
- package/components/Avatar/index.ts +12 -0
- package/components/Backdrop/Backdrop.vue +27 -0
- package/components/Backdrop/index.ts +12 -0
- package/components/Button/Button.story.ts +74 -0
- package/components/Button/Button.vue +230 -0
- package/components/Button/index.ts +12 -0
- package/components/ButtonCopy/ButtonCopy.vue +61 -0
- package/components/ButtonCopy/index.ts +12 -0
- package/components/Drawer/Drawer.vue +102 -0
- package/components/Drawer/index.ts +12 -0
- package/components/Dropdown/Dropdown.vue +258 -0
- package/components/Dropdown/index.ts +12 -0
- package/components/EventListener/EventListener.vue +12 -0
- package/components/FileDrop/FileDrop.vue +116 -0
- package/components/FileDrop/index.ts +12 -0
- package/components/Form/Form.spec.ts +72 -0
- package/components/Form/Form.vue +134 -0
- package/components/Form/index.ts +12 -0
- package/components/FormItem/FormItem.vue +85 -0
- package/components/FormItem/index.ts +12 -0
- package/components/GraphyEmpty/GraphyEmpty.vue +16 -0
- package/components/GraphyEmpty/index.ts +12 -0
- package/components/GraphyLabel/GraphyLabel.vue +34 -0
- package/components/GraphyLabel/index.ts +12 -0
- package/components/GraphyPrice/GraphyPrice.story.ts +37 -0
- package/components/GraphyPrice/GraphyPrice.vue +65 -0
- package/components/GraphyPrice/index.ts +12 -0
- package/components/GraphySubtitle/GraphySubtitle.vue +22 -0
- package/components/GraphySubtitle/index.ts +12 -0
- package/components/GraphyTitle/GraphyTitle.vue +13 -0
- package/components/GraphyTitle/index.ts +12 -0
- package/components/Icon/Icon.vue +84 -0
- package/components/Icon/index.ts +12 -0
- package/components/IconButton/IconButton.vue +168 -0
- package/components/IconButton/index.ts +12 -0
- package/components/InputAvatar/InputAvatar.vue +63 -0
- package/components/InputAvatar/index.ts +12 -0
- package/components/InputCheckbox/InputCheckbox.vue +77 -0
- package/components/InputCheckbox/index.ts +12 -0
- package/components/InputColor/InputColor.vue +54 -0
- package/components/InputColor/index.ts +12 -0
- package/components/InputDate/InputDate.story.ts +15 -0
- package/components/InputDate/InputDate.vue +368 -0
- package/components/InputDate/index.ts +12 -0
- package/components/InputMultiplier/InputMultiplier.vue +144 -0
- package/components/InputMultiplier/index.ts +12 -0
- package/components/InputPassword/InputPassword.vue +168 -0
- package/components/InputPassword/index.ts +12 -0
- package/components/InputPhone/InputPhone.vue +125 -0
- package/components/InputPhone/index.ts +12 -0
- package/components/InputPrice/InputPrice.vue +96 -0
- package/components/InputPrice/index.ts +12 -0
- package/components/InputRadio/InputRadio.vue +41 -0
- package/components/InputRadio/InputRadioGroup.story.ts +24 -0
- package/components/InputRadio/InputRadioGroup.vue +48 -0
- package/components/InputRadio/index.ts +14 -0
- package/components/InputSelect/InputSelect.story.ts +87 -0
- package/components/InputSelect/InputSelect.vue +507 -0
- package/components/InputSelect/index.ts +12 -0
- package/components/InputSwitch/InputSwitch.story.ts +34 -0
- package/components/InputSwitch/InputSwitch.vue +82 -0
- package/components/InputSwitch/index.ts +12 -0
- package/components/InputText/InputText.vue +62 -0
- package/components/InputText/index.ts +12 -0
- package/components/InputTextarea/InputTextarea.vue +64 -0
- package/components/InputTextarea/index.ts +12 -0
- package/components/LineChart/LineChart.vue +14 -0
- package/components/LineChart/index.ts +12 -0
- package/components/Modal/Modal.vue +106 -0
- package/components/Modal/index.ts +12 -0
- package/components/ModalForm/ModalForm.vue +141 -0
- package/components/ModalForm/index.ts +12 -0
- package/components/Pagination/Pagination.story.ts +15 -0
- package/components/Pagination/Pagination.vue +138 -0
- package/components/Pagination/index.ts +12 -0
- package/components/PieChart/PieChart.vue +14 -0
- package/components/PieChart/index.ts +12 -0
- package/components/Popconfirm/Popconfirm.vue +80 -0
- package/components/Popconfirm/index.ts +12 -0
- package/components/Popover/Popover.vue +133 -0
- package/components/Popover/index.ts +12 -0
- package/components/ProgressCircle/ProgressCircle.story.ts +31 -0
- package/components/ProgressCircle/ProgressCircle.vue +82 -0
- package/components/ProgressCircle/index.ts +12 -0
- package/components/ProgressLine/ProgressLine.story.ts +27 -0
- package/components/ProgressLine/ProgressLine.vue +104 -0
- package/components/ProgressLine/index.ts +12 -0
- package/components/SensitiveInfo/SensitiveInfo.vue +18 -0
- package/components/SensitiveInfo/index.ts +12 -0
- package/components/Tab/Tab.vue +58 -0
- package/components/Tab/index.ts +12 -0
- package/components/Table/Table.story.ts +32 -0
- package/components/Table/Table.vue +318 -0
- package/components/Table/index.ts +12 -0
- package/components/Tag/Tag.vue +73 -0
- package/components/Tag/index.ts +12 -0
- package/components/Toast/Toast.vue +75 -0
- package/components/Toast/index.ts +12 -0
- package/components/index.ts +43 -0
- package/components/plugins.ts +89 -0
- package/composables/index.ts +2 -0
- package/composables/useBreakpoints.ts +30 -0
- package/composables/useRender.ts +29 -0
- package/entrypoint.sh +19 -0
- package/enums/app.ts +5 -0
- package/enums/form.ts +25 -0
- package/enums/ui.ts +160 -0
- package/env.d.ts +8 -0
- package/i18n.ts +20 -0
- package/index.css +383 -0
- package/index.html +22 -0
- package/index.ts +14 -0
- package/main.ts +31 -0
- package/package.json +70 -0
- package/plugins/register-component.ts +5 -0
- package/postcss.config.js +6 -0
- package/services/clipboard.ts +5 -0
- package/services/date.ts +27 -0
- package/services/form/crud.ts +109 -0
- package/services/form/form-data-transformers.ts +148 -0
- package/services/form/form-json-transformers.ts +91 -0
- package/services/form/form-transformer.ts +54 -0
- package/services/form/form-value-transformers.ts +35 -0
- package/services/form/form.test.ts +98 -0
- package/services/form/form.ts +80 -0
- package/services/password.ts +309 -0
- package/services/ui.ts +43 -0
- package/tailwind.config.js +16 -0
- package/tsconfig.json +23 -0
- package/types/address.ts +44 -0
- package/types/api.ts +28 -0
- package/types/common.ts +5 -0
- package/types/form.ts +144 -0
- package/types/index.ts +5 -0
- package/types/ui.ts +55 -0
- package/types/website.ts +16 -0
- package/vite.config.mts +38 -0
- package/vitest.setup.ts +21 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let id = 0;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
6
|
+
import { ref, watch } from "vue";
|
|
7
|
+
|
|
8
|
+
defineOptions({ name: "TInputSwitch" });
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(
|
|
11
|
+
defineProps<{
|
|
12
|
+
label?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
modelValue?: boolean;
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
label: "",
|
|
18
|
+
disabled: false,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits<{
|
|
23
|
+
(e: "update:modelValue", val: boolean): void;
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
const name = `switch_${++id}`;
|
|
27
|
+
const checked = ref<boolean>(false);
|
|
28
|
+
|
|
29
|
+
const onInput = () => {
|
|
30
|
+
const value = !checked.value;
|
|
31
|
+
|
|
32
|
+
emit("update:modelValue", value);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
watch(
|
|
36
|
+
() => props.modelValue,
|
|
37
|
+
(newValue?: boolean) => {
|
|
38
|
+
checked.value = !!newValue;
|
|
39
|
+
},
|
|
40
|
+
{ immediate: true },
|
|
41
|
+
);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div>
|
|
46
|
+
<div
|
|
47
|
+
class="relative inline-block w-12 mr-2 align-middle select-none"
|
|
48
|
+
:class="{
|
|
49
|
+
'rounded-full': !checked,
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<input
|
|
53
|
+
v-model="checked"
|
|
54
|
+
type="checkbox"
|
|
55
|
+
class="absolute block w-6 h-6 rounded-full appearance-none cursor-pointer bg-caipira-primary border input-outline"
|
|
56
|
+
:class="{
|
|
57
|
+
'right-0 border-caipira-primary-inverted': checked,
|
|
58
|
+
'border-caipira-tertiary': !checked,
|
|
59
|
+
}"
|
|
60
|
+
:name="name"
|
|
61
|
+
:id="name"
|
|
62
|
+
:disabled="disabled"
|
|
63
|
+
@input="onInput"
|
|
64
|
+
/>
|
|
65
|
+
<label
|
|
66
|
+
:for="name"
|
|
67
|
+
:class="{
|
|
68
|
+
'bg-caipira-primary-inverted': checked,
|
|
69
|
+
'bg-caipira-tertiary': !checked,
|
|
70
|
+
}"
|
|
71
|
+
class="block overflow-hidden h-6 rounded-full cursor-pointer"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
<label
|
|
75
|
+
v-if="label"
|
|
76
|
+
class="text-base cursor-pointer"
|
|
77
|
+
:for="name"
|
|
78
|
+
>
|
|
79
|
+
{{ label }}
|
|
80
|
+
</label>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App, Plugin } from "vue";
|
|
2
|
+
import registerComponent from "@/plugins/register-component";
|
|
3
|
+
|
|
4
|
+
import InputSwitch from "./InputSwitch.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
registerComponent(app, InputSwitch);
|
|
9
|
+
},
|
|
10
|
+
} as Plugin;
|
|
11
|
+
|
|
12
|
+
export { InputSwitch };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, inject } from "vue";
|
|
3
|
+
|
|
4
|
+
defineOptions({ name: "TInputText" });
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
autocomplete?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
disableStyle?: boolean;
|
|
14
|
+
}>(),
|
|
15
|
+
{
|
|
16
|
+
modelValue: "",
|
|
17
|
+
type: "text",
|
|
18
|
+
placeholder: undefined,
|
|
19
|
+
autocomplete: undefined,
|
|
20
|
+
disabled: false,
|
|
21
|
+
disableStyle: false,
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const emit = defineEmits<{
|
|
26
|
+
(e: "update:modelValue", val: string): void;
|
|
27
|
+
(e: "keyup.enter", val: any): void;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
const id = inject("id", "");
|
|
31
|
+
const invalid = inject("invalid", false);
|
|
32
|
+
const formStyle = inject("formStyle", { input: "w-full" });
|
|
33
|
+
const validated = inject("validated", false);
|
|
34
|
+
|
|
35
|
+
const value = computed({
|
|
36
|
+
get: () => {
|
|
37
|
+
return props.modelValue;
|
|
38
|
+
},
|
|
39
|
+
set: (value: string) => {
|
|
40
|
+
emit("update:modelValue", value);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<input
|
|
47
|
+
v-model="value"
|
|
48
|
+
:type="props.type"
|
|
49
|
+
:class="{
|
|
50
|
+
'h-9 input-bg-color input-text-color input-outline border input-border input-roundnes input-padding input-roundness':
|
|
51
|
+
!props.disableStyle,
|
|
52
|
+
[formStyle.input]: !props.disableStyle,
|
|
53
|
+
'border-red-500': !validated && invalid,
|
|
54
|
+
'border-emerald-500': validated && !invalid,
|
|
55
|
+
}"
|
|
56
|
+
:id="id"
|
|
57
|
+
:placeholder="props.placeholder"
|
|
58
|
+
:autocomplete="props.autocomplete"
|
|
59
|
+
:disabled="props.disabled"
|
|
60
|
+
v-bind="$attrs"
|
|
61
|
+
/>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App, Plugin } from "vue";
|
|
2
|
+
import registerComponent from "@/plugins/register-component";
|
|
3
|
+
|
|
4
|
+
import InputText from "./InputText.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
registerComponent(app, InputText);
|
|
9
|
+
},
|
|
10
|
+
} as Plugin;
|
|
11
|
+
|
|
12
|
+
export { InputText };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, inject, watch } from "vue";
|
|
3
|
+
|
|
4
|
+
defineOptions({ name: "TInputTextarea" });
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
type?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
modelValue?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
disableStyle?: boolean;
|
|
13
|
+
}>(),
|
|
14
|
+
{
|
|
15
|
+
type: "text",
|
|
16
|
+
disabled: false,
|
|
17
|
+
placeholder: undefined,
|
|
18
|
+
disableStyle: false,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits<{
|
|
23
|
+
(e: "update:modelValue", val: string): void;
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
const text = ref<string>("");
|
|
27
|
+
const invalid = inject("invalid", false);
|
|
28
|
+
const formStyle = inject("formStyle", { input: "w-full" });
|
|
29
|
+
const validated = inject("validated", false);
|
|
30
|
+
const errorMessage = ref<string>("");
|
|
31
|
+
|
|
32
|
+
const onChange = ({ target }: Event) => {
|
|
33
|
+
const value = (target as HTMLInputElement).value;
|
|
34
|
+
|
|
35
|
+
emit("update:modelValue", value);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
watch(
|
|
39
|
+
() => props.modelValue,
|
|
40
|
+
(value?: string) => {
|
|
41
|
+
if (value) {
|
|
42
|
+
text.value = value;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{ immediate: true },
|
|
46
|
+
);
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<textarea
|
|
51
|
+
:value="text"
|
|
52
|
+
:type="type"
|
|
53
|
+
class="min-h-9 input-bg-color input-text-color input-outline border input-border input-roundnes input-padding input-roundness"
|
|
54
|
+
:class="{
|
|
55
|
+
'border rounded h-9': !disableStyle,
|
|
56
|
+
[formStyle.input]: !disableStyle,
|
|
57
|
+
'border-red-500': !validated && invalid,
|
|
58
|
+
'border-emerald-500': validated && !invalid,
|
|
59
|
+
}"
|
|
60
|
+
:placeholder="placeholder"
|
|
61
|
+
:disabled="disabled"
|
|
62
|
+
@input="onChange"
|
|
63
|
+
/>
|
|
64
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App, Plugin } from "vue";
|
|
2
|
+
import registerComponent from "@/plugins/register-component";
|
|
3
|
+
|
|
4
|
+
import InputTextarea from "./InputTextarea.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
registerComponent(app, InputTextarea);
|
|
9
|
+
},
|
|
10
|
+
} as Plugin;
|
|
11
|
+
|
|
12
|
+
export { InputTextarea };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App, Plugin } from "vue";
|
|
2
|
+
import registerComponent from "@/plugins/register-component";
|
|
3
|
+
|
|
4
|
+
import LineChart from "./LineChart.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
registerComponent(app, LineChart);
|
|
9
|
+
},
|
|
10
|
+
} as Plugin;
|
|
11
|
+
|
|
12
|
+
export { LineChart };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { onMounted, ref } from "vue";
|
|
3
|
+
|
|
4
|
+
import Backdrop from "@/components/Backdrop/Backdrop.vue";
|
|
5
|
+
|
|
6
|
+
defineOptions({ name: "TModal" });
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
title?: string;
|
|
11
|
+
showHeader?: boolean;
|
|
12
|
+
injectStyle?: any;
|
|
13
|
+
hasBackdrop?: boolean;
|
|
14
|
+
disableStyle?: boolean;
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
title: "",
|
|
18
|
+
showHeader: true,
|
|
19
|
+
injectStyle: () => ({ wrapper: "", body: "", container: "" }),
|
|
20
|
+
hasBackdrop: true,
|
|
21
|
+
disableStyle: false,
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const modal = ref<InstanceType<typeof HTMLElement> | null>(null);
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
(e: "closed"): void;
|
|
29
|
+
}>();
|
|
30
|
+
|
|
31
|
+
const onClose = (e: KeyboardEvent | MouseEvent) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
|
|
34
|
+
emit("closed");
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
onMounted(() => {
|
|
38
|
+
modal.value?.focus();
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div
|
|
44
|
+
class="fixed inset-0 focus-visible:outline-none z-10"
|
|
45
|
+
:class="{
|
|
46
|
+
'flex items-center': !props.disableStyle,
|
|
47
|
+
[props.injectStyle.wrapper]: true,
|
|
48
|
+
}"
|
|
49
|
+
tabindex="-1"
|
|
50
|
+
ref="modal"
|
|
51
|
+
@keyup.esc="onClose"
|
|
52
|
+
>
|
|
53
|
+
<Backdrop
|
|
54
|
+
v-if="props.hasBackdrop"
|
|
55
|
+
class="z-10"
|
|
56
|
+
@click="onClose"
|
|
57
|
+
/>
|
|
58
|
+
<div
|
|
59
|
+
class="z-10 w-full md:w-[36rem] mx-auto"
|
|
60
|
+
:class="{
|
|
61
|
+
'bg-caipira-primary input-roundness shadow-2xl':
|
|
62
|
+
!props.disableStyle,
|
|
63
|
+
[props.injectStyle.container]: true,
|
|
64
|
+
}"
|
|
65
|
+
>
|
|
66
|
+
<div
|
|
67
|
+
v-if="props.showHeader"
|
|
68
|
+
class="flex justify-between items-center p-4 border-b border-color"
|
|
69
|
+
>
|
|
70
|
+
<div class="">
|
|
71
|
+
<span
|
|
72
|
+
v-if="props.title"
|
|
73
|
+
class="inline-block font-semibold uppercase mr-8"
|
|
74
|
+
>
|
|
75
|
+
{{ props.title }}
|
|
76
|
+
</span>
|
|
77
|
+
<slot
|
|
78
|
+
v-if="$slots.header"
|
|
79
|
+
name="header"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<t-icon
|
|
83
|
+
icon="close"
|
|
84
|
+
role="button"
|
|
85
|
+
class="text-neutral-600"
|
|
86
|
+
@click="onClose"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
<div
|
|
90
|
+
class="flex flex-col flex-1 overflow-y-auto scrollbar"
|
|
91
|
+
style="max-height: 80vh"
|
|
92
|
+
:class="{
|
|
93
|
+
[props.injectStyle.body]: true,
|
|
94
|
+
}"
|
|
95
|
+
>
|
|
96
|
+
<slot />
|
|
97
|
+
</div>
|
|
98
|
+
<div
|
|
99
|
+
v-if="$slots.footer"
|
|
100
|
+
class="flex flex-row items-center justify-between p-4 border-t border-color"
|
|
101
|
+
>
|
|
102
|
+
<slot name="footer" />
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App, Plugin } from "vue";
|
|
2
|
+
import registerComponent from "@/plugins/register-component";
|
|
3
|
+
|
|
4
|
+
import Modal from "./Modal.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
registerComponent(app, Modal);
|
|
9
|
+
},
|
|
10
|
+
} as Plugin;
|
|
11
|
+
|
|
12
|
+
export { Modal };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { SelectOption } from "@/types/form";
|
|
3
|
+
|
|
4
|
+
import CrudService from "@/services/form/crud";
|
|
5
|
+
import { computed, ref } from "vue";
|
|
6
|
+
|
|
7
|
+
type Form = {
|
|
8
|
+
key: string;
|
|
9
|
+
title: string;
|
|
10
|
+
component: any;
|
|
11
|
+
pinnable?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
defineOptions({ name: "TModalForm" });
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(
|
|
17
|
+
defineProps<{
|
|
18
|
+
forms: Form[];
|
|
19
|
+
options?: SelectOption[];
|
|
20
|
+
formClass?: string;
|
|
21
|
+
}>(),
|
|
22
|
+
{
|
|
23
|
+
options: () => [],
|
|
24
|
+
formClass: "",
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits<{
|
|
29
|
+
(e: "saved"): void;
|
|
30
|
+
(e: "closed"): void;
|
|
31
|
+
}>();
|
|
32
|
+
|
|
33
|
+
const form = ref<InstanceType<typeof CrudService> | null>(null);
|
|
34
|
+
const keepOpen = ref<boolean>(false);
|
|
35
|
+
const currentKey = ref<string>("");
|
|
36
|
+
const formReference = ref<any | null>(null);
|
|
37
|
+
|
|
38
|
+
const current = computed<Form | undefined>(() => {
|
|
39
|
+
return props.forms.find((form) => form.key === currentKey.value);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const open = (key: string, id?: string) => {
|
|
43
|
+
currentKey.value = key;
|
|
44
|
+
form.value = new CrudService(current.value?.title!, formReference);
|
|
45
|
+
|
|
46
|
+
if (id) {
|
|
47
|
+
form.value?.edit(id);
|
|
48
|
+
} else {
|
|
49
|
+
form.value?.show();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onSave = () => {
|
|
54
|
+
form.value?.onSave(!keepOpen.value);
|
|
55
|
+
emit("saved");
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const deleteItem = () => {
|
|
59
|
+
form.value?.delete();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onClose = () => {
|
|
63
|
+
form.value?.close();
|
|
64
|
+
emit("closed");
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
defineExpose({ open, delete: deleteItem });
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<t-modal
|
|
72
|
+
v-if="form?.visible"
|
|
73
|
+
:title="form?.title"
|
|
74
|
+
@closed="onClose"
|
|
75
|
+
>
|
|
76
|
+
<template v-slot:header>
|
|
77
|
+
<t-input-switch
|
|
78
|
+
v-if="current?.pinnable && !form?.isEditing"
|
|
79
|
+
v-model="keepOpen"
|
|
80
|
+
label="Keep open"
|
|
81
|
+
class="mt-4"
|
|
82
|
+
/>
|
|
83
|
+
</template>
|
|
84
|
+
<component
|
|
85
|
+
v-if="current"
|
|
86
|
+
:is="current.component"
|
|
87
|
+
:id="`${form?.id}`"
|
|
88
|
+
:class="[props.formClass]"
|
|
89
|
+
ref="formReference"
|
|
90
|
+
@deleted="() => form?.onDelete()"
|
|
91
|
+
@saved="onSave"
|
|
92
|
+
/>
|
|
93
|
+
<template v-slot:footer>
|
|
94
|
+
<div
|
|
95
|
+
v-if="props.options.length"
|
|
96
|
+
class="inline-flex"
|
|
97
|
+
>
|
|
98
|
+
<t-popover placement="bottom-start">
|
|
99
|
+
<t-icon
|
|
100
|
+
icon="dots-vertical"
|
|
101
|
+
class="text-lg mr-6"
|
|
102
|
+
size="xs"
|
|
103
|
+
role="button"
|
|
104
|
+
aria-describedby="tooltip"
|
|
105
|
+
/>
|
|
106
|
+
<template v-slot:content>
|
|
107
|
+
<t-dropdown :items="props.options" />
|
|
108
|
+
</template>
|
|
109
|
+
</t-popover>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<t-popconfirm
|
|
113
|
+
v-else
|
|
114
|
+
:title="`Are you sure you want to delete this ${current?.title}?`"
|
|
115
|
+
@confirm="() => form?.delete()"
|
|
116
|
+
>
|
|
117
|
+
<t-button
|
|
118
|
+
v-if="form?.isEditing"
|
|
119
|
+
:is-disabled="form?.isLoading"
|
|
120
|
+
variant="danger"
|
|
121
|
+
icon="trash-can-outline"
|
|
122
|
+
label="Delete"
|
|
123
|
+
size="sm"
|
|
124
|
+
aria-describedby="tooltip"
|
|
125
|
+
/>
|
|
126
|
+
</t-popconfirm>
|
|
127
|
+
|
|
128
|
+
<t-button
|
|
129
|
+
variant="success"
|
|
130
|
+
icon="save"
|
|
131
|
+
:class="{
|
|
132
|
+
'ml-auto': !form?.isEditing,
|
|
133
|
+
}"
|
|
134
|
+
size="sm"
|
|
135
|
+
label="Save"
|
|
136
|
+
:is-disabled="form?.isLoading"
|
|
137
|
+
@click="() => form?.save()"
|
|
138
|
+
/>
|
|
139
|
+
</template>
|
|
140
|
+
</t-modal>
|
|
141
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App, Plugin } from "vue";
|
|
2
|
+
import registerComponent from "@/plugins/register-component";
|
|
3
|
+
|
|
4
|
+
import ModalForm from "./ModalForm.vue";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
registerComponent(app, ModalForm);
|
|
9
|
+
},
|
|
10
|
+
} as Plugin;
|
|
11
|
+
|
|
12
|
+
export { ModalForm };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: "Pagination",
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const Template1: any = (args: any) => ({
|
|
6
|
+
setup() {
|
|
7
|
+
return { args };
|
|
8
|
+
},
|
|
9
|
+
template: `<t-pagination :info="args.info" />`,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const Pagination = Template1.bind({});
|
|
13
|
+
Pagination.args = {
|
|
14
|
+
info: {},
|
|
15
|
+
};
|