@firecms/ui 3.0.0-canary.12 → 3.0.0-canary.120

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 (101) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Avatar.d.ts +1 -0
  3. package/dist/components/BooleanSwitch.d.ts +1 -1
  4. package/dist/components/CenteredView.d.ts +4 -2
  5. package/dist/components/Checkbox.d.ts +3 -2
  6. package/dist/components/Chip.d.ts +3 -2
  7. package/dist/components/DateTimeField.d.ts +3 -4
  8. package/dist/components/Dialog.d.ts +4 -1
  9. package/dist/components/InputLabel.d.ts +2 -2
  10. package/dist/components/Label.d.ts +4 -1
  11. package/dist/components/Markdown.d.ts +1 -0
  12. package/dist/components/Menu.d.ts +6 -2
  13. package/dist/components/Menubar.d.ts +79 -0
  14. package/dist/components/MultiSelect.d.ts +1 -4
  15. package/dist/components/NewMultiSelect.d.ts +60 -0
  16. package/dist/components/Popover.d.ts +2 -1
  17. package/dist/components/RadioGroup.d.ts +26 -3
  18. package/dist/components/Select.d.ts +4 -4
  19. package/dist/components/Sheet.d.ts +4 -0
  20. package/dist/components/Table.d.ts +10 -10
  21. package/dist/components/TextField.d.ts +1 -1
  22. package/dist/components/TextareaAutosize.d.ts +3 -34
  23. package/dist/components/Tooltip.d.ts +5 -2
  24. package/dist/components/index.d.ts +2 -1
  25. package/dist/hooks/index.d.ts +4 -0
  26. package/dist/hooks/useLocaleConfig.d.ts +1 -0
  27. package/dist/icons/Icon.d.ts +3 -3
  28. package/dist/index.css +77 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.es.js +13290 -13511
  31. package/dist/index.es.js.map +1 -1
  32. package/dist/index.umd.js +19828 -49
  33. package/dist/index.umd.js.map +1 -1
  34. package/dist/styles.d.ts +7 -7
  35. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  36. package/dist/util/index.d.ts +1 -3
  37. package/package.json +109 -118
  38. package/src/components/Alert.tsx +2 -2
  39. package/src/components/Autocomplete.tsx +4 -3
  40. package/src/components/Avatar.tsx +7 -6
  41. package/src/components/Badge.tsx +1 -1
  42. package/src/components/BooleanSwitch.tsx +15 -15
  43. package/src/components/BooleanSwitchWithLabel.tsx +8 -8
  44. package/src/components/Button.tsx +11 -13
  45. package/src/components/Card.tsx +3 -3
  46. package/src/components/CenteredView.tsx +25 -15
  47. package/src/components/Checkbox.tsx +11 -9
  48. package/src/components/Chip.tsx +8 -5
  49. package/src/components/CircularProgress.tsx +2 -2
  50. package/src/components/Collapse.tsx +3 -2
  51. package/src/components/Container.tsx +2 -2
  52. package/src/components/DateTimeField.tsx +38 -48
  53. package/src/components/Dialog.tsx +15 -6
  54. package/src/components/DialogActions.tsx +2 -2
  55. package/src/components/DialogContent.tsx +2 -2
  56. package/src/components/ExpandablePanel.tsx +10 -8
  57. package/src/components/FileUpload.tsx +6 -9
  58. package/src/components/IconButton.tsx +4 -6
  59. package/src/components/InfoLabel.tsx +2 -2
  60. package/src/components/InputLabel.tsx +12 -9
  61. package/src/components/Label.tsx +17 -4
  62. package/src/components/Markdown.tsx +14 -3
  63. package/src/components/Menu.tsx +49 -31
  64. package/src/components/Menubar.tsx +322 -0
  65. package/src/components/MultiSelect.tsx +12 -14
  66. package/src/components/NewMultiSelect.tsx +370 -0
  67. package/src/components/Paper.tsx +2 -2
  68. package/src/components/Popover.tsx +17 -14
  69. package/src/components/RadioGroup.tsx +41 -9
  70. package/src/components/SearchBar.tsx +7 -8
  71. package/src/components/Select.tsx +92 -104
  72. package/src/components/Sheet.tsx +45 -28
  73. package/src/components/Skeleton.tsx +9 -6
  74. package/src/components/Table.tsx +50 -32
  75. package/src/components/Tabs.tsx +6 -7
  76. package/src/components/TextField.tsx +10 -13
  77. package/src/components/TextareaAutosize.tsx +3 -3
  78. package/src/components/Tooltip.tsx +27 -13
  79. package/src/components/Typography.tsx +34 -19
  80. package/src/components/common/SelectInputLabel.tsx +2 -2
  81. package/src/components/index.tsx +2 -1
  82. package/src/hooks/index.ts +4 -0
  83. package/src/hooks/useLocaleConfig.tsx +18 -0
  84. package/src/icons/Icon.tsx +46 -43
  85. package/src/icons/icon_keys.ts +114 -1301
  86. package/src/index.css +77 -0
  87. package/src/index.ts +1 -0
  88. package/src/scripts/generateIconKeys.ts +20 -11
  89. package/src/styles.ts +7 -7
  90. package/src/util/cls.ts +14 -0
  91. package/src/util/index.ts +1 -3
  92. package/tailwind.config.js +5 -3
  93. package/dist/components/Spinner.d.ts +0 -1
  94. package/src/components/Spinner.tsx +0 -18
  95. package/src/util/cn.ts +0 -6
  96. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  97. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  98. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  99. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  100. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  101. /package/src/{util → hooks}/useOutsideAlerter.tsx +0 -0
package/dist/styles.d.ts CHANGED
@@ -1,12 +1,12 @@
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";
1
+ export declare const focusedDisabled = "focus-visible:ring-0 focus-visible:ring-offset-0";
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-50 dark:bg-opacity-90";
7
+ export declare const fieldBackgroundHoverMixin = "hover:bg-opacity-50 dark:hover:bg-gray-700 dark:hover:bg-opacity-40";
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,121 +1,112 @@
1
1
  {
2
- "name": "@firecms/ui",
3
- "type": "module",
4
- "version": "3.0.0-canary.12",
5
- "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
- "funding": {
7
- "url": "https://github.com/sponsors/firecmsco"
2
+ "name": "@firecms/ui",
3
+ "type": "module",
4
+ "version": "3.0.0-canary.120",
5
+ "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
+ "funding": {
7
+ "url": "https://github.com/sponsors/firecmsco"
8
+ },
9
+ "author": "FireCMS",
10
+ "license": "MIT",
11
+ "repository": "git@github.com:FireCMSco/firecms.git",
12
+ "main": "./dist/index.umd.js",
13
+ "module": "./dist/index.es.js",
14
+ "types": "./dist/index.d.ts",
15
+ "source": "src/index.ts",
16
+ "engines": {
17
+ "node": ">=14"
18
+ },
19
+ "keywords": [
20
+ "firebase",
21
+ "cms",
22
+ "admin",
23
+ "admin panel",
24
+ "firebase panel",
25
+ "firestore",
26
+ "headless",
27
+ "headless cms",
28
+ "content manager"
29
+ ],
30
+ "exports": {
31
+ ".": {
32
+ "import": "./dist/index.es.js",
33
+ "require": "./dist/index.umd.js",
34
+ "types": "./dist/index.d.ts"
8
35
  },
9
- "author": "FireCMS",
10
- "license": "MIT",
11
- "repository": "git@github.com:FireCMSco/firecms.git",
12
- "main": "./dist/index.umd.js",
13
- "module": "./dist/index.es.js",
14
- "types": "./dist/index.d.ts",
15
- "source": "src/index.ts",
16
- "engines": {
17
- "node": ">=14"
18
- },
19
- "keywords": [
20
- "firebase",
21
- "cms",
22
- "admin",
23
- "admin panel",
24
- "firebase panel",
25
- "firestore",
26
- "headless",
27
- "headless cms",
28
- "content manager"
29
- ],
30
- "exports": {
31
- ".": {
32
- "import": "./dist/index.es.js",
33
- "require": "./dist/index.umd.js",
34
- "types": "./dist/index.d.ts"
35
- },
36
- "./package.json": "./package.json",
37
- "./tailwind.config.js": "./tailwind.config.js"
38
- },
39
- "scripts": {
40
- "watch": "vite build --watch",
41
- "build": "vite build && tsc --emitDeclarationOnly",
42
- "prepublishOnly": "run-s build",
43
- "createTag": "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags",
44
- "test:lint": "eslint \"src/**\" --quiet",
45
- "test": "jest",
46
- "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
47
- "generateIcons": "ts-node --esm src/scripts/generateIcons.ts"
48
- },
49
- "dependencies": {
50
- "@material-design-icons/font": "^0.14.13",
51
- "@radix-ui/react-checkbox": "^1.0.4",
52
- "@radix-ui/react-collapsible": "^1.0.3",
53
- "@radix-ui/react-dialog": "^1.0.5",
54
- "@radix-ui/react-dropdown-menu": "^2.0.6",
55
- "@radix-ui/react-label": "^2.0.2",
56
- "@radix-ui/react-popover": "^1.0.7",
57
- "@radix-ui/react-portal": "^1.0.4",
58
- "@radix-ui/react-radio-group": "^1.1.3",
59
- "@radix-ui/react-scroll-area": "^1.0.5",
60
- "@radix-ui/react-select": "^2.0.0",
61
- "@radix-ui/react-separator": "^1.0.3",
62
- "@radix-ui/react-switch": "^1.0.3",
63
- "@radix-ui/react-tabs": "^1.0.4",
64
- "@radix-ui/react-tooltip": "^1.0.7",
65
- "cmdk": "^0.2.1",
66
- "react-datepicker": "^6.4.0",
67
- "react-dropzone": "^14.2.3",
68
- "react-fast-compare": "^3.2.2",
69
- "tailwind-merge": "^2.2.2"
70
- },
71
- "peerDependencies": {
72
- "react": "^18.2.0",
73
- "react-dom": "^18.2.0"
74
- },
75
- "eslintConfig": {
76
- "extends": [
77
- "react-app",
78
- "react-app/jest"
79
- ]
80
- },
81
- "devDependencies": {
82
- "@jest/globals": "^29.7.0",
83
- "@testing-library/jest-dom": "^6.4.2",
84
- "@testing-library/react": "^14.2.1",
85
- "@testing-library/user-event": "^14.5.2",
86
- "@types/jest": "^29.5.12",
87
- "@types/node": "^20.11.30",
88
- "@types/object-hash": "^3.0.6",
89
- "@types/react": "^18.2.67",
90
- "@types/react-dom": "^18.2.22",
91
- "@types/react-measure": "^2.0.12",
92
- "@typescript-eslint/eslint-plugin": "^7.3.1",
93
- "@typescript-eslint/parser": "^7.3.1",
94
- "@vitejs/plugin-react": "^4.2.1",
95
- "cross-env": "^7.0.3",
96
- "eslint": "^8.57.0",
97
- "eslint-config-standard": "^17.1.0",
98
- "eslint-plugin-import": "^2.29.1",
99
- "eslint-plugin-n": "^16.6.2",
100
- "eslint-plugin-promise": "^6.1.1",
101
- "eslint-plugin-react": "^7.34.1",
102
- "eslint-plugin-react-hooks": "^4.6.0",
103
- "firebase": "^10.9.0",
104
- "jest": "^29.7.0",
105
- "npm-run-all": "^4.1.5",
106
- "ts-jest": "^29.1.2",
107
- "ts-node": "^10.9.2",
108
- "tsd": "^0.30.7",
109
- "typescript": "^5.4.2",
110
- "vite": "^5.2.3"
111
- },
112
- "files": [
113
- "dist",
114
- "src",
115
- "tailwind.config.js"
116
- ],
117
- "gitHead": "8bbe4916c2901f1cd63e6f507b844fc527c573c9",
118
- "publishConfig": {
119
- "access": "public"
120
- }
36
+ "./package.json": "./package.json",
37
+ "./tailwind.config.js": "./tailwind.config.js",
38
+ "./index.css": "./dist/index.css",
39
+ "./dist/index.css": "./dist/index.css"
40
+ },
41
+ "scripts": {
42
+ "watch": "vite build --watch",
43
+ "build": "vite build && tsc --emitDeclarationOnly",
44
+ "prepublishOnly": "run-s build",
45
+ "createTag": "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags",
46
+ "test:lint": "eslint \"src/**\" --quiet",
47
+ "test": "jest",
48
+ "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
49
+ "generateIcons": "ts-node --esm src/scripts/generateIcons.ts"
50
+ },
51
+ "dependencies": {
52
+ "@radix-ui/react-checkbox": "^1.1.1",
53
+ "@radix-ui/react-collapsible": "^1.1.0",
54
+ "@radix-ui/react-dialog": "^1.1.1",
55
+ "@radix-ui/react-dropdown-menu": "^2.1.1",
56
+ "@radix-ui/react-label": "^2.1.0",
57
+ "@radix-ui/react-menubar": "^1.1.1",
58
+ "@radix-ui/react-popover": "^1.1.1",
59
+ "@radix-ui/react-portal": "^1.1.1",
60
+ "@radix-ui/react-radio-group": "^1.2.0",
61
+ "@radix-ui/react-scroll-area": "^1.1.0",
62
+ "@radix-ui/react-select": "^2.1.1",
63
+ "@radix-ui/react-separator": "^1.1.0",
64
+ "@radix-ui/react-switch": "^1.1.0",
65
+ "@radix-ui/react-tabs": "^1.1.0",
66
+ "@radix-ui/react-tooltip": "^1.1.2",
67
+ "clsx": "^2.1.1",
68
+ "cmdk": "^0.2.1",
69
+ "date-fns": "^3.6.0",
70
+ "material-icons": "latest",
71
+ "react-datepicker": "^7.3.0",
72
+ "react-dropzone": "^14.2.3",
73
+ "react-fast-compare": "^3.2.2",
74
+ "tailwind-merge": "^2.4.0"
75
+ },
76
+ "peerDependencies": {
77
+ "react": "^18.3.1",
78
+ "react-dom": "^18.3.1"
79
+ },
80
+ "devDependencies": {
81
+ "@jest/globals": "^29.7.0",
82
+ "@testing-library/jest-dom": "^6.4.6",
83
+ "@testing-library/react": "^15.0.7",
84
+ "@testing-library/user-event": "^14.5.2",
85
+ "@types/jest": "^29.5.12",
86
+ "@types/node": "^20.14.12",
87
+ "@types/object-hash": "^3.0.6",
88
+ "@types/react": "^18.3.3",
89
+ "@types/react-dom": "^18.3.0",
90
+ "@types/react-measure": "^2.0.12",
91
+ "@vitejs/plugin-react": "^4.3.1",
92
+ "cross-env": "^7.0.3",
93
+ "firebase": "^10.12.4",
94
+ "jest": "^29.7.0",
95
+ "npm-run-all": "^4.1.5",
96
+ "ts-jest": "^29.2.3",
97
+ "ts-node": "^10.9.2",
98
+ "tsd": "^0.31.1",
99
+ "typescript": "^5.5.4",
100
+ "vite": "^5.3.4",
101
+ "vite-plugin-static-copy": "^1.0.6"
102
+ },
103
+ "files": [
104
+ "dist",
105
+ "src",
106
+ "tailwind.config.js"
107
+ ],
108
+ "gitHead": "aa817730cb582b5724774a50ac8a512bf0643ef3",
109
+ "publishConfig": {
110
+ "access": "public"
111
+ }
121
112
  }
@@ -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;
@@ -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,12 +1,12 @@
1
1
  import React from "react";
2
- import { cn } from "../util";
3
- import { focusedMixin } from "../styles";
2
+ import { cls } from "../util";
4
3
 
5
4
  export interface AvatarProps {
6
5
  src?: string;
7
6
  alt?: string;
8
7
  children?: React.ReactNode;
9
8
  className?: string;
9
+ outerClassName?: string;
10
10
  style?: React.CSSProperties;
11
11
  }
12
12
 
@@ -17,6 +17,7 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
17
17
  children,
18
18
  className,
19
19
  style,
20
+ outerClassName,
20
21
  ...props
21
22
  }, ref) => {
22
23
 
@@ -25,13 +26,13 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
25
26
  ref={ref}
26
27
  style={style}
27
28
  {...props}
28
- className={cn("rounded-full flex items-center justify-center overflow-hidden",
29
- focusedMixin,
29
+ className={cls("rounded-full flex items-center justify-center overflow-hidden",
30
30
  "p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12",
31
+ outerClassName
31
32
  )}>
32
33
  {src
33
34
  ? (
34
- <img className={cn(
35
+ <img className={cls(
35
36
  "bg-slate-100 dark:bg-slate-800",
36
37
  "w-full h-full object-cover rounded-full",
37
38
  className)}
@@ -40,7 +41,7 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
40
41
  )
41
42
  : (
42
43
  <span
43
- className={cn(
44
+ className={cls(
44
45
  "bg-slate-100 dark:bg-slate-800",
45
46
  "flex items-center justify-center",
46
47
  "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,11 +1,11 @@
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;
6
6
  className?: string;
7
7
  disabled?: boolean;
8
- size?: "small" | "medium";
8
+ size?: "smallest" | "small" | "medium";
9
9
  } & ({
10
10
  allowIndeterminate: true;
11
11
  onValueChange?: (newValue: boolean | null) => void;
@@ -20,7 +20,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
20
20
  className,
21
21
  onValueChange,
22
22
  disabled = false,
23
- size = "medium",
23
+ size = "small",
24
24
  ...props
25
25
  }: BooleanSwitchProps, ref: React.Ref<HTMLButtonElement>) {
26
26
  return <button
@@ -39,8 +39,8 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
39
39
  onValueChange?.(!value);
40
40
  }
41
41
  }}
42
- className={cn(
43
- size === "small" ? "w-[38px] h-[22px] min-w-[38px] min-h-[22px]" : "w-[42px] h-[26px] min-w-[42px] min-h-[26px]",
42
+ className={cls(
43
+ size === "smallest" ? "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
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"
@@ -51,28 +51,28 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
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
  {
58
- "w-[21px] h-[10px]": size === "medium",
59
- "w-[19px] h-[8px]": size === "small",
60
- "translate-x-[10px]": size === "medium",
61
- "translate-x-[9px]": size === "small"
58
+ "w-[21px] h-[10px]": size === "small" || size === "medium",
59
+ "w-[19px] h-[8px]": size === "smallest",
60
+ "translate-x-[10px]": size === "small" || size === "medium",
61
+ "translate-x-[9px]": size === "smallest"
62
62
  }
63
63
  )}
64
64
  />}
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
  {
72
- "w-[21px] h-[21px]": size === "medium",
73
- "w-[19px] h-[19px]": size === "small",
74
- [value ? "translate-x-[19px]" : "translate-x-[3px]"]: size === "medium",
75
- [value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "small"
72
+ "w-[21px] h-[21px]": size === "small" || size === "medium",
73
+ "w-[19px] h-[19px]": size === "smallest",
74
+ [value ? "translate-x-[19px]" : "translate-x-[3px]"]: size === "small" || size === "medium",
75
+ [value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "smallest"
76
76
  }
77
77
  )}
78
78
  />}
@@ -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,16 +53,16 @@ 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",
60
- "rounded-md relative max-w-full justify-between w-full box-border relative inline-flex items-center",
60
+ "rounded-md max-w-full justify-between w-full box-border relative inline-flex items-center",
61
61
  !invisible && focus && !disabled ? focusedClasses : "",
62
62
  error ? "text-red-500 dark:text-red-600" : (focus && !disabled ? "text-primary" : (!disabled ? "text-text-primary dark:text-text-primary-dark" : "text-text-secondary dark:text-text-secondary-dark")),
63
- size === "small" ? "min-h-[40px]" : "min-h-[64px]",
64
- size === "small" ? "pl-2" : "pl-4",
65
- size === "small" ? "pr-4" : "pr-6",
63
+ size === "smallest" ? "min-h-[40px]" : (size === "small" ? "min-h-[48px]" : "min-h-[64px]"),
64
+ size === "smallest" ? "pl-2" : "pl-4",
65
+ size === "smallest" ? "pr-4" : "pr-6",
66
66
  position === "end" ? "flex-row-reverse" : "flex-row"
67
67
  )}
68
68
  onClick={disabled ? undefined : (e) => {
@@ -86,10 +86,10 @@ 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
- size === "small" ? "text-sm" : "text-base"
92
+ size === "smallest" ? "text-sm" : "text-base"
93
93
  )}>
94
94
  {label}
95
95
  </div>
@@ -1,7 +1,5 @@
1
1
  import React from "react";
2
-
3
- import { focusedMixin } from "../styles";
4
- import { cn } from "../util";
2
+ import { cls } from "../util";
5
3
 
6
4
  export type ButtonProps<P extends React.ElementType> =
7
5
  Omit<(P extends "button" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<P>), "onClick">
@@ -32,16 +30,16 @@ const ButtonInner = React.forwardRef<
32
30
  }: ButtonProps<any>, ref) => {
33
31
 
34
32
  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";
33
+ "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
34
 
37
- const buttonClasses = cn({
35
+ const buttonClasses = cls({
38
36
  "w-full": fullWidth,
39
37
  "w-fit": !fullWidth,
40
38
  // Filled Variants
41
- "border border-transparent bg-primary hover:bg-primary-dark focus:ring-primary shadow hover:ring-1 hover:ring-primary text-white": variant === "filled" && color === "primary" && !disabled,
42
- "border border-transparent bg-secondary hover:bg-secondary-dark focus:ring-secondary shadow hover:ring-1 hover:ring-secondary text-white": variant === "filled" && color === "secondary" && !disabled,
43
- "border border-transparent bg-red-500 hover:bg-red-500 focus:ring-red-500 shadow hover:ring-1 hover:ring-red-600 text-white": variant === "filled" && color === "error" && !disabled,
44
- "border border-transparent bg-slate-200 hover:bg-slate-300 focus:ring-slate-400 shadow hover:ring-1 hover:ring-slate-400 text-text-primary dark:text-text-primary-dark": variant === "filled" && color === "text" && !disabled,
39
+ "border border-transparent bg-primary hover:bg-primary-dark focus:ring-primary shadow hover:ring-1 hover:ring-primary text-white hover:text-white": variant === "filled" && color === "primary" && !disabled,
40
+ "border border-transparent bg-secondary hover:bg-secondary-dark focus:ring-secondary shadow hover:ring-1 hover:ring-secondary text-white hover:text-white": variant === "filled" && color === "secondary" && !disabled,
41
+ "border border-transparent bg-red-500 hover:bg-red-500 focus:ring-red-500 shadow hover:ring-1 hover:ring-red-600 text-white hover:text-white": variant === "filled" && color === "error" && !disabled,
42
+ "border border-transparent bg-slate-200 hover:bg-slate-300 focus:ring-slate-400 shadow hover:ring-1 hover:ring-slate-400 text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark": variant === "filled" && color === "text" && !disabled,
45
43
  // Text Variants
46
44
  "border border-transparent text-primary hover:bg-slate-200 dark:hover:bg-gray-900": variant === "text" && color === "primary" && !disabled,
47
45
  "border border-transparent text-secondary hover:bg-secondary-bg": variant === "text" && color === "secondary" && !disabled,
@@ -50,7 +48,7 @@ const ButtonInner = React.forwardRef<
50
48
  // Outlined Variants
51
49
  "border border-primary text-primary hover:bg-primary-bg": variant === "outlined" && color === "primary" && !disabled,
52
50
  "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,
51
+ "border border-red-500 text-red-500 hover:bg-red-500 hover:text-white": variant === "outlined" && color === "error" && !disabled,
54
52
  "border border-slate-400 text-text-primary dark:text-text-primary-dark hover:bg-slate-200": variant === "outlined" && color === "text" && !disabled,
55
53
  // Disabled states for all variants
56
54
  "border border-transparent opacity-50": variant === "text" && disabled,
@@ -58,7 +56,7 @@ const ButtonInner = React.forwardRef<
58
56
  "border border-gray-500 bg-gray-500 opacity-50": variant === "filled" && disabled,
59
57
  });
60
58
 
61
- const sizeClasses = cn(
59
+ const sizeClasses = cls(
62
60
  {
63
61
  "py-1 px-2": size === "small",
64
62
  "py-2 px-4": size === "medium",
@@ -73,7 +71,7 @@ const ButtonInner = React.forwardRef<
73
71
  <Component
74
72
  ref={ref}
75
73
  onClick={props.onClick}
76
- className={cn(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
74
+ className={cls( startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
77
75
  {...(props as React.ComponentPropsWithRef<any>)}>
78
76
  {startIcon}
79
77
  {children}
@@ -85,7 +83,7 @@ const ButtonInner = React.forwardRef<
85
83
  <button ref={ref as any}
86
84
  type={props.type ?? "button"}
87
85
  onClick={props.onClick}
88
- className={cn(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
86
+ className={cls(startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
89
87
  disabled={disabled}
90
88
  {...props as React.ButtonHTMLAttributes<HTMLButtonElement>}>
91
89
  {startIcon}
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from "react";
2
- import { cardClickableMixin, cardMixin, focusedMixin } from "../styles";
3
- import { cn } from "../util";
2
+ import { cardClickableMixin, cardMixin } from "../styles";
3
+ import { cls } from "../util";
4
4
 
5
5
  type CardProps = {
6
6
  children: React.ReactNode;
@@ -29,7 +29,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(({
29
29
  role={onClick ? "button" : undefined}
30
30
  tabIndex={onClick ? 0 : undefined}
31
31
  onClick={onClick}
32
- className={cn(cardMixin, onClick && focusedMixin, onClick && cardClickableMixin, className)}
32
+ className={cls(cardMixin, onClick && cardClickableMixin, className)}
33
33
  style={style}
34
34
  {...props}>
35
35
  {children}
@@ -1,24 +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
- 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={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";