@luizleon/sf.prefeiturasp.vuecomponents 0.0.37 → 0.0.38

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/drawer/Drawer.d.ts +55 -0
  2. package/dist/components/internal/ThemeToggle.d.ts +11 -8
  3. package/dist/components/internal/getMaxZindex.d.ts +2 -0
  4. package/dist/lib.es.js +2030 -1907
  5. package/dist/lib.es.js.map +1 -1
  6. package/dist/lib.umd.js +16 -16
  7. package/dist/lib.umd.js.map +1 -1
  8. package/dist/style.css +1 -1
  9. package/package.json +3 -2
  10. package/src/components/drawer/Drawer.d.ts +55 -0
  11. package/src/components/drawer/Drawer.vue +131 -0
  12. package/src/components/internal/HeaderAvatar.vue +18 -1
  13. package/src/components/internal/getMaxZindex.ts +14 -0
  14. package/src/components/layout/Layout.vue +1 -14
  15. package/src/index.ts +0 -1
  16. package/src/services/authService.ts +3 -4
  17. package/src/style/componentes.scss +1 -1
  18. package/src/style/src/_functions.scss +3 -170
  19. package/src/style/src/_mixins.scss +70 -553
  20. package/src/style/src/_variables.scss +1 -87
  21. package/src/style/src/components/_button.scss +22 -22
  22. package/src/style/src/components/_drawer.scss +29 -39
  23. package/src/style/src/components/_icon.scss +17 -20
  24. package/src/style/src/components/_layout.scss +5 -47
  25. package/src/style/src/components/_mask.scss +35 -0
  26. package/src/style/src/components/_themetoggle.scss +30 -3
  27. package/src/style/src/sweetalert/scss/_core.scss +13 -14
  28. package/src/style/src/sweetalert/scss/_variables.scss +17 -11
  29. package/src/style/src/_animation.scss +0 -441
  30. package/src/style/src/_display.scss +0 -10
  31. package/src/style/src/_flexbox.scss +0 -85
  32. package/src/style/src/_gap.scss +0 -8
  33. package/src/style/src/_grid.scss +0 -100
  34. package/src/style/src/_normalize.scss +0 -351
  35. package/src/style/src/_ripple.scss +0 -30
  36. package/src/style/src/_size.scss +0 -98
  37. package/src/style/src/_spacing.scss +0 -42
  38. package/src/style/src/_typography.scss +0 -43
  39. package/src/style/src/components/_internal-icon-button.scss +0 -5
  40. package/src/style/tema.scss +0 -171
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luizleon/sf.prefeiturasp.vuecomponents",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.js",
6
6
  "module": "dist/lib.es.js",
@@ -12,6 +12,7 @@
12
12
  "air-datepicker": "3.3.1",
13
13
  "axios": "1.6.5",
14
14
  "date-fns": "2.29.3",
15
+ "nanoid": "5.0.4",
15
16
  "sweetalert2": "11.4.8",
16
17
  "vue-currency-input": "3.0.2"
17
18
  },
@@ -25,7 +26,7 @@
25
26
  "rimraf": "3.0.2",
26
27
  "sass": "1.69.5",
27
28
  "typescript": "5.2.2",
28
- "vite": "4.5.1",
29
+ "vite": "4.5.2",
29
30
  "vite-plugin-dts": "1.6.4",
30
31
  "vite-plugin-vue-type-imports": "0.2.3",
31
32
  "vue-tsc": "1.8.22",
