@una-ui/nuxt 0.15.0-beta.1 → 0.16.0-beta.1

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.
Files changed (40) hide show
  1. package/dist/module.d.mts +3 -6
  2. package/dist/module.d.ts +3 -6
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +11 -2
  5. package/dist/runtime/components/data/table/Table.vue +4 -4
  6. package/dist/runtime/components/elements/Accordion.vue +1 -1
  7. package/dist/runtime/components/elements/Label.vue +28 -0
  8. package/dist/runtime/components/elements/Link.vue.d.ts +303 -1
  9. package/dist/runtime/components/elements/popover/Popover.vue +16 -0
  10. package/dist/runtime/components/elements/popover/PopoverContent.vue +48 -0
  11. package/dist/runtime/components/forms/Checkbox.vue +49 -60
  12. package/dist/runtime/components/forms/FormGroup.vue +21 -21
  13. package/dist/runtime/components/misc/ThemeSwitcher.vue +159 -73
  14. package/dist/runtime/components/slots/AvatarGroupDefault.d.ts +9 -5
  15. package/dist/runtime/components/slots/FormGroupDefault.d.ts +11 -5
  16. package/dist/runtime/composables/useUnaSettings.d.ts +6 -1
  17. package/dist/runtime/composables/useUnaSettings.js +3 -1
  18. package/dist/runtime/constants.d.ts +1 -0
  19. package/dist/runtime/constants.js +1 -0
  20. package/dist/runtime/plugins/theme.client.js +11 -7
  21. package/dist/runtime/plugins/theme.server.js +6 -4
  22. package/dist/runtime/types/checkbox.d.ts +24 -20
  23. package/dist/runtime/types/form-group.d.ts +2 -12
  24. package/dist/runtime/types/index.d.ts +3 -0
  25. package/dist/runtime/types/index.js +2 -0
  26. package/dist/runtime/types/label.d.ts +8 -0
  27. package/dist/runtime/types/label.js +0 -0
  28. package/dist/runtime/types/popover.d.ts +10 -0
  29. package/dist/runtime/types/popover.js +0 -0
  30. package/package.json +19 -20
  31. package/playground/.nuxt/components.d.ts +116 -116
  32. package/playground/.nuxt/imports.d.ts +4 -5
  33. package/playground/.nuxt/types/app.config.d.ts +3 -1
  34. package/playground/.nuxt/types/imports.d.ts +768 -764
  35. package/playground/.nuxt/types/nitro-imports.d.ts +22 -22
  36. package/playground/.nuxt/types/nitro-routes.d.ts +1 -1
  37. package/playground/.nuxt/types/plugins.d.ts +13 -13
  38. package/playground/.nuxt/types/schema.d.ts +132 -2
  39. package/dist/runtime/components/slots/FormGroupLabel.d.ts +0 -18
  40. package/dist/runtime/components/slots/FormGroupLabel.js +0 -29
package/dist/module.d.mts CHANGED
@@ -1,12 +1,9 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { UnaSettings } from '../dist/runtime/types/index.js';
2
3
 
3
- interface UnaOptions {
4
- primary?: string;
5
- gray?: string;
6
- }
7
4
  declare module '@nuxt/schema' {
8
5
  interface AppConfigInput {
9
- una?: UnaOptions;
6
+ una?: UnaSettings;
10
7
  }
11
8
  }
