create-astram-app 0.1.2 → 0.2.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 (101) hide show
  1. package/dist/add-frontend.js +107 -0
  2. package/dist/add-frontend.js.map +1 -0
  3. package/dist/index.js +132 -33
  4. package/dist/index.js.map +1 -1
  5. package/package.json +3 -2
  6. package/template/CLAUDE.md +51 -0
  7. package/template/README.md +43 -44
  8. package/template/_gitignore +6 -0
  9. package/template/frontend/FRONTEND.md +92 -0
  10. package/template/frontend/README.md +16 -0
  11. package/template/frontend/_env.example +6 -0
  12. package/template/frontend/_gitignore +9 -0
  13. package/template/frontend/eslint.config.js +71 -0
  14. package/template/frontend/index.html +13 -0
  15. package/template/frontend/package.json +52 -0
  16. package/template/frontend/public/astram-logo-full.png +0 -0
  17. package/template/frontend/public/astram-logo-white.png +0 -0
  18. package/template/frontend/public/favicon.png +0 -0
  19. package/template/frontend/src/App.jsx +167 -0
  20. package/template/frontend/src/auth/AuthContext.jsx +338 -0
  21. package/template/frontend/src/components/ConfirmDialog.jsx +92 -0
  22. package/template/frontend/src/components/EntityFormModal.jsx +154 -0
  23. package/template/frontend/src/components/EntityList.jsx +480 -0
  24. package/template/frontend/src/components/PageHeader.jsx +54 -0
  25. package/template/frontend/src/components/access/CollapsibleGroup.jsx +34 -0
  26. package/template/frontend/src/components/ui/alert-dialog.tsx +175 -0
  27. package/template/frontend/src/components/ui/alert.tsx +83 -0
  28. package/template/frontend/src/components/ui/avatar.tsx +51 -0
  29. package/template/frontend/src/components/ui/badge.tsx +56 -0
  30. package/template/frontend/src/components/ui/button.tsx +67 -0
  31. package/template/frontend/src/components/ui/card.tsx +92 -0
  32. package/template/frontend/src/components/ui/checkbox.tsx +30 -0
  33. package/template/frontend/src/components/ui/date-field.tsx +47 -0
  34. package/template/frontend/src/components/ui/dialog.tsx +214 -0
  35. package/template/frontend/src/components/ui/dropdown-menu.tsx +255 -0
  36. package/template/frontend/src/components/ui/input-otp.tsx +81 -0
  37. package/template/frontend/src/components/ui/input.tsx +21 -0
  38. package/template/frontend/src/components/ui/label.tsx +46 -0
  39. package/template/frontend/src/components/ui/searchable-select.tsx +459 -0
  40. package/template/frontend/src/components/ui/select.tsx +199 -0
  41. package/template/frontend/src/components/ui/separator.tsx +26 -0
  42. package/template/frontend/src/components/ui/sheet.tsx +139 -0
  43. package/template/frontend/src/components/ui/skeleton.tsx +13 -0
  44. package/template/frontend/src/components/ui/sonner.tsx +23 -0
  45. package/template/frontend/src/components/ui/table.tsx +181 -0
  46. package/template/frontend/src/components/ui/tooltip.tsx +59 -0
  47. package/template/frontend/src/config/branding.js +80 -0
  48. package/template/frontend/src/hooks/useMobile.tsx +21 -0
  49. package/template/frontend/src/index.css +265 -0
  50. package/template/frontend/src/lib/utils.js +7 -0
  51. package/template/frontend/src/main.jsx +27 -0
  52. package/template/frontend/src/pages/Dashboard.jsx +127 -0
  53. package/template/frontend/src/pages/ForgotPassword.jsx +104 -0
  54. package/template/frontend/src/pages/Login.jsx +393 -0
  55. package/template/frontend/src/pages/ResetPassword.jsx +159 -0
  56. package/template/frontend/src/pages/access/AccessForm.jsx +416 -0
  57. package/template/frontend/src/pages/access/AccessPage.jsx +282 -0
  58. package/template/frontend/src/pages/access/RoleActionsMenu.jsx +42 -0
  59. package/template/frontend/src/pages/account/AccountLayout.jsx +229 -0
  60. package/template/frontend/src/pages/account/ChangePasswordPage.jsx +235 -0
  61. package/template/frontend/src/pages/account/ProfilePage.jsx +122 -0
  62. package/template/frontend/src/pages/account/ReenrollPage.jsx +98 -0
  63. package/template/frontend/src/pages/account/TwoFactorPage.jsx +833 -0
  64. package/template/frontend/src/pages/audit/AuditPage.jsx +268 -0
  65. package/template/frontend/src/pages/companies/CompaniesPage.jsx +232 -0
  66. package/template/frontend/src/pages/companies/CompanyForm.jsx +127 -0
  67. package/template/frontend/src/pages/roles/RoleForm.jsx +99 -0
  68. package/template/frontend/src/pages/roles/RolesPage.jsx +207 -0
  69. package/template/frontend/src/pages/users/AssignmentsEditor.jsx +193 -0
  70. package/template/frontend/src/pages/users/MembershipCard.jsx +303 -0
  71. package/template/frontend/src/pages/users/PostingRow.jsx +264 -0
  72. package/template/frontend/src/pages/users/UserForm.jsx +167 -0
  73. package/template/frontend/src/pages/users/UsersPage.jsx +232 -0
  74. package/template/frontend/src/platform/httpClient.js +125 -0
  75. package/template/frontend/src/platform/returnPathStore.js +43 -0
  76. package/template/frontend/src/platform/sessionStore.js +29 -0
  77. package/template/frontend/src/platform/shieldTransport.js +172 -0
  78. package/template/frontend/src/platform/shieldTransport.test.mjs +245 -0
  79. package/template/frontend/src/shell/AppShell.jsx +237 -0
  80. package/template/frontend/src/shell/Sidebar.jsx +257 -0
  81. package/template/frontend/src/shell/nav.js +90 -0
  82. package/template/frontend/src/theme/ThemeProvider.jsx +14 -0
  83. package/template/frontend/src/theme/ThemeToggle.jsx +44 -0
  84. package/template/frontend/tsconfig.json +22 -0
  85. package/template/frontend/vite.config.js +30 -0
  86. package/template/server/_env.example +45 -0
  87. package/template/server/eslint.config.js +95 -0
  88. package/template/server/package.json +49 -0
  89. package/template/server/scripts/dev.mjs +51 -0
  90. package/template/server/scripts/sync-astram-guide.mjs +63 -0
  91. package/template/_env.example +0 -33
  92. package/template/package.json +0 -37
  93. /package/template/{src → server/src}/app.module.ts +0 -0
  94. /package/template/{src → server/src}/features/_gitkeep +0 -0
  95. /package/template/{src → server/src}/health/demo.controller.ts +0 -0
  96. /package/template/{src → server/src}/health/health.controller.ts +0 -0
  97. /package/template/{src → server/src}/main.ts +0 -0
  98. /package/template/{test → server/test}/enforcement.e2e.spec.ts +0 -0
  99. /package/template/{tsconfig.build.json → server/tsconfig.build.json} +0 -0
  100. /package/template/{tsconfig.json → server/tsconfig.json} +0 -0
  101. /package/template/{vitest.config.ts → server/vitest.config.ts} +0 -0