@@ -0,0 +1,55 @@
1
+ import { StyleValue, VNode } from "vue";
2
+ import {
3
+ ClassComponent,
4
+ GlobalComponentConstructor,
5
+ } from "../../ts-helpers";
6
+
7
+ export interface SfDrawerProps {
8
+ visible: boolean;
9
+ position?: "left" | "right" | "bottom" | "full";
10
+ style?: StyleValue;
11
+ }
12
+
13
+ export interface SfDrawerSlots {
14
+ /**
15
+ * Default content slot.
16
+ */
17
+ default: () => VNode[];
18
+ /**
19
+ * Título da janela
20
+ */
21
+ title: () => VNode[];
22
+ /**
23
+ * Conteúdo para exibir no rodapé
24
+ */
25
+ footer: () => VNode[];
26
+ }
27
+
28
+ export declare type SfDrawerEmits = {
29
+ /**
30
+ * Emitted when the visible changes.
31
+ */
32
+ "update:visible": (value: boolean) => void;
33
+ /**
34
+ * Emitido após aberta
35
+ */
36
+ open: () => void;
37
+ /**
38
+ * Emitido antes de fechar
39
+ */
40
+ "before-close": () => void;
41
+ };
42
+
43
+ declare class SfDrawer extends ClassComponent<
44
+ SfDrawerProps,
45
+ SfDrawerSlots,
46
+ SfDrawerEmits
47
+ > {}
48
+
49
+ declare module "@vue/runtime-core" {
50
+ interface GlobalComponents {
51
+ Drawer: GlobalComponentConstructor<SfDrawer>;
52
+ }
53
+ }
54
+
55
+ export default SfDrawer;
@@ -0,0 +1,131 @@
1
+ <script setup lang="ts">
2
+ import { SfDrawerProps } from "./Drawer";
3
+ import { ref, useSlots, watch } from "vue";
4
+ import { CssClassBuilder } from "../internal/cssClassBuilder";
5
+ import { GetMaxZindex } from "../internal/getMaxZindex";
6
+ import { nanoid } from "nanoid";
7
+ import SfIcon from "../icon/Icon.vue";
8
+
9
+ const props: SfDrawerProps = withDefaults(
10
+ defineProps<SfDrawerProps>(),
11
+ {
12
+ visible: false,
13
+ position: "left",
14
+ }
15
+ );
16
+
17
+ const emit = defineEmits<{
18
+ (e: "update:visible", v: boolean): void;
19
+ (e: "open"): void;
20
+ (e: "before-close"): void;
21
+ }>();
22
+
23
+ const slots = useSlots();
24
+
25
+ const visible = ref(props.visible);
26
+
27
+ const maskVisible = ref(false);
28
+
29
+ const zIndex = ref(0);
30
+
31
+ const id = nanoid();
32
+
33
+ function Close() {
34
+ visible.value = false;
35
+ }
36
+
37
+ function OnKeydown(ev: KeyboardEvent) {
38
+ if (ev.key === "Escape" || ev.code === "Escape") {
39
+ Close();
40
+ }
41
+ }
42
+
43
+ function OnEnter() {
44
+ emit("open");
45
+ window.document.addEventListener("keydown", OnKeydown, true);
46
+ }
47
+
48
+ function OnBeforeEnter(el: Element) {
49
+ zIndex.value = GetMaxZindex();
50
+ (el as HTMLElement).style.zIndex = `${zIndex.value}`;
51
+ }
52
+
53
+ function OnBeforeLeave(el: Element) {
54
+ emit("before-close");
55
+ el?.parentElement?.classList.add("sf-mask-overlay-leave");
56
+ }
57
+
58
+ function OnAfterLeave() {
59
+ window.document.removeEventListener("keydown", OnKeydown, true);
60
+ maskVisible.value = false;
61
+ }
62
+
63
+ function CssMask() {
64
+ return new CssClassBuilder("sf-mask sf-mask-overlay")
65
+ .AddClass("right", props.position === "right")
66
+ .AddClass("bottom", props.position === "bottom")
67
+ .AddClass("full", props.position === "full")
68
+ .AddClass("sf-mask-overlay-enter", props.visible === true)
69
+ .Build();
70
+ }
71
+
72
+ watch(
73
+ () => props.visible,
74
+ (v) => {
75
+ visible.value = v;
76
+ }
77
+ );
78
+ watch(
79
+ () => visible.value,
80
+ (v) => {
81
+ emit("update:visible", v);
82
+ if (v) {
83
+ maskVisible.value = true;
84
+ }
85
+ }
86
+ );
87
+ </script>
88
+
89
+ <template>
90
+ <Teleport :to="'body'">
91
+ <div v-if="maskVisible" :id="id" :class="CssMask()">
92
+ <transition
93
+ name="sf-drawer"
94
+ appear
95
+ @before-enter="OnBeforeEnter"
96
+ @enter="OnEnter"
97
+ @before-leave="OnBeforeLeave"
98
+ @after-leave="OnAfterLeave"
99
+ >
100
+ <div
101
+ v-if="visible"
102
+ :class="[
103
+ 'sf-drawer',
104
+ {
105
+ 'sf-drawer-with-footer': !!slots.footer,
106
+ },
107
+ ]"
108
+ :style="props.style"
109
+ role="dialog"
110
+ >
111
+ <div class="sf-drawer-header">
112
+ <span class="sf-drawer-title">
113
+ <slot name="title"></slot>
114
+ </span>
115
+ <SfIcon
116
+ :button="true"
117
+ :icone="'close'"
118
+ @click.stop="Close"
119
+ />
120
+ </div>
121
+ <div class="sf-drawer-content">
122
+ <slot name="default"></slot>
123
+ </div>
124
+ <div class="sf-drawer-footer" v-if="slots.footer">
125
+ <slot name="footer"></slot>
126
+ </div>
127
+ </div>
128
+ </transition>
129
+ </div>
130
+ </Teleport>
131
+ </template>
@@ -1,5 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onMounted, ref } from "vue";
3
+ import SfDrawer from "../drawer/Drawer.vue";
4
+ import SfButton from "../button/Button.vue";
5
+ import { Cor } from "../../enum";
3
6
  import { UseDialogService } from "../../services/dialogService";
