vueless 0.0.137 → 0.0.139
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/package.json +1 -1
- package/ui.button/configs/default.config.js +35 -29
- package/ui.button/index.vue +3 -7
- package/ui.button-toggle/configs/default.config.js +2 -2
- package/ui.button-toggle-item/composables/attrs.composable.js +4 -42
- package/ui.button-toggle-item/configs/default.config.js +1 -48
- package/ui.button-toggle-item/index.vue +37 -32
- package/web-types.json +5 -8
package/package.json
CHANGED
|
@@ -5,39 +5,41 @@ export default /*tw*/ {
|
|
|
5
5
|
text-base font-medium outline-none
|
|
6
6
|
border border-solid rounded-lg
|
|
7
7
|
transition duration-100 ease-in-out
|
|
8
|
-
focus:ring-opacity-20 focus:ring-4 focus:
|
|
9
|
-
|
|
8
|
+
focus:ring-opacity-20 focus:ring-4 focus:ring-{color}-700
|
|
9
|
+
focus-within:ring-opacity-20 focus-within:ring-4 focus-within:ring-{color}-700
|
|
10
10
|
disabled:ring-0 disabled:cursor-no-drop
|
|
11
11
|
`,
|
|
12
12
|
variants: {
|
|
13
13
|
size: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
"2xs": "px-3 py-1 text-2xs leading-tight gap-1",
|
|
15
|
+
xs: "px-4 py-1.5 text-xs leading-tight gap-1.5",
|
|
16
|
+
sm: "px-5 py-2.5 text-sm leading-tight gap-1.5",
|
|
17
|
+
md: "px-6 py-3.5 text-base leading-tight gap-2",
|
|
18
|
+
lg: "px-7 py-4 text-lg leading-tight gap-2.5",
|
|
19
|
+
xl: "px-8 py-5 text-xl leading-tight gap-2.5",
|
|
18
20
|
},
|
|
19
21
|
variant: {
|
|
20
22
|
primary: `
|
|
21
23
|
text-white
|
|
22
24
|
bg-{color}-600 border-{color}-600
|
|
23
25
|
hover:bg-{color}-700 hover:border-{color}-700
|
|
24
|
-
focus:bg-{color}-700 focus:border-{color}-700
|
|
25
|
-
active:bg-{color}-800 active:border-{color}-800
|
|
26
|
+
focus:bg-{color}-700 focus:border-{color}-700
|
|
27
|
+
active:bg-{color}-800 active:border-{color}-800
|
|
26
28
|
disabled:bg-{color}-300 disabled:border-{color}-300 disabled:text-white
|
|
27
29
|
`,
|
|
28
30
|
secondary: `
|
|
29
31
|
text-{color}-600 border-{color}-600
|
|
30
32
|
hover:text-{color}-700 hover:border-{color}-700
|
|
31
|
-
focus:text-{color}-700 focus:border-{color}-700
|
|
32
|
-
active:text-{color}-800 active:border-{color}-800
|
|
33
|
+
focus:text-{color}-700 focus:border-{color}-700
|
|
34
|
+
active:text-{color}-800 active:border-{color}-800
|
|
33
35
|
disabled:text-{color}-300 disabled:border-{color}-300
|
|
34
36
|
`,
|
|
35
37
|
thirdary: `
|
|
36
38
|
border-transparent
|
|
37
39
|
text-{color}-600
|
|
38
40
|
hover:text-{color}-700 hover:bg-{color}-700 hover:bg-opacity-10
|
|
39
|
-
focus:text-{color}-700 focus:bg-{color}-700 focus:bg-opacity-10
|
|
40
|
-
active:text-{color}-800 active:bg-{color}-800 active:bg-opacity-15
|
|
41
|
+
focus:text-{color}-700 focus:bg-{color}-700 focus:bg-opacity-10
|
|
42
|
+
active:text-{color}-800 active:bg-{color}-800 active:bg-opacity-15
|
|
41
43
|
disabled:text-{color}-300
|
|
42
44
|
`,
|
|
43
45
|
},
|
|
@@ -51,8 +53,8 @@ export default /*tw*/ {
|
|
|
51
53
|
true: "w-full",
|
|
52
54
|
},
|
|
53
55
|
color: {
|
|
54
|
-
grayscale: "focus:ring-gray-800
|
|
55
|
-
white: "focus:ring-gray-800
|
|
56
|
+
grayscale: "focus:ring-gray-800 focus-within:ring-gray-800 disabled:text-gray-400",
|
|
57
|
+
white: "focus:ring-gray-800 focus-within:ring-gray-800 disabled:text-gray-400",
|
|
56
58
|
},
|
|
57
59
|
},
|
|
58
60
|
compoundVariants: [
|
|
@@ -83,9 +85,10 @@ export default /*tw*/ {
|
|
|
83
85
|
variant: "thirdary",
|
|
84
86
|
class: `
|
|
85
87
|
text-gray-900
|
|
86
|
-
hover:text-gray-800 hover:bg-gray-800
|
|
87
|
-
focus:text-gray-800 focus:bg-gray-800
|
|
88
|
-
active:text-gray-700 active:bg-gray-700
|
|
88
|
+
hover:text-gray-800 hover:bg-gray-800
|
|
89
|
+
focus:text-gray-800 focus:bg-gray-800
|
|
90
|
+
active:text-gray-700 active:bg-gray-700
|
|
91
|
+
disabled:bg-transparent
|
|
89
92
|
`,
|
|
90
93
|
},
|
|
91
94
|
{
|
|
@@ -102,10 +105,10 @@ export default /*tw*/ {
|
|
|
102
105
|
color: "white",
|
|
103
106
|
variant: "secondary",
|
|
104
107
|
class: `
|
|
105
|
-
text-gray-900 border-
|
|
106
|
-
hover:text-gray-800 hover:border-gray-
|
|
107
|
-
focus:text-gray-800 focus:border-gray-
|
|
108
|
-
active:text-gray-700 active:border-gray-
|
|
108
|
+
text-gray-900 border-gray-200
|
|
109
|
+
hover:text-gray-800 hover:border-gray-300
|
|
110
|
+
focus:text-gray-800 focus:border-gray-300
|
|
111
|
+
active:text-gray-700 active:border-gray-400
|
|
109
112
|
`,
|
|
110
113
|
},
|
|
111
114
|
{
|
|
@@ -113,26 +116,29 @@ export default /*tw*/ {
|
|
|
113
116
|
variant: "thirdary",
|
|
114
117
|
class: `
|
|
115
118
|
text-gray-900
|
|
116
|
-
hover:text-gray-800 hover:bg-white
|
|
117
|
-
focus:text-gray-800 focus:bg-white
|
|
118
|
-
active:text-gray-700 active:bg-white
|
|
119
|
+
hover:text-gray-800 hover:bg-white
|
|
120
|
+
focus:text-gray-800 focus:bg-white
|
|
121
|
+
active:text-gray-700 active:bg-white
|
|
122
|
+
disabled:bg-transparent
|
|
119
123
|
`,
|
|
120
124
|
},
|
|
121
|
-
{ filled: true, variant: "thirdary", class: "bg-{color}-
|
|
125
|
+
{ filled: true, variant: "thirdary", class: "bg-{color}-700 bg-opacity-10" },
|
|
122
126
|
{ filled: true, variant: "thirdary", color: "grayscale", class: "bg-gray-800 bg-opacity-10" },
|
|
123
127
|
{ filled: true, variant: "thirdary", color: "white", class: "bg-gray-50" },
|
|
124
128
|
{ square: true, size: "xs", class: "p-1" },
|
|
125
|
-
{ square: true, size: "
|
|
126
|
-
{ square: true, size: "
|
|
129
|
+
{ square: true, size: "xs", class: "p-1.5" },
|
|
130
|
+
{ square: true, size: "sm", class: "p-2.5" },
|
|
131
|
+
{ square: true, size: "md", class: "p-3.5" },
|
|
127
132
|
{ square: true, size: "lg", class: "p-4" },
|
|
133
|
+
{ square: true, size: "lg", class: "p-5" },
|
|
128
134
|
],
|
|
129
135
|
},
|
|
130
|
-
text: "whitespace-nowrap",
|
|
136
|
+
text: "whitespace-nowrap focus-visible:outline-none",
|
|
131
137
|
defaultVariants: {
|
|
132
138
|
color: "brand",
|
|
133
139
|
variant: "primary",
|
|
134
|
-
size: "md",
|
|
135
140
|
tag: "button",
|
|
141
|
+
size: "md",
|
|
136
142
|
pill: false,
|
|
137
143
|
block: false,
|
|
138
144
|
square: false,
|
package/ui.button/index.vue
CHANGED
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
<slot v-if="!loading" name="left" />
|
|
13
13
|
|
|
14
14
|
<!-- @slot Use it to add something instead of text. -->
|
|
15
|
-
<slot v-if="!loading"
|
|
16
|
-
<div v-if="label" v-bind="textAttrs" v-text="label" />
|
|
17
|
-
</slot>
|
|
15
|
+
<slot v-if="!loading" />
|
|
18
16
|
|
|
17
|
+
<div v-if="label" v-bind="textAttrs" tabindex="-1" v-text="label" />
|
|
19
18
|
<ULoader v-if="loading" :size="size" color="white" />
|
|
20
19
|
|
|
21
20
|
<!-- @slot Use it to add something after text. -->
|
|
@@ -65,7 +64,7 @@ const props = defineProps({
|
|
|
65
64
|
|
|
66
65
|
/**
|
|
67
66
|
* Button size.
|
|
68
|
-
* @values xs, sm, md, lg
|
|
67
|
+
* @values 2xs, xs, sm, md, lg, xl
|
|
69
68
|
*/
|
|
70
69
|
size: {
|
|
71
70
|
type: String,
|
|
@@ -163,8 +162,5 @@ function onClick(event) {
|
|
|
163
162
|
if (props.disabled) return;
|
|
164
163
|
|
|
165
164
|
emit("click", event);
|
|
166
|
-
|
|
167
|
-
// TODO: Maybe this should be removed (need to test)
|
|
168
|
-
//document.getElementById(props.id).blur();
|
|
169
165
|
}
|
|
170
166
|
</script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: `
|
|
3
3
|
flex gap-px
|
|
4
|
-
[&>*:first-child]:rounded-l-lg [&>*:first-child]:rounded-r-none
|
|
5
|
-
[&>*:last-child]:rounded-r-lg [&>*:last-child]:rounded-l-none
|
|
4
|
+
[&>*:first-child]:rounded-l-lg [&>*:first-child]:rounded-r-none
|
|
5
|
+
[&>*:last-child]:rounded-r-lg [&>*:last-child]:rounded-l-none
|
|
6
6
|
`,
|
|
7
7
|
toggleItem: "",
|
|
8
8
|
defaultVariants: {
|
|
@@ -1,53 +1,15 @@
|
|
|
1
|
-
import { computed, toValue } from "vue";
|
|
2
1
|
import useUI from "../../composable.ui";
|
|
3
|
-
import { cva } from "../../service.ui";
|
|
4
2
|
|
|
5
3
|
import defaultConfig from "../configs/default.config";
|
|
6
4
|
|
|
7
|
-
export function useAttrs(props
|
|
8
|
-
const {
|
|
9
|
-
const { label, labelText, wrapper } = config.value;
|
|
5
|
+
export function useAttrs(props) {
|
|
6
|
+
const { getAttrs } = useUI(defaultConfig, () => props.config);
|
|
10
7
|
|
|
11
|
-
const
|
|
12
|
-
base: wrapper.base,
|
|
13
|
-
variants: wrapper.variants,
|
|
14
|
-
compoundVariants: wrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const cvaLabelText = cva({
|
|
18
|
-
base: labelText.base,
|
|
19
|
-
variants: labelText.variants,
|
|
20
|
-
compoundVariants: labelText.compoundVariants,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const cvaLabel = cva({
|
|
24
|
-
base: label.base,
|
|
25
|
-
variants: label.variants,
|
|
26
|
-
compoundVariants: label.compoundVariants,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const wrapperClasses = computed(() => cvaWrapper({ block: toValue(block) }));
|
|
30
|
-
|
|
31
|
-
const labelTextClasses = computed(() => cvaLabelText({ size: toValue(size) }));
|
|
32
|
-
|
|
33
|
-
const labelClasses = computed(() =>
|
|
34
|
-
cvaLabel({
|
|
35
|
-
size: toValue(size),
|
|
36
|
-
variant: toValue(variant),
|
|
37
|
-
disabled: props.disabled,
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
|
|
8
|
+
const buttonAttrs = getAttrs("button");
|
|
42
9
|
const inputAttrs = getAttrs("input");
|
|
43
|
-
const labelAttrs = getAttrs("label", { classes: labelClasses });
|
|
44
|
-
const labelTextAttrs = getAttrs("labelText", { classes: labelTextClasses });
|
|
45
10
|
|
|
46
11
|
return {
|
|
12
|
+
buttonAttrs,
|
|
47
13
|
inputAttrs,
|
|
48
|
-
wrapperAttrs,
|
|
49
|
-
labelTextAttrs,
|
|
50
|
-
labelAttrs,
|
|
51
|
-
hasSlotContent,
|
|
52
14
|
};
|
|
53
15
|
}
|
|
@@ -1,53 +1,6 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
|
|
3
|
-
base: "w-fit",
|
|
4
|
-
variants: {
|
|
5
|
-
block: {
|
|
6
|
-
true: "w-full",
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
},
|
|
2
|
+
button: "rounded-none",
|
|
10
3
|
input: "p-0 m-0 size-0 invisible peer absolute",
|
|
11
|
-
label: {
|
|
12
|
-
base: "font-medium w-full flex items-center justify-center cursor-pointer",
|
|
13
|
-
variants: {
|
|
14
|
-
variant: {
|
|
15
|
-
primary: `
|
|
16
|
-
bg-gray-900/5 hover:bg-gray-900/10 active:bg-gray-900/15
|
|
17
|
-
peer-focus:border-gray-100 peer-focus:bg-opacity-10 peer-focus:ring-4 peer-focus:ring-gray-600/15
|
|
18
|
-
focus:border-gray-100 focus:bg-opacity-10 focus:ring-4 focus:ring-gray-600/15
|
|
19
|
-
peer-checked:bg-gray-900/15
|
|
20
|
-
`,
|
|
21
|
-
secondary: `
|
|
22
|
-
bg-transparent border hover:text-opacity-80 hover:border-opacity-80
|
|
23
|
-
peer-focus:text-opacity-100 peer-focus:border-opacity-100
|
|
24
|
-
focus:text-opacity-100 focus:border-opacity-100
|
|
25
|
-
peer-checked:text-opacity-100 peer-checked:border-opacity-100
|
|
26
|
-
`,
|
|
27
|
-
thirdary: `
|
|
28
|
-
bg-transparent opacity-50 border-none hover:border-none hover:opacity-100 hover:ring-0
|
|
29
|
-
peer-focus:border-none peer-focus:bg-gray-100 peer-focus:bg-opacity-10 peer-focus:opacity-100
|
|
30
|
-
peer-focus:ring-0 peer-checked:bg-transparent peer-checked:opacity-100
|
|
31
|
-
focus:border-none focus:bg-gray-100 focus:bg-opacity-10 focus:opacity-100 focus:ring-0
|
|
32
|
-
`,
|
|
33
|
-
},
|
|
34
|
-
size: {
|
|
35
|
-
sm: "gap-1.5 p-3.5",
|
|
36
|
-
md: "p-[1.125rem] gap-2",
|
|
37
|
-
lg: "gap-2.5 p-[1.375rem]",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
labelText: {
|
|
42
|
-
base: "font-medium text-center w-full",
|
|
43
|
-
variants: {
|
|
44
|
-
size: {
|
|
45
|
-
sm: "text-sm",
|
|
46
|
-
md: "font-base",
|
|
47
|
-
lg: "text-lg",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
4
|
defaultVariants: {
|
|
52
5
|
variant: "primary",
|
|
53
6
|
type: "radio",
|
|
@@ -1,34 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
2
|
+
<UButton
|
|
3
|
+
tag="label"
|
|
4
|
+
tabindex="0"
|
|
5
|
+
:for="id"
|
|
6
|
+
:label="label"
|
|
7
|
+
:size="toValue(size)"
|
|
8
|
+
:block="toValue(block)"
|
|
9
|
+
:variant="toValue(variant)"
|
|
10
|
+
v-bind="buttonAttrs"
|
|
11
|
+
@click="onClickSetValue"
|
|
12
|
+
>
|
|
13
|
+
<template #left>
|
|
14
|
+
<slot name="left" />
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<template #default>
|
|
18
|
+
<input
|
|
19
|
+
:id="id"
|
|
20
|
+
v-model="selectedItem"
|
|
21
|
+
:name="name"
|
|
22
|
+
:type="type"
|
|
23
|
+
:value="value"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
v-bind="inputAttrs"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<slot name="default" />
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<template #right>
|
|
32
|
+
<slot name="right" />
|
|
33
|
+
</template>
|
|
34
|
+
</UButton>
|
|
28
35
|
</template>
|
|
29
36
|
|
|
30
37
|
<script setup>
|
|
31
|
-
import { inject, onMounted, ref } from "vue";
|
|
38
|
+
import { inject, onMounted, ref, toValue } from "vue";
|
|
39
|
+
|
|
40
|
+
import UButton from "../ui.button";
|
|
32
41
|
import UIService, { getRandomId } from "../service.ui";
|
|
33
42
|
|
|
34
43
|
import { TYPE_RADIO } from "../ui.button-toggle/constants";
|
|
@@ -108,11 +117,7 @@ const block = inject("toggleBlock", UIService.get(defaultConfig, UToggleItem).de
|
|
|
108
117
|
const variant = inject("toggleVariant", UIService.get(defaultConfig, UToggleItem).default.variant);
|
|
109
118
|
const { selectedValue, updateSelectedValue } = inject("toggleSelectedValue", {});
|
|
110
119
|
|
|
111
|
-
const {
|
|
112
|
-
size,
|
|
113
|
-
block,
|
|
114
|
-
variant,
|
|
115
|
-
});
|
|
120
|
+
const { buttonAttrs, inputAttrs } = useAttrs(props);
|
|
116
121
|
|
|
117
122
|
const selectedItem = ref("");
|
|
118
123
|
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.139",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -576,7 +576,7 @@
|
|
|
576
576
|
"description": "Button size.",
|
|
577
577
|
"value": {
|
|
578
578
|
"kind": "expression",
|
|
579
|
-
"type": "'xs' | 'sm' | 'md' | 'lg'"
|
|
579
|
+
"type": "'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'"
|
|
580
580
|
},
|
|
581
581
|
"default": "md"
|
|
582
582
|
},
|
|
@@ -7146,16 +7146,13 @@
|
|
|
7146
7146
|
],
|
|
7147
7147
|
"slots": [
|
|
7148
7148
|
{
|
|
7149
|
-
"name": "left"
|
|
7150
|
-
"description": "Use it to add some content before label."
|
|
7149
|
+
"name": "left"
|
|
7151
7150
|
},
|
|
7152
7151
|
{
|
|
7153
|
-
"name": "default"
|
|
7154
|
-
"description": "Use it to add some content instead of label."
|
|
7152
|
+
"name": "default"
|
|
7155
7153
|
},
|
|
7156
7154
|
{
|
|
7157
|
-
"name": "right"
|
|
7158
|
-
"description": "Use it to add some content after label."
|
|
7155
|
+
"name": "right"
|
|
7159
7156
|
}
|
|
7160
7157
|
],
|
|
7161
7158
|
"source": {
|