@firecms/ui 3.0.0-canary.3 → 3.0.0-canary.31
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/README.md +2 -2
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Card.d.ts +4 -2
- package/dist/components/CenteredView.d.ts +2 -1
- package/dist/components/Checkbox.d.ts +4 -4
- package/dist/components/Chip.d.ts +1 -1
- package/dist/components/DateTimeField.d.ts +2 -2
- package/dist/components/Dialog.d.ts +2 -1
- package/dist/components/Label.d.ts +4 -0
- package/dist/components/Markdown.d.ts +1 -0
- package/dist/components/Menu.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +27 -0
- package/dist/components/Tooltip.d.ts +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.es.js +7731 -7659
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.d.ts +6 -6
- package/package.json +25 -21
- package/src/components/Alert.tsx +2 -2
- package/src/components/BooleanSwitch.tsx +2 -2
- package/src/components/Button.tsx +9 -17
- package/src/components/Card.tsx +16 -10
- package/src/components/CenteredView.tsx +4 -2
- package/src/components/Checkbox.tsx +32 -23
- package/src/components/Chip.tsx +3 -3
- package/src/components/DateTimeField.tsx +4 -4
- package/src/components/Dialog.tsx +4 -1
- package/src/components/ExpandablePanel.tsx +3 -2
- package/src/components/IconButton.tsx +2 -2
- package/src/components/InputLabel.tsx +2 -1
- package/src/components/Label.tsx +18 -0
- package/src/components/Markdown.tsx +14 -3
- package/src/components/Menu.tsx +11 -5
- package/src/components/RadioGroup.tsx +72 -0
- package/src/components/Select.tsx +21 -21
- package/src/components/Table.tsx +1 -1
- package/src/components/Tabs.tsx +2 -2
- package/src/components/TextField.tsx +1 -1
- package/src/components/Tooltip.tsx +3 -0
- package/src/components/index.tsx +2 -0
- package/src/styles.ts +6 -6
- package/tailwind.config.js +72 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
3
|
+
import { cn } from "../util";
|
4
|
+
|
5
|
+
export interface RadioGroupProps {
|
6
|
+
id?: string;
|
7
|
+
children: React.ReactNode;
|
8
|
+
name?: string
|
9
|
+
required?: boolean;
|
10
|
+
disabled?: boolean;
|
11
|
+
/**
|
12
|
+
* Whether keyboard navigation should loop around
|
13
|
+
* @defaultValue false
|
14
|
+
*/
|
15
|
+
loop?: boolean;
|
16
|
+
defaultValue?: string;
|
17
|
+
value?: string;
|
18
|
+
|
19
|
+
onValueChange?(value: string): void;
|
20
|
+
|
21
|
+
className?: string;
|
22
|
+
}
|
23
|
+
|
24
|
+
const RadioGroup = React.forwardRef<
|
25
|
+
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
26
|
+
RadioGroupProps
|
27
|
+
>(({
|
28
|
+
className,
|
29
|
+
...props
|
30
|
+
}, ref) => {
|
31
|
+
return (
|
32
|
+
<RadioGroupPrimitive.Root
|
33
|
+
className={cn("grid gap-2", className)}
|
34
|
+
{...props}
|
35
|
+
ref={ref}
|
36
|
+
/>
|
37
|
+
)
|
38
|
+
})
|
39
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
|
40
|
+
|
41
|
+
export interface RadioGroupItemProps {
|
42
|
+
id?: string;
|
43
|
+
value: string;
|
44
|
+
checked?: boolean;
|
45
|
+
required?: boolean;
|
46
|
+
className?: string;
|
47
|
+
}
|
48
|
+
const RadioGroupItem = React.forwardRef<
|
49
|
+
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
50
|
+
RadioGroupItemProps
|
51
|
+
>(({
|
52
|
+
className,
|
53
|
+
...props
|
54
|
+
}, ref) => {
|
55
|
+
return (
|
56
|
+
<RadioGroupPrimitive.Item
|
57
|
+
ref={ref}
|
58
|
+
className={cn(
|
59
|
+
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
60
|
+
className
|
61
|
+
)}
|
62
|
+
{...props}
|
63
|
+
>
|
64
|
+
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
65
|
+
<div className="h-2.5 w-2.5 fill-current text-current bg-primary rounded-lg"/>
|
66
|
+
</RadioGroupPrimitive.Indicator>
|
67
|
+
</RadioGroupPrimitive.Item>
|
68
|
+
)
|
69
|
+
})
|
70
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
|
71
|
+
|
72
|
+
export { RadioGroup, RadioGroupItem }
|
@@ -127,38 +127,38 @@ export function Select({
|
|
127
127
|
"w-full h-full",
|
128
128
|
size === "small" ? "h-[42px]" : "h-[64px]",
|
129
129
|
padding ? "px-4 " : "",
|
130
|
-
"
|
130
|
+
"outline-none focus:outline-none",
|
131
131
|
"select-none rounded-md text-sm",
|
132
132
|
error ? "text-red-500 dark:text-red-600" : "focus:text-text-primary dark:focus:text-text-primary-dark",
|
133
133
|
error ? "border border-red-500 dark:border-red-600" : "",
|
134
|
-
disabled ? "text-slate-600 dark:text-slate-400" : "text-slate-800 dark:text-
|
134
|
+
disabled ? "text-slate-600 dark:text-slate-400" : "text-slate-800 dark:text-white",
|
135
135
|
"relative flex items-center",
|
136
136
|
includeFocusOutline ? focusedMixin : "",
|
137
137
|
inputClassName
|
138
138
|
)}>
|
139
139
|
|
140
|
-
<
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
140
|
+
<div className={cn(
|
141
|
+
"flex-grow w-full max-w-full flex flex-row gap-2 items-center",
|
142
|
+
"overflow-visible",
|
143
|
+
size === "small" ? "h-[42px]" : "h-[64px]"
|
144
|
+
)}>
|
145
|
+
<SelectPrimitive.Value >
|
146
|
+
{renderValue &&
|
147
|
+
(value && Array.isArray(value)
|
148
|
+
? value.map((v, i) => (
|
149
|
+
<div key={v} className={"flex items-center gap-1 max-w-full"}>
|
150
|
+
{renderValue ? renderValue(v, i) : v}
|
151
|
+
</div>))
|
152
|
+
: (typeof value === "string" ? (renderValue ? renderValue(value, 0) : value) : placeholder))}
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
{renderValues && (!value || Array.isArray(value))
|
155
|
+
? renderValues(value as string[] ?? [])
|
156
|
+
: null}
|
157
157
|
|
158
|
-
|
158
|
+
{!renderValue && !renderValues && value}
|
159
159
|
|
160
|
-
</div>
|
161
160
|
</SelectPrimitive.Value>
|
161
|
+
</div>
|
162
162
|
|
163
163
|
<SelectPrimitive.Icon className={cn(
|
164
164
|
"px-2 h-full flex items-center",
|
@@ -249,7 +249,7 @@ export function SelectGroup({
|
|
249
249
|
return <>
|
250
250
|
<SelectPrimitive.Group
|
251
251
|
className={cn(
|
252
|
-
"text-xs text-slate-900 dark:text-
|
252
|
+
"text-xs text-slate-900 dark:text-white uppercase tracking-wider font-bold mt-6 first:mt-2",
|
253
253
|
"px-2 py-2",
|
254
254
|
className
|
255
255
|
)}>
|
package/src/components/Table.tsx
CHANGED
@@ -13,7 +13,7 @@ export const Table = ({
|
|
13
13
|
className,
|
14
14
|
style
|
15
15
|
}: TableProps) => (
|
16
|
-
<table className={cn("w-full text-left text-gray-800 dark:text-
|
16
|
+
<table className={cn("w-full text-left text-gray-800 dark:text-white rounded-md overflow-x-auto",
|
17
17
|
className)}
|
18
18
|
style={style}>
|
19
19
|
{children}
|
package/src/components/Tabs.tsx
CHANGED
@@ -19,7 +19,7 @@ export function Tabs({
|
|
19
19
|
|
20
20
|
return <TabsPrimitive.Root value={value} onValueChange={onValueChange}>
|
21
21
|
<TabsPrimitive.List className={cn(
|
22
|
-
"flex text-sm font-medium text-center text-slate-800 dark:text-
|
22
|
+
"flex text-sm font-medium text-center text-slate-800 dark:text-white max-w-full overflow-auto no-scrollbar",
|
23
23
|
className)
|
24
24
|
}>
|
25
25
|
{children}
|
@@ -48,7 +48,7 @@ export function Tab({
|
|
48
48
|
disabled
|
49
49
|
? "text-slate-400 dark:text-slate-500"
|
50
50
|
: cn("text-slate-700 dark:text-slate-300",
|
51
|
-
"data-[state=active]:text-slate-900 data-[state=active]:dark:text-
|
51
|
+
"data-[state=active]:text-slate-900 data-[state=active]:dark:text-white",
|
52
52
|
"hover:text-slate-800 dark:hover:text-slate-200"),
|
53
53
|
// disabled ? "text-slate-400 dark:text-slate-500" : "data-[state=active]:text-primary",
|
54
54
|
// "data-[state=active]:bg-slate-50 data-[state=active]:dark:bg-slate-800",
|
@@ -132,7 +132,7 @@ export function TextField<T extends string | number>({
|
|
132
132
|
label ? (size === "medium" ? "pt-[28px] pb-2" : "pt-4 pb-2") : "py-2",
|
133
133
|
focused ? "text-text-primary dark:text-text-primary-dark" : "",
|
134
134
|
endAdornment ? "pr-10" : "pr-3",
|
135
|
-
disabled && "border border-transparent outline-none opacity-50 dark:opacity-50 text-slate-800 dark:text-
|
135
|
+
disabled && "border border-transparent outline-none opacity-50 dark:opacity-50 text-slate-800 dark:text-white",
|
136
136
|
inputClassName
|
137
137
|
)}
|
138
138
|
placeholder={focused || hasValue || !label ? placeholder : undefined}
|
@@ -7,6 +7,7 @@ export type TooltipProps = {
|
|
7
7
|
open?: boolean,
|
8
8
|
onOpenChange?: (open: boolean) => void,
|
9
9
|
side?: "top" | "bottom" | "left" | "right",
|
10
|
+
align?: "start" | "center" | "end",
|
10
11
|
sideOffset?: number,
|
11
12
|
title?: string | React.ReactNode,
|
12
13
|
delayDuration?: number;
|
@@ -21,6 +22,7 @@ export const Tooltip = ({
|
|
21
22
|
side = "bottom",
|
22
23
|
delayDuration = 250,
|
23
24
|
sideOffset,
|
25
|
+
align,
|
24
26
|
onOpenChange,
|
25
27
|
title,
|
26
28
|
className,
|
@@ -49,6 +51,7 @@ export const Tooltip = ({
|
|
49
51
|
"z-50 rounded px-3 py-2 text-xs leading-none bg-slate-700 dark:bg-slate-800 bg-opacity-90 font-medium text-slate-50 shadow-2xl select-none duration-400 ease-in transform opacity-100",
|
50
52
|
tooltipClassName)}
|
51
53
|
sideOffset={sideOffset === undefined ? 4 : sideOffset}
|
54
|
+
align={align}
|
52
55
|
side={side}>
|
53
56
|
{title}
|
54
57
|
{/*<TooltipPrimitive.Arrow className="fill-slate-600"/>*/}
|
package/src/components/index.tsx
CHANGED
@@ -20,11 +20,13 @@ export * from "./FileUpload";
|
|
20
20
|
export * from "./IconButton";
|
21
21
|
export * from "./InputLabel";
|
22
22
|
export * from "./InfoLabel";
|
23
|
+
export * from "./Label";
|
23
24
|
export * from "./LoadingButton";
|
24
25
|
export * from "./Markdown";
|
25
26
|
export * from "./Menu";
|
26
27
|
export * from "./MultiSelect";
|
27
28
|
export * from "./Paper";
|
29
|
+
export * from "./RadioGroup";
|
28
30
|
export * from "./SearchBar";
|
29
31
|
export * from "./Select";
|
30
32
|
export * from "./Separator";
|
package/src/styles.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
export 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";
|
2
2
|
export const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-slate-100 focus:dark:bg-gray-800 focus:dark:bg-opacity-60";
|
3
3
|
export const focusedClasses = "z-30 outline-none ring-2 ring-primary ring-opacity-75 ring-offset-2 ring-offset-transparent ";
|
4
|
-
export const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-
|
4
|
+
export const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-700 dark:bg-opacity-40 transition duration-150 ease-in-out";
|
5
5
|
export const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0 transition duration-150 ease-in-out";
|
6
|
-
export const fieldBackgroundDisabledMixin = "bg-opacity-80 dark:bg-opacity-90";
|
7
|
-
export const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-opacity-
|
8
|
-
export const defaultBorderMixin = "border-gray-100 dark:border-gray-
|
9
|
-
export const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-
|
10
|
-
export const cardMixin = "bg-white rounded-md dark:bg-gray-950 dark:border-gray-
|
6
|
+
export const fieldBackgroundDisabledMixin = "dark:bg-gray-800 bg-opacity-80 dark:bg-opacity-90";
|
7
|
+
export const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-opacity-60";
|
8
|
+
export const defaultBorderMixin = "border-gray-100 dark:border-gray-900 dark:border-opacity-60";
|
9
|
+
export const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-80 border-gray-100";
|
10
|
+
export const cardMixin = "bg-white rounded-md dark:bg-gray-950 border-gray-100 dark:border-gray-900 dark:border-opacity-60 transition duration-200 ease-in-out m-1 -p-1 border ";
|
11
11
|
export 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 const cardSelectedMixin = "bg-primary-bg dark:bg-primary-bg bg-opacity-30 dark:bg-opacity-10 ring-1 ring-primary ring-opacity-75";
|
@@ -0,0 +1,72 @@
|
|
1
|
+
export default {
|
2
|
+
darkMode: ["selector", "[data-theme=\"dark\"]"],
|
3
|
+
mode: "jit",
|
4
|
+
content: [
|
5
|
+
"./index.html",
|
6
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
7
|
+
"./node_modules/firecms/src/**/*.{js,ts,jsx,tsx}",
|
8
|
+
"./node_modules/@firecms/**/src/**/*.{js,ts,jsx,tsx}"
|
9
|
+
],
|
10
|
+
plugins: [
|
11
|
+
require("@tailwindcss/typography")
|
12
|
+
],
|
13
|
+
theme: {
|
14
|
+
extend: {
|
15
|
+
fontFamily: {
|
16
|
+
sans: [
|
17
|
+
"Rubik",
|
18
|
+
"Roboto",
|
19
|
+
"Helvetica",
|
20
|
+
"Arial",
|
21
|
+
"sans-serif"
|
22
|
+
],
|
23
|
+
headers: [
|
24
|
+
"Rubik",
|
25
|
+
"Roboto",
|
26
|
+
"Helvetica",
|
27
|
+
"Arial",
|
28
|
+
"sans-serif"
|
29
|
+
],
|
30
|
+
mono: [
|
31
|
+
"SFMono-Regular",
|
32
|
+
"IBM Plex Mono",
|
33
|
+
"Space Mono",
|
34
|
+
"Lucida Console",
|
35
|
+
"monospace"
|
36
|
+
]
|
37
|
+
},
|
38
|
+
colors: {
|
39
|
+
primary: "var(--fcms-primary)",
|
40
|
+
"primary-dark": "var(--fcms-primary-dark)",
|
41
|
+
"primary-bg": "var(--fcms-primary-bg)",
|
42
|
+
secondary: "var(--fcms-secondary)",
|
43
|
+
field: {
|
44
|
+
disabled: "rgb(224 224 226)",
|
45
|
+
"disabled-dark": "rgb(35 35 37)"
|
46
|
+
},
|
47
|
+
text: {
|
48
|
+
primary: "rgba(0, 0, 0, 0.87)",
|
49
|
+
"primary-dark": "#ffffff",
|
50
|
+
secondary: "rgba(0, 0, 0, 0.6)",
|
51
|
+
"secondary-dark": "rgba(255, 255, 255, 0.7)",
|
52
|
+
disabled: "rgba(0, 0, 0, 0.38)",
|
53
|
+
"disabled-dark": "rgba(255, 255, 255, 0.5)",
|
54
|
+
label: "rgb(131, 131, 131)"
|
55
|
+
},
|
56
|
+
gray: {
|
57
|
+
50: "#f8f8fc",
|
58
|
+
100: "#E7E7EB",
|
59
|
+
200: "#CFCFD6",
|
60
|
+
300: "#B7B7BF",
|
61
|
+
400: "#A0A0A9",
|
62
|
+
500: "#87878F",
|
63
|
+
600: "#6C6C75",
|
64
|
+
700: "#505058",
|
65
|
+
800: "#35353A",
|
66
|
+
900: "#18181C",
|
67
|
+
950: "#101013"
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|