4
7
 
5
8
  const dialogService = UseDialogService();
@@ -45,13 +48,27 @@ const color = computed(() => {
45
48
  return Math.max(cor, 0);
46
49
  });
47
50
 
51
+ const showDrawer = ref(false);
52
+
48
53
  onMounted(() => {
49
54
  letters.value = Letters();
50
55
  });
51
56
  </script>
52
57
 
53
58
  <template>
54
- <div id="sf-header-avatar" :data-cor="color" @click="Logout">
59
+ <div
60
+ id="sf-header-avatar"
61
+ :data-cor="color"
62
+ @click="showDrawer = true"
63
+ >
55
64
  {{ letters }}
56
65
  </div>
66
+ <SfDrawer v-model:visible="showDrawer" :position="'right'">
67
+ <template #title>Minha conta</template>
68
+ <template #default>
69
+ <div class="sf-p-4">
70
+ <SfButton :color="Cor.Error" @click="Logout">Sair</SfButton>
71
+ </div>
72
+ </template>
73
+ </SfDrawer>
57
74
  </template>
@@ -0,0 +1,14 @@
1
+ function GetMaxZindex(seletores: string[] = []) {
2
+ let selector = "body *:not(style)";
3
+ for (const s of seletores) {
4
+ selector += `, ${s}`;
5
+ }
6
+ return Math.max(
7
+ ...Array.from(document.querySelectorAll(selector)).map((x) => {
8
+ const z = getComputedStyle(x).zIndex;
9
+ return +z === +z ? +z : 0;
10
+ })
11
+ );
12
+ }
13
+
14
+ export { GetMaxZindex };
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { onMounted } from "vue";
3
3
  import { UseNavMenuService } from "../../services/navMenuService";
4
- import Icon from "../icon/Icon.vue";
5
4
  import HeaderAvatar from "../internal/HeaderAvatar.vue";
6
5
  import MenuIcon from "../internal/MenuIcon.vue";
7
6
  import ThemeToggle from "../internal/ThemeToggle.vue";
@@ -13,10 +12,6 @@ const emit = defineEmits<{
13
12
  (event: "logout"): void;
14
13
  }>();
15
14
 
16
- function OnLogout() {
17
- emit("logout");
18
- }
19
-
20
15
  onMounted(() => {
21
16
  emit("mounted");
22
17
  });
@@ -40,17 +35,9 @@ onMounted(() => {
40
35
  </div>
41
36
  <slot name="action"> </slot>
42
37
  <ThemeToggle />
43
- <HeaderAvatar @logout="OnLogout" />
38
+ <HeaderAvatar @logout="emit('logout')" />
44
39
  </header>
45
40
  <nav :class="{ visible: navService.IsVisible }">
46
- <div class="sf-layout-nav-header">
47
- <span>Menu</span>
48
- <Icon
49
- :icone="'close'"
50
- button
51
- @click="navService.Close()"
52
- ></Icon>
53
- </div>
54
41
  <div class="sf-layout-nav-content">
55
42
  <slot name="menu"></slot>
56
43
  </div>
package/src/index.ts CHANGED
@@ -13,7 +13,6 @@ import { AppResult } from "./common/appResult";
13
13
 
14
14
  import { Cor, Tamanho } from "./enum";
15
15
 
16
- import "./style/tema.scss";
17
16
  import "./style/componentes.scss";
18
17
  import { AxiosClient, UseAxiosClient } from "./axios/axiosClient";
19
18
 
@@ -28,10 +28,9 @@ async function CheckSilentLoginFile() {
28
28
  return false;
29
29
  });
30
30
  if (!result) {
31
- console.warn(
32
- `Arquivo ${fileName} não localizado no projeto ou não possui o conteúdo correto!`
33
- );
34
- document.body.innerHTML = `<div style="padding: 3rem; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100vw; font-size: 1.5rem;">O arquivo '${fileName}' não foi encontrado.</div>`;
31
+ const error = `O arquivo ${fileName} não foi localizado no projeto ou não possui o conteúdo correto!`;
32
+ console.warn(error);
33
+ document.documentElement.setAttribute("data-app-message", error);
35
34
  }
36
35
  return result;
37
36
  }
