@firecms/ui 3.0.0-canary.7 → 3.0.0-canary.70

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 (92) hide show
  1. package/README.md +2 -2
  2. package/dist/components/Avatar.d.ts +1 -0
  3. package/dist/components/Button.d.ts +1 -1
  4. package/dist/components/Card.d.ts +4 -2
  5. package/dist/components/CenteredView.d.ts +5 -2
  6. package/dist/components/Checkbox.d.ts +5 -4
  7. package/dist/components/Chip.d.ts +1 -1
  8. package/dist/components/DateTimeField.d.ts +2 -2
  9. package/dist/components/Dialog.d.ts +2 -1
  10. package/dist/components/Label.d.ts +7 -0
  11. package/dist/components/Markdown.d.ts +1 -0
  12. package/dist/components/Menu.d.ts +2 -1
  13. package/dist/components/Menubar.d.ts +69 -0
  14. package/dist/components/RadioGroup.d.ts +27 -0
  15. package/dist/components/Select.d.ts +1 -1
  16. package/dist/components/TextField.d.ts +1 -1
  17. package/dist/components/TextareaAutosize.d.ts +4 -2
  18. package/dist/components/Tooltip.d.ts +2 -1
  19. package/dist/components/index.d.ts +3 -1
  20. package/dist/hooks/index.d.ts +4 -0
  21. package/dist/hooks/useLocaleConfig.d.ts +1 -0
  22. package/dist/icons/Icon.d.ts +2 -2
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.es.js +8504 -8158
  25. package/dist/index.es.js.map +1 -1
  26. package/dist/index.umd.js +10 -10
  27. package/dist/index.umd.js.map +1 -1
  28. package/dist/styles.d.ts +6 -6
  29. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  30. package/dist/util/index.d.ts +1 -3
  31. package/package.json +35 -28
  32. package/src/components/Alert.tsx +4 -4
  33. package/src/components/Autocomplete.tsx +4 -3
  34. package/src/components/Avatar.tsx +7 -4
  35. package/src/components/Badge.tsx +1 -1
  36. package/src/components/BooleanSwitch.tsx +6 -6
  37. package/src/components/BooleanSwitchWithLabel.tsx +3 -3
  38. package/src/components/Button.tsx +15 -23
  39. package/src/components/Card.tsx +18 -12
  40. package/src/components/CenteredView.tsx +26 -14
  41. package/src/components/Checkbox.tsx +36 -25
  42. package/src/components/Chip.tsx +5 -5
  43. package/src/components/CircularProgress.tsx +2 -2
  44. package/src/components/Collapse.tsx +3 -2
  45. package/src/components/Container.tsx +2 -2
  46. package/src/components/DateTimeField.tsx +10 -9
  47. package/src/components/Dialog.tsx +8 -5
  48. package/src/components/DialogActions.tsx +2 -2
  49. package/src/components/DialogContent.tsx +2 -2
  50. package/src/components/ExpandablePanel.tsx +9 -7
  51. package/src/components/FileUpload.tsx +6 -8
  52. package/src/components/IconButton.tsx +4 -4
  53. package/src/components/InfoLabel.tsx +2 -2
  54. package/src/components/InputLabel.tsx +10 -9
  55. package/src/components/Label.tsx +31 -0
  56. package/src/components/Markdown.tsx +14 -3
  57. package/src/components/Menu.tsx +13 -7
  58. package/src/components/Menubar.tsx +287 -0
  59. package/src/components/MultiSelect.tsx +7 -6
  60. package/src/components/Paper.tsx +2 -2
  61. package/src/components/Popover.tsx +3 -2
  62. package/src/components/RadioGroup.tsx +72 -0
  63. package/src/components/SearchBar.tsx +6 -6
  64. package/src/components/Select.tsx +24 -23
  65. package/src/components/Sheet.tsx +3 -3
  66. package/src/components/Skeleton.tsx +8 -5
  67. package/src/components/Table.tsx +6 -6
  68. package/src/components/Tabs.tsx +7 -7
  69. package/src/components/TextField.tsx +9 -8
  70. package/src/components/TextareaAutosize.tsx +3 -3
  71. package/src/components/Tooltip.tsx +6 -2
  72. package/src/components/Typography.tsx +20 -3
  73. package/src/components/common/SelectInputLabel.tsx +2 -2
  74. package/src/components/index.tsx +3 -1
  75. package/src/hooks/index.ts +4 -0
  76. package/src/hooks/useLocaleConfig.tsx +18 -0
  77. package/src/icons/Icon.tsx +44 -41
  78. package/src/index.ts +1 -0
  79. package/src/scripts/generateIconKeys.ts +0 -1
  80. package/src/styles.ts +6 -6
  81. package/src/util/cls.ts +14 -0
  82. package/src/util/index.ts +1 -3
  83. package/tailwind.config.js +70 -0
  84. package/dist/components/Spinner.d.ts +0 -1
  85. package/src/components/Spinner.tsx +0 -18
  86. package/src/util/cn.ts +0 -6
  87. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  88. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  89. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  90. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  91. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  92. /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-800 dark:bg-opacity-60";
