luan-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/components/accordion/accordion.d.ts +34 -0
  4. package/dist/components/accordion/accordion.js +15 -0
  5. package/dist/components/accordion/accordion.js.map +1 -0
  6. package/dist/components/button/button.d.ts +60 -0
  7. package/dist/components/button/button.js +80 -0
  8. package/dist/components/button/button.js.map +1 -0
  9. package/dist/components/card/card.d.ts +172 -0
  10. package/dist/components/card/card.js +212 -0
  11. package/dist/components/card/card.js.map +1 -0
  12. package/dist/components/checkbox/checkbox.d.ts +39 -0
  13. package/dist/components/checkbox/checkbox.js +66 -0
  14. package/dist/components/checkbox/checkbox.js.map +1 -0
  15. package/dist/components/dialog/dialog.d.ts +10 -0
  16. package/dist/components/dialog/dialog.js +23 -0
  17. package/dist/components/dialog/dialog.js.map +1 -0
  18. package/dist/components/form-field/form-field-context.d.ts +13 -0
  19. package/dist/components/form-field/form-field-context.js +12 -0
  20. package/dist/components/form-field/form-field-context.js.map +1 -0
  21. package/dist/components/form-field/form-field.d.ts +25 -0
  22. package/dist/components/form-field/form-field.js +46 -0
  23. package/dist/components/form-field/form-field.js.map +1 -0
  24. package/dist/components/form-helper/form-helper.d.ts +21 -0
  25. package/dist/components/form-helper/form-helper.js +42 -0
  26. package/dist/components/form-helper/form-helper.js.map +1 -0
  27. package/dist/components/icon/icon.d.ts +54 -0
  28. package/dist/components/icon/icon.js +67 -0
  29. package/dist/components/icon/icon.js.map +1 -0
  30. package/dist/components/input/input.d.ts +15 -0
  31. package/dist/components/input/input.js +42 -0
  32. package/dist/components/input/input.js.map +1 -0
  33. package/dist/components/label/label.d.ts +16 -0
  34. package/dist/components/label/label.js +23 -0
  35. package/dist/components/label/label.js.map +1 -0
  36. package/dist/components/pagination/pagination.d.ts +86 -0
  37. package/dist/components/pagination/pagination.js +134 -0
  38. package/dist/components/pagination/pagination.js.map +1 -0
  39. package/dist/components/popover/popover.d.ts +64 -0
  40. package/dist/components/popover/popover.js +81 -0
  41. package/dist/components/popover/popover.js.map +1 -0
  42. package/dist/components/progress/progress.d.ts +17 -0
  43. package/dist/components/progress/progress.js +18 -0
  44. package/dist/components/progress/progress.js.map +1 -0
  45. package/dist/components/radio-group/radio-group.d.ts +33 -0
  46. package/dist/components/radio-group/radio-group.js +37 -0
  47. package/dist/components/radio-group/radio-group.js.map +1 -0
  48. package/dist/components/select/select.d.ts +42 -0
  49. package/dist/components/select/select.js +58 -0
  50. package/dist/components/select/select.js.map +1 -0
  51. package/dist/components/skeleton/skeleton.d.ts +5 -0
  52. package/dist/components/skeleton/skeleton.js +10 -0
  53. package/dist/components/skeleton/skeleton.js.map +1 -0
  54. package/dist/components/slider/slider.d.ts +39 -0
  55. package/dist/components/slider/slider.js +36 -0
  56. package/dist/components/slider/slider.js.map +1 -0
  57. package/dist/components/slot/slot.d.ts +13 -0
  58. package/dist/components/slot/slot.js +70 -0
  59. package/dist/components/slot/slot.js.map +1 -0
  60. package/dist/components/switch/switch.d.ts +41 -0
  61. package/dist/components/switch/switch.js +74 -0
  62. package/dist/components/switch/switch.js.map +1 -0
  63. package/dist/components/table/table.d.ts +33 -0
  64. package/dist/components/table/table.js +45 -0
  65. package/dist/components/table/table.js.map +1 -0
  66. package/dist/components/tabs/tabs.d.ts +6 -0
  67. package/dist/components/tabs/tabs.js +13 -0
  68. package/dist/components/tabs/tabs.js.map +1 -0
  69. package/dist/components/toast/toast.d.ts +33 -0
  70. package/dist/components/toast/toast.js +33 -0
  71. package/dist/components/toast/toast.js.map +1 -0
  72. package/dist/components/tooltip/tooltip.d.ts +35 -0
  73. package/dist/components/tooltip/tooltip.js +48 -0
  74. package/dist/components/tooltip/tooltip.js.map +1 -0
  75. package/dist/index.d.ts +34 -0
  76. package/dist/index.js +21 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/utilities/cn/cn.d.ts +2 -0
  79. package/dist/utilities/cn/cn.js +6 -0
  80. package/dist/utilities/cn/cn.js.map +1 -0
  81. package/dist/utilities/get-variants/get-variants.d.ts +56 -0
  82. package/dist/utilities/get-variants/get-variants.js +79 -0
  83. package/dist/utilities/get-variants/get-variants.js.map +1 -0
  84. package/dist/utilities/merge-refs/merge-refs.d.ts +2 -0
  85. package/dist/utilities/merge-refs/merge-refs.js +13 -0
  86. package/dist/utilities/merge-refs/merge-refs.js.map +1 -0
  87. package/dist/utilities/pagination/get-truncated-elements.d.ts +7 -0
  88. package/dist/utilities/pagination/get-truncated-elements.js +101 -0
  89. package/dist/utilities/pagination/get-truncated-elements.js.map +1 -0
  90. package/dist/utilities/pagination/keyboard-navigation.d.ts +1 -0
  91. package/dist/utilities/pagination/keyboard-navigation.js +70 -0
  92. package/dist/utilities/pagination/keyboard-navigation.js.map +1 -0
  93. package/dist/utilities/responsive/responsive.d.ts +37 -0
  94. package/dist/utilities/responsive/responsive.js +40 -0
  95. package/dist/utilities/responsive/responsive.js.map +1 -0
  96. package/package.json +77 -0
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFormContext } from "@components/form-field/form-field-context";
3
+ import { Icon } from "@components/icon/icon";
4
+ import { CheckIcon } from "@radix-ui/react-icons";
5
+ import { getVariants } from "@utilities/get-variants/get-variants";
6
+ import { mapResponsiveValue, } from "@utilities/responsive/responsive";
7
+ import { Checkbox as CheckboxPrimitive } from "radix-ui";
8
+ import { forwardRef, } from "react";
9
+ export const SIZES = {
10
+ sm: {
11
+ small: "sm:h-4 sm:w-4",
12
+ medium: "sm:h-5 sm:w-5",
13
+ large: "sm:h-6 sm:w-6",
14
+ },
15
+ md: {
16
+ small: "md:h-4 md:w-4",
17
+ medium: "md:h-5 md:w-5",
18
+ large: "md:h-6 md:w-6",
19
+ },
20
+ lg: {
21
+ small: "lg:h-4 lg:w-4",
22
+ medium: "lg:h-5 lg:w-5",
23
+ large: "lg:h-6 lg:w-6",
24
+ },
25
+ xl: {
26
+ small: "xl:h-4 xl:w-4",
27
+ medium: "xl:h-5 xl:w-5",
28
+ large: "xl:h-6 xl:w-6",
29
+ },
30
+ };
31
+ const checkboxStyles = getVariants({
32
+ base: "peer flex h-4 w-4 items-center justify-center rounded-sm border border-gray-700 shadow-sm focus:outline-none focus:ring-1 focus:ring-gray-700 data-[state=checked]:bg-gray-700 data-[state=checked]:text-gray-100",
33
+ variants: {
34
+ disabled: {
35
+ true: "cursor-not-allowed bg-gray-400 opacity-50",
36
+ },
37
+ size: {
38
+ small: "h-4 w-4",
39
+ medium: "h-5 w-5",
40
+ large: "h-6 w-6",
41
+ },
42
+ },
43
+ });
44
+ const iconSizeMap = {
45
+ small: "small",
46
+ medium: "medium",
47
+ large: "medium",
48
+ };
49
+ /**
50
+ * A checkbox component built on top of Radix UI's checkbox primitive.
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * <Checkbox id="checkbox" onCheckedChange={(checked) => console.log(checked)} />
55
+ * ```
56
+ */
57
+ export const Checkbox = forwardRef(({ className, disabled: initialDisabled, required: initialRequired, size = "medium", ...props }, ref) => {
58
+ const iconSize = mapResponsiveValue(size, (size) => iconSizeMap[size]);
59
+ const { disabled, required } = useFormContext({
60
+ disabled: initialDisabled,
61
+ required: initialRequired,
62
+ });
63
+ return (_jsx(CheckboxPrimitive.Root, { className: checkboxStyles({ disabled, size, className }), ref: ref, disabled: disabled, required: required, ...props, children: _jsx(CheckboxPrimitive.Indicator, { children: _jsx(Icon, { asChild: true, size: iconSize, children: _jsx(CheckIcon, {}) }) }) }));
64
+ });
65
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
66
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE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AG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC7C,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,iBAAiB,CAAC,IAAI,IACtB,SAAS,EAAE,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACxD,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,KAAK,YAET,KAAC,iBAAiB,CAAC,SAAS,cAC3B,KAAC,IAAI,IAAC,OAAO,QAAC,IAAI,EAAE,QAAQ,YAC3B,KAAC,SAAS,KAAG,GACP,GACsB,GACN,CACzB,CAAC;AACH,CAAC,CACD,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Dialog as RadixDialog } from "radix-ui";
2
+ declare const Dialog: import("react").FC<RadixDialog.DialogProps>;
3
+ declare const DialogTrigger: import("react").ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
4
+ declare const DialogClose: import("react").ForwardRefExoticComponent<RadixDialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
5
+ declare const DialogContent: import("react").ForwardRefExoticComponent<Omit<RadixDialog.DialogContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
6
+ declare const DialogHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
7
+ declare const DialogTitle: import("react").ForwardRefExoticComponent<Omit<RadixDialog.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
8
+ declare const DialogDescription: import("react").ForwardRefExoticComponent<Omit<RadixDialog.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
9
+ declare const DialogFooter: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
10
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Cross1Icon } from "@radix-ui/react-icons";
3
+ import { cn } from "@utilities/cn/cn";
4
+ import { Dialog as RadixDialog } from "radix-ui";
5
+ import { forwardRef, } from "react";
6
+ const Dialog = RadixDialog.Root;
7
+ const DialogTrigger = RadixDialog.Trigger;
8
+ const DialogClose = RadixDialog.Close;
9
+ const DialogOverlay = forwardRef(({ className, ...props }, ref) => (_jsx(RadixDialog.Overlay, { ref: ref, className: cn("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in", className), ...props })));
10
+ DialogOverlay.displayName = RadixDialog.Overlay.displayName;
11
+ const DialogContent = forwardRef(({ children, className, ...props }, ref) => {
12
+ return (_jsxs(DialogOverlay, { children: [_jsx(DialogOverlay, {}), _jsxs(RadixDialog.Content, { className: cn("-translate-x-1/2 -translate-y-1/2 fixed top-1/2 left-1/2 z-50 flex w-fit max-w-xl flex-col gap-4 rounded-lg bg-white p-4", className), ...props, ref: ref, children: [_jsx(DialogClose, { asChild: true, children: _jsx("button", { type: "button", className: "absolute top-4 right-4", children: _jsx(Cross1Icon, { className: "h-4 w-4" }) }) }), children] })] }));
13
+ });
14
+ const DialogHeader = forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex flex-col gap-1", className), ...props })));
15
+ DialogHeader.displayName = "DialogHeader";
16
+ const DialogTitle = forwardRef(({ className, ...props }, ref) => (_jsx(RadixDialog.Title, { ref: ref, className: cn("font-semibold text-lg", className), ...props })));
17
+ DialogTitle.displayName = "DialogTitle";
18
+ const DialogDescription = forwardRef(({ className, ...props }, ref) => (_jsx(RadixDialog.Description, { ref: ref, className: cn("text-gray-500 text-sm", className), ...props })));
19
+ DialogDescription.displayName = "DialogDescription";
20
+ const DialogFooter = forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex justify-end gap-2", className), ...props })));
21
+ DialogFooter.displayName = "DialogFooter";
22
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
23
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/components/dialog/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAGN,UAAU,GACV,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC;AAEhC,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC;AAE1C,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC;AAEtC,MAAM,aAAa,GAAG,UAAU,CAG9B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,KAAC,WAAW,CAAC,OAAO,IACnB,GAA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,CAAC;AAExC,MAAM,iBAAiB,GAAG,UAAU,CAGlC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,KAAC,WAAW,CAAC,WAAW,IACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,KAC7C,KAAK,GACR,CACF,CAAC,CAAC;AAEH,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAEpD,MAAM,YAAY,GAAG,UAAU,CAG7B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,wBAAwB,EAAE,SAAS,CAAC,KAC9C,KAAK,GACR,CACF,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAC1C,OAAO,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,GACb,CAAC"}
@@ -0,0 +1,13 @@
1
+ type FormFieldContextType = {
2
+ disabled?: boolean;
3
+ required?: boolean;
4
+ error?: boolean;
5
+ };
6
+ export declare const FormFieldContext: import("react").Context<FormFieldContextType | undefined>;
7
+ export declare const FormFieldProvider: import("react").Provider<FormFieldContextType | undefined>;
8
+ export declare const useFormContext: (props: FormFieldContextType) => {
9
+ disabled: boolean | undefined;
10
+ required: boolean | undefined;
11
+ error: boolean | undefined;
12
+ };
13
+ export {};
@@ -0,0 +1,12 @@
1
+ import { createContext, useContext } from "react";
2
+ export const FormFieldContext = createContext(undefined);
3
+ export const FormFieldProvider = FormFieldContext.Provider;
4
+ export const useFormContext = (props) => {
5
+ const context = useContext(FormFieldContext);
6
+ return {
7
+ disabled: props.disabled ?? context?.disabled,
8
+ required: props.required ?? context?.required,
9
+ error: props.error ?? context?.error,
10
+ };
11
+ };
12
+ //# sourceMappingURL=form-field-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field-context.js","sourceRoot":"","sources":["../../../src/components/form-field/form-field-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC5C,SAAS,CACT,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,QAAQ,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAE7C,OAAO;QACN,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,OAAO,EAAE,QAAQ;QAC7C,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,OAAO,EAAE,QAAQ;QAC7C,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,OAAO,EAAE,KAAK;KACpC,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ export type FormFieldProps = ComponentPropsWithoutRef<"div"> & {
3
+ orientation?: "horizontal" | "vertical";
4
+ disabled?: boolean;
5
+ required?: boolean;
6
+ error?: boolean;
7
+ };
8
+ /**
9
+ * A component that displays a form field. Should be used as a parent of a Label, an input element and a FormHelper component.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <FormField>
14
+ * <Label>Email</Label>
15
+ * <Input />
16
+ * <FormHelper>This is a helper text</FormHelper>
17
+ * </FormField>
18
+ * ```
19
+ */
20
+ export declare const FormField: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
21
+ orientation?: "horizontal" | "vertical";
22
+ disabled?: boolean;
23
+ required?: boolean;
24
+ error?: boolean;
25
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,46 @@
1
+ import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { FormHelper } from "@components/form-helper/form-helper";
3
+ import { Label } from "@components/label/label";
4
+ import { getVariants } from "@utilities/get-variants/get-variants";
5
+ import { Children, forwardRef, isValidElement, } from "react";
6
+ import { FormFieldProvider } from "./form-field-context";
7
+ const formFieldStyles = getVariants({
8
+ base: "flex gap-2",
9
+ variants: {
10
+ orientation: {
11
+ horizontal: "flex-row items-start",
12
+ vertical: "flex-col",
13
+ },
14
+ },
15
+ });
16
+ /**
17
+ * A component that displays a form field. Should be used as a parent of a Label, an input element and a FormHelper component.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <FormField>
22
+ * <Label>Email</Label>
23
+ * <Input />
24
+ * <FormHelper>This is a helper text</FormHelper>
25
+ * </FormField>
26
+ * ```
27
+ */
28
+ export const FormField = forwardRef(({ className, children, orientation = "vertical", disabled, required, error, ...props }, ref) => {
29
+ const childElements = Children.toArray(children);
30
+ const label = childElements.find((child) => isValidElement(child) && child.type === Label);
31
+ const helperText = childElements.find((child) => isValidElement(child) && child.type === FormHelper);
32
+ const input = childElements.find((child) => isValidElement(child) &&
33
+ child.type !== Label &&
34
+ child.type !== FormHelper);
35
+ if (!label || !input) {
36
+ console.warn("FormField requires both Label and Input components as children");
37
+ return null;
38
+ }
39
+ return (_jsx(FormFieldProvider, { value: {
40
+ disabled,
41
+ required,
42
+ error,
43
+ }, children: _jsx("div", { ref: ref, className: formFieldStyles({ orientation, className }), ...props, children: orientation === "horizontal" ? (_jsxs(_Fragment, { children: [input, _jsxs("div", { className: "flex flex-col", children: [label, helperText] })] })) : (_jsxs(_Fragment, { children: [label, input, helperText] })) }) }));
44
+ });
45
+ FormField.displayName = "FormField";
46
+ //# sourceMappingURL=form-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src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AAC;IAEF,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CACX,gEAAgE,CAChE,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,CACN,KAAC,iBAAiB,IACjB,KAAK,EAAE;YACN,QAAQ;YACR,QAAQ;YACR,KAAK;SACL,YAED,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,eAAe,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAClD,KAAK,YAER,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,CAC/B,8BACE,KAAK,EACN,eAAK,SAAS,EAAC,eAAe,aAC5B,KAAK,EACL,UAAU,IACN,IACJ,CACH,CAAC,CAAC,CAAC,CACH,8BACE,KAAK,EACL,KAAK,EACL,UAAU,IACT,CACH,GACI,GACa,CACpB,CAAC;AACH,CAAC,CACD,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ export type FormHelperProps = ComponentPropsWithoutRef<"div"> & {
3
+ error?: boolean;
4
+ disabled?: boolean;
5
+ };
6
+ /**
7
+ * A component that displays a helper text for a form field. Should be used as a child of a FormField component and will inherit the form field's error and disabled state.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <FormField>
12
+ * <Label>Email</Label>
13
+ * <Input />
14
+ * <FormHelper>This is a helper text</FormHelper>
15
+ * </FormField>
16
+ * ```
17
+ */
18
+ export declare const FormHelper: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
19
+ error?: boolean;
20
+ disabled?: boolean;
21
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFormContext } from "@components/form-field/form-field-context";
3
+ import { getVariants } from "@utilities/get-variants/get-variants";
4
+ import { forwardRef } from "react";
5
+ const formHelperStyles = getVariants({
6
+ base: "text-gray-500 text-sm",
7
+ variants: {
8
+ error: {
9
+ true: "text-red-600",
10
+ },
11
+ disabled: {
12
+ true: "text-gray-300",
13
+ },
14
+ },
15
+ compoundVariants: [
16
+ {
17
+ error: true,
18
+ disabled: true,
19
+ className: "text-gray-300",
20
+ },
21
+ ],
22
+ });
23
+ /**
24
+ * A component that displays a helper text for a form field. Should be used as a child of a FormField component and will inherit the form field's error and disabled state.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <FormField>
29
+ * <Label>Email</Label>
30
+ * <Input />
31
+ * <FormHelper>This is a helper text</FormHelper>
32
+ * </FormField>
33
+ * ```
34
+ */
35
+ export const FormHelper = forwardRef(({ className, children, error: initialError, disabled: initialDisabled, ...props }, ref) => {
36
+ const { error, disabled } = useFormContext({
37
+ error: initialError,
38
+ disabled: initialDisabled,
39
+ });
40
+ return (_jsx("div", { ref: ref, className: formHelperStyles({ error, disabled, className }), ...props, children: children }));
41
+ });
42
+ //# sourceMappingURL=form-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-helper.js","sourceRoot":"","sources":["../../../src/components/form-helper/form-helper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;AAOlE,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACpC,IAAI,EAAE,uBAAuB;IAC7B,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,IAAI,EAAE,cAAc;SACpB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,eAAe;SACrB;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,eAAe;SAC1B;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CACnC,CACC,EACC,SAAS,EACT,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC1C,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,OAAO,CACN,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,KACvD,KAAK,YAER,QAAQ,GACJ,CACN,CAAC;AACH,CAAC,CACD,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { ResponsiveValue } from "@utilities/responsive/responsive";
2
+ export type IconProps = React.SVGProps<SVGSVGElement> & {
3
+ asChild?: boolean;
4
+ size?: ResponsiveValue<"small" | "medium" | "large">;
5
+ };
6
+ export declare const SIZES: {
7
+ sm: {
8
+ small: string;
9
+ medium: string;
10
+ large: string;
11
+ };
12
+ md: {
13
+ small: string;
14
+ medium: string;
15
+ large: string;
16
+ };
17
+ lg: {
18
+ small: string;
19
+ medium: string;
20
+ large: string;
21
+ };
22
+ xl: {
23
+ small: string;
24
+ medium: string;
25
+ large: string;
26
+ };
27
+ };
28
+ /**
29
+ * A flexible icon component that serves as a wrapper for SVG icons.
30
+ * Must be used with asChild={true} to render the actual icon component.
31
+ *
32
+ * @example
33
+ * // Correct usage
34
+ * <Icon asChild size="medium">
35
+ * <HomeIcon />
36
+ * </Icon>
37
+ *
38
+ * @example
39
+ * // With different sizes
40
+ * <Icon asChild size="small">
41
+ * <UserIcon />
42
+ * </Icon>
43
+ *
44
+ * @example
45
+ * // With custom className
46
+ * <Icon asChild className="text-blue-500">
47
+ * <SettingsIcon />
48
+ * </Icon>
49
+ *
50
+ * @param {boolean} [props.asChild] - Should always be true when using this component
51
+ * @param {ResponsiveValue<"small" | "medium" | "large">} [props.size="medium"] - The size of the icon
52
+ * @param {string} [props.className] - Additional CSS classes to apply
53
+ */
54
+ export declare const Icon: import("react").ForwardRefExoticComponent<Omit<IconProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@components/slot/slot";
3
+ import { getVariants } from "@utilities/get-variants/get-variants";
4
+ import { forwardRef } from "react";
5
+ export const SIZES = {
6
+ sm: {
7
+ small: "sm:h-4 sm:w-4",
8
+ medium: "sm:h-6 sm:w-6",
9
+ large: "sm:h-8 sm:w-8",
10
+ },
11
+ md: {
12
+ small: "md:h-4 md:w-4",
13
+ medium: "md:h-6 md:w-6",
14
+ large: "md:h-8 md:w-8",
15
+ },
16
+ lg: {
17
+ small: "lg:h-4 lg:w-4",
18
+ medium: "lg:h-6 lg:w-6",
19
+ large: "lg:h-8 lg:w-8",
20
+ },
21
+ xl: {
22
+ small: "xl:h-4 xl:w-4",
23
+ medium: "xl:h-6 xl:w-6",
24
+ large: "xl:h-8 xl:w-8",
25
+ },
26
+ };
27
+ const iconStyles = getVariants({
28
+ base: "fill-current text-current",
29
+ variants: {
30
+ size: {
31
+ small: "h-4 w-4",
32
+ medium: "h-6 w-6",
33
+ large: "h-8 w-8",
34
+ },
35
+ },
36
+ });
37
+ /**
38
+ * A flexible icon component that serves as a wrapper for SVG icons.
39
+ * Must be used with asChild={true} to render the actual icon component.
40
+ *
41
+ * @example
42
+ * // Correct usage
43
+ * <Icon asChild size="medium">
44
+ * <HomeIcon />
45
+ * </Icon>
46
+ *
47
+ * @example
48
+ * // With different sizes
49
+ * <Icon asChild size="small">
50
+ * <UserIcon />
51
+ * </Icon>
52
+ *
53
+ * @example
54
+ * // With custom className
55
+ * <Icon asChild className="text-blue-500">
56
+ * <SettingsIcon />
57
+ * </Icon>
58
+ *
59
+ * @param {boolean} [props.asChild] - Should always be true when using this component
60
+ * @param {ResponsiveValue<"small" | "medium" | "large">} [props.size="medium"] - The size of the icon
61
+ * @param {string} [props.className] - Additional CSS classes to apply
62
+ */
63
+ export const Icon = forwardRef(({ className, size = "medium", asChild, ...props }, ref) => {
64
+ const Comp = asChild ? Slot : "svg";
65
+ return (_jsx(Comp, { ref: ref, className: iconStyles({ size, className }), ...props }));
66
+ });
67
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/components/icon/icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,EAAqB,UAAU,EAAE,MAAM,OAAO,CAAC;AAOtD,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,eAAe;KACtB;CACD,CAAC;AAEF,MAAM,UAAU,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,2BAA2B;IACjC,QAAQ,EAAE;QACT,IAAI,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,SAAS;SAChB;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACpC,OAAO,CACN,KAAC,IAAI,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,KAAM,KAAK,GAAI,CACzE,CAAC;AACH,CAAC,CACD,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
2
+ error?: boolean;
3
+ };
4
+ /**
5
+ * A basic input component with styling.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <Input placeholder="Enter your email" id="email" />
10
+ * ```
11
+ */
12
+ declare const Input: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & {
13
+ error?: boolean;
14
+ } & import("react").RefAttributes<HTMLInputElement>>;
15
+ export { Input };
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFormContext } from "@components/form-field/form-field-context";
3
+ import { cn } from "@utilities/cn/cn";
4
+ import { getVariants } from "@utilities/get-variants/get-variants";
5
+ import { forwardRef } from "react";
6
+ const inputStyles = getVariants({
7
+ base: "rounded-sm border border-gray-400 px-3 py-2 text-sm placeholder:text-gray-400 focus-visible:outline focus-visible:outline-gray-800",
8
+ variants: {
9
+ error: {
10
+ true: "border-red-600",
11
+ },
12
+ disabled: {
13
+ true: "disabled:cursor-not-allowed disabled:opacity-50",
14
+ },
15
+ },
16
+ compoundVariants: [
17
+ {
18
+ error: true,
19
+ disabled: true,
20
+ className: "border-gray-400 disabled:cursor-not-allowed disabled:opacity-50",
21
+ },
22
+ ],
23
+ });
24
+ /**
25
+ * A basic input component with styling.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <Input placeholder="Enter your email" id="email" />
30
+ * ```
31
+ */
32
+ const Input = forwardRef(({ className, disabled: initialDisabled, required: initialRequired, error: initialError, ...props }, ref) => {
33
+ const { disabled, required, error } = useFormContext({
34
+ disabled: initialDisabled,
35
+ required: initialRequired,
36
+ error: initialError,
37
+ });
38
+ return (_jsx("input", { className: inputStyles({ disabled, error, className }), disabled: disabled, required: required, ...props, ref: ref }));
39
+ });
40
+ Input.displayName = "Input";
41
+ export { Input };
42
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMnC,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,IAAI,EAAE,oIAAoI;IAC1I,QAAQ,EAAE;QACT,KAAK,EAAE;YACN,IAAI,EAAE,gBAAgB;SACtB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE,iDAAiD;SACvD;KACD;IACD,gBAAgB,EAAE;QACjB;YACC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,IAAI;YACd,SAAS,EACR,iEAAiE;SAClE;KACD;CACD,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,UAAU,CACvB,CACC,EACC,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC;QACpD,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;QACzB,KAAK,EAAE,YAAY;KACnB,CAAC,CAAC;IACH,OAAO,CACN,gBACC,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EACtD,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,KAAK,EACT,GAAG,EAAE,GAAG,GACP,CACF,CAAC;AACH,CAAC,CACD,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
2
+ required?: boolean;
3
+ };
4
+ /**
5
+ * A label component that can be used to label form fields.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <Label htmlFor="email">Email</Label>
10
+ * <Input id="email" />
11
+ * ```
12
+ */
13
+ declare const Label: import("react").ForwardRefExoticComponent<import("react").LabelHTMLAttributes<HTMLLabelElement> & {
14
+ required?: boolean;
15
+ } & import("react").RefAttributes<HTMLLabelElement>>;
16
+ export { Label };
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFormContext } from "@components/form-field/form-field-context";
3
+ import { cn } from "@utilities/cn/cn";
4
+ import { Label as RadixLabel } from "radix-ui";
5
+ import { forwardRef } from "react";
6
+ /**
7
+ * A label component that can be used to label form fields.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <Label htmlFor="email">Email</Label>
12
+ * <Input id="email" />
13
+ * ```
14
+ */
15
+ const Label = forwardRef(({ className, required: initialRequired, children, ...props }, ref) => {
16
+ const { required } = useFormContext({
17
+ required: initialRequired,
18
+ });
19
+ return (_jsxs(RadixLabel.Root, { className: cn("font-medium text-gray-900 text-md peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className), ...props, ref: ref, children: [children, required && _jsx("span", { children: "*" })] }));
20
+ });
21
+ Label.displayName = RadixLabel.Root.displayName;
22
+ export { Label };
23
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/components/label/label.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMnC;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG,UAAU,CACvB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACrE,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QACnC,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,MAAC,UAAU,CAAC,IAAI,IACf,SAAS,EAAE,EAAE,CACZ,6FAA6F,EAC7F,SAAS,CACT,KACG,KAAK,EACT,GAAG,EAAE,GAAG,aAEP,QAAQ,EACR,QAAQ,IAAI,+BAAc,IACV,CAClB,CAAC;AACH,CAAC,CACD,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Pagination
3
+ */
4
+ export type PaginationProps = {
5
+ children?: React.ReactNode;
6
+ page: number;
7
+ totalPages: number;
8
+ onPageChange: (page: number) => void;
9
+ asChild?: boolean;
10
+ } & React.HTMLAttributes<HTMLElement>;
11
+ /**
12
+ * Pagination component that provides navigation controls for a set of pages.
13
+ *
14
+ * @param {number} props.page - The current active page number
15
+ * @param {number} props.totalPages - The total number of pages
16
+ * @param {(page: number) => void} props.onPageChange - Callback function called when page changes
17
+ * @param {boolean} [props.asChild] - Whether to render the root element as a child component
18
+ * @param {React.ReactNode} [props.children] - The content to render within the pagination component
19
+ * @param {string} [props.className] - Additional CSS classes to apply
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <Pagination page={1} totalPages={10} onPageChange={(page) => console.log(page)}>
24
+ * <PaginationPrev>Previous</PaginationPrev>
25
+ * <PaginationItem index={1}>1</PaginationItem>
26
+ * <PaginationItem index={2}>2</PaginationItem>
27
+ * <PaginationNext>Next</PaginationNext>
28
+ * </Pagination>
29
+ * ```
30
+ */
31
+ declare const Pagination: import("react").ForwardRefExoticComponent<{
32
+ children?: React.ReactNode;
33
+ page: number;
34
+ totalPages: number;
35
+ onPageChange: (page: number) => void;
36
+ asChild?: boolean;
37
+ } & import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
38
+ /**
39
+ * Pagination Item
40
+ */
41
+ export type PaginationItemProps = {
42
+ children?: React.ReactNode;
43
+ index?: number;
44
+ } & React.HTMLAttributes<HTMLButtonElement>;
45
+ /**
46
+ * Individual page item within the Pagination component.
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * <PaginationItem index={1}>1</PaginationItem>
51
+ */
52
+ declare const PaginationItem: import("react").ForwardRefExoticComponent<{
53
+ children?: React.ReactNode;
54
+ index?: number;
55
+ } & import("react").HTMLAttributes<HTMLButtonElement> & import("react").RefAttributes<HTMLButtonElement>>;
56
+ /**
57
+ * Pagination Prev
58
+ */
59
+ /**
60
+ * Previous page button component for the Pagination.
61
+ * Automatically disabled when on the first page.
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * <PaginationPrev>Previous</PaginationPrev>
66
+ * ```
67
+ */
68
+ declare const PaginationPrev: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLButtonElement> & {
69
+ children?: import("react").ReactNode | undefined;
70
+ } & import("react").RefAttributes<HTMLButtonElement>>;
71
+ /**
72
+ * Pagination Next
73
+ */
74
+ /**
75
+ * Next page button component for the Pagination.
76
+ * Automatically disabled when on the last page.
77
+ *
78
+ * @example
79
+ * ```tsx
80
+ * <PaginationNext>Next</PaginationNext>
81
+ * ```
82
+ */
83
+ declare const PaginationNext: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLButtonElement> & {
84
+ children?: import("react").ReactNode | undefined;
85
+ } & import("react").RefAttributes<HTMLButtonElement>>;
86
+ export { Pagination, PaginationItem, PaginationPrev, PaginationNext };