@@ -1,6 +1,5 @@
1
1
  @import "./src/components/layout";
2
2
  @import "./src/components/themetoggle";
3
- @import "./src/components/internal-icon-button";
4
3
  @import "./src/components/svg_icon";
5
4
  @import "./src/components/loading-circle";
6
5
  @import "./src/components/icon";
@@ -13,3 +12,4 @@
13
12
  @import "./src/components/headerAvatar";
14
13
  @import "./src/components/tab-navigation";
15
14
  @import "./src/components/button";
15
+ @import "./src/components/mask";
@@ -1,171 +1,4 @@
1
- @use "sass:color";
2
-
3
- @function alpha($color, $opacity) {
4
- $color-h: unquote("var(#{$color + -color-h})");
5
- $color-s: unquote("var(#{$color + -color-s})");
6
- $color-l: unquote("var(#{$color + -color-l})");
7
- @return hsla($color-h, $color-s, $color-l, $opacity);
8
- }
9
-
10
- @function str-replace($string, $search, $replace: "") {
11
- $index: str-index($string, $search);
12
-
13
- @if $index {
14
- @return str-slice($string, 1, $index - 1) + $replace +
15
- str-replace(
16
- str-slice($string, $index + str-length($search)),
17
- $search,
18
- $replace
19
- );
20
- }
21
-
22
- @return $string;
23
- }
24
-
25
- @function tetradColor($color) {
26
- $hue: hue($color);
27
- $saturation: saturation($color);
28
- $lightness: lightness($color);
29
- $tetrad: (
30
- hsl($hue, $saturation, $lightness),
31
- hsl($hue + 90 % 360, $saturation, $lightness),
32
- hsl($hue + 180 % 360, $saturation, $lightness),
33
- hsl($hue + 270 % 360, $saturation, $lightness)
34
- );
35
- @return $tetrad;
36
- }
37
-
38
- @function multiplyColor($fore, $back) {
39
- $red: calc(red($back) * red($fore) / 255);
40
- $green: calc(green($back) * green($fore) / 255);
41
- $blue: calc(blue($back) * blue($fore) / 255);
42
- @return rgb($red, $green, $blue);
43
- }
44
-
45
- @function makeColorPalette($color) {
46
- $light: #fff;
47
- $dark: multiplyColor($color, $color);
48
- $tetrad: tetradColor($color);
49
- $palette: (
50
- "": mix($light, $color, 0%),
51
- "-50": mix($light, $color, 88%),
52
- "-100": mix($light, $color, 70%),
53
- "-200": mix($light, $color, 50%),
54
- "-300": mix($light, $color, 30%),
55
- "-400": mix($light, $color, 15%),
56
- "-500": mix($light, $color, 0%),
57
- "-600": mix($dark, $color, 13%),
58
- "-700": mix($dark, $color, 30%),
59
- "-800": mix($dark, $color, 46%),
60
- "-900": mix($dark, $color, 75%),
61
- );
62
- @return $palette;
63
- }
64
-
65
- @function themeColors($dark: false) {
66
- $bg: #fff;
67
- $text: #334d5c;
68
- $primary: #3f51b5;
69
- $info: #2196f3;
70
- $success: #4caf50;
71
- $warn: #cbb701;
72
- $help: #673ab7;
73
- $error: #f44336;
74
- $secondary: #607d8b;
75
- $disabled: #c4c4c4;
76
- $primary-hover: rgba(color.scale($primary, $lightness: 70%), 0.5);
77
- $info-hover: rgba(color.scale($info, $lightness: 70%), 0.5);
78
- $success-hover: rgba(color.scale($success, $lightness: 70%), 0.5);
79
- $warn-hover: rgba(color.scale($warn, $lightness: 70%), 0.5);
80
- $help-hover: rgba(color.scale($help, $lightness: 70%), 0.5);
81
- $error-hover: rgba(color.scale($error, $lightness: 70%), 0.5);
82
- $secondary-hover: rgba(color.scale($secondary, $lightness: 70%), 0.5);
83
- $surface: #fafafd;
84
- $surface-100: color.scale($surface, $lightness: -1%);
85
- $surface-200: color.scale($surface, $lightness: -3%);
86
- $surface-300: color.scale($surface, $lightness: -5%);
87
- $surface-400: color.scale($surface, $lightness: -7%);
88
- $surface-500: color.scale($surface, $lightness: -9%);
89
- $surface-600: color.scale($surface, $lightness: -11%);
90
- $surface-700: color.scale($surface, $lightness: -13%);
91
- $surface-800: color.scale($surface, $lightness: -15%);
92
- $surface-900: color.scale($surface, $lightness: -17%);
93
- $surface-1000: color.scale($surface, $lightness: -19%);
94
- $surface-1100: color.scale($surface, $lightness: -22%);
95
- $surface-1200: color.scale($surface, $lightness: -24%);
96
- $surface-1300: color.scale($surface, $lightness: -26%);
97
- $surface-border: $surface-800;
98
- $maskbg: color.adjust($text, $alpha: -0.2);
99
-
100
- @if ($dark) {
101
- $bg: hsl(215, 69%, 9%);
102
- $text: #cfd8dc;
103
- $primary: color.scale($primary, $lightness: 35%);
104
- $info: color.scale($info, $lightness: 22.5%);
105
- $success: color.scale($success, $lightness: 22.5%);
106
- $warn: color.scale($warn, $lightness: 22.5%);
107
- $help: color.scale($help, $lightness: 35%);
108
- $error: color.scale($error, $lightness: 22.5%);
109
- $secondary: color.scale($secondary, $lightness: 22.5%);
110
- $disabled: #576374;
111
- $primary-hover: rgba(color.scale($primary, $lightness: -70%), 0.5);
112
- $info-hover: rgba(color.scale($info, $lightness: -70%), 0.5);
113
- $success-hover: rgba(color.scale($success, $lightness: -70%), 0.5);
114
- $warn-hover: rgba(color.scale($warn, $lightness: -70%), 0.5);
115
- $help-hover: rgba(color.scale($help, $lightness: -70%), 0.5);
116
- $error-hover: rgba(color.scale($error, $lightness: -70%), 0.5);
117
- $secondary-hover: rgba(color.scale($secondary, $lightness: -70%), 0.5);
118
- $surface-100: color.scale($bg, $lightness: 2%);
119
- $surface-200: color.scale($bg, $lightness: 4%);
120
- $surface-300: color.scale($bg, $lightness: 6%);
121
- $surface-400: color.scale($bg, $lightness: 8%);
122
- $surface-500: color.scale($bg, $lightness: 10%);
123
- $surface-600: color.scale($bg, $lightness: 12%);
124
- $surface-700: color.scale($bg, $lightness: 14%);
125
- $surface-800: color.scale($bg, $lightness: 16%);
126
- $surface-900: color.scale($bg, $lightness: 18%);
127
- $surface-1000: color.scale($bg, $lightness: 20%);
128
- $surface-1100: color.scale($bg, $lightness: 22%);
129
- $surface-1200: color.scale($bg, $lightness: 24%);
130
- $surface-1300: color.scale($bg, $lightness: 26%);
131
- $surface-border: $surface-800;
132
- $maskbg: color.adjust($surface-600, $alpha: -0.4);
133
- }
134
-
135
- $v: (
136
- "--bg": $bg,
137
- "--text": $text,
138
- "--primary": $primary,
139
- "--info": $info,
140
- "--success": $success,
141
- "--warn": $warn,
142
- "--help": $help,
143
- "--error": $error,
144
- "--secondary": $secondary,
145
- "--disabled": $disabled,
146
- "--primary-hover": $primary-hover,
147
- "--info-hover": $info-hover,
148
- "--success-hover": $success-hover,
149
- "--warn-hover": $warn-hover,
150
- "--help-hover": $help-hover,
151
- "--error-hover": $error-hover,
152
- "--secondary-hover": $secondary-hover,
153
- "--surface-100": $surface-100,
154
- "--surface-200": $surface-200,
155
- "--surface-300": $surface-300,
156
- "--surface-400": $surface-400,
157
- "--surface-500": $surface-500,
158
- "--surface-600": $surface-600,
159
- "--surface-700": $surface-700,
160
- "--surface-800": $surface-800,
161
- "--surface-900": $surface-900,
162
- "--surface-1000": $surface-1000,
163
- "--surface-1100": $surface-1100,
164
- "--surface-1200": $surface-1200,
165
- "--surface-1300": $surface-1300,
166
- "--surface-border": $surface-border,
167
- "--maskbg": $maskbg,
168
- );
169
-
170
- @return $v;
1
+ @function theme-colors($dark: false) {
2
+ @return "primary", "info", "success", "warn", "help",
3
+ "error", "secondary";
171
4
  }