5
+ export declare const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0";
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-gray-700 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 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";
@@ -1,2 +1,6 @@
1
1
  import { type ClassValue } from "clsx";
2
+ export declare function cls(...classes: ClassValue[]): string;
3
+ /**
4
+ * @deprecated
5
+ */
2
6
  export declare function cn(...classes: ClassValue[]): string;
@@ -1,6 +1,4 @@
1
- export * from "./cn";
1
+ export * from "./cls";
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-canary.7",
4
+ "version": "3.0.0-canary.70",
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,23 +52,28 @@
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",
56
+ "@radix-ui/react-menubar": "^1.0.4",
54
57
  "@radix-ui/react-popover": "^1.0.7",
55
58
  "@radix-ui/react-portal": "^1.0.4",
59
+ "@radix-ui/react-radio-group": "^1.1.3",
56
60
  "@radix-ui/react-scroll-area": "^1.0.5",
57
- "@radix-ui/react-select": "^1.2.2",
61
+ "@radix-ui/react-select": "^2.0.0",
58
62
  "@radix-ui/react-separator": "^1.0.3",
59
63
  "@radix-ui/react-switch": "^1.0.3",
60
64
  "@radix-ui/react-tabs": "^1.0.4",
61
65
  "@radix-ui/react-tooltip": "^1.0.7",
66
+ "clsx": "^2.1.1",
62
67
  "cmdk": "^0.2.1",
63
- "react-datepicker": "^4.25.0",
68
+ "date-fns": "^3.6.0",
69
+ "react-datepicker": "^6.9.0",
64
70
  "react-dropzone": "^14.2.3",
65
71
  "react-fast-compare": "^3.2.2",
66
- "tailwind-merge": "^2.2.1"
72
+ "tailwind-merge": "^2.3.0"
67
73
  },
68
74
  "peerDependencies": {
69
- "react": "^18.2.0",
70
- "react-dom": "^18.2.0"
75
+ "react": "^18.3.1",
76
+ "react-dom": "^18.3.1"
71
77
  },
