@una-ui/nuxt-edge 1.0.0-alpha.1-29179535.5c5a2cb → 1.0.0-alpha.1-29182152.ce98054

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt-edge",
3
3
  "configKey": "una",
4
- "version": "1.0.0-alpha.1-29179535.5c5a2cb",
4
+ "version": "1.0.0-alpha.1-29182152.ce98054",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -8,7 +8,7 @@ import 'unocss';
8
8
  import 'unocss-preset-animations';
9
9
 
10
10
  const name = "@una-ui/nuxt-edge";
11
- const version = "1.0.0-alpha.1-29179535.5c5a2cb";
11
+ const version = "1.0.0-alpha.1-29182152.ce98054";
12
12
 
13
13
  const module = defineNuxtModule({
14
14
  meta: {
@@ -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;
@@ -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';
@@ -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-edge",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.1-29179535.5c5a2cb",
4
+ "version": "1.0.0-alpha.1-29182152.ce98054",
5
5
  "description": "Nuxt module for @una-ui",
6
6
  "author": "Phojie Rengel <phojrengel@gmail.com>",
7
7
  "license": "MIT",
@@ -41,8 +41,8 @@
41
41
  "@nuxt/kit": "^3.17.5",
42
42
  "@nuxtjs/color-mode": "^3.5.2",
43
43
  "@tanstack/vue-table": "^8.21.3",
44
- "@una-ui/extractor-vue-script": "npm:@una-ui/extractor-vue-script-edge@1.0.0-alpha.1-29179535.5c5a2cb",
45
- "@una-ui/preset": "npm:@una-ui/preset-edge@1.0.0-alpha.1-29179535.5c5a2cb",
44
+ "@una-ui/extractor-vue-script": "npm:@una-ui/extractor-vue-script-edge@1.0.0-alpha.1-29182152.ce98054",
45
+ "@una-ui/preset": "npm:@una-ui/preset-edge@1.0.0-alpha.1-29182152.ce98054",
46
46
  "@unocss/core": "^66.2.0",
47
47
  "@unocss/nuxt": "^66.2.0",
48
48
  "@unocss/preset-attributify": "^66.2.0",