@firecms/ui 3.0.0-beta.4.pre.2 → 3.0.0-beta.6

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/components/CenteredView.d.ts +4 -2
  3. package/dist/components/Checkbox.d.ts +4 -3
  4. package/dist/components/DateTimeField.d.ts +2 -2
  5. package/dist/components/Markdown.d.ts +1 -0
  6. package/dist/components/Menu.d.ts +2 -1
  7. package/dist/components/RadioGroup.d.ts +25 -3
  8. package/dist/components/TextareaAutosize.d.ts +4 -2
  9. package/dist/hooks/index.d.ts +4 -0
  10. package/dist/hooks/useLocaleConfig.d.ts +1 -0
  11. package/dist/icons/Icon.d.ts +2 -2
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.es.js +7506 -7466
  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/dist/styles.d.ts +6 -6
  18. package/dist/util/index.d.ts +0 -2
  19. package/package.json +20 -16
  20. package/src/components/Autocomplete.tsx +2 -1
  21. package/src/components/Button.tsx +1 -1
  22. package/src/components/CenteredView.tsx +24 -14
  23. package/src/components/Checkbox.tsx +29 -22
  24. package/src/components/Collapse.tsx +2 -1
  25. package/src/components/DateTimeField.tsx +6 -5
  26. package/src/components/ExpandablePanel.tsx +4 -2
  27. package/src/components/FileUpload.tsx +1 -1
  28. package/src/components/IconButton.tsx +1 -1
  29. package/src/components/InputLabel.tsx +8 -7
  30. package/src/components/Label.tsx +1 -1
  31. package/src/components/Markdown.tsx +14 -3
  32. package/src/components/Menu.tsx +11 -5
  33. package/src/components/MultiSelect.tsx +2 -1
  34. package/src/components/Popover.tsx +2 -1
  35. package/src/components/RadioGroup.tsx +37 -6
  36. package/src/components/SearchBar.tsx +1 -1
  37. package/src/components/Select.tsx +1 -1
  38. package/src/components/TextareaAutosize.tsx +1 -1
  39. package/src/components/Tooltip.tsx +2 -1
  40. package/src/components/Typography.tsx +1 -1
  41. package/src/hooks/index.ts +4 -0
  42. package/src/hooks/useLocaleConfig.tsx +18 -0
  43. package/src/icons/Icon.tsx +43 -40
  44. package/src/index.ts +1 -0
  45. package/src/styles.ts +6 -6
  46. package/src/util/index.ts +0 -2
  47. package/tailwind.config.js +70 -0
  48. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  49. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  50. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  51. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  52. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  53. /package/src/{util → hooks}/useOutsideAlerter.tsx +0 -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-800 dark:bg-opacity-60 transition duration-150 ease-in-out";
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-90";
4
+ export declare const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-700 dark:bg-opacity-40 transition duration-100 ease-in-out";
5
+ export declare const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0 transition duration-100 ease-in-out";
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
8
  export declare const defaultBorderMixin = "border-gray-100 dark:border-gray-800 dark:border-opacity-80";
9
- export declare const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-90 border-gray-100";
10
- export declare const cardMixin = "bg-white rounded-md dark:bg-gray-950 dark:border-gray-800 dark:border-opacity-50 transition duration-200 ease-in-out m-1 -p-1 border border-transparent";
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 border border-gray-100 dark:border-transparent rounded-md dark:bg-gray-950 dark:border-gray-800 dark:border-opacity-50 transition duration-100 ease-in-out m-1 -p-1";
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";
@@ -2,5 +2,3 @@ export * from "./cn";
2
2
  export * from "./debounce";
3
3
  export * from "./chip_colors";
4
4
  export * from "./key_to_icon_component";
5
- export * from "./useInjectStyles";
6
- export * from "./useOutsideAlerter";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/ui",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.4.pre.2",
4
+ "version": "3.0.0-beta.6",
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",
@@ -61,8 +62,10 @@
61
62
  "@radix-ui/react-switch": "^1.0.3",
