@firecms/ui 3.0.0-beta.4.pre.2 → 3.0.0-beta.6
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 +1 -1
- package/dist/components/CenteredView.d.ts +4 -2
- package/dist/components/Checkbox.d.ts +4 -3
- package/dist/components/DateTimeField.d.ts +2 -2
- package/dist/components/Markdown.d.ts +1 -0
- package/dist/components/Menu.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +25 -3
- package/dist/components/TextareaAutosize.d.ts +4 -2
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useLocaleConfig.d.ts +1 -0
- package/dist/icons/Icon.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +7506 -7466
- 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/dist/util/index.d.ts +0 -2
- package/package.json +20 -16
- package/src/components/Autocomplete.tsx +2 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/CenteredView.tsx +24 -14
- package/src/components/Checkbox.tsx +29 -22
- package/src/components/Collapse.tsx +2 -1
- package/src/components/DateTimeField.tsx +6 -5
- package/src/components/ExpandablePanel.tsx +4 -2
- package/src/components/FileUpload.tsx +1 -1
- package/src/components/IconButton.tsx +1 -1
- package/src/components/InputLabel.tsx +8 -7
- package/src/components/Label.tsx +1 -1
- package/src/components/Markdown.tsx +14 -3
- package/src/components/Menu.tsx +11 -5
- package/src/components/MultiSelect.tsx +2 -1
- package/src/components/Popover.tsx +2 -1
- package/src/components/RadioGroup.tsx +37 -6
- package/src/components/SearchBar.tsx +1 -1
- package/src/components/Select.tsx +1 -1
- package/src/components/TextareaAutosize.tsx +1 -1
- package/src/components/Tooltip.tsx +2 -1
- package/src/components/Typography.tsx +1 -1
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useLocaleConfig.tsx +18 -0
- package/src/icons/Icon.tsx +43 -40
- package/src/index.ts +1 -0
- package/src/styles.ts +6 -6
- package/src/util/index.ts +0 -2
- package/tailwind.config.js +70 -0
- /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
- /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
- /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
- /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
- /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
- /package/src/{util → hooks}/useOutsideAlerter.tsx +0 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as locales from "date-fns/locale";
|
2
|
+
// @ts-ignore
|
3
|
+
import { registerLocale, setDefaultLocale } from "react-datepicker";
|
4
|
+
import { useEffect } from "react";
|
5
|
+
|
6
|
+
export function useLocaleConfig(locale?: string) {
|
7
|
+
useEffect(() => {
|
8
|
+
if (!locale) {
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
// @ts-ignore
|
12
|
+
const dateFnsLocale = locales[locale];
|
13
|
+
if (dateFnsLocale) {
|
14
|
+
registerLocale(locale, dateFnsLocale);
|
15
|
+
setDefaultLocale(locale);
|
16
|
+
}
|
17
|
+
}, [locale])
|
18
|
+
}
|
package/src/icons/Icon.tsx
CHANGED
@@ -8,7 +8,7 @@ export type IconProps = {
|
|
8
8
|
color?: IconColor,
|
9
9
|
className?: string,
|
10
10
|
onClick?: (e: React.SyntheticEvent) => void,
|
11
|
-
style?: React.CSSProperties
|
11
|
+
style?: React.CSSProperties,
|
12
12
|
}
|
13
13
|
|
14
14
|
const colorClassesMapping: Record<IconColor, string> = {
|
@@ -21,43 +21,46 @@ const colorClassesMapping: Record<IconColor, string> = {
|
|
21
21
|
error: "text-red-500"
|
22
22
|
}
|
23
23
|
|
24
|
-
export
|
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
|
-
|
24
|
+
export const Icon = React.forwardRef<HTMLSpanElement, IconProps & { iconKey: string }>(
|
25
|
+
({
|
26
|
+
iconKey,
|
27
|
+
size = "medium",
|
28
|
+
color,
|
29
|
+
className,
|
30
|
+
onClick,
|
31
|
+
style
|
32
|
+
}, ref) => {
|
33
|
+
let sizeInPx: number;
|
34
|
+
switch (size) {
|
35
|
+
case "smallest":
|
36
|
+
sizeInPx = 16;
|
37
|
+
break;
|
38
|
+
case "small":
|
39
|
+
sizeInPx = 20;
|
40
|
+
break;
|
41
|
+
case "medium":
|
42
|
+
sizeInPx = 24;
|
43
|
+
break;
|
44
|
+
case "large":
|
45
|
+
sizeInPx = 28;
|
46
|
+
break
|
47
|
+
default:
|
48
|
+
sizeInPx = typeof size === "number" ? size : 24;
|
49
|
+
}
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
}
|
51
|
+
return <span
|
52
|
+
ref={ref} // Attach the ref to the span
|
53
|
+
style={{
|
54
|
+
fontSize: `${sizeInPx}px`,
|
55
|
+
display: "block",
|
56
|
+
...style
|
57
|
+
}}
|
58
|
+
className={
|
59
|
+
cn("material-icons",
|
60
|
+
color ? colorClassesMapping[color] : "",
|
61
|
+
"select-none",
|
62
|
+
className)}
|
63
|
+
onClick={onClick}>{iconKey}</span>
|
64
|
+
});
|
65
|
+
|
66
|
+
Icon.displayName = "Icon";
|
package/src/index.ts
CHANGED
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-
|
5
|
-
export const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0 transition duration-
|
6
|
-
export const fieldBackgroundDisabledMixin = "bg-opacity-80 dark:bg-opacity-90";
|
7
|
-
export const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-opacity-
|
4
|
+
export const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-700 dark:bg-opacity-40 transition duration-100 ease-in-out";
|
5
|
+
export const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0 transition duration-100 ease-in-out";
|
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
8
|
export const defaultBorderMixin = "border-gray-100 dark:border-gray-800 dark:border-opacity-80";
|
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-800 dark:border-opacity-50 transition duration-
|
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 border border-gray-100 dark:border-transparent rounded-md dark:bg-gray-950 dark:border-gray-800 dark:border-opacity-50 transition duration-100 ease-in-out m-1 -p-1";
|
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";
|
package/src/util/index.ts
CHANGED
@@ -0,0 +1,70 @@
|
|
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/**/*.{js,ts,jsx,tsx}"
|
8
|
+
],
|
9
|
+
plugins: [
|
10
|
+
require("@tailwindcss/typography")
|
11
|
+
],
|
12
|
+
theme: {
|
13
|
+
extend: {
|
14
|
+
fontFamily: {
|
15
|
+
sans: [
|
16
|
+
"Rubik",
|
17
|
+
"Roboto",
|
18
|
+
"Helvetica",
|
19
|
+
"Arial",
|
20
|
+
"sans-serif"
|
21
|
+
],
|
22
|
+
headers: [
|
23
|
+
"Rubik",
|
24
|
+
"Roboto",
|
25
|
+
"Helvetica",
|
26
|
+
"Arial",
|
27
|
+
"sans-serif"
|
28
|
+
],
|
29
|
+
mono: [
|
30
|
+
"JetBrains Mono",
|
31
|
+
"Space Mono",
|
32
|
+
"Lucida Console",
|
33
|
+
"monospace"
|
34
|
+
]
|
35
|
+
},
|
36
|
+
colors: {
|
37
|
+
primary: "var(--fcms-primary)",
|
38
|
+
"primary-dark": "var(--fcms-primary-dark)",
|
39
|
+
"primary-bg": "var(--fcms-primary-bg)",
|
40
|
+
secondary: "var(--fcms-secondary)",
|
41
|
+
field: {
|
42
|
+
disabled: "rgb(224 224 226)",
|
43
|
+
"disabled-dark": "rgb(35 35 37)"
|
44
|
+
},
|
45
|
+
text: {
|
46
|
+
primary: "rgba(0, 0, 0, 0.87)",
|
47
|
+
"primary-dark": "#ffffff",
|
48
|
+
secondary: "rgba(0, 0, 0, 0.6)",
|
49
|
+
"secondary-dark": "rgba(255, 255, 255, 0.7)",
|
50
|
+
disabled: "rgba(0, 0, 0, 0.38)",
|
51
|
+
"disabled-dark": "rgba(255, 255, 255, 0.5)",
|
52
|
+
label: "rgb(131, 131, 131)"
|
53
|
+
},
|
54
|
+
gray: {
|
55
|
+
50: "#f8f8fc",
|
56
|
+
100: "#E7E7EB",
|
57
|
+
200: "#CFCFD6",
|
58
|
+
300: "#B7B7BF",
|
59
|
+
400: "#A0A0A9",
|
60
|
+
500: "#87878F",
|
61
|
+
600: "#6C6C75",
|
62
|
+
700: "#505058",
|
63
|
+
800: "#35353A",
|
64
|
+
900: "#18181C",
|
65
|
+
950: "#101013"
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
};
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|