@firecms/ui 3.0.0-canary.8 → 3.0.0-canary.80

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.
Files changed (89) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Avatar.d.ts +1 -0
  3. package/dist/components/BooleanSwitch.d.ts +1 -1
  4. package/dist/components/CenteredView.d.ts +4 -2
  5. package/dist/components/Checkbox.d.ts +4 -3
  6. package/dist/components/DateTimeField.d.ts +2 -2
  7. package/dist/components/InputLabel.d.ts +2 -2
  8. package/dist/components/Label.d.ts +4 -1
  9. package/dist/components/Markdown.d.ts +1 -0
  10. package/dist/components/Menu.d.ts +2 -1
  11. package/dist/components/Menubar.d.ts +69 -0
  12. package/dist/components/RadioGroup.d.ts +25 -3
  13. package/dist/components/Select.d.ts +1 -1
  14. package/dist/components/TextField.d.ts +1 -1
  15. package/dist/components/TextareaAutosize.d.ts +3 -34
  16. package/dist/components/index.d.ts +1 -1
  17. package/dist/hooks/index.d.ts +4 -0
  18. package/dist/hooks/useLocaleConfig.d.ts +1 -0
  19. package/dist/icons/Icon.d.ts +2 -2
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.es.js +8362 -8066
  22. package/dist/index.es.js.map +1 -1
  23. package/dist/index.umd.js +10 -10
  24. package/dist/index.umd.js.map +1 -1
  25. package/dist/styles.d.ts +6 -6
  26. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  27. package/dist/util/index.d.ts +1 -3
  28. package/package.json +39 -49
  29. package/src/components/Alert.tsx +2 -2
  30. package/src/components/Autocomplete.tsx +4 -3
  31. package/src/components/Avatar.tsx +7 -4
  32. package/src/components/Badge.tsx +1 -1
  33. package/src/components/BooleanSwitch.tsx +9 -9
  34. package/src/components/BooleanSwitchWithLabel.tsx +5 -5
  35. package/src/components/Button.tsx +7 -7
  36. package/src/components/Card.tsx +2 -2
  37. package/src/components/CenteredView.tsx +25 -15
  38. package/src/components/Checkbox.tsx +31 -24
  39. package/src/components/Chip.tsx +2 -2
  40. package/src/components/CircularProgress.tsx +2 -2
  41. package/src/components/Collapse.tsx +3 -2
  42. package/src/components/Container.tsx +2 -2
  43. package/src/components/DateTimeField.tsx +10 -9
  44. package/src/components/Dialog.tsx +4 -4
  45. package/src/components/DialogActions.tsx +2 -2
  46. package/src/components/DialogContent.tsx +2 -2
  47. package/src/components/ExpandablePanel.tsx +8 -6
  48. package/src/components/FileUpload.tsx +5 -7
  49. package/src/components/IconButton.tsx +3 -3
  50. package/src/components/InfoLabel.tsx +2 -2
  51. package/src/components/InputLabel.tsx +10 -9
  52. package/src/components/Label.tsx +17 -4
  53. package/src/components/Markdown.tsx +14 -3
  54. package/src/components/Menu.tsx +13 -7
  55. package/src/components/Menubar.tsx +287 -0
  56. package/src/components/MultiSelect.tsx +7 -6
  57. package/src/components/Paper.tsx +2 -2
  58. package/src/components/Popover.tsx +3 -2
  59. package/src/components/RadioGroup.tsx +40 -9
  60. package/src/components/SearchBar.tsx +6 -6
  61. package/src/components/Select.tsx +24 -23
  62. package/src/components/Sheet.tsx +7 -7
  63. package/src/components/Skeleton.tsx +8 -5
  64. package/src/components/Table.tsx +6 -6
  65. package/src/components/Tabs.tsx +5 -5
  66. package/src/components/TextField.tsx +8 -7
  67. package/src/components/TextareaAutosize.tsx +3 -3
  68. package/src/components/Tooltip.tsx +4 -3
  69. package/src/components/Typography.tsx +20 -3
  70. package/src/components/common/SelectInputLabel.tsx +2 -2
  71. package/src/components/index.tsx +1 -1
  72. package/src/hooks/index.ts +4 -0
  73. package/src/hooks/useLocaleConfig.tsx +18 -0
  74. package/src/icons/Icon.tsx +44 -41
  75. package/src/index.ts +1 -0
  76. package/src/scripts/generateIconKeys.ts +0 -1
  77. package/src/styles.ts +6 -6
  78. package/src/util/cls.ts +14 -0
  79. package/src/util/index.ts +1 -3
  80. package/tailwind.config.js +70 -0
  81. package/dist/components/Spinner.d.ts +0 -1
  82. package/src/components/Spinner.tsx +0 -18
  83. package/src/util/cn.ts +0 -6
  84. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  85. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  86. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  87. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  88. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  89. /package/src/{util → hooks}/useOutsideAlerter.tsx +0 -0