62
63
  "@radix-ui/react-tabs": "^1.0.4",
63
64
  "@radix-ui/react-tooltip": "^1.0.7",
65
+ "clsx": "^2.1.0",
64
66
  "cmdk": "^0.2.1",
65
- "react-datepicker": "^6.4.0",
67
+ "date-fns": "^3.6.0",
68
+ "react-datepicker": "^6.8.0",
66
69
  "react-dropzone": "^14.2.3",
67
70
  "react-fast-compare": "^3.2.2",
68
71
  "tailwind-merge": "^2.2.2"
@@ -80,16 +83,16 @@
80
83
  "devDependencies": {
81
84
  "@jest/globals": "^29.7.0",
82
85
  "@testing-library/jest-dom": "^6.4.2",
83
- "@testing-library/react": "^14.2.1",
86
+ "@testing-library/react": "^14.3.1",
84
87
  "@testing-library/user-event": "^14.5.2",
85
88
  "@types/jest": "^29.5.12",
86
- "@types/node": "^20.11.30",
89
+ "@types/node": "^20.12.7",
87
90
  "@types/object-hash": "^3.0.6",
88
- "@types/react": "^18.2.67",
89
- "@types/react-dom": "^18.2.22",
91
+ "@types/react": "^18.2.79",
92
+ "@types/react-dom": "^18.2.25",
90
93
  "@types/react-measure": "^2.0.12",
91
- "@typescript-eslint/eslint-plugin": "^7.3.1",
92
- "@typescript-eslint/parser": "^7.3.1",
94
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
95
+ "@typescript-eslint/parser": "^7.7.0",
93
96
  "@vitejs/plugin-react": "^4.2.1",
94
97
  "cross-env": "^7.0.3",
95
98
  "eslint": "^8.57.0",
@@ -99,20 +102,21 @@
99
102
  "eslint-plugin-promise": "^6.1.1",
100
103
  "eslint-plugin-react": "^7.34.1",
101
104
  "eslint-plugin-react-hooks": "^4.6.0",
102
- "firebase": "^10.9.0",
105
+ "firebase": "^10.11.0",
103
106
  "jest": "^29.7.0",
104
107
  "npm-run-all": "^4.1.5",
105
108
  "ts-jest": "^29.1.2",
106
109
  "ts-node": "^10.9.2",
107
- "tsd": "^0.30.7",
108
- "typescript": "^5.4.2",
109
- "vite": "^5.1.6"
110
+ "tsd": "^0.31.0",
111
+ "typescript": "^5.4.5",
112
+ "vite": "^5.2.9"
110
113
  },
111
114
  "files": [
112
115
  "dist",
113
- "src"
116
+ "src",
117
+ "tailwind.config.js"
114
118
  ],
115
- "gitHead": "77875cc369a0bfe7b0b141e794b14a819d5811df",
119
+ "gitHead": "ffcbddbd73211bb644ff7503c2c62790bff6202a",
116
120
  "publishConfig": {
117
121
  "access": "public"
118
122
  }
@@ -2,7 +2,8 @@ import React from "react";
2
2
 
3
3
  import { paperMixin } from "../styles";
4
4
  import { Collapse } from "./Collapse";
5
- import { cn, useOutsideAlerter } from "../util";
5
+ import { cn } from "../util";
6
+ import { useOutsideAlerter } from "../hooks";
6
7
 
