@luizleon/sf.prefeiturasp.vuecomponents 0.0.14 → 0.0.16
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/dist/components/button/Button.d.ts +42 -0
- package/dist/index.d.ts +2 -1
- package/dist/lib.es.js +871 -819
- package/dist/lib.es.js.map +1 -1
- package/dist/lib.umd.js +11 -11
- package/dist/lib.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.d.ts +42 -0
- package/src/components/button/Button.vue +61 -0
- package/src/index.ts +2 -0
- package/src/style/componentes.scss +1 -0
- package/src/style/src/components/_button.scss +107 -0
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VNode } from "vue";
|
|
2
|
+
import { StyleValue } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
ClassComponent,
|
|
5
|
+
GlobalComponentConstructor,
|
|
6
|
+
} from "../../ts-helpers";
|
|
7
|
+
|
|
8
|
+
export interface SfButtonProps {
|
|
9
|
+
icon?: string;
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
class?: any;
|
|
12
|
+
style?: StyleValue;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
color?: Color;
|
|
16
|
+
size?: Size;
|
|
17
|
+
variant?: "filled" | "outlined" | "text";
|
|
18
|
+
autofocus?: boolean;
|
|
19
|
+
form?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
type?: "submit" | "reset" | "button";
|
|
23
|
+
value?: string | string[] | number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SfButtonSlots {}
|
|
27
|
+
|
|
28
|
+
export declare type SfButtonEmits = {};
|
|
29
|
+
|
|
30
|
+
declare class SfButton extends ClassComponent<
|
|
31
|
+
SfButtonProps,
|
|
32
|
+
SfButtonSlots,
|
|
33
|
+
SfButtonEmits
|
|
34
|
+
> {}
|
|
35
|
+
|
|
36
|
+
declare module "@vue/runtime-core" {
|
|
37
|
+
interface GlobalComponents {
|
|
38
|
+
SfButton: GlobalComponentConstructor<SfButton>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default SfButton;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Icon from "../icon/Icon.vue";
|
|
3
|
+
import { CssClassBuilder } from "../internal/cssClassBuilder";
|
|
4
|
+
import { SfButtonProps } from "./Button";
|
|
5
|
+
|
|
6
|
+
const props: SfButtonProps = withDefaults(
|
|
7
|
+
defineProps<SfButtonProps>(),
|
|
8
|
+
{
|
|
9
|
+
visible: true,
|
|
10
|
+
color: "primary",
|
|
11
|
+
size: "md",
|
|
12
|
+
type: "button",
|
|
13
|
+
variant: "filled",
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
function CssClass() {
|
|
18
|
+
return new CssClassBuilder(`${props.class ?? ""} sf-button`)
|
|
19
|
+
.AddClass("sf-component-loading", props.loading)
|
|
20
|
+
.AddClass("sf-component-disabled", props.disabled)
|
|
21
|
+
.AddClass("sf-button-small", props.size === "sm")
|
|
22
|
+
.AddClass("sf-button-medium", props.size === "md")
|
|
23
|
+
.AddClass("sf-button-large", props.size === "lg")
|
|
24
|
+
.AddClass("sf-button-filled", props.variant === "filled")
|
|
25
|
+
.AddClass("sf-button-text", props.variant === "text")
|
|
26
|
+
.AddClass("sf-button-outlined", props.variant === "outlined")
|
|
27
|
+
.AddClass("sf-button-with-icon", !!props.icon)
|
|
28
|
+
.AddClass("sf-ripple")
|
|
29
|
+
.Build();
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<button
|
|
35
|
+
:id="props.id"
|
|
36
|
+
:name="props.name"
|
|
37
|
+
:class="CssClass()"
|
|
38
|
+
:style="props.style"
|
|
39
|
+
:disabled="props.disabled || props.loading"
|
|
40
|
+
:data-color="props.color"
|
|
41
|
+
:form="props.form"
|
|
42
|
+
:type="props.type"
|
|
43
|
+
>
|
|
44
|
+
<Icon
|
|
45
|
+
v-if="!!props.icon"
|
|
46
|
+
:icon="props.icon"
|
|
47
|
+
:loading="props.loading"
|
|
48
|
+
:size="props.size"
|
|
49
|
+
:button-props="{ tabindex: -1 }"
|
|
50
|
+
/>
|
|
51
|
+
<Icon
|
|
52
|
+
v-else-if="props.loading"
|
|
53
|
+
:loading="true"
|
|
54
|
+
:size="props.size"
|
|
55
|
+
:button-props="{ tabindex: -1 }"
|
|
56
|
+
/>
|
|
57
|
+
<span class="sf-button-label">
|
|
58
|
+
<slot name="default"></slot>
|
|
59
|
+
</span>
|
|
60
|
+
</button>
|
|
61
|
+
</template>
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import SfIcon from "./components/icon/Icon.vue";
|
|
|
3
3
|
import SfNavMenuLink from "./components/navmenulink/NavMenuLink.vue";
|
|
4
4
|
import SfContent from "./components/content/Content.vue";
|
|
5
5
|
import SfTabNavigation from "./components/tabnavigation/TabNavigation.vue";
|
|
6
|
+
import SfButton from "./components/button/Button.vue";
|
|
6
7
|
|
|
7
8
|
import { UseNavMenuService } from "./services/navMenuService";
|
|
8
9
|
import { UseDialogService } from "./services/dialogService";
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
SfNavMenuLink,
|
|
23
24
|
SfContent,
|
|
24
25
|
SfTabNavigation,
|
|
26
|
+
SfButton,
|
|
25
27
|
AuthService,
|
|
26
28
|
AppResult,
|
|
27
29
|
UseNavMenuService,
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@use "../mixins";
|
|
2
|
+
|
|
3
|
+
.sf-button {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
transition: opacity 0.2s ease-in-out;
|
|
11
|
+
&:hover {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sf-button-label {
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sf-icon {
|
|
20
|
+
position: absolute;
|
|
21
|
+
> button {
|
|
22
|
+
color: currentColor !important;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.sf-component-loading {
|
|
27
|
+
color: var(--disabled-color) !important;
|
|
28
|
+
border-color: var(--disabled-color) !important;
|
|
29
|
+
.sf-button-label {
|
|
30
|
+
color: transparent !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.sf-button-filled:disabled {
|
|
35
|
+
background-color: hsla(
|
|
36
|
+
var(--disabled-color-h),
|
|
37
|
+
var(--disabled-color-s),
|
|
38
|
+
var(--disabled-color-l),
|
|
39
|
+
0.5
|
|
40
|
+
) !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.sf-button-small {
|
|
44
|
+
height: 32px;
|
|
45
|
+
font-size: 0.875rem;
|
|
46
|
+
padding: 0 12px;
|
|
47
|
+
&.sf-button-with-icon {
|
|
48
|
+
padding-left: 28px;
|
|
49
|
+
}
|
|
50
|
+
.sf-icon {
|
|
51
|
+
inset: 0 0 0 6px;
|
|
52
|
+
&.sf-component-loading {
|
|
53
|
+
inset: 0 0 0 50%;
|
|
54
|
+
margin-left: -8px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
.sf-button-label {
|
|
58
|
+
line-height: 32px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.sf-button-medium {
|
|
63
|
+
height: 36px;
|
|
64
|
+
font-size: 1rem;
|
|
65
|
+
padding: 0 12px;
|
|
66
|
+
&.sf-button-with-icon {
|
|
67
|
+
padding-left: 38px;
|
|
68
|
+
}
|
|
69
|
+
.sf-icon {
|
|
70
|
+
inset: 0 0 0 8px;
|
|
71
|
+
&.sf-component-loading {
|
|
72
|
+
inset: 0 0 0 50%;
|
|
73
|
+
margin-left: -12px;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.sf-button-label {
|
|
77
|
+
line-height: 36px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.sf-button-large {
|
|
82
|
+
height: 48px;
|
|
83
|
+
font-size: 1.25rem;
|
|
84
|
+
padding: 0 16px;
|
|
85
|
+
&.sf-button-with-icon {
|
|
86
|
+
padding-left: 54px;
|
|
87
|
+
}
|
|
88
|
+
.sf-icon {
|
|
89
|
+
inset: 0 0 0 10px;
|
|
90
|
+
&.sf-component-loading {
|
|
91
|
+
inset: 0 0 0 50%;
|
|
92
|
+
margin-left: -18px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
.sf-button-label {
|
|
96
|
+
line-height: 48px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@include button-colors;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
html.dark {
|
|
104
|
+
.sf-button {
|
|
105
|
+
@include button-colors(true);
|
|
106
|
+
}
|
|
107
|
+
}
|