@firecms/ui 3.0.0-beta.7 → 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/InputLabel.d.ts +2 -2
- package/dist/components/Label.d.ts +2 -2
- 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/TextareaAutosize.d.ts +2 -35
- 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 +13044 -13693
- 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 +4 -4
- package/package.json +109 -121
- package/src/components/Avatar.tsx +0 -2
- package/src/components/BooleanSwitch.tsx +11 -11
- package/src/components/BooleanSwitchWithLabel.tsx +5 -5
- 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 +3 -6
- 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 +50 -12
- 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 +43 -26
- 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 +27 -12
- 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 +4 -4
- 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
|
-
export declare const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-
|
|
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,124 +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
|
-
"@jest/globals": "^29.7.0",
|
|
86
|
-
"@testing-library/jest-dom": "^6.4.5",
|
|
87
|
-
"@testing-library/react": "^15.0.7",
|
|
88
|
-
"@testing-library/user-event": "^14.5.2",
|
|
89
|
-
"@types/jest": "^29.5.12",
|
|
90
|
-
"@types/node": "^20.12.13",
|
|
91
|
-
"@types/object-hash": "^3.0.6",
|
|
92
|
-
"@types/react": "^18.3.3",
|
|
93
|
-
"@types/react-dom": "^18.3.0",
|
|
94
|
-
"@types/react-measure": "^2.0.12",
|
|
95
|
-
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
96
|
-
"@typescript-eslint/parser": "^7.11.0",
|
|
97
|
-
"@vitejs/plugin-react": "^4.3.0",
|
|
98
|
-
"cross-env": "^7.0.3",
|
|
99
|
-
"eslint": "^8.57.0",
|
|
100
|
-
"eslint-config-standard": "^17.1.0",
|
|
101
|
-
"eslint-plugin-import": "^2.29.1",
|
|
102
|
-
"eslint-plugin-n": "^16.6.2",
|
|
103
|
-
"eslint-plugin-promise": "^6.2.0",
|
|
104
|
-
"eslint-plugin-react": "^7.34.2",
|
|
105
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
106
|
-
"firebase": "^10.12.2",
|
|
107
|
-
"jest": "^29.7.0",
|
|
108
|
-
"npm-run-all": "^4.1.5",
|
|
109
|
-
"ts-jest": "^29.1.4",
|
|
110
|
-
"ts-node": "^10.9.2",
|
|
111
|
-
"tsd": "^0.31.0",
|
|
112
|
-
"typescript": "^5.4.5",
|
|
113
|
-
"vite": "^5.2.12"
|
|
114
|
-
},
|
|
115
|
-
"files": [
|
|
116
|
-
"dist",
|
|
117
|
-
"src",
|
|
118
|
-
"tailwind.config.js"
|
|
119
|
-
],
|
|
120
|
-
"gitHead": "b1f5dbd89d66bd75e8d214a4a6c40e07e371a1d1",
|
|
121
|
-
"publishConfig": {
|
|
122
|
-
"access": "public"
|
|
123
|
-
}
|
|
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
|
+
}
|
|
124
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?: "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 = "
|
|
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 === "medium",
|
|
59
|
-
"w-[19px] h-[8px]": size === "
|
|
60
|
-
"translate-x-[10px]": size === "medium",
|
|
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 === "medium",
|
|
73
|
-
"w-[19px] h-[19px]": size === "
|
|
74
|
-
[value ? "translate-x-[19px]" : "translate-x-[3px]"]: size === "medium",
|
|
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
|
/>}
|
|
@@ -57,12 +57,12 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
|
|
|
57
57
|
!invisible && fieldBackgroundMixin,
|
|
58
58
|
!invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
|
|
59
59
|
disabled ? "cursor-default" : "cursor-pointer",
|
|
60
|
-
"rounded-md
|
|
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",
|