@mbao01/common 0.2.1 → 0.2.3
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/types/components/Dock/Dock.d.ts +8 -0
- package/dist/types/components/Dock/constants.d.ts +12 -0
- package/dist/types/components/Dock/index.d.ts +1 -0
- package/dist/types/components/Dock/types.d.ts +12 -0
- package/dist/types/components/Form/Input/Input.d.ts +5 -2
- package/dist/types/components/Form/Input/constants.d.ts +4 -0
- package/dist/types/components/Form/Input/types.d.ts +9 -2
- package/dist/types/components/Form/Radio/Radio.d.ts +1 -1
- package/dist/types/components/Form/Radio/types.d.ts +1 -1
- package/dist/types/components/Form/Range/Range.d.ts +1 -1
- package/dist/types/components/Form/Range/types.d.ts +1 -1
- package/dist/types/components/Form/Select/Select.d.ts +3 -0
- package/dist/types/components/Form/Select/constants.d.ts +4 -0
- package/dist/types/components/Form/Select/types.d.ts +10 -2
- package/dist/types/components/Form/Switch/Switch.d.ts +1 -1
- package/dist/types/components/Form/Switch/types.d.ts +1 -1
- package/dist/types/components/Form/TextField/TextField.d.ts +5 -1
- package/dist/types/components/Form/TextField/types.d.ts +1 -0
- package/dist/types/components/Form/Textarea/Textarea.d.ts +2 -0
- package/dist/types/components/Form/Textarea/constants.d.ts +1 -0
- package/dist/types/components/Form/Textarea/types.d.ts +7 -1
- package/dist/types/components/Form/Validator/Validator.d.ts +6 -0
- package/dist/types/components/Form/Validator/constants.d.ts +4 -0
- package/dist/types/components/Form/Validator/index.d.ts +1 -0
- package/dist/types/components/Form/Validator/types.d.ts +14 -0
- package/dist/types/components/Form/components/Fieldset/types.d.ts +1 -1
- package/dist/types/components/Form/index.d.ts +1 -0
- package/dist/types/components/Indicator/Indicator.d.ts +6 -0
- package/dist/types/components/Indicator/constants.d.ts +15 -0
- package/dist/types/components/Indicator/index.d.ts +1 -0
- package/dist/types/components/Indicator/types.d.ts +14 -0
- package/dist/types/components/Join/Join.d.ts +6 -0
- package/dist/types/components/Join/constants.d.ts +2 -0
- package/dist/types/components/Join/index.d.ts +1 -0
- package/dist/types/components/Join/types.d.ts +13 -0
- package/dist/types/components/Kbd/Kbd.d.ts +2 -0
- package/dist/types/components/Kbd/constants.d.ts +5 -0
- package/dist/types/components/Kbd/index.d.ts +1 -0
- package/dist/types/components/Kbd/types.d.ts +3 -0
- package/dist/types/components/List/List.d.ts +7 -0
- package/dist/types/components/List/constants.d.ts +5 -0
- package/dist/types/components/List/index.d.ts +1 -0
- package/dist/types/components/List/types.d.ts +6 -0
- package/dist/types/components/Resizable/Resizable.d.ts +24 -0
- package/dist/types/components/Resizable/constants.d.ts +6 -0
- package/dist/types/components/Resizable/index.d.ts +1 -0
- package/dist/types/components/Resizable/types.d.ts +7 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts +5 -2
- package/dist/types/components/Stack/Stack.d.ts +2 -0
- package/dist/types/components/Stack/constants.d.ts +3 -0
- package/dist/types/components/Stack/index.d.ts +1 -0
- package/dist/types/components/Stack/types.d.ts +3 -0
- package/dist/types/components/Stat/Stat.d.ts +11 -0
- package/dist/types/components/Stat/constants.d.ts +11 -0
- package/dist/types/components/Stat/index.d.ts +1 -0
- package/dist/types/components/Stat/types.d.ts +10 -0
- package/dist/types/components/Status/Status.d.ts +2 -0
- package/dist/types/components/Status/constants.d.ts +5 -0
- package/dist/types/components/Status/index.d.ts +1 -0
- package/dist/types/components/Status/types.d.ts +3 -0
- package/dist/types/components/Text/types.d.ts +1 -1
- package/dist/types/index.d.ts +9 -0
- package/package.json +16 -14
- package/src/components/Dock/Dock.tsx +41 -0
- package/src/components/Dock/constants.ts +62 -0
- package/src/components/Dock/index.ts +1 -0
- package/src/components/Dock/types.ts +23 -0
- package/src/components/Form/Input/Input.tsx +71 -10
- package/src/components/Form/Input/constants.ts +17 -5
- package/src/components/Form/Input/types.ts +12 -4
- package/src/components/Form/Radio/types.ts +4 -1
- package/src/components/Form/Range/types.ts +4 -1
- package/src/components/Form/Select/Select.tsx +71 -10
- package/src/components/Form/Select/constants.ts +17 -0
- package/src/components/Form/Select/types.ts +11 -1
- package/src/components/Form/Switch/types.ts +4 -1
- package/src/components/Form/TextField/types.ts +1 -0
- package/src/components/Form/Textarea/Textarea.tsx +29 -3
- package/src/components/Form/Textarea/constants.ts +2 -0
- package/src/components/Form/Textarea/types.ts +9 -2
- package/src/components/Form/Validator/Validator.tsx +27 -0
- package/src/components/Form/Validator/constants.ts +18 -0
- package/src/components/Form/Validator/index.ts +1 -0
- package/src/components/Form/Validator/types.ts +30 -0
- package/src/components/Form/components/Fieldset/types.ts +1 -1
- package/src/components/Form/index.ts +1 -0
- package/src/components/Indicator/Indicator.tsx +46 -0
- package/src/components/Indicator/constants.ts +26 -0
- package/src/components/Indicator/index.ts +1 -0
- package/src/components/Indicator/types.ts +34 -0
- package/src/components/Join/Join.tsx +28 -0
- package/src/components/Join/constants.ts +5 -0
- package/src/components/Join/index.ts +1 -0
- package/src/components/Join/types.ts +29 -0
- package/src/components/Kbd/Kbd.tsx +7 -0
- package/src/components/Kbd/constants.ts +40 -0
- package/src/components/Kbd/index.ts +1 -0
- package/src/components/Kbd/types.ts +4 -0
- package/src/components/List/List.tsx +35 -0
- package/src/components/List/constants.ts +14 -0
- package/src/components/List/index.ts +1 -0
- package/src/components/List/types.ts +12 -0
- package/src/components/Resizable/Resizable.tsx +36 -0
- package/src/components/Resizable/constants.ts +22 -0
- package/src/components/Resizable/index.ts +1 -0
- package/src/components/Resizable/types.ts +13 -0
- package/src/components/Stack/Stack.tsx +11 -0
- package/src/components/Stack/constants.ts +12 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Stack/types.ts +5 -0
- package/src/components/Stat/Stat.tsx +55 -0
- package/src/components/Stat/constants.ts +33 -0
- package/src/components/Stat/index.ts +1 -0
- package/src/components/Stat/types.ts +31 -0
- package/src/components/Status/Status.tsx +7 -0
- package/src/components/Status/constants.ts +31 -0
- package/src/components/Status/index.ts +1 -0
- package/src/components/Status/types.ts +5 -0
- package/src/components/Text/types.ts +1 -1
- package/src/index.ts +9 -0
- package/src/stylesheets/tailwind.css +309 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { type VariantProps } from "../../../libs";
|
|
4
|
+
import { Text } from "../../Text";
|
|
5
|
+
import { getValidatorClasses, getValidatorHintClasses } from "./constants";
|
|
6
|
+
|
|
7
|
+
type FormElements = "input" | "select" | "textarea";
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
export type As<P = any> =
|
|
10
|
+
| FormElements
|
|
11
|
+
| React.ComponentType<P>
|
|
12
|
+
| React.ForwardRefExoticComponent<P>;
|
|
13
|
+
|
|
14
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, FormElements>;
|
|
15
|
+
|
|
16
|
+
export type ValidatorProps<T extends As> = (T extends FormElements
|
|
17
|
+
? AllowedElements[T]
|
|
18
|
+
: T extends React.ForwardRefExoticComponent<infer P>
|
|
19
|
+
? P
|
|
20
|
+
: T extends React.ComponentType<infer P>
|
|
21
|
+
? P
|
|
22
|
+
: never) &
|
|
23
|
+
VariantProps<typeof getValidatorClasses> & {
|
|
24
|
+
as: T;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type ValidatorHintProps = ComponentProps<typeof Text> &
|
|
30
|
+
VariantProps<typeof getValidatorHintClasses>;
|
|
@@ -10,7 +10,7 @@ type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
|
10
10
|
|
|
11
11
|
export type FieldsetLabelProps<T extends As> = (T extends "label"
|
|
12
12
|
? React.LabelHTMLAttributes<HTMLLabelElement>
|
|
13
|
-
:
|
|
13
|
+
: AllowedElements[T]) &
|
|
14
14
|
VariantProps<typeof getFieldsetLabelClasses> & {
|
|
15
15
|
as?: T;
|
|
16
16
|
};
|
|
@@ -12,5 +12,6 @@ export { Checkbox, CheckboxControlled } from "./Checkbox";
|
|
|
12
12
|
export { TagsInput } from "./TagsInput";
|
|
13
13
|
export { Textarea } from "./Textarea";
|
|
14
14
|
export { TextField } from "./TextField";
|
|
15
|
+
export { Validator } from "./Validator";
|
|
15
16
|
export { Label } from "./components/Label";
|
|
16
17
|
export { Fieldset } from "./components/Fieldset";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import type { As, IndicatorItemProps, IndicatorProps } from "./types";
|
|
3
|
+
import { cn } from "../../utilities";
|
|
4
|
+
import {
|
|
5
|
+
getIndicatorClasses,
|
|
6
|
+
getIndicatorItemClasses,
|
|
7
|
+
getIndicatorPositionClasses,
|
|
8
|
+
} from "./constants";
|
|
9
|
+
|
|
10
|
+
const Indicator = <T extends As>({
|
|
11
|
+
as,
|
|
12
|
+
position,
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}: IndicatorProps<T>) => {
|
|
17
|
+
const SlotChild = as;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Slot
|
|
21
|
+
className={cn(getIndicatorClasses(), getIndicatorPositionClasses({ position }), className)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<SlotChild>{children}</SlotChild>
|
|
25
|
+
</Slot>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const IndicatorItem = <T extends As>({
|
|
30
|
+
as,
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}: IndicatorItemProps<T>) => {
|
|
35
|
+
const SlotChild = as;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Slot className={cn(getIndicatorItemClasses(), className)} {...props}>
|
|
39
|
+
<SlotChild>{children}</SlotChild>
|
|
40
|
+
</Slot>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Indicator.Item = IndicatorItem;
|
|
45
|
+
|
|
46
|
+
export { Indicator };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getIndicatorClasses = cva("indicator");
|
|
5
|
+
|
|
6
|
+
export const getIndicatorItemClasses = cva("indicator-item");
|
|
7
|
+
|
|
8
|
+
const INDICATOR_POSITION_CLASS = {
|
|
9
|
+
center: cn("indicator-center"),
|
|
10
|
+
middle: cn("indicator-middle"),
|
|
11
|
+
start: cn("indicator-start"),
|
|
12
|
+
end: cn("indicator-end"),
|
|
13
|
+
top: cn("indicator-top"),
|
|
14
|
+
bottom: cn("indicator-bottom"),
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type IndicatorPosition = keyof typeof INDICATOR_POSITION_CLASS;
|
|
18
|
+
|
|
19
|
+
export const getIndicatorPositionClasses = ({
|
|
20
|
+
position = [],
|
|
21
|
+
}: {
|
|
22
|
+
position: IndicatorPosition | IndicatorPosition[];
|
|
23
|
+
}) => {
|
|
24
|
+
const positions = Array.isArray(position) ? position : [position];
|
|
25
|
+
return positions.map((p) => INDICATOR_POSITION_CLASS[p]).join(" ");
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Indicator } from "./Indicator";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import {
|
|
3
|
+
getIndicatorClasses,
|
|
4
|
+
getIndicatorItemClasses,
|
|
5
|
+
getIndicatorPositionClasses,
|
|
6
|
+
} from "./constants";
|
|
7
|
+
|
|
8
|
+
type FormElements = keyof React.JSX.IntrinsicElements;
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export type As<P = any> =
|
|
11
|
+
| FormElements
|
|
12
|
+
| React.ComponentType<P>
|
|
13
|
+
| React.ForwardRefExoticComponent<P>;
|
|
14
|
+
|
|
15
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, FormElements>;
|
|
16
|
+
|
|
17
|
+
type AsProps<T extends As> = T extends FormElements
|
|
18
|
+
? AllowedElements[T]
|
|
19
|
+
: T extends React.ForwardRefExoticComponent<infer P>
|
|
20
|
+
? P
|
|
21
|
+
: T extends React.ComponentType<infer P>
|
|
22
|
+
? P
|
|
23
|
+
: never;
|
|
24
|
+
|
|
25
|
+
export type IndicatorProps<T extends As> = AsProps<T> &
|
|
26
|
+
VariantProps<typeof getIndicatorClasses> & {
|
|
27
|
+
as: T;
|
|
28
|
+
position?: Parameters<typeof getIndicatorPositionClasses>[0]["position"];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type IndicatorItemProps<T extends As> = AsProps<T> &
|
|
32
|
+
VariantProps<typeof getIndicatorItemClasses> & {
|
|
33
|
+
as: T;
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import type { As, JoinItemProps, JoinProps } from "./types";
|
|
3
|
+
import { cn } from "../../utilities";
|
|
4
|
+
import { getJoinClasses, getJoinItemClasses } from "./constants";
|
|
5
|
+
|
|
6
|
+
const Join = <T extends As>({ as, className, children, ...props }: JoinProps<T>) => {
|
|
7
|
+
const SlotChild = as;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Slot className={cn(getJoinClasses(), className)} {...props}>
|
|
11
|
+
<SlotChild>{children}</SlotChild>
|
|
12
|
+
</Slot>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const JoinItem = <T extends As>({ as, className, children, ...props }: JoinItemProps<T>) => {
|
|
17
|
+
const SlotChild = as;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Slot className={cn(getJoinItemClasses(), className)} {...props}>
|
|
21
|
+
<SlotChild>{children}</SlotChild>
|
|
22
|
+
</Slot>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
Join.Item = JoinItem;
|
|
27
|
+
|
|
28
|
+
export { Join };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Join } from "./Join";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getJoinClasses, getJoinItemClasses } from "./constants";
|
|
3
|
+
|
|
4
|
+
type FormElements = keyof React.JSX.IntrinsicElements;
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
export type As<P = any> =
|
|
7
|
+
| FormElements
|
|
8
|
+
| React.ComponentType<P>
|
|
9
|
+
| React.ForwardRefExoticComponent<P>;
|
|
10
|
+
|
|
11
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, FormElements>;
|
|
12
|
+
|
|
13
|
+
type AsProps<T extends As> = T extends FormElements
|
|
14
|
+
? AllowedElements[T]
|
|
15
|
+
: T extends React.ForwardRefExoticComponent<infer P>
|
|
16
|
+
? P
|
|
17
|
+
: T extends React.ComponentType<infer P>
|
|
18
|
+
? P
|
|
19
|
+
: never;
|
|
20
|
+
|
|
21
|
+
export type JoinProps<T extends As> = AsProps<T> &
|
|
22
|
+
VariantProps<typeof getJoinClasses> & {
|
|
23
|
+
as: T;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type JoinItemProps<T extends As> = AsProps<T> &
|
|
27
|
+
VariantProps<typeof getJoinItemClasses> & {
|
|
28
|
+
as: T;
|
|
29
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { KbdProps } from "./types";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getKbdClasses } from "./constants";
|
|
4
|
+
|
|
5
|
+
export const Kbd = ({ outline, variant, size, className, ...props }: KbdProps) => (
|
|
6
|
+
<kbd className={cn(getKbdClasses({ outline, variant, size }), className)} {...props} />
|
|
7
|
+
);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getKbdClasses = cva("kbd", {
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
accent: "bg-accent text-accent-content border-accent",
|
|
7
|
+
default: "bg-default text-default-content border-default",
|
|
8
|
+
error: "bg-error text-error-content border-error",
|
|
9
|
+
ghost: "bg-ghost text-ghost-content border-transparent",
|
|
10
|
+
info: "bg-info text-info-content border-info",
|
|
11
|
+
neutral: "bg-neutral text-neutral-content border-neutral",
|
|
12
|
+
primary: "bg-primary text-primary-content border-primary",
|
|
13
|
+
secondary: "bg-secondary text-secondary-content border-secondary",
|
|
14
|
+
success: "bg-success text-success-content border-success",
|
|
15
|
+
warning: "bg-warning text-warning-content border-warning",
|
|
16
|
+
},
|
|
17
|
+
outline: {
|
|
18
|
+
true: "bg-default",
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
xs: "kbd-xs",
|
|
22
|
+
sm: "kbd-sm",
|
|
23
|
+
md: "kbd-md",
|
|
24
|
+
lg: "kbd-lg",
|
|
25
|
+
xl: "kbd-xl",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
compoundVariants: [
|
|
29
|
+
{ outline: true, variant: "accent", className: "text-accent" },
|
|
30
|
+
{ outline: true, variant: "default", className: "text-default" },
|
|
31
|
+
{ outline: true, variant: "error", className: "text-error" },
|
|
32
|
+
{ outline: true, variant: "ghost", className: "text-ghost" },
|
|
33
|
+
{ outline: true, variant: "info", className: "text-info" },
|
|
34
|
+
{ outline: true, variant: "neutral", className: "text-neutral" },
|
|
35
|
+
{ outline: true, variant: "primary", className: "text-primary" },
|
|
36
|
+
{ outline: true, variant: "secondary", className: "text-secondary" },
|
|
37
|
+
{ outline: true, variant: "success", className: "text-success" },
|
|
38
|
+
{ outline: true, variant: "warning", className: "text-warning" },
|
|
39
|
+
],
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Kbd } from "./Kbd";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import type { ListColumnProps, ListItemProps, ListProps } from "./types";
|
|
3
|
+
import { cn } from "../../utilities";
|
|
4
|
+
import { getListClasses, getListColumnClasses, getListItemClasses } from "./constants";
|
|
5
|
+
|
|
6
|
+
const List = ({ className, children, ...props }: ListProps) => (
|
|
7
|
+
<ul className={cn(getListClasses(), className)} {...props}>
|
|
8
|
+
{children}
|
|
9
|
+
</ul>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const ListItem = ({ className, children, ...props }: ListItemProps) => (
|
|
13
|
+
<li className={cn(getListItemClasses(), className)} {...props}>
|
|
14
|
+
{children}
|
|
15
|
+
</li>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const ListColumn = ({ flex, className, children, ...props }: ListColumnProps) => {
|
|
19
|
+
const SlotChild = ["string", "number", "boolean", "undefined"].includes(typeof children) ? (
|
|
20
|
+
<span>{children}</span>
|
|
21
|
+
) : (
|
|
22
|
+
children
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Slot className={cn(getListColumnClasses({ flex }), className)} {...props}>
|
|
27
|
+
{SlotChild}
|
|
28
|
+
</Slot>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
List.Item = ListItem;
|
|
33
|
+
List.Column = ListColumn;
|
|
34
|
+
|
|
35
|
+
export { List };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getListClasses = cva("list");
|
|
4
|
+
|
|
5
|
+
export const getListItemClasses = cva("list-row");
|
|
6
|
+
|
|
7
|
+
export const getListColumnClasses = cva("", {
|
|
8
|
+
variants: {
|
|
9
|
+
flex: {
|
|
10
|
+
grow: "list-col-grow",
|
|
11
|
+
wrap: "list-col-grow",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { List } from "./List";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type VariantProps } from "../../libs";
|
|
3
|
+
import { getListClasses, getListColumnClasses, getListItemClasses } from "./constants";
|
|
4
|
+
|
|
5
|
+
export type ListProps = React.HTMLAttributes<HTMLUListElement> &
|
|
6
|
+
VariantProps<typeof getListClasses>;
|
|
7
|
+
|
|
8
|
+
export type ListItemProps = React.HTMLAttributes<HTMLLIElement> &
|
|
9
|
+
VariantProps<typeof getListItemClasses>;
|
|
10
|
+
|
|
11
|
+
export type ListColumnProps = React.HTMLAttributes<HTMLLIElement> &
|
|
12
|
+
VariantProps<typeof getListColumnClasses>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as ResizablePrimitive from "react-resizable-panels";
|
|
4
|
+
import { GripVerticalIcon } from "lucide-react";
|
|
5
|
+
import type { ResizableHandleProps, ResizableProps } from "./types";
|
|
6
|
+
import { cn } from "../../utilities";
|
|
7
|
+
import {
|
|
8
|
+
getResizableClasses,
|
|
9
|
+
getResizableHandleClasses,
|
|
10
|
+
getResizableHandleIconClasses,
|
|
11
|
+
getResizableHandleIconWrapperClasses,
|
|
12
|
+
} from "./constants";
|
|
13
|
+
|
|
14
|
+
const Resizable = ({ className, ...props }: ResizableProps) => (
|
|
15
|
+
<ResizablePrimitive.PanelGroup className={cn(getResizableClasses(), className)} {...props} />
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const ResizablePanel = ResizablePrimitive.Panel;
|
|
19
|
+
|
|
20
|
+
const ResizableHandle = ({ withHandle, bordered, className, ...props }: ResizableHandleProps) => (
|
|
21
|
+
<ResizablePrimitive.PanelResizeHandle
|
|
22
|
+
className={cn(getResizableHandleClasses({ bordered }), className)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{withHandle && (
|
|
26
|
+
<div className={getResizableHandleIconWrapperClasses()}>
|
|
27
|
+
<GripVerticalIcon className={getResizableHandleIconClasses()} />
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
</ResizablePrimitive.PanelResizeHandle>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
Resizable.Panel = ResizablePanel;
|
|
34
|
+
Resizable.Handle = ResizableHandle;
|
|
35
|
+
|
|
36
|
+
export { Resizable };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getResizableClasses = cva(
|
|
4
|
+
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col"
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
export const getResizableHandleClasses = cva(
|
|
8
|
+
"relative flex w-px items-center justify-center border-primary after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
bordered: {
|
|
12
|
+
true: "border border-neutral-content",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const getResizableHandleIconWrapperClasses = cva(
|
|
19
|
+
"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-base-100"
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const getResizableHandleIconClasses = cva("h-2.5 w-2.5");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Resizable } from "./Resizable";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as ResizablePrimitive from "react-resizable-panels";
|
|
2
|
+
import { type VariantProps } from "../../libs";
|
|
3
|
+
import { getResizableClasses, getResizableHandleClasses } from "./constants";
|
|
4
|
+
|
|
5
|
+
export type ResizableProps = React.ComponentProps<typeof ResizablePrimitive.PanelGroup> &
|
|
6
|
+
VariantProps<typeof getResizableClasses>;
|
|
7
|
+
|
|
8
|
+
export type ResizableHandleProps = React.ComponentProps<
|
|
9
|
+
typeof ResizablePrimitive.PanelResizeHandle
|
|
10
|
+
> &
|
|
11
|
+
VariantProps<typeof getResizableHandleClasses> & {
|
|
12
|
+
withHandle?: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StackProps } from "./types";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getStackClasses } from "./constants";
|
|
4
|
+
|
|
5
|
+
export const Stack = ({ className, children, direction, ...props }: StackProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<div className={cn(getStackClasses({ direction }), className)} {...props}>
|
|
8
|
+
{children}
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stack } from "./Stack";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
StatActionsProps,
|
|
3
|
+
StatDescriptionProps,
|
|
4
|
+
StatFigureProps,
|
|
5
|
+
StatProps,
|
|
6
|
+
StatsProps,
|
|
7
|
+
StatTitleProps,
|
|
8
|
+
StatValueProps,
|
|
9
|
+
} from "./types";
|
|
10
|
+
import { cn } from "../../utilities";
|
|
11
|
+
import {
|
|
12
|
+
getStatActionsClasses,
|
|
13
|
+
getStatClasses,
|
|
14
|
+
getStatDescriptionClasses,
|
|
15
|
+
getStatFigureClasses,
|
|
16
|
+
getStatsClasses,
|
|
17
|
+
getStatTitleClasses,
|
|
18
|
+
getStatValueClasses,
|
|
19
|
+
} from "./constants";
|
|
20
|
+
|
|
21
|
+
const Stats = ({ direction, className, ...props }: StatsProps) => (
|
|
22
|
+
<div className={cn(getStatsClasses({ direction }), className)} {...props} />
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const Stat = ({ className, position, ...props }: StatProps) => (
|
|
26
|
+
<div className={cn(getStatClasses({ position }), className)} {...props} />
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const StatTitle = ({ className, ...props }: StatTitleProps) => (
|
|
30
|
+
<div className={cn(getStatTitleClasses(), className)} {...props} />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const StatValue = ({ className, ...props }: StatValueProps) => (
|
|
34
|
+
<div className={cn(getStatValueClasses(), className)} {...props} />
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const StatDescription = ({ className, ...props }: StatDescriptionProps) => (
|
|
38
|
+
<div className={cn(getStatDescriptionClasses(), className)} {...props} />
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const StatFigure = ({ className, ...props }: StatFigureProps) => (
|
|
42
|
+
<div className={cn(getStatFigureClasses(), className)} {...props} />
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const StatActions = ({ className, ...props }: StatActionsProps) => (
|
|
46
|
+
<div className={cn(getStatActionsClasses(), className)} {...props} />
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
Stat.Actions = StatActions;
|
|
50
|
+
Stat.Description = StatDescription;
|
|
51
|
+
Stat.Figure = StatFigure;
|
|
52
|
+
Stat.Title = StatTitle;
|
|
53
|
+
Stat.Value = StatValue;
|
|
54
|
+
|
|
55
|
+
export { Stats, Stat };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getStatsClasses = cva("stats", {
|
|
4
|
+
variants: {
|
|
5
|
+
direction: {
|
|
6
|
+
horizontal: "stats-horizontal",
|
|
7
|
+
vertical: "stats-vertical",
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
defaultVariants: {
|
|
11
|
+
direction: "horizontal",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const getStatClasses = cva("stat", {
|
|
16
|
+
variants: {
|
|
17
|
+
position: {
|
|
18
|
+
center: "place-items-center",
|
|
19
|
+
start: "place-items-start",
|
|
20
|
+
end: "place-items-end",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const getStatTitleClasses = cva("stat-title");
|
|
26
|
+
|
|
27
|
+
export const getStatValueClasses = cva("stat-value");
|
|
28
|
+
|
|
29
|
+
export const getStatDescriptionClasses = cva("stat-desc");
|
|
30
|
+
|
|
31
|
+
export const getStatFigureClasses = cva("stat-figure");
|
|
32
|
+
|
|
33
|
+
export const getStatActionsClasses = cva("stat-actions");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stat, Stats } from "./Stat";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type VariantProps } from "../../libs";
|
|
3
|
+
import {
|
|
4
|
+
getStatActionsClasses,
|
|
5
|
+
getStatClasses,
|
|
6
|
+
getStatDescriptionClasses,
|
|
7
|
+
getStatFigureClasses,
|
|
8
|
+
getStatsClasses,
|
|
9
|
+
getStatTitleClasses,
|
|
10
|
+
getStatValueClasses,
|
|
11
|
+
} from "./constants";
|
|
12
|
+
|
|
13
|
+
export type StatsProps = React.HTMLAttributes<HTMLDivElement> &
|
|
14
|
+
VariantProps<typeof getStatsClasses>;
|
|
15
|
+
|
|
16
|
+
export type StatProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatClasses>;
|
|
17
|
+
|
|
18
|
+
export type StatActionsProps = React.HTMLAttributes<HTMLDivElement> &
|
|
19
|
+
VariantProps<typeof getStatActionsClasses>;
|
|
20
|
+
|
|
21
|
+
export type StatDescriptionProps = React.HTMLAttributes<HTMLDivElement> &
|
|
22
|
+
VariantProps<typeof getStatDescriptionClasses>;
|
|
23
|
+
|
|
24
|
+
export type StatFigureProps = React.HTMLAttributes<HTMLDivElement> &
|
|
25
|
+
VariantProps<typeof getStatFigureClasses>;
|
|
26
|
+
|
|
27
|
+
export type StatTitleProps = React.HTMLAttributes<HTMLDivElement> &
|
|
28
|
+
VariantProps<typeof getStatTitleClasses>;
|
|
29
|
+
|
|
30
|
+
export type StatValueProps = React.HTMLAttributes<HTMLDivElement> &
|
|
31
|
+
VariantProps<typeof getStatValueClasses>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StatusProps } from "./types";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getStatusClasses } from "./constants";
|
|
4
|
+
|
|
5
|
+
export const Status = ({ animate, variant, size, className, ...props }: StatusProps) => (
|
|
6
|
+
<span className={cn(getStatusClasses({ animate, variant, size }), className)} {...props} />
|
|
7
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getStatusClasses = cva("status", {
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
accent: "status-accent",
|
|
7
|
+
default: "",
|
|
8
|
+
error: "status-error",
|
|
9
|
+
ghost: "",
|
|
10
|
+
info: "status-info",
|
|
11
|
+
neutral: "status-neutral",
|
|
12
|
+
primary: "status-primary",
|
|
13
|
+
secondary: "status-secondary",
|
|
14
|
+
success: "status-success",
|
|
15
|
+
warning: "status-warning",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
xs: "status-xs",
|
|
19
|
+
sm: "status-sm",
|
|
20
|
+
md: "status-md",
|
|
21
|
+
lg: "status-lg",
|
|
22
|
+
xl: "status-xl",
|
|
23
|
+
},
|
|
24
|
+
animate: {
|
|
25
|
+
bounce: "animate-bounce",
|
|
26
|
+
ping: "animate-ping",
|
|
27
|
+
pulse: "animate-pulse",
|
|
28
|
+
spin: "animate-spin",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Status } from "./Status";
|
|
@@ -5,7 +5,7 @@ export type As = "h1" | "h2" | "h3" | "h4" | "h5" | "p" | "span";
|
|
|
5
5
|
|
|
6
6
|
type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
7
7
|
|
|
8
|
-
export type TextProps<T extends As> =
|
|
8
|
+
export type TextProps<T extends As> = AllowedElements[T] &
|
|
9
9
|
VariantProps<typeof getTextClasses> & {
|
|
10
10
|
as?: As;
|
|
11
11
|
};
|