@kubetail/ui 2.7.1 → 3.0.0-rc1
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/elements/avatar.cjs +1 -1
- package/dist/elements/avatar.cjs.map +1 -1
- package/dist/elements/avatar.d.ts +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/avatar.js.map +1 -1
- package/dist/elements/button.cjs +1 -1
- package/dist/elements/button.cjs.map +1 -1
- package/dist/elements/button.d.ts +5 -4
- package/dist/elements/button.js +17 -14
- package/dist/elements/button.js.map +1 -1
- package/dist/elements/checkbox.cjs +1 -1
- package/dist/elements/checkbox.cjs.map +1 -1
- package/dist/elements/checkbox.d.ts +1 -1
- package/dist/elements/checkbox.js +2 -2
- package/dist/elements/checkbox.js.map +1 -1
- package/dist/elements/context-menu.cjs +1 -1
- package/dist/elements/context-menu.cjs.map +1 -1
- package/dist/elements/context-menu.d.ts +8 -7
- package/dist/elements/context-menu.js +26 -31
- package/dist/elements/context-menu.js.map +1 -1
- package/dist/elements/dialog.cjs +1 -1
- package/dist/elements/dialog.cjs.map +1 -1
- package/dist/elements/dialog.d.ts +3 -3
- package/dist/elements/dialog.js +16 -25
- package/dist/elements/dialog.js.map +1 -1
- package/dist/elements/dropdown-menu.cjs +1 -1
- package/dist/elements/dropdown-menu.cjs.map +1 -1
- package/dist/elements/dropdown-menu.d.ts +11 -8
- package/dist/elements/dropdown-menu.js +27 -31
- package/dist/elements/dropdown-menu.js.map +1 -1
- package/dist/elements/form.cjs +1 -1
- package/dist/elements/form.cjs.map +1 -1
- package/dist/elements/form.d.ts +5 -4
- package/dist/elements/form.js +39 -42
- package/dist/elements/form.js.map +1 -1
- package/dist/elements/label.cjs +1 -1
- package/dist/elements/label.cjs.map +1 -1
- package/dist/elements/label.d.ts +1 -2
- package/dist/elements/label.js +5 -6
- package/dist/elements/label.js.map +1 -1
- package/dist/elements/link.cjs +1 -1
- package/dist/elements/link.cjs.map +1 -1
- package/dist/elements/link.d.ts +6 -5
- package/dist/elements/link.js +18 -13
- package/dist/elements/link.js.map +1 -1
- package/dist/elements/popover.cjs +1 -1
- package/dist/elements/popover.cjs.map +1 -1
- package/dist/elements/popover.d.ts +8 -5
- package/dist/elements/popover.js +13 -19
- package/dist/elements/popover.js.map +1 -1
- package/dist/elements/select.cjs +1 -1
- package/dist/elements/select.cjs.map +1 -1
- package/dist/elements/select.d.ts +13 -8
- package/dist/elements/select.js +32 -37
- package/dist/elements/select.js.map +1 -1
- package/dist/elements/separator.cjs +1 -1
- package/dist/elements/separator.cjs.map +1 -1
- package/dist/elements/separator.d.ts +2 -2
- package/dist/elements/separator.js +4 -5
- package/dist/elements/separator.js.map +1 -1
- package/dist/elements/sheet.cjs +1 -1
- package/dist/elements/sheet.cjs.map +1 -1
- package/dist/elements/sheet.d.ts +2 -2
- package/dist/elements/sheet.js +8 -14
- package/dist/elements/sheet.js.map +1 -1
- package/dist/elements/sidebar.cjs +1 -1
- package/dist/elements/sidebar.cjs.map +1 -1
- package/dist/elements/sidebar.d.ts +15 -14
- package/dist/elements/sidebar.js +63 -46
- package/dist/elements/sidebar.js.map +1 -1
- package/dist/elements/switch.cjs +1 -1
- package/dist/elements/switch.cjs.map +1 -1
- package/dist/elements/switch.d.ts +1 -1
- package/dist/elements/switch.js +3 -3
- package/dist/elements/switch.js.map +1 -1
- package/dist/elements/tabs.cjs +1 -1
- package/dist/elements/tabs.cjs.map +1 -1
- package/dist/elements/tabs.d.ts +3 -3
- package/dist/elements/tabs.js +4 -4
- package/dist/elements/tabs.js.map +1 -1
- package/dist/elements/toggle.cjs +1 -1
- package/dist/elements/toggle.cjs.map +1 -1
- package/dist/elements/toggle.d.ts +2 -2
- package/dist/elements/toggle.js +3 -3
- package/dist/elements/toggle.js.map +1 -1
- package/dist/elements/tooltip.cjs +1 -1
- package/dist/elements/tooltip.cjs.map +1 -1
- package/dist/elements/tooltip.d.ts +7 -3
- package/dist/elements/tooltip.js +14 -14
- package/dist/elements/tooltip.js.map +1 -1
- package/package.json +3 -71
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.cjs","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useId, useMemo } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"form.cjs","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { Children, cloneElement, createContext, isValidElement, useContext, useId, useMemo } from 'react';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/elements/label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n const value = useMemo(() => ({ name: props.name }), [props.name]);\n\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n const value = useMemo(() => ({ id }), [id]);\n\n return (\n <FormItemContext.Provider value={value}>\n <div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn('data-[error=true]:text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ children }: { children: React.ReactNode }) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n const child = Children.only(children);\n\n if (!isValidElement<Record<string, unknown>>(child)) {\n return <>{children}</>;\n }\n\n return cloneElement(child, {\n 'data-slot': 'form-control',\n id: formItemId,\n 'aria-describedby': !error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`,\n 'aria-invalid': !!error,\n });\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n {body}\n </p>\n );\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":"6QAgBA,IAAM,EAAO,EAAA,aASP,GAAA,EAAA,EAAA,eAAwD,EAAE,CAA0B,CAMpF,GAAA,EAAA,EAAA,eAAsD,EAAE,CAAyB,CAEjF,GAGJ,CACA,GAAG,KACuC,CAC1C,IAAM,GAAA,EAAA,EAAA,cAAuB,CAAE,KAAM,EAAM,KAAM,EAAG,CAAC,EAAM,KAAK,CAAC,CAEjE,OACE,EAAA,EAAA,KAAC,EAAiB,SAAlB,CAAkC,kBAChC,EAAA,EAAA,KAAC,EAAA,WAAD,CAAY,GAAI,EAAS,CAAA,CACC,CAAA,EAI1B,MAAqB,CACzB,IAAM,GAAA,EAAA,EAAA,YAA0B,EAAiB,CAC3C,GAAA,EAAA,EAAA,YAAyB,EAAgB,CACzC,CAAE,kBAAA,EAAA,EAAA,iBAAkC,CACpC,GAAA,EAAA,EAAA,cAAyB,CAAE,KAAM,EAAa,KAAM,CAAC,CACrD,EAAa,EAAc,EAAa,KAAM,EAAU,CAE9D,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAGnE,GAAM,CAAE,MAAO,EAEf,MAAO,CACL,KACA,KAAM,EAAa,KACnB,WAAY,GAAG,EAAG,YAClB,kBAAmB,GAAG,EAAG,wBACzB,cAAe,GAAG,EAAG,oBACrB,GAAG,EACJ,EAGH,SAAS,EAAS,CAAE,YAAW,GAAG,GAAsC,CACtE,IAAM,GAAA,EAAA,EAAA,QAAY,CACZ,GAAA,EAAA,EAAA,cAAuB,CAAE,KAAI,EAAG,CAAC,EAAG,CAAC,CAE3C,OACE,EAAA,EAAA,KAAC,EAAgB,SAAjB,CAAiC,kBAC/B,EAAA,EAAA,KAAC,MAAD,CAAK,YAAU,YAAY,UAAW,EAAA,GAAG,aAAc,EAAU,CAAE,GAAI,EAAS,CAAA,CACvD,CAAA,CAI/B,SAAS,EAAU,CAAE,YAAW,GAAG,GAA6C,CAC9E,GAAM,CAAE,QAAO,cAAe,GAAc,CAE5C,OACE,EAAA,EAAA,KAAC,EAAA,MAAD,CACE,YAAU,aACV,aAAY,CAAC,CAAC,EACd,UAAW,EAAA,GAAG,qCAAsC,EAAU,CAC9D,QAAS,EACT,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAA2C,CAChE,GAAM,CAAE,QAAO,aAAY,oBAAmB,iBAAkB,GAAc,CACxE,EAAQ,EAAA,SAAS,KAAK,EAAS,CAMrC,OAJI,EAAA,EAAA,gBAAyC,EAAM,EAInD,EAAA,EAAA,cAAoB,EAAO,CACzB,YAAa,eACb,GAAI,EACJ,mBAAqB,EAA4B,GAAG,EAAkB,GAAG,IAA5C,EAC7B,eAAgB,CAAC,CAAC,EACnB,CAAC,EARO,EAAA,EAAA,KAAA,EAAA,SAAA,CAAG,WAAY,CAAA,CAW1B,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAoC,CAC3E,GAAM,CAAE,qBAAsB,GAAc,CAE5C,OACE,EAAA,EAAA,KAAC,IAAD,CACE,YAAU,mBACV,GAAI,EACJ,UAAW,EAAA,GAAG,gCAAiC,EAAU,CACzD,GAAI,EACJ,CAAA,CAIN,SAAS,EAAY,CAAE,YAAW,GAAG,GAAoC,CACvE,GAAM,CAAE,QAAO,iBAAkB,GAAc,CACzC,EAAO,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,EAAM,SAM1D,OAJK,GAKH,EAAA,EAAA,KAAC,IAAD,CAAG,YAAU,eAAe,GAAI,EAAe,UAAW,EAAA,GAAG,2BAA4B,EAAU,CAAE,GAAI,WACtG,EACC,CAAA,CANG"}
|
package/dist/elements/form.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
1
|
import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form';
|
|
2
|
+
import { Label } from '@/elements/label';
|
|
4
3
|
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
4
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
declare const useFormField: () => {
|
|
@@ -16,8 +15,10 @@ declare const useFormField: () => {
|
|
|
16
15
|
formMessageId: string;
|
|
17
16
|
};
|
|
18
17
|
declare function FormItem({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof
|
|
20
|
-
declare function FormControl({
|
|
18
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof Label>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function FormControl({ children }: {
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
declare function FormDescription({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
declare function FormMessage({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element | null;
|
|
23
24
|
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
package/dist/elements/form.js
CHANGED
|
@@ -1,82 +1,79 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../lib/utils.js";
|
|
3
3
|
import { Label as t } from "./label.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "@radix-ui/react-label";
|
|
8
|
-
import { Controller as c, FormProvider as l, useFormContext as u, useFormState as d } from "react-hook-form";
|
|
4
|
+
import { Fragment as n, jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { Children as i, cloneElement as a, createContext as o, isValidElement as s, useContext as c, useId as l, useMemo as u } from "react";
|
|
6
|
+
import { Controller as d, FormProvider as f, useFormContext as p, useFormState as m } from "react-hook-form";
|
|
9
7
|
//#region src/elements/form.tsx
|
|
10
|
-
var
|
|
11
|
-
let t =
|
|
12
|
-
return /* @__PURE__ */
|
|
8
|
+
var h = f, g = o({}), _ = o({}), v = ({ ...e }) => {
|
|
9
|
+
let t = u(() => ({ name: e.name }), [e.name]);
|
|
10
|
+
return /* @__PURE__ */ r(g.Provider, {
|
|
13
11
|
value: t,
|
|
14
|
-
children: /* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ r(d, { ...e })
|
|
15
13
|
});
|
|
16
|
-
},
|
|
17
|
-
let e =
|
|
14
|
+
}, y = () => {
|
|
15
|
+
let e = c(g), t = c(_), { getFieldState: n } = p(), r = m({ name: e.name }), i = n(e.name, r);
|
|
18
16
|
if (!e) throw Error("useFormField should be used within <FormField>");
|
|
19
|
-
let { id:
|
|
17
|
+
let { id: a } = t;
|
|
20
18
|
return {
|
|
21
|
-
id:
|
|
19
|
+
id: a,
|
|
22
20
|
name: e.name,
|
|
23
|
-
formItemId: `${
|
|
24
|
-
formDescriptionId: `${
|
|
25
|
-
formMessageId: `${
|
|
21
|
+
formItemId: `${a}-form-item`,
|
|
22
|
+
formDescriptionId: `${a}-form-item-description`,
|
|
23
|
+
formMessageId: `${a}-form-item-message`,
|
|
26
24
|
...i
|
|
27
25
|
};
|
|
28
26
|
};
|
|
29
|
-
function
|
|
30
|
-
let i =
|
|
31
|
-
return /* @__PURE__ */
|
|
27
|
+
function b({ className: t, ...n }) {
|
|
28
|
+
let i = l(), a = u(() => ({ id: i }), [i]);
|
|
29
|
+
return /* @__PURE__ */ r(_.Provider, {
|
|
32
30
|
value: a,
|
|
33
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ r("div", {
|
|
34
32
|
"data-slot": "form-item",
|
|
35
33
|
className: e("grid gap-2", t),
|
|
36
|
-
...
|
|
34
|
+
...n
|
|
37
35
|
})
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
function
|
|
41
|
-
let { error: a, formItemId: o } =
|
|
42
|
-
return /* @__PURE__ */
|
|
38
|
+
function x({ className: n, ...i }) {
|
|
39
|
+
let { error: a, formItemId: o } = y();
|
|
40
|
+
return /* @__PURE__ */ r(t, {
|
|
43
41
|
"data-slot": "form-label",
|
|
44
42
|
"data-error": !!a,
|
|
45
|
-
className: e("data-[error=true]:text-destructive",
|
|
43
|
+
className: e("data-[error=true]:text-destructive", n),
|
|
46
44
|
htmlFor: o,
|
|
47
45
|
...i
|
|
48
46
|
});
|
|
49
47
|
}
|
|
50
|
-
function
|
|
51
|
-
let { error: t, formItemId:
|
|
52
|
-
return
|
|
48
|
+
function S({ children: e }) {
|
|
49
|
+
let { error: t, formItemId: o, formDescriptionId: c, formMessageId: l } = y(), u = i.only(e);
|
|
50
|
+
return s(u) ? a(u, {
|
|
53
51
|
"data-slot": "form-control",
|
|
54
|
-
id:
|
|
55
|
-
"aria-describedby": t ? `${
|
|
56
|
-
"aria-invalid": !!t
|
|
57
|
-
|
|
58
|
-
});
|
|
52
|
+
id: o,
|
|
53
|
+
"aria-describedby": t ? `${c} ${l}` : c,
|
|
54
|
+
"aria-invalid": !!t
|
|
55
|
+
}) : /* @__PURE__ */ r(n, { children: e });
|
|
59
56
|
}
|
|
60
|
-
function
|
|
61
|
-
let { formDescriptionId: i } =
|
|
62
|
-
return /* @__PURE__ */
|
|
57
|
+
function C({ className: t, ...n }) {
|
|
58
|
+
let { formDescriptionId: i } = y();
|
|
59
|
+
return /* @__PURE__ */ r("p", {
|
|
63
60
|
"data-slot": "form-description",
|
|
64
61
|
id: i,
|
|
65
62
|
className: e("text-muted-foreground text-sm", t),
|
|
66
|
-
...
|
|
63
|
+
...n
|
|
67
64
|
});
|
|
68
65
|
}
|
|
69
|
-
function
|
|
70
|
-
let { error: i, formMessageId: a } =
|
|
71
|
-
return o ? /* @__PURE__ */
|
|
66
|
+
function w({ className: t, ...n }) {
|
|
67
|
+
let { error: i, formMessageId: a } = y(), o = i ? String(i?.message ?? "") : n.children;
|
|
68
|
+
return o ? /* @__PURE__ */ r("p", {
|
|
72
69
|
"data-slot": "form-message",
|
|
73
70
|
id: a,
|
|
74
71
|
className: e("text-destructive text-sm", t),
|
|
75
|
-
...
|
|
72
|
+
...n,
|
|
76
73
|
children: o
|
|
77
74
|
}) : null;
|
|
78
75
|
}
|
|
79
76
|
//#endregion
|
|
80
|
-
export {
|
|
77
|
+
export { h as Form, S as FormControl, C as FormDescription, v as FormField, b as FormItem, x as FormLabel, w as FormMessage, y as useFormField };
|
|
81
78
|
|
|
82
79
|
//# sourceMappingURL=form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useId, useMemo } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"form.js","names":[],"sources":["../../src/elements/form.tsx"],"sourcesContent":["'use client';\n\nimport { Children, cloneElement, createContext, isValidElement, useContext, useId, useMemo } from 'react';\nimport {\n Controller,\n FormProvider,\n useFormContext,\n useFormState,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from 'react-hook-form';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/elements/label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n const value = useMemo(() => ({ name: props.name }), [props.name]);\n\n return (\n <FormFieldContext.Provider value={value}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = useContext(FormFieldContext);\n const itemContext = useContext(FormItemContext);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\nfunction FormItem({ className, ...props }: React.ComponentProps<'div'>) {\n const id = useId();\n const value = useMemo(() => ({ id }), [id]);\n\n return (\n <FormItemContext.Provider value={value}>\n <div data-slot=\"form-item\" className={cn('grid gap-2', className)} {...props} />\n </FormItemContext.Provider>\n );\n}\n\nfunction FormLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n data-slot=\"form-label\"\n data-error={!!error}\n className={cn('data-[error=true]:text-destructive', className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n}\n\nfunction FormControl({ children }: { children: React.ReactNode }) {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n const child = Children.only(children);\n\n if (!isValidElement<Record<string, unknown>>(child)) {\n return <>{children}</>;\n }\n\n return cloneElement(child, {\n 'data-slot': 'form-control',\n id: formItemId,\n 'aria-describedby': !error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`,\n 'aria-invalid': !!error,\n });\n}\n\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n data-slot=\"form-description\"\n id={formDescriptionId}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction FormMessage({ className, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message ?? '') : props.children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p data-slot=\"form-message\" id={formMessageId} className={cn('text-destructive text-sm', className)} {...props}>\n {body}\n </p>\n );\n}\n\nexport { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"mappings":";;;;;;;AAgBA,IAAM,IAAO,GASP,IAAmB,EAAqC,EAAE,CAA0B,EAMpF,IAAkB,EAAoC,EAAE,CAAyB,EAEjF,KAGJ,EACA,GAAG,QACuC;CAC1C,IAAM,IAAQ,SAAe,EAAE,MAAM,EAAM,MAAM,GAAG,CAAC,EAAM,KAAK,CAAC;AAEjE,QACE,kBAAC,EAAiB,UAAlB;EAAkC;YAChC,kBAAC,GAAD,EAAY,GAAI,GAAS,CAAA;EACC,CAAA;GAI1B,UAAqB;CACzB,IAAM,IAAe,EAAW,EAAiB,EAC3C,IAAc,EAAW,EAAgB,EACzC,EAAE,qBAAkB,GAAgB,EACpC,IAAY,EAAa,EAAE,MAAM,EAAa,MAAM,CAAC,EACrD,IAAa,EAAc,EAAa,MAAM,EAAU;AAE9D,KAAI,CAAC,EACH,OAAU,MAAM,iDAAiD;CAGnE,IAAM,EAAE,UAAO;AAEf,QAAO;EACL;EACA,MAAM,EAAa;EACnB,YAAY,GAAG,EAAG;EAClB,mBAAmB,GAAG,EAAG;EACzB,eAAe,GAAG,EAAG;EACrB,GAAG;EACJ;;AAGH,SAAS,EAAS,EAAE,cAAW,GAAG,KAAsC;CACtE,IAAM,IAAK,GAAO,EACZ,IAAQ,SAAe,EAAE,OAAI,GAAG,CAAC,EAAG,CAAC;AAE3C,QACE,kBAAC,EAAgB,UAAjB;EAAiC;YAC/B,kBAAC,OAAD;GAAK,aAAU;GAAY,WAAW,EAAG,cAAc,EAAU;GAAE,GAAI;GAAS,CAAA;EACvD,CAAA;;AAI/B,SAAS,EAAU,EAAE,cAAW,GAAG,KAA6C;CAC9E,IAAM,EAAE,UAAO,kBAAe,GAAc;AAE5C,QACE,kBAAC,GAAD;EACE,aAAU;EACV,cAAY,CAAC,CAAC;EACd,WAAW,EAAG,sCAAsC,EAAU;EAC9D,SAAS;EACT,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAY,EAAE,eAA2C;CAChE,IAAM,EAAE,UAAO,eAAY,sBAAmB,qBAAkB,GAAc,EACxE,IAAQ,EAAS,KAAK,EAAS;AAMrC,QAJK,EAAwC,EAAM,GAI5C,EAAa,GAAO;EACzB,aAAa;EACb,IAAI;EACJ,oBAAqB,IAA4B,GAAG,EAAkB,GAAG,MAA5C;EAC7B,gBAAgB,CAAC,CAAC;EACnB,CAAC,GARO,kBAAA,GAAA,EAAG,aAAY,CAAA;;AAW1B,SAAS,EAAgB,EAAE,cAAW,GAAG,KAAoC;CAC3E,IAAM,EAAE,yBAAsB,GAAc;AAE5C,QACE,kBAAC,KAAD;EACE,aAAU;EACV,IAAI;EACJ,WAAW,EAAG,iCAAiC,EAAU;EACzD,GAAI;EACJ,CAAA;;AAIN,SAAS,EAAY,EAAE,cAAW,GAAG,KAAoC;CACvE,IAAM,EAAE,UAAO,qBAAkB,GAAc,EACzC,IAAO,IAAQ,OAAO,GAAO,WAAW,GAAG,GAAG,EAAM;AAM1D,QAJK,IAKH,kBAAC,KAAD;EAAG,aAAU;EAAe,IAAI;EAAe,WAAW,EAAG,4BAA4B,EAAU;EAAE,GAAI;YACtG;EACC,CAAA,GANG"}
|
package/dist/elements/label.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`);function n({className:n,...r}){return(0,t.jsx)(`label`,{"data-slot":`label`,className:e.cn(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,n),...r})}exports.Label=n;
|
|
2
2
|
//# sourceMappingURL=label.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.cjs","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"label.cjs","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({ className, ...props }: React.ComponentProps<'label'>) {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":"oMAIA,SAAS,EAAM,CAAE,YAAW,GAAG,GAAwC,CACrE,OAEE,EAAA,EAAA,KAAC,QAAD,CACE,YAAU,QACV,UAAW,EAAA,GACT,sNACA,EACD,CACD,GAAI,EACJ,CAAA"}
|
package/dist/elements/label.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
declare function Label({ className, ...props }: React.ComponentProps<'label'>): import("react/jsx-runtime").JSX.Element;
|
|
3
2
|
export { Label };
|
package/dist/elements/label.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../lib/utils.js";
|
|
3
3
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import * as n from "@radix-ui/react-label";
|
|
5
4
|
//#region src/elements/label.tsx
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */ t(
|
|
5
|
+
function n({ className: n, ...r }) {
|
|
6
|
+
return /* @__PURE__ */ t("label", {
|
|
8
7
|
"data-slot": "label",
|
|
9
|
-
className: e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
10
|
-
...
|
|
8
|
+
className: e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", n),
|
|
9
|
+
...r
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
12
|
//#endregion
|
|
14
|
-
export {
|
|
13
|
+
export { n as Label };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"label.js","names":[],"sources":["../../src/elements/label.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@/lib/utils';\n\nfunction Label({ className, ...props }: React.ComponentProps<'label'>) {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n"],"mappings":";;;;AAIA,SAAS,EAAM,EAAE,cAAW,GAAG,KAAwC;AACrE,QAEE,kBAAC,SAAD;EACE,aAAU;EACV,WAAW,EACT,uNACA,EACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/elements/link.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`class-variance-authority`),r=require(`@
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`class-variance-authority`),r=require(`@base-ui/react/use-render`);var i=(0,n.cva)(`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer`,{variants:{variant:{default:``,external:``}},defaultVariants:{variant:`default`}}),a=null;function o(e){a=e}function s(){return a}function c({className:t,variant:n,render:a,...o}){let s=n===`external`&&!a?{target:`_blank`,rel:`noopener noreferrer`}:{};return(0,r.useRender)({render:a,defaultTagName:`a`,props:{"data-slot":`link`,className:e.cn(i({variant:n,className:t})),...s,...o}})}function l({className:n,variant:r,...o}){let s=a||`a`;return(0,t.jsx)(s,{"data-slot":`link`,className:e.cn(i({variant:r,className:n})),...r===`external`&&s===`a`?{target:`_blank`,rel:`noopener noreferrer`}:{},...o})}exports.Link=c,exports.RouterLink=l,exports.getLinkComponent=s,exports.linkStyles=i,exports.setLinkComponent=o;
|
|
2
2
|
//# sourceMappingURL=link.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.cjs","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"link.cjs","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\nconst linkStyles = cva(\n 'inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer',\n {\n variants: {\n variant: {\n default: '',\n external: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nexport type LinkVariantProps = VariantProps<typeof linkStyles>;\n\ntype LinkComponent = React.ElementType;\n\nlet configuredLinkComponent: LinkComponent | null = null;\n\n/**\n * Set a custom component to be used by `RouterLink` (e.g. your router's Link component).\n *\n * @example\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link } from 'react-router-dom';\n * setLinkComponent(Link);\n */\nfunction setLinkComponent(component: LinkComponent) {\n configuredLinkComponent = component;\n}\n\n/**\n * Get the currently configured link component.\n */\nfunction getLinkComponent(): LinkComponent | null {\n return configuredLinkComponent;\n}\n\ntype LinkProps = React.ComponentProps<'a'> &\n LinkVariantProps & {\n render?: useRender.RenderProp;\n };\n\n/**\n * `Link` renders a styled anchor element.\n *\n * Supports `render` for composition with custom components.\n *\n * @param props.variant - \"default\" | \"external\" (adds target=\"_blank\" and rel=\"noopener noreferrer\")\n * @param props.render - render as a different element (e.g. `render={<RouterLink to=\"...\" />}`)\n */\nfunction Link({ className, variant, render, ...props }: LinkProps) {\n const externalProps = variant === 'external' && !render ? { target: '_blank', rel: 'noopener noreferrer' } : {};\n\n return useRender({\n render,\n defaultTagName: 'a',\n props: {\n 'data-slot': 'link',\n className: cn(linkStyles({ variant, className })),\n ...externalProps,\n ...props,\n },\n });\n}\n\ntype RouterLinkProps = Omit<LinkProps, 'render'> & Record<string, unknown>;\n\n/**\n * `RouterLink` renders using the component set via `setLinkComponent()`,\n * falling back to a plain `<a>` tag if none has been configured.\n *\n * @example\n * // In your app entry:\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link as RRLink } from 'react-router-dom';\n * setLinkComponent(RRLink);\n *\n * // Then use RouterLink anywhere:\n * <RouterLink to=\"/dashboard\">Dashboard</RouterLink>\n */\nfunction RouterLink({ className, variant, ...props }: RouterLinkProps) {\n const Comp = configuredLinkComponent || 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && Comp === 'a' ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\nexport { Link, RouterLink, linkStyles, setLinkComponent, getLinkComponent };\n"],"mappings":"oQAKA,IAAM,GAAA,EAAA,EAAA,KACJ,8LACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,GACT,SAAU,GACX,CACF,CACD,gBAAiB,CACf,QAAS,UACV,CACF,CACF,CAMG,EAAgD,KAUpD,SAAS,EAAiB,EAA0B,CAClD,EAA0B,EAM5B,SAAS,GAAyC,CAChD,OAAO,EAgBT,SAAS,EAAK,CAAE,YAAW,UAAS,SAAQ,GAAG,GAAoB,CACjE,IAAM,EAAgB,IAAY,YAAc,CAAC,EAAS,CAAE,OAAQ,SAAU,IAAK,sBAAuB,CAAG,EAAE,CAE/G,OAAA,EAAA,EAAA,WAAiB,CACf,SACA,eAAgB,IAChB,MAAO,CACL,YAAa,OACb,UAAW,EAAA,GAAG,EAAW,CAAE,UAAS,YAAW,CAAC,CAAC,CACjD,GAAG,EACH,GAAG,EACJ,CACF,CAAC,CAkBJ,SAAS,EAAW,CAAE,YAAW,UAAS,GAAG,GAA0B,CACrE,IAAM,EAAO,GAA2B,IAExC,OACE,EAAA,EAAA,KAAC,EAAD,CACE,YAAU,OACV,UAAW,EAAA,GAAG,EAAW,CAAE,UAAS,YAAW,CAAC,CAAC,CACjD,GAAK,IAAY,YAAc,IAAS,IAAM,CAAE,OAAQ,SAAU,IAAK,sBAAuB,CAAG,EAAE,CACnG,GAAI,EACJ,CAAA"}
|
package/dist/elements/link.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
1
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
3
|
declare const linkStyles: (props?: ({
|
|
3
4
|
variant?: "default" | "external" | null | undefined;
|
|
@@ -18,18 +19,18 @@ declare function setLinkComponent(component: LinkComponent): void;
|
|
|
18
19
|
*/
|
|
19
20
|
declare function getLinkComponent(): LinkComponent | null;
|
|
20
21
|
type LinkProps = React.ComponentProps<'a'> & LinkVariantProps & {
|
|
21
|
-
|
|
22
|
+
render?: useRender.RenderProp;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* `Link` renders a styled anchor element.
|
|
25
26
|
*
|
|
26
|
-
* Supports `
|
|
27
|
+
* Supports `render` for composition with custom components.
|
|
27
28
|
*
|
|
28
29
|
* @param props.variant - "default" | "external" (adds target="_blank" and rel="noopener noreferrer")
|
|
29
|
-
* @param props.
|
|
30
|
+
* @param props.render - render as a different element (e.g. `render={<RouterLink to="..." />}`)
|
|
30
31
|
*/
|
|
31
|
-
declare function Link({ className, variant,
|
|
32
|
-
type RouterLinkProps = Omit<LinkProps, '
|
|
32
|
+
declare function Link({ className, variant, render, ...props }: LinkProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
33
|
+
type RouterLinkProps = Omit<LinkProps, 'render'> & Record<string, unknown>;
|
|
33
34
|
/**
|
|
34
35
|
* `RouterLink` renders using the component set via `setLinkComponent()`,
|
|
35
36
|
* falling back to a plain `<a>` tag if none has been configured.
|
package/dist/elements/link.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn as e } from "../lib/utils.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { cva as n } from "class-variance-authority";
|
|
4
|
-
import {
|
|
4
|
+
import { useRender as r } from "@base-ui/react/use-render";
|
|
5
5
|
//#region src/elements/link.tsx
|
|
6
6
|
var i = n("inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer", {
|
|
7
7
|
variants: { variant: {
|
|
@@ -16,18 +16,23 @@ function o(e) {
|
|
|
16
16
|
function s() {
|
|
17
17
|
return a;
|
|
18
18
|
}
|
|
19
|
-
function c({ className:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
function c({ className: t, variant: n, render: a, ...o }) {
|
|
20
|
+
let s = n === "external" && !a ? {
|
|
21
|
+
target: "_blank",
|
|
22
|
+
rel: "noopener noreferrer"
|
|
23
|
+
} : {};
|
|
24
|
+
return r({
|
|
25
|
+
render: a,
|
|
26
|
+
defaultTagName: "a",
|
|
27
|
+
props: {
|
|
28
|
+
"data-slot": "link",
|
|
29
|
+
className: e(i({
|
|
30
|
+
variant: n,
|
|
31
|
+
className: t
|
|
32
|
+
})),
|
|
33
|
+
...s,
|
|
34
|
+
...o
|
|
35
|
+
}
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
38
|
function l({ className: n, variant: r, ...o }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"link.js","names":[],"sources":["../../src/elements/link.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\nconst linkStyles = cva(\n 'inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline transition-colors outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] rounded-sm cursor-pointer',\n {\n variants: {\n variant: {\n default: '',\n external: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nexport type LinkVariantProps = VariantProps<typeof linkStyles>;\n\ntype LinkComponent = React.ElementType;\n\nlet configuredLinkComponent: LinkComponent | null = null;\n\n/**\n * Set a custom component to be used by `RouterLink` (e.g. your router's Link component).\n *\n * @example\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link } from 'react-router-dom';\n * setLinkComponent(Link);\n */\nfunction setLinkComponent(component: LinkComponent) {\n configuredLinkComponent = component;\n}\n\n/**\n * Get the currently configured link component.\n */\nfunction getLinkComponent(): LinkComponent | null {\n return configuredLinkComponent;\n}\n\ntype LinkProps = React.ComponentProps<'a'> &\n LinkVariantProps & {\n render?: useRender.RenderProp;\n };\n\n/**\n * `Link` renders a styled anchor element.\n *\n * Supports `render` for composition with custom components.\n *\n * @param props.variant - \"default\" | \"external\" (adds target=\"_blank\" and rel=\"noopener noreferrer\")\n * @param props.render - render as a different element (e.g. `render={<RouterLink to=\"...\" />}`)\n */\nfunction Link({ className, variant, render, ...props }: LinkProps) {\n const externalProps = variant === 'external' && !render ? { target: '_blank', rel: 'noopener noreferrer' } : {};\n\n return useRender({\n render,\n defaultTagName: 'a',\n props: {\n 'data-slot': 'link',\n className: cn(linkStyles({ variant, className })),\n ...externalProps,\n ...props,\n },\n });\n}\n\ntype RouterLinkProps = Omit<LinkProps, 'render'> & Record<string, unknown>;\n\n/**\n * `RouterLink` renders using the component set via `setLinkComponent()`,\n * falling back to a plain `<a>` tag if none has been configured.\n *\n * @example\n * // In your app entry:\n * import { setLinkComponent } from '@kubetail/ui/elements/link';\n * import { Link as RRLink } from 'react-router-dom';\n * setLinkComponent(RRLink);\n *\n * // Then use RouterLink anywhere:\n * <RouterLink to=\"/dashboard\">Dashboard</RouterLink>\n */\nfunction RouterLink({ className, variant, ...props }: RouterLinkProps) {\n const Comp = configuredLinkComponent || 'a';\n\n return (\n <Comp\n data-slot=\"link\"\n className={cn(linkStyles({ variant, className }))}\n {...(variant === 'external' && Comp === 'a' ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n {...props}\n />\n );\n}\n\nexport { Link, RouterLink, linkStyles, setLinkComponent, getLinkComponent };\n"],"mappings":";;;;;AAKA,IAAM,IAAa,EACjB,+LACA;CACE,UAAU,EACR,SAAS;EACP,SAAS;EACT,UAAU;EACX,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CACF,EAMG,IAAgD;AAUpD,SAAS,EAAiB,GAA0B;AAClD,KAA0B;;AAM5B,SAAS,IAAyC;AAChD,QAAO;;AAgBT,SAAS,EAAK,EAAE,cAAW,YAAS,WAAQ,GAAG,KAAoB;CACjE,IAAM,IAAgB,MAAY,cAAc,CAAC,IAAS;EAAE,QAAQ;EAAU,KAAK;EAAuB,GAAG,EAAE;AAE/G,QAAO,EAAU;EACf;EACA,gBAAgB;EAChB,OAAO;GACL,aAAa;GACb,WAAW,EAAG,EAAW;IAAE;IAAS;IAAW,CAAC,CAAC;GACjD,GAAG;GACH,GAAG;GACJ;EACF,CAAC;;AAkBJ,SAAS,EAAW,EAAE,cAAW,YAAS,GAAG,KAA0B;CACrE,IAAM,IAAO,KAA2B;AAExC,QACE,kBAAC,GAAD;EACE,aAAU;EACV,WAAW,EAAG,EAAW;GAAE;GAAS;GAAW,CAAC,CAAC;EACjD,GAAK,MAAY,cAAc,MAAS,MAAM;GAAE,QAAQ;GAAU,KAAK;GAAuB,GAAG,EAAE;EACnG,GAAI;EACJ,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`@base-ui/react/popover`);function r({...e}){return(0,t.jsx)(n.Popover.Root,{...e})}function i({...e}){return(0,t.jsx)(n.Popover.Trigger,{"data-slot":`popover-trigger`,...e})}function a({className:r,align:i=`center`,side:a,sideOffset:o=4,...s}){return(0,t.jsx)(n.Popover.Portal,{children:(0,t.jsx)(n.Popover.Positioner,{align:i,side:a,sideOffset:o,children:(0,t.jsx)(n.Popover.Popup,{"data-slot":`popover-content`,className:e.cn(`bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden`,r),...s})})})}var o=n.Popover.Close;exports.Popover=r,exports.PopoverClose=o,exports.PopoverContent=a,exports.PopoverTrigger=i;
|
|
2
2
|
//# sourceMappingURL=popover.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.cjs","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"popover.cjs","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { cn } from '@/lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n side,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['align'];\n side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['side'];\n sideOffset?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['sideOffset'];\n}) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Positioner align={align} side={side} sideOffset={sideOffset}>\n <PopoverPrimitive.Popup\n data-slot=\"popover-content\"\n className={cn(\n 'bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n );\n}\n\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport { Popover, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":"wOAMA,SAAS,EAAQ,CAAE,GAAG,GAA6D,CACjF,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,KAAlB,CAAuB,GAAI,EAAS,CAAA,CAG7C,SAAS,EAAe,CAAE,GAAG,GAAgE,CAC3F,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,QAAlB,CAA0B,YAAU,kBAAkB,GAAI,EAAS,CAAA,CAG5E,SAAS,EAAe,CACtB,YACA,QAAQ,SACR,OACA,aAAa,EACb,GAAG,GAKF,CACD,OACE,EAAA,EAAA,KAAC,EAAA,QAAiB,OAAlB,CAAA,UACE,EAAA,EAAA,KAAC,EAAA,QAAiB,WAAlB,CAAoC,QAAa,OAAkB,uBACjE,EAAA,EAAA,KAAC,EAAA,QAAiB,MAAlB,CACE,YAAU,kBACV,UAAW,EAAA,GACT,uaACA,EACD,CACD,GAAI,EACJ,CAAA,CAC0B,CAAA,CACN,CAAA,CAI9B,IAAM,EAAe,EAAA,QAAiB"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
|
|
2
2
|
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
declare function PopoverContent({ className, align, side, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Popup> & {
|
|
5
|
+
align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['align'];
|
|
6
|
+
side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['side'];
|
|
7
|
+
sideOffset?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['sideOffset'];
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const PopoverClose: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
package/dist/elements/popover.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../lib/utils.js";
|
|
3
3
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import { Popover as n } from "@base-ui/react/popover";
|
|
5
5
|
//#region src/elements/popover.tsx
|
|
6
6
|
function r({ ...e }) {
|
|
7
|
-
return /* @__PURE__ */ t(n.Root, {
|
|
8
|
-
"data-slot": "popover",
|
|
9
|
-
...e
|
|
10
|
-
});
|
|
7
|
+
return /* @__PURE__ */ t(n.Root, { ...e });
|
|
11
8
|
}
|
|
12
9
|
function i({ ...e }) {
|
|
13
10
|
return /* @__PURE__ */ t(n.Trigger, {
|
|
@@ -15,23 +12,20 @@ function i({ ...e }) {
|
|
|
15
12
|
...e
|
|
16
13
|
});
|
|
17
14
|
}
|
|
18
|
-
function a({ className: r, align: i = "center",
|
|
19
|
-
return /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(n.
|
|
20
|
-
"data-slot": "popover-content",
|
|
15
|
+
function a({ className: r, align: i = "center", side: a, sideOffset: o = 4, ...s }) {
|
|
16
|
+
return /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(n.Positioner, {
|
|
21
17
|
align: i,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
side: a,
|
|
19
|
+
sideOffset: o,
|
|
20
|
+
children: /* @__PURE__ */ t(n.Popup, {
|
|
21
|
+
"data-slot": "popover-content",
|
|
22
|
+
className: e("bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden", r),
|
|
23
|
+
...s
|
|
24
|
+
})
|
|
25
25
|
}) });
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
return /* @__PURE__ */ t(n.Anchor, {
|
|
29
|
-
"data-slot": "popover-anchor",
|
|
30
|
-
...e
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
var s = n.Close;
|
|
27
|
+
var o = n.Close;
|
|
34
28
|
//#endregion
|
|
35
|
-
export { r as Popover, o as
|
|
29
|
+
export { r as Popover, o as PopoverClose, a as PopoverContent, i as PopoverTrigger };
|
|
36
30
|
|
|
37
31
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../src/elements/popover.tsx"],"sourcesContent":["'use client';\n\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { cn } from '@/lib/utils';\n\nfunction Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\nfunction PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n side,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Popup> & {\n align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['align'];\n side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['side'];\n sideOffset?: React.ComponentProps<typeof PopoverPrimitive.Positioner>['sideOffset'];\n}) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Positioner align={align} side={side} sideOffset={sideOffset}>\n <PopoverPrimitive.Popup\n data-slot=\"popover-content\"\n className={cn(\n 'bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n );\n}\n\nconst PopoverClose = PopoverPrimitive.Close;\n\nexport { Popover, PopoverClose, PopoverContent, PopoverTrigger };\n"],"mappings":";;;;;AAMA,SAAS,EAAQ,EAAE,GAAG,KAA6D;AACjF,QAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,GAAS,CAAA;;AAG7C,SAAS,EAAe,EAAE,GAAG,KAAgE;AAC3F,QAAO,kBAAC,EAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;EAAS,CAAA;;AAG5E,SAAS,EAAe,EACtB,cACA,WAAQ,UACR,SACA,gBAAa,GACb,GAAG,KAKF;AACD,QACE,kBAAC,EAAiB,QAAlB,EAAA,UACE,kBAAC,EAAiB,YAAlB;EAAoC;EAAa;EAAkB;YACjE,kBAAC,EAAiB,OAAlB;GACE,aAAU;GACV,WAAW,EACT,waACA,EACD;GACD,GAAI;GACJ,CAAA;EAC0B,CAAA,EACN,CAAA;;AAI9B,IAAM,IAAe,EAAiB"}
|
package/dist/elements/select.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../lib/utils.cjs`);let t=require(`react/jsx-runtime`),n=require(`lucide-react`),r=require(`@base-ui/react/select`);function i({...e}){return(0,t.jsx)(r.Select.Root,{...e})}function a({...e}){return(0,t.jsx)(r.Select.Group,{"data-slot":`select-group`,...e})}function o({placeholder:e,...n}){return(0,t.jsx)(r.Select.Value,{"data-slot":`select-value`,...n,children:t=>t==null||t===``?e:String(t)})}function s({className:i,size:a=`default`,children:o,...s}){return(0,t.jsxs)(r.Select.Trigger,{"data-slot":`select-trigger`,"data-size":a,className:e.cn(`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),...s,children:[o,(0,t.jsx)(r.Select.Icon,{render:(0,t.jsx)(n.ChevronDownIcon,{className:`size-4 opacity-50`})})]})}function c({className:i,...a}){return(0,t.jsx)(r.Select.ScrollUpArrow,{"data-slot":`select-scroll-up-button`,className:e.cn(`flex cursor-default items-center justify-center py-1`,i),...a,children:(0,t.jsx)(n.ChevronUpIcon,{className:`size-4`})})}function l({className:i,...a}){return(0,t.jsx)(r.Select.ScrollDownArrow,{"data-slot":`select-scroll-down-button`,className:e.cn(`flex cursor-default items-center justify-center py-1`,i),...a,children:(0,t.jsx)(n.ChevronDownIcon,{className:`size-4`})})}function u({className:n,children:i,side:a,align:o,...s}){return(0,t.jsx)(r.Select.Portal,{children:(0,t.jsx)(r.Select.Positioner,{side:a,align:o,children:(0,t.jsxs)(r.Select.Popup,{"data-slot":`select-content`,className:e.cn(`bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md`,n),...s,children:[(0,t.jsx)(c,{}),(0,t.jsx)(r.Select.List,{className:`p-1`,children:i}),(0,t.jsx)(l,{})]})})})}function d({className:n,...i}){return(0,t.jsx)(r.Select.GroupLabel,{"data-slot":`select-label`,className:e.cn(`text-muted-foreground px-2 py-1.5 text-xs`,n),...i})}function f({className:i,children:a,...o}){return(0,t.jsxs)(r.Select.Item,{"data-slot":`select-item`,className:e.cn(`data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,i),...o,children:[(0,t.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,t.jsx)(r.Select.ItemIndicator,{children:(0,t.jsx)(n.CheckIcon,{className:`size-4`})})}),(0,t.jsx)(r.Select.ItemText,{children:a})]})}function p({className:n,...r}){return(0,t.jsx)(`div`,{role:`separator`,"data-slot":`select-separator`,className:e.cn(`bg-border pointer-events-none -mx-1 my-1 h-px`,n),...r})}exports.Select=i,exports.SelectContent=u,exports.SelectGroup=a,exports.SelectItem=f,exports.SelectLabel=d,exports.SelectScrollDownButton=l,exports.SelectScrollUpButton=c,exports.SelectSeparator=p,exports.SelectTrigger=s,exports.SelectValue=o;
|
|
2
2
|
//# sourceMappingURL=select.cjs.map
|