@@ -1,6 +1,6 @@
1
1
  import React, { useRef } from "react";
2
2
  import { defaultBorderMixin } from "../styles";
3
- import { cn } from "../util";
3
+ import { cls } from "../util";
4
4
 
5
5
  export type TableProps = {
6
6
  children: React.ReactNode;
@@ -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-white rounded-md overflow-x-auto",
16
+ <table className={cls("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}
@@ -29,7 +29,7 @@ export const TableBody = ({
29
29
  className
30
30
  }: TableBodyProps) => (
31
31
  <tbody
32
- className={cn("bg-white text-sm dark:bg-gray-800 divide-y divide-slate-200 dark:divide-gray-700", className)}>
32
+ className={cls("bg-white text-sm dark:bg-gray-800 divide-y divide-slate-200 dark:divide-gray-700", className)}>
33
33
  {children}
34
34
  </tbody>
35
35
  );
@@ -44,7 +44,7 @@ export const TableHeader = ({
44
44
  className
45
45
  }: TableHeaderProps) => (
46
46
  <thead>
47
- <tr className={cn(
47
+ <tr className={cls(
48
48
  defaultBorderMixin,
49
49
  "text-sm font-medium text-gray-700 dark:text-slate-300",
50
50
  "bg-slate-50 border-b dark:bg-gray-900", className)}>
@@ -69,7 +69,7 @@ export const TableRow = ({
69
69
  <tr
70
70
  onClick={onClick}
71
71
  style={style}
72
- className={cn(
72
+ className={cls(
73
73
  "divide-slate-100 dark:divide-gray-800",
74
74
  "bg-white dark:bg-gray-950",
75
75
  onClick ? "hover:bg-slate-100 dark:hover:bg-gray-800 cursor-pointer" : "",
@@ -107,7 +107,7 @@ export const TableCell = ({
107
107
  colSpan={colspan}
108
108
  ref={ref}
109
109
  style={style}
110
- className={cn("px-4 py-3 text-clip ",
110
+ className={cls("px-4 py-3 text-clip ",
111
111
  align === "center" ? "text-center" : (align === "right" ? "text-right" : "text-left"),
112
112
  className)}>
113
113
  {children}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import * as TabsPrimitive from "@radix-ui/react-tabs";
3
3
  import { focusedMixin } from "../styles";
4
- import { cn } from "../util";
4
+ import { cls } from "../util";
5
5
 
6
6
  export type TabsProps = {
7
7
  value: string,
@@ -18,7 +18,7 @@ export function Tabs({
18
18
  }: TabsProps) {
19
19
 
20
20
  return <TabsPrimitive.Root value={value} onValueChange={onValueChange}>
21
- <TabsPrimitive.List className={cn(
21
+ <TabsPrimitive.List className={cls(
22
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
  }>
@@ -42,18 +42,18 @@ export function Tab({
42
42
  }: TabProps) {
43
43
  return <TabsPrimitive.Trigger value={value}
44
44
  disabled={disabled}
45
- className={cn(focusedMixin,
45
+ className={cls(focusedMixin,
46
46
  "border-b-2 border-transparent",
47
47
  "data-[state=active]:border-secondary",
48
48
  disabled
49
49
  ? "text-slate-400 dark:text-slate-500"
50
- : cn("text-slate-700 dark:text-slate-300",
50
+ : cls("text-slate-700 dark:text-slate-300",
51
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",
55
55
  className)}>
56
- <div className={cn("uppercase inline-block p-2 px-4 m-2 rounded",
56
+ <div className={cls("uppercase inline-block p-2 px-4 m-2 rounded",
57
57
  "hover:bg-slate-100 dark:hover:bg-slate-800")}>
58
58
  {children}
59
59
  </div>
@@ -10,7 +10,7 @@ import {
10
10
  focusedMixin
11
11
  } from "../styles";
12
12
  import { InputLabel } from "./InputLabel";
13
- import { cn } from "../util";
13
+ import { cls } from "../util";
14
14
 
15
15
  export type InputType =
16
16
  "text"
@@ -40,7 +40,7 @@ export type TextFieldProps<T extends string | number> = {
40
40
  endAdornment?: React.ReactNode,
41
41
  autoFocus?: boolean,
42
42
  placeholder?: string,
43
- size?: "small" | "medium",
43
+ size?: "smallest" | "small" | "medium",
44
44
  className?: string,
45
45
  style?: React.CSSProperties,
46
46
  inputClassName?: string,
@@ -111,7 +111,7 @@ export function TextField<T extends string | number>({
111
111
  value={value ?? ""}
112
112
  onChange={onChange}
113
113
  style={inputStyle}
114
- className={cn(
114
+ className={cls(
115
115
  invisible ? focusedInvisibleMixin : focusedMixin,
116
116
  "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-[28px]",
117
117
  disabled && "border border-transparent outline-none opacity-50 text-slate-600 dark:text-slate-500"
@@ -123,12 +123,12 @@ export function TextField<T extends string | number>({
123
123
  onWheel={type === "number" ? numberInputOnWheelPreventChange : undefined}
124
124
  disabled={disabled}
125
125
  style={inputStyle}
126
- className={cn(
126
+ className={cls(
127
127
  "w-full outline-none bg-transparent leading-normal px-3",
128
128
  "rounded-md",
129
129
  invisible ? focusedInvisibleMixin : focusedMixin,
130
130
  disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
131
- size === "small" ? "min-h-[48px]" : "min-h-[64px]",
131
+ size === "smallest" ? "min-h-[32px]" : (size === "small" ? "min-h-[48px]" : "min-h-[64px]"),
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",
@@ -146,12 +146,13 @@ export function TextField<T extends string | number>({
146
146
 
147
147
  return (
148
148
  <div
149
- className={cn(
149
+ className={cls(
150
150
  "rounded-md relative max-w-full",
151
151
  invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,
152
152
  disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
153
153
  error ? "border border-red-500 dark:border-red-600" : "",
154
154
  {
155
+ "min-h-[32px]": !invisible && size === "smallest",
155
156
  "min-h-[48px]": !invisible && size === "small",
156
157
  "min-h-[64px]": !invisible && size === "medium"
157
158
  },
@@ -160,7 +161,7 @@ export function TextField<T extends string | number>({
160
161
 
161
162
  {label && (
162
163
  <InputLabel
163
- className={cn(
164
+ className={cls(
164
165
  "pointer-events-none absolute",
165
166
  size === "medium" ? "top-1" : "-top-1",
166
167
  !error ? (focused ? "text-primary dark:text-primary" : "text-text-secondary dark:text-text-secondary-dark") : "text-red-500 dark:text-red-600",
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useLayoutEffect } from "react";
3
3
  import * as ReactDOM from "react-dom";
4
- import { cn, debounce } from "../util";
4
+ import { cls, debounce } from "../util";
5
5
 
6
6
  type State = {
7
7
  outerHeightStyle: number;
@@ -276,7 +276,7 @@ export const TextareaAutosize = React.forwardRef(function TextareaAutosize(
276
276
  />
277
277
  <textarea
278
278
  aria-hidden
279
- className={cn(props.className, props.shadowClassName)}
279
+ className={cls(props.className, props.shadowClassName)}
280
280
  readOnly
281
281
  ref={shadowRef}
282
282
  tabIndex={-1}
@@ -288,7 +288,7 @@ export const TextareaAutosize = React.forwardRef(function TextareaAutosize(
288
288
  />
289
289
  </React.Fragment>
290
290
  );
291
- });
291
+ }) as React.FC<TextareaAutosizeProps & { ref?: React.ForwardedRef<Element> }>;
292
292
 
293
293
  export type TextareaAutosizeProps = Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "onResize"> & {
294
294
 
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
3
 
4
- import { cn, useInjectStyles } from "../util";
4
+ import { cls } from "../util";
5
+ import { useInjectStyles } from "../hooks";
5
6
 
6
7
  export type TooltipProps = {
7
8
  open?: boolean,
@@ -20,7 +21,7 @@ export type TooltipProps = {
20
21
  export const Tooltip = ({
21
22
  open,
22
23
  side = "bottom",
23
- delayDuration = 250,
24
+ delayDuration = 200,
24
25
  sideOffset,
25
26
  align,
26
27
  onOpenChange,
@@ -46,7 +47,7 @@ export const Tooltip = ({
46
47
  </TooltipPrimitive.Trigger>
47
48
  <TooltipPrimitive.Portal>
48
49
  <TooltipPrimitive.Content
49
- className={cn("TooltipContent",
50
+ className={cls("TooltipContent",
50
51
  "max-w-lg leading-relaxed",
51
52
  "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",
52
53
  tooltipClassName)}
@@ -1,6 +1,6 @@
1
1
  import React, { ReactEventHandler } from "react";
2
2
  import { focusedMixin } from "../styles";
3
- import { cn } from "../util";
3
+ import { cls } from "../util";
4
4
 
5
5
  export type TextProps<C extends React.ElementType> = {
6
6
  align?: "center" | "inherit" | "justify" | "left" | "right";
@@ -43,6 +43,23 @@ const colorToClasses = {
43
43
  error: "text-red-600 dark:text-red-500"
44
44
  };
45
45
 
46
+ const gutterBottomClasses = {
47
+ h1: "mb-5",
48
+ h2: "mb-4",
49
+ h3: "mb-4",
50
+ h4: "mb-4",
51
+ h5: "mb-3",
52
+ h6: "mb-3",
53
+ subtitle1: "mb-3",
54
+ subtitle2: "mb-3",
55
+ body1: "mb-3",
56
+ body2: "mb-3",
57
+ inherit: "mb-3",
58
+ caption: "mb-2",
59
+ button: "mb-2",
60
+ label: "mb-2"
61
+ };
62
+
46
63
  const variantToClasses = {
47
64
  h1: "text-6xl font-headers font-light",
48
65
  h2: "text-5xl font-headers font-light",
@@ -82,12 +99,12 @@ export function Typography<C extends React.ElementType>(
82
99
  (paragraph ? "p" : variantMapping[variant] || defaultVariantMapping[variant]) ||
83
100
  "span";
84
101
 
85
- const classes = cn(
102
+ const classes = cls(
86
103
  focusedMixin,
87
104
  variantToClasses[variant],
88
105
  color ? colorToClasses[color] : "",
89
106
  align !== "inherit" && `text-${align}`,
90
- gutterBottom && "mb-[0.35em]",
107
+ gutterBottom && gutterBottomClasses[variant],
91
108
  noWrap && "truncate",
92
109
  paragraph && "mb-3",
93
110
  className
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { cn } from "../../util";
2
+ import { cls } from "../../util";
3
3
 
4
4
  export function SelectInputLabel({ children, error }: { children: React.ReactNode, error?: boolean }) {
5
- return <div className={cn("text-sm font-medium ml-3.5 mb-1",
5
+ return <div className={cls("text-sm font-medium ml-3.5 mb-1",
6
6
  error ? "text-red-500 dark:text-red-600" : "text-slate-500 dark:text-slate-300",)}>
7
7
  {children}
8
8
  </div>;
@@ -24,6 +24,7 @@ export * from "./Label";
24
24
  export * from "./LoadingButton";
25
25
  export * from "./Markdown";
26
26
  export * from "./Menu";
27
+ export * from "./Menubar";
27
28
  export * from "./MultiSelect";
28
29
  export * from "./Paper";
29
30
  export * from "./RadioGroup";
@@ -31,7 +32,6 @@ export * from "./SearchBar";
31
32
  export * from "./Select";
32
33
  export * from "./Separator";
33
34
  export * from "./Sheet";
34
- export * from "./Spinner";
35
35
  export * from "./TextareaAutosize";
36
36
  export * from "./TextField";
37
37
  export * from "./Tooltip";
@@ -0,0 +1,4 @@
1
+ export * from "./useLocaleConfig";
2
+ export * from "./useInjectStyles";
3
+ export * from "./useOutsideAlerter";
4
+ export * from "./useDebounceValue";
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import "@material-design-icons/font/filled.css";
3
- import { cn } from "../util";
3
+ import { cls } from "../util";
4
4
 
5
5
  export type IconColor = "inherit" | "primary" | "secondary" | "disabled" | "error" | "success" | "warning";
6
6
  export type IconProps = {
@@ -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 function Icon({
25
- iconKey,
26
- size = "medium",
27
- color,
28
- className,
29
- onClick,
30
- style
31
- }: IconProps & { iconKey: string }) {
32
- let sizeInPx: number;
33
- switch (size) {
34
- case "smallest":
35
- sizeInPx = 16;
36
- break;
37
- case "small":
38
- sizeInPx = 20;
39
- break;
40
- case "medium":
41
- sizeInPx = 24;
42
- break;
43
- case "large":
44
- sizeInPx = 28;
45
- break
46
- default:
47
- sizeInPx = size;
48
- }
49
- if (!sizeInPx) sizeInPx = 24;
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
- return <span
52
- style={{
53
- fontSize: `${sizeInPx}px`,
54
- display: "block",
55
- ...style
56
- }}
57
- className={
58
- cn("material-icons",
59
- color ? colorClassesMapping[color] : "",
60
- "select-none",
61
- className)}
62
- onClick={onClick}>{iconKey}</span>
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
+ cls("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
@@ -2,3 +2,4 @@ export * from "./components";
2
2
  export * from "./styles";
3
3
  export * from "./util";
4
4
  export * from "./icons";
5
+ export * from "./hooks";
@@ -10,7 +10,6 @@ export function generateIconKeys() {
10
10
  const lines = text.split("\n");
11
11
  const words = lines.map((line) => line.split(" ")[0]);
12
12
  const keys = words.filter(Boolean).filter((word) => word !== "addchart");
13
- console.log(keys);
14
13
  saveIconKeys(keys);
15
14
  return keys;
16
15
  });
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-800 dark:bg-opacity-60 transition duration-150 ease-in-out";
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-90";
4
+ export const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-800 dark:bg-opacity-60";
5
+ export const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0";
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-gray-700 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-90 border-gray-100";
10
- export const cardMixin = "bg-white rounded-md dark:bg-gray-950 dark:border-gray-800 dark:border-opacity-50 transition duration-200 ease-in-out m-1 -p-1 border border-transparent";
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 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";
@@ -0,0 +1,14 @@
1
+ import { type ClassValue, clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cls(...classes: ClassValue[]) {
5
+ return twMerge(clsx(classes))
6
+ }
7
+
8
+ /**
9
+ * @deprecated
10
+ */
11
+ export function cn(...classes: ClassValue[]) {
12
+ console.warn("cn() is deprecated, use cls() instead. cn will be removed in the final 3.0.0 version");
13
+ return cls(...classes)
14
+ }
package/src/util/index.ts CHANGED
@@ -1,6 +1,4 @@
1
- export * from "./cn";
1
+ export * from "./cls";
2
2
  export * from "./debounce";
3
3
  export * from "./chip_colors";
4
4
  export * from "./key_to_icon_component";
5
- export * from "./useInjectStyles";
6
- export * from "./useOutsideAlerter";
@@ -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
+ };
@@ -1 +0,0 @@
1
- export declare function Spinner(): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +0,0 @@
1
- import React from "react";
2
-
3
- export function Spinner() {
4
- return (
5
- <div role="status">
6
- <svg aria-hidden="true" className="w-8 h-8 mr-2 text-slate-200 animate-spin dark:text-slate-600 fill-primary"
7
- viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
8
- <path
9
- d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
10
- fill="currentColor"/>
11
- <path
12
- d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
13
- fill="currentFill"/>
14
- </svg>
15
- <span className="sr-only">Loading...</span>
16
- </div>
17
- );
18
- }
package/src/util/cn.ts DELETED
@@ -1,6 +0,0 @@
1
- import { type ClassValue, clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
-
4
- export function cn(...classes: ClassValue[]) {
5
- return twMerge(clsx(classes))
6
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes