@firecms/ui 3.0.0-canary.12 → 3.0.0-canary.120
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/Avatar.d.ts +1 -0
- package/dist/components/BooleanSwitch.d.ts +1 -1
- package/dist/components/CenteredView.d.ts +4 -2
- package/dist/components/Checkbox.d.ts +3 -2
- package/dist/components/Chip.d.ts +3 -2
- package/dist/components/DateTimeField.d.ts +3 -4
- package/dist/components/Dialog.d.ts +4 -1
- package/dist/components/InputLabel.d.ts +2 -2
- package/dist/components/Label.d.ts +4 -1
- package/dist/components/Markdown.d.ts +1 -0
- package/dist/components/Menu.d.ts +6 -2
- package/dist/components/Menubar.d.ts +79 -0
- package/dist/components/MultiSelect.d.ts +1 -4
- package/dist/components/NewMultiSelect.d.ts +60 -0
- package/dist/components/Popover.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +26 -3
- package/dist/components/Select.d.ts +4 -4
- package/dist/components/Sheet.d.ts +4 -0
- package/dist/components/Table.d.ts +10 -10
- package/dist/components/TextField.d.ts +1 -1
- package/dist/components/TextareaAutosize.d.ts +3 -34
- package/dist/components/Tooltip.d.ts +5 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useLocaleConfig.d.ts +1 -0
- package/dist/icons/Icon.d.ts +3 -3
- package/dist/index.css +77 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +13290 -13511
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19828 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.d.ts +7 -7
- package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
- package/dist/util/index.d.ts +1 -3
- package/package.json +109 -118
- package/src/components/Alert.tsx +2 -2
- package/src/components/Autocomplete.tsx +4 -3
- package/src/components/Avatar.tsx +7 -6
- package/src/components/Badge.tsx +1 -1
- package/src/components/BooleanSwitch.tsx +15 -15
- package/src/components/BooleanSwitchWithLabel.tsx +8 -8
- package/src/components/Button.tsx +11 -13
- package/src/components/Card.tsx +3 -3
- package/src/components/CenteredView.tsx +25 -15
- package/src/components/Checkbox.tsx +11 -9
- package/src/components/Chip.tsx +8 -5
- package/src/components/CircularProgress.tsx +2 -2
- package/src/components/Collapse.tsx +3 -2
- package/src/components/Container.tsx +2 -2
- package/src/components/DateTimeField.tsx +38 -48
- package/src/components/Dialog.tsx +15 -6
- package/src/components/DialogActions.tsx +2 -2
- package/src/components/DialogContent.tsx +2 -2
- package/src/components/ExpandablePanel.tsx +10 -8
- package/src/components/FileUpload.tsx +6 -9
- package/src/components/IconButton.tsx +4 -6
- package/src/components/InfoLabel.tsx +2 -2
- package/src/components/InputLabel.tsx +12 -9
- package/src/components/Label.tsx +17 -4
- package/src/components/Markdown.tsx +14 -3
- package/src/components/Menu.tsx +49 -31
- package/src/components/Menubar.tsx +322 -0
- package/src/components/MultiSelect.tsx +12 -14
- package/src/components/NewMultiSelect.tsx +370 -0
- package/src/components/Paper.tsx +2 -2
- package/src/components/Popover.tsx +17 -14
- package/src/components/RadioGroup.tsx +41 -9
- package/src/components/SearchBar.tsx +7 -8
- package/src/components/Select.tsx +92 -104
- package/src/components/Sheet.tsx +45 -28
- package/src/components/Skeleton.tsx +9 -6
- package/src/components/Table.tsx +50 -32
- package/src/components/Tabs.tsx +6 -7
- package/src/components/TextField.tsx +10 -13
- package/src/components/TextareaAutosize.tsx +3 -3
- package/src/components/Tooltip.tsx +27 -13
- package/src/components/Typography.tsx +34 -19
- package/src/components/common/SelectInputLabel.tsx +2 -2
- package/src/components/index.tsx +2 -1
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useLocaleConfig.tsx +18 -0
- package/src/icons/Icon.tsx +46 -43
- package/src/icons/icon_keys.ts +114 -1301
- package/src/index.css +77 -0
- package/src/index.ts +1 -0
- package/src/scripts/generateIconKeys.ts +20 -11
- package/src/styles.ts +7 -7
- package/src/util/cls.ts +14 -0
- package/src/util/index.ts +1 -3
- package/tailwind.config.js +5 -3
- package/dist/components/Spinner.d.ts +0 -1
- package/src/components/Spinner.tsx +0 -18
- package/src/util/cn.ts +0 -6
- /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
@@ -2,15 +2,16 @@ 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;
|
9
|
+
id?: string;
|
9
10
|
disabled?: boolean;
|
10
11
|
indeterminate?: boolean;
|
11
12
|
onCheckedChange?: (checked: boolean) => void;
|
12
13
|
padding?: boolean;
|
13
|
-
size?: "
|
14
|
+
size?: "smallest" | "small" | "medium" | "large";
|
14
15
|
color?: "primary" | "secondary";
|
15
16
|
}
|
16
17
|
|
@@ -18,20 +19,20 @@ const sizeClasses = {
|
|
18
19
|
large: "w-6 h-6 rounded flex items-center justify-center",
|
19
20
|
medium: "w-5 h-5 rounded flex items-center justify-center",
|
20
21
|
small: "w-4 h-4 rounded flex items-center justify-center",
|
21
|
-
|
22
|
+
smallest: "w-4 h-4 rounded flex items-center justify-center"
|
22
23
|
};
|
23
24
|
|
24
25
|
const outerSizeClasses = {
|
25
26
|
medium: "w-10 h-10",
|
26
27
|
small: "w-8 h-8",
|
27
28
|
large: "w-12 h-12 ",
|
28
|
-
|
29
|
+
smallest: "w-6 h-6"
|
29
30
|
}
|
30
31
|
const paddingClasses = {
|
31
32
|
medium: "p-2",
|
32
33
|
small: "p-2",
|
33
34
|
large: "p-2",
|
34
|
-
|
35
|
+
smallest: ""
|
35
36
|
}
|
36
37
|
|
37
38
|
const colorClasses = {
|
@@ -40,6 +41,7 @@ const colorClasses = {
|
|
40
41
|
}
|
41
42
|
|
42
43
|
export const Checkbox = ({
|
44
|
+
id,
|
43
45
|
checked,
|
44
46
|
indeterminate = false,
|
45
47
|
padding = true,
|
@@ -55,17 +57,17 @@ export const Checkbox = ({
|
|
55
57
|
? 20
|
56
58
|
: size === "small"
|
57
59
|
? 16
|
58
|
-
: size === "
|
60
|
+
: size === "smallest"
|
59
61
|
? 14
|
60
62
|
: 24;
|
61
63
|
return (
|
62
64
|
<CheckboxPrimitive.Root
|
63
|
-
|
65
|
+
id={id}
|
64
66
|
checked={indeterminate || isChecked}
|
65
67
|
disabled={disabled}
|
66
68
|
onCheckedChange={disabled ? undefined : onCheckedChange}>
|
67
69
|
|
68
|
-
<div className={
|
70
|
+
<div className={cls(
|
69
71
|
padding ? paddingClasses[size] : "",
|
70
72
|
outerSizeClasses[size],
|
71
73
|
"inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
|
@@ -73,7 +75,7 @@ export const Checkbox = ({
|
|
73
75
|
onCheckedChange ? "cursor-pointer" : "cursor-default"
|
74
76
|
)}>
|
75
77
|
<div
|
76
|
-
className={
|
78
|
+
className={cls(
|
77
79
|
"border-2 relative transition-colors ease-in-out duration-150",
|
78
80
|
sizeClasses[size],
|
79
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;
|
@@ -11,16 +11,17 @@ export type ChipColorKey = keyof typeof CHIP_COLORS;
|
|
11
11
|
export interface ChipProps {
|
12
12
|
className?: string;
|
13
13
|
children: React.ReactNode;
|
14
|
-
size?: "
|
14
|
+
size?: "smallest" | "small" | "medium";
|
15
15
|
colorScheme?: ChipColorScheme | ChipColorKey;
|
16
16
|
error?: boolean;
|
17
17
|
outlined?: boolean;
|
18
18
|
onClick?: () => void;
|
19
19
|
icon?: React.ReactNode;
|
20
|
+
style?: React.CSSProperties;
|
20
21
|
}
|
21
22
|
|
22
23
|
const sizeClassNames = {
|
23
|
-
|
24
|
+
smallest: "px-2 py-0.5 text-sm",
|
24
25
|
small: "px-3 py-1 text-sm",
|
25
26
|
medium: "px-4 py-1.5 text-sm"
|
26
27
|
}
|
@@ -36,13 +37,14 @@ export function Chip({
|
|
36
37
|
onClick,
|
37
38
|
icon,
|
38
39
|
size = "medium",
|
39
|
-
className
|
40
|
+
className,
|
41
|
+
style
|
40
42
|
}: ChipProps) {
|
41
43
|
|
42
44
|
const usedColorScheme = typeof colorScheme === "string" ? getColorSchemeForKey(colorScheme) : colorScheme;
|
43
45
|
return (
|
44
46
|
<div
|
45
|
-
className={
|
47
|
+
className={cls("rounded-lg max-w-full w-max h-fit font-regular inline-flex gap-1",
|
46
48
|
"text-ellipsis",
|
47
49
|
onClick ? "cursor-pointer hover:bg-slate-300 hover:dark:bg-slate-700" : "",
|
48
50
|
sizeClassNames[size],
|
@@ -54,6 +56,7 @@ export function Chip({
|
|
54
56
|
backgroundColor: error || !usedColorScheme ? undefined : usedColorScheme.color,
|
55
57
|
color: error || !usedColorScheme ? undefined : usedColorScheme.text,
|
56
58
|
overflow: "hidden",
|
59
|
+
...style
|
57
60
|
// display: "-webkit-box",
|
58
61
|
// WebkitLineClamp: 1,
|
59
62
|
// WebkitBoxOrient: "vertical",
|
@@ -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,8 @@
|
|
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
|
+
import { useInjectStyles } from "../hooks";
|
5
6
|
|
6
7
|
interface CollapseProps {
|
7
8
|
children?: React.ReactNode;
|
@@ -53,7 +54,7 @@ export function Collapse({
|
|
53
54
|
className={className}>
|
54
55
|
|
55
56
|
<Collapsible.Content
|
56
|
-
className={
|
57
|
+
className={cls(`CollapseContent-${duration}`)}
|
57
58
|
>
|
58
59
|
{children}
|
59
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}>
|
@@ -1,34 +1,28 @@
|
|
1
1
|
import React, { useRef } from "react";
|
2
|
-
// @ts-ignore
|
3
2
|
import DatePicker from "react-datepicker";
|
4
3
|
|
5
4
|
import { CalendarMonthIcon, ClearIcon, ErrorIcon } from "../icons";
|
6
5
|
import { IconButton } from "./IconButton";
|
7
|
-
import {
|
8
|
-
fieldBackgroundDisabledMixin,
|
9
|
-
fieldBackgroundHoverMixin,
|
10
|
-
fieldBackgroundMixin,
|
11
|
-
focusedMixin,
|
12
|
-
paperMixin
|
13
|
-
} from "../styles";
|
6
|
+
import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin, paperMixin } from "../styles";
|
14
7
|
import { InputLabel } from "./InputLabel";
|
15
|
-
import { cn, useInjectStyles } from "../util";
|
16
8
|
import { Typography } from "./Typography";
|
9
|
+
import { cls } from "../util";
|
10
|
+
import { useInjectStyles } from "../hooks";
|
17
11
|
|
18
12
|
interface DateTimeFieldProps {
|
19
|
-
value?: Date;
|
20
|
-
onChange
|
13
|
+
value?: Date | null;
|
14
|
+
onChange?: (date: Date | null) => void;
|
15
|
+
|
21
16
|
mode?: "date" | "date_time";
|
22
17
|
disabled?: boolean;
|
23
18
|
clearable?: boolean;
|
24
19
|
error?: boolean;
|
25
|
-
size
|
20
|
+
size?: "small" | "medium";
|
26
21
|
label?: React.ReactNode;
|
27
22
|
className?: string;
|
28
23
|
style?: React.CSSProperties;
|
29
24
|
inputClassName?: string;
|
30
25
|
invisible?: boolean;
|
31
|
-
preventOpenOnFocus?: boolean;
|
32
26
|
locale?: string;
|
33
27
|
}
|
34
28
|
|
@@ -40,11 +34,10 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
40
34
|
clearable,
|
41
35
|
mode = "date",
|
42
36
|
error,
|
43
|
-
size,
|
37
|
+
size = "medium",
|
44
38
|
className,
|
45
39
|
style,
|
46
40
|
inputClassName,
|
47
|
-
preventOpenOnFocus,
|
48
41
|
invisible,
|
49
42
|
locale
|
50
43
|
}) => {
|
@@ -60,14 +53,14 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
60
53
|
|
61
54
|
const handleClear = (e: React.MouseEvent) => {
|
62
55
|
e.preventDefault();
|
63
|
-
onChange(null);
|
56
|
+
onChange?.(null);
|
64
57
|
}
|
65
58
|
|
66
59
|
return (
|
67
60
|
<>
|
68
61
|
|
69
62
|
<div
|
70
|
-
className={
|
63
|
+
className={cls(
|
71
64
|
"rounded-md relative max-w-full",
|
72
65
|
!invisible && fieldBackgroundMixin,
|
73
66
|
disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
@@ -80,7 +73,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
80
73
|
|
81
74
|
{label && (
|
82
75
|
<InputLabel
|
83
|
-
className={
|
76
|
+
className={cls("absolute top-1 pointer-events-none",
|
84
77
|
!error ? (focused ? "text-primary" : "text-text-secondary dark:text-text-secondary-dark") : "text-red-500 dark:text-red-500",
|
85
78
|
disabled ? "opacity-50" : "")}
|
86
79
|
shrink={hasValue || focused}
|
@@ -95,8 +88,7 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
95
88
|
selected={(invalidValue ? null : value) ?? null}
|
96
89
|
onChange={onChange}
|
97
90
|
disabled={false}
|
98
|
-
popperClassName={
|
99
|
-
onClick={(e: any) => e.stopPropagation()}
|
91
|
+
popperClassName={cls(paperMixin, "my-4 shadow")}
|
100
92
|
onFocus={() => setFocused(true)}
|
101
93
|
onBlur={() => setFocused(false)}
|
102
94
|
showTimeSelect={mode === "date_time"}
|
@@ -105,11 +97,10 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
105
97
|
timeCaption="time"
|
106
98
|
dateFormat={mode === "date_time" ? "Pp" : "P"}
|
107
99
|
preventOpenOnFocus={true}
|
108
|
-
className={
|
100
|
+
className={cls(
|
109
101
|
"w-full outline-none bg-transparent leading-normal text-base px-3",
|
110
102
|
clearable ? "pr-14" : "pr-12",
|
111
103
|
"rounded-md",
|
112
|
-
!invisible && focusedMixin,
|
113
104
|
size === "small" ? "min-h-[48px]" : "min-h-[64px]",
|
114
105
|
label ? "pt-[28px] pb-2" : "py-2",
|
115
106
|
inputClassName,
|
@@ -117,7 +108,6 @@ export const DateTimeField: React.FC<DateTimeFieldProps> = ({
|
|
117
108
|
)}
|
118
109
|
/>
|
119
110
|
|
120
|
-
|
121
111
|
<IconButton
|
122
112
|
onClick={() => {
|
123
113
|
// @ts-ignore
|
@@ -527,7 +517,7 @@ const datePickerCss = `
|
|
527
517
|
.react-datepicker__year-text--in-selecting-range,
|
528
518
|
.react-datepicker__year-text--in-range {
|
529
519
|
border-radius: 100%;
|
530
|
-
background-color: #
|
520
|
+
background-color: #186ef0;
|
531
521
|
color: #fff;
|
532
522
|
}
|
533
523
|
.react-datepicker__day--selected:hover, .react-datepicker__day--in-selecting-range:hover, .react-datepicker__day--in-range:hover,
|
@@ -540,22 +530,22 @@ const datePickerCss = `
|
|
540
530
|
.react-datepicker__year-text--selected:hover,
|
541
531
|
.react-datepicker__year-text--in-selecting-range:hover,
|
542
532
|
.react-datepicker__year-text--in-range:hover {
|
543
|
-
background-color: #
|
544
|
-
}
|
545
|
-
.react-datepicker__day--keyboard-selected,
|
546
|
-
.react-datepicker__month-text--keyboard-selected,
|
547
|
-
.react-datepicker__quarter-text--keyboard-selected,
|
548
|
-
.react-datepicker__year-text--keyboard-selected {
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
}
|
553
|
-
.react-datepicker__day--keyboard-selected:hover,
|
554
|
-
.react-datepicker__month-text--keyboard-selected:hover,
|
555
|
-
.react-datepicker__quarter-text--keyboard-selected:hover,
|
556
|
-
.react-datepicker__year-text--keyboard-selected:hover {
|
557
|
-
|
558
|
-
}
|
533
|
+
background-color: #5698f9;
|
534
|
+
}
|
535
|
+
// .react-datepicker__day--keyboard-selected,
|
536
|
+
// .react-datepicker__month-text--keyboard-selected,
|
537
|
+
// .react-datepicker__quarter-text--keyboard-selected,
|
538
|
+
// .react-datepicker__year-text--keyboard-selected {
|
539
|
+
// border-radius: 100%;
|
540
|
+
// background-color: #5193f6;
|
541
|
+
// color: rgb(0, 0, 0);
|
542
|
+
// }
|
543
|
+
// .react-datepicker__day--keyboard-selected:hover,
|
544
|
+
// .react-datepicker__month-text--keyboard-selected:hover,
|
545
|
+
// .react-datepicker__quarter-text--keyboard-selected:hover,
|
546
|
+
// .react-datepicker__year-text--keyboard-selected:hover {
|
547
|
+
// background-color: #5193f6;
|
548
|
+
// }
|
559
549
|
.react-datepicker__day--in-selecting-range:not(.react-datepicker__day--in-range,
|
560
550
|
.react-datepicker__month-text--in-range,
|
561
551
|
.react-datepicker__quarter-text--in-range,
|
@@ -838,7 +828,7 @@ const datePickerCss = `
|
|
838
828
|
:is([data-theme="dark"]) .react-datepicker__month-read-view--down-arrow,
|
839
829
|
:is([data-theme="dark"]) .react-datepicker__month-year-read-view--down-arrow,
|
840
830
|
:is([data-theme="dark"]) .react-datepicker__navigation-icon::before {
|
841
|
-
border-color: #
|
831
|
+
border-color: #999;
|
842
832
|
}
|
843
833
|
|
844
834
|
|
@@ -912,7 +902,7 @@ const datePickerCss = `
|
|
912
902
|
:is([data-theme="dark"]) .react-datepicker__year-text--selected:hover,
|
913
903
|
:is([data-theme="dark"]) .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item:hover
|
914
904
|
{
|
915
|
-
background-color: #
|
905
|
+
background-color: #262626;
|
916
906
|
}
|
917
907
|
|
918
908
|
:is([data-theme="dark"]) .react-datepicker__day--selected,
|
@@ -930,12 +920,12 @@ const datePickerCss = `
|
|
930
920
|
background-color: #0e528f;
|
931
921
|
}
|
932
922
|
|
933
|
-
:is([data-theme="dark"]) .react-datepicker__day--keyboard-selected,
|
934
|
-
:is([data-theme="dark"]) .react-datepicker__month-text--keyboard-selected,
|
935
|
-
:is([data-theme="dark"]) .react-datepicker__quarter-text--keyboard-selected,
|
936
|
-
:is([data-theme="dark"]) .react-datepicker__year-text--keyboard-selected {
|
937
|
-
|
938
|
-
}
|
923
|
+
// :is([data-theme="dark"]) .react-datepicker__day--keyboard-selected,
|
924
|
+
// :is([data-theme="dark"]) .react-datepicker__month-text--keyboard-selected,
|
925
|
+
// :is([data-theme="dark"]) .react-datepicker__quarter-text--keyboard-selected,
|
926
|
+
// :is([data-theme="dark"]) .react-datepicker__year-text--keyboard-selected {
|
927
|
+
// background-color: #0e529f;
|
928
|
+
// }
|
939
929
|
|
940
930
|
:is([data-theme="dark"]) .react-datepicker__today-button {
|
941
931
|
background-color: #262626;
|
@@ -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;
|
@@ -15,6 +15,9 @@ export type DialogProps = {
|
|
15
15
|
maxWidth?: keyof typeof widthClasses;
|
16
16
|
modal?: boolean;
|
17
17
|
onOpenAutoFocus?: (e: Event) => void;
|
18
|
+
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
19
|
+
onPointerDownOutside?: (e: Event) => void;
|
20
|
+
onInteractOutside?: (e: Event) => void;
|
18
21
|
};
|
19
22
|
|
20
23
|
const widthClasses = {
|
@@ -43,7 +46,10 @@ export const Dialog = ({
|
|
43
46
|
scrollable = true,
|
44
47
|
maxWidth = "lg",
|
45
48
|
modal = true,
|
46
|
-
onOpenAutoFocus
|
49
|
+
onOpenAutoFocus,
|
50
|
+
onEscapeKeyDown,
|
51
|
+
onPointerDownOutside,
|
52
|
+
onInteractOutside
|
47
53
|
}: DialogProps) => {
|
48
54
|
const [displayed, setDisplayed] = useState(false);
|
49
55
|
|
@@ -51,7 +57,7 @@ export const Dialog = ({
|
|
51
57
|
if (!open) {
|
52
58
|
const timeout = setTimeout(() => {
|
53
59
|
setDisplayed(false);
|
54
|
-
},
|
60
|
+
}, 150);
|
55
61
|
return () => clearTimeout(timeout);
|
56
62
|
} else {
|
57
63
|
setDisplayed(true);
|
@@ -69,7 +75,7 @@ export const Dialog = ({
|
|
69
75
|
<div className={"fixed inset-0 z-30"}>
|
70
76
|
|
71
77
|
<DialogPrimitive.Overlay
|
72
|
-
className={
|
78
|
+
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
79
|
displayed && open ? "opacity-100" : "opacity-0",
|
74
80
|
"z-20 fixed top-0 left-0 w-full h-full flex justify-center items-center"
|
75
81
|
)}
|
@@ -79,11 +85,14 @@ export const Dialog = ({
|
|
79
85
|
/>
|
80
86
|
|
81
87
|
<DialogPrimitive.Content
|
88
|
+
onEscapeKeyDown={onEscapeKeyDown}
|
82
89
|
onOpenAutoFocus={onOpenAutoFocus}
|
83
|
-
|
90
|
+
onPointerDownOutside={onPointerDownOutside}
|
91
|
+
onInteractOutside={onInteractOutside}
|
92
|
+
className={cls("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out")}
|
84
93
|
>
|
85
94
|
<div
|
86
|
-
className={
|
95
|
+
className={cls(paperMixin,
|
87
96
|
"z-30",
|
88
97
|
"relative",
|
89
98
|
"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
|
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React, { PropsWithChildren, useEffect, useState } from "react";
|
2
2
|
|
3
3
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
4
|
-
import { defaultBorderMixin, fieldBackgroundMixin
|
4
|
+
import { defaultBorderMixin, fieldBackgroundMixin } from "../styles";
|
5
5
|
import { ExpandMoreIcon } from "../icons";
|
6
|
-
import {
|
6
|
+
import { cls } from "../util";
|
7
|
+
import { useInjectStyles } from "../hooks";
|
7
8
|
|
8
9
|
export function ExpandablePanel({
|
9
10
|
title,
|
@@ -75,9 +76,10 @@ export function ExpandablePanel({
|
|
75
76
|
|
76
77
|
return (<>
|
77
78
|
<Collapsible.Root
|
78
|
-
className={
|
79
|
+
className={cls(
|
79
80
|
!invisible && defaultBorderMixin + " border",
|
80
|
-
"rounded-md"
|
81
|
+
"rounded-md",
|
82
|
+
"w-full"
|
81
83
|
)}
|
82
84
|
open={open}
|
83
85
|
onOpenChange={(updatedOpen: boolean) => {
|
@@ -86,9 +88,9 @@ export function ExpandablePanel({
|
|
86
88
|
}}>
|
87
89
|
|
88
90
|
<Collapsible.Trigger
|
89
|
-
className={
|
91
|
+
className={cls(
|
90
92
|
"rounded flex items-center justify-between w-full min-h-[52px]",
|
91
|
-
"hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-
|
93
|
+
"hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-20",
|
92
94
|
invisible ? "border-b px-2" : "p-4",
|
93
95
|
invisible && defaultBorderMixin,
|
94
96
|
asField && fieldBackgroundMixin,
|
@@ -96,11 +98,11 @@ export function ExpandablePanel({
|
|
96
98
|
)}
|
97
99
|
>
|
98
100
|
{title}
|
99
|
-
<ExpandMoreIcon className={
|
101
|
+
<ExpandMoreIcon className={cls("transition", open ? "rotate-180" : "")}/>
|
100
102
|
</Collapsible.Trigger>
|
101
103
|
|
102
104
|
<Collapsible.Content
|
103
|
-
className={
|
105
|
+
className={cls("CollapsibleContent")}
|
104
106
|
style={{
|
105
107
|
overflow: allowOverflow ? "visible" : "hidden"
|
106
108
|
}}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { useDropzone } from "react-dropzone";
|
3
|
-
import { fieldBackgroundHoverMixin, fieldBackgroundMixin
|
4
|
-
import {
|
3
|
+
import { fieldBackgroundHoverMixin, fieldBackgroundMixin } from "../styles";
|
4
|
+
import { cls } from "../util";
|
5
5
|
import { Typography } from "./Typography";
|
6
6
|
|
7
7
|
export interface FileUploadError {
|
@@ -38,7 +38,7 @@ export function FileUpload({
|
|
38
38
|
disabled,
|
39
39
|
maxFiles,
|
40
40
|
title,
|
41
|
-
uploadDescription
|
41
|
+
uploadDescription,
|
42
42
|
children,
|
43
43
|
preventDropOnDocument = true,
|
44
44
|
size
|
@@ -63,21 +63,18 @@ export function FileUpload({
|
|
63
63
|
);
|
64
64
|
return <div
|
65
65
|
{...getRootProps()}
|
66
|
-
className={
|
66
|
+
className={cls(
|
67
67
|
fieldBackgroundMixin,
|
68
|
-
fieldBackgroundHoverMixin,
|
69
|
-
focusedMixin,
|
70
68
|
"flex gap-2",
|
71
69
|
"p-4 box-border relative items-center border-2 border-solid border-transparent outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid",
|
72
70
|
{
|
73
71
|
"h-44": size === "medium",
|
74
72
|
"h-28": size === "small",
|
75
73
|
"cursor-pointer": !disabled,
|
76
|
-
|
74
|
+
[fieldBackgroundHoverMixin]: !isDragActive,
|
77
75
|
"transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-red-500": isDragReject,
|
78
76
|
"transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-green-500": isDragAccept,
|
79
|
-
})}
|
80
|
-
>
|
77
|
+
})}>
|
81
78
|
|
82
79
|
<Typography variant={"caption"} color={"secondary"} className={"absolute top-2 left-3.5 cursor-inherit"}>
|
83
80
|
{title}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
3
|
-
import { cn } from "../util";
|
2
|
+
import { cls } from "../util";
|
4
3
|
|
5
4
|
export type IconButtonProps<C extends React.ElementType> =
|
6
5
|
Omit<(C extends "button" ? React.ButtonHTMLAttributes<HTMLButtonElement> : React.ComponentProps<C>), "onClick">
|
@@ -15,7 +14,7 @@ export type IconButtonProps<C extends React.ElementType> =
|
|
15
14
|
}
|
16
15
|
|
17
16
|
const buttonClasses =
|
18
|
-
"hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-
|
17
|
+
"hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-slate-800";
|
19
18
|
const baseClasses =
|
20
19
|
"inline-flex items-center justify-center p-2 text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150";
|
21
20
|
const colorClasses = "text-slate-600 visited:text-slate-600 dark:text-slate-300 dark:visited:text-gray-300";
|
@@ -42,15 +41,14 @@ const IconButtonInner = <C extends React.ElementType = "button">({
|
|
42
41
|
...props
|
43
42
|
}: IconButtonProps<C>, ref: React.ForwardedRef<HTMLButtonElement>) => {
|
44
43
|
|
45
|
-
const bgClasses = variant === "ghost" ? "bg-transparent" : "bg-slate-50 dark:bg-gray-950 dark:bg-opacity-50";
|
44
|
+
const bgClasses = variant === "ghost" ? "bg-transparent" : "bg-slate-200 bg-opacity-50 dark:bg-gray-950 dark:bg-opacity-50";
|
46
45
|
const Component: React.ElementType<any> = component || "button";
|
47
46
|
return (
|
48
47
|
<Component
|
49
48
|
type="button"
|
50
49
|
ref={ref}
|
51
50
|
{...props}
|
52
|
-
className={
|
53
|
-
focusedMixin,
|
51
|
+
className={cls(
|
54
52
|
disabled ? "opacity-50 pointer-events-none" : "cursor-pointer",
|
55
53
|
toggled ? "outline outline-2 outline-primary" : "",
|
56
54
|
colorClasses,
|
@@ -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
|
)
|