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.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/components/accordion/accordion.d.ts +34 -0
- package/dist/components/accordion/accordion.js +15 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/button/button.d.ts +60 -0
- package/dist/components/button/button.js +80 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/card/card.d.ts +172 -0
- package/dist/components/card/card.js +212 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +39 -0
- package/dist/components/checkbox/checkbox.js +66 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +10 -0
- package/dist/components/dialog/dialog.js +23 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/form-field/form-field-context.d.ts +13 -0
- package/dist/components/form-field/form-field-context.js +12 -0
- package/dist/components/form-field/form-field-context.js.map +1 -0
- package/dist/components/form-field/form-field.d.ts +25 -0
- package/dist/components/form-field/form-field.js +46 -0
- package/dist/components/form-field/form-field.js.map +1 -0
- package/dist/components/form-helper/form-helper.d.ts +21 -0
- package/dist/components/form-helper/form-helper.js +42 -0
- package/dist/components/form-helper/form-helper.js.map +1 -0
- package/dist/components/icon/icon.d.ts +54 -0
- package/dist/components/icon/icon.js +67 -0
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/input/input.d.ts +15 -0
- package/dist/components/input/input.js +42 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/label/label.d.ts +16 -0
- package/dist/components/label/label.js +23 -0
- package/dist/components/label/label.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +86 -0
- package/dist/components/pagination/pagination.js +134 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/popover/popover.d.ts +64 -0
- package/dist/components/popover/popover.js +81 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/progress/progress.d.ts +17 -0
- package/dist/components/progress/progress.js +18 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +33 -0
- package/dist/components/radio-group/radio-group.js +37 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/select/select.d.ts +42 -0
- package/dist/components/select/select.js +58 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +5 -0
- package/dist/components/skeleton/skeleton.js +10 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/slider/slider.d.ts +39 -0
- package/dist/components/slider/slider.js +36 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/slot/slot.d.ts +13 -0
- package/dist/components/slot/slot.js +70 -0
- package/dist/components/slot/slot.js.map +1 -0
- package/dist/components/switch/switch.d.ts +41 -0
- package/dist/components/switch/switch.js +74 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/table.d.ts +33 -0
- package/dist/components/table/table.js +45 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +6 -0
- package/dist/components/tabs/tabs.js +13 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/toast/toast.d.ts +33 -0
- package/dist/components/toast/toast.js +33 -0
- package/dist/components/toast/toast.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +35 -0
- package/dist/components/tooltip/tooltip.js +48 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/utilities/cn/cn.d.ts +2 -0
- package/dist/utilities/cn/cn.js +6 -0
- package/dist/utilities/cn/cn.js.map +1 -0
- package/dist/utilities/get-variants/get-variants.d.ts +56 -0
- package/dist/utilities/get-variants/get-variants.js +79 -0
- package/dist/utilities/get-variants/get-variants.js.map +1 -0
- package/dist/utilities/merge-refs/merge-refs.d.ts +2 -0
- package/dist/utilities/merge-refs/merge-refs.js +13 -0
- package/dist/utilities/merge-refs/merge-refs.js.map +1 -0
- package/dist/utilities/pagination/get-truncated-elements.d.ts +7 -0
- package/dist/utilities/pagination/get-truncated-elements.js +101 -0
- package/dist/utilities/pagination/get-truncated-elements.js.map +1 -0
- package/dist/utilities/pagination/keyboard-navigation.d.ts +1 -0
- package/dist/utilities/pagination/keyboard-navigation.js +70 -0
- package/dist/utilities/pagination/keyboard-navigation.js.map +1 -0
- package/dist/utilities/responsive/responsive.d.ts +37 -0
- package/dist/utilities/responsive/responsive.js +40 -0
- package/dist/utilities/responsive/responsive.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface SlotProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<unknown>>;
|
|
6
|
+
type SlottableProps = {
|
|
7
|
+
child: React.ReactNode;
|
|
8
|
+
children: (child: React.ReactNode) => React.JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
declare const Slottable: ({ child, children }: SlottableProps) => React.JSX.Element;
|
|
11
|
+
declare const Root: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<unknown>>;
|
|
12
|
+
export { Root, Slot, Slottable };
|
|
13
|
+
export type { SlotProps };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { children, ...slotProps } = props;
|
|
6
|
+
if (isSlottable(children)) {
|
|
7
|
+
const slottable = children;
|
|
8
|
+
return (_jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(slottable.props.child)
|
|
9
|
+
? React.cloneElement(slottable.props.child, undefined, slottable.props.children(slottable.props.child.props.children))
|
|
10
|
+
: null }));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: children }));
|
|
13
|
+
});
|
|
14
|
+
Slot.displayName = "Slot";
|
|
15
|
+
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
16
|
+
const { children, ...slotProps } = props;
|
|
17
|
+
if (React.isValidElement(children)) {
|
|
18
|
+
return React.cloneElement(children, {
|
|
19
|
+
...mergeProps(slotProps, children.props),
|
|
20
|
+
ref: forwardedRef
|
|
21
|
+
? composeRefs(forwardedRef, children.ref)
|
|
22
|
+
: children.ref,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return React.Children.count(children) > 1
|
|
26
|
+
? React.Children.only(null)
|
|
27
|
+
: null;
|
|
28
|
+
});
|
|
29
|
+
SlotClone.displayName = "SlotClone";
|
|
30
|
+
const Slottable = ({ child, children }) => {
|
|
31
|
+
return children(child);
|
|
32
|
+
};
|
|
33
|
+
function isSlottable(child) {
|
|
34
|
+
return React.isValidElement(child) && child.type === Slottable;
|
|
35
|
+
}
|
|
36
|
+
function mergeProps(slotProps, childProps) {
|
|
37
|
+
// all child props should override
|
|
38
|
+
const overrideProps = { ...childProps };
|
|
39
|
+
for (const propName in childProps) {
|
|
40
|
+
const slotPropValue = slotProps[propName];
|
|
41
|
+
const childPropValue = childProps[propName];
|
|
42
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
43
|
+
if (isHandler) {
|
|
44
|
+
// if the handler exists on both, we compose them
|
|
45
|
+
if (slotPropValue && childPropValue) {
|
|
46
|
+
overrideProps[propName] = (...args) => {
|
|
47
|
+
childPropValue(...args);
|
|
48
|
+
slotPropValue(...args);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// but if it exists only on the slot, we use only this one
|
|
52
|
+
else if (slotPropValue) {
|
|
53
|
+
overrideProps[propName] = slotPropValue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// if it's `style`, we merge them
|
|
57
|
+
else if (propName === "style") {
|
|
58
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
59
|
+
}
|
|
60
|
+
else if (propName === "className") {
|
|
61
|
+
overrideProps[propName] = [slotPropValue, childPropValue]
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.join(" ");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { ...slotProps, ...overrideProps };
|
|
67
|
+
}
|
|
68
|
+
const Root = Slot;
|
|
69
|
+
export { Root, Slot, Slottable };
|
|
70
|
+
//# sourceMappingURL=slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/components/slot/slot.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACxE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAEzC,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,QAAQ,CAAC;QAE3B,OAAO,CACN,KAAC,SAAS,OAAK,SAAS,EAAE,GAAG,EAAE,YAAY,YACzC,KAAK,CAAC,cAAc,CACpB,SAAS,CAAC,KAAK,CAAC,KAAK,CACrB;gBACA,CAAC,CAAC,KAAK,CAAC,YAAY,CAClB,SAAS,CAAC,KAAK,CAAC,KAAK,EACrB,SAAS,EACT,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC9D;gBACF,CAAC,CAAC,IAAI,GACI,CACZ,CAAC;IACH,CAAC;IAED,OAAO,CACN,KAAC,SAAS,OAAK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+
import { Switch as RadixSwitch } from "radix-ui";
|
|
3
|
+
export type SwitchProps = RadixSwitch.SwitchProps & {
|
|
4
|
+
size?: ResponsiveValue<"small" | "medium" | "large">;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A switch component that toggles between on and off states.
|
|
9
|
+
* Built on top of Radix UI's Switch primitive.
|
|
10
|
+
*
|
|
11
|
+
* @param {SwitchProps} props - The props for the Switch component
|
|
12
|
+
* @param {ResponsiveValue<"small" | "medium" | "large">} [props.size="medium"] - The size of the switch
|
|
13
|
+
* @param {boolean} [props.disabled] - Whether the switch is disabled
|
|
14
|
+
* @param {string} [props.className] - Additional CSS classes to apply
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage
|
|
18
|
+
* <Switch />
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // With different sizes
|
|
22
|
+
* <Switch size="small" />
|
|
23
|
+
* <Switch size="medium" />
|
|
24
|
+
* <Switch size="large" />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Disabled state
|
|
28
|
+
* <Switch disabled />
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // With onChange handler
|
|
32
|
+
* <Switch onCheckedChange={(checked) => console.log(checked)} />
|
|
33
|
+
*
|
|
34
|
+
* @param {ResponsiveValue<"small" | "medium" | "large">} [props.size="medium"] - The size of the switch
|
|
35
|
+
* @param {boolean} [props.disabled] - Whether the switch is disabled
|
|
36
|
+
* @param {string} [props.className] - Additional CSS classes to apply
|
|
37
|
+
*/
|
|
38
|
+
export declare const Switch: import("react").ForwardRefExoticComponent<RadixSwitch.SwitchProps & {
|
|
39
|
+
size?: ResponsiveValue<"small" | "medium" | "large">;
|
|
40
|
+
error?: boolean;
|
|
41
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { Switch as RadixSwitch } from "radix-ui";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
const rootStyles = getVariants({
|
|
7
|
+
base: "relative flex cursor-pointer appearance-none items-center rounded-full bg-gray-500 transition-colors duration-500 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-light-blue-300 data-[state=checked]:bg-green-500",
|
|
8
|
+
variants: {
|
|
9
|
+
disabled: {
|
|
10
|
+
true: "cursor-not-allowed opacity-50",
|
|
11
|
+
},
|
|
12
|
+
error: {
|
|
13
|
+
true: "bg-red-600 data-[state=checked]:bg-red-600",
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
small: "h-5 w-10",
|
|
17
|
+
medium: "h-7 w-12",
|
|
18
|
+
large: "h-9 w-14",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const thumbStyles = getVariants({
|
|
23
|
+
base: "absolute left-1 h-5 w-5 rounded-full transition-transform duration-500 ease-out data-[state=checked]:translate-x-[1.125rem]",
|
|
24
|
+
variants: {
|
|
25
|
+
disabled: {
|
|
26
|
+
true: "bg-gray-300",
|
|
27
|
+
false: "bg-white",
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
small: "h-3 w-3",
|
|
31
|
+
medium: "h-5 w-5",
|
|
32
|
+
large: "h-7 w-7",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* A switch component that toggles between on and off states.
|
|
38
|
+
* Built on top of Radix UI's Switch primitive.
|
|
39
|
+
*
|
|
40
|
+
* @param {SwitchProps} props - The props for the Switch component
|
|
41
|
+
* @param {ResponsiveValue<"small" | "medium" | "large">} [props.size="medium"] - The size of the switch
|
|
42
|
+
* @param {boolean} [props.disabled] - Whether the switch is disabled
|
|
43
|
+
* @param {string} [props.className] - Additional CSS classes to apply
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Basic usage
|
|
47
|
+
* <Switch />
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // With different sizes
|
|
51
|
+
* <Switch size="small" />
|
|
52
|
+
* <Switch size="medium" />
|
|
53
|
+
* <Switch size="large" />
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Disabled state
|
|
57
|
+
* <Switch disabled />
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // With onChange handler
|
|
61
|
+
* <Switch onCheckedChange={(checked) => console.log(checked)} />
|
|
62
|
+
*
|
|
63
|
+
* @param {ResponsiveValue<"small" | "medium" | "large">} [props.size="medium"] - The size of the switch
|
|
64
|
+
* @param {boolean} [props.disabled] - Whether the switch is disabled
|
|
65
|
+
* @param {string} [props.className] - Additional CSS classes to apply
|
|
66
|
+
*/
|
|
67
|
+
export const Switch = forwardRef(({ className, disabled: initialDisabled, size = "medium", error: initialError, ...props }, ref) => {
|
|
68
|
+
const { disabled, error } = useFormContext({
|
|
69
|
+
disabled: initialDisabled,
|
|
70
|
+
error: initialError,
|
|
71
|
+
});
|
|
72
|
+
return (_jsx(RadixSwitch.Root, { className: rootStyles({ disabled, size, error, className }), disabled: disabled, ...props, ref: ref, children: _jsx(RadixSwitch.Thumb, { className: thumbStyles({ disabled, size }) }) }));
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAqB,UAAU,EAAE,MA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AI,GAC/C,CACnB,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table
|
|
3
|
+
*/
|
|
4
|
+
declare const Table: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & import("react").RefAttributes<HTMLTableElement>>;
|
|
5
|
+
/**
|
|
6
|
+
* TableHeader
|
|
7
|
+
*/
|
|
8
|
+
declare const TableHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
9
|
+
/**
|
|
10
|
+
* TableBody
|
|
11
|
+
*/
|
|
12
|
+
declare const TableBody: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
13
|
+
/**
|
|
14
|
+
* TableFooter
|
|
15
|
+
*/
|
|
16
|
+
declare const TableFooter: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
17
|
+
/**
|
|
18
|
+
* TableRow
|
|
19
|
+
*/
|
|
20
|
+
declare const TableRow: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
21
|
+
/**
|
|
22
|
+
* TableHead
|
|
23
|
+
*/
|
|
24
|
+
declare const TableHead: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref"> & import("react").RefAttributes<HTMLTableHeaderCellElement>>;
|
|
25
|
+
/**
|
|
26
|
+
* TableCell
|
|
27
|
+
*/
|
|
28
|
+
declare const TableCell: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & import("react").RefAttributes<HTMLTableDataCellElement>>;
|
|
29
|
+
/**
|
|
30
|
+
* TableCaption
|
|
31
|
+
*/
|
|
32
|
+
declare const TableCaption: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
33
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@utilities/cn/cn";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Table
|
|
6
|
+
*/
|
|
7
|
+
const Table = forwardRef(({ className, ...props }, ref) => (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", { ref: ref, className: cn("w-full caption-bottom text-sm", className), ...props }) })));
|
|
8
|
+
Table.displayName = "Table";
|
|
9
|
+
/**
|
|
10
|
+
* TableHeader
|
|
11
|
+
*/
|
|
12
|
+
const TableHeader = forwardRef(({ className, ...props }, ref) => (_jsx("thead", { ref: ref, className: cn("[&_tr]:border-b [&_tr]:bg-gray-700! [&_tr]:text-white [&_tr]:hover:bg-gray-700! [&_tr]:hover:text-white!", className), ...props })));
|
|
13
|
+
TableHeader.displayName = "TableHeader";
|
|
14
|
+
/**
|
|
15
|
+
* TableBody
|
|
16
|
+
*/
|
|
17
|
+
const TableBody = forwardRef(({ className, ...props }, ref) => (_jsx("tbody", { ref: ref, className: cn("[&_tr:last-child]:border-0", className), ...props })));
|
|
18
|
+
TableBody.displayName = "TableBody";
|
|
19
|
+
/**
|
|
20
|
+
* TableFooter
|
|
21
|
+
*/
|
|
22
|
+
const TableFooter = forwardRef(({ className, ...props }, ref) => (_jsx("tfoot", { ref: ref, className: cn("border-t bg-gray-100 font-medium [&>tr]:bg-gray-100! [&>tr]:text-gray-700! [&>tr]:last:border-b-0", className), ...props })));
|
|
23
|
+
TableFooter.displayName = "TableFooter";
|
|
24
|
+
/**
|
|
25
|
+
* TableRow
|
|
26
|
+
*/
|
|
27
|
+
const TableRow = forwardRef(({ className, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn("border-b transition-colors hover:bg-gray-400 hover:text-white data-[state=selected]:bg-gray-500 data-[state=selected]:text-white", className), ...props })));
|
|
28
|
+
TableRow.displayName = "TableRow";
|
|
29
|
+
/**
|
|
30
|
+
* TableHead
|
|
31
|
+
*/
|
|
32
|
+
const TableHead = forwardRef(({ className, ...props }, ref) => (_jsx("th", { ref: ref, className: cn("h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props })));
|
|
33
|
+
TableHead.displayName = "TableHead";
|
|
34
|
+
/**
|
|
35
|
+
* TableCell
|
|
36
|
+
*/
|
|
37
|
+
const TableCell = forwardRef(({ className, ...props }, ref) => (_jsx("td", { ref: ref, className: cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props })));
|
|
38
|
+
TableCell.displayName = "TableCell";
|
|
39
|
+
/**
|
|
40
|
+
* TableCaption
|
|
41
|
+
*/
|
|
42
|
+
const TableCaption = forwardRef(({ className, ...props }, ref) => (_jsx("caption", { ref: ref, className: cn("mt-4 text-start text-gray-500 text-sm", className), ...props })));
|
|
43
|
+
TableCaption.displayName = "TableCaption";
|
|
44
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
45
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -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AW,GAAG,cAAc,CAAC;AAE1C,OAAO,EACN,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACZ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
2
|
+
declare const Tabs: import("react").ForwardRefExoticComponent<TabsPrimitive.TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const TabsList: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const TabsTrigger: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const TabsContent: import("react").ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@utilities/cn/cn";
|
|
3
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
4
|
+
import { forwardRef, } from "react";
|
|
5
|
+
const Tabs = TabsPrimitive.Root;
|
|
6
|
+
const TabsList = forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.List, { ref: ref, className: cn("inline-flex h-10 items-center justify-center gap-2 bg-gray-100 px-1 text-gray-700", className), ...props })));
|
|
7
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
8
|
+
const TabsTrigger = forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.Trigger, { ref: ref, className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-700 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:shadow-sm", className), ...props })));
|
|
9
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
10
|
+
const TabsContent = forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.Content, { ref: ref, className: cn("mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-700 focus-visible:ring-offset-2", className), ...props })));
|
|
11
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
12
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
13
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAGN,UAAU,GACV,MAAM,OAAO,CAAC;AAEf,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;AAEhC,MAAM,QAAQ,GAAG,UAAU,CAGzB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,KAAC,aAAa,CAAC,IAAI,IAClB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,mFAAmF,EACnF,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC,CAAC;AACH,QAAQ,CAAC,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;AAEtD,MAAM,WAAW,GAAG,UAAU,CAG5B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,KAAC,aAAa,CAAC,OAAO,IACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,yUAAyU,EACzU,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;AAE5D,MAAM,WAAW,GAAG,UAAU,CAG5B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACnC,KAAC,aAAa,CAAC,OAAO,IACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,8GAA8G,EAC9G,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ToasterProps } from "sonner";
|
|
2
|
+
export type ToastProps = {
|
|
3
|
+
id: string | number;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
button: {
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
} & ToasterProps;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a custom toast notification using the sonner toast library
|
|
13
|
+
* @param toast - The toast configuration object without an ID
|
|
14
|
+
* @param toast.title - The title text to display in the toast
|
|
15
|
+
* @param toast.description - The description text to display in the toast
|
|
16
|
+
* @param toast.button - Configuration for the toast's action button
|
|
17
|
+
* @param toast.button.label - The text label for the action button
|
|
18
|
+
* @param toast.button.onClick - Click handler function for the action button
|
|
19
|
+
* @returns A unique identifier for the created toast
|
|
20
|
+
*/
|
|
21
|
+
declare const toast: (toast: Omit<ToastProps, "id">) => string | number;
|
|
22
|
+
declare const Toaster: import("react").ForwardRefExoticComponent<ToasterProps & import("react").RefAttributes<HTMLElement>>;
|
|
23
|
+
/** A fully custom toast built on top of sonner. */
|
|
24
|
+
declare const Toast: import("react").ForwardRefExoticComponent<{
|
|
25
|
+
id: string | number;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
button: {
|
|
29
|
+
label: string;
|
|
30
|
+
onClick: () => void;
|
|
31
|
+
};
|
|
32
|
+
} & ToasterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export { toast, Toast, Toaster };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Toaster as SonnerToaster, toast as sonnerToast, } from "sonner";
|
|
4
|
+
import { Button } from "../button/button";
|
|
5
|
+
/**
|
|
6
|
+
* Creates a custom toast notification using the sonner toast library
|
|
7
|
+
* @param toast - The toast configuration object without an ID
|
|
8
|
+
* @param toast.title - The title text to display in the toast
|
|
9
|
+
* @param toast.description - The description text to display in the toast
|
|
10
|
+
* @param toast.button - Configuration for the toast's action button
|
|
11
|
+
* @param toast.button.label - The text label for the action button
|
|
12
|
+
* @param toast.button.onClick - Click handler function for the action button
|
|
13
|
+
* @returns A unique identifier for the created toast
|
|
14
|
+
*/
|
|
15
|
+
const toast = (toast) => {
|
|
16
|
+
const { title, description, button, ...toastOptions } = toast;
|
|
17
|
+
return sonnerToast.custom((id) => (_jsx(Toast, { id: id, title: title, description: description, button: {
|
|
18
|
+
label: toast.button.label,
|
|
19
|
+
onClick: toast.button.onClick,
|
|
20
|
+
}, ...toastOptions })));
|
|
21
|
+
};
|
|
22
|
+
const Toaster = SonnerToaster;
|
|
23
|
+
Toaster.displayName = "Toaster";
|
|
24
|
+
/** A fully custom toast built on top of sonner. */
|
|
25
|
+
const Toast = forwardRef(({ title, description, button, id }, ref) => {
|
|
26
|
+
return (_jsxs("div", { className: "flex w-full items-center gap-4 rounded-lg bg-white p-4 shadow-lg ring-1 ring-black/5 md:max-w-96", ref: ref, children: [_jsx("div", { className: "flex flex-1 items-center", children: _jsxs("div", { className: "w-full gap-1", children: [_jsx("p", { className: "font-medium text-gray-900 text-sm", children: title }), _jsx("p", { className: "text-gray-500 text-sm", children: description })] }) }), _jsx("div", { className: "shrink-0 rounded-md font-medium text-sm", children: _jsx(Button, { size: "small", type: "button", variant: "secondary", onClick: () => {
|
|
27
|
+
button.onClick();
|
|
28
|
+
sonnerToast.dismiss(id);
|
|
29
|
+
}, children: button.label }) })] }));
|
|
30
|
+
});
|
|
31
|
+
Toast.displayName = "Toast";
|
|
32
|
+
export { toast, Toast, Toaster };
|
|
33
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../src/components/toast/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EACN,OAAO,IAAI,aAAa,EAExB,KAAK,IAAI,WAAW,GACpB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAY1C;;;;;;;;;GASG;AACH,MAAM,KAAK,GAAG,CAAC,KAA6B,EAAE,EAAE;IAC/C,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IAC9D,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CACjC,KAAC,KAAK,IACL,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE;YACP,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;YACzB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;SAC7B,KACG,YAAY,GACf,CACF,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAC;AAE9B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAEhC,mDAAmD;AACnD,MAAM,KAAK,GAAG,UAAU,CACvB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3C,OAAO,CACN,eACC,SAAS,EAAC,kGAAkG,EAC5G,GAAG,EAAE,GAAG,aAER,cAAK,SAAS,EAAC,0BAA0B,YACxC,eAAK,SAAS,EAAC,cAAc,aAC5B,YAAG,SAAS,EAAC,mCAAmC,YAAE,KAAK,GAAK,EAC5D,YAAG,SAAS,EAAC,uBAAuB,YAAE,WAAW,GAAK,IACjD,GACD,EACN,cAAK,SAAS,EAAC,yCAAyC,YACvD,KAAC,MAAM,IACN,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE;wBACb,MAAM,CAAC,OAAO,EAAE,CAAC;wBACjB,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBACzB,CAAC,YAEA,MAAM,CAAC,KAAK,GACL,GACJ,IACD,CACN,CAAC;AACH,CAAC,CACD,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Tooltip as RadixTooltip } from "radix-ui";
|
|
2
|
+
/**
|
|
3
|
+
* Tooltip
|
|
4
|
+
*/
|
|
5
|
+
export type TooltipProps = React.ComponentProps<typeof RadixTooltip.Root> & {
|
|
6
|
+
showArrow?: boolean;
|
|
7
|
+
side?: RadixTooltip.TooltipContentProps["side"];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A tooltip component built on top of Radix UI's tooltip primitive.
|
|
11
|
+
*
|
|
12
|
+
* @param {TooltipProps} props - The props for the Tooltip component
|
|
13
|
+
* @param {boolean} [props.showArrow=true] - Whether to show the arrow pointing to the trigger
|
|
14
|
+
* @param {RadixTooltip.TooltipContentProps["side"]} [props.side] - The preferred side to show the tooltip
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Tooltip>
|
|
19
|
+
* <TooltipTrigger>Hover me</TooltipTrigger>
|
|
20
|
+
* <TooltipContent>Tooltip content</TooltipContent>
|
|
21
|
+
* </Tooltip>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const Tooltip: ({ children, showArrow, side, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* Tooltip Trigger
|
|
27
|
+
*/
|
|
28
|
+
declare const TooltipTrigger: import("react").ForwardRefExoticComponent<RadixTooltip.TooltipTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
/**
|
|
30
|
+
* Tooltip Content
|
|
31
|
+
*/
|
|
32
|
+
declare const TooltipContent: import("react").ForwardRefExoticComponent<Omit<RadixTooltip.TooltipContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
33
|
+
showArrow?: boolean;
|
|
34
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export { Tooltip, TooltipTrigger, TooltipContent };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@utilities/cn/cn";
|
|
3
|
+
import { Tooltip as RadixTooltip } from "radix-ui";
|
|
4
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
5
|
+
const TooltipContext = createContext(undefined);
|
|
6
|
+
const useTooltipContext = () => {
|
|
7
|
+
const context = useContext(TooltipContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error("Tooltip components must be used within a TooltipProvider");
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A tooltip component built on top of Radix UI's tooltip primitive.
|
|
15
|
+
*
|
|
16
|
+
* @param {TooltipProps} props - The props for the Tooltip component
|
|
17
|
+
* @param {boolean} [props.showArrow=true] - Whether to show the arrow pointing to the trigger
|
|
18
|
+
* @param {RadixTooltip.TooltipContentProps["side"]} [props.side] - The preferred side to show the tooltip
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <Tooltip>
|
|
23
|
+
* <TooltipTrigger>Hover me</TooltipTrigger>
|
|
24
|
+
* <TooltipContent>Tooltip content</TooltipContent>
|
|
25
|
+
* </Tooltip>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
const Tooltip = ({ children, showArrow = true, side, ...props }) => {
|
|
29
|
+
const contextValue = useMemo(() => ({
|
|
30
|
+
showArrow,
|
|
31
|
+
side,
|
|
32
|
+
}), [showArrow, side]);
|
|
33
|
+
return (_jsx(TooltipContext.Provider, { value: contextValue, children: _jsx(RadixTooltip.Provider, { children: _jsx(RadixTooltip.Root, { ...props, children: children }) }) }));
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Tooltip Trigger
|
|
37
|
+
*/
|
|
38
|
+
const TooltipTrigger = RadixTooltip.Trigger;
|
|
39
|
+
/**
|
|
40
|
+
* Tooltip Content
|
|
41
|
+
*/
|
|
42
|
+
const TooltipContent = forwardRef(({ className, sideOffset = 4, children, ...props }, ref) => {
|
|
43
|
+
const { showArrow, side } = useTooltipContext();
|
|
44
|
+
return (_jsxs(RadixTooltip.Content, { className: cn("relative z-50 w-fit max-w-72 rounded-md bg-gray-700 p-2 text-sm text-white shadow-md", className), sideOffset: sideOffset, side: side, ...props, ref: ref, children: [children, showArrow && _jsx(RadixTooltip.Arrow, { className: "fill-gray-700" })] }));
|
|
45
|
+
});
|
|
46
|
+
TooltipContent.displayName = RadixTooltip.Content.displayName;
|
|
47
|
+
export { Tooltip, TooltipTrigger, TooltipContent };
|
|
48
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAWvE,MAAM,cAAc,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC;AAEhF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAWF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,GAAG,CAAC,EAChB,QAAQ,EACR,SAAS,GAAG,IAAI,EAChB,IAAI,EACJ,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,YAAY,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC;QACN,SAAS;QACT,IAAI;KACJ,CAAC,EACF,CAAC,SAAS,EAAE,IAAI,CAAC,CACjB,CAAC;IACF,OAAO,CACN,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,KAAC,YAAY,CAAC,QAAQ,cACrB,KAAC,YAAY,CAAC,IAAI,OAAK,KAAK,YAAG,QAAQ,GAAqB,GACrC,GACC,CAC1B,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AAEH,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC;AAE5C;;GAEG;AAEH,MAAM,cAAc,GAAG,UAAU,CAK/B,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC5D,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAChD,OAAO,CACN,MAAC,YAAY,CAAC,OAAO,IACpB,SAAS,EAAE,EAAE,CACZ,sFAAsF,EACtF,SAAS,CACT,EACD,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,KACN,KAAK,EACT,GAAG,EAAE,GAAG,aAEP,QAAQ,EACR,SAAS,IAAI,KAAC,YAAY,CAAC,KAAK,IAAC,SAAS,EAAC,eAAe,GAAG,IACxC,CACvB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@components/accordion/accordion";
|
|
2
|
+
export type { AccordionContentProps, AccordionItemProps, AccordionProps, AccordionTriggerProps, } from "@components/accordion/accordion";
|
|
3
|
+
export { Button } from "@components/button/button";
|
|
4
|
+
export type { ButtonProps } from "@components/button/button";
|
|
5
|
+
export { Card, CardContent, CardFooter, CardHeader, } from "@components/card/card";
|
|
6
|
+
export type { CardContentProps, CardFooterProps, CardHeaderProps, CardProps, } from "@components/card/card";
|
|
7
|
+
export { Checkbox } from "@components/checkbox/checkbox";
|
|
8
|
+
export type { CheckboxProps } from "@components/checkbox/checkbox";
|
|
9
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@components/dialog/dialog";
|
|
10
|
+
export { getVariants } from "@utilities/get-variants/get-variants";
|
|
11
|
+
export type { ResponsiveValue } from "@utilities/responsive/responsive";
|
|
12
|
+
export { Label } from "@components/label/label";
|
|
13
|
+
export type { LabelProps } from "@components/label/label";
|
|
14
|
+
export { Input } from "@components/input/input";
|
|
15
|
+
export type { InputProps } from "@components/input/input";
|
|
16
|
+
export { Pagination, PaginationItem, PaginationNext, PaginationPrev, } from "@components/pagination/pagination";
|
|
17
|
+
export type { PaginationItemProps, PaginationProps, } from "@components/pagination/pagination";
|
|
18
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, } from "@components/popover/popover";
|
|
19
|
+
export type { PopoverContentProps, PopoverProps, } from "@components/popover/popover";
|
|
20
|
+
export { Progress } from "@components/progress/progress";
|
|
21
|
+
export type { ProgressProps } from "@components/progress/progress";
|
|
22
|
+
export { RadioGroup, RadioGroupItem, } from "@components/radio-group/radio-group";
|
|
23
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, } from "@components/select/select";
|
|
24
|
+
export { Skeleton } from "@components/skeleton/skeleton";
|
|
25
|
+
export { Slider } from "@components/slider/slider";
|
|
26
|
+
export type { SliderProps } from "@components/slider/slider";
|
|
27
|
+
export { Switch } from "@components/switch/switch";
|
|
28
|
+
export type { SwitchProps } from "@components/switch/switch";
|
|
29
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, } from "@components/tabs/tabs";
|
|
30
|
+
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableFooter, TableCaption, } from "@components/table/table";
|
|
31
|
+
export { Toast, Toaster, toast, } from "@components/toast/toast";
|
|
32
|
+
export type { ToastProps } from "@components/toast/toast";
|
|
33
|
+
export { Tooltip, TooltipContent, TooltipTrigger, } from "@components/tooltip/tooltip";
|
|
34
|
+
export type { TooltipProps } from "@components/tooltip/tooltip";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@components/accordion/accordion";
|
|
2
|
+
export { Button } from "@components/button/button";
|
|
3
|
+
export { Card, CardContent, CardFooter, CardHeader, } from "@components/card/card";
|
|
4
|
+
export { Checkbox } from "@components/checkbox/checkbox";
|
|
5
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@components/dialog/dialog";
|
|
6
|
+
export { getVariants } from "@utilities/get-variants/get-variants";
|
|
7
|
+
export { Label } from "@components/label/label";
|
|
8
|
+
export { Input } from "@components/input/input";
|
|
9
|
+
export { Pagination, PaginationItem, PaginationNext, PaginationPrev, } from "@components/pagination/pagination";
|
|
10
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, } from "@components/popover/popover";
|
|
11
|
+
export { Progress } from "@components/progress/progress";
|
|
12
|
+
export { RadioGroup, RadioGroupItem, } from "@components/radio-group/radio-group";
|
|
13
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, } from "@components/select/select";
|
|
14
|
+
export { Skeleton } from "@components/skeleton/skeleton";
|
|
15
|
+
export { Slider } from "@components/slider/slider";
|
|
16
|
+
export { Switch } from "@components/switch/switch";
|
|
17
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, } from "@components/tabs/tabs";
|
|
18
|
+
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableFooter, TableCaption, } from "@components/table/table";
|
|
19
|
+
export { Toast, Toaster, toast, } from "@components/toast/toast";
|
|
20
|
+
export { Tooltip, TooltipContent, TooltipTrigger, } from "@components/tooltip/tooltip";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,gBAAg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