@firecms/ui 3.0.0-canary.56 → 3.0.0-canary.58
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/Menubar.d.ts +69 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.es.js +8117 -7871
- 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/{cn.d.ts → cls.d.ts} +4 -0
- package/dist/util/index.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/Alert.tsx +2 -2
- package/src/components/Autocomplete.tsx +3 -3
- package/src/components/Avatar.tsx +4 -4
- package/src/components/BooleanSwitch.tsx +4 -4
- package/src/components/BooleanSwitchWithLabel.tsx +3 -3
- package/src/components/Button.tsx +5 -5
- package/src/components/Card.tsx +2 -2
- package/src/components/CenteredView.tsx +3 -3
- package/src/components/Checkbox.tsx +3 -3
- package/src/components/Chip.tsx +2 -2
- package/src/components/CircularProgress.tsx +2 -2
- package/src/components/Collapse.tsx +2 -2
- package/src/components/Container.tsx +2 -2
- package/src/components/DateTimeField.tsx +5 -5
- package/src/components/Dialog.tsx +4 -4
- package/src/components/DialogActions.tsx +2 -2
- package/src/components/DialogContent.tsx +2 -2
- package/src/components/ExpandablePanel.tsx +5 -5
- package/src/components/FileUpload.tsx +2 -2
- package/src/components/IconButton.tsx +2 -2
- package/src/components/InfoLabel.tsx +2 -2
- package/src/components/InputLabel.tsx +2 -2
- package/src/components/Label.tsx +2 -2
- package/src/components/Markdown.tsx +2 -2
- package/src/components/Menu.tsx +3 -3
- package/src/components/Menubar.tsx +284 -0
- package/src/components/MultiSelect.tsx +6 -6
- package/src/components/Paper.tsx +2 -2
- package/src/components/Popover.tsx +2 -2
- package/src/components/RadioGroup.tsx +3 -3
- package/src/components/SearchBar.tsx +3 -3
- package/src/components/Select.tsx +9 -9
- package/src/components/Sheet.tsx +3 -3
- package/src/components/Skeleton.tsx +2 -2
- package/src/components/Table.tsx +6 -6
- package/src/components/Tabs.tsx +5 -5
- package/src/components/TextField.tsx +5 -5
- package/src/components/TextareaAutosize.tsx +2 -2
- package/src/components/Tooltip.tsx +2 -2
- package/src/components/Typography.tsx +2 -2
- package/src/components/common/SelectInputLabel.tsx +2 -2
- package/src/components/index.tsx +1 -0
- package/src/icons/Icon.tsx +2 -2
- package/src/util/cls.ts +14 -0
- package/src/util/index.ts +1 -1
- package/src/util/cn.ts +0 -6
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.58",
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
6
6
|
"funding": {
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
@@ -53,6 +53,7 @@
|
|
53
53
|
"@radix-ui/react-dialog": "^1.0.5",
|
54
54
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
55
55
|
"@radix-ui/react-label": "^2.0.2",
|
56
|
+
"@radix-ui/react-menubar": "^1.0.4",
|
56
57
|
"@radix-ui/react-popover": "^1.0.7",
|
57
58
|
"@radix-ui/react-portal": "^1.0.4",
|
58
59
|
"@radix-ui/react-radio-group": "^1.1.3",
|
@@ -116,7 +117,7 @@
|
|
116
117
|
"src",
|
117
118
|
"tailwind.config.js"
|
118
119
|
],
|
119
|
-
"gitHead": "
|
120
|
+
"gitHead": "8fb738b6abf384c0cba679f293b049a0ac56a7c2",
|
120
121
|
"publishConfig": {
|
121
122
|
"access": "public"
|
122
123
|
}
|
package/src/components/Alert.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
export interface AlertProps {
|
5
5
|
children: React.ReactNode;
|
@@ -52,7 +52,7 @@ export const Alert: React.FC<AlertProps> = ({
|
|
52
52
|
return (
|
53
53
|
<div
|
54
54
|
style={style}
|
55
|
-
className={
|
55
|
+
className={cls(
|
56
56
|
getSizeClasses(size),
|
57
57
|
"w-full",
|
58
58
|
"font-medium",
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
2
2
|
|
3
3
|
import { paperMixin } from "../styles";
|
4
4
|
import { Collapse } from "./Collapse";
|
5
|
-
import {
|
5
|
+
import { cls } from "../util";
|
6
6
|
import { useOutsideAlerter } from "../hooks";
|
7
7
|
|
8
8
|
export type AutocompleteProps = {
|
@@ -50,14 +50,14 @@ export function Autocomplete({
|
|
50
50
|
return <Collapse
|
51
51
|
in={open}
|
52
52
|
duration={50}
|
53
|
-
className={
|
53
|
+
className={cls(
|
54
54
|
"absolute top-full left-0 right-0 overflow-visible",
|
55
55
|
open ? "shadow" : "",
|
56
56
|
"my-2",
|
57
57
|
"z-20",
|
58
58
|
"w-full")}>
|
59
59
|
<div ref={autocompleteRef}
|
60
|
-
className={
|
60
|
+
className={cls(
|
61
61
|
open ? paperMixin : "",
|
62
62
|
"bg-slate-50 dark:bg-slate-900 py-2"
|
63
63
|
)}>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
import { focusedMixin } from "../styles";
|
4
4
|
|
5
5
|
export interface AvatarProps {
|
@@ -27,14 +27,14 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
|
|
27
27
|
ref={ref}
|
28
28
|
style={style}
|
29
29
|
{...props}
|
30
|
-
className={
|
30
|
+
className={cls("rounded-full flex items-center justify-center overflow-hidden",
|
31
31
|
focusedMixin,
|
32
32
|
"p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12",
|
33
33
|
outerClassName
|
34
34
|
)}>
|
35
35
|
{src
|
36
36
|
? (
|
37
|
-
<img className={
|
37
|
+
<img className={cls(
|
38
38
|
"bg-slate-100 dark:bg-slate-800",
|
39
39
|
"w-full h-full object-cover rounded-full",
|
40
40
|
className)}
|
@@ -43,7 +43,7 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
|
|
43
43
|
)
|
44
44
|
: (
|
45
45
|
<span
|
46
|
-
className={
|
46
|
+
className={cls(
|
47
47
|
"bg-slate-100 dark:bg-slate-800",
|
48
48
|
"flex items-center justify-center",
|
49
49
|
"w-full h-full py-1.5 text-lg font-medium text-slate-900 dark:text-white rounded-full",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
export type BooleanSwitchProps = {
|
5
5
|
value: boolean | null;
|
@@ -39,7 +39,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
39
39
|
onValueChange?.(!value);
|
40
40
|
}
|
41
41
|
}}
|
42
|
-
className={
|
42
|
+
className={cls(
|
43
43
|
size === "small" ? "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
|
@@ -51,7 +51,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
51
51
|
>
|
52
52
|
{allowIndeterminate && (value === null || value === undefined) && <div
|
53
53
|
key={"knob"}
|
54
|
-
className={
|
54
|
+
className={cls(
|
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
|
{
|
@@ -65,7 +65,7 @@ export const BooleanSwitch = React.forwardRef(function BooleanSwitch({
|
|
65
65
|
|
66
66
|
{!(allowIndeterminate && (value === null || value === undefined)) && <div
|
67
67
|
key={"knob"}
|
68
|
-
className={
|
68
|
+
className={cls(
|
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
|
{
|
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
focusedClasses
|
7
7
|
} from "../styles";
|
8
8
|
import { BooleanSwitch, BooleanSwitchProps } from "./BooleanSwitch";
|
9
|
-
import {
|
9
|
+
import { cls } from "../util";
|
10
10
|
|
11
11
|
export type BooleanSwitchWithLabelProps = BooleanSwitchProps & {
|
12
12
|
position?: "start" | "end",
|
@@ -53,7 +53,7 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
|
|
53
53
|
onFocus={onFocus}
|
54
54
|
onBlur={onBlur}
|
55
55
|
tabIndex={-1}
|
56
|
-
className={
|
56
|
+
className={cls(
|
57
57
|
!invisible && fieldBackgroundMixin,
|
58
58
|
!invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
|
59
59
|
disabled ? "cursor-default" : "cursor-pointer",
|
@@ -86,7 +86,7 @@ export const BooleanSwitchWithLabel = function BooleanSwitchWithLabel({
|
|
86
86
|
{...props}
|
87
87
|
/>
|
88
88
|
|
89
|
-
<div className={
|
89
|
+
<div className={cls(
|
90
90
|
"flex-grow",
|
91
91
|
position === "end" ? "mr-4" : "ml-4",
|
92
92
|
size === "small" ? "text-sm" : "text-base"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
|
3
3
|
import { focusedMixin } from "../styles";
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
|
6
6
|
export type ButtonProps<P extends React.ElementType> =
|
7
7
|
Omit<(P extends "button" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<P>), "onClick">
|
@@ -34,7 +34,7 @@ const ButtonInner = React.forwardRef<
|
|
34
34
|
const baseClasses =
|
35
35
|
"h-fit rounded-md uppercase whitespace-nowrap inline-flex items-center justify-center p-2 px-4 text-sm font-medium focus:outline-none transition ease-in-out duration-150 gap-2";
|
36
36
|
|
37
|
-
const buttonClasses =
|
37
|
+
const buttonClasses = cls({
|
38
38
|
"w-full": fullWidth,
|
39
39
|
"w-fit": !fullWidth,
|
40
40
|
// Filled Variants
|
@@ -58,7 +58,7 @@ const ButtonInner = React.forwardRef<
|
|
58
58
|
"border border-gray-500 bg-gray-500 opacity-50": variant === "filled" && disabled,
|
59
59
|
});
|
60
60
|
|
61
|
-
const sizeClasses =
|
61
|
+
const sizeClasses = cls(
|
62
62
|
{
|
63
63
|
"py-1 px-2": size === "small",
|
64
64
|
"py-2 px-4": size === "medium",
|
@@ -73,7 +73,7 @@ const ButtonInner = React.forwardRef<
|
|
73
73
|
<Component
|
74
74
|
ref={ref}
|
75
75
|
onClick={props.onClick}
|
76
|
-
className={
|
76
|
+
className={cls(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
|
77
77
|
{...(props as React.ComponentPropsWithRef<any>)}>
|
78
78
|
{startIcon}
|
79
79
|
{children}
|
@@ -85,7 +85,7 @@ const ButtonInner = React.forwardRef<
|
|
85
85
|
<button ref={ref as any}
|
86
86
|
type={props.type ?? "button"}
|
87
87
|
onClick={props.onClick}
|
88
|
-
className={
|
88
|
+
className={cls(focusedMixin, startIcon ? "pl-3" : "", baseClasses, buttonClasses, sizeClasses, className)}
|
89
89
|
disabled={disabled}
|
90
90
|
{...props as React.ButtonHTMLAttributes<HTMLButtonElement>}>
|
91
91
|
{startIcon}
|
package/src/components/Card.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useCallback } from "react";
|
2
2
|
import { cardClickableMixin, cardMixin, focusedMixin } from "../styles";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
type CardProps = {
|
6
6
|
children: React.ReactNode;
|
@@ -29,7 +29,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(({
|
|
29
29
|
role={onClick ? "button" : undefined}
|
30
30
|
tabIndex={onClick ? 0 : undefined}
|
31
31
|
onClick={onClick}
|
32
|
-
className={
|
32
|
+
className={cls(cardMixin, onClick && focusedMixin, onClick && cardClickableMixin, className)}
|
33
33
|
style={style}
|
34
34
|
{...props}>
|
35
35
|
{children}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Container } from "./Container";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
export type CenteredViewProps = {
|
6
6
|
children: React.ReactNode;
|
@@ -21,9 +21,9 @@ export const CenteredView = React.forwardRef<HTMLDivElement, CenteredViewProps>(
|
|
21
21
|
|
22
22
|
return (
|
23
23
|
<div ref={ref}
|
24
|
-
className={
|
24
|
+
className={cls("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full", outerClassName)}
|
25
25
|
{...rest}>
|
26
|
-
<Container className={
|
26
|
+
<Container className={cls("m-auto", className)} maxWidth={maxWidth}>
|
27
27
|
{children}
|
28
28
|
</Container>
|
29
29
|
</div>
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
2
2
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
3
3
|
|
4
4
|
import { Icon } from "../icons";
|
5
|
-
import {
|
5
|
+
import { cls } from "../util";
|
6
6
|
|
7
7
|
export interface CheckboxProps {
|
8
8
|
checked: boolean;
|
@@ -67,7 +67,7 @@ export const Checkbox = ({
|
|
67
67
|
disabled={disabled}
|
68
68
|
onCheckedChange={disabled ? undefined : onCheckedChange}>
|
69
69
|
|
70
|
-
<div className={
|
70
|
+
<div className={cls(
|
71
71
|
padding ? paddingClasses[size] : "",
|
72
72
|
outerSizeClasses[size],
|
73
73
|
"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
|
@@ -75,7 +75,7 @@ export const Checkbox = ({
|
|
75
75
|
onCheckedChange ? "cursor-pointer" : "cursor-default"
|
76
76
|
)}>
|
77
77
|
<div
|
78
|
-
className={
|
78
|
+
className={cls(
|
79
79
|
"border-2 relative transition-colors ease-in-out duration-150",
|
80
80
|
sizeClasses[size],
|
81
81
|
disabled
|
package/src/components/Chip.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { CHIP_COLORS,
|
2
|
+
import { CHIP_COLORS, cls, getColorSchemeForKey } from "../util";
|
3
3
|
|
4
4
|
export type ChipColorScheme = {
|
5
5
|
color: string;
|
@@ -42,7 +42,7 @@ export function Chip({
|
|
42
42
|
const usedColorScheme = typeof colorScheme === "string" ? getColorSchemeForKey(colorScheme) : colorScheme;
|
43
43
|
return (
|
44
44
|
<div
|
45
|
-
className={
|
45
|
+
className={cls("rounded-lg w-fit h-fit font-regular inline-flex gap-1",
|
46
46
|
"text-ellipsis",
|
47
47
|
onClick ? "cursor-pointer hover:bg-slate-300 hover:dark:bg-slate-700" : "",
|
48
48
|
sizeClassNames[size],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
export type CircularProgressProps = {
|
5
5
|
size?: "small" | "medium" | "large",
|
@@ -31,7 +31,7 @@ export function CircularProgress({
|
|
31
31
|
|
32
32
|
return (
|
33
33
|
<div
|
34
|
-
className={
|
34
|
+
className={cls(
|
35
35
|
sizeClasses,
|
36
36
|
borderClasses,
|
37
37
|
"inline-block animate-spin rounded-full border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
import { useInjectStyles } from "../hooks";
|
6
6
|
|
7
7
|
interface CollapseProps {
|
@@ -54,7 +54,7 @@ export function Collapse({
|
|
54
54
|
className={className}>
|
55
55
|
|
56
56
|
<Collapsible.Content
|
57
|
-
className={
|
57
|
+
className={cls(`CollapseContent-${duration}`)}
|
58
58
|
>
|
59
59
|
{children}
|
60
60
|
</Collapsible.Content>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { ForwardRefRenderFunction } from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
export type ContainerProps = {
|
5
5
|
children: React.ReactNode;
|
@@ -37,7 +37,7 @@ const ContainerInner: ForwardRefRenderFunction<HTMLDivElement, ContainerProps> =
|
|
37
37
|
return (
|
38
38
|
<div
|
39
39
|
ref={ref}
|
40
|
-
className={
|
40
|
+
className={cls("mx-auto px-3 md:px-4 lg-px-6",
|
41
41
|
classForMaxWidth,
|
42
42
|
className)}
|
43
43
|
style={style}>
|
@@ -13,7 +13,7 @@ import {
|
|
13
13
|
} from "../styles";
|
14
14
|
import { InputLabel } from "./InputLabel";
|
15
15
|
import { Typography } from "./Typography";
|
16
|
-
import {
|
16
|
+
import { cls } from "../util";
|
17
17
|
import { useInjectStyles } from "../hooks";
|
18
18
|
|
19
19
|
interface DateTimeFieldProps {
|
@@ -68,7 +68,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
68
68
|
<>
|
69
69
|
|
70
70
|
<div
|
71
|
-
className={
|
71
|
+
className={cls(
|
72
72
|
"rounded-md relative max-w-full",
|
73
73
|
!invisible && fieldBackgroundMixin,
|
74
74
|
disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
@@ -81,7 +81,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
81
81
|
|
82
82
|
{label && (
|
83
83
|
<InputLabel
|
84
|
-
className={
|
84
|
+
className={cls("absolute top-1 pointer-events-none",
|
85
85
|
!error ? (focused ? "text-primary" : "text-text-secondary dark:text-text-secondary-dark") : "text-red-500 dark:text-red-500",
|
86
86
|
disabled ? "opacity-50" : "")}
|
87
87
|
shrink={hasValue || focused}
|
@@ -96,7 +96,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
96
96
|
selected={(invalidValue ? null : value) ?? null}
|
97
97
|
onChange={onChange}
|
98
98
|
disabled={false}
|
99
|
-
popperClassName={
|
99
|
+
popperClassName={cls(paperMixin, "my-4 shadow")}
|
100
100
|
onClick={(e: any) => e.stopPropagation()}
|
101
101
|
onFocus={() => setFocused(true)}
|
102
102
|
onBlur={() => setFocused(false)}
|
@@ -106,7 +106,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
106
106
|
timeCaption="time"
|
107
107
|
dateFormat={mode === "date_time" ? "Pp" : "P"}
|
108
108
|
preventOpenOnFocus={true}
|
109
|
-
className={
|
109
|
+
className={cls(
|
110
110
|
"w-full outline-none bg-transparent leading-normal text-base px-3",
|
111
111
|
clearable ? "pr-14" : "pr-12",
|
112
112
|
"rounded-md",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
3
3
|
import { paperMixin } from "../styles";
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
|
6
6
|
export type DialogProps = {
|
7
7
|
open?: boolean;
|
@@ -69,7 +69,7 @@ export const Dialog = ({
|
|
69
69
|
<div className={"fixed inset-0 z-30"}>
|
70
70
|
|
71
71
|
<DialogPrimitive.Overlay
|
72
|
-
className={
|
72
|
+
className={cls("fixed inset-0 transition-opacity z-20 ease-in-out duration-200 bg-black bg-opacity-50 dark:bg-opacity-60 backdrop-blur-sm ",
|
73
73
|
displayed && open ? "opacity-100" : "opacity-0",
|
74
74
|
"z-20 fixed top-0 left-0 w-full h-full flex justify-center items-center"
|
75
75
|
)}
|
@@ -80,10 +80,10 @@ export const Dialog = ({
|
|
80
80
|
|
81
81
|
<DialogPrimitive.Content
|
82
82
|
onOpenAutoFocus={onOpenAutoFocus}
|
83
|
-
className={
|
83
|
+
className={cls("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out")}
|
84
84
|
>
|
85
85
|
<div
|
86
|
-
className={
|
86
|
+
className={cls(paperMixin,
|
87
87
|
"z-30",
|
88
88
|
"relative",
|
89
89
|
"outline-none focus:outline-none",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { defaultBorderMixin } from "../styles";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
export function DialogActions({
|
6
6
|
children,
|
@@ -15,7 +15,7 @@ export function DialogActions({
|
|
15
15
|
}) {
|
16
16
|
|
17
17
|
return <div
|
18
|
-
className={
|
18
|
+
className={cls(
|
19
19
|
defaultBorderMixin,
|
20
20
|
"py-3 px-4 border-t flex flex-row items-center justify-end bottom-0 right-0 left-0 text-right z-2 gap-2",
|
21
21
|
position,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
export function DialogContent({
|
5
5
|
children,
|
@@ -17,7 +17,7 @@ export function DialogContent({
|
|
17
17
|
</div>;
|
18
18
|
|
19
19
|
return <div
|
20
|
-
className={
|
20
|
+
className={cls("py-6 px-6 h-full flex-grow", className)}>
|
21
21
|
{children}
|
22
22
|
</div>;
|
23
23
|
}
|
@@ -3,7 +3,7 @@ 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 {
|
6
|
+
import { cls } from "../util";
|
7
7
|
import { useInjectStyles } from "../hooks";
|
8
8
|
|
9
9
|
export function ExpandablePanel({
|
@@ -76,7 +76,7 @@ export function ExpandablePanel({
|
|
76
76
|
|
77
77
|
return (<>
|
78
78
|
<Collapsible.Root
|
79
|
-
className={
|
79
|
+
className={cls(
|
80
80
|
!invisible && defaultBorderMixin + " border",
|
81
81
|
"rounded-md",
|
82
82
|
"w-full"
|
@@ -88,7 +88,7 @@ export function ExpandablePanel({
|
|
88
88
|
}}>
|
89
89
|
|
90
90
|
<Collapsible.Trigger
|
91
|
-
className={
|
91
|
+
className={cls(focusedMixin,
|
92
92
|
"rounded flex items-center justify-between w-full min-h-[52px]",
|
93
93
|
"hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-10",
|
94
94
|
invisible ? "border-b px-2" : "p-4",
|
@@ -98,11 +98,11 @@ export function ExpandablePanel({
|
|
98
98
|
)}
|
99
99
|
>
|
100
100
|
{title}
|
101
|
-
<ExpandMoreIcon className={
|
101
|
+
<ExpandMoreIcon className={cls("transition", open ? "rotate-180" : "")}/>
|
102
102
|
</Collapsible.Trigger>
|
103
103
|
|
104
104
|
<Collapsible.Content
|
105
|
-
className={
|
105
|
+
className={cls("CollapsibleContent")}
|
106
106
|
style={{
|
107
107
|
overflow: allowOverflow ? "visible" : "hidden"
|
108
108
|
}}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { useDropzone } from "react-dropzone";
|
3
3
|
import { fieldBackgroundHoverMixin, fieldBackgroundMixin, focusedMixin } from "../styles";
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
import { Typography } from "./Typography";
|
6
6
|
|
7
7
|
export interface FileUploadError {
|
@@ -63,7 +63,7 @@ export function FileUpload({
|
|
63
63
|
);
|
64
64
|
return <div
|
65
65
|
{...getRootProps()}
|
66
|
-
className={
|
66
|
+
className={cls(
|
67
67
|
fieldBackgroundMixin,
|
68
68
|
fieldBackgroundHoverMixin,
|
69
69
|
focusedMixin,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { focusedMixin } from "../styles";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
export type IconButtonProps<C extends React.ElementType> =
|
6
6
|
Omit<(C extends "button" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<C>), "onClick">
|
@@ -49,7 +49,7 @@ const IconButtonInner = <C extends React.ElementType = "button">({
|
|
49
49
|
type="button"
|
50
50
|
ref={ref}
|
51
51
|
{...props}
|
52
|
-
className={
|
52
|
+
className={cls(
|
53
53
|
focusedMixin,
|
54
54
|
disabled ? "opacity-50 pointer-events-none" : "cursor-pointer",
|
55
55
|
toggled ? "outline outline-2 outline-primary" : "",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
const colorClasses = {
|
5
5
|
info: "bg-sky-200 dark:bg-teal-900",
|
@@ -16,7 +16,7 @@ export function InfoLabel({
|
|
16
16
|
|
17
17
|
return (
|
18
18
|
<div
|
19
|
-
className={
|
19
|
+
className={cls("my-3 py-2 px-4 rounded", colorClasses[mode])}>
|
20
20
|
{children}
|
21
21
|
</div>
|
22
22
|
)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
import { Label } from "./Label";
|
4
4
|
|
5
5
|
export type InputLabelProps = {
|
@@ -21,7 +21,7 @@ export const InputLabel = React.forwardRef<HTMLLabelElement, InputLabelProps>(fu
|
|
21
21
|
...other
|
22
22
|
} = inProps;
|
23
23
|
|
24
|
-
const computedClassName =
|
24
|
+
const computedClassName = cls(defaultClasses.root,
|
25
25
|
{
|
26
26
|
[defaultClasses.shrink]: shrink,
|
27
27
|
[defaultClasses.expanded]: !shrink
|
package/src/components/Label.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from "react"
|
2
2
|
import * as LabelPrimitive from "@radix-ui/react-label"
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
import { defaultBorderMixin } from "../styles";
|
5
5
|
|
6
6
|
type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & {
|
@@ -19,7 +19,7 @@ const Label = React.forwardRef<
|
|
19
19
|
<LabelPrimitive.Root
|
20
20
|
ref={ref}
|
21
21
|
onClick={onClick}
|
22
|
-
className={
|
22
|
+
className={cls("text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
23
23
|
border && "border border-gray-300 dark:border-gray-700 rounded-md px-3 py-1.5",
|
24
24
|
onClick && "hover:cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-800",
|
25
25
|
defaultBorderMixin, className)}
|
@@ -3,7 +3,7 @@ import equal from "react-fast-compare"
|
|
3
3
|
|
4
4
|
// @ts-ignore
|
5
5
|
import MarkdownIt from "markdown-it";
|
6
|
-
import {
|
6
|
+
import { cls } from "../util";
|
7
7
|
|
8
8
|
export interface MarkdownProps {
|
9
9
|
source: string,
|
@@ -33,7 +33,7 @@ export const Markdown = React.memo<MarkdownProps>(function Markdown({
|
|
33
33
|
}, [source]);
|
34
34
|
|
35
35
|
return <div
|
36
|
-
className={
|
36
|
+
className={cls(proseClasses[size], "dark:prose-invert prose-headings:font-title", className)}
|
37
37
|
dangerouslySetInnerHTML={{ __html: html }}
|
38
38
|
/>;
|
39
39
|
}
|
package/src/components/Menu.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
3
3
|
import { focusedMixin, paperMixin } from "../styles";
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
|
6
6
|
export type MenuProps = {
|
7
7
|
children: React.ReactNode;
|
@@ -31,7 +31,7 @@ export function Menu({
|
|
31
31
|
{trigger}
|
32
32
|
</DropdownMenu.Trigger>
|
33
33
|
<DropdownMenu.Portal container={portalContainer}>
|
34
|
-
<DropdownMenu.Content className={
|
34
|
+
<DropdownMenu.Content className={cls(paperMixin, "shadow py-2 z-30")}>
|
35
35
|
{children}
|
36
36
|
</DropdownMenu.Content>
|
37
37
|
</DropdownMenu.Portal>
|
@@ -51,7 +51,7 @@ export function MenuItem({
|
|
51
51
|
onClick
|
52
52
|
}: MenuItemProps) {
|
53
53
|
// Dynamically adjusting the class based on the "dense" prop
|
54
|
-
const classNames =
|
54
|
+
const classNames = cls(
|
55
55
|
focusedMixin,
|
56
56
|
onClick && "cursor-pointer",
|
57
57
|
"rounded-md text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center gap-4",
|