@firecms/ui 3.0.0-canary.2 → 3.0.0-canary.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Button.d.ts +1 -1
  3. package/dist/components/Card.d.ts +4 -2
  4. package/dist/components/CenteredView.d.ts +2 -1
  5. package/dist/components/Checkbox.d.ts +4 -4
  6. package/dist/components/Chip.d.ts +1 -1
  7. package/dist/components/Dialog.d.ts +2 -1
  8. package/dist/components/Label.d.ts +4 -0
  9. package/dist/components/Markdown.d.ts +1 -0
  10. package/dist/components/RadioGroup.d.ts +5 -0
  11. package/dist/components/Tooltip.d.ts +2 -1
  12. package/dist/components/index.d.ts +2 -0
  13. package/dist/index.es.js +7711 -7649
  14. package/dist/index.es.js.map +1 -1
  15. package/dist/index.umd.js +10 -10
  16. package/dist/index.umd.js.map +1 -1
  17. package/package.json +25 -21
  18. package/src/components/Alert.tsx +2 -2
  19. package/src/components/BooleanSwitch.tsx +2 -2
  20. package/src/components/Button.tsx +9 -17
  21. package/src/components/Card.tsx +16 -10
  22. package/src/components/CenteredView.tsx +4 -2
  23. package/src/components/Checkbox.tsx +32 -23
  24. package/src/components/Chip.tsx +3 -3
  25. package/src/components/Dialog.tsx +4 -1
  26. package/src/components/ExpandablePanel.tsx +1 -1
  27. package/src/components/IconButton.tsx +1 -1
  28. package/src/components/Label.tsx +18 -0
  29. package/src/components/Markdown.tsx +14 -3
  30. package/src/components/RadioGroup.tsx +41 -0
  31. package/src/components/Select.tsx +21 -21
  32. package/src/components/Table.tsx +1 -1
  33. package/src/components/Tabs.tsx +2 -2
  34. package/src/components/TextField.tsx +1 -1
  35. package/src/components/Tooltip.tsx +3 -0
  36. package/src/components/index.tsx +2 -0
  37. package/tailwind.config.js +71 -0
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.2",
4
+ "version": "3.0.0-canary.21",
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/src/index.d.ts"
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": "^1.2.2",
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.25.0",
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.1"
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": "^5.17.0",
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.16",
87
+ "@types/node": "^20.11.30",
85
88
  "@types/object-hash": "^3.0.6",
86
- "@types/react": "^18.2.54",
87
- "@types/react-dom": "^18.2.18",
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": "^5.62.0",
90
- "@typescript-eslint/parser": "^5.62.0",
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.56.0",
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": "^15.7.0",
99
+ "eslint-plugin-n": "^16.6.2",
97
100
  "eslint-plugin-promise": "^6.1.1",
98
- "eslint-plugin-react": "^7.33.2",
101
+ "eslint-plugin-react": "^7.34.1",
99
102
  "eslint-plugin-react-hooks": "^4.6.0",
100
- "firebase": "^10.8.0",
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.4",
106
- "typescript": "^5.3.3",
107
- "vite": "^5.1.1"
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": "24234382207c741094a561eb4b94a416f00e6b74",
117
+ "gitHead": "e451246cf15bdd8d934b5e2a70d86f606f6292f5",
114
118
  "publishConfig": {
115
119
  "access": "public"
116
120
  }
@@ -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-50 dark:bg-blue-800 dark:text-blue-100 text-blue-900";
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-slate-100 text-slate-900";
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-100 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-100 dark:ring-slate-700",
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
 
