@una-ui/nuxt 1.0.0-alpha.1 → 1.0.0-alpha.3
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/module.mjs +1 -1
- package/dist/runtime/components/data/table/Table.vue +1 -0
- package/dist/runtime/components/misc/ThemeSwitcher.vue +25 -19
- package/dist/runtime/components/pin-input/PinInput.vue +139 -0
- package/dist/runtime/components/pin-input/PinInput.vue.d.ts +33 -0
- package/dist/runtime/components/pin-input/PinInputGroup.vue +28 -0
- package/dist/runtime/components/pin-input/PinInputGroup.vue.d.ts +13 -0
- package/dist/runtime/components/pin-input/PinInputSeparator.vue +30 -0
- package/dist/runtime/components/pin-input/PinInputSeparator.vue.d.ts +15 -0
- package/dist/runtime/components/pin-input/PinInputSlot.vue +46 -0
- package/dist/runtime/components/pin-input/PinInputSlot.vue.d.ts +5 -0
- package/dist/runtime/composables/useUnaSettings.js +6 -4
- package/dist/runtime/types/index.d.ts +4 -3
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/pin-input.d.ts +88 -0
- package/dist/runtime/types/pin-input.js +0 -0
- package/package.json +3 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -213,6 +213,7 @@ const table = useVueTable({
|
|
|
213
213
|
getFilteredRowModel: getFilteredRowModel(),
|
|
214
214
|
getPaginationRowModel: getPaginationRowModel(),
|
|
215
215
|
getRowId: (row) => props.rowId ? row[props.rowId] : row.id,
|
|
216
|
+
getSubRows: (row) => row.subRows,
|
|
216
217
|
getExpandedRowModel: getExpandedRowModel(),
|
|
217
218
|
onSortingChange: (updaterOrValue) => valueUpdater(updaterOrValue, sorting),
|
|
218
219
|
onRowSelectionChange: (updaterOrValue) => valueUpdater(updaterOrValue, rowSelection),
|
|
@@ -25,23 +25,23 @@ const currentPrimaryThemeName = computed(() => {
|
|
|
25
25
|
});
|
|
26
26
|
const currentGrayThemeHex = computed(() => settings.value.grayColors?.["--una-gray-hex"]);
|
|
27
27
|
const currentGrayThemeName = computed(() => {
|
|
28
|
-
if (settings.value.theme
|
|
29
|
-
return
|
|
28
|
+
if (settings.value.theme) {
|
|
29
|
+
return settings.value.theme;
|
|
30
30
|
}
|
|
31
31
|
const theme = grayThemes.find(([, theme2]) => theme2["--una-gray-hex"] === currentGrayThemeHex.value);
|
|
32
32
|
return theme ? theme[0] : "";
|
|
33
33
|
});
|
|
34
|
-
function
|
|
34
|
+
function updateTheme(theme) {
|
|
35
35
|
settings.value.theme = theme;
|
|
36
|
-
settings.value.primary =
|
|
37
|
-
settings.value.gray =
|
|
36
|
+
settings.value.primary = false;
|
|
37
|
+
settings.value.gray = false;
|
|
38
38
|
}
|
|
39
39
|
function updatePrimaryTheme(theme) {
|
|
40
|
-
settings.value.theme =
|
|
40
|
+
settings.value.theme = false;
|
|
41
41
|
settings.value.primary = theme;
|
|
42
42
|
}
|
|
43
43
|
function updateGrayTheme(theme) {
|
|
44
|
-
settings.value.theme =
|
|
44
|
+
settings.value.theme = false;
|
|
45
45
|
settings.value.gray = theme;
|
|
46
46
|
}
|
|
47
47
|
function shuffleTheme() {
|
|
@@ -114,7 +114,7 @@ function shuffleTheme() {
|
|
|
114
114
|
class="justify-start gap-2 ring-primary"
|
|
115
115
|
:aria-label="`Theme: ${theme.name}`"
|
|
116
116
|
:class="currentPrimaryThemeName === theme?.name && 'ring-2'"
|
|
117
|
-
@click="
|
|
117
|
+
@click="updateTheme(theme.name)"
|
|
118
118
|
>
|
|
119
119
|
<template #leading>
|
|
120
120
|
<Icon
|
|
@@ -169,19 +169,25 @@ function shuffleTheme() {
|
|
|
169
169
|
<div class="space-y-2">
|
|
170
170
|
<Label for="color" class="text-xs"> Gray Color </Label>
|
|
171
171
|
<div class="grid grid-cols-7 gap-3">
|
|
172
|
-
<
|
|
172
|
+
<template
|
|
173
173
|
v-for="[key, theme] in grayThemes"
|
|
174
174
|
:key="key"
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
175
|
+
>
|
|
176
|
+
<button
|
|
177
|
+
:title="capitalize(key)"
|
|
178
|
+
:style="{
|
|
179
|
+
'--c-gray': `oklch(${theme['--una-gray-600']})`,
|
|
180
|
+
'--c-gray-foreground': `oklch(${theme['--una-gray-500']})`
|
|
181
|
+
}"
|
|
182
|
+
class="bg-$c-gray transition-all dark:bg-$c-gray-foreground"
|
|
183
|
+
rounded="full"
|
|
184
|
+
square="6.5"
|
|
185
|
+
:class="[currentGrayThemeName === key ? 'ring-2' : 'scale-93']"
|
|
186
|
+
ring="gray offset-4 offset-background"
|
|
187
|
+
:aria-label="`Gray Color: ${key}`"
|
|
188
|
+
@click="updateGrayTheme(key)"
|
|
189
|
+
/>
|
|
190
|
+
</template>
|
|
185
191
|
</div>
|
|
186
192
|
</div>
|
|
187
193
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { PinInputRoot, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
import { cn, randomId } from "../../utils";
|
|
10
|
+
import PinInputGroup from "./PinInputGroup.vue";
|
|
11
|
+
import PinInputSeparator from "./PinInputSeparator.vue";
|
|
12
|
+
import PinInputSlot from "./PinInputSlot.vue";
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
defaultValue: { type: Array, required: false },
|
|
15
|
+
maxLength: { type: Number, required: false },
|
|
16
|
+
separator: { type: [Boolean, String], required: false, default: false },
|
|
17
|
+
groupBy: { type: Number, required: false, default: 0 },
|
|
18
|
+
_pinInputGroup: { type: Object, required: false },
|
|
19
|
+
_pinInputSeparator: { type: Object, required: false },
|
|
20
|
+
_pinInputSlot: { type: Object, required: false },
|
|
21
|
+
una: { type: Object, required: false },
|
|
22
|
+
modelValue: { type: null, required: false },
|
|
23
|
+
placeholder: { type: String, required: false },
|
|
24
|
+
mask: { type: Boolean, required: false },
|
|
25
|
+
otp: { type: Boolean, required: false },
|
|
26
|
+
type: { type: null, required: false, default: "text" },
|
|
27
|
+
dir: { type: String, required: false },
|
|
28
|
+
disabled: { type: Boolean, required: false },
|
|
29
|
+
id: { type: String, required: false },
|
|
30
|
+
asChild: { type: Boolean, required: false },
|
|
31
|
+
as: { type: null, required: false },
|
|
32
|
+
name: { type: String, required: false },
|
|
33
|
+
required: { type: Boolean, required: false },
|
|
34
|
+
pinInput: { type: null, required: false, default: "outline-primary" },
|
|
35
|
+
status: { type: String, required: false },
|
|
36
|
+
class: { type: null, required: false },
|
|
37
|
+
size: { type: null, required: false, default: "md" }
|
|
38
|
+
});
|
|
39
|
+
const emits = defineEmits(["update:modelValue", "complete"]);
|
|
40
|
+
const rootProps = reactivePick(props, [
|
|
41
|
+
"as",
|
|
42
|
+
"asChild",
|
|
43
|
+
"dir",
|
|
44
|
+
"defaultValue",
|
|
45
|
+
"disabled",
|
|
46
|
+
"id",
|
|
47
|
+
"mask",
|
|
48
|
+
"modelValue",
|
|
49
|
+
"name",
|
|
50
|
+
"otp",
|
|
51
|
+
"placeholder",
|
|
52
|
+
"type",
|
|
53
|
+
"required"
|
|
54
|
+
]);
|
|
55
|
+
const forwarded = useForwardPropsEmits(rootProps, emits);
|
|
56
|
+
const id = computed(() => props.id ?? randomId("pin-input"));
|
|
57
|
+
const separator = computed(() => {
|
|
58
|
+
if (props.separator === true) {
|
|
59
|
+
return "pin-input-separator-icon";
|
|
60
|
+
}
|
|
61
|
+
return props.separator;
|
|
62
|
+
});
|
|
63
|
+
const maxLength = computed(() => {
|
|
64
|
+
if (typeof props.maxLength !== "number") {
|
|
65
|
+
return props.modelValue?.length ?? 0;
|
|
66
|
+
}
|
|
67
|
+
return props.maxLength;
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<PinInputRoot
|
|
73
|
+
v-bind="forwarded"
|
|
74
|
+
:id
|
|
75
|
+
data-slot="pin-input"
|
|
76
|
+
:class="cn(
|
|
77
|
+
'pin-input',
|
|
78
|
+
props.una?.pinInput,
|
|
79
|
+
props.class
|
|
80
|
+
)"
|
|
81
|
+
:size
|
|
82
|
+
>
|
|
83
|
+
<slot>
|
|
84
|
+
<template v-if="groupBy === 0">
|
|
85
|
+
<PinInputGroup
|
|
86
|
+
v-bind="_pinInputGroup"
|
|
87
|
+
:una
|
|
88
|
+
>
|
|
89
|
+
<slot name="group">
|
|
90
|
+
<template v-for="index in maxLength" :key="index">
|
|
91
|
+
<slot name="slot" :index="index - 1">
|
|
92
|
+
<PinInputSlot
|
|
93
|
+
:index="index - 1"
|
|
94
|
+
:una
|
|
95
|
+
:status
|
|
96
|
+
:pin-input
|
|
97
|
+
v-bind="_pinInputSlot"
|
|
98
|
+
/>
|
|
99
|
+
</slot>
|
|
100
|
+
</template>
|
|
101
|
+
</slot>
|
|
102
|
+
</PinInputGroup>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<template v-else>
|
|
106
|
+
<template v-for="(groupIndex) in Math.ceil(maxLength / groupBy)" :key="groupIndex">
|
|
107
|
+
<PinInputGroup
|
|
108
|
+
v-bind="_pinInputGroup"
|
|
109
|
+
:una
|
|
110
|
+
>
|
|
111
|
+
<slot name="group">
|
|
112
|
+
<template v-for="slotInGroup in Math.min(groupBy, maxLength - (groupIndex - 1) * groupBy)" :key="slotInGroup">
|
|
113
|
+
<slot name="slot" :index="(groupIndex - 1) * groupBy + slotInGroup - 1">
|
|
114
|
+
<PinInputSlot
|
|
115
|
+
:index="(groupIndex - 1) * groupBy + slotInGroup - 1"
|
|
116
|
+
:una
|
|
117
|
+
:pin-input
|
|
118
|
+
:status
|
|
119
|
+
v-bind="_pinInputSlot"
|
|
120
|
+
/>
|
|
121
|
+
</slot>
|
|
122
|
+
</template>
|
|
123
|
+
</slot>
|
|
124
|
+
</PinInputGroup>
|
|
125
|
+
|
|
126
|
+
<template v-if="separator !== false && (separator || $slots.separator) && groupIndex < Math.ceil(maxLength / groupBy)">
|
|
127
|
+
<PinInputSeparator
|
|
128
|
+
:icon="separator"
|
|
129
|
+
:una
|
|
130
|
+
v-bind="_pinInputSeparator"
|
|
131
|
+
>
|
|
132
|
+
<slot name="separator" />
|
|
133
|
+
</PinInputSeparator>
|
|
134
|
+
</template>
|
|
135
|
+
</template>
|
|
136
|
+
</template>
|
|
137
|
+
</slot>
|
|
138
|
+
</PinInputRoot>
|
|
139
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NPinInputProps, PinInputType } from '../../types/index.js';
|
|
2
|
+
declare const _default: <T extends PinInputType = "text">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
|
|
5
|
+
readonly onComplete?: ((value: string[]) => any) | undefined;
|
|
6
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onComplete"> & NPinInputProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
7
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
8
|
+
attrs: any;
|
|
9
|
+
slots: {
|
|
10
|
+
default?: (props: {}) => any;
|
|
11
|
+
} & {
|
|
12
|
+
group?: (props: {}) => any;
|
|
13
|
+
} & {
|
|
14
|
+
slot?: (props: {
|
|
15
|
+
index: number;
|
|
16
|
+
}) => any;
|
|
17
|
+
} & {
|
|
18
|
+
group?: (props: {}) => any;
|
|
19
|
+
} & {
|
|
20
|
+
slot?: (props: {
|
|
21
|
+
index: number;
|
|
22
|
+
}) => any;
|
|
23
|
+
} & {
|
|
24
|
+
separator?: (props: {}) => any;
|
|
25
|
+
};
|
|
26
|
+
emit: ((evt: "update:modelValue", value: string[]) => void) & ((evt: "complete", value: string[]) => void);
|
|
27
|
+
}>) => import("vue").VNode & {
|
|
28
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_PrettifyLocal<T> = {
|
|
32
|
+
[K in keyof T]: T[K];
|
|
33
|
+
} & {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { Primitive, useForwardProps } from "reka-ui";
|
|
4
|
+
import { cn } from "../../utils";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
una: { type: Object, required: false },
|
|
7
|
+
asChild: { type: Boolean, required: false },
|
|
8
|
+
as: { type: null, required: false },
|
|
9
|
+
class: { type: null, required: false },
|
|
10
|
+
size: { type: null, required: false }
|
|
11
|
+
});
|
|
12
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
13
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<Primitive
|
|
18
|
+
data-slot="pin-input-group"
|
|
19
|
+
v-bind="forwardedProps"
|
|
20
|
+
:class="cn(
|
|
21
|
+
'pin-input-group',
|
|
22
|
+
props.una?.pinInputGroup,
|
|
23
|
+
props.class
|
|
24
|
+
)"
|
|
25
|
+
>
|
|
26
|
+
<slot />
|
|
27
|
+
</Primitive>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NPinInputGroupProps } from '../../types/index.js';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<NPinInputGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NPinInputGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Primitive, useForwardProps } from "reka-ui";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
import Icon from "../elements/Icon.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
icon: { type: String, required: false, default: "i-lucide-minus" },
|
|
7
|
+
una: { type: Object, required: false },
|
|
8
|
+
asChild: { type: Boolean, required: false },
|
|
9
|
+
as: { type: null, required: false },
|
|
10
|
+
class: { type: null, required: false },
|
|
11
|
+
size: { type: null, required: false }
|
|
12
|
+
});
|
|
13
|
+
const forwardedProps = useForwardProps(props);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<Primitive
|
|
18
|
+
data-slot="pin-input-separator"
|
|
19
|
+
v-bind="forwardedProps"
|
|
20
|
+
:class="cn(
|
|
21
|
+
'pin-input-separator',
|
|
22
|
+
props.una?.pinInputSeparator,
|
|
23
|
+
props.class
|
|
24
|
+
)"
|
|
25
|
+
>
|
|
26
|
+
<slot>
|
|
27
|
+
<Icon :name="icon" />
|
|
28
|
+
</slot>
|
|
29
|
+
</Primitive>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NPinInputSeparatorProps } from '../../types/index.js';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<NPinInputSeparatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NPinInputSeparatorProps> & Readonly<{}>, {
|
|
7
|
+
icon: string;
|
|
8
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { PinInputInput, useForwardProps } from "reka-ui";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { cn } from "../../utils";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
pinInput: { type: null, required: false, default: "outline-primary" },
|
|
8
|
+
status: { type: String, required: false },
|
|
9
|
+
una: { type: Object, required: false },
|
|
10
|
+
index: { type: Number, required: true },
|
|
11
|
+
disabled: { type: Boolean, required: false },
|
|
12
|
+
asChild: { type: Boolean, required: false },
|
|
13
|
+
as: { type: null, required: false },
|
|
14
|
+
icon: { type: String, required: false },
|
|
15
|
+
class: { type: null, required: false },
|
|
16
|
+
size: { type: null, required: false }
|
|
17
|
+
});
|
|
18
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
19
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
20
|
+
const statusClassVariants = computed(() => {
|
|
21
|
+
const input = {
|
|
22
|
+
info: "input-status-info pin-input-solid-info input-status-ring",
|
|
23
|
+
success: "input-status-success pin-input-solid-success input-status-ring",
|
|
24
|
+
warning: "input-status-warning pin-input-solid-warning input-status-ring",
|
|
25
|
+
error: "input-status-error pin-input-solid-error input-status-ring",
|
|
26
|
+
default: void 0
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
input: input[props.status ?? "default"]
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<PinInputInput
|
|
36
|
+
data-slot="pin-input-slot"
|
|
37
|
+
v-bind="forwardedProps"
|
|
38
|
+
:class="cn(
|
|
39
|
+
'pin-input-slot',
|
|
40
|
+
props.una?.pinInputSlot,
|
|
41
|
+
props.class,
|
|
42
|
+
statusClassVariants.input
|
|
43
|
+
)"
|
|
44
|
+
:pin-input="statusClassVariants.input === void 0 && props.pinInput"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NPinInputSlotProps } from '../../types/index.js';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<NPinInputSlotProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NPinInputSlotProps> & Readonly<{}>, {
|
|
3
|
+
pinInput: import("vue").HTMLAttributes["class"];
|
|
4
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -6,8 +6,8 @@ export function useUnaSettings() {
|
|
|
6
6
|
const { una } = useAppConfig();
|
|
7
7
|
const { getPrimaryColors, getGrayColors } = useUnaThemes();
|
|
8
8
|
const defaultSettings = {
|
|
9
|
-
primaryColors: getPrimaryColors(una.primary),
|
|
10
|
-
grayColors: getGrayColors(una.gray),
|
|
9
|
+
primaryColors: una.primary ? getPrimaryColors(una.primary) : {},
|
|
10
|
+
grayColors: una.gray ? getGrayColors(una.gray) : {},
|
|
11
11
|
primary: una.primary,
|
|
12
12
|
gray: una.gray,
|
|
13
13
|
radius: una.radius,
|
|
@@ -21,14 +21,16 @@ export function useUnaSettings() {
|
|
|
21
21
|
watch(
|
|
22
22
|
() => [settings.value.primary, settings.value.gray],
|
|
23
23
|
([primary, gray]) => {
|
|
24
|
-
settings.value.primaryColors = getPrimaryColors(primary
|
|
25
|
-
settings.value.grayColors = getGrayColors(gray
|
|
24
|
+
settings.value.primaryColors = primary ? getPrimaryColors(primary) : {};
|
|
25
|
+
settings.value.grayColors = gray ? getGrayColors(gray) : {};
|
|
26
26
|
},
|
|
27
27
|
{ immediate: true }
|
|
28
28
|
);
|
|
29
29
|
function reset() {
|
|
30
30
|
if (una.theme) {
|
|
31
31
|
settings.value.theme = una.theme;
|
|
32
|
+
settings.value.primary = false;
|
|
33
|
+
settings.value.gray = false;
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
34
36
|
settings.value.primary = defaultSettings.primary;
|
|
@@ -26,6 +26,7 @@ export * from './link.js';
|
|
|
26
26
|
export * from './navigation-menu.js';
|
|
27
27
|
export * from './number-field.js';
|
|
28
28
|
export * from './pagination.js';
|
|
29
|
+
export * from './pin-input.js';
|
|
29
30
|
export * from './popover.js';
|
|
30
31
|
export * from './progress.js';
|
|
31
32
|
export * from './radio-group.js';
|
|
@@ -62,9 +63,9 @@ export interface ColorPalette {
|
|
|
62
63
|
export interface UnaSettings {
|
|
63
64
|
primaryColors: Colors;
|
|
64
65
|
grayColors: Colors;
|
|
65
|
-
theme: string |
|
|
66
|
-
primary: string;
|
|
67
|
-
gray: string;
|
|
66
|
+
theme: string | false;
|
|
67
|
+
primary: string | false;
|
|
68
|
+
gray: string | false;
|
|
68
69
|
fontSize: number;
|
|
69
70
|
radius: number;
|
|
70
71
|
themes: {
|
|
@@ -26,6 +26,7 @@ export * from "./link.js";
|
|
|
26
26
|
export * from "./navigation-menu.js";
|
|
27
27
|
export * from "./number-field.js";
|
|
28
28
|
export * from "./pagination.js";
|
|
29
|
+
export * from "./pin-input.js";
|
|
29
30
|
export * from "./popover.js";
|
|
30
31
|
export * from "./progress.js";
|
|
31
32
|
export * from "./radio-group.js";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { PinInputInputProps, PinInputRootProps, PrimitiveProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
interface BaseExtensions {
|
|
4
|
+
/** CSS class for the component */
|
|
5
|
+
class?: HTMLAttributes['class'];
|
|
6
|
+
/** Size of the component */
|
|
7
|
+
size?: HTMLAttributes['class'];
|
|
8
|
+
}
|
|
9
|
+
export type PinInputType = 'text' | 'number';
|
|
10
|
+
export type PinInputValueType<T extends PinInputType> = T extends 'text' ? string : number;
|
|
11
|
+
export interface NPinInputProps<T extends PinInputType = 'text'> extends Omit<PinInputRootProps<T>, 'defaultValue'>, Pick<NPinInputSlotProps, 'pinInput' | 'status'>, BaseExtensions {
|
|
12
|
+
/**
|
|
13
|
+
* The default value of the pin input.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
16
|
+
defaultValue?: PinInputValueType<T>[];
|
|
17
|
+
/**
|
|
18
|
+
* The maximum number of slots to render.
|
|
19
|
+
*/
|
|
20
|
+
maxLength?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The icon to use as a separator between pin-input groups.
|
|
23
|
+
*/
|
|
24
|
+
separator?: boolean | string;
|
|
25
|
+
/**
|
|
26
|
+
* The number of slots to group together.
|
|
27
|
+
*
|
|
28
|
+
* @default 0
|
|
29
|
+
*/
|
|
30
|
+
groupBy?: number;
|
|
31
|
+
/** Props for the pin input group */
|
|
32
|
+
_pinInputGroup?: Partial<NPinInputGroupProps>;
|
|
33
|
+
/** Props for the pin input separator */
|
|
34
|
+
_pinInputSeparator?: Partial<NPinInputSeparatorProps>;
|
|
35
|
+
/** Props for the pin input slots */
|
|
36
|
+
_pinInputSlot?: Partial<NPinInputSlotProps>;
|
|
37
|
+
/**
|
|
38
|
+
* `UnaUI` preset configuration
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/pin-input.ts
|
|
41
|
+
*/
|
|
42
|
+
una?: NPinInputUnaProps;
|
|
43
|
+
}
|
|
44
|
+
export interface NPinInputGroupProps extends PrimitiveProps, BaseExtensions {
|
|
45
|
+
/** Additional properties for the una component */
|
|
46
|
+
una?: Pick<NPinInputUnaProps, 'pinInputGroup'>;
|
|
47
|
+
}
|
|
48
|
+
export interface NPinInputSlotProps extends PinInputInputProps, Pick<NPinInputSeparatorProps, 'icon'>, BaseExtensions {
|
|
49
|
+
/**
|
|
50
|
+
* Allows you to add `UnaUI` pin-input preset properties,
|
|
51
|
+
* Think of it as a shortcut for adding options or variants to the preset if available.
|
|
52
|
+
*
|
|
53
|
+
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/pin-input.ts
|
|
54
|
+
* @example
|
|
55
|
+
* pin-input="outline-indigo"
|
|
56
|
+
*/
|
|
57
|
+
pinInput?: HTMLAttributes['class'];
|
|
58
|
+
/**
|
|
59
|
+
* Update the pin input status.
|
|
60
|
+
* Useful for validations.
|
|
61
|
+
*
|
|
62
|
+
* @default null
|
|
63
|
+
*/
|
|
64
|
+
status?: 'info' | 'success' | 'warning' | 'error';
|
|
65
|
+
/** Additional properties for the una component */
|
|
66
|
+
una?: Pick<NPinInputUnaProps, 'pinInputSlot'>;
|
|
67
|
+
}
|
|
68
|
+
export interface NPinInputSeparatorProps extends PrimitiveProps, BaseExtensions {
|
|
69
|
+
/**
|
|
70
|
+
* The separator to use between pin input fields.
|
|
71
|
+
*@example
|
|
72
|
+
* 'i-lucide:dot'
|
|
73
|
+
*/
|
|
74
|
+
icon?: string;
|
|
75
|
+
/** Additional properties for the una component */
|
|
76
|
+
una?: Pick<NPinInputUnaProps, 'pinInputSeparator'>;
|
|
77
|
+
}
|
|
78
|
+
interface NPinInputUnaProps {
|
|
79
|
+
/** CSS class for the pin input root */
|
|
80
|
+
pinInput?: HTMLAttributes['class'];
|
|
81
|
+
/** CSS class for the pin input group */
|
|
82
|
+
pinInputGroup?: HTMLAttributes['class'];
|
|
83
|
+
/** CSS class for the pin input separator */
|
|
84
|
+
pinInputSeparator?: HTMLAttributes['class'];
|
|
85
|
+
/** CSS class for the pin input slots */
|
|
86
|
+
pinInputSlot?: HTMLAttributes['class'];
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@una-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.3",
|
|
5
5
|
"description": "Nuxt module for @una-ui",
|
|
6
6
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"unocss": "^66.2.0",
|
|
59
59
|
"unocss-preset-animations": "^1.2.1",
|
|
60
60
|
"vaul-vue": "^0.4.1",
|
|
61
|
-
"@una-ui/
|
|
62
|
-
"@una-ui/
|
|
61
|
+
"@una-ui/extractor-vue-script": "^1.0.0-alpha.3",
|
|
62
|
+
"@una-ui/preset": "^1.0.0-alpha.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@iconify-json/lucide": "^1.2.51",
|