7
8
  export type AutocompleteProps = {
8
9
  children: React.ReactNode;
@@ -50,7 +50,7 @@ const ButtonInner = React.forwardRef<
50
50
  // Outlined Variants
51
51
  "border border-primary text-primary hover:bg-primary-bg": variant === "outlined" && color === "primary" && !disabled,
52
52
  "border border-secondary text-secondary hover:bg-secondary-bg": variant === "outlined" && color === "secondary" && !disabled,
53
- "border border-red-500 text-red-500 hover:bg-red-500": variant === "outlined" && color === "error" && !disabled,
53
+ "border border-red-500 text-red-500 hover:bg-red-500 hover:text-white": variant === "outlined" && color === "error" && !disabled,
54
54
  "border border-slate-400 text-text-primary dark:text-text-primary-dark hover:bg-slate-200": variant === "outlined" && color === "text" && !disabled,
55
55
  // Disabled states for all variants
56
56
  "border border-transparent opacity-50": variant === "text" && disabled,
@@ -2,23 +2,33 @@ import React from "react";
2
2
  import { Container } from "./Container";
3
3
  import { cn } from "../util";
4
4
 
5
- export function CenteredView({
6
- children,
7
- maxWidth,
8
- className,
9
- fullScreen
10
- }: {
5
+ export type CenteredViewProps = {
11
6
  children: React.ReactNode;
12
7
  maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
8
+ outerClassName?: string;
13
9
  className?: string;
14
10
  fullScreen?: boolean;
15
- }) {
11
+ };
16
12
 
17
- return <div className={cn("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full")}>
18
- <Container className={cn("m-auto", className)}
19
- maxWidth={maxWidth}>
20
- {children}
21
- </Container>
22
- </div>
13
+ export const CenteredView = React.forwardRef<HTMLDivElement, CenteredViewProps>(({
14
+ children,
15
+ maxWidth,
16
+ outerClassName,
17
+ className,
18
+ fullScreen,
19
+ ...rest
20
+ }, ref) => { // Notice how the ref is now received as the second argument
23
21
 
24
- }
22
+ return (
23
+ <div ref={ref}
24
+ className={cn("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full", outerClassName)}
25
+ {...rest}>
26
+ <Container className={cn("m-auto", className)} maxWidth={maxWidth}>
27
+ {children}
28
+ </Container>
29
+ </div>
30
+ );
31
+
32
+ });
33
+
34
+ CenteredView.displayName = "CenteredView";
@@ -4,11 +4,13 @@ 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
+ id?: string;
9
10
  disabled?: boolean;
10
11
  indeterminate?: boolean;
11
12
  onCheckedChange?: (checked: boolean) => void;
13
+ padding?: boolean;
12
14
  size?: "tiny" | "small" | "medium" | "large";
13
15
  color?: "primary" | "secondary";
14
16
  }
@@ -21,11 +23,17 @@ const sizeClasses = {
21
23
  };
22
24
 
23
25
  const outerSizeClasses = {
24
- medium: "w-10 h-10 p-2",
25
- small: "w-8 h-8 p-2",
26
- large: "w-12 h-12 p-2",
26
+ medium: "w-10 h-10",
27
+ small: "w-8 h-8",
28
+ large: "w-12 h-12 ",
27
29
  tiny: "w-6 h-6"
28
30
  }
31
+ const paddingClasses = {
32
+ medium: "p-2",
33
+ small: "p-2",
34
+ large: "p-2",
35
+ tiny: ""
36
+ }
29
37
 