72
78
  "eslintConfig": {
73
79
  "extends": [
@@ -77,40 +83,41 @@
77
83
  },
78
84
  "devDependencies": {
79
85
  "@jest/globals": "^29.7.0",
80
- "@testing-library/jest-dom": "^5.17.0",
81
- "@testing-library/react": "^14.2.1",
86
+ "@testing-library/jest-dom": "^6.4.5",
87
+ "@testing-library/react": "^15.0.7",
82
88
  "@testing-library/user-event": "^14.5.2",
83
89
  "@types/jest": "^29.5.12",
84
- "@types/node": "^20.11.16",
90
+ "@types/node": "^20.12.13",
85
91
  "@types/object-hash": "^3.0.6",
86
- "@types/react": "^18.2.54",
87
- "@types/react-dom": "^18.2.18",
92
+ "@types/react": "^18.3.3",
93
+ "@types/react-dom": "^18.3.0",
88
94
  "@types/react-measure": "^2.0.12",
89
- "@typescript-eslint/eslint-plugin": "^5.62.0",
90
- "@typescript-eslint/parser": "^5.62.0",
91
- "@vitejs/plugin-react": "^4.2.1",
95
+ "@typescript-eslint/eslint-plugin": "^7.11.0",
96
+ "@typescript-eslint/parser": "^7.11.0",
97
+ "@vitejs/plugin-react": "^4.3.0",
92
98
  "cross-env": "^7.0.3",
93
- "eslint": "^8.56.0",
99
+ "eslint": "^8.57.0",
94
100
  "eslint-config-standard": "^17.1.0",
95
101
  "eslint-plugin-import": "^2.29.1",
96
- "eslint-plugin-n": "^15.7.0",
97
- "eslint-plugin-promise": "^6.1.1",
98
- "eslint-plugin-react": "^7.33.2",
99
- "eslint-plugin-react-hooks": "^4.6.0",
100
- "firebase": "^10.8.0",
102
+ "eslint-plugin-n": "^16.6.2",
103
+ "eslint-plugin-promise": "^6.2.0",
104
+ "eslint-plugin-react": "^7.34.2",
105
+ "eslint-plugin-react-hooks": "^4.6.2",
106
+ "firebase": "^10.12.2",
101
107
  "jest": "^29.7.0",
102
108
  "npm-run-all": "^4.1.5",
103
- "ts-jest": "^29.1.2",
109
+ "ts-jest": "^29.1.4",
104
110
  "ts-node": "^10.9.2",
105
- "tsd": "^0.30.4",
106
- "typescript": "^5.3.3",
107
- "vite": "^5.1.1"
111
+ "tsd": "^0.31.0",
112
+ "typescript": "^5.4.5",
113
+ "vite": "^5.2.12"
108
114
  },
109
115
  "files": [
110
116
  "dist",
111
- "src"
117
+ "src",
118
+ "tailwind.config.js"
112
119
  ],
113
- "gitHead": "30ef9b29f5f624fca64e11ffda6001a98f998102",
120
+ "gitHead": "8782754f770575b610bb23f89d284841bae03bdb",
114
121
  "publishConfig": {
115
122
  "access": "public"
116
123
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { cn } from "../util";
2
+ import { cls } from "../util";
3
3
 
4
4
  export interface AlertProps {
5
5
  children: React.ReactNode;
@@ -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
 
@@ -52,7 +52,7 @@ export const Alert: React.FC<AlertProps> = ({
52
52
  return (
53
53
  <div
54
54
  style={style}
55
- className={cn(
55
+ className={cls(
56
56
  getSizeClasses(size),
57
57
  "w-full",
58
58
  "font-medium",
@@ -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 { cls } from "../util";
6
+ import { useOutsideAlerter } from "../hooks";
6
7
 
7
8
  export type AutocompleteProps = {
8
9
  children: React.ReactNode;
@@ -49,14 +50,14 @@ export function Autocomplete({
49
50
  return <Collapse
50
51
  in={open}
51
52
  duration={50}
52
- className={cn(
53
+ className={cls(
53
54
  "absolute top-full left-0 right-0 overflow-visible",
54
55
  open ? "shadow" : "",
55
56
  "my-2",
56
57
  "z-20",
57
58
  "w-full")}>
58
59
  <div ref={autocompleteRef}
59
- className={cn(
60
+ className={cls(
60
61
  open ? paperMixin : "",
61
62
  "bg-slate-50 dark:bg-slate-900 py-2"
62
63
  )}>
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { cn } from "../util";
2
+ import { cls } from "../util";
3
3
  import { focusedMixin } from "../styles";
4
4
 
5
5
  export interface AvatarProps {
@@ -7,6 +7,7 @@ export interface AvatarProps {
7
7
  alt?: string;
8
8
  children?: React.ReactNode;
9
9
  className?: string;
10
+ outerClassName?: string;
10
11
  style?: React.CSSProperties;
11
12
  }
12
13
 
@@ -17,6 +18,7 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
17
18
  children,
18
19
  className,
19
20
  style,
21
+ outerClassName,
20
22
  ...props
21
23
  }, ref) => {
22
24
 
@@ -25,13 +27,14 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
25
27
  ref={ref}
26
28
  style={style}
27
29
  {...props}
28
- className={cn("rounded-full flex items-center justify-center overflow-hidden",
30
+ className={cls("rounded-full flex items-center justify-center overflow-hidden",
29
31
  focusedMixin,
30
32
  "p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12",
33
+ outerClassName
31
34
  )}>
32
35
  {src
33
36
  ? (
34
- <img className={cn(
37
+ <img className={cls(
35
38
  "bg-slate-100 dark:bg-slate-800",
36
39
  "w-full h-full object-cover rounded-full",
37
40
  className)}
@@ -40,7 +43,7 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
40
43
  )
41
44
  : (
42
45
  <span
43
- className={cn(
46
+ className={cls(
44
47
  "bg-slate-100 dark:bg-slate-800",
45
48
  "flex items-center justify-center",
46
49
  "w-full h-full py-1.5 text-lg font-medium text-slate-900 dark:text-white rounded-full",
@@ -27,7 +27,7 @@ export const Badge: React.FC<BadgeProps> = ({
27
27
  children
28
28
  }) => {
29
29
  return (
30
- <div className="relative inline-block">
30
+ <div className="relative inline-block w-fit">
31
31
  {children}
32
32
  <span
33
33
  className={`absolute top-0.5 right-0.5 transform translate-x-1/2 -translate-y-1/2 rounded-full
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { cn } from "../util";
2
+ import { cls } from "../util";
3
3
 
4
4
  export type BooleanSwitchProps = {
5
5
  value: boolean | null;
@@ -39,19 +39,19 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
39
39
  onValueChange?.(!value);
40
40
  }
41
41
  }}
42
- className={cn(
42
+ className={cls(
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}
51
51
  >
52
52
  {allowIndeterminate && (value === null || value === undefined) && <div
53
53
  key={"knob"}
54
- className={cn(
54
+ className={cls(
55
55
  "block rounded-full transition-transform duration-100 transform will-change-auto",
56
56
  disabled ? "bg-slate-400 dark:bg-slate-600" : "bg-slate-400 dark:bg-slate-600",
57
57
  {
@@ -65,7 +65,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
65
65
 
66
66
  {!(allowIndeterminate && (value === null || value === undefined)) && <div
67
67
  key={"knob"}
68
- className={cn(
68
+ className={cls(
69
69
  "block rounded-full transition-transform duration-100 transform will-change-auto",
70
70
  disabled ? "bg-slate-300 dark:bg-slate-700" : (value ? "bg-white" : "bg-slate-600 dark:bg-slate-400"),
71
71
  {
@@ -6,7 +6,7 @@ import {
6
6
  focusedClasses
7
7
  } from "../styles";
8
8
  import { BooleanSwitch, BooleanSwitchProps } from "./BooleanSwitch";
9
- import { cn } from "../util";
9
+ import { cls } from "../util";
10
10
 
11
11
  export type BooleanSwitchWithLabelProps = BooleanSwitchProps & {
12
12
  position?: "start" | "end",
@@ -53,7 +53,7 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
53
53
  onFocus={onFocus}
54
54
  onBlur={onBlur}
55
55
  tabIndex={-1}
56
- className={cn(
56
+ className={cls(
57
57
  !invisible && fieldBackgroundMixin,
58
58
  !invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
59
59
  disabled ? "cursor-default" : "cursor-pointer",
@@ -86,7 +86,7 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
86
86
  {...props}
87
87
  />
88
88
 
89
- <div className={cn(
89
+ <div className={cls(
90
90
  "flex-grow",
91
91
  position === "end" ? "mr-4" : "ml-4",
92
92
  size === "small" ? "text-sm" : "text-base"
@@ -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 { cls } 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;
@@ -32,21 +32,9 @@ const ButtonInner = React.forwardRef<
32
32
  }: ButtonProps<any>, ref) => {
33
33
 
34
34
  const baseClasses =
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";
35
+ "h-fit rounded-md uppercase whitespace-nowrap 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
- const buttonClasses = cn({
37
+ const buttonClasses = cls({
50
38
  "w-full": fullWidth,
51
39
  "w-fit": !fullWidth,
52
40
  // Filled Variants
@@ -62,17 +50,21 @@ const ButtonInner = React.forwardRef<
62
50
  // Outlined Variants
63
51
  "border border-primary text-primary hover:bg-primary-bg": variant === "outlined" && color === "primary" && !disabled,
64
52
  "border border-secondary text-secondary hover:bg-secondary-bg": variant === "outlined" && color === "secondary" && !disabled,
65
- "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,
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
- const sizeClasses = cn(
61
+ const sizeClasses = cls(
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
 
@@ -81,7 +73,7 @@ const ButtonInner = React.forwardRef<
81
73
  <Component
82
74
  ref={ref}
83
75
  onClick={props.onClick}
84
- className={cn(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
76
+ className={cls(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
85
77
  {...(props as React.ComponentPropsWithRef<any>)}>
86
78
  {startIcon}
87
79
  {children}
@@ -93,7 +85,7 @@ const ButtonInner = React.forwardRef<
93
85
  <button ref={ref as any}
94
86
  type={props.type ?? "button"}
95
87
  onClick={props.onClick}
96
- className={cn(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
88
+ className={cls(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
97
89
  disabled={disabled}
98
90
  {...props as React.ButtonHTMLAttributes<HTMLButtonElement>}>
99
91
  {startIcon}
@@ -1,19 +1,21 @@
1
1
  import React, { useCallback } from "react";
2
2
  import { cardClickableMixin, cardMixin, focusedMixin } from "../styles";
3
- import { cn } from "../util";
3
+ import { cls } 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
- className={cn(cardMixin, onClick && focusedMixin, onClick && cardClickableMixin, className)}
30
- style={style}>
32
+ className={cls(cardMixin, onClick && focusedMixin, onClick && cardClickableMixin, className)}
33
+ style={style}
34
+ {...props}>
31
35
  {children}
32
36
  </div>
33
- )
34
- }
37
+ );
38
+ });
39
+
40
+ export { Card };
@@ -1,22 +1,34 @@
1
1
  import React from "react";
2
2
  import { Container } from "./Container";
3
- import { cn } from "../util";
3
+ import { cls } from "../util";
4
4
 
5
- export function CenteredView({
6
- children,
7
- maxWidth,
8
- className
9
- }: {
5
+ export type CenteredViewProps = {
10
6
  children: React.ReactNode;
11
7
  maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
8
+ outerClassName?: string;
12
9
  className?: string;
13
- }) {
10
+ fullScreen?: boolean;
11
+ };
14
12
 
15
- return <div className={"flex flex-col flex-grow h-full"}>
16
- <Container className={cn("m-auto", className)}
17
- maxWidth={maxWidth}>
18
- {children}
19
- </Container>
20
- </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
21
21
 
22
- }
22
+ return (
23
+ <div ref={ref}
24
+ className={cls("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full", outerClassName)}
25
+ {...rest}>
26
+ <Container className={cls("m-auto", className)} maxWidth={maxWidth}>
27
+ {children}
28
+ </Container>
29
+ </div>
30
+ );
31
+
32
+ });
33
+
34
+ CenteredView.displayName = "CenteredView";
@@ -2,27 +2,37 @@ import React from "react";
2
2
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
3
 
4
4
  import { Icon } from "../icons";
5
- import { cn } from "../util";
5
+ import { cls } 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;
12
- size?: "small" | "medium" | "large";
13
+ padding?: boolean;
14
+ size?: "tiny" | "small" | "medium" | "large";
13
15
  color?: "primary" | "secondary";
14
16
  }
15
17
 
16
18
  const sizeClasses = {
17
19
  large: "w-6 h-6 rounded flex items-center justify-center",
18
20
  medium: "w-5 h-5 rounded flex items-center justify-center",
19
- small: "w-4 h-4 rounded flex items-center justify-center"
21
+ small: "w-4 h-4 rounded flex items-center justify-center",
22
+ tiny: "w-4 h-4 rounded flex items-center justify-center"
20
23
  };
21
24
 
22
25
  const outerSizeClasses = {
23
26
  medium: "w-10 h-10",
24
27
  small: "w-8 h-8",
25
- large: "w-12 h-12"
28
+ large: "w-12 h-12 ",
29
+ tiny: "w-6 h-6"
30
+ }
31
+ const paddingClasses = {
32
+ medium: "p-2",
33
+ small: "p-2",
34
+ large: "p-2",
35
+ tiny: ""
26
36
  }
27
37
 
28
38
  const colorClasses = {
@@ -31,8 +41,10 @@ const colorClasses = {
31
41
  }
32
42
 
33
43
  export const Checkbox = ({
44
+ id,
34
45
  checked,
35
46
  indeterminate = false,
47
+ padding = true,
36
48
  disabled,
37
49
  size = "medium",
38
50
  onCheckedChange,
@@ -45,21 +57,25 @@ export const Checkbox = ({
45
57
  ? 20
46
58
  : size === "small"
47
59
  ? 16
48
- : 24;
60
+ : size === "tiny"
61
+ ? 14
62
+ : 24;
49
63
  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}>
64
+ <CheckboxPrimitive.Root
65
+ id={id}
66
+ checked={indeterminate || isChecked}
67
+ disabled={disabled}
68
+ onCheckedChange={disabled ? undefined : onCheckedChange}>
69
+
70
+ <div className={cls(
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
+ )}>
61
77
  <div
62
- className={cn(
78
+ className={cls(
63
79
  "border-2 relative transition-colors ease-in-out duration-150",
64
80
  sizeClasses[size],
65
81
  disabled
@@ -80,12 +96,7 @@ export const Checkbox = ({
80
96
  )}
81
97
  </CheckboxPrimitive.Indicator>
82
98
  </div>
83
- </CheckboxPrimitive.Root>
84
- {/*{indeterminate && (*/}
85
- {/* <div >*/}
86
- {/* YO*/}
87
- {/* </div>*/}
88
- {/*)}*/}
89
- </div>
99
+ </div>
100
+ </CheckboxPrimitive.Root>
90
101
  );
91
102
  };