@firecms/ui 3.0.0-canary.105 → 3.0.0-canary.107
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 +1 -1
- package/dist/index.es.js +19 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19 -19
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/BooleanSwitch.tsx +11 -11
- package/src/components/BooleanSwitchWithLabel.tsx +4 -4
- package/src/components/Checkbox.tsx +5 -5
- package/src/components/Chip.tsx +2 -2
- package/src/components/TextField.tsx +0 -3
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@firecms/ui",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.0-canary.
|
4
|
+
"version": "3.0.0-canary.107",
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
6
6
|
"funding": {
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
@@ -102,7 +102,7 @@
|
|
102
102
|
"src",
|
103
103
|
"tailwind.config.js"
|
104
104
|
],
|
105
|
-
"gitHead": "
|
105
|
+
"gitHead": "07f66833d1cc898c000b92029a8c33992a1dea55",
|
106
106
|
"publishConfig": {
|
107
107
|
"access": "public"
|
108
108
|
}
|
@@ -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>
|
@@ -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,7 +11,7 @@ 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;
|
@@ -21,7 +21,7 @@ export interface ChipProps {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
const sizeClassNames = {
|
24
|
-
|
24
|
+
smallest: "px-2 py-0.5 text-sm",
|
25
25
|
small: "px-3 py-1 text-sm",
|
26
26
|
medium: "px-4 py-1.5 text-sm"
|
27
27
|
}
|
@@ -70,7 +70,6 @@ export function TextField<T extends string | number>({
|
|
70
70
|
...inputProps
|
71
71
|
}: TextFieldProps<T>) {
|
72
72
|
|
73
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
74
73
|
const inputRef = inputRefProp ?? useRef(null);
|
75
74
|
|
76
75
|
// @ts-ignore
|
@@ -106,8 +105,6 @@ export function TextField<T extends string | number>({
|
|
106
105
|
placeholder={focused || hasValue || !label ? placeholder : undefined}
|
107
106
|
autoFocus={autoFocus}
|
108
107
|
rows={rows}
|
109
|
-
// onFocus={() => setFocused(true)}
|
110
|
-
// onBlur={() => setFocused(false)}
|
111
108
|
value={value ?? ""}
|
112
109
|
onChange={onChange}
|
113
110
|
style={inputStyle}
|