@firecms/ui 3.0.0-canary.14 → 3.0.0-canary.140

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 (107) hide show
  1. package/README.md +3 -3
  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 +5 -7
  8. package/dist/components/Dialog.d.ts +4 -1
  9. package/dist/components/DialogTitle.d.ts +9 -0
  10. package/dist/components/ExpandablePanel.d.ts +2 -1
  11. package/dist/components/FileUpload.d.ts +1 -1
  12. package/dist/components/InputLabel.d.ts +2 -2
  13. package/dist/components/Label.d.ts +4 -1
  14. package/dist/components/Markdown.d.ts +1 -0
  15. package/dist/components/Menu.d.ts +6 -2
  16. package/dist/components/Menubar.d.ts +79 -0
  17. package/dist/components/MultiSelect.d.ts +31 -16
  18. package/dist/components/Popover.d.ts +2 -1
  19. package/dist/components/RadioGroup.d.ts +26 -3
  20. package/dist/components/Select.d.ts +6 -10
  21. package/dist/components/Separator.d.ts +2 -1
  22. package/dist/components/Sheet.d.ts +6 -0
  23. package/dist/components/Slider.d.ts +21 -0
  24. package/dist/components/Table.d.ts +10 -10
  25. package/dist/components/TextField.d.ts +1 -1
  26. package/dist/components/TextareaAutosize.d.ts +3 -34
  27. package/dist/components/Tooltip.d.ts +6 -2
  28. package/dist/components/Typography.d.ts +5 -4
  29. package/dist/components/index.d.ts +3 -1
  30. package/dist/hooks/index.d.ts +3 -0
  31. package/dist/icons/Icon.d.ts +3 -3
  32. package/dist/index.css +73 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.es.js +13371 -14447
  35. package/dist/index.es.js.map +1 -1
  36. package/dist/index.umd.js +19782 -857
  37. package/dist/index.umd.js.map +1 -1
  38. package/dist/styles.d.ts +8 -8
  39. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  40. package/dist/util/index.d.ts +1 -3
  41. package/package.json +111 -118
  42. package/src/components/Alert.tsx +2 -2
  43. package/src/components/Autocomplete.tsx +5 -3
  44. package/src/components/Avatar.tsx +8 -7
  45. package/src/components/Badge.tsx +1 -1
  46. package/src/components/BooleanSwitch.tsx +15 -15
  47. package/src/components/BooleanSwitchWithLabel.tsx +9 -8
  48. package/src/components/Button.tsx +18 -20
  49. package/src/components/Card.tsx +4 -3
  50. package/src/components/CenteredView.tsx +25 -15
  51. package/src/components/Checkbox.tsx +11 -9
  52. package/src/components/Chip.tsx +8 -5
  53. package/src/components/CircularProgress.tsx +2 -2
  54. package/src/components/Collapse.tsx +4 -2
  55. package/src/components/Container.tsx +2 -2
  56. package/src/components/DateTimeField.tsx +142 -921
  57. package/src/components/DebouncedTextField.tsx +1 -0
  58. package/src/components/Dialog.tsx +16 -6
  59. package/src/components/DialogActions.tsx +2 -2
  60. package/src/components/DialogContent.tsx +2 -2
  61. package/src/components/DialogTitle.tsx +35 -0
  62. package/src/components/ExpandablePanel.tsx +20 -12
  63. package/src/components/FileUpload.tsx +8 -10
  64. package/src/components/IconButton.tsx +4 -6
  65. package/src/components/InfoLabel.tsx +2 -2
  66. package/src/components/InputLabel.tsx +11 -9
  67. package/src/components/Label.tsx +17 -4
  68. package/src/components/Markdown.tsx +15 -3
  69. package/src/components/Menu.tsx +49 -31
  70. package/src/components/Menubar.tsx +322 -0
  71. package/src/components/MultiSelect.tsx +336 -165
  72. package/src/components/Paper.tsx +2 -2
  73. package/src/components/Popover.tsx +18 -14
  74. package/src/components/RadioGroup.tsx +41 -9
  75. package/src/components/SearchBar.tsx +9 -9
  76. package/src/components/Select.tsx +97 -124
  77. package/src/components/Separator.tsx +10 -4
  78. package/src/components/Sheet.tsx +52 -30
  79. package/src/components/Skeleton.tsx +9 -6
  80. package/src/components/Slider.tsx +109 -0
  81. package/src/components/Table.tsx +50 -33
  82. package/src/components/Tabs.tsx +6 -7
  83. package/src/components/TextField.tsx +14 -16
  84. package/src/components/TextareaAutosize.tsx +4 -3
  85. package/src/components/Tooltip.tsx +31 -14
  86. package/src/components/Typography.tsx +42 -26
  87. package/src/components/common/SelectInputLabel.tsx +2 -2
  88. package/src/components/index.tsx +3 -1
  89. package/src/hooks/index.ts +3 -0
  90. package/src/icons/Icon.tsx +46 -43
  91. package/src/icons/icon_keys.ts +114 -1301
  92. package/src/index.css +73 -0
  93. package/src/index.ts +1 -0
  94. package/src/scripts/generateIconKeys.ts +20 -11
  95. package/src/styles.ts +8 -8
  96. package/src/util/cls.ts +14 -0
  97. package/src/util/index.ts +1 -3
  98. package/tailwind.config.js +8 -6
  99. package/dist/components/Spinner.d.ts +0 -1
  100. package/src/components/Spinner.tsx +0 -18
  101. package/src/util/cn.ts +0 -6
  102. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  103. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  104. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  105. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  106. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  107. /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";
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";
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-70 dark:hover:bg-gray-700 dark:hover:bg-opacity-40";
8
+ export declare const defaultBorderMixin = "border-gray-200 border-opacity-40 dark:border-gray-700 dark:border-opacity-40";
9
+ export declare const paperMixin = "bg-white rounded-md dark:bg-gray-950 border border-gray-200 border-opacity-40 dark:border-gray-700 dark:border-opacity-40";
10
+ export declare const cardMixin = "bg-white border border-gray-200 border-opacity-40 dark:border-transparent rounded-md dark:bg-gray-950 dark:border-gray-700 dark:border-opacity-40 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,114 @@
1
1
  {
2
- "name": "@firecms/ui",
3
- "type": "module",
4
- "version": "3.0.0-canary.14",
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.140",
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": "42fe62aaa86f3330c79c7cbba551d9323299c141",
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.2",
53
+ "@radix-ui/react-collapsible": "^1.1.1",
54
+ "@radix-ui/react-dialog": "^1.1.2",
55
+ "@radix-ui/react-dropdown-menu": "^2.1.2",
56
+ "@radix-ui/react-label": "^2.1.0",
57
+ "@radix-ui/react-menubar": "^1.1.2",
58
+ "@radix-ui/react-popover": "^1.1.2",
59
+ "@radix-ui/react-portal": "^1.1.2",
60
+ "@radix-ui/react-radio-group": "^1.2.1",
61
+ "@radix-ui/react-scroll-area": "^1.2.0",
62
+ "@radix-ui/react-select": "^2.1.2",
63
+ "@radix-ui/react-separator": "^1.1.0",
64
+ "@radix-ui/react-slider": "^1.2.1",
65
+ "@radix-ui/react-switch": "^1.1.1",
66
+ "@radix-ui/react-tabs": "^1.1.1",
67
+ "@radix-ui/react-tooltip": "^1.1.3",
68
+ "@radix-ui/react-visually-hidden": "^1.1.0",
69
+ "clsx": "^2.1.1",
70
+ "cmdk": "^0.2.1",
71
+ "date-fns": "^3.6.0",
72
+ "markdown-it": "^14.1.0",
73
+ "material-icons": "^1.13.12",
74
+ "react-dropzone": "^14.2.9",
75
+ "react-fast-compare": "^3.2.2",
76
+ "tailwind-merge": "^2.5.3"
77
+ },
78
+ "peerDependencies": {
79
+ "react": "^18.3.1",
80
+ "react-dom": "^18.3.1"
81
+ },
82
+ "devDependencies": {
83
+ "@jest/globals": "^29.7.0",
84
+ "@testing-library/jest-dom": "^6.5.0",
85
+ "@testing-library/react": "^16.0.1",
86
+ "@testing-library/user-event": "^14.5.2",
87
+ "@types/jest": "^29.5.13",
88
+ "@types/node": "^20.16.11",
89
+ "@types/object-hash": "^3.0.6",
90
+ "@types/react": "^18.3.11",
91
+ "@types/react-dom": "^18.3.0",
92
+ "@types/react-measure": "^2.0.12",
93
+ "@vitejs/plugin-react": "^4.3.2",
94
+ "cross-env": "^7.0.3",
95
+ "firebase": "^10.14.0",
96
+ "jest": "^29.7.0",
97
+ "npm-run-all": "^4.1.5",
98
+ "ts-jest": "^29.2.5",
99
+ "ts-node": "^10.9.2",
100
+ "tsd": "^0.31.2",
101
+ "typescript": "^5.6.3",
102
+ "vite": "^5.4.8",
103
+ "vite-plugin-static-copy": "^1.0.6"
104
+ },
105
+ "files": [
106
+ "dist",
107
+ "src",
108
+ "tailwind.config.js"
109
+ ],
110
+ "gitHead": "112132e315d1ae63babf9f53500c00bc37a2d8e4",
111
+ "publishConfig": {
112
+ "access": "public"
113
+ }
121
114
  }
