@firecms/ui 3.0.0-canary.40 → 3.0.0-canary.41
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/CenteredView.d.ts +4 -2
- 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/index.d.ts +1 -0
- package/dist/index.es.js +7254 -7242
- 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/util/index.d.ts +0 -2
- package/package.json +4 -2
- package/src/components/Autocomplete.tsx +2 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/CenteredView.tsx +24 -14
- package/src/components/Collapse.tsx +2 -1
- package/src/components/DateTimeField.tsx +2 -1
- package/src/components/ExpandablePanel.tsx +2 -1
- package/src/components/FileUpload.tsx +1 -1
- package/src/components/InputLabel.tsx +6 -6
- package/src/components/Label.tsx +1 -1
- package/src/components/MultiSelect.tsx +2 -1
- package/src/components/Popover.tsx +2 -1
- package/src/components/SearchBar.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/index.ts +1 -0
- package/src/util/index.ts +0 -2
- /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
package/dist/util/index.d.ts
CHANGED
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.41",
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
6
6
|
"funding": {
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
@@ -62,7 +62,9 @@
|
|
62
62
|
"@radix-ui/react-switch": "^1.0.3",
|
63
63
|
"@radix-ui/react-tabs": "^1.0.4",
|
64
64
|
"@radix-ui/react-tooltip": "^1.0.7",
|
65
|
+
"clsx": "^2.1.0",
|
65
66
|
"cmdk": "^0.2.1",
|
67
|
+
"date-fns": "^3.6.0",
|
66
68
|
"react-datepicker": "^6.4.0",
|
67
69
|
"react-dropzone": "^14.2.3",
|
68
70
|
"react-fast-compare": "^3.2.2",
|
@@ -114,7 +116,7 @@
|
|
114
116
|
"src",
|
115
117
|
"tailwind.config.js"
|
116
118
|
],
|
117
|
-
"gitHead": "
|
119
|
+
"gitHead": "d1ffa185f8930bab4e7b9941ba551c53f947aa1f",
|
118
120
|
"publishConfig": {
|
119
121
|
"access": "public"
|
120
122
|
}
|
@@ -2,7 +2,8 @@ import React from "react";
|
|
2
2
|
|
3
3
|
import { paperMixin } from "../styles";
|
4
4
|
import { Collapse } from "./Collapse";
|
5
|
-
import { cn
|
5
|
+
import { cn } from "../util";
|
6
|
+
import { useOutsideAlerter } from "../hooks";
|
6
7
|
|
7
8
|
export type AutocompleteProps = {
|
8
9
|
children: React.ReactNode;
|
@@ -50,7 +50,7 @@ const ButtonInner = React.forwardRef<
|
|
50
50
|
// Outlined Variants
|
51
51
|
"border border-primary text-primary hover:bg-primary-bg": variant === "outlined" && color === "primary" && !disabled,
|
52
52
|
"border border-secondary text-secondary hover:bg-secondary-bg": variant === "outlined" && color === "secondary" && !disabled,
|
53
|
-
"border border-red-500 text-red-500 hover:bg-red-500": variant === "outlined" && color === "error" && !disabled,
|
53
|
+
"border border-red-500 text-red-500 hover:bg-red-500 hover:text-white": variant === "outlined" && color === "error" && !disabled,
|
54
54
|
"border border-slate-400 text-text-primary dark:text-text-primary-dark hover:bg-slate-200": variant === "outlined" && color === "text" && !disabled,
|
55
55
|
// Disabled states for all variants
|
56
56
|
"border border-transparent opacity-50": variant === "text" && disabled,
|
@@ -2,23 +2,33 @@ import React from "react";
|
|
2
2
|
import { Container } from "./Container";
|
3
3
|
import { cn } from "../util";
|
4
4
|
|
5
|
-
export
|
6
|
-
children,
|
7
|
-
maxWidth,
|
8
|
-
className,
|
9
|
-
fullScreen
|
10
|
-
}: {
|
5
|
+
export type CenteredViewProps = {
|
11
6
|
children: React.ReactNode;
|
12
7
|
maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
|
8
|
+
outerClassName?: string;
|
13
9
|
className?: string;
|
14
10
|
fullScreen?: boolean;
|
15
|
-
}
|
11
|
+
};
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
export const CenteredView = React.forwardRef<HTMLDivElement, CenteredViewProps>(({
|
14
|
+
children,
|
15
|
+
maxWidth,
|
16
|
+
outerClassName,
|
17
|
+
className,
|
18
|
+
fullScreen,
|
19
|
+
...rest
|
20
|
+
}, ref) => { // Notice how the ref is now received as the second argument
|
23
21
|
|
24
|
-
|
22
|
+
return (
|
23
|
+
<div ref={ref}
|
24
|
+
className={cn("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full", outerClassName)}
|
25
|
+
{...rest}>
|
26
|
+
<Container className={cn("m-auto", className)} maxWidth={maxWidth}>
|
27
|
+
{children}
|
28
|
+
</Container>
|
29
|
+
</div>
|
30
|
+
);
|
31
|
+
|
32
|
+
});
|
33
|
+
|
34
|
+
CenteredView.displayName = "CenteredView";
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
3
3
|
|
4
|
-
import { cn
|
4
|
+
import { cn } from "../util";
|
5
|
+
import { useInjectStyles } from "../hooks";
|
5
6
|
|
6
7
|
interface CollapseProps {
|
7
8
|
children?: React.ReactNode;
|
@@ -12,8 +12,9 @@ import {
|
|
12
12
|
paperMixin
|
13
13
|
} from "../styles";
|
14
14
|
import { InputLabel } from "./InputLabel";
|
15
|
-
import { cn, useInjectStyles } from "../util";
|
16
15
|
import { Typography } from "./Typography";
|
16
|
+
import { cn } from "../util";
|
17
|
+
import { useInjectStyles } from "../hooks";
|
17
18
|
|
18
19
|
interface DateTimeFieldProps {
|
19
20
|
value?: Date;
|
@@ -3,7 +3,8 @@ import React, { PropsWithChildren, useEffect, useState } from "react";
|
|
3
3
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
4
4
|
import { defaultBorderMixin, fieldBackgroundMixin, focusedMixin } from "../styles";
|
5
5
|
import { ExpandMoreIcon } from "../icons";
|
6
|
-
import { cn
|
6
|
+
import { cn } from "../util";
|
7
|
+
import { useInjectStyles } from "../hooks";
|
7
8
|
|
8
9
|
export function ExpandablePanel({
|
9
10
|
title,
|
@@ -8,6 +8,12 @@ export type InputLabelProps = {
|
|
8
8
|
shrink?: boolean;
|
9
9
|
} & React.LabelHTMLAttributes<HTMLLabelElement>;
|
10
10
|
|
11
|
+
const defaultClasses = {
|
12
|
+
root: "origin-left transition-transform block whitespace-nowrap overflow-hidden text-overflow-ellipsis max-w-full",
|
13
|
+
shrink: "transform translate-y-[2px] scale-75 translate-x-[12px]",
|
14
|
+
expanded: "translate-x-[16px] top-0 transform translate-y-[16px] scale-100"
|
15
|
+
};
|
16
|
+
|
11
17
|
export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(function InputLabel(inProps, ref) {
|
12
18
|
const {
|
13
19
|
shrink,
|
@@ -15,12 +21,6 @@ export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(fu
|
|
15
21
|
...other
|
16
22
|
} = inProps;
|
17
23
|
|
18
|
-
const defaultClasses = {
|
19
|
-
root: "origin-left transition-transform block whitespace-nowrap overflow-hidden text-overflow-ellipsis max-w-full",
|
20
|
-
shrink: "transform translate-y-[2px] scale-75 translate-x-[12px]",
|
21
|
-
expanded: "translate-x-[16px] top-0 transform translate-y-[16px] scale-100"
|
22
|
-
};
|
23
|
-
|
24
24
|
const computedClassName = cn(defaultClasses.root,
|
25
25
|
{
|
26
26
|
[defaultClasses.shrink]: shrink,
|
package/src/components/Label.tsx
CHANGED
@@ -9,7 +9,7 @@ const Label = React.forwardRef<
|
|
9
9
|
>(({ className, ...props }, ref) => (
|
10
10
|
<LabelPrimitive.Root
|
11
11
|
ref={ref}
|
12
|
-
className={cn("text-sm font-medium
|
12
|
+
className={cn("text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70", defaultBorderMixin, className)}
|
13
13
|
{...props}
|
14
14
|
/>
|
15
15
|
))
|
@@ -6,8 +6,9 @@ import { Command as CommandPrimitive } from "cmdk";
|
|
6
6
|
|
7
7
|
import { ExpandMoreIcon } from "../icons";
|
8
8
|
import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin, focusedMixin } from "../styles";
|
9
|
-
import { cn
|
9
|
+
import { cn } from "../util";
|
10
10
|
import { SelectInputLabel } from "./common/SelectInputLabel";
|
11
|
+
import { useOutsideAlerter } from "../hooks";
|
11
12
|
|
12
13
|
export type MultiSelectProps = {
|
13
14
|
open?: boolean,
|
@@ -2,7 +2,8 @@ import React from "react";
|
|
2
2
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
3
3
|
|
4
4
|
import { paperMixin } from "../styles";
|
5
|
-
import { cn
|
5
|
+
import { cn } from "../util";
|
6
|
+
import { useInjectStyles } from "../hooks";
|
6
7
|
|
7
8
|
export type PopoverSide = "top" | "right" | "bottom" | "left";
|
8
9
|
export type PopoverAlign = "start" | "center" | "end";
|
@@ -4,7 +4,7 @@ import { defaultBorderMixin, focusedMixin } from "../styles";
|
|
4
4
|
import { CircularProgress, IconButton } from "./index";
|
5
5
|
import { ClearIcon, SearchIcon } from "../icons";
|
6
6
|
import { cn } from "../util";
|
7
|
-
import { useDebounceValue } from "../
|
7
|
+
import { useDebounceValue } from "../hooks";
|
8
8
|
|
9
9
|
interface SearchBarProps {
|
10
10
|
onClick?: () => void;
|
@@ -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
|
4
|
+
import { cn } from "../util";
|
5
|
+
import { useInjectStyles } from "../hooks";
|
5
6
|
|
6
7
|
export type TooltipProps = {
|
7
8
|
open?: boolean,
|
@@ -87,7 +87,7 @@ export function Typography<C extends React.ElementType>(
|
|
87
87
|
variantToClasses[variant],
|
88
88
|
color ? colorToClasses[color] : "",
|
89
89
|
align !== "inherit" && `text-${align}`,
|
90
|
-
gutterBottom && "mb-
|
90
|
+
gutterBottom && "mb-2",
|
91
91
|
noWrap && "truncate",
|
92
92
|
paragraph && "mb-3",
|
93
93
|
className
|
@@ -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/index.ts
CHANGED
package/src/util/index.ts
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|