@luizleon/sf.prefeiturasp.vuecomponents 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 (93) hide show
  1. package/dist/components/content/Content.d.ts +21 -0
  2. package/dist/components/icon/Icon.d.ts +39 -0
  3. package/dist/components/internal/LoadingCircle.d.ts +2 -0
  4. package/dist/components/internal/LogoutIcon.d.ts +2 -0
  5. package/dist/components/internal/MenuIcon.d.ts +2 -0
  6. package/dist/components/internal/ScrollToTop.d.ts +2 -0
  7. package/dist/components/internal/ThemeToggle.d.ts +2 -0
  8. package/dist/components/internal/cssClassBuilder.d.ts +29 -0
  9. package/dist/components/layout/Layout.d.ts +12 -0
  10. package/dist/components/navmenulink/NavMenuLink.d.ts +12 -0
  11. package/dist/enum/cor.d.ts +9 -0
  12. package/dist/enum/index.d.ts +2 -0
  13. package/dist/enum/tamanho.d.ts +5 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/lib.es.js +2724 -0
  16. package/dist/lib.umd.js +79 -0
  17. package/dist/services/authService.d.ts +20 -0
  18. package/dist/services/dialogService.d.ts +12 -0
  19. package/dist/services/navMenuService.d.ts +9 -0
  20. package/dist/style.css +1 -0
  21. package/package.json +31 -0
  22. package/src/components/content/Content.d.ts +35 -0
  23. package/src/components/content/Content.vue +41 -0
  24. package/src/components/icon/Icon.d.ts +38 -0
  25. package/src/components/icon/Icon.vue +43 -0
  26. package/src/components/internal/LoadingCircle.vue +16 -0
  27. package/src/components/internal/LogoutIcon.vue +14 -0
  28. package/src/components/internal/MenuIcon.vue +13 -0
  29. package/src/components/internal/ScrollToTop.vue +26 -0
  30. package/src/components/internal/ThemeToggle.ts +41 -0
  31. package/src/components/internal/ThemeToggle.vue +23 -0
  32. package/src/components/internal/cssClassBuilder.ts +44 -0
  33. package/src/components/layout/Layout.d.ts +44 -0
  34. package/src/components/layout/Layout.vue +63 -0
  35. package/src/components/navmenulink/NavMenuLink.d.ts +34 -0
  36. package/src/components/navmenulink/NavMenuLink.vue +41 -0
  37. package/src/enum/cor.ts +9 -0
  38. package/src/enum/index.ts +2 -0
  39. package/src/enum/tamanho.ts +5 -0
  40. package/src/index.ts +56 -0
  41. package/src/services/authService.ts +69 -0
  42. package/src/services/dialogService.ts +35 -0
  43. package/src/services/navMenuService.ts +21 -0
  44. package/src/sf-oidc-state.html +15 -0
  45. package/src/style/componentes.scss +22 -0
  46. package/src/style/src/_animation.scss +441 -0
  47. package/src/style/src/_display.scss +10 -0
  48. package/src/style/src/_flexbox.scss +85 -0
  49. package/src/style/src/_functions.scss +171 -0
  50. package/src/style/src/_gap.scss +8 -0
  51. package/src/style/src/_grid.scss +100 -0
  52. package/src/style/src/_mixins.scss +633 -0
  53. package/src/style/src/_normalize.scss +351 -0
  54. package/src/style/src/_ripple.scss +30 -0
  55. package/src/style/src/_size.scss +98 -0
  56. package/src/style/src/_spacing.scss +42 -0
  57. package/src/style/src/_typography.scss +43 -0
  58. package/src/style/src/_variables.scss +87 -0
  59. package/src/style/src/components/_button.scss +110 -0
  60. package/src/style/src/components/_checkbox.scss +53 -0
  61. package/src/style/src/components/_content.scss +57 -0
  62. package/src/style/src/components/_datefield.scss +405 -0
  63. package/src/style/src/components/_drawer.scss +99 -0
  64. package/src/style/src/components/_icon.scss +120 -0
  65. package/src/style/src/components/_internal_icon_button.scss +5 -0
  66. package/src/style/src/components/_layout.scss +183 -0
  67. package/src/style/src/components/_loading-circle.scss +24 -0
  68. package/src/style/src/components/_mark.scss +9 -0
  69. package/src/style/src/components/_mask.scss +33 -0
  70. package/src/style/src/components/_navmenulink.scss +31 -0
  71. package/src/style/src/components/_numpad.scss +58 -0
  72. package/src/style/src/components/_progress-circular.scss +52 -0
  73. package/src/style/src/components/_scrollToTop.scss +28 -0
  74. package/src/style/src/components/_select.scss +60 -0
  75. package/src/style/src/components/_svg_icon.scss +5 -0
  76. package/src/style/src/components/_textfield.scss +186 -0
  77. package/src/style/src/components/_themetoggle.scss +25 -0
  78. package/src/style/src/components/_toast.scss +66 -0
  79. package/src/style/src/components/_tooltip.scss +55 -0
  80. package/src/style/src/sweetalert/_sweetalert.scss +9 -0
  81. package/src/style/src/sweetalert/scss/_animations.scss +197 -0
  82. package/src/style/src/sweetalert/scss/_body.scss +45 -0
  83. package/src/style/src/sweetalert/scss/_core.scss +863 -0
  84. package/src/style/src/sweetalert/scss/_mixins.scss +16 -0
  85. package/src/style/src/sweetalert/scss/_theming.scss +8 -0
  86. package/src/style/src/sweetalert/scss/_toasts-animations.scss +83 -0
  87. package/src/style/src/sweetalert/scss/_toasts-body.scss +85 -0
  88. package/src/style/src/sweetalert/scss/_toasts.scss +203 -0
  89. package/src/style/src/sweetalert/scss/_variables.scss +265 -0
  90. package/src/style/tema.scss +169 -0
  91. package/src/ts-helpers.d.ts +57 -0
  92. package/tsconfig.json +19 -0
  93. package/vite.config.js +25 -0
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@luizleon/sf.prefeiturasp.vuecomponents",
3
+ "version": "0.0.1",
4
+ "description": "Pacote de componentes Vue para projetos em SF.",
5
+ "main": "dist/lib.umd.js",
6
+ "module": "dist/lib.es.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "rimraf ./dist/ && vue-tsc --noEmit && vite build"
10
+ },
11
+ "dependencies": {
12
+ "air-datepicker": "3.3.1",
13
+ "date-fns": "2.29.3",
14
+ "keycloak-js": "22.0.5",
15
+ "sweetalert2": "11.4.8",
16
+ "vue-currency-input": "3.0.2"
17
+ },
18
+ "devDependencies": {
19
+ "@vitejs/plugin-vue": "4.4.1",
20
+ "rimraf": "3.0.2",
21
+ "sass": "1.69.5",
22
+ "typescript": "5.2.2",
23
+ "vite": "4.5.0",
24
+ "vite-plugin-dts": "3.6.3",
25
+ "vite-plugin-vue-type-imports": "0.2.5",
26
+ "vue-tsc": "1.8.22"
27
+ },
28
+ "peerDependencies": {
29
+ "vue": "3.*"
30
+ }
31
+ }
@@ -0,0 +1,35 @@
1
+ import { VNode } from "vue";
2
+ import { StyleValue } from "vue";
3
+ import {
4
+ ClassComponent,
5
+ GlobalComponentConstructor,
6
+ } from "../../ts-helpers";
7
+
8
+ export interface SfContentProps {
9
+ class?: any;
10
+ style?: StyleValue;
11
+ disableBodyPadding?: boolean;
12
+ disableHeaderPadding?: boolean;
13
+ disableFooterPadding?: boolean;
14
+ }
15
+
16
+ export interface SfContentSlots {
17
+ header: () => VNode[];
18
+ footer: () => VNode[];
19
+ }
20
+
21
+ export declare type SfContentEmits = {};
22
+
23
+ declare class SfContent extends ClassComponent<
24
+ SfContentProps,
25
+ SfContentSlots,
26
+ SfContentEmits
27
+ > {}
28
+
29
+ declare module "@vue/runtime-core" {
30
+ interface GlobalComponents {
31
+ SfContent: GlobalComponentConstructor<SfContent>;
32
+ }
33
+ }
34
+
35
+ export default SfContent;
@@ -0,0 +1,41 @@
1
+ <script setup lang="ts">
2
+ import ScrollToTop from "../internal/ScrollToTop.vue";
3
+ import { SfContentProps } from "./Content";
4
+ import { CssClassBuilder } from "../internal/cssClassBuilder";
5
+
6
+ const props: SfContentProps = defineProps<SfContentProps>();
7
+
8
+ function Css() {
9
+ return new CssClassBuilder("sf-content")
10
+ .AddClass(props.class, !!props.class)
11
+ .Build();
12
+ }
13
+
14
+ function CssBody() {
15
+ return new CssClassBuilder("sf-content-body")
16
+ .AddClass("sf-content-no-padding", props.disableBodyPadding)
17
+ .Build();
18
+ }
19
+
20
+ function CssHeader() {
21
+ return new CssClassBuilder("sf-content-header")
22
+ .AddClass("sf-content-no-padding", props.disableHeaderPadding)
23
+ .Build();
24
+ }
25
+
26
+ function CssFooter() {
27
+ return new CssClassBuilder("sf-content-footer")
28
+ .AddClass("sf-content-no-padding", props.disableFooterPadding)
29
+ .Build();
30
+ }
31
+ </script>
32
+ <template>
33
+ <div :class="Css()" :style="props.style">
34
+ <div :class="CssHeader()"><slot name="header"></slot></div>
35
+ <div :class="CssBody()">
36
+ <slot name="default"></slot>
37
+ <ScrollToTop />
38
+ </div>
39
+ <div :class="CssFooter()"><slot name="footer"></slot></div>
40
+ </div>
41
+ </template>
@@ -0,0 +1,38 @@
1
+ import { Cor, Tamanho } from "../../enum";
2
+ import {
3
+ ClassComponent,
4
+ GlobalComponentConstructor,
5
+ } from "../../ts-helpers";
6
+ import { StyleValue, ButtonHTMLAttributes } from "vue";
7
+
8
+ export interface SfIconProps {
9
+ icone?: string;
10
+ visible?: boolean;
11
+ class?: any;
12
+ style?: StyleValue;
13
+ disabled?: boolean;
14
+ loading?: boolean;
15
+ button?: boolean;
16
+ tamanho?: Tamanho;
17
+ dot?: boolean;
18
+ dotColor?: Cor;
19
+ buttonProps?: ButtonHTMLAttributes;
20
+ }
21
+
22
+ export interface SfIconSlots {}
23
+
24
+ export declare type SfIconEmits = {};
25
+
26
+ declare class SfIcon extends ClassComponent<
27
+ SfIconProps,
28
+ SfIconSlots,
29
+ SfIconEmits
30
+ > {}
31
+
32
+ declare module "@vue/runtime-core" {
33
+ interface GlobalComponents {
34
+ SfIcon: GlobalComponentConstructor<SfIcon>;
35
+ }
36
+ }
37
+
38
+ export default SfIcon;
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ import { Cor, Tamanho } from "../../enum";
3
+ import LoadingCircle from "../internal/LoadingCircle.vue";
4
+ import { CssClassBuilder } from "../internal/cssClassBuilder";
5
+ import { SfIconProps } from "./Icon";
6
+
7
+ const props: SfIconProps = withDefaults(defineProps<SfIconProps>(), {
8
+ visible: true,
9
+ class: "",
10
+ style: "",
11
+ tamanho: Tamanho.Medio,
12
+ dotColor: Cor.Error,
13
+ });
14
+
15
+ function CssClass() {
16
+ return new CssClassBuilder(`${props.class} sf-icon`)
17
+ .AddClass("sf-component-loading", props.loading)
18
+ .AddClass("sf-component-disabled", props.disabled)
19
+ .AddClass("sf-icon-button", props.button)
20
+ .AddClass("sf-icon-small", props.tamanho === Tamanho.Pequeno)
21
+ .AddClass("sf-icon-medium", props.tamanho === Tamanho.Medio)
22
+ .AddClass("sf-icon-large", props.tamanho === Tamanho.Grande)
23
+ .AddClass("sf-ripple", props.button === true)
24
+ .Build();
25
+ }
26
+ </script>
27
+
28
+ <template>
29
+ <div :style="props.style" :class="CssClass()">
30
+ <button
31
+ class="material-symbols-outlined"
32
+ :disabled="props.disabled || props.loading"
33
+ v-bind="props.buttonProps"
34
+ :tabindex="!props.button ? -1 : undefined"
35
+ >
36
+ <template v-if="props.loading">
37
+ <LoadingCircle></LoadingCircle>
38
+ </template>
39
+ <template v-else>{{ props.icone }}</template>
40
+ </button>
41
+ <span v-if="props.dot" :data-color="props.dotColor"></span>
42
+ </div>
43
+ </template>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div class="sf-loading-circle">
3
+ <div>
4
+ <svg viewBox="25 25 50 50">
5
+ <circle
6
+ cx="50"
7
+ cy="50"
8
+ r="20"
9
+ fill="none"
10
+ stroke-width="4"
11
+ stroke-miterlimit="10"
12
+ ></circle>
13
+ </svg>
14
+ </div>
15
+ </div>
16
+ </template>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <button class="sf-internal-icon-button sf-ripple">
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ height="48"
6
+ viewBox="0 -960 960 960"
7
+ width="48"
8
+ >
9
+ <path
10
+ d="M194.694-124.001q-28.254 0-49.473-21.22-21.22-21.219-21.22-49.473v-570.612q0-28.254 21.22-49.473 21.219-21.22 49.473-21.22h285.075v58.384H194.694q-4.616 0-8.463 3.846-3.846 3.847-3.846 8.463v570.612q0 4.616 3.846 8.463 3.847 3.846 8.463 3.846h285.075v58.384H194.694Zm469.614-183.693-42.999-42.23 101.384-101.384H360.846v-58.384h360.616L620.078-611.076l42.615-41.615 173.306 173.499-171.691 171.498Z"
11
+ />
12
+ </svg>
13
+ </button>
14
+ </template>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ height="48"
5
+ viewBox="0 -960 960 960"
6
+ width="48"
7
+ class="sf-svg-icon"
8
+ >
9
+ <path
10
+ d="m307.231-83.463-54.999-55.23 343.923-343.922-343.923-343.539 54.999-54.614 398.153 398.153L307.231-83.462Z"
11
+ />
12
+ </svg>
13
+ </template>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, ref } from "vue";
3
+
4
+ const visible = ref(false);
5
+ const id = `--${+new Date()}`;
6
+ let parent: HTMLElement | null = null;
7
+
8
+ function ButtonClick() {
9
+ parent?.scrollTo(0, 0);
10
+ }
11
+
12
+ onMounted(() => {
13
+ parent = document.getElementById(id)?.parentElement ?? null;
14
+ if (!parent) return;
15
+ parent.addEventListener("scroll", function () {
16
+ visible.value = this.scrollTop - this.clientHeight > 0;
17
+ });
18
+ });
19
+ </script>
20
+ <template>
21
+ <button
22
+ :id="id"
23
+ :class="['sf-scrollToTop', { 'sf-scrollToTop-visible': visible }]"
24
+ @click="ButtonClick"
25
+ ></button>
26
+ </template>
@@ -0,0 +1,41 @@
1
+ class ThemeToggle {
2
+ get storedTheme() {
3
+ return localStorage.getItem("lkVueTheme") as
4
+ | "light"
5
+ | "dark"
6
+ | null;
7
+ }
8
+ get IsDark() {
9
+ return document.documentElement.classList.contains("dark");
10
+ }
11
+ Toggle() {
12
+ this.IsDark ? this.EnableLightMode() : this.EnableDarkMode();
13
+ }
14
+ EnableDarkMode() {
15
+ document.documentElement.classList.add("dark");
16
+ document.documentElement.classList.remove("light");
17
+ localStorage.setItem("lkVueTheme", "dark");
18
+ }
19
+ EnableLightMode() {
20
+ document.documentElement.classList.remove("dark");
21
+ document.documentElement.classList.add("light");
22
+ localStorage.setItem("lkVueTheme", "light");
23
+ }
24
+ SetInitialTheme() {
25
+ if (this.storedTheme === "light") {
26
+ return this.EnableLightMode();
27
+ }
28
+ if (this.storedTheme === "dark") {
29
+ return this.EnableDarkMode();
30
+ }
31
+ if (
32
+ window.matchMedia &&
33
+ window.matchMedia("(prefers-color-scheme: dark)").matches
34
+ ) {
35
+ return this.EnableDarkMode();
36
+ }
37
+ this.EnableLightMode();
38
+ }
39
+ }
40
+
41
+ export const ThemeToggleBase = (() => new ThemeToggle())();
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ import { ThemeToggleBase } from "./ThemeToggle";
3
+ </script>
4
+
5
+ <template>
6
+ <button id="sf-theme-toggle" @click="ThemeToggleBase.Toggle">
7
+ <svg
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ width="472.39"
10
+ height="472.39"
11
+ viewBox="0 0 472.39 472.39"
12
+ >
13
+ <g class="toggle-sun">
14
+ <path
15
+ d="M403.21,167V69.18H305.38L236.2,0,167,69.18H69.18V167L0,236.2l69.18,69.18v97.83H167l69.18,69.18,69.18-69.18h97.83V305.38l69.18-69.18Zm-167,198.17a129,129,0,1,1,129-129A129,129,0,0,1,236.2,365.19Z"
16
+ />
17
+ </g>
18
+ <g class="toggle-circle">
19
+ <circle class="cls-1" cx="236.2" cy="236.2" r="103.78" />
20
+ </g>
21
+ </svg>
22
+ </button>
23
+ </template>
@@ -0,0 +1,44 @@
1
+ /**
2
+ * A utility class for building CSS class strings.
3
+ */
4
+ export class CssClassBuilder {
5
+ /**
6
+ * Creates a new instance of the CssClassBuilder class.
7
+ * @param value The initial value of the CSS class string.
8
+ */
9
+ constructor(value: string) {
10
+ this.retorno = value ?? "";
11
+ }
12
+
13
+ retorno: string;
14
+
15
+ /**
16
+ * Concatenates a new CSS class to the existing string.
17
+ * @param value The CSS class to concatenate.
18
+ * @returns The current instance of the CssClassBuilder class.
19
+ */
20
+ private Concat(value?: string) {
21
+ if (value && value.trim().length) {
22
+ this.retorno += ` ${value}`;
23
+ }
24
+ return this;
25
+ }
26
+
27
+ /**
28
+ * Adds a new CSS class to the string if the specified condition is true.
29
+ * @param value The CSS class to add.
30
+ * @param when The condition that determines whether to add the CSS class.
31
+ * @returns The current instance of the CssClassBuilder class.
32
+ */
33
+ AddClass(value?: string, when: boolean = true) {
34
+ return when ? this.Concat(value) : this;
35
+ }
36
+
37
+ /**
38
+ * Builds the final CSS class string.
39
+ * @returns The final CSS class string.
40
+ */
41
+ Build() {
42
+ return this.retorno.trim();
43
+ }
44
+ }
@@ -0,0 +1,44 @@
1
+ import { VNode } from "vue";
2
+ import {
3
+ ClassComponent,
4
+ GlobalComponentConstructor,
5
+ } from "../ts-helpers";
6
+
7
+ export interface SfLayoutProps {}
8
+
9
+ export interface SfLayoutSlots {
10
+ /**
11
+ * Título ao lado do botão do menu
12
+ */
13
+ title: () => VNode[];
14
+ /**
15
+ * Conteúdo para ficar no menu
16
+ */
17
+ menu: () => VNode[];
18
+ /**
19
+ * Visível no footer da aplicação.
20
+ */
21
+ "app-version": () => VNode[];
22
+ /**
23
+ * Conteúdo principal
24
+ */
25
+ content: () => VNode[];
26
+ }
27
+
28
+ export declare type SfLayoutEmits = {
29
+ mounted: () => void;
30
+ };
31
+
32
+ declare class SfLayout extends ClassComponent<
33
+ SfLayoutProps,
34
+ SfLayoutSlots,
35
+ SfLayoutEmits
36
+ > {}
37
+
38
+ declare module "@vue/runtime-core" {
39
+ interface GlobalComponents {
40
+ SfLayout: GlobalComponentConstructor<SfLayout>;
41
+ }
42
+ }
43
+
44
+ export default SfLayout;
@@ -0,0 +1,63 @@
1
+ <script setup lang="ts">
2
+ import { UseDialogService } from "../..";
3
+ import { AuthService } from "../../services/authService";
4
+ import { UseNavMenuService } from "../../services/navMenuService";
5
+ import Icon from "../icon/Icon.vue";
6
+ import LogoutIcon from "../internal/LogoutIcon.vue";
7
+ import MenuIcon from "../internal/MenuIcon.vue";
8
+ import ThemeToggle from "../internal/ThemeToggle.vue";
9
+
10
+ const navService = UseNavMenuService();
11
+ const dialogService = UseDialogService();
12
+
13
+ async function Logout() {
14
+ const confirm = await dialogService.ConfirmAsync({
15
+ message: "Você deseja sair da sua conta?",
16
+ confirmLabel: "sair",
17
+ });
18
+ if (!confirm) return;
19
+ AuthService.CallLogout();
20
+ }
21
+ </script>
22
+
23
+ <template>
24
+ <div id="sf-layout">
25
+ <header>
26
+ <div
27
+ :class="[
28
+ 'sf-layout-menu-toggler',
29
+ { invert: navService.IsVisible },
30
+ ]"
31
+ @click="navService.Toggle()"
32
+ >
33
+ <div class="sf-layout-menu-toggler-logo"></div>
34
+ <MenuIcon />
35
+ </div>
36
+ <div class="title">
37
+ <slot name="title"></slot>
38
+ </div>
39
+ <slot name="action"> </slot>
40
+ <ThemeToggle />
41
+ <LogoutIcon @click="Logout" />
42
+ </header>
43
+ <nav :class="{ visible: navService.IsVisible }">
44
+ <div class="sf-layout-nav-header">
45
+ <span>Menu</span>
46
+ <Icon
47
+ :icone="'close'"
48
+ button
49
+ @click="navService.Close()"
50
+ ></Icon>
51
+ </div>
52
+ <div class="sf-layout-nav-content">
53
+ <slot name="menu"></slot>
54
+ </div>
55
+ </nav>
56
+ <main :class="{ 'menu-visible': navService.IsVisible }">
57
+ <section id="sf-layout-page-title"></section>
58
+ <section id="sf-layout-content">
59
+ <slot name="content"></slot>
60
+ </section>
61
+ </main>
62
+ </div>
63
+ </template>
@@ -0,0 +1,34 @@
1
+ import {
2
+ ClassComponent,
3
+ GlobalComponentConstructor,
4
+ } from "../../ts-helpers";
5
+
6
+ export interface SfNavMenuLinkProps {
7
+ href: string;
8
+ text: string;
9
+ icon?: string;
10
+ }
11
+
12
+ export interface SfNavMenuLinkSlots {}
13
+
14
+ export declare type SfNavMenuLinkEmits = {};
15
+
16
+ declare class SfNavMenuLink extends ClassComponent<
17
+ SfNavMenuLinkProps,
18
+ SfNavMenuLinkSlots,
19
+ SfNavMenuLinkEmits
20
+ > {}
21
+
22
+ declare module "@vue/runtime-core" {
23
+ interface GlobalComponents {
24
+ SfNavMenuLink: GlobalComponentConstructor<SfNavMenuLink>;
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Componente para navegação no menu.
30
+ *
31
+ * Dependência: router-link.
32
+ * @see [https://router.vuejs.org/api/#router-link-s-v-slot](https://router.vuejs.org/api/#router-link-s-v-slot)
33
+ */
34
+ export default SfNavMenuLink;
@@ -0,0 +1,41 @@
1
+ <script setup lang="ts">
2
+ import { SfNavMenuLinkProps } from "./NavMenuLink";
3
+ import { UseNavMenuService } from "../../services/navMenuService";
4
+ import Icon from "../icon/Icon.vue";
5
+
6
+ const props: SfNavMenuLinkProps = defineProps<SfNavMenuLinkProps>();
7
+
8
+ const navService = UseNavMenuService();
9
+
10
+ function OnClick(ev: Event, navigate: any) {
11
+ ev.preventDefault();
12
+ const target = ev.target as HTMLElement;
13
+ const nav = target.closest(".sf-layout-nav-content");
14
+ navigate();
15
+ if (nav && nav.clientWidth + 10 > document.body.clientWidth) {
16
+ navService.Close();
17
+ }
18
+ }
19
+ </script>
20
+
21
+ <template>
22
+ <router-link
23
+ :to="props.href"
24
+ custom
25
+ v-slot="{ href, navigate, isExactActive }"
26
+ >
27
+ <a
28
+ class="sf-navmenulink"
29
+ :href="href"
30
+ :data-active="isExactActive"
31
+ @click="OnClick($event, navigate)"
32
+ >
33
+ <Icon
34
+ v-if="props.icon"
35
+ :icone="props.icon"
36
+ :button-props="{ tabindex: -1 }"
37
+ />
38
+ <span class="sf-navmenulink-text">{{ props.text }}</span>
39
+ </a>
40
+ </router-link>
41
+ </template>
@@ -0,0 +1,9 @@
1
+ export enum Cor {
2
+ Primary = "primary",
3
+ Secondary = "secondary",
4
+ Info = "info",
5
+ Success = "success",
6
+ Help = "help",
7
+ Warn = "warn",
8
+ Error = "error",
9
+ }
@@ -0,0 +1,2 @@
1
+ export { Cor } from "./cor";
2
+ export { Tamanho } from "./tamanho";
@@ -0,0 +1,5 @@
1
+ export enum Tamanho {
2
+ Pequeno = "sm",
3
+ Medio = "md",
4
+ Grande = "lg",
5
+ }
package/src/index.ts ADDED
@@ -0,0 +1,56 @@
1
+ import SfLayout from "./components/layout/Layout.vue";
2
+ import SfIcon from "./components/icon/Icon.vue";
3
+ import SfNavMenuLink from "./components/navmenulink/NavMenuLink.vue";
4
+ import SfContent from "./components/content/Content.vue";
5
+
6
+ import { UseNavMenuService } from "./services/navMenuService";
7
+ import { UseDialogService } from "./services/dialogService";
8
+ import { AuthService } from "./services/authService";
9
+
10
+ import { Cor, Tamanho } from "./enum";
11
+
12
+ import { nextTick } from "vue";
13
+
14
+ import "./style/tema.scss";
15
+ import "./style/componentes.scss";
16
+
17
+ export {
18
+ SfLayout,
19
+ SfIcon,
20
+ SfNavMenuLink,
21
+ SfContent,
22
+ AuthService,
23
+ UseNavMenuService,
24
+ UseDialogService,
25
+ Cor,
26
+ Tamanho,
27
+ };
28
+ /**
29
+ * https://stackoverflow.com/questions/37112218/css3-100vh-not-constant-in-mobile-browser
30
+ */
31
+ (() => {
32
+ function Ajusta() {
33
+ nextTick(() => {
34
+ setTimeout(() => {
35
+ const root = document.querySelector(":root");
36
+ root &&
37
+ // @ts-ignore
38
+ root.style.setProperty(
39
+ "--window-height",
40
+ `${window.visualViewport?.height ?? window.innerHeight}px`
41
+ );
42
+ }, 1);
43
+ });
44
+ }
45
+ Ajusta();
46
+ window.addEventListener("resize", Ajusta);
47
+ })();
48
+
49
+ import { ThemeToggleBase } from "./components/internal/ThemeToggle";
50
+
51
+ /**
52
+ * Tema inicial
53
+ */
54
+ (() => {
55
+ ThemeToggleBase.SetInitialTheme();
56
+ })();