@firecms/ui 3.0.0-canary.3 → 3.0.0-canary.31
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/README.md +2 -2
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Card.d.ts +4 -2
- package/dist/components/CenteredView.d.ts +2 -1
- package/dist/components/Checkbox.d.ts +4 -4
- package/dist/components/Chip.d.ts +1 -1
- package/dist/components/DateTimeField.d.ts +2 -2
- package/dist/components/Dialog.d.ts +2 -1
- package/dist/components/Label.d.ts +4 -0
- package/dist/components/Markdown.d.ts +1 -0
- package/dist/components/Menu.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +27 -0
- package/dist/components/Tooltip.d.ts +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.es.js +7731 -7659
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.d.ts +6 -6
- package/package.json +25 -21
- package/src/components/Alert.tsx +2 -2
- package/src/components/BooleanSwitch.tsx +2 -2
- package/src/components/Button.tsx +9 -17
- package/src/components/Card.tsx +16 -10
- package/src/components/CenteredView.tsx +4 -2
- package/src/components/Checkbox.tsx +32 -23
- package/src/components/Chip.tsx +3 -3
- package/src/components/DateTimeField.tsx +4 -4
- package/src/components/Dialog.tsx +4 -1
- package/src/components/ExpandablePanel.tsx +3 -2
- package/src/components/IconButton.tsx +2 -2
- package/src/components/InputLabel.tsx +2 -1
- package/src/components/Label.tsx +18 -0
- package/src/components/Markdown.tsx +14 -3
- package/src/components/Menu.tsx +11 -5
- package/src/components/RadioGroup.tsx +72 -0
- package/src/components/Select.tsx +21 -21
- package/src/components/Table.tsx +1 -1
- package/src/components/Tabs.tsx +2 -2
- package/src/components/TextField.tsx +1 -1
- package/src/components/Tooltip.tsx +3 -0
- package/src/components/index.tsx +2 -0
- package/src/styles.ts +6 -6
- package/tailwind.config.js +72 -0
package/dist/styles.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
export declare const focusedMixin = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent";
|
2
2
|
export declare const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-slate-100 focus:dark:bg-gray-800 focus:dark:bg-opacity-60";
|
3
3
|
export declare const focusedClasses = "z-30 outline-none ring-2 ring-primary ring-opacity-75 ring-offset-2 ring-offset-transparent ";
|
4
|
-
export declare const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-
|
4
|
+
export declare const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-700 dark:bg-opacity-40 transition duration-150 ease-in-out";
|
5
5
|
export declare const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0 transition duration-150 ease-in-out";
|
6
|
-
export declare const fieldBackgroundDisabledMixin = "bg-opacity-80 dark:bg-opacity-90";
|
7
|
-
export declare const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-opacity-
|
8
|
-
export declare const defaultBorderMixin = "border-gray-100 dark:border-gray-
|
9
|
-
export declare const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-
|
10
|
-
export declare const cardMixin = "bg-white rounded-md dark:bg-gray-950 dark:border-gray-
|
6
|
+
export declare const fieldBackgroundDisabledMixin = "dark:bg-gray-800 bg-opacity-80 dark:bg-opacity-90";
|
7
|
+
export declare const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-opacity-60";
|
8
|
+
export declare const defaultBorderMixin = "border-gray-100 dark:border-gray-900 dark:border-opacity-60";
|
9
|
+
export declare const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-80 border-gray-100";
|
10
|
+
export declare const cardMixin = "bg-white rounded-md dark:bg-gray-950 border-gray-100 dark:border-gray-900 dark:border-opacity-60 transition duration-200 ease-in-out m-1 -p-1 border ";
|
11
11
|
export declare const cardClickableMixin = "hover:bg-primary-bg dark:hover:bg-primary-bg hover:bg-opacity-20 dark:hover:bg-opacity-20 hover:ring-2 hover:ring-primary cursor-pointer";
|
12
12
|
export declare const cardSelectedMixin = "bg-primary-bg dark:bg-primary-bg bg-opacity-30 dark:bg-opacity-10 ring-1 ring-primary ring-opacity-75";
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@firecms/ui",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.0-canary.
|
4
|
+
"version": "3.0.0-canary.31",
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
6
6
|
"funding": {
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
@@ -31,9 +31,10 @@
|
|
31
31
|
".": {
|
32
32
|
"import": "./dist/index.es.js",
|
33
33
|
"require": "./dist/index.umd.js",
|
34
|
-
"types": "./dist/
|
34
|
+
"types": "./dist/index.d.ts"
|
35
35
|
},
|
36
|
-
"./package.json": "./package.json"
|
36
|
+
"./package.json": "./package.json",
|
37
|
+
"./tailwind.config.js": "./tailwind.config.js"
|
37
38
|
},
|
38
39
|
"scripts": {
|
39
40
|
"watch": "vite build --watch",
|
@@ -51,19 +52,21 @@
|
|
51
52
|
"@radix-ui/react-collapsible": "^1.0.3",
|
52
53
|
"@radix-ui/react-dialog": "^1.0.5",
|
53
54
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
55
|
+
"@radix-ui/react-label": "^2.0.2",
|
54
56
|
"@radix-ui/react-popover": "^1.0.7",
|
55
57
|
"@radix-ui/react-portal": "^1.0.4",
|
58
|
+
"@radix-ui/react-radio-group": "^1.1.3",
|
56
59
|
"@radix-ui/react-scroll-area": "^1.0.5",
|
57
|
-
"@radix-ui/react-select": "^
|
60
|
+
"@radix-ui/react-select": "^2.0.0",
|
58
61
|
"@radix-ui/react-separator": "^1.0.3",
|
59
62
|
"@radix-ui/react-switch": "^1.0.3",
|
60
63
|
"@radix-ui/react-tabs": "^1.0.4",
|
61
64
|
"@radix-ui/react-tooltip": "^1.0.7",
|
62
65
|
"cmdk": "^0.2.1",
|
63
|
-
"react-datepicker": "^4.
|
66
|
+
"react-datepicker": "^6.4.0",
|
64
67
|
"react-dropzone": "^14.2.3",
|
65
68
|
"react-fast-compare": "^3.2.2",
|
66
|
-
"tailwind-merge": "^2.2.
|
69
|
+
"tailwind-merge": "^2.2.2"
|
67
70
|
},
|
68
71
|
"peerDependencies": {
|
69
72
|
"react": "^18.2.0",
|
@@ -77,40 +80,41 @@
|
|
77
80
|
},
|
78
81
|
"devDependencies": {
|
79
82
|
"@jest/globals": "^29.7.0",
|
80
|
-
"@testing-library/jest-dom": "^
|
83
|
+
"@testing-library/jest-dom": "^6.4.2",
|
81
84
|
"@testing-library/react": "^14.2.1",
|
82
85
|
"@testing-library/user-event": "^14.5.2",
|
83
86
|
"@types/jest": "^29.5.12",
|
84
|
-
"@types/node": "^20.11.
|
87
|
+
"@types/node": "^20.11.30",
|
85
88
|
"@types/object-hash": "^3.0.6",
|
86
|
-
"@types/react": "^18.2.
|
87
|
-
"@types/react-dom": "^18.2.
|
89
|
+
"@types/react": "^18.2.67",
|
90
|
+
"@types/react-dom": "^18.2.22",
|
88
91
|
"@types/react-measure": "^2.0.12",
|
89
|
-
"@typescript-eslint/eslint-plugin": "^
|
90
|
-
"@typescript-eslint/parser": "^
|
92
|
+
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
93
|
+
"@typescript-eslint/parser": "^7.3.1",
|
91
94
|
"@vitejs/plugin-react": "^4.2.1",
|
92
95
|
"cross-env": "^7.0.3",
|
93
|
-
"eslint": "^8.
|
96
|
+
"eslint": "^8.57.0",
|
94
97
|
"eslint-config-standard": "^17.1.0",
|
95
98
|
"eslint-plugin-import": "^2.29.1",
|
96
|
-
"eslint-plugin-n": "^
|
99
|
+
"eslint-plugin-n": "^16.6.2",
|
97
100
|
"eslint-plugin-promise": "^6.1.1",
|
98
|
-
"eslint-plugin-react": "^7.
|
101
|
+
"eslint-plugin-react": "^7.34.1",
|
99
102
|
"eslint-plugin-react-hooks": "^4.6.0",
|
100
|
-
"firebase": "^10.
|
103
|
+
"firebase": "^10.9.0",
|
101
104
|
"jest": "^29.7.0",
|
102
105
|
"npm-run-all": "^4.1.5",
|
103
106
|
"ts-jest": "^29.1.2",
|
104
107
|
"ts-node": "^10.9.2",
|
105
|
-
"tsd": "^0.30.
|
106
|
-
"typescript": "^5.
|
107
|
-
"vite": "^5.
|
108
|
+
"tsd": "^0.30.7",
|
109
|
+
"typescript": "^5.4.2",
|
110
|
+
"vite": "^5.2.3"
|
108
111
|
},
|
109
112
|
"files": [
|
110
113
|
"dist",
|
111
|
-
"src"
|
114
|
+
"src",
|
115
|
+
"tailwind.config.js"
|
112
116
|
],
|
113
|
-
"gitHead": "
|
117
|
+
"gitHead": "e0160839147a52060b659fcd778418de07883312",
|
114
118
|
"publishConfig": {
|
115
119
|
"access": "public"
|
116
120
|
}
|
package/src/components/Alert.tsx
CHANGED
@@ -29,12 +29,12 @@ const getColorClasses = (severity: string) => {
|
|
29
29
|
case "warning":
|
30
30
|
return "bg-amber-50 dark:bg-amber-800 dark:text-amber-100 text-amber-900";
|
31
31
|
case "info":
|
32
|
-
return "bg-blue-
|
32
|
+
return "bg-blue-100 dark:bg-blue-800 dark:text-blue-100 text-blue-900";
|
33
33
|
case "success":
|
34
34
|
return "bg-emerald-50 dark:bg-emerald-800 dark:text-emerald-100 text-emerald-900";
|
35
35
|
case "base":
|
36
36
|
default:
|
37
|
-
return "bg-slate-50 dark:bg-slate-800 dark:text-
|
37
|
+
return "bg-slate-50 dark:bg-slate-800 dark:text-white text-slate-900";
|
38
38
|
}
|
39
39
|
};
|
40
40
|
|
@@ -43,8 +43,8 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
43
43
|
size === "small" ? "w-[38px] h-[22px] min-w-[38px] min-h-[22px]" : "w-[42px] h-[26px] min-w-[42px] min-h-[26px]",
|
44
44
|
"outline-none rounded-full relative shadow-sm",
|
45
45
|
value ? (disabled
|
46
|
-
? "bg-white bg-opacity-54 dark:bg-slate-950 border-slate-100 dark:border-slate-700 ring-1 ring-slate-
|
47
|
-
: "ring-secondary ring-1 bg-secondary dark:bg-secondary") : "bg-white bg-opacity-54 dark:bg-slate-900 ring-1 ring-slate-
|
46
|
+
? "bg-white bg-opacity-54 dark:bg-slate-950 border-slate-100 dark:border-slate-700 ring-1 ring-slate-200 dark:ring-slate-700"
|
47
|
+
: "ring-secondary ring-1 bg-secondary dark:bg-secondary") : "bg-white bg-opacity-54 dark:bg-slate-900 ring-1 ring-slate-200 dark:ring-slate-700",
|
48
48
|
className
|
49
49
|
)}
|
50
50
|
{...props}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
|
3
|
-
import {focusedMixin} from "../styles";
|
4
|
-
import {cn} from "../util";
|
3
|
+
import { focusedMixin } from "../styles";
|
4
|
+
import { cn } from "../util";
|
5
5
|
|
6
6
|
export type ButtonProps<P extends React.ElementType> =
|
7
7
|
Omit<(P extends "button" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<P>), "onClick">
|
@@ -9,7 +9,7 @@ export type ButtonProps<P extends React.ElementType> =
|
|
9
9
|
variant?: "filled" | "outlined" | "text";
|
10
10
|
disabled?: boolean;
|
11
11
|
color?: "primary" | "secondary" | "text" | "error";
|
12
|
-
size?: "small" | "medium" | "large";
|
12
|
+
size?: "small" | "medium" | "large" | "xl" | "2xl";
|
13
13
|
startIcon?: React.ReactNode;
|
14
14
|
fullWidth?: boolean;
|
15
15
|
className?: string;
|
@@ -34,18 +34,6 @@ const ButtonInner = React.forwardRef<
|
|
34
34
|
const baseClasses =
|
35
35
|
"h-fit rounded-md uppercase inline-flex items-center justify-center p-2 px-4 text-sm font-medium focus:outline-none transition ease-in-out duration-150 gap-2";
|
36
36
|
|
37
|
-
// const buttonClasses = cn(
|
38
|
-
// {
|
39
|
-
// "w-full": fullWidth,
|
40
|
-
// "w-fit": !fullWidth,
|
41
|
-
// "border-transparent bg-primary hover:bg-primary-dark focus:ring-primary !text-white shadow hover:ring-1 hover:ring-primary": variant === "filled" && !disabled,
|
42
|
-
// "border-transparent !text-primary !hover:text-primary-dark hover:bg-primary hover:bg-primary-bg": variant === "text" && !disabled,
|
43
|
-
// "border-primary !text-primary hover:bg-primary-bg hover:border-primary-dark !hover:text-primary-dark focus:ring-primary hover:ring-1 hover:ring-primary": variant === "outlined" && !disabled,
|
44
|
-
// "border-primary-dark border-opacity-50 dark:border-primary dark:border-opacity-50 opacity-50 !text-primary-dark !dark:text-primary text-opacity-50 dark:text-opacity-50": variant === "outlined" && disabled,
|
45
|
-
// "border-transparent outline-none opacity-50 !text-slate-600 !dark:text-slate-500": (variant === "filled" || variant === "text") && disabled
|
46
|
-
// }
|
47
|
-
// );
|
48
|
-
|
49
37
|
const buttonClasses = cn({
|
50
38
|
"w-full": fullWidth,
|
51
39
|
"w-fit": !fullWidth,
|
@@ -65,14 +53,18 @@ const ButtonInner = React.forwardRef<
|
|
65
53
|
"border border-red-500 text-red-500 hover:bg-red-500": variant === "outlined" && color === "error" && !disabled,
|
66
54
|
"border border-slate-400 text-text-primary dark:text-text-primary-dark hover:bg-slate-200": variant === "outlined" && color === "text" && !disabled,
|
67
55
|
// Disabled states for all variants
|
68
|
-
"border border-transparent opacity-50": disabled
|
56
|
+
"border border-transparent opacity-50": variant === "text" && disabled,
|
57
|
+
"border border-gray-500 opacity-50": variant === "outlined" && disabled,
|
58
|
+
"border border-gray-500 bg-gray-500 opacity-50": variant === "filled" && disabled,
|
69
59
|
});
|
70
60
|
|
71
61
|
const sizeClasses = cn(
|
72
62
|
{
|
73
63
|
"py-1 px-2": size === "small",
|
74
64
|
"py-2 px-4": size === "medium",
|
75
|
-
"py-2.5 px-5": size === "large"
|
65
|
+
"py-2.5 px-5": size === "large",
|
66
|
+
"py-3 px-6": size === "xl",
|
67
|
+
"py-4 px-10": size === "2xl",
|
76
68
|
}
|
77
69
|
);
|
78
70
|
|
package/src/components/Card.tsx
CHANGED
@@ -2,18 +2,20 @@ import React, { useCallback } from "react";
|
|
2
2
|
import { cardClickableMixin, cardMixin, focusedMixin } from "../styles";
|
3
3
|
import { cn } from "../util";
|
4
4
|
|
5
|
-
|
6
|
-
children,
|
7
|
-
style,
|
8
|
-
onClick,
|
9
|
-
className
|
10
|
-
}: {
|
5
|
+
type CardProps = {
|
11
6
|
children: React.ReactNode;
|
12
7
|
style?: React.CSSProperties;
|
13
8
|
onClick?: () => void;
|
14
9
|
className?: string;
|
15
|
-
}
|
10
|
+
};
|
16
11
|
|
12
|
+
const Card = React.forwardRef<HTMLDivElement, CardProps>(({
|
13
|
+
children,
|
14
|
+
className,
|
15
|
+
onClick,
|
16
|
+
style,
|
17
|
+
...props
|
18
|
+
}, ref) => {
|
17
19
|
const onKeyPress = useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {
|
18
20
|
if (e.key === "Enter" || e.key === " ") {
|
19
21
|
onClick?.();
|
@@ -22,13 +24,17 @@ export function Card({
|
|
22
24
|
|
23
25
|
return (
|
24
26
|
<div
|
27
|
+
ref={ref}
|
25
28
|
onKeyPress={onKeyPress}
|
26
29
|
role={onClick ? "button" : undefined}
|
27
30
|
tabIndex={onClick ? 0 : undefined}
|
28
31
|
onClick={onClick}
|
29
32
|
className={cn(cardMixin, onClick && focusedMixin, onClick && cardClickableMixin, className)}
|
30
|
-
style={style}
|
33
|
+
style={style}
|
34
|
+
{...props}>
|
31
35
|
{children}
|
32
36
|
</div>
|
33
|
-
)
|
34
|
-
}
|
37
|
+
);
|
38
|
+
});
|
39
|
+
|
40
|
+
export { Card };
|
@@ -5,14 +5,16 @@ import { cn } from "../util";
|
|
5
5
|
export function CenteredView({
|
6
6
|
children,
|
7
7
|
maxWidth,
|
8
|
-
className
|
8
|
+
className,
|
9
|
+
fullScreen
|
9
10
|
}: {
|
10
11
|
children: React.ReactNode;
|
11
12
|
maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
|
12
13
|
className?: string;
|
14
|
+
fullScreen?: boolean;
|
13
15
|
}) {
|
14
16
|
|
15
|
-
return <div className={"flex flex-col flex-grow h-full"}>
|
17
|
+
return <div className={cn("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full")}>
|
16
18
|
<Container className={cn("m-auto", className)}
|
17
19
|
maxWidth={maxWidth}>
|
18
20
|
{children}
|
@@ -4,25 +4,34 @@ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
4
4
|
import { Icon } from "../icons";
|
5
5
|
import { cn } from "../util";
|
6
6
|
|
7
|
-
interface CheckboxProps {
|
7
|
+
export interface CheckboxProps {
|
8
8
|
checked: boolean;
|
9
9
|
disabled?: boolean;
|
10
10
|
indeterminate?: boolean;
|
11
11
|
onCheckedChange?: (checked: boolean) => void;
|
12
|
-
|
12
|
+
padding?: boolean;
|
13
|
+
size?: "tiny" | "small" | "medium" | "large";
|
13
14
|
color?: "primary" | "secondary";
|
14
15
|
}
|
15
16
|
|
16
17
|
const sizeClasses = {
|
17
18
|
large: "w-6 h-6 rounded flex items-center justify-center",
|
18
19
|
medium: "w-5 h-5 rounded flex items-center justify-center",
|
19
|
-
small: "w-4 h-4 rounded flex items-center justify-center"
|
20
|
+
small: "w-4 h-4 rounded flex items-center justify-center",
|
21
|
+
tiny: "w-4 h-4 rounded flex items-center justify-center"
|
20
22
|
};
|
21
23
|
|
22
24
|
const outerSizeClasses = {
|
23
25
|
medium: "w-10 h-10",
|
24
26
|
small: "w-8 h-8",
|
25
|
-
large: "w-12 h-12"
|
27
|
+
large: "w-12 h-12 ",
|
28
|
+
tiny: "w-6 h-6"
|
29
|
+
}
|
30
|
+
const paddingClasses = {
|
31
|
+
medium: "p-2",
|
32
|
+
small: "p-2",
|
33
|
+
large: "p-2",
|
34
|
+
tiny: ""
|
26
35
|
}
|
27
36
|
|
28
37
|
const colorClasses = {
|
@@ -33,6 +42,7 @@ const colorClasses = {
|
|
33
42
|
export const Checkbox = ({
|
34
43
|
checked,
|
35
44
|
indeterminate = false,
|
45
|
+
padding = true,
|
36
46
|
disabled,
|
37
47
|
size = "medium",
|
38
48
|
onCheckedChange,
|
@@ -45,19 +55,23 @@ export const Checkbox = ({
|
|
45
55
|
? 20
|
46
56
|
: size === "small"
|
47
57
|
? 16
|
48
|
-
:
|
58
|
+
: size === "tiny"
|
59
|
+
? 14
|
60
|
+
: 24;
|
49
61
|
return (
|
50
|
-
<
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
onCheckedChange ?
|
55
|
-
|
56
|
-
<
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
onCheckedChange
|
62
|
+
<CheckboxPrimitive.Root
|
63
|
+
asChild
|
64
|
+
checked={indeterminate || isChecked}
|
65
|
+
disabled={disabled}
|
66
|
+
onCheckedChange={disabled ? undefined : onCheckedChange}>
|
67
|
+
|
68
|
+
<div className={cn(
|
69
|
+
padding ? paddingClasses[size] : "",
|
70
|
+
outerSizeClasses[size],
|
71
|
+
"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
|
72
|
+
onCheckedChange ? "rounded-full hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-slate-700 dark:hover:bg-opacity-75" : "",
|
73
|
+
onCheckedChange ? "cursor-pointer" : "cursor-default"
|
74
|
+
)}>
|
61
75
|
<div
|
62
76
|
className={cn(
|
63
77
|
"border-2 relative transition-colors ease-in-out duration-150",
|
@@ -80,12 +94,7 @@ export const Checkbox = ({
|
|
80
94
|
)}
|
81
95
|
</CheckboxPrimitive.Indicator>
|
82
96
|
</div>
|
83
|
-
</
|
84
|
-
|
85
|
-
{/* <div >*/}
|
86
|
-
{/* YO*/}
|
87
|
-
{/* </div>*/}
|
88
|
-
{/*)}*/}
|
89
|
-
</div>
|
97
|
+
</div>
|
98
|
+
</CheckboxPrimitive.Root>
|
90
99
|
);
|
91
100
|
};
|
package/src/components/Chip.tsx
CHANGED
@@ -11,7 +11,7 @@ export type ChipColorKey = keyof typeof CHIP_COLORS;
|
|
11
11
|
export interface ChipProps {
|
12
12
|
className?: string;
|
13
13
|
children: React.ReactNode;
|
14
|
-
size?: "
|
14
|
+
size?: "tiny" | "small" | "medium";
|
15
15
|
colorScheme?: ChipColorScheme | ChipColorKey;
|
16
16
|
error?: boolean;
|
17
17
|
outlined?: boolean;
|
@@ -20,7 +20,7 @@ export interface ChipProps {
|
|
20
20
|
}
|
21
21
|
|
22
22
|
const sizeClassNames = {
|
23
|
-
|
23
|
+
tiny: "px-2 py-0.5 text-sm",
|
24
24
|
small: "px-3 py-1 text-sm",
|
25
25
|
medium: "px-4 py-1.5 text-sm"
|
26
26
|
}
|
@@ -46,7 +46,7 @@ export function Chip({
|
|
46
46
|
"text-ellipsis",
|
47
47
|
onClick ? "cursor-pointer hover:bg-slate-300 hover:dark:bg-slate-700" : "",
|
48
48
|
sizeClassNames[size],
|
49
|
-
error || !usedColorScheme ? "bg-slate-200 dark:bg-slate-800 text-slate-800 dark:text-
|
49
|
+
error || !usedColorScheme ? "bg-slate-200 dark:bg-slate-800 text-slate-800 dark:text-white" : "",
|
50
50
|
error ? "text-red-500 dark:text-red-400" : "",
|
51
51
|
className)}
|
52
52
|
onClick={onClick}
|
@@ -17,12 +17,12 @@ import { Typography } from "./Typography";
|
|
17
17
|
|
18
18
|
interface DateTimeFieldProps {
|
19
19
|
value?: Date;
|
20
|
-
onChange: (date: Date |
|
20
|
+
onChange: (date: Date | undefined) => void;
|
21
21
|
mode?: "date" | "date_time";
|
22
22
|
disabled?: boolean;
|
23
23
|
clearable?: boolean;
|
24
24
|
error?: boolean;
|
25
|
-
size
|
25
|
+
size?: "small" | "medium";
|
26
26
|
label?: React.ReactNode;
|
27
27
|
className?: string;
|
28
28
|
style?: React.CSSProperties;
|
@@ -40,7 +40,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
40
40
|
clearable,
|
41
41
|
mode = "date",
|
42
42
|
error,
|
43
|
-
size,
|
43
|
+
size = "medium",
|
44
44
|
className,
|
45
45
|
style,
|
46
46
|
inputClassName,
|
@@ -60,7 +60,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
60
60
|
|
61
61
|
const handleClear = (e: React.MouseEvent) => {
|
62
62
|
e.preventDefault();
|
63
|
-
onChange(
|
63
|
+
onChange(undefined);
|
64
64
|
}
|
65
65
|
|
66
66
|
return (
|
@@ -14,6 +14,7 @@ export type DialogProps = {
|
|
14
14
|
scrollable?: boolean;
|
15
15
|
maxWidth?: keyof typeof widthClasses;
|
16
16
|
modal?: boolean;
|
17
|
+
onOpenAutoFocus?: (e: Event) => void;
|
17
18
|
};
|
18
19
|
|
19
20
|
const widthClasses = {
|
@@ -41,7 +42,8 @@ export const Dialog = ({
|
|
41
42
|
fullScreen,
|
42
43
|
scrollable = true,
|
43
44
|
maxWidth = "lg",
|
44
|
-
modal = true
|
45
|
+
modal = true,
|
46
|
+
onOpenAutoFocus
|
45
47
|
}: DialogProps) => {
|
46
48
|
const [displayed, setDisplayed] = useState(false);
|
47
49
|
|
@@ -77,6 +79,7 @@ export const Dialog = ({
|
|
77
79
|
/>
|
78
80
|
|
79
81
|
<DialogPrimitive.Content
|
82
|
+
onOpenAutoFocus={onOpenAutoFocus}
|
80
83
|
className={cn("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out")}
|
81
84
|
>
|
82
85
|
<div
|
@@ -77,7 +77,8 @@ export function ExpandablePanel({
|
|
77
77
|
<Collapsible.Root
|
78
78
|
className={cn(
|
79
79
|
!invisible && defaultBorderMixin + " border",
|
80
|
-
"rounded-md"
|
80
|
+
"rounded-md",
|
81
|
+
"w-full"
|
81
82
|
)}
|
82
83
|
open={open}
|
83
84
|
onOpenChange={(updatedOpen: boolean) => {
|
@@ -88,7 +89,7 @@ export function ExpandablePanel({
|
|
88
89
|
<Collapsible.Trigger
|
89
90
|
className={cn(focusedMixin,
|
90
91
|
"rounded flex items-center justify-between w-full min-h-[52px]",
|
91
|
-
"hover:bg-
|
92
|
+
"hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-10",
|
92
93
|
invisible ? "border-b px-2" : "p-4",
|
93
94
|
invisible && defaultBorderMixin,
|
94
95
|
asField && fieldBackgroundMixin,
|
@@ -18,7 +18,7 @@ const buttonClasses =
|
|
18
18
|
"hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-gray-700 dark:hover:bg-opacity-50";
|
19
19
|
const baseClasses =
|
20
20
|
"inline-flex items-center justify-center p-2 text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150";
|
21
|
-
const colorClasses = "text-slate-600 visited:text-slate-600 dark:text-slate-300 dark:visited:text-
|
21
|
+
const colorClasses = "text-slate-600 visited:text-slate-600 dark:text-slate-300 dark:visited:text-gray-300";
|
22
22
|
const sizeClasses = {
|
23
23
|
medium: "w-10 !h-10 min-w-10 min-h-10",
|
24
24
|
small: "w-8 !h-8 min-w-8 min-h-8",
|
@@ -42,7 +42,7 @@ const IconButtonInner = <C extends React.ElementType = "button">({
|
|
42
42
|
...props
|
43
43
|
}: IconButtonProps<C>, ref: React.ForwardedRef<HTMLButtonElement>) => {
|
44
44
|
|
45
|
-
const bgClasses = variant === "ghost" ? "bg-transparent" : "bg-slate-50 dark:bg-gray-950 dark:bg-opacity-50";
|
45
|
+
const bgClasses = variant === "ghost" ? "bg-transparent" : "bg-slate-200 bg-opacity-50 dark:bg-gray-950 dark:bg-opacity-50";
|
46
46
|
const Component: React.ElementType<any> = component || "button";
|
47
47
|
return (
|
48
48
|
<Component
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import * as React from "react";
|
2
2
|
import { cn } from "../util";
|
3
|
+
import { Label } from "./Label";
|
3
4
|
|
4
5
|
export type InputLabelProps = {
|
5
6
|
children?: React.ReactNode;
|
@@ -27,7 +28,7 @@ export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(fu
|
|
27
28
|
}, className);
|
28
29
|
|
29
30
|
return (
|
30
|
-
<
|
31
|
+
<Label
|
31
32
|
data-shrink={shrink}
|
32
33
|
ref={ref}
|
33
34
|
className={computedClassName}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
3
|
+
import { cn } from "../util";
|
4
|
+
import { defaultBorderMixin } from "../styles";
|
5
|
+
|
6
|
+
const Label = React.forwardRef<
|
7
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
8
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
9
|
+
>(({ className, ...props }, ref) => (
|
10
|
+
<LabelPrimitive.Root
|
11
|
+
ref={ref}
|
12
|
+
className={cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", defaultBorderMixin, className)}
|
13
|
+
{...props}
|
14
|
+
/>
|
15
|
+
))
|
16
|
+
Label.displayName = LabelPrimitive.Root.displayName
|
17
|
+
|
18
|
+
export { Label }
|
@@ -3,26 +3,37 @@ import equal from "react-fast-compare"
|
|
3
3
|
|
4
4
|
// @ts-ignore
|
5
5
|
import MarkdownIt from "markdown-it";
|
6
|
+
import { cn } from "../util";
|
6
7
|
|
7
8
|
export interface MarkdownProps {
|
8
9
|
source: string,
|
10
|
+
size?: "small" | "medium" | "large" | "xl" | "2xl";
|
9
11
|
className?: string
|
10
12
|
}
|
11
13
|
|
12
|
-
const
|
14
|
+
const proseClasses = {
|
15
|
+
small: "prose-sm",
|
16
|
+
medium: "prose",
|
17
|
+
large: "prose-lg",
|
18
|
+
xl: "prose-xl",
|
19
|
+
"2xl": "prose-2xl"
|
20
|
+
};
|
21
|
+
|
22
|
+
const md = new MarkdownIt({ html: true });
|
13
23
|
/**
|
14
24
|
* @group Preview components
|
15
25
|
*/
|
16
26
|
export const Markdown = React.memo<MarkdownProps>(function Markdown({
|
17
27
|
source,
|
18
|
-
className
|
28
|
+
className,
|
29
|
+
size = "medium"
|
19
30
|
}: MarkdownProps) {
|
20
31
|
const html = useMemo(() => {
|
21
32
|
return md.render(typeof source === "string" ? source : "");
|
22
33
|
}, [source]);
|
23
34
|
|
24
35
|
return <div
|
25
|
-
className={className}
|
36
|
+
className={cn(proseClasses[size], "dark:prose-invert prose-headings:font-title", className)}
|
26
37
|
dangerouslySetInnerHTML={{ __html: html }}
|
27
38
|
/>;
|
28
39
|
}
|
package/src/components/Menu.tsx
CHANGED
@@ -43,18 +43,24 @@ export type MenuItemProps = {
|
|
43
43
|
children: React.ReactNode;
|
44
44
|
dense?: boolean;
|
45
45
|
onClick?: (event: React.MouseEvent) => void;
|
46
|
-
}
|
46
|
+
};
|
47
47
|
|
48
48
|
export function MenuItem({
|
49
49
|
children,
|
50
|
-
dense,
|
50
|
+
dense = false, // Default value is false if not provided
|
51
51
|
onClick
|
52
52
|
}: MenuItemProps) {
|
53
|
+
// Dynamically adjusting the class based on the "dense" prop
|
54
|
+
const classNames = cn(
|
55
|
+
focusedMixin,
|
56
|
+
onClick && "cursor-pointer",
|
57
|
+
"rounded-md text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center gap-4",
|
58
|
+
dense ? "px-3 py-1.5" : "px-4 py-2"
|
59
|
+
);
|
60
|
+
|
53
61
|
return (
|
54
62
|
<DropdownMenu.Item
|
55
|
-
className={
|
56
|
-
onClick && "cursor-pointer",
|
57
|
-
"rounded-md px-4 py-2 text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center gap-4")}
|
63
|
+
className={classNames}
|
58
64
|
onClick={onClick}>
|
59
65
|
{children}
|
60
66
|
</DropdownMenu.Item>
|