@luizleon/sf.prefeiturasp.vuecomponents 0.0.44 → 0.0.45

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 (40) hide show
  1. package/dist/components/button/Button.d.ts +35 -3
  2. package/dist/components/content/Content.d.ts +8 -1
  3. package/dist/components/drawer/Drawer.d.ts +9 -1
  4. package/dist/components/icon/Icon.d.ts +26 -5
  5. package/dist/components/layout/Layout.d.ts +2 -0
  6. package/dist/components/message/Message.d.ts +10 -1
  7. package/dist/components/navmenulink/NavMenuLink.d.ts +7 -1
  8. package/dist/components/tabnavigation/TabNavigation.d.ts +8 -2
  9. package/dist/components/tooltip/Tooltip.d.ts +21 -0
  10. package/dist/index.d.ts +2 -1
  11. package/dist/sf.prefeiturasp.vuecomponents.es.js +1813 -1747
  12. package/dist/sf.prefeiturasp.vuecomponents.es.js.map +1 -1
  13. package/dist/sf.prefeiturasp.vuecomponents.umd.js +39 -39
  14. package/dist/sf.prefeiturasp.vuecomponents.umd.js.map +1 -1
  15. package/dist/style.css +1 -1
  16. package/package.json +3 -4
  17. package/src/components/button/Button.d.ts +1 -32
  18. package/src/components/button/Button.vue +44 -2
  19. package/src/components/content/Content.d.ts +0 -8
  20. package/src/components/content/Content.vue +9 -1
  21. package/src/components/drawer/Drawer.d.ts +1 -9
  22. package/src/components/drawer/Drawer.vue +11 -3
  23. package/src/components/icon/Icon.d.ts +1 -30
  24. package/src/components/icon/Icon.vue +64 -27
  25. package/src/components/layout/Layout.d.ts +1 -2
  26. package/src/components/layout/Layout.vue +6 -1
  27. package/src/components/message/Message.d.ts +1 -18
  28. package/src/components/message/Message.vue +19 -2
  29. package/src/components/navmenulink/NavMenuLink.d.ts +1 -7
  30. package/src/components/navmenulink/NavMenuLink.vue +10 -2
  31. package/src/components/tabnavigation/TabNavigation.d.ts +1 -9
  32. package/src/components/tabnavigation/TabNavigation.vue +9 -1
  33. package/src/components/tooltip/Tooltip.d.ts +23 -0
  34. package/src/components/tooltip/Tooltip.vue +91 -0
  35. package/src/index.ts +2 -0
  36. package/src/style/src/_mixins.scss +5 -0
  37. package/src/style/src/components/_icon.scss +7 -0
  38. package/src/style/src/components/_message.scss +1 -1
  39. package/src/style/src/components/_tooltip.scss +11 -12
  40. package/vite.config.js +1 -2
@@ -4,6 +4,9 @@ import { UseNavMenuService } from "../../services/navMenuService";
4
4
  import HeaderAvatar from "../internal/HeaderAvatar.vue";
5
5
  import MenuIcon from "../internal/MenuIcon.vue";
6
6
  import ThemeToggle from "../internal/ThemeToggle.vue";
7
+ import SfTooltip from "../tooltip/Tooltip.vue";
8
+
9
+ export interface SfLayoutProps {}
7
10
 
8
11
  const navService = UseNavMenuService();
9
12
 
