@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
@@ -0,0 +1,284 @@
|
|
1
|
+
import * as MenubarPrimitive from "@radix-ui/react-Menubar";
|
2
|
+
import { cls } from "../util";
|
3
|
+
import { CheckIcon, ChevronRightIcon } from "../icons";
|
4
|
+
|
5
|
+
export function Menubar({
|
6
|
+
children,
|
7
|
+
className
|
8
|
+
}: { children: React.ReactNode, className?: string }) {
|
9
|
+
return (
|
10
|
+
<MenubarPrimitive.Root className={cls("z-10 flex bg-white dark:bg-gray-950 p-[3px] rounded-sm shadow-sm", className)}>
|
11
|
+
{children}
|
12
|
+
</MenubarPrimitive.Root>
|
13
|
+
)
|
14
|
+
}
|
15
|
+
|
16
|
+
export function MenubarMenu({
|
17
|
+
children,
|
18
|
+
}: { children: React.ReactNode }) {
|
19
|
+
return (
|
20
|
+
<MenubarPrimitive.Menu>
|
21
|
+
{children}
|
22
|
+
</MenubarPrimitive.Menu>
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
export function MenubarTrigger({
|
27
|
+
children,
|
28
|
+
className
|
29
|
+
}: { children: React.ReactNode, className?: string }) {
|
30
|
+
return (
|
31
|
+
<MenubarPrimitive.Trigger
|
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
|
+
className)}>
|
34
|
+
{children}
|
35
|
+
</MenubarPrimitive.Trigger>
|
36
|
+
)
|
37
|
+
}
|
38
|
+
|
39
|
+
export function MenubarPortal({
|
40
|
+
children,
|
41
|
+
}: { children: React.ReactNode }) {
|
42
|
+
return (
|
43
|
+
<MenubarPrimitive.Portal>
|
44
|
+
{children}
|
45
|
+
</MenubarPrimitive.Portal>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
export function MenubarContent({
|
50
|
+
children,
|
51
|
+
className,
|
52
|
+
align,
|
53
|
+
sideOffset,
|
54
|
+
alignOffset,
|
55
|
+
...rest
|
56
|
+
}: {
|
57
|
+
children: React.ReactNode,
|
58
|
+
className?: string,
|
59
|
+
align?: "start" | "center" | "end",
|
60
|
+
sideOffset?: number,
|
61
|
+
alignOffset?: number
|
62
|
+
}) {
|
63
|
+
return (
|
64
|
+
<MenubarPrimitive.Content
|
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
|
+
align={align ?? "start"}
|
67
|
+
sideOffset={sideOffset ?? 5}
|
68
|
+
alignOffset={alignOffset ?? -3}
|
69
|
+
{...rest}
|
70
|
+
>
|
71
|
+
{children}
|
72
|
+
</MenubarPrimitive.Content>
|
73
|
+
)
|
74
|
+
}
|
75
|
+
|
76
|
+
export function MenubarItem({
|
77
|
+
children,
|
78
|
+
leftPadding,
|
79
|
+
className,
|
80
|
+
disabled,
|
81
|
+
...rest
|
82
|
+
}: {
|
83
|
+
children: React.ReactNode,
|
84
|
+
leftPadding?: boolean,
|
85
|
+
className?: string,
|
86
|
+
disabled?: boolean
|
87
|
+
}) {
|
88
|
+
return (
|
89
|
+
<MenubarPrimitive.Item
|
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
|
+
leftPadding ? "pl-5" : "",
|
92
|
+
className)}
|
93
|
+
disabled={disabled}
|
94
|
+
{...rest}
|
95
|
+
>
|
96
|
+
{children}
|
97
|
+
</MenubarPrimitive.Item>
|
98
|
+
)
|
99
|
+
}
|
100
|
+
|
101
|
+
export function MenubarSeparator({
|
102
|
+
children,
|
103
|
+
className,
|
104
|
+
...rest
|
105
|
+
}: {
|
106
|
+
children?: React.ReactNode,
|
107
|
+
className?: string,
|
108
|
+
}) {
|
109
|
+
return (
|
110
|
+
<MenubarPrimitive.Separator
|
111
|
+
className={cls("h-[1px] bg-gray-100 dark:bg-gray-800 m-[5px]", className)}
|
112
|
+
{...rest}
|
113
|
+
>
|
114
|
+
{children}
|
115
|
+
</MenubarPrimitive.Separator>
|
116
|
+
)
|
117
|
+
}
|
118
|
+
|
119
|
+
export function MenubarSub({
|
120
|
+
children,
|
121
|
+
...rest
|
122
|
+
}: {
|
123
|
+
children?: React.ReactNode,
|
124
|
+
}) {
|
125
|
+
return (
|
126
|
+
<MenubarPrimitive.Sub
|
127
|
+
{...rest}
|
128
|
+
>
|
129
|
+
{children}
|
130
|
+
</MenubarPrimitive.Sub>
|
131
|
+
)
|
132
|
+
}
|
133
|
+
|
134
|
+
export function MenubarSubTrigger({
|
135
|
+
children,
|
136
|
+
className,
|
137
|
+
...rest
|
138
|
+
}: {
|
139
|
+
children?: React.ReactNode,
|
140
|
+
className?: string,
|
141
|
+
}) {
|
142
|
+
return (
|
143
|
+
<MenubarPrimitive.SubTrigger
|
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
|
+
className)}
|
146
|
+
{...rest}
|
147
|
+
>
|
148
|
+
{children}
|
149
|
+
</MenubarPrimitive.SubTrigger>
|
150
|
+
)
|
151
|
+
}
|
152
|
+
|
153
|
+
export function MenubarSubContent({
|
154
|
+
children,
|
155
|
+
alignOffset,
|
156
|
+
className,
|
157
|
+
...rest
|
158
|
+
}: {
|
159
|
+
children?: React.ReactNode,
|
160
|
+
alignOffset?: number,
|
161
|
+
className?: string,
|
162
|
+
}) {
|
163
|
+
return (
|
164
|
+
<MenubarPrimitive.SubContent
|
165
|
+
alignOffset={alignOffset ?? -5}
|
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
|
+
className)}
|
168
|
+
{...rest}
|
169
|
+
>
|
170
|
+
{children}
|
171
|
+
</MenubarPrimitive.SubContent>
|
172
|
+
)
|
173
|
+
}
|
174
|
+
|
175
|
+
export function MenubarCheckboxItem({
|
176
|
+
children,
|
177
|
+
checked,
|
178
|
+
onCheckedChange,
|
179
|
+
className,
|
180
|
+
...rest
|
181
|
+
}: {
|
182
|
+
children?: React.ReactNode,
|
183
|
+
checked?: boolean,
|
184
|
+
onCheckedChange?: () => void,
|
185
|
+
className?: string,
|
186
|
+
}) {
|
187
|
+
return (
|
188
|
+
<MenubarPrimitive.CheckboxItem
|
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
|
+
className)}
|
191
|
+
checked={checked}
|
192
|
+
onCheckedChange={onCheckedChange}
|
193
|
+
{...rest}
|
194
|
+
>
|
195
|
+
{children}
|
196
|
+
</MenubarPrimitive.CheckboxItem>
|
197
|
+
)
|
198
|
+
}
|
199
|
+
|
200
|
+
export function MenubarItemIndicator({
|
201
|
+
children,
|
202
|
+
className,
|
203
|
+
...rest
|
204
|
+
}: {
|
205
|
+
children?: React.ReactNode,
|
206
|
+
className?: string,
|
207
|
+
}) {
|
208
|
+
return (
|
209
|
+
<MenubarPrimitive.ItemIndicator
|
210
|
+
className={cls("absolute left-0 w-4 inline-flex items-center justify-center", className)}
|
211
|
+
{...rest}>
|
212
|
+
{children ?? <CheckIcon size={"smallest"}/>}
|
213
|
+
</MenubarPrimitive.ItemIndicator>
|
214
|
+
)
|
215
|
+
}
|
216
|
+
|
217
|
+
export function MenubarRadioGroup({
|
218
|
+
children,
|
219
|
+
className,
|
220
|
+
value,
|
221
|
+
onValueChange,
|
222
|
+
...rest
|
223
|
+
}: {
|
224
|
+
children?: React.ReactNode,
|
225
|
+
value?: string,
|
226
|
+
onValueChange?: (value: string) => void,
|
227
|
+
className?: string,
|
228
|
+
}) {
|
229
|
+
return (
|
230
|
+
<MenubarPrimitive.RadioGroup
|
231
|
+
className={cls(className)}
|
232
|
+
value={value}
|
233
|
+
onValueChange={onValueChange}
|
234
|
+
{...rest}>
|
235
|
+
{children ?? <CheckIcon size={"small"}/>}
|
236
|
+
</MenubarPrimitive.RadioGroup>
|
237
|
+
)
|
238
|
+
}
|
239
|
+
|
240
|
+
export function MenubarRadioItem({
|
241
|
+
children,
|
242
|
+
className,
|
243
|
+
value,
|
244
|
+
...rest
|
245
|
+
}: {
|
246
|
+
children?: React.ReactNode,
|
247
|
+
value: string,
|
248
|
+
className?: string,
|
249
|
+
}) {
|
250
|
+
return (
|
251
|
+
<MenubarPrimitive.RadioItem
|
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
|
+
className)}
|
254
|
+
value={value}
|
255
|
+
{...rest}>
|
256
|
+
{children ?? <CheckIcon size={"small"}/>}
|
257
|
+
</MenubarPrimitive.RadioItem>
|
258
|
+
)
|
259
|
+
}
|
260
|
+
|
261
|
+
export function MenubarShortcut({
|
262
|
+
children,
|
263
|
+
className,
|
264
|
+
...rest
|
265
|
+
}: {
|
266
|
+
children?: React.ReactNode,
|
267
|
+
className?: string,
|
268
|
+
}) {
|
269
|
+
return (
|
270
|
+
<div
|
271
|
+
className={cls("ml-auto pl-5 group-data-[highlighted]:text-white group-data-[disabled]:text-disabled data-[disabled]:dark:text-disabled-dark",
|
272
|
+
className)}>
|
273
|
+
{children}
|
274
|
+
</div>
|
275
|
+
)
|
276
|
+
}
|
277
|
+
|
278
|
+
export function MenubarSubTriggerIndicator() {
|
279
|
+
return (
|
280
|
+
<div className="ml-auto pl-5 ">
|
281
|
+
<ChevronRightIcon size={"small"}/>
|
282
|
+
</div>
|
283
|
+
)
|
284
|
+
}
|
@@ -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",
|