@firecms/ui 3.0.0-canary.11 → 3.0.0-canary.111
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 +4 -2
- package/dist/components/Menubar.d.ts +79 -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 +1 -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 +79 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +12979 -13497
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19531 -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 +108 -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 +14 -5
- 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 +42 -31
- package/src/components/Menubar.tsx +322 -0
- package/src/components/MultiSelect.tsx +8 -8
- 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 +89 -102
- 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 +1 -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 +79 -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
package/src/components/Label.tsx
CHANGED
@@ -1,15 +1,28 @@
|
|
1
1
|
import * as React from "react"
|
2
2
|
import * as LabelPrimitive from "@radix-ui/react-label"
|
3
|
-
import {
|
3
|
+
import { cls } from "../util";
|
4
4
|
import { defaultBorderMixin } from "../styles";
|
5
5
|
|
6
|
+
type LabelProps = React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & {
|
7
|
+
border?: boolean,
|
8
|
+
onClick?: React.MouseEventHandler<HTMLLabelElement>
|
9
|
+
};
|
6
10
|
const Label = React.forwardRef<
|
7
11
|
React.ElementRef<typeof LabelPrimitive.Root>,
|
8
|
-
|
9
|
-
>(({
|
12
|
+
LabelProps
|
13
|
+
>(({
|
14
|
+
className,
|
15
|
+
border,
|
16
|
+
onClick,
|
17
|
+
...props
|
18
|
+
}, ref) => (
|
10
19
|
<LabelPrimitive.Root
|
11
20
|
ref={ref}
|
12
|
-
|
21
|
+
onClick={onClick}
|
22
|
+
className={cls("text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
23
|
+
border && "border border-gray-300 dark:border-gray-700 rounded-md px-3 py-1.5",
|
24
|
+
onClick && "hover:cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-800",
|
25
|
+
defaultBorderMixin, className)}
|
13
26
|
{...props}
|
14
27
|
/>
|
15
28
|
))
|
@@ -3,26 +3,37 @@ import equal from "react-fast-compare"
|
|
3
3
|
|
4
4
|
// @ts-ignore
|
5
5
|
import MarkdownIt from "markdown-it";
|
6
|
+
import { cls } from "../util";
|
6
7
|
|
7
8
|
export interface MarkdownProps {
|
8
9
|
source: string,
|
10
|
+
size?: "small" | "medium" | "large" | "xl" | "2xl";
|
9
11
|
className?: string
|
10
12
|
}
|
11
13
|
|
12
|
-
const
|
14
|
+
const proseClasses = {
|
15
|
+
small: "prose-sm text-sm",
|
16
|
+
medium: "prose text-base",
|
17
|
+
large: "prose-lg",
|
18
|
+
xl: "prose-xl",
|
19
|
+
"2xl": "prose-2xl"
|
20
|
+
};
|
21
|
+
|
22
|
+
const md = new MarkdownIt({ html: true });
|
13
23
|
/**
|
14
24
|
* @group Preview components
|
15
25
|
*/
|
16
26
|
export const Markdown = React.memo<MarkdownProps>(function Markdown({
|
17
27
|
source,
|
18
|
-
className
|
28
|
+
className,
|
29
|
+
size = "medium"
|
19
30
|
}: MarkdownProps) {
|
20
31
|
const html = useMemo(() => {
|
21
32
|
return md.render(typeof source === "string" ? source : "");
|
22
33
|
}, [source]);
|
23
34
|
|
24
35
|
return <div
|
25
|
-
className={className}
|
36
|
+
className={cls(proseClasses[size], "dark:prose-invert prose-headings:font-title", className)}
|
26
37
|
dangerouslySetInnerHTML={{ __html: html }}
|
27
38
|
/>;
|
28
39
|
}
|
package/src/components/Menu.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import { paperMixin } from "../styles";
|
4
|
+
import { cls } from "../util";
|
5
5
|
|
6
6
|
export type MenuProps = {
|
7
7
|
children: React.ReactNode;
|
@@ -14,47 +14,58 @@ export type MenuProps = {
|
|
14
14
|
portalContainer?: HTMLElement | null;
|
15
15
|
}
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
17
|
+
const Menu = React.forwardRef<
|
18
|
+
React.ElementRef<typeof DropdownMenu.Trigger>,
|
19
|
+
MenuProps
|
20
|
+
>(({
|
21
|
+
children,
|
22
|
+
trigger,
|
23
|
+
open,
|
24
|
+
defaultOpen,
|
25
|
+
onOpenChange,
|
26
|
+
portalContainer
|
27
|
+
}, ref) => (
|
28
|
+
<DropdownMenu.Root
|
29
|
+
open={open}
|
30
|
+
defaultOpen={defaultOpen}
|
31
|
+
onOpenChange={onOpenChange}>
|
32
|
+
<DropdownMenu.Trigger
|
33
|
+
ref={ref}
|
34
|
+
asChild>
|
35
|
+
{trigger}
|
36
|
+
</DropdownMenu.Trigger>
|
37
|
+
<DropdownMenu.Portal container={portalContainer}>
|
38
|
+
<DropdownMenu.Content className={cls(paperMixin, "shadow py-2 z-30")}>
|
39
|
+
{children}
|
40
|
+
</DropdownMenu.Content>
|
41
|
+
</DropdownMenu.Portal>
|
42
|
+
</DropdownMenu.Root>
|
43
|
+
))
|
44
|
+
Menu.displayName = "Menu"
|
45
|
+
|
46
|
+
export { Menu }
|
41
47
|
|
42
48
|
export type MenuItemProps = {
|
43
49
|
children: React.ReactNode;
|
44
50
|
dense?: boolean;
|
45
51
|
onClick?: (event: React.MouseEvent) => void;
|
46
|
-
}
|
52
|
+
};
|
47
53
|
|
48
54
|
export function MenuItem({
|
49
55
|
children,
|
50
|
-
dense,
|
56
|
+
dense = false, // Default value is false if not provided
|
51
57
|
onClick
|
52
58
|
}: MenuItemProps) {
|
59
|
+
// Dynamically adjusting the class based on the "dense" prop
|
60
|
+
const classNames = cls(
|
61
|
+
onClick && "cursor-pointer",
|
62
|
+
"rounded-md text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center gap-4",
|
63
|
+
dense ? "px-3 py-1.5" : "px-4 py-2"
|
64
|
+
);
|
65
|
+
|
53
66
|
return (
|
54
67
|
<DropdownMenu.Item
|
55
|
-
className={
|
56
|
-
onClick && "cursor-pointer",
|
57
|
-
"rounded-md px-4 py-2 text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center gap-4")}
|
68
|
+
className={classNames}
|
58
69
|
onClick={onClick}>
|
59
70
|
{children}
|
60
71
|
</DropdownMenu.Item>
|
@@ -0,0 +1,322 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
|
3
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
4
|
+
import { cls } from "../util";
|
5
|
+
import { CheckIcon, ChevronRightIcon } from "../icons";
|
6
|
+
|
7
|
+
export function Menubar({
|
8
|
+
children,
|
9
|
+
onSelect,
|
10
|
+
className
|
11
|
+
}: {
|
12
|
+
children: React.ReactNode,
|
13
|
+
onSelect?: (event: React.SyntheticEvent) => void,
|
14
|
+
className?: string
|
15
|
+
}) {
|
16
|
+
return (
|
17
|
+
<MenubarPrimitive.Root
|
18
|
+
onSelect={onSelect}
|
19
|
+
className={cls("z-10 flex bg-white dark:bg-gray-950 p-[3px] rounded-sm shadow-sm", className)}>
|
20
|
+
{children}
|
21
|
+
</MenubarPrimitive.Root>
|
22
|
+
)
|
23
|
+
}
|
24
|
+
|
25
|
+
export function MenubarMenu({
|
26
|
+
children,
|
27
|
+
}: { children: React.ReactNode }) {
|
28
|
+
return (
|
29
|
+
<MenubarPrimitive.Menu>
|
30
|
+
{children}
|
31
|
+
</MenubarPrimitive.Menu>
|
32
|
+
)
|
33
|
+
}
|
34
|
+
|
35
|
+
export function MenubarTrigger({
|
36
|
+
children,
|
37
|
+
onSelect,
|
38
|
+
className
|
39
|
+
}: {
|
40
|
+
children: React.ReactNode,
|
41
|
+
onSelect?: (event: React.SyntheticEvent) => void,
|
42
|
+
className?: string
|
43
|
+
}) {
|
44
|
+
return (
|
45
|
+
<MenubarPrimitive.Trigger
|
46
|
+
onSelect={onSelect}
|
47
|
+
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-slate-100 data-[highlighted]:dark:bg-gray-800 data-[state=open]:bg-slate-100 data-[state=open]:dark:bg-gray-800 hover:bg-slate-200 hover:bg-opacity-75 dark:hover:bg-gray-700 dark:hover:bg-opacity-50",
|
48
|
+
className)}>
|
49
|
+
{children}
|
50
|
+
</MenubarPrimitive.Trigger>
|
51
|
+
)
|
52
|
+
}
|
53
|
+
|
54
|
+
export function MenubarPortal({
|
55
|
+
children,
|
56
|
+
}: { children: React.ReactNode }) {
|
57
|
+
return (
|
58
|
+
<MenubarPrimitive.Portal>
|
59
|
+
{children}
|
60
|
+
</MenubarPrimitive.Portal>
|
61
|
+
)
|
62
|
+
}
|
63
|
+
|
64
|
+
export function MenubarContent({
|
65
|
+
children,
|
66
|
+
className,
|
67
|
+
align,
|
68
|
+
sideOffset,
|
69
|
+
alignOffset,
|
70
|
+
onSelect,
|
71
|
+
...rest
|
72
|
+
}: {
|
73
|
+
children: React.ReactNode,
|
74
|
+
className?: string,
|
75
|
+
onSelect?: (event: React.SyntheticEvent) => void,
|
76
|
+
align?: "start" | "center" | "end",
|
77
|
+
sideOffset?: number,
|
78
|
+
alignOffset?: number
|
79
|
+
}) {
|
80
|
+
return (
|
81
|
+
<MenubarPrimitive.Content
|
82
|
+
onSelect={onSelect}
|
83
|
+
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)}
|
84
|
+
align={align ?? "start"}
|
85
|
+
sideOffset={sideOffset ?? 5}
|
86
|
+
alignOffset={alignOffset ?? -3}
|
87
|
+
{...rest}
|
88
|
+
>
|
89
|
+
{children}
|
90
|
+
</MenubarPrimitive.Content>
|
91
|
+
)
|
92
|
+
}
|
93
|
+
|
94
|
+
export function MenubarItem({
|
95
|
+
children,
|
96
|
+
leftPadding,
|
97
|
+
className,
|
98
|
+
disabled,
|
99
|
+
onSelect,
|
100
|
+
...rest
|
101
|
+
}: {
|
102
|
+
children: React.ReactNode,
|
103
|
+
onSelect?: (event: Event) => void;
|
104
|
+
leftPadding?: boolean,
|
105
|
+
className?: string,
|
106
|
+
disabled?: boolean
|
107
|
+
}) {
|
108
|
+
return (
|
109
|
+
<MenubarPrimitive.Item
|
110
|
+
onSelect={onSelect}
|
111
|
+
className={cls("group text-[13px] leading-none rounded flex items-center h-[32px] px-[10px] py-[2px] relative select-none outline-none data-[state=open]:bg-slate-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-slate-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none",
|
112
|
+
leftPadding ? "pl-5" : "",
|
113
|
+
disabled ? "pointer-events-none text-text-secondary dark:text-text-secondary-dark" : "text-text-primary dark:text-text-primary-dark",
|
114
|
+
className)}
|
115
|
+
disabled={disabled}
|
116
|
+
{...rest}
|
117
|
+
>
|
118
|
+
{children}
|
119
|
+
</MenubarPrimitive.Item>
|
120
|
+
)
|
121
|
+
}
|
122
|
+
|
123
|
+
export function MenubarSeparator({
|
124
|
+
children,
|
125
|
+
className,
|
126
|
+
...rest
|
127
|
+
}: {
|
128
|
+
children?: React.ReactNode,
|
129
|
+
className?: string,
|
130
|
+
}) {
|
131
|
+
return (
|
132
|
+
<MenubarPrimitive.Separator
|
133
|
+
className={cls("h-[1px] bg-slate-100 dark:bg-gray-800 m-[5px]", className)}
|
134
|
+
{...rest}
|
135
|
+
>
|
136
|
+
{children}
|
137
|
+
</MenubarPrimitive.Separator>
|
138
|
+
)
|
139
|
+
}
|
140
|
+
|
141
|
+
export function MenubarSub({
|
142
|
+
children,
|
143
|
+
...rest
|
144
|
+
}: {
|
145
|
+
children?: React.ReactNode,
|
146
|
+
}) {
|
147
|
+
return (
|
148
|
+
<MenubarPrimitive.Sub
|
149
|
+
{...rest}
|
150
|
+
>
|
151
|
+
{children}
|
152
|
+
</MenubarPrimitive.Sub>
|
153
|
+
)
|
154
|
+
}
|
155
|
+
|
156
|
+
export function MenubarSubTrigger({
|
157
|
+
children,
|
158
|
+
className,
|
159
|
+
onSelect,
|
160
|
+
...rest
|
161
|
+
}: {
|
162
|
+
children?: React.ReactNode,
|
163
|
+
onSelect?: (event: React.SyntheticEvent) => void,
|
164
|
+
className?: string,
|
165
|
+
}) {
|
166
|
+
return (
|
167
|
+
<MenubarPrimitive.SubTrigger
|
168
|
+
onSelect={onSelect}
|
169
|
+
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-slate-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-slate-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none",
|
170
|
+
className)}
|
171
|
+
{...rest}
|
172
|
+
>
|
173
|
+
{children}
|
174
|
+
</MenubarPrimitive.SubTrigger>
|
175
|
+
)
|
176
|
+
}
|
177
|
+
|
178
|
+
export function MenubarSubContent({
|
179
|
+
children,
|
180
|
+
alignOffset,
|
181
|
+
className,
|
182
|
+
onSelect,
|
183
|
+
...rest
|
184
|
+
}: {
|
185
|
+
children?: React.ReactNode,
|
186
|
+
onSelect?: (event: React.SyntheticEvent) => void,
|
187
|
+
alignOffset?: number,
|
188
|
+
className?: string,
|
189
|
+
}) {
|
190
|
+
return (
|
191
|
+
<MenubarPrimitive.SubContent
|
192
|
+
onSelect={onSelect}
|
193
|
+
alignOffset={alignOffset ?? -5}
|
194
|
+
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]",
|
195
|
+
className)}
|
196
|
+
{...rest}
|
197
|
+
>
|
198
|
+
{children}
|
199
|
+
</MenubarPrimitive.SubContent>
|
200
|
+
)
|
201
|
+
}
|
202
|
+
|
203
|
+
export function MenubarCheckboxItem({
|
204
|
+
children,
|
205
|
+
checked,
|
206
|
+
onCheckedChange,
|
207
|
+
className,
|
208
|
+
onSelect,
|
209
|
+
...rest
|
210
|
+
}: {
|
211
|
+
children?: React.ReactNode,
|
212
|
+
onSelect?: (event: Event) => void;
|
213
|
+
checked?: boolean,
|
214
|
+
onCheckedChange?: () => void,
|
215
|
+
className?: string,
|
216
|
+
}) {
|
217
|
+
return (
|
218
|
+
<MenubarPrimitive.CheckboxItem
|
219
|
+
onSelect={onSelect}
|
220
|
+
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-slate-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none",
|
221
|
+
className)}
|
222
|
+
checked={checked}
|
223
|
+
onCheckedChange={onCheckedChange}
|
224
|
+
{...rest}
|
225
|
+
>
|
226
|
+
{children}
|
227
|
+
</MenubarPrimitive.CheckboxItem>
|
228
|
+
)
|
229
|
+
}
|
230
|
+
|
231
|
+
export function MenubarItemIndicator({
|
232
|
+
children,
|
233
|
+
className,
|
234
|
+
...rest
|
235
|
+
}: {
|
236
|
+
children?: React.ReactNode,
|
237
|
+
className?: string,
|
238
|
+
}) {
|
239
|
+
return (
|
240
|
+
<MenubarPrimitive.ItemIndicator
|
241
|
+
className={cls("absolute left-0 w-4 inline-flex items-center justify-center", className)}
|
242
|
+
{...rest}>
|
243
|
+
{children ?? <CheckIcon size={"smallest"}/>}
|
244
|
+
</MenubarPrimitive.ItemIndicator>
|
245
|
+
)
|
246
|
+
}
|
247
|
+
|
248
|
+
export function MenubarRadioGroup({
|
249
|
+
children,
|
250
|
+
className,
|
251
|
+
value,
|
252
|
+
onValueChange,
|
253
|
+
onSelect,
|
254
|
+
...rest
|
255
|
+
}: {
|
256
|
+
children?: React.ReactNode,
|
257
|
+
onSelect?: (event: React.SyntheticEvent) => void,
|
258
|
+
value?: string,
|
259
|
+
onValueChange?: (value: string) => void,
|
260
|
+
className?: string,
|
261
|
+
}) {
|
262
|
+
return (
|
263
|
+
<MenubarPrimitive.RadioGroup
|
264
|
+
className={cls(className)}
|
265
|
+
value={value}
|
266
|
+
onValueChange={onValueChange}
|
267
|
+
onSelect={onSelect}
|
268
|
+
{...rest}>
|
269
|
+
{children ?? <CheckIcon size={"small"}/>}
|
270
|
+
</MenubarPrimitive.RadioGroup>
|
271
|
+
)
|
272
|
+
}
|
273
|
+
|
274
|
+
export function MenubarRadioItem({
|
275
|
+
children,
|
276
|
+
className,
|
277
|
+
value,
|
278
|
+
onSelect,
|
279
|
+
...rest
|
280
|
+
}: {
|
281
|
+
children?: React.ReactNode,
|
282
|
+
onSelect?: (event: Event) => void;
|
283
|
+
value: string,
|
284
|
+
className?: string,
|
285
|
+
}) {
|
286
|
+
return (
|
287
|
+
<MenubarPrimitive.RadioItem
|
288
|
+
onSelect={onSelect}
|
289
|
+
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-slate-100 data-[highlighted]:dark:bg-gray-800 data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark data-[disabled]:pointer-events-none",
|
290
|
+
className)}
|
291
|
+
value={value}
|
292
|
+
{...rest}>
|
293
|
+
{children ?? <CheckIcon size={"small"}/>}
|
294
|
+
</MenubarPrimitive.RadioItem>
|
295
|
+
)
|
296
|
+
}
|
297
|
+
|
298
|
+
export function MenubarShortcut({
|
299
|
+
children,
|
300
|
+
className,
|
301
|
+
...rest
|
302
|
+
}: {
|
303
|
+
children?: React.ReactNode,
|
304
|
+
className?: string,
|
305
|
+
}) {
|
306
|
+
return (
|
307
|
+
<div
|
308
|
+
className={cls("ml-auto pl-5 group-data-[disabled]:text-text-disabled data-[disabled]:dark:text-text-disabled-dark",
|
309
|
+
className)}
|
310
|
+
{...rest}>
|
311
|
+
{children}
|
312
|
+
</div>
|
313
|
+
)
|
314
|
+
}
|
315
|
+
|
316
|
+
export function MenubarSubTriggerIndicator() {
|
317
|
+
return (
|
318
|
+
<div className="ml-auto pl-5 ">
|
319
|
+
<ChevronRightIcon size={"small"}/>
|
320
|
+
</div>
|
321
|
+
)
|
322
|
+
}
|
@@ -5,9 +5,10 @@ import * as Dialog from "@radix-ui/react-dialog";
|
|
5
5
|
import { Command as CommandPrimitive } from "cmdk";
|
6
6
|
|
7
7
|
import { ExpandMoreIcon } from "../icons";
|
8
|
-
import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin
|
9
|
-
import {
|
8
|
+
import { fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, fieldBackgroundMixin } from "../styles";
|
9
|
+
import { cls } from "../util";
|
10
10
|
import { SelectInputLabel } from "./common/SelectInputLabel";
|
11
|
+
import { useOutsideAlerter } from "../hooks";
|
11
12
|
|
12
13
|
export type MultiSelectProps = {
|
13
14
|
open?: boolean,
|
@@ -115,10 +116,10 @@ export function MultiSelect({
|
|
115
116
|
inputRef.current?.focus();
|
116
117
|
openDialog()
|
117
118
|
}}
|
118
|
-
className={
|
119
|
+
className={cls("relative overflow-visible bg-transparent", containerClassName)}>
|
119
120
|
<div
|
120
121
|
ref={containerRef}
|
121
|
-
className={
|
122
|
+
className={cls(
|
122
123
|
"flex flex-row",
|
123
124
|
size === "small" ? "min-h-[42px]" : "min-h-[64px]",
|
124
125
|
"select-none rounded-md text-sm",
|
@@ -128,10 +129,9 @@ export function MultiSelect({
|
|
128
129
|
"p-4",
|
129
130
|
error ? "text-red-500 dark:text-red-600" : "focus:text-text-primary dark:focus:text-text-primary-dark",
|
130
131
|
error ? "border border-red-500 dark:border-red-600" : "",
|
131
|
-
includeFocusOutline ? focusedMixin : "",
|
132
132
|
className)}
|
133
133
|
>
|
134
|
-
<div className={
|
134
|
+
<div className={cls("flex-grow flex gap-1.5 flex-wrap items-center")}>
|
135
135
|
{renderValue && (value ?? []).map((v, i) => renderValue(v, i))}
|
136
136
|
{renderValues && renderValues(value ?? [])}
|
137
137
|
<CommandPrimitive.Input
|
@@ -145,7 +145,7 @@ export function MultiSelect({
|
|
145
145
|
</div>
|
146
146
|
<div className={"px-2 h-full flex items-center"}>
|
147
147
|
<ExpandMoreIcon size={"small"}
|
148
|
-
className={
|
148
|
+
className={cls("transition ", openInternal ? "rotate-180" : "")}/>
|
149
149
|
</div>
|
150
150
|
|
151
151
|
</div>
|
@@ -209,7 +209,7 @@ export function MultiSelectItem({ children, value, className }: MultiSelectItemP
|
|
209
209
|
setInputValue("");
|
210
210
|
onValueChangeInternal(value);
|
211
211
|
}}
|
212
|
-
className={
|
212
|
+
className={cls(
|
213
213
|
(fieldValue ?? []).includes(value) ? "bg-slate-200 dark:bg-slate-950" : "",
|
214
214
|
"cursor-pointer",
|
215
215
|
"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,8 @@ 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
|
+
import { useInjectStyles } from "../hooks";
|
6
7
|
|
7
8
|
export type PopoverSide = "top" | "right" | "bottom" | "left";
|
8
9
|
export type PopoverAlign = "start" | "center" | "end";
|
@@ -23,6 +24,7 @@ export interface PopoverProps {
|
|
23
24
|
enabled?: boolean;
|
24
25
|
modal?: boolean;
|
25
26
|
className?: string;
|
27
|
+
portalContainer?: HTMLElement | null;
|
26
28
|
}
|
27
29
|
|
28
30
|
export function Popover({
|
@@ -40,6 +42,7 @@ export function Popover({
|
|
40
42
|
avoidCollisions,
|
41
43
|
enabled = true,
|
42
44
|
modal = false,
|
45
|
+
portalContainer,
|
43
46
|
className
|
44
47
|
}: PopoverProps) {
|
45
48
|
|
@@ -50,22 +53,22 @@ export function Popover({
|
|
50
53
|
|
51
54
|
return <PopoverPrimitive.Root open={open}
|
52
55
|
onOpenChange={onOpenChange}
|
53
|
-
modal={modal}
|
54
|
-
>
|
56
|
+
modal={modal}>
|
55
57
|
<PopoverPrimitive.Trigger asChild>
|
56
58
|
{trigger}
|
57
59
|
</PopoverPrimitive.Trigger>
|
58
|
-
<PopoverPrimitive.Portal>
|
59
|
-
<PopoverPrimitive.Content
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
<PopoverPrimitive.Portal container={portalContainer}>
|
61
|
+
<PopoverPrimitive.Content
|
62
|
+
className={cls(paperMixin,
|
63
|
+
"PopoverContent shadow z-40", className)}
|
64
|
+
side={side}
|
65
|
+
sideOffset={sideOffset}
|
66
|
+
align={align}
|
67
|
+
alignOffset={alignOffset}
|
68
|
+
arrowPadding={arrowPadding}
|
69
|
+
sticky={sticky}
|
70
|
+
hideWhenDetached={hideWhenDetached}
|
71
|
+
avoidCollisions={avoidCollisions}>
|
69
72
|
|
70
73
|
{children}
|
71
74
|
<PopoverPrimitive.Arrow className="fill-white dark:fill-slate-950"/>
|