@ucdjs-internal/shared-ui 0.1.0

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/dist/components/shiki-code.d.mts +50 -0
  4. package/dist/components/shiki-code.mjs +76 -0
  5. package/dist/components/theme-toggle.d.mts +6 -0
  6. package/dist/components/theme-toggle.mjs +75 -0
  7. package/dist/hooks/index.d.mts +3 -0
  8. package/dist/hooks/index.mjs +4 -0
  9. package/dist/hooks/use-mobile.d.mts +4 -0
  10. package/dist/hooks/use-mobile.mjs +41 -0
  11. package/dist/hooks/use-theme.d.mts +11 -0
  12. package/dist/hooks/use-theme.mjs +105 -0
  13. package/dist/index.d.mts +3 -0
  14. package/dist/index.mjs +4 -0
  15. package/dist/lib/theme-script.d.mts +5 -0
  16. package/dist/lib/theme-script.mjs +26 -0
  17. package/dist/lib/utils.d.mts +6 -0
  18. package/dist/lib/utils.mjs +10 -0
  19. package/dist/styles/globals.css +219 -0
  20. package/dist/styles/shadcn-vendored.css +95 -0
  21. package/dist/ui/alert-dialog.d.mts +58 -0
  22. package/dist/ui/alert-dialog.mjs +387 -0
  23. package/dist/ui/avatar.d.mts +34 -0
  24. package/dist/ui/avatar.mjs +208 -0
  25. package/dist/ui/badge.d.mts +17 -0
  26. package/dist/ui/badge.mjs +76 -0
  27. package/dist/ui/breadcrumb.d.mts +37 -0
  28. package/dist/ui/breadcrumb.mjs +281 -0
  29. package/dist/ui/button.d.mts +18 -0
  30. package/dist/ui/button.mjs +82 -0
  31. package/dist/ui/card.d.mts +37 -0
  32. package/dist/ui/card.mjs +239 -0
  33. package/dist/ui/checkbox.d.mts +10 -0
  34. package/dist/ui/checkbox.mjs +52 -0
  35. package/dist/ui/collapsible.d.mts +15 -0
  36. package/dist/ui/collapsible.mjs +65 -0
  37. package/dist/ui/combobox.d.mts +81 -0
  38. package/dist/ui/combobox.mjs +641 -0
  39. package/dist/ui/command.d.mts +55 -0
  40. package/dist/ui/command.mjs +378 -0
  41. package/dist/ui/context-menu.d.mts +86 -0
  42. package/dist/ui/context-menu.mjs +520 -0
  43. package/dist/ui/dialog.d.mts +51 -0
  44. package/dist/ui/dialog.mjs +331 -0
  45. package/dist/ui/dropdown-menu.d.mts +84 -0
  46. package/dist/ui/dropdown-menu.mjs +534 -0
  47. package/dist/ui/field.d.mts +64 -0
  48. package/dist/ui/field.mjs +425 -0
  49. package/dist/ui/input-group.d.mts +45 -0
  50. package/dist/ui/input-group.mjs +254 -0
  51. package/dist/ui/input.d.mts +11 -0
  52. package/dist/ui/input.mjs +47 -0
  53. package/dist/ui/label.d.mts +10 -0
  54. package/dist/ui/label.mjs +41 -0
  55. package/dist/ui/scroll-area.d.mts +16 -0
  56. package/dist/ui/scroll-area.mjs +120 -0
  57. package/dist/ui/select.d.mts +55 -0
  58. package/dist/ui/select.mjs +414 -0
  59. package/dist/ui/separator.d.mts +11 -0
  60. package/dist/ui/separator.mjs +47 -0
  61. package/dist/ui/sheet.d.mts +42 -0
  62. package/dist/ui/sheet.mjs +318 -0
  63. package/dist/ui/sidebar.d.mts +160 -0
  64. package/dist/ui/sidebar.mjs +1258 -0
  65. package/dist/ui/skeleton.d.mts +9 -0
  66. package/dist/ui/skeleton.mjs +40 -0
  67. package/dist/ui/table.d.mts +38 -0
  68. package/dist/ui/table.mjs +269 -0
  69. package/dist/ui/textarea.d.mts +10 -0
  70. package/dist/ui/textarea.mjs +41 -0
  71. package/dist/ui/tooltip.d.mts +25 -0
  72. package/dist/ui/tooltip.mjs +149 -0
  73. package/package.json +111 -0
