pukaad-ui-lib 1.250.0 → 1.252.0
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/module.json +1 -1
- package/dist/runtime/components/input/input-checkbox.d.vue.ts +2 -0
- package/dist/runtime/components/input/input-checkbox.vue +13 -21
- package/dist/runtime/components/input/input-checkbox.vue.d.ts +2 -0
- package/dist/runtime/components/input/input-radio.vue +23 -55
- package/dist/runtime/components/ui/checkbox/Checkbox.vue +4 -11
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -5,6 +5,7 @@ export interface InputCheckboxProps {
|
|
|
5
5
|
rules?: object | string | Function;
|
|
6
6
|
indeterminate?: boolean;
|
|
7
7
|
labelPosition?: 'left' | 'right';
|
|
8
|
+
size?: number;
|
|
8
9
|
}
|
|
9
10
|
type __VLS_Props = InputCheckboxProps;
|
|
10
11
|
type __VLS_ModelProps = {
|
|
@@ -16,6 +17,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
16
17
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
18
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
18
19
|
}>, {
|
|
20
|
+
size: number;
|
|
19
21
|
name: string;
|
|
20
22
|
indeterminate: boolean;
|
|
21
23
|
labelPosition: "left" | "right";
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ShadFormField
|
|
3
|
-
:name="props.name"
|
|
4
|
-
:rules="props.rules || defaultRules"
|
|
5
|
-
v-slot="{ componentField }"
|
|
6
|
-
>
|
|
2
|
+
<ShadFormField :name="props.name" :rules="props.rules || defaultRules" v-slot="{ componentField }">
|
|
7
3
|
<ShadFormItem>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class="flex gap-2 items-center"
|
|
4
|
+
<ShadFormLabel
|
|
5
|
+
class="flex gap-2 items-center font-body-medium text-black leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
|
|
11
6
|
:class="[
|
|
12
7
|
props.labelPosition === 'left' ? 'flex-row-reverse justify-between w-full' : ''
|
|
13
8
|
]"
|
|
14
9
|
>
|
|
15
|
-
<
|
|
16
|
-
v-bind="componentField"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<ShadFormLabel
|
|
21
|
-
class="font-body-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
|
|
10
|
+
<ShadFormControl>
|
|
11
|
+
<ShadCheckbox v-bind="componentField" v-model="modelValue" :indeterminate="props.indeterminate"
|
|
12
|
+
:style="{ width: `${props.size}px`, height: `${props.size}px` }" />
|
|
13
|
+
</ShadFormControl>
|
|
14
|
+
<span
|
|
22
15
|
:class="[
|
|
23
16
|
props.labelPosition === 'left' ? 'flex-1' : ''
|
|
24
|
-
]"
|
|
25
|
-
>
|
|
17
|
+
]">
|
|
26
18
|
{{ props.label }}
|
|
27
|
-
</
|
|
28
|
-
</
|
|
29
|
-
</ShadFormControl>
|
|
19
|
+
</span>
|
|
20
|
+
</ShadFormLabel>
|
|
30
21
|
</ShadFormItem>
|
|
31
22
|
</ShadFormField>
|
|
32
23
|
</template>
|
|
@@ -38,7 +29,8 @@ const props = defineProps({
|
|
|
38
29
|
label: { type: String, required: false },
|
|
39
30
|
rules: { type: [Object, String, Function], required: false },
|
|
40
31
|
indeterminate: { type: Boolean, required: false, default: false },
|
|
41
|
-
labelPosition: { type: String, required: false, default: "right" }
|
|
32
|
+
labelPosition: { type: String, required: false, default: "right" },
|
|
33
|
+
size: { type: Number, required: false, default: 18 }
|
|
42
34
|
});
|
|
43
35
|
const defaultRules = () => true;
|
|
44
36
|
const modelValue = defineModel({ type: Boolean, ...{
|
|
@@ -5,6 +5,7 @@ export interface InputCheckboxProps {
|
|
|
5
5
|
rules?: object | string | Function;
|
|
6
6
|
indeterminate?: boolean;
|
|
7
7
|
labelPosition?: 'left' | 'right';
|
|
8
|
+
size?: number;
|
|
8
9
|
}
|
|
9
10
|
type __VLS_Props = InputCheckboxProps;
|
|
10
11
|
type __VLS_ModelProps = {
|
|
@@ -16,6 +17,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
16
17
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
18
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
18
19
|
}>, {
|
|
20
|
+
size: number;
|
|
19
21
|
name: string;
|
|
20
22
|
indeterminate: boolean;
|
|
21
23
|
labelPosition: "left" | "right";
|
|
@@ -1,54 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Field
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
:standalone="props.standalone"
|
|
6
|
-
:rules="rules"
|
|
7
|
-
v-model="modelValue"
|
|
8
|
-
>
|
|
9
|
-
<div
|
|
10
|
-
:class="[layout, layoutGapClass]"
|
|
11
|
-
:style="{
|
|
2
|
+
<Field :name="props.name" v-slot="{ field, errorMessage }" :standalone="props.standalone" :rules="rules"
|
|
3
|
+
v-model="modelValue">
|
|
4
|
+
<div :class="[layout, layoutGapClass]" :style="{
|
|
12
5
|
gap: layoutGapStyle
|
|
13
|
-
}"
|
|
14
|
-
>
|
|
6
|
+
}">
|
|
15
7
|
<template v-if="items.length > 0" v-for="(item, i) in items" :key="i">
|
|
16
8
|
<slot name="default" :item="item">
|
|
17
|
-
<label
|
|
18
|
-
|
|
19
|
-
'flex items-center font-body-large',
|
|
9
|
+
<label :class="[
|
|
10
|
+
'flex items-center font-body-medium text-black',
|
|
20
11
|
columnGapClass,
|
|
21
12
|
cursor
|
|
22
|
-
]"
|
|
23
|
-
:style="{ gap: columnGapStyle }"
|
|
24
|
-
>
|
|
13
|
+
]" :style="{ gap: columnGapStyle }">
|
|
25
14
|
<template v-if="props.labelPosition == 'left'">
|
|
26
|
-
<slot
|
|
27
|
-
:name="`label-${typeof item === 'object' ? item.value : item}-text`"
|
|
28
|
-
>
|
|
15
|
+
<slot :name="`label-${typeof item === 'object' ? item.value : item}-text`">
|
|
29
16
|
{{ typeof item === "object" ? item.label : item }}
|
|
30
17
|
</slot>
|
|
31
18
|
</template>
|
|
32
19
|
|
|
33
|
-
<input
|
|
34
|
-
|
|
35
|
-
:
|
|
36
|
-
|
|
37
|
-
:name="props.name"
|
|
38
|
-
:style="{ width: `${props.size}px`, height: `${props.size}px` }"
|
|
39
|
-
:value="typeof item === 'object' ? item.value : item"
|
|
40
|
-
:disabled="
|
|
20
|
+
<input v-bind="field"
|
|
21
|
+
:class="['appearance-none rounded-full border border-black bg-white checked:border-primary checked:bg-primary checked:shadow-[inset_0_0_0_2px_white] cursor-pointer shrink-0', cursor]"
|
|
22
|
+
type="radio" :name="props.name" :style="{ width: `${props.size}px`, height: `${props.size}px` }"
|
|
23
|
+
:value="typeof item === 'object' ? item.value : item" :disabled="
|
|
41
24
|
props.disabled || typeof item === 'object' && item.disabled
|
|
42
|
-
"
|
|
43
|
-
:checked="
|
|
25
|
+
" :checked="
|
|
44
26
|
modelValue === (typeof item === 'object' ? item.value : item)
|
|
45
|
-
"
|
|
46
|
-
/>
|
|
27
|
+
" />
|
|
47
28
|
|
|
48
29
|
<template v-if="props.labelPosition == 'right'">
|
|
49
|
-
<slot
|
|
50
|
-
:name="`label-${typeof item === 'object' ? item.value : item}-text`"
|
|
51
|
-
>
|
|
30
|
+
<slot :name="`label-${typeof item === 'object' ? item.value : item}-text`">
|
|
52
31
|
{{ typeof item === "object" ? item.label : item }}
|
|
53
32
|
</slot>
|
|
54
33
|
</template>
|
|
@@ -57,29 +36,21 @@
|
|
|
57
36
|
</template>
|
|
58
37
|
<template v-else>
|
|
59
38
|
<slot name="default" :item="item">
|
|
60
|
-
<label
|
|
61
|
-
|
|
62
|
-
'flex items-center font-body-large',
|
|
39
|
+
<label :class="[
|
|
40
|
+
'flex items-center font-body-medium text-black',
|
|
63
41
|
columnGapClass,
|
|
64
42
|
cursor
|
|
65
|
-
]"
|
|
66
|
-
:style="{ gap: columnGapStyle }"
|
|
67
|
-
>
|
|
43
|
+
]" :style="{ gap: columnGapStyle }">
|
|
68
44
|
<template v-if="props.labelPosition == 'left'">
|
|
69
45
|
<slot :name="`label-${item}-text`">
|
|
70
46
|
{{ item }}
|
|
71
47
|
</slot>
|
|
72
48
|
</template>
|
|
73
49
|
|
|
74
|
-
<input
|
|
75
|
-
|
|
76
|
-
:
|
|
77
|
-
|
|
78
|
-
:name="props.name"
|
|
79
|
-
:style="{ width: `${props.size}px`, height: `${props.size}px` }"
|
|
80
|
-
:value="item"
|
|
81
|
-
:disabled="props.disabled"
|
|
82
|
-
/>
|
|
50
|
+
<input v-bind="field"
|
|
51
|
+
:class="['appearance-none rounded-full border border-black bg-white checked:border-primary checked:bg-primary checked:shadow-[inset_0_0_0_2px_white] cursor-pointer shrink-0', cursor]"
|
|
52
|
+
type="radio" :name="props.name" :style="{ width: `${props.size}px`, height: `${props.size}px` }"
|
|
53
|
+
:value="item" :disabled="props.disabled" />
|
|
83
54
|
|
|
84
55
|
<template v-if="props.labelPosition == 'right'">
|
|
85
56
|
<slot :name="`label-${item}-text`">
|
|
@@ -90,10 +61,7 @@
|
|
|
90
61
|
</slot>
|
|
91
62
|
</template>
|
|
92
63
|
|
|
93
|
-
<div
|
|
94
|
-
v-if="!props.disabledErrorMessage && errorMessage"
|
|
95
|
-
class="font-body-small text-error"
|
|
96
|
-
>
|
|
64
|
+
<div v-if="!props.disabledErrorMessage && errorMessage" class="font-body-small text-error">
|
|
97
65
|
<slot name="error">
|
|
98
66
|
{{ errorMessage }}
|
|
99
67
|
</slot>
|
|
@@ -21,20 +21,13 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<template>
|
|
24
|
-
<CheckboxRoot
|
|
25
|
-
data-slot="checkbox"
|
|
26
|
-
v-bind="forwarded"
|
|
27
|
-
:class="
|
|
24
|
+
<CheckboxRoot data-slot="checkbox" v-bind="forwarded" :class="
|
|
28
25
|
cn(
|
|
29
|
-
'flex items-center justify-center peer border-
|
|
26
|
+
'flex items-center justify-center peer border-black data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[2px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
|
|
30
27
|
props.class
|
|
31
28
|
)
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
<CheckboxIndicator
|
|
35
|
-
data-slot="checkbox-indicator"
|
|
36
|
-
class="grid place-content-center text-current transition-none"
|
|
37
|
-
>
|
|
29
|
+
">
|
|
30
|
+
<CheckboxIndicator data-slot="checkbox-indicator" class="grid place-content-center text-current transition-none">
|
|
38
31
|
<slot>
|
|
39
32
|
<Icon v-if="props.indeterminate" name="lucide:minus" size="16" />
|
|
40
33
|
<Icon v-else name="lucide:check" />
|