30
38
  const colorClasses = {
31
39
  primary: "bg-primary",
@@ -33,8 +41,10 @@ const colorClasses = {
33
41
  }
34
42
 
35
43
  export const Checkbox = ({
44
+ id,
36
45
  checked,
37
46
  indeterminate = false,
47
+ padding = true,
38
48
  disabled,
39
49
  size = "medium",
40
50
  onCheckedChange,
@@ -51,17 +61,19 @@ export const Checkbox = ({
51
61
  ? 14
52
62
  : 24;
53
63
  return (
54
- <div className={cn(
55
- outerSizeClasses[size],
56
- "inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
57
- onCheckedChange ? "rounded-full hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-slate-700 dark:hover:bg-opacity-75" : "",
58
- onCheckedChange ? "cursor-pointer" : "cursor-default"
59
- )}>
60
- <CheckboxPrimitive.Root
61
- asChild
62
- checked={indeterminate || isChecked}
63
- disabled={disabled}
64
- onCheckedChange={disabled ? undefined : onCheckedChange}>
64
+ <CheckboxPrimitive.Root
65
+ id={id}
66
+ checked={indeterminate || isChecked}
67
+ disabled={disabled}
68
+ onCheckedChange={disabled ? undefined : onCheckedChange}>
69
+
70
+ <div className={cn(
71
+ padding ? paddingClasses[size] : "",
72
+ outerSizeClasses[size],
73
+ "inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
74
+ onCheckedChange ? "rounded-full hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-slate-700 dark:hover:bg-opacity-75" : "",
75
+ onCheckedChange ? "cursor-pointer" : "cursor-default"
76
+ )}>
65
77
  <div
66
78
  className={cn(
67
79
  "border-2 relative transition-colors ease-in-out duration-150",
@@ -84,12 +96,7 @@ export const Checkbox = ({
84
96
  )}
85
97
  </CheckboxPrimitive.Indicator>
86
98
  </div>
87
- </CheckboxPrimitive.Root>
88
- {/*{indeterminate && (*/}
89
- {/* <div >*/}
90
- {/* YO*/}
91
- {/* </div>*/}
92
- {/*)}*/}
93
- </div>
99
+ </div>
100
+ </CheckboxPrimitive.Root>
94
101
  );
95
102
  };
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import * as Collapsible from "@radix-ui/react-collapsible";
3
3
 
4
- import { cn, useInjectStyles } from "../util";
4
+ import { cn } from "../util";
5
+ import { useInjectStyles } from "../hooks";
5
6
 
6
7
  interface CollapseProps {
7
8
  children?: React.ReactNode;
@@ -12,17 +12,18 @@ import {
12
12
  paperMixin
13
13
  } from "../styles";
14
14
  import { InputLabel } from "./InputLabel";
15
- import { cn, useInjectStyles } from "../util";
16
15
  import { Typography } from "./Typography";
16
+ import { cn } from "../util";
17
+ import { useInjectStyles } from "../hooks";
17
18
 
18
19
  interface DateTimeFieldProps {
19
20
  value?: Date;
20
- onChange: (date: Date | null) => void;
21
+ onChange: (date: Date | undefined) => void;
21
22
  mode?: "date" | "date_time";
22
23
  disabled?: boolean;
23
24
  clearable?: boolean;
24
25
  error?: boolean;
25
- size: "small" | "medium";
26
+ size?: "small" | "medium";
26
27
  label?: React.ReactNode;
27
28
  className?: string;
28
29
  style?: React.CSSProperties;
@@ -40,7 +41,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
40
41
  clearable,
41
42
  mode = "date",
42
43
  error,
43
- size,
44
+ size = "medium",
44
45
  className,
45
46
  style,
46
47
  inputClassName,
@@ -60,7 +61,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
60
61
 
61
62
  const handleClear = (e: React.MouseEvent) => {
62
63
  e.preventDefault();
63
- onChange(null);
64
+ onChange(undefined);
64
65
  }
65
66
 
66
67
  return (
@@ -3,7 +3,8 @@ import React, { PropsWithChildren, useEffect, useState } from "react";
3
3
  import * as Collapsible from "@radix-ui/react-collapsible";
4
4
  import { defaultBorderMixin, fieldBackgroundMixin, focusedMixin } from "../styles";
5
5
  import { ExpandMoreIcon } from "../icons";
6
- import { cn, useInjectStyles } from "../util";
6
+ import { cn } from "../util";
7
+ import { useInjectStyles } from "../hooks";
7
8
 
8
9
  export function ExpandablePanel({
9
10
  title,
@@ -77,7 +78,8 @@ export function ExpandablePanel({
77
78
  <Collapsible.Root
78
79
  className={cn(
79
80
  !invisible && defaultBorderMixin + " border",
80
- "rounded-md"
81
+ "rounded-md",
82
+ "w-full"
81
83
  )}
82
84
  open={open}
83
85
  onOpenChange={(updatedOpen: boolean) => {
@@ -38,7 +38,7 @@ export function FileUpload({
38
38
  disabled,
39
39
  maxFiles,
40
40
  title,
41
- uploadDescription = "Drag and drop a file here or click",
41
+ uploadDescription,
42
42
  children,
43
43
  preventDropOnDocument = true,
44
44
  size
@@ -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;
@@ -7,6 +8,12 @@ export type InputLabelProps = {
7
8
  shrink?: boolean;
8
9
  } & React.LabelHTMLAttributes<HTMLLabelElement>;
9
10
 
11
+ const defaultClasses = {
12
+ root: "origin-left transition-transform block whitespace-nowrap overflow-hidden text-overflow-ellipsis max-w-full",
13
+ shrink: "transform translate-y-[2px] scale-75 translate-x-[12px]",
14
+ expanded: "translate-x-[16px] top-0 transform translate-y-[16px] scale-100"
15
+ };
16
+
10
17
  export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(function InputLabel(inProps, ref) {
11
18
  const {
12
19
  shrink,
@@ -14,12 +21,6 @@ export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(fu
14
21
  ...other
15
22
  } = inProps;
16
23
 
17
- const defaultClasses = {
18
- root: "origin-left transition-transform block whitespace-nowrap overflow-hidden text-overflow-ellipsis max-w-full",
19
- shrink: "transform translate-y-[2px] scale-75 translate-x-[12px]",
20
- expanded: "translate-x-[16px] top-0 transform translate-y-[16px] scale-100"
21
- };
22
-
23
24
  const computedClassName = cn(defaultClasses.root,
24
25
  {
25
26
  [defaultClasses.shrink]: shrink,
@@ -27,7 +28,7 @@ export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(fu
27
28
  }, className);
28
29
 
29
30
  return (
30
- <label
31
+ <Label
31
32
  data-shrink={shrink}
32
33
  ref={ref}
33
34
  className={computedClassName}
@@ -9,7 +9,7 @@ const Label = React.forwardRef<
9
9
  >(({ className, ...props }, ref) => (
10
10
  <LabelPrimitive.Root
11
11
  ref={ref}
12
- className={cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", defaultBorderMixin, className)}
12
+ className={cn("text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70", defaultBorderMixin, className)}
13
13
  {...props}
14
14
  />
15
15
  ))
@@ -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 text-sm",
16
+ medium: "prose text-base",
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
  }
@@ -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={cn(focusedMixin,
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>
@@ -6,8 +6,9 @@ import { Command as CommandPrimitive } from "cmdk";
6
6
 
7
7
  import { ExpandMoreIcon } from "../icons";
8
8
  import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin, focusedMixin } from "../styles";
9
- import { cn, useOutsideAlerter } from "../util";
9
+ import { cn } from "../util";
10
10
  import { SelectInputLabel } from "./common/SelectInputLabel";
11
+ import { useOutsideAlerter } from "../hooks";
11
12
 
12
13
  export type MultiSelectProps = {
13
14
  open?: boolean,
@@ -2,7 +2,8 @@ import React from "react";
2
2
  import * as PopoverPrimitive from "@radix-ui/react-popover";
3
3
 
4
4
  import { paperMixin } from "../styles";
5
- import { cn, useInjectStyles } from "../util";
5
+ import { cn } from "../util";
6
+ import { useInjectStyles } from "../hooks";
6
7
 
7
8
  export type PopoverSide = "top" | "right" | "bottom" | "left";
8
9
  export type PopoverAlign = "start" | "center" | "end";
@@ -1,12 +1,33 @@
1
1
  import * as React from "react"
2
2
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3
3
  import { cn } from "../util";
4
- import { CircleIcon } from "../icons";
4
+
5
+ export interface RadioGroupProps {
6
+ id?: string;
7
+ children: React.ReactNode;
8
+ name?: string
9
+ required?: boolean;
10
+ disabled?: boolean;
11
+ /**
12
+ * Whether keyboard navigation should loop around
13
+ * @defaultValue false
14
+ */
15
+ loop?: boolean;
16
+ defaultValue?: string;
17
+ value?: string;
18
+
19
+ onValueChange?(value: string): void;
20
+
21
+ className?: string;
22
+ }
5
23
 
6
24
  const RadioGroup = React.forwardRef<
7
25
  React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
- >(({ className, ...props }, ref) => {
26
+ RadioGroupProps
27
+ >(({
28
+ className,
29
+ ...props
30
+ }, ref) => {
10
31
  return (
11
32
  <RadioGroupPrimitive.Root
12
33
  className={cn("grid gap-2", className)}
@@ -17,10 +38,20 @@ const RadioGroup = React.forwardRef<
17
38
  })
18
39
  RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
19
40
 
41
+ export interface RadioGroupItemProps {
42
+ id?: string;
43
+ value: string;
44
+ checked?: boolean;
45
+ required?: boolean;
46
+ className?: string;
47
+ }
20
48
  const RadioGroupItem = React.forwardRef<
21
49
  React.ElementRef<typeof RadioGroupPrimitive.Item>,
22
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
23
- >(({ className, ...props }, ref) => {
50
+ RadioGroupItemProps
51
+ >(({
52
+ className,
53
+ ...props
54
+ }, ref) => {
24
55
  return (
25
56
  <RadioGroupPrimitive.Item
26
57
  ref={ref}
@@ -31,7 +62,7 @@ const RadioGroupItem = React.forwardRef<
31
62
  {...props}
32
63
  >
33
64
  <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" />
65
+ <div className="h-2.5 w-2.5 fill-current text-current bg-primary rounded-lg"/>
35
66
  </RadioGroupPrimitive.Indicator>
36
67
  </RadioGroupPrimitive.Item>
37
68
  )
@@ -4,7 +4,7 @@ import { defaultBorderMixin, focusedMixin } from "../styles";
4
4
  import { CircularProgress, IconButton } from "./index";
5
5
  import { ClearIcon, SearchIcon } from "../icons";
6
6
  import { cn } from "../util";
7
- import { useDebounceValue } from "../util/useDebounceValue";
7
+ import { useDebounceValue } from "../hooks";
8
8
 
9
9
  interface SearchBarProps {
10
10
  onClick?: () => void;
@@ -142,7 +142,7 @@ export function Select({
142
142
  "overflow-visible",
143
143
  size === "small" ? "h-[42px]" : "h-[64px]"
144
144
  )}>
145
- <SelectPrimitive.Value >
145
+ <SelectPrimitive.Value placeholder={placeholder}>
146
146
  {renderValue &&
147
147
  (value && Array.isArray(value)
148
148
  ? value.map((v, i) => (
@@ -288,7 +288,7 @@ export const TextareaAutosize = React.forwardRef(function TextareaAutosize(
288
288
  />
289
289
  </React.Fragment>
290
290
  );
291
- });
291
+ }) as React.FC<TextareaAutosizeProps & { ref?: React.ForwardedRef<Element> }>;
292
292
 
293
293
  export type TextareaAutosizeProps = Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "onResize"> & {
294
294
 
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
3
 
4
- import { cn, useInjectStyles } from "../util";
4
+ import { cn } from "../util";
5
+ import { useInjectStyles } from "../hooks";
5
6
 
6
7
  export type TooltipProps = {
7
8
  open?: boolean,
@@ -87,7 +87,7 @@ export function Typography<C extends React.ElementType>(
87
87
  variantToClasses[variant],
88
88
  color ? colorToClasses[color] : "",
89
89
  align !== "inherit" && `text-${align}`,
90
- gutterBottom && "mb-[0.35em]",
90
+ gutterBottom && "mb-2",
91
91
  noWrap && "truncate",
92
92
  paragraph && "mb-3",
93
93
  className
@@ -0,0 +1,4 @@
1
+ export * from "./useLocaleConfig";
2
+ export * from "./useInjectStyles";
3
+ export * from "./useOutsideAlerter";
4
+ export * from "./useDebounceValue";