@@ -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
- export function Card({
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
- size?: "small" | "medium" | "large";
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
- : 24;
58
+ : size === "tiny"
59
+ ? 14
60
+ : 24;
49
61
  return (
50
- <div className={cn(
51
- outerSizeClasses[size],
52
- "inline-flex items-center justify-center p-2 text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
53
- onCheckedChange ? "rounded-full hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-slate-700 dark:hover:bg-opacity-75" : "",
54
- onCheckedChange ? "cursor-pointer" : "cursor-default"
55
- )}>
56
- <CheckboxPrimitive.Root
57
- asChild
58
- checked={indeterminate || isChecked}
59
- disabled={disabled}
60
- onCheckedChange={disabled ? undefined : 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
- </CheckboxPrimitive.Root>
84
- {/*{indeterminate && (*/}
85
- {/* <div >*/}
86
- {/* YO*/}
87
- {/* </div>*/}
88
- {/*)}*/}
89
- </div>
97
+ </div>
98
+ </CheckboxPrimitive.Root>
90
99
  );
91
100
  };
@@ -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?: "smaller" | "small" | "medium";
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
- smaller: "px-2 py-0.5 text-sm",
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-slate-200" : "",
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}
@@ -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
@@ -88,7 +88,7 @@ export function ExpandablePanel({
88
88
  <Collapsible.Trigger
89
89
  className={cn(focusedMixin,
90
90
  "rounded flex items-center justify-between w-full min-h-[52px]",
91
- "hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:bg-opacity-10",
91
+ "hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-10",
92
92
  invisible ? "border-b px-2" : "p-4",
93
93
  invisible && defaultBorderMixin,
94
94
  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-slate-300";
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",
@@ -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 md = new MarkdownIt({ html: true, });
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
  }
@@ -0,0 +1,41 @@
1
+ import * as React from "react"
2
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3
+ import { cn } from "../util";
4
+ import { CircleIcon } from "../icons";
5
+
6
+ const RadioGroup = React.forwardRef<
7
+ React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
+ >(({ className, ...props }, ref) => {
10
+ return (
11
+ <RadioGroupPrimitive.Root
12
+ className={cn("grid gap-2", className)}
13
+ {...props}
14
+ ref={ref}
15
+ />
16
+ )
17
+ })
18
+ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
19
+
20
+ const RadioGroupItem = React.forwardRef<
21
+ React.ElementRef<typeof RadioGroupPrimitive.Item>,
22
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
23
+ >(({ className, ...props }, ref) => {
24
+ return (
25
+ <RadioGroupPrimitive.Item
26
+ ref={ref}
27
+ className={cn(
28
+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
34
+ <div className="h-2.5 w-2.5 fill-current text-current bg-primary rounded-lg" />
35
+ </RadioGroupPrimitive.Indicator>
36
+ </RadioGroupPrimitive.Item>
37
+ )
38
+ })
39
+ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
40
+
41
+ export { RadioGroup, RadioGroupItem }
@@ -127,38 +127,38 @@ export function Select({
127
127
  "w-full h-full",
128
128
  size === "small" ? "h-[42px]" : "h-[64px]",
129
129
  padding ? "px-4 " : "",
130
- "outlin e-none focus:outline-none",
130
+ "outline-none focus:outline-none",
131
131
  "select-none rounded-md text-sm",
132
132
  error ? "text-red-500 dark:text-red-600" : "focus:text-text-primary dark:focus:text-text-primary-dark",
133
133
  error ? "border border-red-500 dark:border-red-600" : "",
134
- disabled ? "text-slate-600 dark:text-slate-400" : "text-slate-800 dark:text-slate-200",
134
+ disabled ? "text-slate-600 dark:text-slate-400" : "text-slate-800 dark:text-white",
135
135
  "relative flex items-center",
136
136
  includeFocusOutline ? focusedMixin : "",
137
137
  inputClassName
138
138
  )}>
139
139
 
140
- <SelectPrimitive.Value asChild>
141
- <div className={cn(
142
- "flex-grow w-full max-w-full flex flex-row gap-2 items-center",
143
- "overflow-visible",
144
- size === "small" ? "h-[42px]" : "h-[64px]"
145
- )}>
146
- {renderValue &&
147
- (value && Array.isArray(value)
148
- ? value.map((v, i) => (
149
- <div key={v} className={"flex items-center gap-1 max-w-full"}>
150
- {renderValue ? renderValue(v, i) : v}
151
- </div>))
152
- : (typeof value === "string" ? (renderValue ? renderValue(value, 0) : value) : placeholder))}
140
+ <div className={cn(
141
+ "flex-grow w-full max-w-full flex flex-row gap-2 items-center",
142
+ "overflow-visible",
143
+ size === "small" ? "h-[42px]" : "h-[64px]"
144
+ )}>
145
+ <SelectPrimitive.Value >
146
+ {renderValue &&
147
+ (value && Array.isArray(value)
148
+ ? value.map((v, i) => (
149
+ <div key={v} className={"flex items-center gap-1 max-w-full"}>
150
+ {renderValue ? renderValue(v, i) : v}
151
+ </div>))
152
+ : (typeof value === "string" ? (renderValue ? renderValue(value, 0) : value) : placeholder))}
153
153
 
154
- {renderValues && (!value || Array.isArray(value))
155
- ? renderValues(value as string[] ?? [])
156
- : null}
154
+ {renderValues && (!value || Array.isArray(value))
155
+ ? renderValues(value as string[] ?? [])
156
+ : null}
157
157
 
158
- {!renderValue && !renderValues && value}
158
+ {!renderValue && !renderValues && value}
159
159
 
160
- </div>
161
160
  </SelectPrimitive.Value>
161
+ </div>
162
162
 
163
163
  <SelectPrimitive.Icon className={cn(
164
164
  "px-2 h-full flex items-center",
@@ -249,7 +249,7 @@ export function SelectGroup({
249
249
  return <>
250
250
  <SelectPrimitive.Group
251
251
  className={cn(
252
- "text-xs text-slate-900 dark:text-slate-100 uppercase tracking-wider font-bold mt-6 first:mt-2",
252
+ "text-xs text-slate-900 dark:text-white uppercase tracking-wider font-bold mt-6 first:mt-2",
253
253
  "px-2 py-2",
254
254
  className
255
255
  )}>
@@ -13,7 +13,7 @@ export const Table = ({
13
13
  className,
14
14
  style
15
15
  }: TableProps) => (
16
- <table className={cn("w-full text-left text-gray-800 dark:text-slate-200 rounded-md overflow-x-auto",
16
+ <table className={cn("w-full text-left text-gray-800 dark:text-white rounded-md overflow-x-auto",
17
17
  className)}
18
18
  style={style}>
19
19
  {children}
@@ -19,7 +19,7 @@ export function Tabs({
19
19
 
20
20
  return <TabsPrimitive.Root value={value} onValueChange={onValueChange}>
21
21
  <TabsPrimitive.List className={cn(
22
- "flex text-sm font-medium text-center text-slate-800 dark:text-slate-200",
22
+ "flex text-sm font-medium text-center text-slate-800 dark:text-white max-w-full overflow-auto no-scrollbar",
23
23
  className)
24
24
  }>
25
25
  {children}
@@ -48,7 +48,7 @@ export function Tab({
48
48
  disabled
49
49
  ? "text-slate-400 dark:text-slate-500"
50
50
  : cn("text-slate-700 dark:text-slate-300",
51
- "data-[state=active]:text-slate-900 data-[state=active]:dark:text-slate-100",
51
+ "data-[state=active]:text-slate-900 data-[state=active]:dark:text-white",
52
52
  "hover:text-slate-800 dark:hover:text-slate-200"),
53
53
  // disabled ? "text-slate-400 dark:text-slate-500" : "data-[state=active]:text-primary",
54
54
  // "data-[state=active]:bg-slate-50 data-[state=active]:dark:bg-slate-800",
@@ -132,7 +132,7 @@ export function TextField<T extends string | number>({
132
132
  label ? (size === "medium" ? "pt-[28px] pb-2" : "pt-4 pb-2") : "py-2",
133
133
  focused ? "text-text-primary dark:text-text-primary-dark" : "",
134
134
  endAdornment ? "pr-10" : "pr-3",
135
- disabled && "border border-transparent outline-none opacity-50 dark:opacity-50 text-slate-800 dark:text-slate-200",
135
+ disabled && "border border-transparent outline-none opacity-50 dark:opacity-50 text-slate-800 dark:text-white",
136
136
  inputClassName
137
137
  )}
138
138
  placeholder={focused || hasValue || !label ? placeholder : undefined}