@firecms/ui 3.0.0-beta.8 → 3.0.0-beta.9
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.
- package/dist/components/BooleanSwitch.d.ts +1 -1
- package/dist/components/Checkbox.d.ts +1 -1
- package/dist/components/Chip.d.ts +3 -2
- package/dist/components/DateTimeField.d.ts +2 -3
- package/dist/components/Dialog.d.ts +4 -1
- package/dist/components/Menu.d.ts +4 -1
- package/dist/components/Menubar.d.ts +19 -9
- package/dist/components/MultiSelect.d.ts +31 -16
- package/dist/components/Popover.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +1 -0
- package/dist/components/Select.d.ts +5 -9
- package/dist/components/Separator.d.ts +2 -1
- package/dist/components/Sheet.d.ts +4 -0
- package/dist/components/Table.d.ts +10 -10
- package/dist/components/Tooltip.d.ts +6 -2
- package/dist/components/_MultiSelect.d.ts +0 -0
- package/dist/icons/Icon.d.ts +1 -1
- package/dist/index.css +77 -0
- package/dist/index.es.js +13036 -13690
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19684 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.d.ts +3 -3
- package/package.json +109 -106
- package/src/components/Avatar.tsx +0 -2
- package/src/components/BooleanSwitch.tsx +11 -11
- package/src/components/BooleanSwitchWithLabel.tsx +4 -4
- package/src/components/Button.tsx +6 -8
- package/src/components/Card.tsx +2 -2
- package/src/components/Checkbox.tsx +5 -5
- package/src/components/Chip.tsx +7 -4
- package/src/components/DateTimeField.tsx +30 -41
- package/src/components/Dialog.tsx +11 -2
- package/src/components/ExpandablePanel.tsx +3 -3
- package/src/components/FileUpload.tsx +1 -2
- package/src/components/IconButton.tsx +1 -3
- package/src/components/InputLabel.tsx +4 -2
- package/src/components/Menu.tsx +38 -26
- package/src/components/Menubar.tsx +42 -7
- package/src/components/MultiSelect.tsx +333 -164
- package/src/components/Popover.tsx +15 -13
- package/src/components/RadioGroup.tsx +1 -0
- package/src/components/SearchBar.tsx +1 -2
- package/src/components/Select.tsx +98 -119
- package/src/components/Separator.tsx +10 -4
- package/src/components/Sheet.tsx +39 -22
- package/src/components/Skeleton.tsx +1 -1
- package/src/components/Table.tsx +48 -30
- package/src/components/Tabs.tsx +2 -3
- package/src/components/TextField.tsx +2 -6
- package/src/components/Tooltip.tsx +26 -11
- package/src/components/Typography.tsx +14 -16
- package/src/components/_MultiSelect.tsx +222 -0
- package/src/icons/Icon.tsx +2 -2
- package/src/icons/icon_keys.ts +114 -1301
- package/src/index.css +77 -0
- package/src/scripts/generateIconKeys.ts +20 -10
- package/src/styles.ts +3 -3
- package/tailwind.config.js +3 -3
package/dist/styles.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const
|
|
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
4
|
export declare const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-800 dark:bg-opacity-60";
|
|
5
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-
|
|
7
|
-
export declare const fieldBackgroundHoverMixin = "hover:bg-opacity-
|
|
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
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
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";
|
package/package.json
CHANGED
|
@@ -1,109 +1,112 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "@firecms/ui",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.0.0-beta.9",
|
|
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
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"@types/object-hash": "^3.0.6",
|
|
86
|
-
"@types/react": "^18.3.3",
|
|
87
|
-
"@types/react-dom": "^18.3.0",
|
|
88
|
-
"@types/react-measure": "^2.0.12",
|
|
89
|
-
"@vitejs/plugin-react": "^4.3.1",
|
|
90
|
-
"cross-env": "^7.0.3",
|
|
91
|
-
"firebase": "^10.12.2",
|
|
92
|
-
"jest": "^29.7.0",
|
|
93
|
-
"npm-run-all": "^4.1.5",
|
|
94
|
-
"ts-jest": "^29.1.5",
|
|
95
|
-
"ts-node": "^10.9.2",
|
|
96
|
-
"tsd": "^0.31.1",
|
|
97
|
-
"typescript": "^5.5.3",
|
|
98
|
-
"vite": "^5.3.2"
|
|
99
|
-
},
|
|
100
|
-
"files": [
|
|
101
|
-
"dist",
|
|
102
|
-
"src",
|
|
103
|
-
"tailwind.config.js"
|
|
104
|
-
],
|
|
105
|
-
"gitHead": "4ef14d60f86cb2e581b908a1dc84ad6a87b14e2e",
|
|
106
|
-
"publishConfig": {
|
|
107
|
-
"access": "public"
|
|
108
|
-
}
|
|
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": "a2fffa74049d185e674aae9f70b462f011edd1c2",
|
|
109
|
+
"publishConfig": {
|
|
110
|
+
"access": "public"
|
|
111
|
+
}
|
|
109
112
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { cls } from "../util";
|
|
3
|
-
import { focusedMixin } from "../styles";
|
|
4
3
|
|
|
5
4
|
export interface AvatarProps {
|
|
6
5
|
src?: string;
|
|
@@ -28,7 +27,6 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
|
|
|
28
27
|
style={style}
|
|
29
28
|
{...props}
|
|
30
29
|
className={cls("rounded-full flex items-center justify-center overflow-hidden",
|
|
31
|
-
focusedMixin,
|
|
32
30
|
"p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12",
|
|
33
31
|
outerClassName
|
|
34
32
|
)}>
|
|
@@ -5,7 +5,7 @@ export type BooleanSwitchProps = {
|
|
|
5
5
|
value: boolean | null;
|
|
6
6
|
className?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
size?: "
|
|
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 = "
|
|
23
|
+
size = "small",
|
|
24
24
|
...props
|
|
25
25
|
}: BooleanSwitchProps, ref: React.Ref<HTMLButtonElement>) {
|
|
26
26
|
return <button
|
|
@@ -40,7 +40,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
|
40
40
|
}
|
|
41
41
|
}}
|
|
42
42
|
className={cls(
|
|
43
|
-
size === "
|
|
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"
|
|
@@ -55,10 +55,10 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
|
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 === "
|
|
59
|
-
"w-[19px] h-[8px]": size === "
|
|
60
|
-
"translate-x-[10px]": size === "
|
|
61
|
-
"translate-x-[9px]": size === "
|
|
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
|
/>}
|
|
@@ -69,10 +69,10 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
|
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 === "
|
|
73
|
-
"w-[19px] h-[19px]": size === "
|
|
74
|
-
[value ? "translate-x-[19px]" : "translate-x-[3px]"]: size === "
|
|
75
|
-
[value ? "translate-x-[17px]" : "translate-x-[2px]"]: size === "
|
|
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
|
/>}
|
|
@@ -60,9 +60,9 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
|
|
|
60
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 === "
|
|
64
|
-
size === "
|
|
65
|
-
size === "
|
|
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) => {
|
|
@@ -89,7 +89,7 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
|
|
|
89
89
|
<div className={cls(
|
|
90
90
|
"flex-grow",
|
|
91
91
|
position === "end" ? "mr-4" : "ml-4",
|
|
92
|
-
size === "
|
|
92
|
+
size === "smallest" ? "text-sm" : "text-base"
|
|
93
93
|
)}>
|
|
94
94
|
{label}
|
|
95
95
|
</div>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { focusedMixin } from "../styles";
|
|
4
2
|
import { cls } from "../util";
|
|
5
3
|
|
|
6
4
|
export type ButtonProps<P extends React.ElementType> =
|
|
@@ -38,10 +36,10 @@ const ButtonInner = React.forwardRef<
|
|
|
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,
|
|
@@ -73,7 +71,7 @@ const ButtonInner = React.forwardRef<
|
|
|
73
71
|
<Component
|
|
74
72
|
ref={ref}
|
|
75
73
|
onClick={props.onClick}
|
|
76
|
-
className={cls(
|
|
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={cls(
|
|
86
|
+
className={cls(startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
|
|
89
87
|
disabled={disabled}
|
|
90
88
|
{...props as React.ButtonHTMLAttributes<HTMLButtonElement>}>
|
|
91
89
|
{startIcon}
|
package/src/components/Card.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
|
-
import { cardClickableMixin, cardMixin
|
|
2
|
+
import { cardClickableMixin, cardMixin } from "../styles";
|
|
3
3
|
import { cls } from "../util";
|
|
4
4
|
|
|
5
5
|
type CardProps = {
|
|
@@ -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={cls(cardMixin, onClick &&
|
|
32
|
+
className={cls(cardMixin, onClick && cardClickableMixin, className)}
|
|
33
33
|
style={style}
|
|
34
34
|
{...props}>
|
|
35
35
|
{children}
|
|
@@ -11,7 +11,7 @@ export interface CheckboxProps {
|
|
|
11
11
|
indeterminate?: boolean;
|
|
12
12
|
onCheckedChange?: (checked: boolean) => void;
|
|
13
13
|
padding?: boolean;
|
|
14
|
-
size?: "
|
|
14
|
+
size?: "smallest" | "small" | "medium" | "large";
|
|
15
15
|
color?: "primary" | "secondary";
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -19,20 +19,20 @@ const sizeClasses = {
|
|
|
19
19
|
large: "w-6 h-6 rounded flex items-center justify-center",
|
|
20
20
|
medium: "w-5 h-5 rounded flex items-center justify-center",
|
|
21
21
|
small: "w-4 h-4 rounded flex items-center justify-center",
|
|
22
|
-
|
|
22
|
+
smallest: "w-4 h-4 rounded flex items-center justify-center"
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const outerSizeClasses = {
|
|
26
26
|
medium: "w-10 h-10",
|
|
27
27
|
small: "w-8 h-8",
|
|
28
28
|
large: "w-12 h-12 ",
|
|
29
|
-
|
|
29
|
+
smallest: "w-6 h-6"
|
|
30
30
|
}
|
|
31
31
|
const paddingClasses = {
|
|
32
32
|
medium: "p-2",
|
|
33
33
|
small: "p-2",
|
|
34
34
|
large: "p-2",
|
|
35
|
-
|
|
35
|
+
smallest: ""
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const colorClasses = {
|
|
@@ -57,7 +57,7 @@ export const Checkbox = ({
|
|
|
57
57
|
? 20
|
|
58
58
|
: size === "small"
|
|
59
59
|
? 16
|
|
60
|
-
: size === "
|
|
60
|
+
: size === "smallest"
|
|
61
61
|
? 14
|
|
62
62
|
: 24;
|
|
63
63
|
return (
|
package/src/components/Chip.tsx
CHANGED
|
@@ -11,16 +11,17 @@ export type ChipColorKey = keyof typeof CHIP_COLORS;
|
|
|
11
11
|
export interface ChipProps {
|
|
12
12
|
className?: string;
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
-
size?: "
|
|
14
|
+
size?: "smallest" | "small" | "medium";
|
|
15
15
|
colorScheme?: ChipColorScheme | ChipColorKey;
|
|
16
16
|
error?: boolean;
|
|
17
17
|
outlined?: boolean;
|
|
18
18
|
onClick?: () => void;
|
|
19
19
|
icon?: React.ReactNode;
|
|
20
|
+
style?: React.CSSProperties;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const sizeClassNames = {
|
|
23
|
-
|
|
24
|
+
smallest: "px-2 py-0.5 text-sm",
|
|
24
25
|
small: "px-3 py-1 text-sm",
|
|
25
26
|
medium: "px-4 py-1.5 text-sm"
|
|
26
27
|
}
|
|
@@ -36,13 +37,14 @@ export function Chip({
|
|
|
36
37
|
onClick,
|
|
37
38
|
icon,
|
|
38
39
|
size = "medium",
|
|
39
|
-
className
|
|
40
|
+
className,
|
|
41
|
+
style
|
|
40
42
|
}: ChipProps) {
|
|
41
43
|
|
|
42
44
|
const usedColorScheme = typeof colorScheme === "string" ? getColorSchemeForKey(colorScheme) : colorScheme;
|
|
43
45
|
return (
|
|
44
46
|
<div
|
|
45
|
-
className={cls("rounded-lg w-
|
|
47
|
+
className={cls("rounded-lg max-w-full w-max h-fit font-regular inline-flex gap-1",
|
|
46
48
|
"text-ellipsis",
|
|
47
49
|
onClick ? "cursor-pointer hover:bg-slate-300 hover:dark:bg-slate-700" : "",
|
|
48
50
|
sizeClassNames[size],
|
|
@@ -54,6 +56,7 @@ export function Chip({
|
|
|
54
56
|
backgroundColor: error || !usedColorScheme ? undefined : usedColorScheme.color,
|
|
55
57
|
color: error || !usedColorScheme ? undefined : usedColorScheme.text,
|
|
56
58
|
overflow: "hidden",
|
|
59
|
+
...style
|
|
57
60
|
// display: "-webkit-box",
|
|
58
61
|
// WebkitLineClamp: 1,
|
|
59
62
|
// WebkitBoxOrient: "vertical",
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
// @ts-ignore
|
|
3
2
|
import DatePicker from "react-datepicker";
|
|
4
3
|
|
|
5
4
|
import { CalendarMonthIcon, ClearIcon, ErrorIcon } from "../icons";
|
|
6
5
|
import { IconButton } from "./IconButton";
|
|
7
|
-
import {
|
|
8
|
-
fieldBackgroundDisabledMixin,
|
|
9
|
-
fieldBackgroundHoverMixin,
|
|
10
|
-
fieldBackgroundMixin,
|
|
11
|
-
focusedMixin,
|
|
12
|
-
paperMixin
|
|
13
|
-
} from "../styles";
|
|
6
|
+
import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin, paperMixin } from "../styles";
|
|
14
7
|
import { InputLabel } from "./InputLabel";
|
|
15
8
|
import { Typography } from "./Typography";
|
|
16
9
|
import { cls } from "../util";
|
|
17
10
|
import { useInjectStyles } from "../hooks";
|
|
18
11
|
|
|
19
12
|
interface DateTimeFieldProps {
|
|
20
|
-
value?: Date;
|
|
21
|
-
onChange
|
|
13
|
+
value?: Date | null;
|
|
14
|
+
onChange?: (date: Date | null) => void;
|
|
15
|
+
|
|
22
16
|
mode?: "date" | "date_time";
|
|
23
17
|
disabled?: boolean;
|
|
24
18
|
clearable?: boolean;
|
|
@@ -29,7 +23,6 @@ interface DateTimeFieldProps {
|
|
|
29
23
|
style?: React.CSSProperties;
|
|
30
24
|
inputClassName?: string;
|
|
31
25
|
invisible?: boolean;
|
|
32
|
-
preventOpenOnFocus?: boolean;
|
|
33
26
|
locale?: string;
|
|
34
27
|
}
|
|
35
28
|
|
|
@@ -45,7 +38,6 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
|
45
38
|
className,
|
|
46
39
|
style,
|
|
47
40
|
inputClassName,
|
|
48
|
-
preventOpenOnFocus,
|
|
49
41
|
invisible,
|
|
50
42
|
locale
|
|
51
43
|
}) => {
|
|
@@ -61,7 +53,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
|
61
53
|
|
|
62
54
|
const handleClear = (e: React.MouseEvent) => {
|
|
63
55
|
e.preventDefault();
|
|
64
|
-
onChange(
|
|
56
|
+
onChange?.(null);
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
return (
|
|
@@ -97,7 +89,6 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
|
97
89
|
onChange={onChange}
|
|
98
90
|
disabled={false}
|
|
99
91
|
popperClassName={cls(paperMixin, "my-4 shadow")}
|
|
100
|
-
onClick={(e: any) => e.stopPropagation()}
|
|
101
92
|
onFocus={() => setFocused(true)}
|
|
102
93
|
onBlur={() => setFocused(false)}
|
|
103
94
|
showTimeSelect={mode === "date_time"}
|
|
@@ -110,7 +101,6 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
|
110
101
|
"w-full outline-none bg-transparent leading-normal text-base px-3",
|
|
111
102
|
clearable ? "pr-14" : "pr-12",
|
|
112
103
|
"rounded-md",
|
|
113
|
-
!invisible && focusedMixin,
|
|
114
104
|
size === "small" ? "min-h-[48px]" : "min-h-[64px]",
|
|
115
105
|
label ? "pt-[28px] pb-2" : "py-2",
|
|
116
106
|
inputClassName,
|
|
@@ -118,7 +108,6 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
|
118
108
|
)}
|
|
119
109
|
/>
|
|
120
110
|
|
|
121
|
-
|
|
122
111
|
<IconButton
|
|
123
112
|
onClick={() => {
|
|
124
113
|
// @ts-ignore
|
|
@@ -528,7 +517,7 @@ const datePickerCss = `
|
|
|
528
517
|
.react-datepicker__year-text--in-selecting-range,
|
|
529
518
|
.react-datepicker__year-text--in-range {
|
|
530
519
|
border-radius: 100%;
|
|
531
|
-
background-color: #
|
|
520
|
+
background-color: #186ef0;
|
|
532
521
|
color: #fff;
|
|
533
522
|
}
|
|
534
523
|
.react-datepicker__day--selected:hover, .react-datepicker__day--in-selecting-range:hover, .react-datepicker__day--in-range:hover,
|
|
@@ -541,22 +530,22 @@ const datePickerCss = `
|
|
|
541
530
|
.react-datepicker__year-text--selected:hover,
|
|
542
531
|
.react-datepicker__year-text--in-selecting-range:hover,
|
|
543
532
|
.react-datepicker__year-text--in-range:hover {
|
|
544
|
-
background-color: #
|
|
545
|
-
}
|
|
546
|
-
.react-datepicker__day--keyboard-selected,
|
|
547
|
-
.react-datepicker__month-text--keyboard-selected,
|
|
548
|
-
.react-datepicker__quarter-text--keyboard-selected,
|
|
549
|
-
.react-datepicker__year-text--keyboard-selected {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
.react-datepicker__day--keyboard-selected:hover,
|
|
555
|
-
.react-datepicker__month-text--keyboard-selected:hover,
|
|
556
|
-
.react-datepicker__quarter-text--keyboard-selected:hover,
|
|
557
|
-
.react-datepicker__year-text--keyboard-selected:hover {
|
|
558
|
-
|
|
559
|
-
}
|
|
533
|
+
background-color: #5698f9;
|
|
534
|
+
}
|
|
535
|
+
// .react-datepicker__day--keyboard-selected,
|
|
536
|
+
// .react-datepicker__month-text--keyboard-selected,
|
|
537
|
+
// .react-datepicker__quarter-text--keyboard-selected,
|
|
538
|
+
// .react-datepicker__year-text--keyboard-selected {
|
|
539
|
+
// border-radius: 100%;
|
|
540
|
+
// background-color: #5193f6;
|
|
541
|
+
// color: rgb(0, 0, 0);
|
|
542
|
+
// }
|
|
543
|
+
// .react-datepicker__day--keyboard-selected:hover,
|
|
544
|
+
// .react-datepicker__month-text--keyboard-selected:hover,
|
|
545
|
+
// .react-datepicker__quarter-text--keyboard-selected:hover,
|
|
546
|
+
// .react-datepicker__year-text--keyboard-selected:hover {
|
|
547
|
+
// background-color: #5193f6;
|
|
548
|
+
// }
|
|
560
549
|
.react-datepicker__day--in-selecting-range:not(.react-datepicker__day--in-range,
|
|
561
550
|
.react-datepicker__month-text--in-range,
|
|
562
551
|
.react-datepicker__quarter-text--in-range,
|
|
@@ -839,7 +828,7 @@ const datePickerCss = `
|
|
|
839
828
|
:is([data-theme="dark"]) .react-datepicker__month-read-view--down-arrow,
|
|
840
829
|
:is([data-theme="dark"]) .react-datepicker__month-year-read-view--down-arrow,
|
|
841
830
|
:is([data-theme="dark"]) .react-datepicker__navigation-icon::before {
|
|
842
|
-
border-color: #
|
|
831
|
+
border-color: #999;
|
|
843
832
|
}
|
|
844
833
|
|
|
845
834
|
|
|
@@ -913,7 +902,7 @@ const datePickerCss = `
|
|
|
913
902
|
:is([data-theme="dark"]) .react-datepicker__year-text--selected:hover,
|
|
914
903
|
:is([data-theme="dark"]) .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item:hover
|
|
915
904
|
{
|
|
916
|
-
background-color: #
|
|
905
|
+
background-color: #262626;
|
|
917
906
|
}
|
|
918
907
|
|
|
919
908
|
:is([data-theme="dark"]) .react-datepicker__day--selected,
|
|
@@ -931,12 +920,12 @@ const datePickerCss = `
|
|
|
931
920
|
background-color: #0e528f;
|
|
932
921
|
}
|
|
933
922
|
|
|
934
|
-
:is([data-theme="dark"]) .react-datepicker__day--keyboard-selected,
|
|
935
|
-
:is([data-theme="dark"]) .react-datepicker__month-text--keyboard-selected,
|
|
936
|
-
:is([data-theme="dark"]) .react-datepicker__quarter-text--keyboard-selected,
|
|
937
|
-
:is([data-theme="dark"]) .react-datepicker__year-text--keyboard-selected {
|
|
938
|
-
|
|
939
|
-
}
|
|
923
|
+
// :is([data-theme="dark"]) .react-datepicker__day--keyboard-selected,
|
|
924
|
+
// :is([data-theme="dark"]) .react-datepicker__month-text--keyboard-selected,
|
|
925
|
+
// :is([data-theme="dark"]) .react-datepicker__quarter-text--keyboard-selected,
|
|
926
|
+
// :is([data-theme="dark"]) .react-datepicker__year-text--keyboard-selected {
|
|
927
|
+
// background-color: #0e529f;
|
|
928
|
+
// }
|
|
940
929
|
|
|
941
930
|
:is([data-theme="dark"]) .react-datepicker__today-button {
|
|
942
931
|
background-color: #262626;
|