@inbeat/ui 0.7.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 (56) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/package.json +100 -0
  3. package/src/components/alert-dialog.tsx +246 -0
  4. package/src/components/alert.tsx +66 -0
  5. package/src/components/app-nav.tsx +55 -0
  6. package/src/components/app-shell.tsx +95 -0
  7. package/src/components/avatar.tsx +73 -0
  8. package/src/components/badge.tsx +42 -0
  9. package/src/components/breadcrumb.tsx +109 -0
  10. package/src/components/button.tsx +75 -0
  11. package/src/components/calendar.tsx +220 -0
  12. package/src/components/carousel.tsx +83 -0
  13. package/src/components/checkbox.tsx +29 -0
  14. package/src/components/collapsible-section.tsx +88 -0
  15. package/src/components/combobox.tsx +351 -0
  16. package/src/components/data-table-shell.tsx +6 -0
  17. package/src/components/data-table-sortable-header.tsx +29 -0
  18. package/src/components/data-table.tsx +141 -0
  19. package/src/components/destructive-action-dialog.tsx +108 -0
  20. package/src/components/dialog.tsx +187 -0
  21. package/src/components/dropdown-menu.tsx +228 -0
  22. package/src/components/empty-state.tsx +55 -0
  23. package/src/components/field.tsx +248 -0
  24. package/src/components/icon-button.tsx +51 -0
  25. package/src/components/input-group.tsx +170 -0
  26. package/src/components/input.tsx +22 -0
  27. package/src/components/label.tsx +24 -0
  28. package/src/components/labeled-field.tsx +18 -0
  29. package/src/components/load-more-sentinel.tsx +12 -0
  30. package/src/components/member-avatar-stack.tsx +44 -0
  31. package/src/components/multi-select-popover.tsx +202 -0
  32. package/src/components/nav-user.tsx +71 -0
  33. package/src/components/number-dot.tsx +13 -0
  34. package/src/components/person-identity.tsx +52 -0
  35. package/src/components/platform-disclaimer.tsx +70 -0
  36. package/src/components/popover.tsx +92 -0
  37. package/src/components/portal-container.tsx +21 -0
  38. package/src/components/progress.tsx +23 -0
  39. package/src/components/search-input.tsx +57 -0
  40. package/src/components/select.tsx +232 -0
  41. package/src/components/separator.tsx +28 -0
  42. package/src/components/sheet.tsx +147 -0
  43. package/src/components/sidebar.tsx +471 -0
  44. package/src/components/skeleton.tsx +13 -0
  45. package/src/components/sonner.tsx +46 -0
  46. package/src/components/spinner.tsx +21 -0
  47. package/src/components/table.tsx +92 -0
  48. package/src/components/tabs.tsx +62 -0
  49. package/src/components/textarea.tsx +18 -0
  50. package/src/components/toggle-pills.tsx +32 -0
  51. package/src/components/tooltip.tsx +67 -0
  52. package/src/hooks/use-mobile.ts +21 -0
  53. package/src/lib/easing.ts +5 -0
  54. package/src/lib/initials.ts +12 -0
  55. package/src/lib/utils.ts +6 -0
  56. package/theme.css +141 -0