@@ -34,7 +37,9 @@ onMounted(() => {
34
37
  <slot name="title"></slot>
35
38
  </div>
36
39
  <slot name="action"> </slot>
37
- <ThemeToggle />
40
+ <SfTooltip :text="'alternar tema'">
41
+ <ThemeToggle />
42
+ </SfTooltip>
38
43
  <HeaderAvatar @logout="emit('logout')" />
39
44
  </header>
40
45
  <nav :class="{ visible: navService.IsVisible }">
@@ -5,24 +5,7 @@ import {
5
5
  GlobalComponentConstructor,
6
6
  } from "../../ts-helpers";
7
7
  import { Cor } from "../../enum";
8
-
9
- export interface SfMessageProps {
10
- /**
11
- * @default 'info'
12
- */
13
- color?:
14
- | "primary"
15
- | "secondary"
16
- | "info"
17
- | "success"
18
- | "help"
19
- | "warn"
20
- | "error"
21
- | undefined;
22
- class?: any;
23
- style?: StyleValue;
24
- icon?: string;
25
- }
8
+ import { SfMessageProps } from "./Message.vue";
26
9
 
27
10
  export interface SfMessageSlots {
28
11
  default: VNode[];
@@ -1,7 +1,24 @@
1
1
  <script lang="ts" setup>
2
2
  import { CssClassBuilder } from "../internal/cssClassBuilder";
3
- import { SfMessageProps } from "./Message";
4
- import { computed } from "vue";
3
+ import { StyleValue, computed } from "vue";
4
+
5
+ export interface SfMessageProps {
6
+ /**
7
+ * @default 'info'
8
+ */
9
+ color?:
10
+ | "primary"
11
+ | "secondary"
12
+ | "info"
13
+ | "success"
14
+ | "help"
15
+ | "warn"
16
+ | "error"
17
+ | undefined;
18
+ class?: any;
19
+ style?: StyleValue;
20
+ icon?: string;
21
+ }
5
22
 
6
23
  const props: SfMessageProps = withDefaults(
7
24
  defineProps<SfMessageProps>(),
@@ -2,13 +2,7 @@ import {
2
2
  ClassComponent,
3
3
  GlobalComponentConstructor,
4
4
  } from "../../ts-helpers";
5
-
6
- export interface SfNavMenuLinkProps {
7
- href: string;
8
- text: string;
9
- icon?: string;
10
- exact?: boolean;
11
- }
5
+ import { SfNavMenuLinkProps } from "./NavMenuLink.vue";
12
6
 
13
7
  export interface SfNavMenuLinkSlots {}
14
8
 
@@ -1,8 +1,15 @@
1
1
  <script setup lang="ts">
2
- import { SfNavMenuLinkProps } from "./NavMenuLink";
3
2
  import { UseNavMenuService } from "../../services/navMenuService";
4
3
  import Icon from "../icon/Icon.vue";
5
4
 
5
+ export interface SfNavMenuLinkProps {
6
+ href: string;
7
+ text: string;
8
+ icon?: string;
9
+ iconFilled?: boolean;
10
+ exact?: boolean;
11
+ }
12
+
6
13
  const props: SfNavMenuLinkProps = defineProps<SfNavMenuLinkProps>();
7
14
 
8
15
  const navService = UseNavMenuService();
@@ -32,7 +39,8 @@ function OnClick(ev: Event, navigate: any) {
32
39
  >
33
40
  <Icon
34
41
  v-if="props.icon"
35
- :icone="props.icon"
42
+ :icon="props.icon"
43
+ :filled="props.iconFilled"
36
44
  :button-props="{ tabindex: -1 }"
37
45
  />
38
46
  <span class="sf-navmenulink-text">{{ props.text }}</span>
@@ -2,15 +2,7 @@ import {
2
2
  ClassComponent,
3
3
  GlobalComponentConstructor,
4
4
  } from "../../ts-helpers";
5
-
6
- export interface SfTabNavigationTab {
7
- text: string;
8
- route: string;
9
- }
10
-
11
- export interface SfTabNavigationProps {
12
- tabs: SfTabNavigationTab[];
13
- }
5
+ import { SfTabNavigationProps } from "./TabNavigation.vue";
14
6
 
15
7
  export interface SfTabNavigationSlots {
16
8
  item: (scope: {
@@ -1,6 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { onMounted, onBeforeUnmount, ref } from "vue";
3
- import { SfTabNavigationProps } from "./TabNavigation";
3
+
4
+ export interface SfTabNavigationTab {
5
+ text: string;
6
+ route: string;
7
+ }
8
+
9
+ export interface SfTabNavigationProps {
10
+ tabs: SfTabNavigationTab[];
11
+ }
4
12
 
5
13
  const props: SfTabNavigationProps =
6
14
  defineProps<SfTabNavigationProps>();
@@ -0,0 +1,23 @@
1
+ import {
2
+ ClassComponent,
3
+ GlobalComponentConstructor,
4
+ } from "../../ts-helpers";
5
+ import { SfTooltipProps } from "./Tooltip.vue";
6
+
7
+ export interface SfTooltipSlots {}
8
+
9
+ export declare type SfTooltipEmits = {};
10
+
11
+ declare class SfTooltip extends ClassComponent<
12
+ SfTooltipProps,
13
+ SfTooltipSlots,
14
+ SfTooltipEmits
15
+ > {}
16
+
17
+ declare module "@vue/runtime-core" {
18
+ interface GlobalComponents {
19
+ SfTooltip: GlobalComponentConstructor<SfTooltip>;
20
+ }
21
+ }
22
+
23
+ export default SfTooltip;
@@ -0,0 +1,91 @@
1
+ <script setup lang="ts">
2
+ import { onBeforeUnmount } from "vue";
3
+ import { GetMaxZindex } from "../internal/getMaxZindex";
4
+
5
+ export interface SfTooltipProps {
6
+ text: string;
7
+ }
8
+
9
+ const props = defineProps<SfTooltipProps>();
10
+
11
+ class Tooltip {
12
+ constructor() {
13
+ this.zIndex = GetMaxZindex() + 1;
14
+ this.Render();
15
+ }
16
+ zIndex: number;
17
+ wrapper!: HTMLElement;
18
+ inner!: HTMLElement;
19
+ Render() {
20
+ this.wrapper = document.createElement("div");
21
+ this.wrapper.classList.add("sf-tooltip-wrapper");
22
+ this.wrapper.style.zIndex = `${this.zIndex ?? 0}`;
23
+ this.inner = document.createElement("div");
24
+ this.inner.classList.add("sf-tooltip-inner");
25
+ this.wrapper.appendChild(this.inner);
26
+ }
27
+ Show(ev: MouseEvent) {
28
+ this.inner.textContent = props.text;
29
+ const target = ev.target as HTMLDivElement;
30
+ document.body.appendChild(this.wrapper);
31
+ this.Position(target.getBoundingClientRect());
32
+ this.wrapper.classList.add("visible");
33
+ }
34
+ Hide() {
35
+ this.wrapper.classList.remove("visible");
36
+ this.wrapper.remove();
37
+ }
38
+ Position(rect: DOMRect) {
39
+ const offset = 10;
40
+ const top = rect.top;
41
+ const bottom = rect.bottom;
42
+ const left = rect.left;
43
+ const right = rect.right;
44
+ const margin = rect.width / 2 - 15;
45
+ const wrapper = this.wrapper;
46
+ wrapper.style.top = `${bottom + offset}px`;
47
+ wrapper.style.left = `${left}px`;
48
+ wrapper.style.marginLeft = `${margin}px`;
49
+ if (this.OutOfBottom()) {
50
+ wrapper.style.top = `${top - wrapper.clientHeight - offset}px`;
51
+ wrapper.classList.add("top");
52
+ }
53
+ if (this.OutOfRight()) {
54
+ wrapper.style.left = `${right - wrapper.clientWidth}px`;
55
+ wrapper.style.marginLeft = `-${margin}px`;
56
+ wrapper.classList.add("left");
57
+ }
58
+ }
59
+ OutOfBottom() {
60
+ const rect = this.wrapper.getBoundingClientRect();
61
+ return (
62
+ rect.bottom >
63
+ (window.innerHeight || document.documentElement.clientHeight)
64
+ );
65
+ }
66
+ OutOfRight() {
67
+ const rect = this.wrapper.getBoundingClientRect();
68
+ return (
69
+ rect.right >
70
+ (window.innerWidth || document.documentElement.clientWidth)
71
+ );
72
+ }
73
+ }
74
+
75
+ const TooltipInstance = new Tooltip();
76
+
77
+ onBeforeUnmount(() => {
78
+ TooltipInstance.Hide();
79
+ });
80
+ </script>
81
+
82
+ <template>
83
+ <div
84
+ class="sf-tooltip-anchor"
85
+ @mouseenter="TooltipInstance.Show"
86
+ @mouseleave="TooltipInstance.Hide"
87
+ @mousedown="TooltipInstance.Hide"
88
+ >
89
+ <slot name="default"></slot>
90
+ </div>
91
+ </template>
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import SfTabNavigation from "./components/tabnavigation/TabNavigation.vue";
6
6
  import SfButton from "./components/button/Button.vue";
7
7
  import SfDrawer from "./components/drawer/Drawer.vue";
8
8
  import SfMessage from "./components/message/Message.vue";
9
+ import SfTooltip from "./components/tooltip/Tooltip.vue";
9
10
  import { ThemeToggleBase } from "./components/internal/ThemeToggle";
10
11
 
11
12
  import { UseNavMenuService } from "./services/navMenuService";
@@ -28,6 +29,7 @@ export {
28
29
  SfButton,
29
30
  SfDrawer,
30
31
  SfMessage,
32
+ SfTooltip,
31
33
  UseAuthService,
32
34
  UseNavMenuService,
33
35
  UseConfirmService,
@@ -164,3 +164,8 @@
164
164
  font-feature-settings: "liga";
165
165
  -webkit-font-smoothing: antialiased;
166
166
  }
167
+
168
+ @mixin material-symbols-filled {
169
+ @include material-symbols-outlined;
170
+ font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
171
+ }
@@ -1,6 +1,13 @@
1
1
  @import "../variables";
2
2
  @import "../mixins";
3
3
 
4
+ .material-symbols-outlined {
5
+ font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
6
+ &.icon-filled {
7
+ font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
8
+ }
9
+ }
10
+
4
11
  div.#{$prefix}icon {
5
12
  position: relative;
6
13
  display: inline-flex;
@@ -36,7 +36,7 @@
36
36
  &[data-icon] {
37
37
  padding-left: 3.25rem;
38
38
  &::before {
39
- @include material-symbols-outlined;
39
+ @include material-symbols-filled;
40
40
  content: attr(data-icon);
41
41
  position: absolute;
42
42
  top: 50%;
@@ -1,4 +1,4 @@
1
- .sf-tooltip-wrapper {
1
+ .#{$prefix}tooltip-wrapper {
2
2
  --arrow-width: 7.5px;
3
3
  pointer-events: none;
4
4
  width: 120px;
@@ -9,18 +9,18 @@
9
9
  opacity: 0;
10
10
  transition: opacity 0.3s;
11
11
 
12
- .sf-tooltip-inner {
12
+ .#{$prefix}tooltip-inner {
13
13
  position: relative;
14
- padding: 6px 0;
14
+ padding: 5px 2px;
15
15
  border-radius: 4px;
16
16
  background-color: var(--text-color);
17
- font-size: 0.875rem;
17
+ font-size: 0.825rem;
18
18
 
19
19
  &::after {
20
20
  content: "";
21
21
  position: absolute;
22
22
  left: var(--arrow-width);
23
- top: calc(var(--arrow-width) * -1);
23
+ top: calc(var(--arrow-width) * -0.75);
24
24
  border-left: var(--arrow-width) solid transparent;
25
25
  border-right: var(--arrow-width) solid transparent;
26
26
  border-bottom: var(--arrow-width) solid var(--text-color);
@@ -31,25 +31,24 @@
31
31
  opacity: 1;
32
32
  }
33
33
 
34
- &.top .sf-tooltip-inner::after {
34
+ &.top .#{$prefix}tooltip-inner::after {
35
35
  top: unset;
36
- bottom: calc(var(--arrow-width) * -1);
36
+ bottom: calc(var(--arrow-width) * -0.75);
37
37
  border-bottom: unset;
38
38
  border-top: var(--arrow-width) solid var(--text-color);
39
39
  }
40
40
 
41
- &.left .sf-tooltip-inner::after {
41
+ &.left .#{$prefix}tooltip-inner::after {
42
42
  left: unset;
43
43
  right: var(--arrow-width);
44
44
  }
45
45
  }
46
46
 
47
- .sf-tooltip-anchor {
47
+ .#{$prefix}tooltip-anchor {
48
48
  display: inline !important;
49
49
  border-radius: 50%;
50
- &:has(.sf-component-disabled),
51
- &:has(.sf-component-loading),
52
- &:has(.sf-component-freeze) {
50
+ &:has(.component-disabled),
51
+ &:has(.component-loading) {
53
52
  pointer-events: none !important;
54
53
  }
55
54
  }
package/vite.config.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { defineConfig } from "vite";
2
2
  import vue from "@vitejs/plugin-vue";
3
- import vueTypeImports from "vite-plugin-vue-type-imports";
4
3
  import dts from "vite-plugin-dts";
5
4
  import path from "path";
6
5
  import sourcemaps from "rollup-plugin-sourcemaps";
@@ -25,5 +24,5 @@ export default defineConfig({
25
24
  },
26
25
  sourcemap: true,
27
26
  },
28
- plugins: [vue(), vueTypeImports(), dts({ cleanVueFileName: true })],
27
+ plugins: [vue(), dts({ cleanVueFileName: true })],
29
28
  });