@@ -0,0 +1,378 @@
1
+ import { cn } from "../lib/utils.mjs";
2
+ import { InputGroup, InputGroupAddon } from "./input-group.mjs";
3
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog.mjs";
4
+ import "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { c } from "react/compiler-runtime";
7
+ import { CheckIcon, SearchIcon } from "lucide-react";
8
+ import { Command as Command$1 } from "cmdk";
9
+
10
+ //#region src/ui/command.tsx
11
+ function Command(t0) {
12
+ const $ = c(8);
13
+ let className;
14
+ let props;
15
+ if ($[0] !== t0) {
16
+ ({className, ...props} = t0);
17
+ $[0] = t0;
18
+ $[1] = className;
19
+ $[2] = props;
20
+ } else {
21
+ className = $[1];
22
+ props = $[2];
23
+ }
24
+ let t1;
25
+ if ($[3] !== className) {
26
+ t1 = cn("bg-popover text-popover-foreground rounded-xl! p-1 flex size-full flex-col overflow-hidden", className);
27
+ $[3] = className;
28
+ $[4] = t1;
29
+ } else t1 = $[4];
30
+ let t2;
31
+ if ($[5] !== props || $[6] !== t1) {
32
+ t2 = /* @__PURE__ */ jsx(Command$1, {
33
+ "data-slot": "command",
34
+ className: t1,
35
+ ...props
36
+ });
37
+ $[5] = props;
38
+ $[6] = t1;
39
+ $[7] = t2;
40
+ } else t2 = $[7];
41
+ return t2;
42
+ }
43
+ function CommandDialog(t0) {
44
+ const $ = c(24);
45
+ let children;
46
+ let className;
47
+ let props;
48
+ let t1;
49
+ let t2;
50
+ let t3;
51
+ if ($[0] !== t0) {
52
+ ({title: t1, description: t2, children, className, showCloseButton: t3, ...props} = t0);
53
+ $[0] = t0;
54
+ $[1] = children;
55
+ $[2] = className;
56
+ $[3] = props;
57
+ $[4] = t1;
58
+ $[5] = t2;
59
+ $[6] = t3;
60
+ } else {
61
+ children = $[1];
62
+ className = $[2];
63
+ props = $[3];
64
+ t1 = $[4];
65
+ t2 = $[5];
66
+ t3 = $[6];
67
+ }
68
+ const title = t1 === void 0 ? "Command Palette" : t1;
69
+ const description = t2 === void 0 ? "Search for a command to run..." : t2;
70
+ const showCloseButton = t3 === void 0 ? false : t3;
71
+ let t4;
72
+ if ($[7] !== title) {
73
+ t4 = /* @__PURE__ */ jsx(DialogTitle, { children: title });
74
+ $[7] = title;
75
+ $[8] = t4;
76
+ } else t4 = $[8];
77
+ let t5;
78
+ if ($[9] !== description) {
79
+ t5 = /* @__PURE__ */ jsx(DialogDescription, { children: description });
80
+ $[9] = description;
81
+ $[10] = t5;
82
+ } else t5 = $[10];
83
+ let t6;
84
+ if ($[11] !== t4 || $[12] !== t5) {
85
+ t6 = /* @__PURE__ */ jsxs(DialogHeader, {
86
+ className: "sr-only",
87
+ children: [t4, t5]
88
+ });
89
+ $[11] = t4;
90
+ $[12] = t5;
91
+ $[13] = t6;
92
+ } else t6 = $[13];
93
+ let t7;
94
+ if ($[14] !== className) {
95
+ t7 = cn("rounded-xl! top-1/3 translate-y-0 overflow-hidden p-0", className);
96
+ $[14] = className;
97
+ $[15] = t7;
98
+ } else t7 = $[15];
99
+ let t8;
100
+ if ($[16] !== children || $[17] !== showCloseButton || $[18] !== t7) {
101
+ t8 = /* @__PURE__ */ jsx(DialogContent, {
102
+ className: t7,
103
+ showCloseButton,
104
+ children
105
+ });
106
+ $[16] = children;
107
+ $[17] = showCloseButton;
108
+ $[18] = t7;
109
+ $[19] = t8;
110
+ } else t8 = $[19];
111
+ let t9;
112
+ if ($[20] !== props || $[21] !== t6 || $[22] !== t8) {
113
+ t9 = /* @__PURE__ */ jsxs(Dialog, {
114
+ ...props,
115
+ children: [t6, t8]
116
+ });
117
+ $[20] = props;
118
+ $[21] = t6;
119
+ $[22] = t8;
120
+ $[23] = t9;
121
+ } else t9 = $[23];
122
+ return t9;
123
+ }
124
+ function CommandInput(t0) {
125
+ const $ = c(11);
126
+ let className;
127
+ let props;
128
+ if ($[0] !== t0) {
129
+ ({className, ...props} = t0);
130
+ $[0] = t0;
131
+ $[1] = className;
132
+ $[2] = props;
133
+ } else {
134
+ className = $[1];
135
+ props = $[2];
136
+ }
137
+ let t1;
138
+ if ($[3] !== className) {
139
+ t1 = cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className);
140
+ $[3] = className;
141
+ $[4] = t1;
142
+ } else t1 = $[4];
143
+ let t2;
144
+ if ($[5] !== props || $[6] !== t1) {
145
+ t2 = /* @__PURE__ */ jsx(Command$1.Input, {
146
+ "data-slot": "command-input",
147
+ className: t1,
148
+ ...props
149
+ });
150
+ $[5] = props;
151
+ $[6] = t1;
152
+ $[7] = t2;
153
+ } else t2 = $[7];
154
+ let t3;
155
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
156
+ t3 = /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) });
157
+ $[8] = t3;
158
+ } else t3 = $[8];
159
+ let t4;
160
+ if ($[9] !== t2) {
161
+ t4 = /* @__PURE__ */ jsx("div", {
162
+ "data-slot": "command-input-wrapper",
163
+ className: "p-1 pb-0",
164
+ children: /* @__PURE__ */ jsxs(InputGroup, {
165
+ className: "bg-input/30 border-input/30 h-8! rounded-lg! shadow-none! *:data-[slot=input-group-addon]:pl-2!",
166
+ children: [t2, t3]
167
+ })
168
+ });
169
+ $[9] = t2;
170
+ $[10] = t4;
171
+ } else t4 = $[10];
172
+ return t4;
173
+ }
174
+ function CommandList(t0) {
175
+ const $ = c(8);
176
+ let className;
177
+ let props;
178
+ if ($[0] !== t0) {
179
+ ({className, ...props} = t0);
180
+ $[0] = t0;
181
+ $[1] = className;
182
+ $[2] = props;
183
+ } else {
184
+ className = $[1];
185
+ props = $[2];
186
+ }
187
+ let t1;
188
+ if ($[3] !== className) {
189
+ t1 = cn("no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto", className);
190
+ $[3] = className;
191
+ $[4] = t1;
192
+ } else t1 = $[4];
193
+ let t2;
194
+ if ($[5] !== props || $[6] !== t1) {
195
+ t2 = /* @__PURE__ */ jsx(Command$1.List, {
196
+ "data-slot": "command-list",
197
+ className: t1,
198
+ ...props
199
+ });
200
+ $[5] = props;
201
+ $[6] = t1;
202
+ $[7] = t2;
203
+ } else t2 = $[7];
204
+ return t2;
205
+ }
206
+ function CommandEmpty(t0) {
207
+ const $ = c(8);
208
+ let className;
209
+ let props;
210
+ if ($[0] !== t0) {
211
+ ({className, ...props} = t0);
212
+ $[0] = t0;
213
+ $[1] = className;
214
+ $[2] = props;
215
+ } else {
216
+ className = $[1];
217
+ props = $[2];
218
+ }
219
+ let t1;
220
+ if ($[3] !== className) {
221
+ t1 = cn("py-6 text-center text-sm", className);
222
+ $[3] = className;
223
+ $[4] = t1;
224
+ } else t1 = $[4];
225
+ let t2;
226
+ if ($[5] !== props || $[6] !== t1) {
227
+ t2 = /* @__PURE__ */ jsx(Command$1.Empty, {
228
+ "data-slot": "command-empty",
229
+ className: t1,
230
+ ...props
231
+ });
232
+ $[5] = props;
233
+ $[6] = t1;
234
+ $[7] = t2;
235
+ } else t2 = $[7];
236
+ return t2;
237
+ }
238
+ function CommandGroup(t0) {
239
+ const $ = c(8);
240
+ let className;
241
+ let props;
242
+ if ($[0] !== t0) {
243
+ ({className, ...props} = t0);
244
+ $[0] = t0;
245
+ $[1] = className;
246
+ $[2] = props;
247
+ } else {
248
+ className = $[1];
249
+ props = $[2];
250
+ }
251
+ let t1;
252
+ if ($[3] !== className) {
253
+ t1 = cn("text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium", className);
254
+ $[3] = className;
255
+ $[4] = t1;
256
+ } else t1 = $[4];
257
+ let t2;
258
+ if ($[5] !== props || $[6] !== t1) {
259
+ t2 = /* @__PURE__ */ jsx(Command$1.Group, {
260
+ "data-slot": "command-group",
261
+ className: t1,
262
+ ...props
263
+ });
264
+ $[5] = props;
265
+ $[6] = t1;
266
+ $[7] = t2;
267
+ } else t2 = $[7];
268
+ return t2;
269
+ }
270
+ function CommandSeparator(t0) {
271
+ const $ = c(8);
272
+ let className;
273
+ let props;
274
+ if ($[0] !== t0) {
275
+ ({className, ...props} = t0);
276
+ $[0] = t0;
277
+ $[1] = className;
278
+ $[2] = props;
279
+ } else {
280
+ className = $[1];
281
+ props = $[2];
282
+ }
283
+ let t1;
284
+ if ($[3] !== className) {
285
+ t1 = cn("bg-border -mx-1 h-px w-auto", className);
286
+ $[3] = className;
287
+ $[4] = t1;
288
+ } else t1 = $[4];
289
+ let t2;
290
+ if ($[5] !== props || $[6] !== t1) {
291
+ t2 = /* @__PURE__ */ jsx(Command$1.Separator, {
292
+ "data-slot": "command-separator",
293
+ className: t1,
294
+ ...props
295
+ });
296
+ $[5] = props;
297
+ $[6] = t1;
298
+ $[7] = t2;
299
+ } else t2 = $[7];
300
+ return t2;
301
+ }
302
+ function CommandItem(t0) {
303
+ const $ = c(11);
304
+ let children;
305
+ let className;
306
+ let props;
307
+ if ($[0] !== t0) {
308
+ ({className, children, ...props} = t0);
309
+ $[0] = t0;
310
+ $[1] = children;
311
+ $[2] = className;
312
+ $[3] = props;
313
+ } else {
314
+ children = $[1];
315
+ className = $[2];
316
+ props = $[3];
317
+ }
318
+ let t1;
319
+ if ($[4] !== className) {
320
+ t1 = cn("data-selected:bg-muted data-selected:text-foreground data-selected:**:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! [&_svg:not([class*='size-'])]:size-4 group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className);
321
+ $[4] = className;
322
+ $[5] = t1;
323
+ } else t1 = $[5];
324
+ let t2;
325
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
326
+ t2 = /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" });
327
+ $[6] = t2;
328
+ } else t2 = $[6];
329
+ let t3;
330
+ if ($[7] !== children || $[8] !== props || $[9] !== t1) {
331
+ t3 = /* @__PURE__ */ jsxs(Command$1.Item, {
332
+ "data-slot": "command-item",
333
+ className: t1,
334
+ ...props,
335
+ children: [children, t2]
336
+ });
337
+ $[7] = children;
338
+ $[8] = props;
339
+ $[9] = t1;
340
+ $[10] = t3;
341
+ } else t3 = $[10];
342
+ return t3;
343
+ }
344
+ function CommandShortcut(t0) {
345
+ const $ = c(8);
346
+ let className;
347
+ let props;
348
+ if ($[0] !== t0) {
349
+ ({className, ...props} = t0);
350
+ $[0] = t0;
351
+ $[1] = className;
352
+ $[2] = props;
353
+ } else {
354
+ className = $[1];
355
+ props = $[2];
356
+ }
357
+ let t1;
358
+ if ($[3] !== className) {
359
+ t1 = cn("text-muted-foreground group-data-selected/command-item:text-foreground ml-auto text-xs tracking-widest", className);
360
+ $[3] = className;
361
+ $[4] = t1;
362
+ } else t1 = $[4];
363
+ let t2;
364
+ if ($[5] !== props || $[6] !== t1) {
365
+ t2 = /* @__PURE__ */ jsx("span", {
366
+ "data-slot": "command-shortcut",
367
+ className: t1,
368
+ ...props
369
+ });
370
+ $[5] = props;
371
+ $[6] = t1;
372
+ $[7] = t2;
373
+ } else t2 = $[7];
374
+ return t2;
375
+ }
376
+
377
+ //#endregion
378
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
@@ -0,0 +1,86 @@
1
+ import * as React from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { ContextMenu as ContextMenu$1 } from "@base-ui/react/context-menu";
4
+
5
+ //#region src/ui/context-menu.d.ts
6
+ declare function ContextMenu({
7
+ ...props
8
+ }: ContextMenu$1.Root.Props): react_jsx_runtime0.JSX.Element;
9
+ declare function ContextMenuPortal({
10
+ ...props
11
+ }: ContextMenu$1.Portal.Props): react_jsx_runtime0.JSX.Element;
12
+ declare function ContextMenuTrigger({
13
+ className,
14
+ ...props
15
+ }: ContextMenu$1.Trigger.Props): react_jsx_runtime0.JSX.Element;
16
+ declare function ContextMenuContent({
17
+ className,
18
+ align,
19
+ alignOffset,
20
+ side,
21
+ sideOffset,
22
+ ...props
23
+ }: ContextMenu$1.Popup.Props & Pick<ContextMenu$1.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): react_jsx_runtime0.JSX.Element;
24
+ declare function ContextMenuGroup({
25
+ ...props
26
+ }: ContextMenu$1.Group.Props): react_jsx_runtime0.JSX.Element;
27
+ declare function ContextMenuLabel({
28
+ className,
29
+ inset,
30
+ ...props
31
+ }: ContextMenu$1.GroupLabel.Props & {
32
+ inset?: boolean;
33
+ }): react_jsx_runtime0.JSX.Element;
34
+ declare function ContextMenuItem({
35
+ className,
36
+ inset,
37
+ variant,
38
+ ...props
39
+ }: ContextMenu$1.Item.Props & {
40
+ inset?: boolean;
41
+ variant?: "default" | "destructive";
42
+ }): react_jsx_runtime0.JSX.Element;
43
+ declare function ContextMenuSub({
44
+ ...props
45
+ }: ContextMenu$1.SubmenuRoot.Props): react_jsx_runtime0.JSX.Element;
46
+ declare function ContextMenuSubTrigger({
47
+ className,
48
+ inset,
49
+ children,
50
+ ...props
51
+ }: ContextMenu$1.SubmenuTrigger.Props & {
52
+ inset?: boolean;
53
+ }): react_jsx_runtime0.JSX.Element;
54
+ declare function ContextMenuSubContent({
55
+ ...props
56
+ }: React.ComponentProps<typeof ContextMenuContent>): react_jsx_runtime0.JSX.Element;
57
+ declare function ContextMenuCheckboxItem({
58
+ className,
59
+ children,
60
+ checked,
61
+ inset,
62
+ ...props
63
+ }: ContextMenu$1.CheckboxItem.Props & {
64
+ inset?: boolean;
65
+ }): react_jsx_runtime0.JSX.Element;
66
+ declare function ContextMenuRadioGroup({
67
+ ...props
68
+ }: ContextMenu$1.RadioGroup.Props): react_jsx_runtime0.JSX.Element;
69
+ declare function ContextMenuRadioItem({
70
+ className,
71
+ children,
72
+ inset,
73
+ ...props
74
+ }: ContextMenu$1.RadioItem.Props & {
75
+ inset?: boolean;
76
+ }): react_jsx_runtime0.JSX.Element;
77
+ declare function ContextMenuSeparator({
78
+ className,
79
+ ...props
80
+ }: ContextMenu$1.Separator.Props): react_jsx_runtime0.JSX.Element;
81
+ declare function ContextMenuShortcut({
82
+ className,
83
+ ...props
84
+ }: React.ComponentProps<"span">): react_jsx_runtime0.JSX.Element;
85
+ //#endregion
86
+ export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };