@firecms/ui 3.0.0-canary.55 → 3.0.0-canary.57

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/ui",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.55",
4
+ "version": "3.0.0-canary.57",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -53,6 +53,7 @@
53
53
  "@radix-ui/react-dialog": "^1.0.5",
54
54
  "@radix-ui/react-dropdown-menu": "^2.0.6",
55
55
  "@radix-ui/react-label": "^2.0.2",
56
+ "@radix-ui/react-menubar": "^1.0.4",
56
57
  "@radix-ui/react-popover": "^1.0.7",
57
58
  "@radix-ui/react-portal": "^1.0.4",
58
59
  "@radix-ui/react-radio-group": "^1.1.3",
@@ -116,7 +117,7 @@
116
117
  "src",
117
118
  "tailwind.config.js"
118
119
  ],
119
- "gitHead": "504f907bf8ecf1b7ed81fa1f84d3461c06efb39a",
120
+ "gitHead": "54c0d79d2648c937d055bacab2d7d92fbd294c7b",
120
121
  "publishConfig": {
121
122
  "access": "public"
122
123
  }
@@ -27,7 +27,7 @@ export const Badge: React.FC<BadgeProps> = ({
27
27
  children
28
28
  }) => {
29
29
  return (
30
- <div className="relative inline-block">
30
+ <div className="relative inline-block w-fit">
31
31
  {children}
32
32
  <span
33
33
  className={`absolute top-0.5 right-0.5 transform translate-x-1/2 -translate-y-1/2 rounded-full
@@ -0,0 +1,284 @@
1
+ import * as MenubarPrimitive from "@radix-ui/react-Menubar";
2
+ import { cn } 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={cn("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={cn("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={cn("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={cn("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-text-secondary data-[disabled]:dark:text-text-secondary-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={cn("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={cn("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-text-secondary data-[disabled]:dark:text-text-secondary-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={cn("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={cn("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-text-secondary data-[disabled]:dark:text-text-secondary-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={cn("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={cn(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={cn("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-text-secondary data-[disabled]:dark:text-text-secondary-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={cn("ml-auto pl-5 group-data-[highlighted]:text-white group-data-[disabled]:text-text-secondary data-[disabled]:dark:text-text-secondary-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
+ }
@@ -12,13 +12,16 @@ export function Skeleton({
12
12
  height,
13
13
  className
14
14
  }: SkeletonProps) {
15
- return <span className={
15
+ return <span
16
+ style={{
17
+ width: width ? `${width}px` : "100%",
18
+ height: height ? `${height}px` : "12px"
19
+ }}
20
+ className={
16
21
  cn(
17
22
  "block",
18
23
  "bg-slate-200 dark:bg-slate-800 rounded",
19
24
  "animate-pulse",
20
- width ? `w-[${width}px]` : "w-full",
21
- height ? `h-[${height}px]` : "h-3",
22
25
  "max-w-full max-h-full",
23
26
  className)
24
27
  }/>;
@@ -24,6 +24,7 @@ export * from "./Label";
24
24
  export * from "./LoadingButton";
25
25
  export * from "./Markdown";
26
26
  export * from "./Menu";
27
+ export * from "./Menubar";
27
28
  export * from "./MultiSelect";
28
29
  export * from "./Paper";
29
30
  export * from "./RadioGroup";