@@ -0,0 +1,214 @@
1
+ import { cn } from "@/lib/utils";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ import { XIcon } from "lucide-react";
4
+ import * as React from "react";
5
+
6
+ // Context to track composition state across dialog children
7
+ const DialogCompositionContext = React.createContext<{
8
+ isComposing: () => boolean;
9
+ setComposing: (composing: boolean) => void;
10
+ justEndedComposing: () => boolean;
11
+ markCompositionEnd: () => void;
12
+ }>({
13
+ isComposing: () => false,
14
+ setComposing: () => {},
15
+ justEndedComposing: () => false,
16
+ markCompositionEnd: () => {},
17
+ });
18
+
19
+ export const useDialogComposition = () =>
20
+ React.useContext(DialogCompositionContext);
21
+
22
+ function Dialog({
23
+ ...props
24
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
25
+ const composingRef = React.useRef(false);
26
+ const justEndedRef = React.useRef(false);
27
+ const endTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
28
+
29
+ const contextValue = React.useMemo(
30
+ () => ({
31
+ isComposing: () => composingRef.current,
32
+ setComposing: (composing: boolean) => {
33
+ composingRef.current = composing;
34
+ },
35
+ justEndedComposing: () => justEndedRef.current,
36
+ markCompositionEnd: () => {
37
+ justEndedRef.current = true;
38
+ if (endTimerRef.current) {
39
+ clearTimeout(endTimerRef.current);
40
+ }
41
+ endTimerRef.current = setTimeout(() => {
42
+ justEndedRef.current = false;
43
+ }, 150);
44
+ },
45
+ }),
46
+ []
47
+ );
48
+
49
+ return (
50
+ <DialogCompositionContext.Provider value={contextValue}>
51
+ <DialogPrimitive.Root data-slot="dialog" {...props} />
52
+ </DialogCompositionContext.Provider>
53
+ );
54
+ }
55
+
56
+ function DialogTrigger({
57
+ ...props
58
+ }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
59
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
60
+ }
61
+
62
+ function DialogPortal({
63
+ ...props
64
+ }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
65
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
66
+ }
67
+
68
+ function DialogClose({
69
+ ...props
70
+ }: React.ComponentProps<typeof DialogPrimitive.Close>) {
71
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
72
+ }
73
+
74
+ // forwardRef: on React 18 a function component cannot receive a ref, but Radix's
75
+ // Presence/Slot attaches one to the overlay for animation/measurement. Without
76
+ // forwardRef this logs "Function components cannot be given refs" (harmless but
77
+ // noisy). Forwarding the ref to the Radix primitive silences it correctly.
78
+ const DialogOverlay = React.forwardRef<
79
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
80
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
81
+ >(({ className, ...props }, ref) => {
82
+ return (
83
+ <DialogPrimitive.Overlay
84
+ ref={ref}
85
+ data-slot="dialog-overlay"
86
+ className={cn(
87
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ );
93
+ });
94
+
95
+ DialogOverlay.displayName = "DialogOverlay";
96
+
97
+ function DialogContent({
98
+ className,
99
+ children,
100
+ showCloseButton = true,
101
+ onEscapeKeyDown,
102
+ ...props
103
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
104
+ showCloseButton?: boolean;
105
+ }) {
106
+ const { isComposing } = useDialogComposition();
107
+
108
+ const handleEscapeKeyDown = React.useCallback(
109
+ (e: KeyboardEvent) => {
110
+ // Check both the native isComposing property and our context state
111
+ // This handles Safari's timing issues with composition events
112
+ const isCurrentlyComposing = (e as any).isComposing || isComposing();
113
+
114
+ // If IME is composing, prevent dialog from closing
115
+ if (isCurrentlyComposing) {
116
+ e.preventDefault();
117
+ return;
118
+ }
119
+
120
+ // Call user's onEscapeKeyDown if provided
121
+ onEscapeKeyDown?.(e);
122
+ },
123
+ [isComposing, onEscapeKeyDown]
124
+ );
125
+
126
+ return (
127
+ <DialogPortal data-slot="dialog-portal">
128
+ <DialogOverlay />
129
+ <DialogPrimitive.Content
130
+ data-slot="dialog-content"
131
+ className={cn(
132
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100vw-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
133
+ className
134
+ )}
135
+ onEscapeKeyDown={handleEscapeKeyDown}
136
+ {...props}
137
+ >
138
+ {children}
139
+ {showCloseButton && (
140
+ <DialogPrimitive.Close
141
+ data-slot="dialog-close"
142
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
143
+ >
144
+ <XIcon />
145
+ <span className="sr-only">Close</span>
146
+ </DialogPrimitive.Close>
147
+ )}
148
+ </DialogPrimitive.Content>
149
+ </DialogPortal>
150
+ );
151
+ }
152
+
153
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
154
+ return (
155
+ <div
156
+ data-slot="dialog-header"
157
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
158
+ {...props}
159
+ />
160
+ );
161
+ }
162
+
163
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
164
+ return (
165
+ <div
166
+ data-slot="dialog-footer"
167
+ className={cn(
168
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
169
+ className
170
+ )}
171
+ {...props}
172
+ />
173
+ );
174
+ }
175
+
176
+ function DialogTitle({
177
+ className,
178
+ ...props
179
+ }: React.ComponentProps<typeof DialogPrimitive.Title>) {
180
+ return (
181
+ <DialogPrimitive.Title
182
+ data-slot="dialog-title"
183
+ className={cn("text-lg leading-none font-semibold", className)}
184
+ {...props}
185
+ />
186
+ );
187
+ }
188
+
189
+ function DialogDescription({
190
+ className,
191
+ ...props
192
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
193
+ return (
194
+ <DialogPrimitive.Description
195
+ data-slot="dialog-description"
196
+ className={cn("text-muted-foreground text-sm", className)}
197
+ {...props}
198
+ />
199
+ );
200
+ }
201
+
202
+ export {
203
+ Dialog,
204
+ DialogClose,
205
+ DialogContent,
206
+ DialogDescription,
207
+ DialogFooter,
208
+ DialogHeader,
209
+ DialogOverlay,
210
+ DialogPortal,
211
+ DialogTitle,
212
+ DialogTrigger
213
+ };
214
+
@@ -0,0 +1,255 @@
1
+ import * as React from "react";
2
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
3
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ function DropdownMenu({
8
+ ...props
9
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
10
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
11
+ }
12
+
13
+ function DropdownMenuPortal({
14
+ ...props
15
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
16
+ return (
17
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
18
+ );
19
+ }
20
+
21
+ function DropdownMenuTrigger({
22
+ ...props
23
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
24
+ return (
25
+ <DropdownMenuPrimitive.Trigger
26
+ data-slot="dropdown-menu-trigger"
27
+ {...props}
28
+ />
29
+ );
30
+ }
31
+
32
+ function DropdownMenuContent({
33
+ className,
34
+ sideOffset = 4,
35
+ ...props
36
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
37
+ return (
38
+ <DropdownMenuPrimitive.Portal>
39
+ <DropdownMenuPrimitive.Content
40
+ data-slot="dropdown-menu-content"
41
+ sideOffset={sideOffset}
42
+ className={cn(
43
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ </DropdownMenuPrimitive.Portal>
49
+ );
50
+ }
51
+
52
+ function DropdownMenuGroup({
53
+ ...props
54
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
55
+ return (
56
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
57
+ );
58
+ }
59
+
60
+ function DropdownMenuItem({
61
+ className,
62
+ inset,
63
+ variant = "default",
64
+ ...props
65
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
66
+ inset?: boolean;
67
+ variant?: "default" | "destructive";
68
+ }) {
69
+ return (
70
+ <DropdownMenuPrimitive.Item
71
+ data-slot="dropdown-menu-item"
72
+ data-inset={inset}
73
+ data-variant={variant}
74
+ className={cn(
75
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ );
81
+ }
82
+
83
+ function DropdownMenuCheckboxItem({
84
+ className,
85
+ children,
86
+ checked,
87
+ ...props
88
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
89
+ return (
90
+ <DropdownMenuPrimitive.CheckboxItem
91
+ data-slot="dropdown-menu-checkbox-item"
92
+ className={cn(
93
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
94
+ className
95
+ )}
96
+ checked={checked}
97
+ {...props}
98
+ >
99
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
100
+ <DropdownMenuPrimitive.ItemIndicator>
101
+ <CheckIcon className="size-4" />
102
+ </DropdownMenuPrimitive.ItemIndicator>
103
+ </span>
104
+ {children}
105
+ </DropdownMenuPrimitive.CheckboxItem>
106
+ );
107
+ }
108
+
109
+ function DropdownMenuRadioGroup({
110
+ ...props
111
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
112
+ return (
113
+ <DropdownMenuPrimitive.RadioGroup
114
+ data-slot="dropdown-menu-radio-group"
115
+ {...props}
116
+ />
117
+ );
118
+ }
119
+
120
+ function DropdownMenuRadioItem({
121
+ className,
122
+ children,
123
+ ...props
124
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
125
+ return (
126
+ <DropdownMenuPrimitive.RadioItem
127
+ data-slot="dropdown-menu-radio-item"
128
+ className={cn(
129
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
130
+ className
131
+ )}
132
+ {...props}
133
+ >
134
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
135
+ <DropdownMenuPrimitive.ItemIndicator>
136
+ <CircleIcon className="size-2 fill-current" />
137
+ </DropdownMenuPrimitive.ItemIndicator>
138
+ </span>
139
+ {children}
140
+ </DropdownMenuPrimitive.RadioItem>
141
+ );
142
+ }
143
+
144
+ function DropdownMenuLabel({
145
+ className,
146
+ inset,
147
+ ...props
148
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
149
+ inset?: boolean;
150
+ }) {
151
+ return (
152
+ <DropdownMenuPrimitive.Label
153
+ data-slot="dropdown-menu-label"
154
+ data-inset={inset}
155
+ className={cn(
156
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
157
+ className
158
+ )}
159
+ {...props}
160
+ />
161
+ );
162
+ }
163
+
164
+ function DropdownMenuSeparator({
165
+ className,
166
+ ...props
167
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
168
+ return (
169
+ <DropdownMenuPrimitive.Separator
170
+ data-slot="dropdown-menu-separator"
171
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
172
+ {...props}
173
+ />
174
+ );
175
+ }
176
+
177
+ function DropdownMenuShortcut({
178
+ className,
179
+ ...props
180
+ }: React.ComponentProps<"span">) {
181
+ return (
182
+ <span
183
+ data-slot="dropdown-menu-shortcut"
184
+ className={cn(
185
+ "text-muted-foreground ml-auto text-xs tracking-widest",
186
+ className
187
+ )}
188
+ {...props}
189
+ />
190
+ );
191
+ }
192
+
193
+ function DropdownMenuSub({
194
+ ...props
195
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
196
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
197
+ }
198
+
199
+ function DropdownMenuSubTrigger({
200
+ className,
201
+ inset,
202
+ children,
203
+ ...props
204
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
205
+ inset?: boolean;
206
+ }) {
207
+ return (
208
+ <DropdownMenuPrimitive.SubTrigger
209
+ data-slot="dropdown-menu-sub-trigger"
210
+ data-inset={inset}
211
+ className={cn(
212
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
213
+ className
214
+ )}
215
+ {...props}
216
+ >
217
+ {children}
218
+ <ChevronRightIcon className="ml-auto size-4" />
219
+ </DropdownMenuPrimitive.SubTrigger>
220
+ );
221
+ }
222
+
223
+ function DropdownMenuSubContent({
224
+ className,
225
+ ...props
226
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
227
+ return (
228
+ <DropdownMenuPrimitive.SubContent
229
+ data-slot="dropdown-menu-sub-content"
230
+ className={cn(
231
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
232
+ className
233
+ )}
234
+ {...props}
235
+ />
236
+ );
237
+ }
238
+
239
+ export {
240
+ DropdownMenu,
241
+ DropdownMenuPortal,
242
+ DropdownMenuTrigger,
243
+ DropdownMenuContent,
244
+ DropdownMenuGroup,
245
+ DropdownMenuLabel,
246
+ DropdownMenuItem,
247
+ DropdownMenuCheckboxItem,
248
+ DropdownMenuRadioGroup,
249
+ DropdownMenuRadioItem,
250
+ DropdownMenuSeparator,
251
+ DropdownMenuShortcut,
252
+ DropdownMenuSub,
253
+ DropdownMenuSubTrigger,
254
+ DropdownMenuSubContent,
255
+ };
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+ import { OTPInput, OTPInputContext } from 'input-otp';
3
+ import { Minus } from 'lucide-react';
4
+
5
+ import { cn } from '@/lib/utils';
6
+
7
+ /** Standard shadcn input-otp (new-york), built on the `input-otp` primitive. */
8
+ // forwardRef so a caller can hold the underlying <input> (input-otp forwards its ref to
9
+ // the real input) — used to refocus the boxes after a failed submit, since React 18 drops
10
+ // `ref` on a plain function component.
11
+ const InputOTP = React.forwardRef<
12
+ React.ElementRef<typeof OTPInput>,
13
+ React.ComponentProps<typeof OTPInput> & { containerClassName?: string }
14
+ >(({ className, containerClassName, ...props }, ref) => {
15
+ return (
16
+ <OTPInput
17
+ ref={ref}
18
+ data-slot="input-otp"
19
+ containerClassName={cn(
20
+ 'flex items-center gap-2 has-disabled:opacity-50',
21
+ containerClassName,
22
+ )}
23
+ className={cn('disabled:cursor-not-allowed', className)}
24
+ {...props}
25
+ />
26
+ );
27
+ });
28
+ InputOTP.displayName = 'InputOTP';
29
+
30
+ function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>) {
31
+ // gap-2 separates the slots into individual boxes (vs the joined shadcn default).
32
+ return (
33
+ <div
34
+ data-slot="input-otp-group"
35
+ className={cn('flex items-center gap-2', className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function InputOTPSlot({
42
+ index,
43
+ className,
44
+ ...props
45
+ }: React.ComponentProps<'div'> & {
46
+ index: number;
47
+ }) {
48
+ const inputOTPContext = React.useContext(OTPInputContext);
49
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
50
+
51
+ return (
52
+ <div
53
+ data-slot="input-otp-slot"
54
+ data-active={isActive}
55
+ className={cn(
56
+ // Each slot is a SEPARATE rounded box (full border + rounded on all sides),
57
+ // spaced by the group's gap — the boxed OTP look, not the joined shadcn bar.
58
+ 'data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-12 w-12 items-center justify-center rounded-lg border text-lg font-mono shadow-xs transition-all outline-none data-[active=true]:z-10 data-[active=true]:ring-[3px]',
59
+ className,
60
+ )}
61
+ {...props}
62
+ >
63
+ {char}
64
+ {hasFakeCaret && (
65
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
66
+ <div className="bg-foreground h-4 w-px animate-pulse" />
67
+ </div>
68
+ )}
69
+ </div>
70
+ );
71
+ }
72
+
73
+ function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>) {
74
+ return (
75
+ <div data-slot="input-otp-separator" role="separator" {...props}>
76
+ <Minus />
77
+ </div>
78
+ );
79
+ }
80
+
81
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { cn } from '@/lib/utils';
3
+
4
+ /** Standard shadcn input (new-york). */
5
+ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
12
+ 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
13
+ 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
14
+ className,
15
+ )}
16
+ {...props}
17
+ />
18
+ );
19
+ }
20
+
21
+ export { Input };
@@ -0,0 +1,46 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ /**
8
+ * Label — default is the standard shadcn label (existing callers unchanged).
9
+ *
10
+ * The `field` variant is the signature OCA form-label look (translated from
11
+ * `.form-label`): MONO, UPPERCASE, tiny (.72rem), wide letter-spacing (.08em),
12
+ * tinted the brand color (`--primary`). Phase B forms use `variant="field"` for
13
+ * the OCA-crisp field labels.
14
+ */
15
+ const labelVariants = cva(
16
+ "flex items-center gap-2 leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
17
+ {
18
+ variants: {
19
+ variant: {
20
+ default: "text-sm font-medium",
21
+ field:
22
+ "font-mono text-[0.72rem] font-semibold tracking-[0.08em] uppercase text-primary",
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ variant: "default",
27
+ },
28
+ }
29
+ );
30
+
31
+ function Label({
32
+ className,
33
+ variant,
34
+ ...props
35
+ }: React.ComponentProps<typeof LabelPrimitive.Root> &
36
+ VariantProps<typeof labelVariants>) {
37
+ return (
38
+ <LabelPrimitive.Root
39
+ data-slot="label"
40
+ className={cn(labelVariants({ variant }), className)}
41
+ {...props}
42
+ />
43
+ );
44
+ }
45
+
46
+ export { Label, labelVariants };