@firecms/ui 3.0.0-canary.57 → 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/index.es.js +7054 -7050
- 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 +2 -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 +13 -13
- 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/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
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as MenubarPrimitive from "@radix-ui/react-Menubar";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
import { CheckIcon, ChevronRightIcon } from "../icons";
|
4
4
|
|
5
5
|
export function Menubar({
|
@@ -7,7 +7,7 @@ export function Menubar({
|
|
7
7
|
className
|
8
8
|
}: { children: React.ReactNode, className?: string }) {
|
9
9
|
return (
|
10
|
-
<MenubarPrimitive.Root className={
|
10
|
+
<MenubarPrimitive.Root className={cls("z-10 flex bg-white dark:bg-gray-950 p-[3px] rounded-sm shadow-sm", className)}>
|
11
11
|
{children}
|
12
12
|
</MenubarPrimitive.Root>
|
13
13
|
)
|
@@ -29,7 +29,7 @@ export function MenubarTrigger({
|
|
29
29
|
}: { children: React.ReactNode, className?: string }) {
|
30
30
|
return (
|
31
31
|
<MenubarPrimitive.Trigger
|
32
|
-
className={
|
32
|
+
className={cls("py-2 px-3 outline-none select-none font-medium leading-none rounded text-text-primary dark:text-text-primary-dark text-[13px] flex items-center justify-between gap-[2px] data-[highlighted]:bg-gray-100 data-[highlighted]:dark:bg-gray-800 data-[state=open]:bg-gray-100 data-[state=open]:dark:bg-gray-800",
|
33
33
|
className)}>
|
34
34
|
{children}
|
35
35
|
</MenubarPrimitive.Trigger>
|
@@ -62,7 +62,7 @@ export function MenubarContent({
|
|
62
62
|
}) {
|
63
63
|
return (
|
64
64
|
<MenubarPrimitive.Content
|
65
|
-
className={
|
65
|
+
className={cls("min-w-[220px] bg-white dark:bg-gray-950 rounded-md p-[6px] shadow-[0px_10px_38px_-10px_rgba(22,_23,_24,_0.35),_0px_10px_20px_-15px_rgba(22,_23,_24,_0.2)] [animation-duration:_400ms] [animation-timing-function:_cubic-bezier(0.16,_1,_0.3,_1)] will-change-[transform,opacity]", className)}
|
66
66
|
align={align ?? "start"}
|
67
67
|
sideOffset={sideOffset ?? 5}
|
68
68
|
alignOffset={alignOffset ?? -3}
|
@@ -87,7 +87,7 @@ export function MenubarItem({
|
|
87
87
|
}) {
|
88
88
|
return (
|
89
89
|
<MenubarPrimitive.Item
|
90
|
-
className={
|
90
|
+
className={cls("group text-[13px] leading-none text-text-primary dark:text-text-primary-dark rounded flex items-center h-[32px] px-[10px] py-[2px] relative select-none outline-none data-[state=open]:bg-gray-100 data-[state=open]:dark:bg-gray-800 data-[state=open]:text-text-primary data-[state=open]:dark:text-text-primary-dark data-[highlighted]:bg-gray-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-disabled data-[disabled]:dark:text-disabled-dark data-[disabled]:pointer-events-none",
|
91
91
|
leftPadding ? "pl-5" : "",
|
92
92
|
className)}
|
93
93
|
disabled={disabled}
|
@@ -108,7 +108,7 @@ export function MenubarSeparator({
|
|
108
108
|
}) {
|
109
109
|
return (
|
110
110
|
<MenubarPrimitive.Separator
|
111
|
-
className={
|
111
|
+
className={cls("h-[1px] bg-gray-100 dark:bg-gray-800 m-[5px]", className)}
|
112
112
|
{...rest}
|
113
113
|
>
|
114
114
|
{children}
|
@@ -141,7 +141,7 @@ export function MenubarSubTrigger({
|
|
141
141
|
}) {
|
142
142
|
return (
|
143
143
|
<MenubarPrimitive.SubTrigger
|
144
|
-
className={
|
144
|
+
className={cls("group text-[13px] leading-none text-text-primary dark:text-text-primary-dark rounded flex items-center h-[32px] px-[10px] py-[2px] relative select-none outline-none data-[state=open]:bg-gray-100 data-[state=open]:dark:bg-gray-800 data-[state=open]:text-text-primary data-[state=open]:dark:text-text-primary-dark data-[highlighted]:bg-gray-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-disabled data-[disabled]:dark:text-disabled-dark data-[disabled]:pointer-events-none",
|
145
145
|
className)}
|
146
146
|
{...rest}
|
147
147
|
>
|
@@ -163,7 +163,7 @@ export function MenubarSubContent({
|
|
163
163
|
return (
|
164
164
|
<MenubarPrimitive.SubContent
|
165
165
|
alignOffset={alignOffset ?? -5}
|
166
|
-
className={
|
166
|
+
className={cls("min-w-[220px] bg-white dark:bg-gray-950 rounded-md p-[6px] shadow-[0px_10px_38px_-10px_rgba(22,_23,_24,_0.35),_0px_10px_20px_-15px_rgba(22,_23,_24,_0.2)] [animation-duration:_400ms] [animation-timing-function:_cubic-bezier(0.16,_1,_0.3,_1)] will-change-[transform,opacity]",
|
167
167
|
className)}
|
168
168
|
{...rest}
|
169
169
|
>
|
@@ -186,7 +186,7 @@ export function MenubarCheckboxItem({
|
|
186
186
|
}) {
|
187
187
|
return (
|
188
188
|
<MenubarPrimitive.CheckboxItem
|
189
|
-
className={
|
189
|
+
className={cls("text-[13px] leading-none text-text-primary dark:text-text-primary-dark rounded flex items-center h-[32px] px-[10px] py-[2px] relative select-none pl-5 outline-none data-[highlighted]:bg-gray-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-disabled data-[disabled]:dark:text-disabled-dark data-[disabled]:pointer-events-none",
|
190
190
|
className)}
|
191
191
|
checked={checked}
|
192
192
|
onCheckedChange={onCheckedChange}
|
@@ -207,7 +207,7 @@ export function MenubarItemIndicator({
|
|
207
207
|
}) {
|
208
208
|
return (
|
209
209
|
<MenubarPrimitive.ItemIndicator
|
210
|
-
className={
|
210
|
+
className={cls("absolute left-0 w-4 inline-flex items-center justify-center", className)}
|
211
211
|
{...rest}>
|
212
212
|
{children ?? <CheckIcon size={"smallest"}/>}
|
213
213
|
</MenubarPrimitive.ItemIndicator>
|
@@ -228,7 +228,7 @@ export function MenubarRadioGroup({
|
|
228
228
|
}) {
|
229
229
|
return (
|
230
230
|
<MenubarPrimitive.RadioGroup
|
231
|
-
className={
|
231
|
+
className={cls(className)}
|
232
232
|
value={value}
|
233
233
|
onValueChange={onValueChange}
|
234
234
|
{...rest}>
|
@@ -249,7 +249,7 @@ export function MenubarRadioItem({
|
|
249
249
|
}) {
|
250
250
|
return (
|
251
251
|
<MenubarPrimitive.RadioItem
|
252
|
-
className={
|
252
|
+
className={cls("text-[13px] leading-none text-text-primary dark:text-text-primary-dark rounded flex items-center h-[32px] px-[10px] py-[2px] relative select-none pl-5 outline-none data-[highlighted]:bg-gray-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-disabled data-[disabled]:dark:text-disabled-dark data-[disabled]:pointer-events-none",
|
253
253
|
className)}
|
254
254
|
value={value}
|
255
255
|
{...rest}>
|
@@ -268,7 +268,7 @@ export function MenubarShortcut({
|
|
268
268
|
}) {
|
269
269
|
return (
|
270
270
|
<div
|
271
|
-
className={
|
271
|
+
className={cls("ml-auto pl-5 group-data-[highlighted]:text-white group-data-[disabled]:text-disabled data-[disabled]:dark:text-disabled-dark",
|
272
272
|
className)}>
|
273
273
|
{children}
|
274
274
|
</div>
|
@@ -6,7 +6,7 @@ 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 {
|
9
|
+
import { cls } from "../util";
|
10
10
|
import { SelectInputLabel } from "./common/SelectInputLabel";
|
11
11
|
import { useOutsideAlerter } from "../hooks";
|
12
12
|
|
@@ -116,10 +116,10 @@ export function MultiSelect({
|
|
116
116
|
inputRef.current?.focus();
|
117
117
|
openDialog()
|
118
118
|
}}
|
119
|
-
className={
|
119
|
+
className={cls("relative overflow-visible bg-transparent", containerClassName)}>
|
120
120
|
<div
|
121
121
|
ref={containerRef}
|
122
|
-
className={
|
122
|
+
className={cls(
|
123
123
|
"flex flex-row",
|
124
124
|
size === "small" ? "min-h-[42px]" : "min-h-[64px]",
|
125
125
|
"select-none rounded-md text-sm",
|
@@ -132,7 +132,7 @@ export function MultiSelect({
|
|
132
132
|
includeFocusOutline ? focusedMixin : "",
|
133
133
|
className)}
|
134
134
|
>
|
135
|
-
<div className={
|
135
|
+
<div className={cls("flex-grow flex gap-1.5 flex-wrap items-center")}>
|
136
136
|
{renderValue && (value ?? []).map((v, i) => renderValue(v, i))}
|
137
137
|
{renderValues && renderValues(value ?? [])}
|
138
138
|
<CommandPrimitive.Input
|
@@ -146,7 +146,7 @@ export function MultiSelect({
|
|
146
146
|
</div>
|
147
147
|
<div className={"px-2 h-full flex items-center"}>
|
148
148
|
<ExpandMoreIcon size={"small"}
|
149
|
-
className={
|
149
|
+
className={cls("transition ", openInternal ? "rotate-180" : "")}/>
|
150
150
|
</div>
|
151
151
|
|
152
152
|
</div>
|
@@ -210,7 +210,7 @@ export function MultiSelectItem({ children, value, className }: MultiSelectItemP
|
|
210
210
|
setInputValue("");
|
211
211
|
onValueChangeInternal(value);
|
212
212
|
}}
|
213
|
-
className={
|
213
|
+
className={cls(
|
214
214
|
(fieldValue ?? []).includes(value) ? "bg-slate-200 dark:bg-slate-950" : "",
|
215
215
|
"cursor-pointer",
|
216
216
|
"m-1",
|
package/src/components/Paper.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
|
3
3
|
import { paperMixin } from "../styles";
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
|
6
6
|
export function Paper({
|
7
7
|
children,
|
@@ -15,7 +15,7 @@ export function Paper({
|
|
15
15
|
}) {
|
16
16
|
return (
|
17
17
|
<div
|
18
|
-
className={
|
18
|
+
className={cls(paperMixin, className)}
|
19
19
|
style={style}>
|
20
20
|
{children}
|
21
21
|
</div>
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
2
2
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
3
3
|
|
4
4
|
import { paperMixin } from "../styles";
|
5
|
-
import {
|
5
|
+
import { cls } from "../util";
|
6
6
|
import { useInjectStyles } from "../hooks";
|
7
7
|
|
8
8
|
export type PopoverSide = "top" | "right" | "bottom" | "left";
|
@@ -57,7 +57,7 @@ export function Popover({
|
|
57
57
|
{trigger}
|
58
58
|
</PopoverPrimitive.Trigger>
|
59
59
|
<PopoverPrimitive.Portal>
|
60
|
-
<PopoverPrimitive.Content className={
|
60
|
+
<PopoverPrimitive.Content className={cls(paperMixin,
|
61
61
|
"PopoverContent shadow z-40", className)}
|
62
62
|
side={side}
|
63
63
|
sideOffset={sideOffset}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from "react"
|
2
2
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
export interface RadioGroupProps {
|
6
6
|
id?: string;
|
@@ -30,7 +30,7 @@ const RadioGroup = React.forwardRef<
|
|
30
30
|
}, ref) => {
|
31
31
|
return (
|
32
32
|
<RadioGroupPrimitive.Root
|
33
|
-
className={
|
33
|
+
className={cls("grid gap-2", className)}
|
34
34
|
{...props}
|
35
35
|
ref={ref}
|
36
36
|
/>
|
@@ -55,7 +55,7 @@ const RadioGroupItem = React.forwardRef<
|
|
55
55
|
return (
|
56
56
|
<RadioGroupPrimitive.Item
|
57
57
|
ref={ref}
|
58
|
-
className={
|
58
|
+
className={cls(
|
59
59
|
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
60
60
|
className
|
61
61
|
)}
|
@@ -3,7 +3,7 @@ import React, { useCallback, useState } from "react";
|
|
3
3
|
import { defaultBorderMixin, focusedMixin } from "../styles";
|
4
4
|
import { CircularProgress, IconButton } from "./index";
|
5
5
|
import { ClearIcon, SearchIcon } from "../icons";
|
6
|
-
import {
|
6
|
+
import { cls } from "../util";
|
7
7
|
import { useDebounceValue } from "../hooks";
|
8
8
|
|
9
9
|
interface SearchBarProps {
|
@@ -60,7 +60,7 @@ export function SearchBar({
|
|
60
60
|
return (
|
61
61
|
<div
|
62
62
|
onClick={onClick}
|
63
|
-
className={
|
63
|
+
className={cls("relative",
|
64
64
|
large ? "h-14" : "h-[42px]",
|
65
65
|
"bg-slate-50 dark:bg-gray-800 border",
|
66
66
|
defaultBorderMixin,
|
@@ -84,7 +84,7 @@ export function SearchBar({
|
|
84
84
|
autoFocus={autoFocus}
|
85
85
|
onFocus={() => setActive(true)}
|
86
86
|
onBlur={() => setActive(false)}
|
87
|
-
className={
|
87
|
+
className={cls(
|
88
88
|
(disabled || loading) && "pointer-events-none",
|
89
89
|
"relative flex items-center rounded transition-all bg-transparent outline-none appearance-none border-none",
|
90
90
|
"pl-12 h-full text-current ",
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
focusedMixin
|
10
10
|
} from "../styles";
|
11
11
|
import { CheckIcon, ExpandMoreIcon } from "../icons";
|
12
|
-
import {
|
12
|
+
import { cls } from "../util";
|
13
13
|
import { SelectInputLabel } from "./common/SelectInputLabel";
|
14
14
|
|
15
15
|
export type SelectProps = {
|
@@ -113,7 +113,7 @@ export function Select({
|
|
113
113
|
{typeof label === "string" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}
|
114
114
|
|
115
115
|
<div
|
116
|
-
className={
|
116
|
+
className={cls(
|
117
117
|
size === "small" ? "min-h-[42px]" : "min-h-[64px]",
|
118
118
|
"select-none rounded-md text-sm",
|
119
119
|
invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,
|
@@ -124,7 +124,7 @@ export function Select({
|
|
124
124
|
<SelectPrimitive.Trigger
|
125
125
|
ref={inputRef}
|
126
126
|
id={id}
|
127
|
-
className={
|
127
|
+
className={cls(
|
128
128
|
"w-full h-full",
|
129
129
|
size === "small" ? "h-[42px]" : "h-[64px]",
|
130
130
|
padding ? "px-4 " : "",
|
@@ -138,7 +138,7 @@ export function Select({
|
|
138
138
|
inputClassName
|
139
139
|
)}>
|
140
140
|
|
141
|
-
<div className={
|
141
|
+
<div className={cls(
|
142
142
|
"flex-grow w-full max-w-full flex flex-row gap-2 items-center",
|
143
143
|
"overflow-visible",
|
144
144
|
size === "small" ? "h-[42px]" : "h-[64px]"
|
@@ -161,16 +161,16 @@ export function Select({
|
|
161
161
|
</SelectPrimitive.Value>
|
162
162
|
</div>
|
163
163
|
|
164
|
-
<SelectPrimitive.Icon className={
|
164
|
+
<SelectPrimitive.Icon className={cls(
|
165
165
|
"px-2 h-full flex items-center",
|
166
166
|
)}>
|
167
167
|
<ExpandMoreIcon size={"small"}
|
168
|
-
className={
|
168
|
+
className={cls("transition", open ? "rotate-180" : "")}/>
|
169
169
|
</SelectPrimitive.Icon>
|
170
170
|
|
171
171
|
</SelectPrimitive.Trigger>
|
172
172
|
|
173
|
-
{endAdornment && <div className={
|
173
|
+
{endAdornment && <div className={cls("absolute h-full flex items-center",
|
174
174
|
size === "small" ? "right-10" : "right-14")}
|
175
175
|
onClick={(e) => e.stopPropagation()}>
|
176
176
|
{endAdornment}
|
@@ -215,7 +215,7 @@ export function SelectItem({
|
|
215
215
|
e.preventDefault();
|
216
216
|
e.stopPropagation();
|
217
217
|
}}
|
218
|
-
className={
|
218
|
+
className={cls(
|
219
219
|
"w-full",
|
220
220
|
"relative relative flex items-center p-2 rounded-md text-sm text-slate-700 dark:text-slate-300",
|
221
221
|
focusedMixin,
|
@@ -249,7 +249,7 @@ export function SelectGroup({
|
|
249
249
|
}: SelectGroupProps) {
|
250
250
|
return <>
|
251
251
|
<SelectPrimitive.Group
|
252
|
-
className={
|
252
|
+
className={cls(
|
253
253
|
"text-xs text-slate-900 dark:text-white uppercase tracking-wider font-bold mt-6 first:mt-2",
|
254
254
|
"px-2 py-2",
|
255
255
|
className
|
package/src/components/Sheet.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useEffect } from "react";
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
interface SheetProps {
|
6
6
|
children: React.ReactNode;
|
@@ -47,7 +47,7 @@ export const Sheet: React.FC<SheetProps> = ({
|
|
47
47
|
onOpenChange={onOpenChange}>
|
48
48
|
<DialogPrimitive.Portal>
|
49
49
|
<DialogPrimitive.Overlay
|
50
|
-
className={
|
50
|
+
className={cls(
|
51
51
|
"fixed inset-0 transition-opacity z-20 ease-in-out duration-200 backdrop-blur-sm",
|
52
52
|
transparent ? "bg-white bg-opacity-80" : "bg-black bg-opacity-50",
|
53
53
|
"dark:bg-black dark:bg-opacity-60",
|
@@ -59,7 +59,7 @@ export const Sheet: React.FC<SheetProps> = ({
|
|
59
59
|
/>
|
60
60
|
<DialogPrimitive.Content
|
61
61
|
{...props}
|
62
|
-
className={
|
62
|
+
className={cls(
|
63
63
|
// "transform-gpu",
|
64
64
|
"will-change-transform",
|
65
65
|
"text-slate-900 dark:text-white",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import {
|
2
|
+
import { cls } from "../util";
|
3
3
|
|
4
4
|
export type SkeletonProps = {
|
5
5
|
width?: number;
|
@@ -18,7 +18,7 @@ export function Skeleton({
|
|
18
18
|
height: height ? `${height}px` : "12px"
|
19
19
|
}}
|
20
20
|
className={
|
21
|
-
|
21
|
+
cls(
|
22
22
|
"block",
|
23
23
|
"bg-slate-200 dark:bg-slate-800 rounded",
|
24
24
|
"animate-pulse",
|
package/src/components/Table.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useRef } from "react";
|
2
2
|
import { defaultBorderMixin } from "../styles";
|
3
|
-
import {
|
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={
|
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={
|
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={
|
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={
|
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={
|
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}
|
package/src/components/Tabs.tsx
CHANGED
@@ -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 {
|
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={
|
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={
|
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
|
-
:
|
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={
|
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 {
|
13
|
+
import { cls } from "../util";
|
14
14
|
|
15
15
|
export type InputType =
|
16
16
|
"text"
|
@@ -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={
|
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,7 +123,7 @@ export function TextField<T extends string | number>({
|
|
123
123
|
onWheel={type === "number" ? numberInputOnWheelPreventChange : undefined}
|
124
124
|
disabled={disabled}
|
125
125
|
style={inputStyle}
|
126
|
-
className={
|
126
|
+
className={cls(
|
127
127
|
"w-full outline-none bg-transparent leading-normal px-3",
|
128
128
|
"rounded-md",
|
129
129
|
invisible ? focusedInvisibleMixin : focusedMixin,
|
@@ -146,7 +146,7 @@ export function TextField<T extends string | number>({
|
|
146
146
|
|
147
147
|
return (
|
148
148
|
<div
|
149
|
-
className={
|
149
|
+
className={cls(
|
150
150
|
"rounded-md relative max-w-full",
|
151
151
|
invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,
|
152
152
|
disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
@@ -161,7 +161,7 @@ export function TextField<T extends string | number>({
|
|
161
161
|
|
162
162
|
{label && (
|
163
163
|
<InputLabel
|
164
|
-
className={
|
164
|
+
className={cls(
|
165
165
|
"pointer-events-none absolute",
|
166
166
|
size === "medium" ? "top-1" : "-top-1",
|
167
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 {
|
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={
|
279
|
+
className={cls(props.className, props.shadowClassName)}
|
280
280
|
readOnly
|
281
281
|
ref={shadowRef}
|
282
282
|
tabIndex={-1}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { cls } from "../util";
|
5
5
|
import { useInjectStyles } from "../hooks";
|
6
6
|
|
7
7
|
export type TooltipProps = {
|
@@ -47,7 +47,7 @@ export const Tooltip = ({
|
|
47
47
|
</TooltipPrimitive.Trigger>
|
48
48
|
<TooltipPrimitive.Portal>
|
49
49
|
<TooltipPrimitive.Content
|
50
|
-
className={
|
50
|
+
className={cls("TooltipContent",
|
51
51
|
"max-w-lg leading-relaxed",
|
52
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",
|
53
53
|
tooltipClassName)}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { ReactEventHandler } from "react";
|
2
2
|
import { focusedMixin } from "../styles";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
export type TextProps<C extends React.ElementType> = {
|
6
6
|
align?: "center" | "inherit" | "justify" | "left" | "right";
|
@@ -99,7 +99,7 @@ export function Typography<C extends React.ElementType>(
|
|
99
99
|
(paragraph ? "p" : variantMapping[variant] || defaultVariantMapping[variant]) ||
|
100
100
|
"span";
|
101
101
|
|
102
|
-
const classes =
|
102
|
+
const classes = cls(
|
103
103
|
focusedMixin,
|
104
104
|
variantToClasses[variant],
|
105
105
|
color ? colorToClasses[color] : "",
|
@@ -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/icons/Icon.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from "react";
|
2
2
|
import "@material-design-icons/font/filled.css";
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
|
5
5
|
export type IconColor = "inherit" | "primary" | "secondary" | "disabled" | "error" | "success" | "warning";
|
6
6
|
export type IconProps = {
|
@@ -56,7 +56,7 @@ export const Icon = React.forwardRef<HTMLSpanElement, IconProps & { iconKey: str
|
|
56
56
|
...style
|
57
57
|
}}
|
58
58
|
className={
|
59
|
-
|
59
|
+
cls("material-icons",
|
60
60
|
color ? colorClassesMapping[color] : "",
|
61
61
|
"select-none",
|
62
62
|
className)}
|
package/src/util/cls.ts
ADDED
@@ -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