vueless 0.0.138 → 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 +5 -4
- package/ui.button/index.vue +2 -6
- 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 +4 -7
package/package.json
CHANGED
|
@@ -5,7 +5,8 @@ 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:ring-{color}-700
|
|
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
|
|
9
10
|
disabled:ring-0 disabled:cursor-no-drop
|
|
10
11
|
`,
|
|
11
12
|
variants: {
|
|
@@ -52,8 +53,8 @@ export default /*tw*/ {
|
|
|
52
53
|
true: "w-full",
|
|
53
54
|
},
|
|
54
55
|
color: {
|
|
55
|
-
grayscale: "focus:ring-gray-800 disabled:text-gray-400",
|
|
56
|
-
white: "focus:ring-gray-800 disabled:text-gray-400",
|
|
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",
|
|
57
58
|
},
|
|
58
59
|
},
|
|
59
60
|
compoundVariants: [
|
|
@@ -132,7 +133,7 @@ export default /*tw*/ {
|
|
|
132
133
|
{ square: true, size: "lg", class: "p-5" },
|
|
133
134
|
],
|
|
134
135
|
},
|
|
135
|
-
text: "whitespace-nowrap",
|
|
136
|
+
text: "whitespace-nowrap focus-visible:outline-none",
|
|
136
137
|
defaultVariants: {
|
|
137
138
|
color: "brand",
|
|
138
139
|
variant: "primary",
|
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. -->
|
|
@@ -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",
|
|
@@ -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": {
|