12
9
  interface ModuleOptions {
@@ -30,6 +27,6 @@ interface ModuleOptions {
30
27
  */
31
28
  dev: boolean;
32
29
  }
33
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
30
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
34
31
 
35
32
  export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { UnaSettings } from '../dist/runtime/types/index.js';
2
3
 
3
- interface UnaOptions {
4
- primary?: string;
5
- gray?: string;
6
- }
7
4
  declare module '@nuxt/schema' {
8
5
  interface AppConfigInput {
9
- una?: UnaOptions;
6
+ una?: UnaSettings;
10
7
  }
11
8
  }
12
9
  interface ModuleOptions {
@@ -30,6 +27,6 @@ interface ModuleOptions {
30
27
  */
31
28
  dev: boolean;
32
29
  }
33
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
30
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
34
31
 
35
32
  export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@una-ui/nuxt",
3
3
  "configKey": "una",
4
- "version": "0.15.0-beta.1",
4
+ "version": "0.16.0-beta.1",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ import '@una-ui/preset/prefixes';
7
7
  import '@una-ui/extractor-vue-script';
8
8
 
9
9
  const name = "@una-ui/nuxt";
10
- const version = "0.15.0-beta.1";
10
+ const version = "0.16.0-beta.1";
11
11
 
12
12
  const module = defineNuxtModule({
13
13
  meta: {
@@ -29,7 +29,9 @@ const module = defineNuxtModule({
29
29
  nuxt.options.css.unshift("@una-ui/preset/una.css");
30
30
  nuxt.options.appConfig.una = {
31
31
  primary: "yellow",
32
- gray: "stone"
32
+ gray: "stone",
33
+ radius: 0.5,
34
+ fontSize: 16
33
35
  };
34
36
  const runtimeDir = resolve("./runtime");
35
37
  nuxt.options.build.transpile.push(runtimeDir);
@@ -62,6 +64,13 @@ const module = defineNuxtModule({
62
64
  watch: nuxt.options.dev,
63
65
  priority: 10
64
66
  });
67
+ addComponentsDir({
68
+ path: resolve(runtimeDir, "components/elements", "popover"),
69
+ prefix: options.prefix,
70
+ global: options.global,
71
+ watch: nuxt.options.dev,
72
+ priority: 10
73
+ });
65
74
  addComponentsDir({
66
75
  path: resolve(runtimeDir, "components", "forms"),
67
76
  prefix: options.prefix,
@@ -73,8 +73,8 @@ const columnsWithMisc = computed(() => {
73
73
  accessorKey: 'selection',
74
74
  header: props.enableMultiRowSelection
75
75
  ? ({ table }: any) => h(Checkbox, {
76
- 'modelValue': table.getIsAllPageRowsSelected() ?? false,
77
- 'onUpdate:modelValue': (value: boolean) => {
76
+ 'checked': table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate'),
77
+ 'onUpdate:checked': (value: boolean) => {
78
78
  table.toggleAllPageRowsSelected(!!value)
79
79
  emit('selectAll', table.getRowModel().rows)
80
80
  },
@@ -82,8 +82,8 @@ const columnsWithMisc = computed(() => {
82
82
  })
83
83
  : '',
84
84
  cell: ({ row }: any) => h(Checkbox, {
85
- 'modelValue': row.getIsSelected() ?? false,
86
- 'onUpdate:modelValue': (value: boolean) => {
85
+ 'checked': row.getIsSelected() ?? false,
86
+ 'onUpdate:checked': (value: boolean) => {
87
87
  row.toggleSelected(!!value)
88
88
  emit('select', row)
89
89
  },
@@ -80,7 +80,7 @@ const isBaseVariant = computed(() => props.btn?.includes('~'))
80
80
  una?.accordion,
81
81
  ]"
82
82
  >
83
- <DefineTemplate v-slot="{ item, close, index, open }">
83
+ <DefineTemplate v-slot="{ item, close, index, open }: any">
84
84
  <slot
85
85
  :name="item.content ? 'content' : index"
86
86
  :item="item" :index="index" :open="open" :close="close"
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { Label } from 'radix-vue'
4
+ import { cn } from '../../utils'
5
+ import type { NLabelProps } from '../../types'
6
+
7
+ const props = defineProps<NLabelProps>()
8
+
9
+ const delegatedProps = computed(() => {
10
+ const { class: _, ...delegated } = props
11
+
12
+ return delegated
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <Label
18
+ v-bind="delegatedProps"
19
+ :class="
20
+ cn(
21
+ 'label-base',
22
+ props.class,
23
+ )
24
+ "
25
+ >
26
+ <slot />
27
+ </Label>
28
+ </template>
@@ -11,7 +11,309 @@ declare const _default: import("vue").DefineComponent<{}, {
11
11
  isActive: boolean;
12
12
  isExactActive: boolean;
13
13
  }) => any;
14
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {} | {
14
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {} | {
15
15
  [x: string]: any;
16
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}>;
17
17
  export default _default;
18
+ declare module 'vue' {
19
+ interface GlobalComponents {
20
+ }
21
+ interface GlobalDirectives {
22
+ }
23
+ }
24
+ declare global {
25
+ const __VLS_intrinsicElements: __VLS_IntrinsicElements;
26
+ const __VLS_directiveBindingRestFields: {
27
+ instance: null;
28
+ oldValue: null;
29
+ modifiers: any;
30
+ dir: any;
31
+ };
32
+ const __VLS_unref: typeof import('vue').unref;
33
+ const __VLS_nativeElements: {
34
+ a: HTMLAnchorElement;
35
+ abbr: HTMLElement;
36
+ address: HTMLElement;
37
+ area: HTMLAreaElement;
38
+ article: HTMLElement;
39
+ aside: HTMLElement;
40
+ audio: HTMLAudioElement;
41
+ b: HTMLElement;
42
+ base: HTMLBaseElement;
43
+ bdi: HTMLElement;
44
+ bdo: HTMLElement;
45
+ blockquote: HTMLQuoteElement;
46
+ body: HTMLBodyElement;
47
+ br: HTMLBRElement;
48
+ button: HTMLButtonElement;
49
+ canvas: HTMLCanvasElement;
50
+ caption: HTMLTableCaptionElement;
51
+ cite: HTMLElement;
52
+ code: HTMLElement;
53
+ col: HTMLTableColElement;
54
+ colgroup: HTMLTableColElement;
55
+ data: HTMLDataElement;
56
+ datalist: HTMLDataListElement;
57
+ dd: HTMLElement;
58
+ del: HTMLModElement;
59
+ details: HTMLDetailsElement;
60
+ dfn: HTMLElement;
61
+ dialog: HTMLDialogElement;
62
+ div: HTMLDivElement;
63
+ dl: HTMLDListElement;
64
+ dt: HTMLElement;
65
+ em: HTMLElement;
66
+ embed: HTMLEmbedElement;
67
+ fieldset: HTMLFieldSetElement;
68
+ figcaption: HTMLElement;
69
+ figure: HTMLElement;
70
+ footer: HTMLElement;
71
+ form: HTMLFormElement;
72
+ h1: HTMLHeadingElement;
73
+ h2: HTMLHeadingElement;
74
+ h3: HTMLHeadingElement;
75
+ h4: HTMLHeadingElement;
76
+ h5: HTMLHeadingElement;
77
+ h6: HTMLHeadingElement;
78
+ head: HTMLHeadElement;
79
+ header: HTMLElement;
80
+ hgroup: HTMLElement;
81
+ hr: HTMLHRElement;
82
+ html: HTMLHtmlElement;
83
+ i: HTMLElement;
84
+ iframe: HTMLIFrameElement;
85
+ img: HTMLImageElement;
86
+ input: HTMLInputElement;
87
+ ins: HTMLModElement;
88
+ kbd: HTMLElement;
89
+ label: HTMLLabelElement;
90
+ legend: HTMLLegendElement;
91
+ li: HTMLLIElement;
92
+ link: HTMLLinkElement;
93
+ main: HTMLElement;
94
+ map: HTMLMapElement;
95
+ mark: HTMLElement;
96
+ menu: HTMLMenuElement;
97
+ meta: HTMLMetaElement;
98
+ meter: HTMLMeterElement;
99
+ nav: HTMLElement;
100
+ noscript: HTMLElement;
101
+ object: HTMLObjectElement;
102
+ ol: HTMLOListElement;
103
+ optgroup: HTMLOptGroupElement;
104
+ option: HTMLOptionElement;
105
+ output: HTMLOutputElement;
106
+ p: HTMLParagraphElement;
107
+ picture: HTMLPictureElement;
108
+ pre: HTMLPreElement;
109
+ progress: HTMLProgressElement;
110
+ q: HTMLQuoteElement;
111
+ rp: HTMLElement;
112
+ rt: HTMLElement;
113
+ ruby: HTMLElement;
114
+ s: HTMLElement;
115
+ samp: HTMLElement;
116
+ script: HTMLScriptElement;
117
+ search: HTMLElement;
118
+ section: HTMLElement;
119
+ select: HTMLSelectElement;
120
+ slot: HTMLSlotElement;
121
+ small: HTMLElement;
122
+ source: HTMLSourceElement;
123
+ span: HTMLSpanElement;
124
+ strong: HTMLElement;
125
+ style: HTMLStyleElement;
126
+ sub: HTMLElement;
127
+ summary: HTMLElement;
128
+ sup: HTMLElement;
129
+ table: HTMLTableElement;
130
+ tbody: HTMLTableSectionElement;
131
+ td: HTMLTableCellElement;
132
+ template: HTMLTemplateElement;
133
+ textarea: HTMLTextAreaElement;
134
+ tfoot: HTMLTableSectionElement;
135
+ th: HTMLTableCellElement;
136
+ thead: HTMLTableSectionElement;
137
+ time: HTMLTimeElement;
138
+ title: HTMLTitleElement;
139
+ tr: HTMLTableRowElement;
140
+ track: HTMLTrackElement;
141
+ u: HTMLElement;
142
+ ul: HTMLUListElement;
143
+ var: HTMLElement;
144
+ video: HTMLVideoElement;
145
+ wbr: HTMLElement;
146
+ animate: SVGAnimateElement;
147
+ animateMotion: SVGAnimateMotionElement;
148
+ animateTransform: SVGAnimateTransformElement;
149
+ circle: SVGCircleElement;
150
+ clipPath: SVGClipPathElement;
151
+ defs: SVGDefsElement;
152
+ desc: SVGDescElement;
153
+ ellipse: SVGEllipseElement;
154
+ feBlend: SVGFEBlendElement;
155
+ feColorMatrix: SVGFEColorMatrixElement;
156
+ feComponentTransfer: SVGFEComponentTransferElement;
157
+ feComposite: SVGFECompositeElement;
158
+ feConvolveMatrix: SVGFEConvolveMatrixElement;
159
+ feDiffuseLighting: SVGFEDiffuseLightingElement;
160
+ feDisplacementMap: SVGFEDisplacementMapElement;
161
+ feDistantLight: SVGFEDistantLightElement;
162
+ feDropShadow: SVGFEDropShadowElement;
163
+ feFlood: SVGFEFloodElement;
164
+ feFuncA: SVGFEFuncAElement;
165
+ feFuncB: SVGFEFuncBElement;
166
+ feFuncG: SVGFEFuncGElement;
167
+ feFuncR: SVGFEFuncRElement;
168
+ feGaussianBlur: SVGFEGaussianBlurElement;
169
+ feImage: SVGFEImageElement;
170
+ feMerge: SVGFEMergeElement;
171
+ feMergeNode: SVGFEMergeNodeElement;
172
+ feMorphology: SVGFEMorphologyElement;
173
+ feOffset: SVGFEOffsetElement;
174
+ fePointLight: SVGFEPointLightElement;
175
+ feSpecularLighting: SVGFESpecularLightingElement;
176
+ feSpotLight: SVGFESpotLightElement;
177
+ feTile: SVGFETileElement;
178
+ feTurbulence: SVGFETurbulenceElement;
179
+ filter: SVGFilterElement;
180
+ foreignObject: SVGForeignObjectElement;
181
+ g: SVGGElement;
182
+ image: SVGImageElement;
183
+ line: SVGLineElement;
184
+ linearGradient: SVGLinearGradientElement;
185
+ marker: SVGMarkerElement;
186
+ mask: SVGMaskElement;
187
+ metadata: SVGMetadataElement;
188
+ mpath: SVGMPathElement;
189
+ path: SVGPathElement;
190
+ pattern: SVGPatternElement;
191
+ polygon: SVGPolygonElement;
192
+ polyline: SVGPolylineElement;
193
+ radialGradient: SVGRadialGradientElement;
194
+ rect: SVGRectElement;
195
+ set: SVGSetElement;
196
+ stop: SVGStopElement;
197
+ svg: SVGSVGElement;
198
+ switch: SVGSwitchElement;
199
+ symbol: SVGSymbolElement;
200
+ text: SVGTextElement;
201
+ textPath: SVGTextPathElement;
202
+ tspan: SVGTSpanElement;
203
+ use: SVGUseElement;
204
+ view: SVGViewElement;
205
+ };
206
+ type __VLS_IntrinsicElements = import('vue/jsx-runtime').JSX.IntrinsicElements;
207
+ type __VLS_Element = import('vue/jsx-runtime').JSX.Element;
208
+ type __VLS_GlobalComponents = import('vue').GlobalComponents & Pick<typeof import('vue'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>;
209
+ type __VLS_GlobalDirectives = import('vue').GlobalDirectives;
210
+ type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
211
+ type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
212
+ type __VLS_unknownDirective = (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
213
+ type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> = N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
214
+ [K in N0]: LocalComponents[N1];
215
+ } : N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
216
+ [K in N0]: LocalComponents[N2];
217
+ } : N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
218
+ [K in N0]: LocalComponents[N3];
219
+ } : N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
220
+ [K in N0]: __VLS_GlobalComponents[N1];
221
+ } : N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
222
+ [K in N0]: __VLS_GlobalComponents[N2];
223
+ } : N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
224
+ [K in N0]: __VLS_GlobalComponents[N3];
225
+ } : {
226
+ [K in N0]: unknown;
227
+ };
228
+ type __VLS_FunctionalComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
229
+ __ctx?: {
230
+ props?: infer P;
231
+ };
232
+ } ? NonNullable<P> : never : T extends (props: infer P, ...args: any) => any ? P : {};
233
+ type __VLS_IsFunction<T, K> = K extends keyof T ? __VLS_IsAny<T[K]> extends false ? unknown extends T[K] ? false : true : false : false;
234
+ type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
235
+ type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R ? U extends T ? never : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R) : never;
236
+ type __VLS_OverloadUnion<T> = Exclude<__VLS_OverloadUnionInner<(() => never) & T>, T extends () => never ? never : () => never>;
237
+ type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F ? F extends (event: infer E, ...args: infer A) => any ? {
238
+ [K in E & string]: (...args: A) => void;
239
+ } : never : never;
240
+ type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<__VLS_UnionToIntersection<__VLS_ConstructorOverloads<T> & {
241
+ [K in keyof T]: T[K] extends any[] ? {
242
+ (...args: T[K]): void;
243
+ } : never;
244
+ }>>;
245
+ type __VLS_PrettifyGlobal<T> = {
246
+ [K in keyof T]: T[K];
247
+ } & {};
248
+ function __VLS_getVForSourceType(source: number): [number, number, number][];
249
+ function __VLS_getVForSourceType(source: string): [string, number, number][];
250
+ function __VLS_getVForSourceType<T extends any[]>(source: T): [
251
+ item: T[number],
252
+ key: number,
253
+ index: number
254
+ ][];
255
+ function __VLS_getVForSourceType<T extends {
256
+ [Symbol.iterator](): Iterator<any>;
257
+ }>(source: T): [
258
+ item: T extends {
259
+ [Symbol.iterator](): Iterator<infer T1>;
260
+ } ? T1 : never,
261
+ key: number,
262
+ index: undefined
263
+ ][];
264
+ function __VLS_getVForSourceType<T extends number | {
265
+ [Symbol.iterator](): Iterator<any>;
266
+ }>(source: T): [
267
+ item: number | (Exclude<T, number> extends {
268
+ [Symbol.iterator](): Iterator<infer T1>;
269
+ } ? T1 : never),
270
+ key: number,
271
+ index: undefined
272
+ ][];
273
+ function __VLS_getVForSourceType<T>(source: T): [
274
+ item: T[keyof T],
275
+ key: keyof T,
276
+ index: number
277
+ ][];
278
+ function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
279
+ function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
280
+ function __VLS_directiveAsFunction<T extends import('vue').Directive>(dir: T): T extends (...args: any) => any ? T | __VLS_unknownDirective : NonNullable<(T & Record<string, __VLS_unknownDirective>)['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']>;
281
+ function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
282
+ function __VLS_makeOptional<T>(t: T): {
283
+ [K in keyof T]?: T[K];
284
+ };
285
+ function __VLS_nonNullable<T>(t: T): T extends null | undefined ? never : T;
286
+ function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K): T extends new (...args: any) => any ? (props: (K extends {
287
+ $props: infer Props;
288
+ } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & {
289
+ __ctx?: {
290
+ attrs?: any;
291
+ slots?: K extends {
292
+ $slots: infer Slots;
293
+ } ? Slots : any;
294
+ emit?: K extends {
295
+ $emit: infer Emit;
296
+ } ? Emit : any;
297
+ } & {
298
+ props?: (K extends {
299
+ $props: infer Props;
300
+ } ? Props : any) & Record<string, unknown>;
301
+ expose?(exposed: K): void;
302
+ };
303
+ } : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T> : T extends (...args: any) => any ? T : (_: {} & Record<string, unknown>, ctx?: any) => {
304
+ __ctx?: {
305
+ attrs?: any;
306
+ expose?: any;
307
+ slots?: any;
308
+ emit?: any;
309
+ props?: {} & Record<string, unknown>;
310
+ };
311
+ };
312
+ function __VLS_elementAsFunction<T>(tag: T, endTag?: T): (_: T & Record<string, unknown>) => void;
313
+ function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
314
+ function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
315
+ __ctx?: infer Ctx;
316
+ } ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>>;
317
+ function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
318
+ function __VLS_tryAsConstant<const T>(t: T): T;
319
+ }
@@ -0,0 +1,16 @@
1
+ <script setup lang="ts">
2
+ import { PopoverRoot, useForwardPropsEmits } from 'radix-vue'
3
+ import type { PopoverRootEmits } from 'radix-vue'
4
+ import type { NPopoverProps } from '../../../types'
5
+
6
+ const props = defineProps<NPopoverProps>()
7
+ const emits = defineEmits<PopoverRootEmits>()
8
+
9
+ const forwarded = useForwardPropsEmits(props, emits)
10
+ </script>
11
+
12
+ <template>
13
+ <PopoverRoot v-bind="forwarded">
14
+ <slot />
15
+ </PopoverRoot>
16
+ </template>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import {
4
+ PopoverContent,
5
+ type PopoverContentEmits,
6
+ PopoverPortal,
7
+ useForwardPropsEmits,
8
+ } from 'radix-vue'
9
+ import { cn } from '../../../utils'
10
+ import type { NPopoverContentProps } from '../../../types'
11
+
12
+ defineOptions({
13
+ inheritAttrs: false,
14
+ })
15
+
16
+ const props = withDefaults(
17
+ defineProps<NPopoverContentProps>(),
18
+ {
19
+ align: 'center',
20
+ sideOffset: 4,
21
+ },
22
+ )
23
+ const emits = defineEmits<PopoverContentEmits>()
24
+
25
+ const delegatedProps = computed(() => {
26
+ const { class: _, ...delegated } = props
27
+
28
+ return delegated
29
+ })
30
+
31
+ const forwarded = useForwardPropsEmits(delegatedProps, emits)
32
+ </script>
33
+
34
+ <template>
35
+ <PopoverPortal>
36
+ <PopoverContent
37
+ v-bind="{ ...forwarded, ...$attrs }"
38
+ :class="
39
+ cn(
40
+ 'popover',
41
+ props.class,
42
+ )
43
+ "
44
+ >
45
+ <slot />
46
+ </PopoverContent>
47
+ </PopoverPortal>
48
+ </template>
@@ -1,86 +1,75 @@
1
1
  <script setup lang="ts">
2
- import { computed, watch } from 'vue'
3
- import { useVModel } from '@vueuse/core'
4
- import NIcon from '../elements/Icon.vue'
5
- import { randomId } from '../../utils'
6
- import type { NCheckboxProps } from '../../types/checkbox'
2
+ import { computed } from 'vue'
3
+ import type { CheckboxRootEmits } from 'radix-vue'
4
+ import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from 'radix-vue'
5
+ import { cn, randomId } from '../../utils'
6
+ import Icon from '../elements/Icon.vue'
7
+ import type { NCheckboxProps } from '../../types'
8
+ import Label from '../elements/Label.vue'
7
9
 
8
- defineOptions({
9
- inheritAttrs: false,
10
+ const props = withDefaults(defineProps<NCheckboxProps>(), {
11
+ forceMount: true,
10
12
  })
13
+ const emits = defineEmits<CheckboxRootEmits>()
11
14
 
12
- const props = withDefaults(
13
- defineProps<NCheckboxProps>(),
14
- {
15
- modelValue: false,
16
- disabled: false,
17
- },
18
- )
15
+ const delegatedProps = computed(() => {
16
+ const { class: _, ...delegated } = props
19
17
 
20
- const emit = defineEmits<{ (...args: any): void }>()
18
+ return delegated
19
+ })
21
20
 
22
- const slots = defineSlots<{
23
- default?: void
24
- icon?: any
25
- }>()
21
+ const forwarded = useForwardPropsEmits(delegatedProps, emits)
26
22
 
27
23
  const id = computed(() => props.id ?? randomId('checkbox'))
28
- const checked = useVModel(props, 'modelValue', emit, { passive: true })
29
-
30
- watch(checked, (value) => {
31
- emit('onUpdate', value)
32
- })
33
24
  </script>
34
25
 
35
26
  <template>
36
- <label
27
+ <div
37
28
  checkbox="wrapper"
38
- role="checkbox"
39
- :for="props.for ?? id"
40
29
  :class="[
41
30
  una?.checkboxWrapper,
42
31
  {
43
32
  'checkbox-reverse': reverse,
44
- 'checkbox-disabled': disabled,
45
33
  },
46
34
  ]"
47
- :checked="checked || null"
48
- :disabled="disabled || null"
49
35
  >
50
- <input
36
+ <CheckboxRoot
37
+ v-bind="forwarded"
51
38
  :id="id"
52
- :value="checked"
53
- :checked="!!checked"
54
- type="checkbox"
55
- class="peer"
56
- checkbox="input"
57
- :disabled="disabled"
58
- :name="name"
59
- @keypress.enter="checked = !checked"
60
- @click="checked = !checked"
39
+ :class="
40
+ cn(
41
+ 'peer checkbox',
42
+ props.class,
43
+ )"
61
44
  >
62
- <span
63
- :checkbox="checkbox"
64
- :size="size"
65
- class="checkbox checkbox-peer-focus"
66
- v-bind="$attrs"
67
- >
68
- <slot name="icon">
69
- <NIcon
70
- checkbox="icon-base icon-checked"
71
- :name="una?.checkboxIcon ?? 'checkbox-icon'"
72
- :class="una?.checkboxIconBase"
73
- />
74
- </slot>
75
- </span>
76
- <div
77
- v-if="slots.default || label"
78
- checkbox="label"
79
- :class="una?.checkboxLabel"
45
+ <CheckboxIndicator
46
+ :force-mount
47
+ :size
48
+ :class="cn('checkbox-indicator', una?.checkboxIndicator)"
49
+ v-bind="props._checkboxIndicator"
50
+ >
51
+ <slot name="icon">
52
+ <Icon
53
+ :name="props.checked === 'indeterminate'
54
+ ? props.una?.checkboxIndeterminateIcon ?? 'checkbox-indeterminate-icon'
55
+ : props.checked
56
+ ? props.una?.checkboxCheckedIcon ?? 'checkbox-checked-icon'
57
+ : props.una?.checkboxUncheckedIcon ?? 'checkbox-unchecked-icon'"
58
+ :class="cn('checkbox-icon-base', una?.checkboxIconBase)"
59
+ />
60
+ </slot>
61
+ </CheckboxIndicator>
62
+ </CheckboxRoot>
63
+
64
+ <Label
65
+ v-if="$slots.default || label"
66
+ :for="props.for || id"
67
+ :class="cn('checkbox-label', una?.checkboxLabel)"
68
+ v-bind="props._label"
80
69
  >
81
70
  <slot>
82
71
  {{ label }}
83
72
  </slot>
84
- </div>
85
- </label>
73
+ </Label>
74
+ </div>
86
75
  </template>