@@ -0,0 +1,18 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "../lib/utils"
4
+
5
+ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
6
+ return (
7
+ <textarea
8
+ data-slot="textarea"
9
+ className={cn(
10
+ "flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ export { Textarea }
@@ -0,0 +1,32 @@
1
+ import { Button } from "./button";
2
+
3
+ interface TogglePillsProps {
4
+ options: readonly string[];
5
+ selected: string[];
6
+ onToggle: (value: string) => void;
7
+ }
8
+
9
+ export function TogglePills({ options, selected, onToggle }: TogglePillsProps) {
10
+ return (
11
+ <div className="flex flex-wrap gap-1.5">
12
+ {options.map((option) => {
13
+ const isSelected = selected.includes(option);
14
+ return (
15
+ <Button
16
+ key={option}
17
+ type="button"
18
+ variant={isSelected ? "default" : "outline"}
19
+ onClick={() => onToggle(option)}
20
+ className={`text-xs px-2.5 h-8 border border-transparent rounded-full ${
21
+ isSelected
22
+ ? "border-foreground bg-foreground text-background"
23
+ : "border-border text-muted-foreground"
24
+ }`}
25
+ >
26
+ {option}
27
+ </Button>
28
+ );
29
+ })}
30
+ </div>
31
+ );
32
+ }
@@ -0,0 +1,67 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
5
+
6
+ import { cn } from "../lib/utils";
7
+
8
+ function TooltipProvider({
9
+ delayDuration = 0,
10
+ ...props
11
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
12
+ return (
13
+ <TooltipPrimitive.Provider
14
+ data-slot="tooltip-provider"
15
+ delayDuration={delayDuration}
16
+ {...props}
17
+ />
18
+ );
19
+ }
20
+
21
+ function TooltipRoot({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
22
+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
23
+ }
24
+
25
+ function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
26
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
27
+ }
28
+
29
+ function TooltipContent({
30
+ className,
31
+ sideOffset = 0,
32
+ children,
33
+ ...props
34
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
35
+ return (
36
+ <TooltipPrimitive.Portal>
37
+ <TooltipPrimitive.Content
38
+ data-slot="tooltip-content"
39
+ sideOffset={sideOffset}
40
+ className={cn(
41
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
42
+ className,
43
+ )}
44
+ {...props}
45
+ >
46
+ {children}
47
+ <TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
48
+ </TooltipPrimitive.Content>
49
+ </TooltipPrimitive.Portal>
50
+ );
51
+ }
52
+
53
+ type TooltipProps = {
54
+ children: React.ReactElement;
55
+ content: React.ReactNode;
56
+ } & Omit<React.ComponentProps<typeof TooltipContent>, "children" | "content">;
57
+
58
+ function Tooltip({ children, content, ...contentProps }: TooltipProps) {
59
+ return (
60
+ <TooltipRoot>
61
+ <TooltipTrigger asChild>{children}</TooltipTrigger>
62
+ <TooltipContent {...contentProps}>{content}</TooltipContent>
63
+ </TooltipRoot>
64
+ );
65
+ }
66
+
67
+ export { Tooltip, TooltipRoot, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+
5
+ const MOBILE_BREAKPOINT = 768;
6
+
7
+ export function useIsMobile() {
8
+ const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);
9
+
10
+ React.useEffect(() => {
11
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
12
+ const onChange = () => {
13
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
14
+ };
15
+ mql.addEventListener("change", onChange);
16
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
17
+ return () => mql.removeEventListener("change", onChange);
18
+ }, []);
19
+
20
+ return !!isMobile;
21
+ }
@@ -0,0 +1,5 @@
1
+ export const EASING_FUNCTION = {
2
+ exponential: [0.16, 1, 0.3, 1],
3
+ quartic: [0.78, 0, 0.22, 1],
4
+ dialog: [0.43, 0.07, 0.59, 0.94],
5
+ } as const;
@@ -0,0 +1,12 @@
1
+ export function getInitials(name: string | null, fallback = "C"): string {
2
+ if (!name) return fallback;
3
+
4
+ const parts = name
5
+ .trim()
6
+ .split(/\s+/)
7
+ .slice(0, 2)
8
+ .map((part) => part[0]?.toUpperCase())
9
+ .filter(Boolean);
10
+
11
+ return parts.join("") || fallback;
12
+ }
@@ -0,0 +1,6 @@
1
+ import { type ClassValue, clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
package/theme.css ADDED
@@ -0,0 +1,141 @@
1
+ /*
2
+ * Import after tailwindcss in the app's globals.css:
3
+ * @import "tailwindcss";
4
+ * @import "tw-animate-css";
5
+ * @import "shadcn/tailwind.css";
6
+ * @import "@inbeat/ui/theme.css";
7
+ * @source makes Tailwind scan this package; node_modules is skipped otherwise.
8
+ */
9
+ @source "./src";
10
+
11
+ @custom-variant dark (&:is(.dark *));
12
+
13
+ @theme inline {
14
+ --color-background: var(--background);
15
+ --color-foreground: var(--foreground);
16
+ --font-sans: var(--font-geist-sans);
17
+ --font-mono: var(--font-geist-mono);
18
+ --color-sidebar-ring: var(--sidebar-ring);
19
+ --color-sidebar-border: var(--sidebar-border);
20
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
21
+ --color-sidebar-accent: var(--sidebar-accent);
22
+ --color-sidebar-foreground: var(--sidebar-foreground);
23
+ --color-sidebar: var(--sidebar);
24
+ --color-ring: var(--ring);
25
+ --color-input: var(--input);
26
+ --color-border: var(--border);
27
+ --color-destructive: var(--destructive);
28
+ --color-accent-foreground: var(--accent-foreground);
29
+ --color-accent: var(--accent);
30
+ --color-muted-foreground: var(--muted-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-secondary-foreground: var(--secondary-foreground);
33
+ --color-secondary: var(--secondary);
34
+ --color-primary-foreground: var(--primary-foreground);
35
+ --color-primary: var(--primary);
36
+ --color-popover-foreground: var(--popover-foreground);
37
+ --color-popover: var(--popover);
38
+ --color-card-foreground: var(--card-foreground);
39
+ --color-card: var(--card);
40
+ --color-cream: var(--cream);
41
+ --radius-sm: calc(var(--radius) - 4px);
42
+ --radius-md: calc(var(--radius) - 2px);
43
+ --radius-lg: var(--radius);
44
+ --radius-xl: calc(var(--radius) + 4px);
45
+ --radius-2xl: calc(var(--radius) + 8px);
46
+ --radius-3xl: calc(var(--radius) + 12px);
47
+ --radius-4xl: calc(var(--radius) + 16px);
48
+ --shadow-hairline: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
49
+ --shadow-subtle: 0px 4px 8px -2px rgba(0, 0, 0, 0.06), 0px 2px 4px -2px rgba(0, 0, 0, 0.04);
50
+ --shadow-elevated: 0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05);
51
+ }
52
+
53
+ :root {
54
+ --card: oklch(1 0 0);
55
+ --card-foreground: oklch(0.145 0 0);
56
+ --popover: oklch(1 0 0);
57
+ --popover-foreground: oklch(0.145 0 0);
58
+ --primary: oklch(0.205 0 0);
59
+ --primary-foreground: oklch(0.985 0 0);
60
+ --secondary: oklch(0.97 0 0);
61
+ --secondary-foreground: oklch(0.205 0 0);
62
+ --muted: oklch(0.97 0 0);
63
+ --muted-foreground: oklch(0.556 0 0);
64
+ --accent: oklch(0.97 0 0);
65
+ --accent-foreground: oklch(0.205 0 0);
66
+ --destructive: oklch(0.53 0.19 27);
67
+ --border: oklch(0.922 0 0);
68
+ --input: oklch(0.922 0 0);
69
+ --ring: oklch(0.708 0 0);
70
+ --radius: 0.625rem;
71
+ --cream: #f3f3f3;
72
+ --sidebar: hsl(0 0% 98%);
73
+ --sidebar-foreground: hsl(240 5.3% 26.1%);
74
+ --sidebar-accent: hsl(240 4.8% 95.9%);
75
+ --sidebar-accent-foreground: hsl(240 5.9% 10%);
76
+ --sidebar-border: hsl(220 13% 91%);
77
+ --sidebar-ring: hsl(217.2 91.2% 59.8%);
78
+ --background: oklch(1 0 0);
79
+ --foreground: oklch(0.145 0 0);
80
+ }
81
+
82
+ .dark {
83
+ --background: #101012;
84
+ --foreground: oklch(0.985 0 0);
85
+ --card: oklch(0.08 0.003 264);
86
+ --card-foreground: oklch(0.985 0 0);
87
+ --popover: oklch(0.08 0.003 264);
88
+ --popover-foreground: oklch(0.985 0 0);
89
+ --primary: oklch(0.922 0 0);
90
+ --primary-foreground: oklch(0.205 0 0);
91
+ --secondary: oklch(0.32 0 0);
92
+ --secondary-foreground: oklch(0.985 0 0);
93
+ --muted: oklch(0.32 0 0);
94
+ --muted-foreground: oklch(0.708 0 0);
95
+ --accent: oklch(0.32 0 0);
96
+ --accent-foreground: oklch(0.985 0 0);
97
+ --destructive: oklch(0.68 0.15 22);
98
+ --border: oklch(1 0 0 / 10%);
99
+ --input: oklch(1 0 0 / 15%);
100
+ --ring: oklch(0.556 0 0);
101
+ --sidebar: #080808;
102
+ --sidebar-foreground: hsl(240 4.8% 95.9%);
103
+ --sidebar-accent: hsl(240 4% 6%);
104
+ --sidebar-accent-foreground: hsl(240 4.8% 95.9%);
105
+ --sidebar-border: hsl(240 4% 6%);
106
+ --sidebar-ring: hsl(217.2 91.2% 59.8%);
107
+ }
108
+
109
+ @layer base {
110
+ * {
111
+ @apply border-border outline-ring/50;
112
+ }
113
+
114
+ body {
115
+ @apply bg-background text-foreground;
116
+ }
117
+
118
+ button,
119
+ a {
120
+ @apply rounded;
121
+ }
122
+
123
+ :is(
124
+ button,
125
+ a[href],
126
+ summary,
127
+ select,
128
+ label[for],
129
+ input:is([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"]),
130
+ [role="button"],
131
+ [role="link"],
132
+ [role="tab"],
133
+ [role="option"],
134
+ [role="checkbox"],
135
+ [role="radio"],
136
+ [role="switch"],
137
+ [role^="menuitem"]
138
+ ):not(:disabled, [aria-disabled="true"], [data-disabled]) {
139
+ cursor: pointer;
140
+ }
141
+ }