@@ -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",
@@ -1,8 +1,10 @@
1
+ "use client";
1
2
  import React from "react";
2
3
 
3
4
  import { paperMixin } from "../styles";
4
5
  import { Collapse } from "./Collapse";
5
- import { cn, useOutsideAlerter } from "../util";
6
+ import { cls } from "../util";
7
+ import { useOutsideAlerter } from "../hooks";
6
8
 
7
9
  export type AutocompleteProps = {
8
10
  children: React.ReactNode;
@@ -49,14 +51,14 @@ export function Autocomplete({
49
51
  return <Collapse
50
52
  in={open}
51
53
  duration={50}
52
- className={cn(
54
+ className={cls(
53
55
  "absolute top-full left-0 right-0 overflow-visible",
54
56
  open ? "shadow" : "",
55
57
  "my-2",
56
58
  "z-20",
57
59
  "w-full")}>
58
60
  <div ref={autocompleteRef}
59
- className={cn(
61
+ className={cls(
60
62
  open ? paperMixin : "",
61
63
  "bg-slate-50 dark:bg-slate-900 py-2"
62
64
  )}>
@@ -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,
30
- "p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12",
29
+ className={cls("rounded-full flex items-center justify-center overflow-hidden",
30
+ "p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12 min-w-12 min-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
  />}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import React from "react";
2
3
  import {
3
4
  fieldBackgroundDisabledMixin,
@@ -6,7 +7,7 @@ import {
6
7
  focusedClasses
7
8
  } from "../styles";
8
9
  import { BooleanSwitch, BooleanSwitchProps } from "./BooleanSwitch";
9
- import { cn } from "../util";
10
+ import { cls } from "../util";
10
11
 
11
12
  export type BooleanSwitchWithLabelProps = BooleanSwitchProps & {
12
13
  position?: "start" | "end",
@@ -53,16 +54,16 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
53
54
  onFocus={onFocus}
54
55
  onBlur={onBlur}
55
56
  tabIndex={-1}
56
- className={cn(
57
+ className={cls(
57
58
  !invisible && fieldBackgroundMixin,
58
59
  !invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
59
60
  disabled ? "cursor-default" : "cursor-pointer",
60
- "rounded-md relative max-w-full justify-between w-full box-border relative inline-flex items-center",
61
+ "rounded-md max-w-full justify-between w-full box-border relative inline-flex items-center",
61
62
  !invisible && focus && !disabled ? focusedClasses : "",
62
63
  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",
64
+ size === "smallest" ? "min-h-[40px]" : (size === "small" ? "min-h-[48px]" : "min-h-[64px]"),
65
+ size === "smallest" ? "pl-2" : "pl-4",
66
+ size === "smallest" ? "pr-4" : "pr-6",
66
67
  position === "end" ? "flex-row-reverse" : "flex-row"
67
68
  )}
68
69
  onClick={disabled ? undefined : (e) => {
@@ -86,10 +87,10 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
86
87
  {...props}
87
88
  />
88
89
 
89
- <div className={cn(
90
+ <div className={cls(
90
91
  "flex-grow",
91
92
  position === "end" ? "mr-4" : "ml-4",
92
- size === "small" ? "text-sm" : "text-base"
93
+ size === "smallest" ? "text-sm" : "text-base"
93
94
  )}>
94
95
  {label}
95
96
  </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,33 +30,33 @@ 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
+ "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-2 px-4 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-primary 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-secondary 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-red-500 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-slate-200 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
- "border border-transparent text-primary hover:bg-slate-200 dark:hover:bg-gray-900": variant === "text" && color === "primary" && !disabled,
47
- "border border-transparent text-secondary hover:bg-secondary-bg": variant === "text" && color === "secondary" && !disabled,
48
- "border border-transparent text-red-500 hover:bg-red-500 hover:bg-opacity-10": variant === "text" && color === "error" && !disabled,
49
- "border border-transparent text-text-primary dark:text-text-primary-dark hover:bg-slate-200 hover:dark:bg-gray-700": variant === "text" && color === "text" && !disabled,
44
+ "border border-transparent text-primary hover:text-primary hover:bg-slate-200 dark:hover:bg-gray-900": variant === "text" && color === "primary" && !disabled,
45
+ "border border-transparent text-secondary hover:text-secondary hover:bg-secondary-bg": variant === "text" && color === "secondary" && !disabled,
46
+ "border border-transparent text-red-500 hover:text-red-500 hover:bg-red-500 hover:bg-opacity-10": variant === "text" && color === "error" && !disabled,
47
+ "border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark hover:bg-slate-200 hover:dark:bg-gray-700": variant === "text" && color === "text" && !disabled,
50
48
  // Outlined Variants
51
- "border border-primary text-primary hover:bg-primary-bg": variant === "outlined" && color === "primary" && !disabled,
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,
54
- "border border-slate-400 text-text-primary dark:text-text-primary-dark hover:bg-slate-200": variant === "outlined" && color === "text" && !disabled,
49
+ "border border-primary text-primary hover:text-primary hover:bg-primary-bg": variant === "outlined" && color === "primary" && !disabled,
50
+ "border border-secondary text-secondary hover:text-secondary hover:bg-secondary-bg": variant === "outlined" && color === "secondary" && !disabled,
51
+ "border border-red-500 text-red-500 hover:text-red-500 hover:bg-red-500 hover:text-white": variant === "outlined" && color === "error" && !disabled,
52
+ "border border-slate-400 text-text-primary hover: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,
57
55
  "border border-gray-500 opacity-50": variant === "outlined" && disabled,
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,7 @@
1
+ "use client";
1
2
  import React, { useCallback } from "react";
2
- import { cardClickableMixin, cardMixin, focusedMixin } from "../styles";
3
- import { cn } from "../util";
3
+ import { cardClickableMixin, cardMixin } from "../styles";
4
+ import { cls } from "../util";
4
5
 
5
6
  type CardProps = {
6
7
  children: React.ReactNode;
@@ -29,7 +30,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(({
29
30
  role={onClick ? "button" : undefined}
30
31
  tabIndex={onClick ? 0 : undefined}
31
32
  onClick={onClick}
32
- className={cn(cardMixin, onClick && focusedMixin, onClick && cardClickableMixin, className)}
33
+ className={cls(cardMixin, onClick && cardClickableMixin, className)}
33
34
  style={style}
34
35
  {...props}>
35
36
  {children}