@firecms/ui 3.0.0-beta.1 → 3.0.0-beta.10
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 +6 -7
- package/dist/components/Avatar.d.ts +1 -0
- package/dist/components/BooleanSwitch.d.ts +1 -1
- package/dist/components/Button.d.ts +3 -2
- package/dist/components/Card.d.ts +4 -2
- package/dist/components/CenteredView.d.ts +5 -2
- package/dist/components/Checkbox.d.ts +5 -4
- package/dist/components/Chip.d.ts +3 -2
- package/dist/components/DateTimeField.d.ts +5 -7
- package/dist/components/Dialog.d.ts +5 -1
- package/dist/components/DialogTitle.d.ts +9 -0
- package/dist/components/ExpandablePanel.d.ts +2 -1
- package/dist/components/FileUpload.d.ts +1 -1
- package/dist/components/IconButton.d.ts +1 -1
- package/dist/components/InputLabel.d.ts +2 -2
- package/dist/components/Label.d.ts +7 -0
- package/dist/components/Markdown.d.ts +1 -0
- package/dist/components/Menu.d.ts +7 -2
- package/dist/components/Menubar.d.ts +79 -0
- package/dist/components/MultiSelect.d.ts +31 -16
- package/dist/components/Popover.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +28 -0
- package/dist/components/Select.d.ts +6 -10
- package/dist/components/Separator.d.ts +5 -0
- package/dist/components/Sheet.d.ts +6 -0
- package/dist/components/Slider.d.ts +21 -0
- package/dist/components/Table.d.ts +10 -10
- package/dist/components/TextField.d.ts +3 -3
- package/dist/components/TextareaAutosize.d.ts +3 -34
- package/dist/components/Tooltip.d.ts +9 -3
- package/dist/components/Typography.d.ts +5 -4
- package/dist/components/_MultiSelect.d.ts +0 -0
- package/dist/components/index.d.ts +7 -2
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useLocaleConfig.d.ts +1 -0
- package/dist/icons/HandleIcon.d.ts +1 -0
- package/dist/icons/Icon.d.ts +3 -3
- package/dist/icons/index.d.ts +1 -0
- package/dist/index.css +73 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +13341 -13478
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19788 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.d.ts +10 -10
- package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
- package/dist/util/index.d.ts +1 -3
- package/package.json +112 -105
- package/src/components/Alert.tsx +6 -5
- package/src/components/Autocomplete.tsx +4 -3
- package/src/components/Avatar.tsx +8 -7
- package/src/components/Badge.tsx +1 -1
- package/src/components/BooleanSwitch.tsx +18 -17
- package/src/components/BooleanSwitchWithLabel.tsx +8 -8
- package/src/components/Button.tsx +59 -35
- package/src/components/Card.tsx +19 -13
- package/src/components/CenteredView.tsx +26 -14
- package/src/components/Checkbox.tsx +36 -25
- package/src/components/Chip.tsx +9 -6
- 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 +45 -50
- package/src/components/DebouncedTextField.tsx +3 -2
- package/src/components/Dialog.tsx +18 -6
- package/src/components/DialogActions.tsx +2 -2
- package/src/components/DialogContent.tsx +2 -2
- package/src/components/DialogTitle.tsx +35 -0
- package/src/components/ExpandablePanel.tsx +19 -11
- package/src/components/FileUpload.tsx +7 -10
- package/src/components/IconButton.tsx +7 -8
- package/src/components/InfoLabel.tsx +2 -2
- package/src/components/InputLabel.tsx +12 -9
- package/src/components/Label.tsx +31 -0
- package/src/components/Markdown.tsx +14 -3
- package/src/components/Menu.tsx +51 -30
- package/src/components/Menubar.tsx +322 -0
- package/src/components/MultiSelect.tsx +335 -165
- package/src/components/Paper.tsx +2 -2
- package/src/components/Popover.tsx +17 -13
- package/src/components/RadioGroup.tsx +73 -0
- package/src/components/SearchBar.tsx +8 -9
- package/src/components/Select.tsx +97 -125
- package/src/components/Separator.tsx +28 -0
- package/src/components/Sheet.tsx +51 -30
- package/src/components/Skeleton.tsx +9 -6
- package/src/components/Slider.tsx +109 -0
- package/src/components/Table.tsx +52 -35
- package/src/components/Tabs.tsx +8 -9
- package/src/components/TextField.tsx +35 -23
- package/src/components/TextareaAutosize.tsx +3 -3
- package/src/components/Tooltip.tsx +37 -16
- package/src/components/Typography.tsx +43 -27
- package/src/components/_MultiSelect.tsx +222 -0
- package/src/components/common/SelectInputLabel.tsx +2 -2
- package/src/components/index.tsx +7 -2
- package/src/hooks/index.ts +4 -0
- package/src/{util → hooks}/useInjectStyles.tsx +1 -1
- package/src/hooks/useLocaleConfig.tsx +18 -0
- package/src/icons/GitHubIcon.tsx +1 -0
- package/src/icons/HandleIcon.tsx +10 -0
- package/src/icons/Icon.tsx +46 -43
- package/src/icons/icon_keys.ts +114 -1301
- package/src/icons/index.ts +1 -0
- package/src/index.css +73 -0
- package/src/index.ts +1 -0
- package/src/scripts/generateIconKeys.ts +20 -12
- package/src/scripts/saveIconFiles.ts +2 -1
- package/src/styles.ts +10 -10
- package/src/util/cls.ts +14 -0
- package/src/util/index.ts +1 -3
- package/tailwind.config.js +70 -0
- package/dist/components/Spinner.d.ts +0 -1
- package/src/components/Spinner.tsx +0 -17
- 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}/useOutsideAlerter.tsx +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactEventHandler } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { cn } from "../util";
|
|
2
|
+
import { cls } from "../util";
|
|
4
3
|
|
|
5
|
-
export type
|
|
4
|
+
export type TypographyVariant = keyof typeof typographyVariants;
|
|
5
|
+
export type TypographyProps<C extends React.ElementType = "span"> = {
|
|
6
6
|
align?: "center" | "inherit" | "justify" | "left" | "right";
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
className?: string;
|
|
@@ -10,14 +10,14 @@ export type TextProps<C extends React.ElementType> = {
|
|
|
10
10
|
gutterBottom?: boolean;
|
|
11
11
|
noWrap?: boolean;
|
|
12
12
|
paragraph?: boolean;
|
|
13
|
-
variant?:
|
|
13
|
+
variant?: TypographyVariant;
|
|
14
14
|
variantMapping?: { [key: string]: string };
|
|
15
15
|
color?: "inherit" | "initial" | "primary" | "secondary" | "disabled" | "error";
|
|
16
16
|
onClick?: ReactEventHandler<HTMLElement>;
|
|
17
17
|
style?: React.CSSProperties;
|
|
18
18
|
} & React.ComponentPropsWithoutRef<C>;
|
|
19
19
|
|
|
20
|
-
const
|
|
20
|
+
const typographyVariants = {
|
|
21
21
|
h1: "h1",
|
|
22
22
|
h2: "h2",
|
|
23
23
|
h3: "h3",
|
|
@@ -43,24 +43,41 @@ 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
|
-
h1: "
|
|
48
|
-
h2: "
|
|
49
|
-
h3: "
|
|
50
|
-
h4: "
|
|
51
|
-
h5: "
|
|
52
|
-
h6: "
|
|
53
|
-
subtitle1: "
|
|
54
|
-
subtitle2: "
|
|
55
|
-
body1: "
|
|
56
|
-
body2: "
|
|
57
|
-
label: "
|
|
58
|
-
inherit: "
|
|
59
|
-
caption: "
|
|
60
|
-
button: "
|
|
64
|
+
h1: "typography-h1",
|
|
65
|
+
h2: "typography-h2",
|
|
66
|
+
h3: "typography-h3",
|
|
67
|
+
h4: "typography-h4",
|
|
68
|
+
h5: "typography-h5",
|
|
69
|
+
h6: "typography-h6",
|
|
70
|
+
subtitle1: "typography-subtitle1",
|
|
71
|
+
subtitle2: "typography-subtitle2",
|
|
72
|
+
body1: "typography-body1",
|
|
73
|
+
body2: "typography-body2",
|
|
74
|
+
label: "typography-label",
|
|
75
|
+
inherit: "typography-inherit",
|
|
76
|
+
caption: "typography-caption",
|
|
77
|
+
button: "typography-button"
|
|
61
78
|
};
|
|
62
79
|
|
|
63
|
-
export function Typography<C extends React.ElementType>(
|
|
80
|
+
export function Typography<C extends React.ElementType = "span">(
|
|
64
81
|
{
|
|
65
82
|
align = "inherit",
|
|
66
83
|
color = "primary",
|
|
@@ -71,25 +88,24 @@ export function Typography<C extends React.ElementType>(
|
|
|
71
88
|
noWrap = false,
|
|
72
89
|
paragraph = false,
|
|
73
90
|
variant = "body1",
|
|
74
|
-
variantMapping =
|
|
91
|
+
variantMapping = typographyVariants,
|
|
75
92
|
style,
|
|
76
93
|
onClick,
|
|
77
94
|
...other
|
|
78
|
-
}:
|
|
95
|
+
}: TypographyProps<C>
|
|
79
96
|
) {
|
|
80
97
|
const Component =
|
|
81
98
|
component ||
|
|
82
|
-
(paragraph ? "p" : variantMapping[variant] ||
|
|
99
|
+
(paragraph ? "p" : variantMapping[variant] || typographyVariants[variant]) ||
|
|
83
100
|
"span";
|
|
84
101
|
|
|
85
|
-
const classes =
|
|
86
|
-
focusedMixin,
|
|
102
|
+
const classes = cls(
|
|
87
103
|
variantToClasses[variant],
|
|
88
104
|
color ? colorToClasses[color] : "",
|
|
89
105
|
align !== "inherit" && `text-${align}`,
|
|
90
|
-
gutterBottom &&
|
|
106
|
+
gutterBottom && gutterBottomClasses[variant],
|
|
91
107
|
noWrap && "truncate",
|
|
92
|
-
paragraph && "mb-
|
|
108
|
+
paragraph && "mb-3",
|
|
93
109
|
className
|
|
94
110
|
);
|
|
95
111
|
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// import * as React from "react";
|
|
2
|
+
// import { useEffect } from "react";
|
|
3
|
+
// import * as Dialog from "@radix-ui/react-dialog";
|
|
4
|
+
//
|
|
5
|
+
// import { Command as CommandPrimitive } from "cmdk";
|
|
6
|
+
//
|
|
7
|
+
// import { ExpandMoreIcon } from "../icons";
|
|
8
|
+
// import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin, focusedDisabled } from "../styles";
|
|
9
|
+
// import { cls } from "../util";
|
|
10
|
+
// import { SelectInputLabel } from "./common/SelectInputLabel";
|
|
11
|
+
// import { useOutsideAlerter } from "../hooks";
|
|
12
|
+
//
|
|
13
|
+
// export type MultiSelectProps = {
|
|
14
|
+
// open?: boolean,
|
|
15
|
+
// name?: string,
|
|
16
|
+
// id?: string,
|
|
17
|
+
// onOpenChange?: (open: boolean) => void,
|
|
18
|
+
// value?: string[],
|
|
19
|
+
// containerClassName?: string,
|
|
20
|
+
// className?: string,
|
|
21
|
+
// inputClassName?: string,
|
|
22
|
+
// onMultiValueChange?: (updatedValue: string[]) => void,
|
|
23
|
+
// placeholder?: React.ReactNode,
|
|
24
|
+
// renderValue?: (values: string, index:number) => React.ReactNode,
|
|
25
|
+
// renderValues?: (values: string[]) => React.ReactNode,
|
|
26
|
+
// size?: "small" | "medium",
|
|
27
|
+
// label?: React.ReactNode,
|
|
28
|
+
// disabled?: boolean,
|
|
29
|
+
// error?: boolean,
|
|
30
|
+
// position?: "item-aligned" | "popper",
|
|
31
|
+
// inputRef?: React.RefObject<HTMLButtonElement>,
|
|
32
|
+
// children?: React.ReactNode,
|
|
33
|
+
// };
|
|
34
|
+
//
|
|
35
|
+
// interface MultiSelectContextProps {
|
|
36
|
+
// fieldValue?: string[];
|
|
37
|
+
// setInputValue: (v: string) => void;
|
|
38
|
+
// onValueChangeInternal: (v: string) => void;
|
|
39
|
+
// }
|
|
40
|
+
//
|
|
41
|
+
// export const MultiSelectContext = React.createContext<MultiSelectContextProps>({} as any);
|
|
42
|
+
//
|
|
43
|
+
// export function MultiSelect({
|
|
44
|
+
// value,
|
|
45
|
+
// open,
|
|
46
|
+
// onMultiValueChange,
|
|
47
|
+
// size = "medium",
|
|
48
|
+
// label,
|
|
49
|
+
// disabled,
|
|
50
|
+
// renderValue,
|
|
51
|
+
// renderValues,
|
|
52
|
+
// containerClassName,
|
|
53
|
+
// className,
|
|
54
|
+
// children,
|
|
55
|
+
// error
|
|
56
|
+
// }: MultiSelectProps) {
|
|
57
|
+
//
|
|
58
|
+
// const containerRef = React.useRef<HTMLInputElement>(null);
|
|
59
|
+
// const inputRef = React.useRef<HTMLInputElement>(null);
|
|
60
|
+
// const listRef = React.useRef<HTMLDivElement>(null);
|
|
61
|
+
// useOutsideAlerter(listRef, () => setOpenInternal(false));
|
|
62
|
+
//
|
|
63
|
+
// const [openInternal, setOpenInternal] = React.useState(false);
|
|
64
|
+
// useEffect(() => {
|
|
65
|
+
// setOpenInternal(open ?? false);
|
|
66
|
+
// }, [open]);
|
|
67
|
+
//
|
|
68
|
+
// const onValueChangeInternal = React.useCallback((newValue: string) => {
|
|
69
|
+
// if (Array.isArray(value) && value.includes(newValue)) {
|
|
70
|
+
// onMultiValueChange?.(value.filter(v => v !== newValue));
|
|
71
|
+
// } else {
|
|
72
|
+
// onMultiValueChange?.([...(value ?? []), newValue]);
|
|
73
|
+
// }
|
|
74
|
+
// }, [value, onMultiValueChange]);
|
|
75
|
+
//
|
|
76
|
+
// const [inputValue, setInputValue] = React.useState("");
|
|
77
|
+
// const [boundingRect, setBoundingRect] = React.useState<DOMRect | null>(null);
|
|
78
|
+
//
|
|
79
|
+
// const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
80
|
+
// const input = inputRef.current
|
|
81
|
+
// if (input) {
|
|
82
|
+
// if (e.key === "Delete" || e.key === "Backspace") {
|
|
83
|
+
// if (input.value === "") {
|
|
84
|
+
// const newSelected = [...(value ?? [])];
|
|
85
|
+
// newSelected.pop();
|
|
86
|
+
// onMultiValueChange?.(newSelected);
|
|
87
|
+
// }
|
|
88
|
+
// }
|
|
89
|
+
// // This is not a default behaviour of the <input /> field
|
|
90
|
+
// if (e.key === "Escape") {
|
|
91
|
+
// input.blur();
|
|
92
|
+
// setOpenInternal(false);
|
|
93
|
+
// e.stopPropagation();
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
|
+
// }, [onMultiValueChange, value]);
|
|
97
|
+
//
|
|
98
|
+
// const openDialog = React.useCallback(() => {
|
|
99
|
+
// setBoundingRect(containerRef.current?.getBoundingClientRect() ?? null);
|
|
100
|
+
// setOpenInternal(true);
|
|
101
|
+
// }, []);
|
|
102
|
+
//
|
|
103
|
+
// const usedBoundingRect = boundingRect ?? containerRef.current?.getBoundingClientRect();
|
|
104
|
+
// const maxHeight = window.innerHeight - (usedBoundingRect?.top ?? 0) - (usedBoundingRect?.height ?? 0) - 16;
|
|
105
|
+
//
|
|
106
|
+
// return (<>
|
|
107
|
+
//
|
|
108
|
+
// {typeof label === "string" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}
|
|
109
|
+
//
|
|
110
|
+
// <CommandPrimitive onKeyDown={handleKeyDown}
|
|
111
|
+
// onClick={() => {
|
|
112
|
+
// inputRef.current?.focus();
|
|
113
|
+
// openDialog()
|
|
114
|
+
// }}
|
|
115
|
+
// className={cls("relative overflow-visible bg-transparent", containerClassName)}>
|
|
116
|
+
// <div
|
|
117
|
+
// ref={containerRef}
|
|
118
|
+
// className={cls(
|
|
119
|
+
// "flex flex-row",
|
|
120
|
+
// size === "small" ? "min-h-[42px]" : "min-h-[64px]",
|
|
121
|
+
// "select-none rounded-md text-sm",
|
|
122
|
+
// fieldBackgroundMixin,
|
|
123
|
+
// disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
|
124
|
+
// "relative flex items-center",
|
|
125
|
+
// "p-4",
|
|
126
|
+
// error ? "text-red-500 dark:text-red-600" : "focus:text-text-primary dark:focus:text-text-primary-dark",
|
|
127
|
+
// error ? "border border-red-500 dark:border-red-600" : "",
|
|
128
|
+
// className)}
|
|
129
|
+
// >
|
|
130
|
+
// <div className={cls("flex-grow flex gap-1.5 flex-wrap items-center")}>
|
|
131
|
+
// {renderValue && (value ?? []).map((v, i) => renderValue(v, i))}
|
|
132
|
+
// {renderValues && renderValues(value ?? [])}
|
|
133
|
+
// <CommandPrimitive.Input
|
|
134
|
+
// ref={inputRef}
|
|
135
|
+
// value={inputValue}
|
|
136
|
+
// onValueChange={setInputValue}
|
|
137
|
+
// // onBlur={() => setOpenInternal(false)}
|
|
138
|
+
// onFocus={openDialog}
|
|
139
|
+
// className={cls("ml-2 bg-transparent outline-none flex-1 h-full w-full ", focusedDisabled)}
|
|
140
|
+
// />
|
|
141
|
+
// </div>
|
|
142
|
+
// <div className={"px-2 h-full flex items-center"}>
|
|
143
|
+
// <ExpandMoreIcon size={"small"}
|
|
144
|
+
// className={cls("transition ", openInternal ? "rotate-180" : "")}/>
|
|
145
|
+
// </div>
|
|
146
|
+
//
|
|
147
|
+
// </div>
|
|
148
|
+
//
|
|
149
|
+
// <Dialog.Root open={openInternal}
|
|
150
|
+
// modal={true}
|
|
151
|
+
// onOpenChange={setOpenInternal}>
|
|
152
|
+
// <Dialog.Portal>
|
|
153
|
+
// <MultiSelectContext.Provider
|
|
154
|
+
// value={{
|
|
155
|
+
// fieldValue: value,
|
|
156
|
+
// setInputValue,
|
|
157
|
+
// onValueChangeInternal
|
|
158
|
+
// }}>
|
|
159
|
+
// <div
|
|
160
|
+
// ref={listRef}
|
|
161
|
+
// className={"z-50 absolute overflow-auto outline-none"}
|
|
162
|
+
// style={{
|
|
163
|
+
// pointerEvents: openInternal ? "auto" : "none",
|
|
164
|
+
// top: (usedBoundingRect?.top ?? 0) + (usedBoundingRect?.height ?? 0),
|
|
165
|
+
// left: usedBoundingRect?.left,
|
|
166
|
+
// width: usedBoundingRect?.width,
|
|
167
|
+
// maxHeight: maxHeight,
|
|
168
|
+
//
|
|
169
|
+
// }}>
|
|
170
|
+
//
|
|
171
|
+
// <CommandPrimitive.Group
|
|
172
|
+
// className="mt-2 text-slate-900 dark:text-white animate-in z-50 border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-800 p-2 rounded-lg shadow-lg flex flex-col outline-none w-full"
|
|
173
|
+
// >
|
|
174
|
+
//
|
|
175
|
+
// {children}
|
|
176
|
+
// </CommandPrimitive.Group>
|
|
177
|
+
//
|
|
178
|
+
// </div>
|
|
179
|
+
// </MultiSelectContext.Provider>
|
|
180
|
+
// </Dialog.Portal>
|
|
181
|
+
// </Dialog.Root>
|
|
182
|
+
// </CommandPrimitive>
|
|
183
|
+
//
|
|
184
|
+
// </>
|
|
185
|
+
// )
|
|
186
|
+
// }
|
|
187
|
+
//
|
|
188
|
+
// export interface MultiSelectItemProps {
|
|
189
|
+
// value: string;
|
|
190
|
+
// children?: React.ReactNode,
|
|
191
|
+
// className?: string;
|
|
192
|
+
// }
|
|
193
|
+
//
|
|
194
|
+
// export function MultiSelectItem({ children, value, className }: MultiSelectItemProps) {
|
|
195
|
+
//
|
|
196
|
+
// const context = React.useContext(MultiSelectContext);
|
|
197
|
+
// if (!context) throw new Error("MultiSelectItem must be used inside a MultiSelect");
|
|
198
|
+
// const { fieldValue, setInputValue, onValueChangeInternal } = context;
|
|
199
|
+
//
|
|
200
|
+
// return <CommandPrimitive.Item
|
|
201
|
+
// onMouseDown={(e) => {
|
|
202
|
+
// e.preventDefault();
|
|
203
|
+
// e.stopPropagation();
|
|
204
|
+
// }}
|
|
205
|
+
// onSelect={(_) => {
|
|
206
|
+
// setInputValue("");
|
|
207
|
+
// onValueChangeInternal(value);
|
|
208
|
+
// }}
|
|
209
|
+
// className={cls(
|
|
210
|
+
// (fieldValue ?? []).includes(value) ? "bg-slate-200 dark:bg-slate-950" : "",
|
|
211
|
+
// "cursor-pointer",
|
|
212
|
+
// "m-1",
|
|
213
|
+
// "ring-offset-transparent",
|
|
214
|
+
// "p-2 rounded aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-offset-2",
|
|
215
|
+
// "aria-[selected=true]:bg-slate-100 aria-[selected=true]:dark:bg-slate-900",
|
|
216
|
+
// "cursor-pointer p-2 rounded aria-[selected=true]:bg-slate-100 aria-[selected=true]:dark:bg-slate-900",
|
|
217
|
+
// className
|
|
218
|
+
// )}
|
|
219
|
+
// >
|
|
220
|
+
// {children}
|
|
221
|
+
// </CommandPrimitive.Item>;
|
|
222
|
+
// }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { cls } from "../../util";
|
|
3
3
|
|
|
4
4
|
export function SelectInputLabel({ children, error }: { children: React.ReactNode, error?: boolean }) {
|
|
5
|
-
return <div className={
|
|
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>;
|
package/src/components/index.tsx
CHANGED
|
@@ -15,20 +15,25 @@ export * from "./DateTimeField";
|
|
|
15
15
|
export * from "./Dialog";
|
|
16
16
|
export * from "./DialogActions";
|
|
17
17
|
export * from "./DialogContent";
|
|
18
|
+
export * from "./DialogTitle";
|
|
18
19
|
export * from "./ExpandablePanel";
|
|
19
20
|
export * from "./FileUpload";
|
|
20
21
|
export * from "./IconButton";
|
|
21
22
|
export * from "./InputLabel";
|
|
22
23
|
export * from "./InfoLabel";
|
|
24
|
+
export * from "./Label";
|
|
23
25
|
export * from "./LoadingButton";
|
|
24
26
|
export * from "./Markdown";
|
|
25
27
|
export * from "./Menu";
|
|
28
|
+
export * from "./Menubar";
|
|
26
29
|
export * from "./MultiSelect";
|
|
27
30
|
export * from "./Paper";
|
|
28
|
-
export * from "./
|
|
31
|
+
export * from "./RadioGroup";
|
|
29
32
|
export * from "./SearchBar";
|
|
33
|
+
export * from "./Select";
|
|
34
|
+
export * from "./Separator";
|
|
35
|
+
export * from "./Slider";
|
|
30
36
|
export * from "./Sheet";
|
|
31
|
-
export * from "./Spinner";
|
|
32
37
|
export * from "./TextareaAutosize";
|
|
33
38
|
export * from "./TextField";
|
|
34
39
|
export * from "./Tooltip";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as locales from "date-fns/locale";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { registerLocale, setDefaultLocale } from "react-datepicker";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
|
|
6
|
+
export function useLocaleConfig(locale?: string) {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!locale) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
const dateFnsLocale = locales[locale];
|
|
13
|
+
if (dateFnsLocale) {
|
|
14
|
+
registerLocale(locale, dateFnsLocale);
|
|
15
|
+
setDefaultLocale(locale);
|
|
16
|
+
}
|
|
17
|
+
}, [locale])
|
|
18
|
+
}
|
package/src/icons/GitHubIcon.tsx
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function HandleIcon() {
|
|
2
|
+
return <svg width="24" height="24" viewBox="0 0 100 100" fill="none">
|
|
3
|
+
<circle cx="28" cy="50" r="9" fill={"currentColor"}/>
|
|
4
|
+
<circle cx="28" cy="21" r="9" fill={"currentColor"}/>
|
|
5
|
+
<circle cx="71" cy="21" r="9" fill={"currentColor"}/>
|
|
6
|
+
<circle cx="71" cy="50" r="9" fill={"currentColor"}/>
|
|
7
|
+
<circle cx="71" cy="78" r="9" fill={"currentColor"}/>
|
|
8
|
+
<circle cx="28" cy="78" r="9" fill={"currentColor"}/>
|
|
9
|
+
</svg>;
|
|
10
|
+
}
|
package/src/icons/Icon.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
2
|
+
import { cls } from "../util";
|
|
3
|
+
import 'material-icons/iconfont/filled.css';
|
|
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> = {
|
|
@@ -17,47 +17,50 @@ const colorClassesMapping: Record<IconColor, string> = {
|
|
|
17
17
|
success: "text-green-500",
|
|
18
18
|
warning: "text-yellow-500",
|
|
19
19
|
secondary: "text-secondary",
|
|
20
|
-
disabled: "text-disabled dark:text-disabled-dark",
|
|
20
|
+
disabled: "text-text-disabled dark:text-text-disabled-dark",
|
|
21
21
|
error: "text-red-500"
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
24
|
+
export const Icon = React.forwardRef<HTMLSpanElement, IconProps & { iconKey: string }>(
|
|
25
|
+
({
|
|
26
|
+
iconKey,
|
|
27
|
+
size = "medium",
|
|
28
|
+
color,
|
|
29
|
+
className,
|
|
30
|
+
onClick,
|
|
31
|
+
style
|
|
32
|
+
}, ref) => {
|
|
33
|
+
let sizeInPx: number;
|
|
34
|
+
switch (size) {
|
|
35
|
+
case "smallest":
|
|
36
|
+
sizeInPx = 16;
|
|
37
|
+
break;
|
|
38
|
+
case "small":
|
|
39
|
+
sizeInPx = 20;
|
|
40
|
+
break;
|
|
41
|
+
case "medium":
|
|
42
|
+
sizeInPx = 24;
|
|
43
|
+
break;
|
|
44
|
+
case "large":
|
|
45
|
+
sizeInPx = 28;
|
|
46
|
+
break
|
|
47
|
+
default:
|
|
48
|
+
sizeInPx = typeof size === "number" ? size : 24;
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
51
|
+
return <span
|
|
52
|
+
ref={ref} // Attach the ref to the span
|
|
53
|
+
style={{
|
|
54
|
+
fontSize: `${sizeInPx}px`,
|
|
55
|
+
display: "block",
|
|
56
|
+
...style
|
|
57
|
+
}}
|
|
58
|
+
className={
|
|
59
|
+
cls("material-icons",
|
|
60
|
+
color ? colorClassesMapping[color] : "",
|
|
61
|
+
"select-none",
|
|
62
|
+
className)}
|
|
63
|
+
onClick={onClick}>{iconKey}</span>
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
Icon.displayName = "Icon";
|